15 #include "pzbfilestream.h" 34 #include "pzviscoelastic.h" 53 static LoggerPtr loggerconverge(Logger::getLogger(
"pz.converge"));
54 static LoggerPtr logger(Logger::getLogger(
"main"));
64 #include <sys/resource.h> 68 #include "tbb/task_scheduler_init.h" 86 cout <<
"Compute the Decompose_Cholesky, Decompose_LDLt, MultAdd methods for a matrix generated of a mesh" << endl;
88 cout <<
"Usage: " << prg <<
"-if file [-v verbose_level] " 89 <<
"[-clk_rdt rdt_file1] [-ldlt_rdt rdt_file2] [-mult_rdt rdt_file3] [-h]" << endl << endl;
100 #define VERBOSE(level,...) if (level <= verbose) cout << __VA_ARGS__ 178 int main(
int argc,
char *argv[])
184 cerr <<
"Error when parsing the arguments!" << endl;
196 std::cout <<
"- Arguments -----------------------" << std::endl;
198 std::cout <<
"-----------------------------------" << std::endl;
210 cmesh->SetDimModel(dim);
214 int64_t neq = cmesh->NEquations();
215 cout <<
"numero de equacoes = " << neq << endl;
271 float rtime1, ptime1, mflops1;
273 PAPI_flops ( &rtime1, &ptime1, &flpops1, &mflops1 );
277 float rtime2, ptime2, mflops2;
279 PAPI_flops ( &rtime2, &ptime2, &flpops2, &mflops2 );
283 cout <<
"skylmat1->Subst_Forward(&f)" << endl;
284 cout <<
" rtime: " << rtime2-rtime1 << endl;
285 cout <<
" ptime: " << ptime2-ptime1 << endl;
286 cout <<
" flpops: " << flpops2-flpops1 << endl;
287 cout <<
" mflops: " << mflops2-mflops1 << endl;
315 REAL overrelax = 1.1;
326 fp3.
SolveSOR(niter, f3, res2, &residual2, scratch2, overrelax, tol);
335 skylmat3->MultAdd(result, result, result, 1., 0);
340 fp4.
MultAdd(result2, result2, result2, 1., 0);
353 int nummat = 1, neumann = 1, mixed = 2;
355 int dir1 = -1, dir2 = -2, dir3 = -3, neumann1 = -4., neumann2 = -5;
359 STATE ElaE = 1000., poissonE = 0.2;
361 STATE lambdaV = 0, muV = 0, alpha = 0, deltaT = 0;
387 TPZBndCond *bc5 = viscoelast->
CreateBC(viscoelastauto, neumann2, neumann, val1, val2);
424 bool countnodes =
false;
425 bool countelements =
false;
427 ifstream
read (FileName.c_str());
432 read.getline(buf, 1024);
433 std::string str(buf);
434 if(str ==
"Coordinates") countnodes =
true;
435 if(str ==
"end coordinates") countnodes =
false;
436 if(countnodes) numnodes++;
438 if(str ==
"Elements") countelements =
true;
439 if(str ==
"end elements") countelements =
false;
440 if(countelements) numelements++;
446 gMesh -> NodeVec().Resize(numnodes);
450 const int Qnodes = numnodes;
454 int64_t nodeId = 0, elementId = 0, matElId = 1;
457 read.open(FileName.c_str());
459 double nodecoordX , nodecoordY , nodecoordZ ;
462 read.getline(buf, 1024);
463 read.getline(buf, 1024);
464 std::string str(buf);
466 for(in=0; in<numnodes; in++)
472 Node[nodeId-1].SetNodeId(nodeId);
473 Node[nodeId-1].SetCoord(0,nodecoordX);
474 Node[nodeId-1].SetCoord(1,nodecoordY);
475 Node[nodeId-1].SetCoord(2,nodecoordZ);
476 gMesh->
NodeVec()[nodeId-1] = Node[nodeId-1];
481 read.open(FileName.c_str());
483 int l ,
m = numnodes+5;
486 read.getline(buf, 1024);
491 int neumann1 = -4, neumann2 = -5;
493 for(el=0; el<numelements; el++)
496 read >> TopolTetra[0];
497 read >> TopolTetra[1];
498 read >> TopolTetra[2];
499 read >> TopolTetra[3];
515 for(el=0; el<numelements; el++)
523 for (
int i = 0; i < 4; i++)
526 Nodefinder[i] = gMesh->
NodeVec()[pos];
527 Nodefinder[i].GetCoordinates(nodecoord);
528 if (nodecoord[0] == 1.)
531 ncoordzVec.
Resize(sizeOfVec);
532 ncoordzVec[sizeOfVec-1] = pos;
545 for (
int i = 0; i < 4; i++)
548 Nodefinder[i] = gMesh->
NodeVec()[pos];
550 Nodefinder[i].GetCoordinates(nodecoord);
551 if (nodecoord[0] == -1.)
554 ncoordzVec.
Resize(sizeOfVec);
555 ncoordzVec[sizeOfVec-1] = pos;
570 int bcidxyz = -1, bcidyz = -2, bcidz = -3;
579 for (iref=0; iref<nref; iref++)
582 for (
int iel=0; iel<nelements; iel++)
590 ofstream arg(
"malhaPZ1BC.txt");
593 std::ofstream out(
"Cube.vtk");
607 for (iel = 0; iel<nelem; iel++) {
612 for (c=0; c<nc; c++) {
629 for (int64_t i = 0; i < skylmat1->
Rows(); i++) {
630 skylvec[i] = i - skylmat1->
Size(i) + 1 ;
634 for (
int i = 0; i < skylmat1->
Rows(); i++) {
635 for (
int j = 0 ; j < skylmat1->
Cols(); j++) {
643 cout <<
"Printing flop count info of " << funct << endl;
645 cout <<
"****************************" << endl;
static TPZCounter gCount
Containts the counter vector by operation performed.
Contains a class to record running statistics on CSV tables.
void InsertElasticityCubo(TPZAutoPointer< TPZCompMesh > mesh)
void PrintInfo(string funct, TPZCounter info)
TPZGeoNode * NodePtr(int i) const
Returns a pointer to the ith node of the element.
TPZGeoMesh * MalhaCubo(string FileName)
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
Contains declaration of the TPZMD5Stream class which implements the interface to write and check md5 ...
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
Implements a vector class which allows to use external storage provided by the user. Utility.
clarg::argBool h("-h", "help message", false)
clarg::argBool bc("-bc", "binary checkpoints", false)
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
Timing class. Absolutely copied from GNU time. Take a look at
Contains the TPZDohrSubstruct class which implements sub structure matrices using Dohrman algorithm...
void values(ostream &os, bool defined_only)
void OpenRead(const std::string &fn)
Contains the TPZVTKGraphMesh class which implements the graphical mesh to VTK environment.
Contains declaration of TPZCompEl class which defines the interface of a computational element...
Defines step solvers class. Solver.
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
virtual int NCornerNodes() const =0
Returns the number of corner nodes of the element.
This class implements a 3D isotropic elasticity material.
Contains the TPZDohrMatrix class which implements a matrix divided into substructures. Also contains the TPZDohrThreadMultData and TPZDohrThreadMultList structs.
virtual void Assemble()
Assemble the stiffness matrix and load vector.
int Decompose_Cholesky() override
Decomposes the current matrix using Cholesky method. The current matrix has to be symmetric...
int64_t NElements() const
Number of elements of the mesh.
virtual TPZMatrix< TVar > * Clone() const =0
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Contains declaration of TPZGeoElBC class, it is a structure to help the construction of geometric ele...
clarg::argString input("-if", "input file", "cube1.txt")
int64_t NElements() const
Access method to query the number of elements of the vector.
void OpenWrite(const std::string &fn)
int main(int argc, char *argv[])
virtual void Divide(TPZVec< TPZGeoEl *> &pv)
Divides the element and puts the resulting elements in the vector.
virtual int64_t NodeIndex(int i) const =0
Returns the index of the ith node the index is the location of the node in the nodevector of the mesh...
Contains the TPZDohrAssembly class which implements assembling using Dohrmann algorithm.
TPZMatrixSolver< STATE > & Solver()
Get the solver matrix.
void CopyTo(TPZSkylMatrix< REAL > *skylmat, TPZSkylMatrix< TPZFlopCounter > &fp_counter)
int WhichSide(TPZVec< int64_t > &SideNodeIds)
Returns the side number which is connected to the SideNodes returns -1 if no side is found...
Implements a skyline storage format. A Skyline matrix is symmetric so square. Matrix.
Contains the TPZDohrStructMatrix class which implements structural matrix divided in sub structures...
TPZGeoNode * FindNode(TPZVec< REAL > &co)
Returns the nearest node to the coordinate. This method is VERY INEFFICIENT.
Contains the TPZElasticity3D class which implements a 3D isotropic elasticity material.
clarg::argBool print_flops("-pf", "print floating point operations", false)
Implements SkyLine Structural Matrices. Structural Matrix.
This abstract class defines the behaviour which each derived class needs to implement.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
RunStatsTable sbck_rst("-sbck_rdt", "Subst_Backward(...) statistics raw data table")
int Zero() override
Makes Zero all the elements.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
Contains the TPZGenSubStruct class which is an interface to "feed" the datastructure of the Dohrmann ...
int Subst_Forward(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is lower triangular.
Implements the sequence of actions to perform a finite element analysis. Analysis.
void SetSkyline(const TPZVec< int64_t > &skyline)
modify the skyline of the matrix, throwing away its values skyline indicates the minimum row number w...
RunStatsTable mult_rst("-mult_rdt", "MultAdd(...) statistics raw data table")
Implements reading from and writing to an ascii file. Persistency.
virtual void Print(std::ostream &out=std::cout) const
Print the information of the grid to an ostream.
Implements a generic geometric element which is refined according to a generic refinement pattern...
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Contains the TPZGeoTetrahedra class which implements the geometry of a tetrahedral element...
void Print(std::ostream &out=std::cout) const
#define DebugStop()
Returns a message to user put a breakpoint in.
int parse_arguments(int argc, char *argv[])
This class defines the boundary condition for TPZMaterial objects.
Contains the TPZSkylineStructMatrix class which implements SkyLine Structural Matrices.
void SetPointBC(TPZGeoMesh *gr, TPZVec< REAL > &x, int bc)
Generate a boundary geometric element at the indicated node.
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Contains the TPZDohrPrecond class which implements a matrix which computes the preconditioner develop...
int64_t Rows() const
Returns number of rows.
int Decompose_LDLt() override
Decomposes the current matrix using LDLt.
void help(const char *prg)
Contains the TPZPairStructMatrix class.
Contains TPZSkyline class which implements a skyline storage format.
int64_t Size(const int64_t column) const
RunStatsTable sor_rst("-sor_rdt", "SolveSOR(...) statistics raw data table")
void arguments_descriptions(ostream &os, string prefix, string suffix)
RunStatsTable sfwd_rst("-sfwd_rdt", "Subst_Forward(...) statistics raw data table")
static void PrintGMeshVTK(TPZGeoMesh *gmesh, std::ofstream &file, bool matColor=true)
Default constructor for graphical mesh with VTK format.
int Subst_Backward(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is upper triangular.
void SetDimModel(int dim)
Set de dimension of the domain of the problem.
virtual void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha, const TVar beta, const int opt=0) const override
It computes z = beta * y + alpha * opt(this)*x but z and x can not overlap in memory.
int Redim(const int64_t newDim, const int64_t) override
Redimensions the matrix reinitializing it with zero.
virtual int HasSubElement() const =0
Return 1 if the element has subelements.
Structure to help the construction of geometric elements along side of a given geometric element...
virtual void SolveSOR(int64_t &numiterations, const TPZFMatrix< TVar > &F, TPZFMatrix< TVar > &result, TPZFMatrix< TVar > *residual, TPZFMatrix< TVar > &scratch, const REAL overrelax, REAL &tol, const int FromCurrent=0, const int direction=1) override
Solves the linear system using Successive Over Relaxation method (Gauss Seidel). ...
void BuildConnectivity()
Build the connectivity of the grid.
virtual TPZBndCond * CreateBC(TPZMaterial *reference, int id, int typ, TPZFMatrix< STATE > &val1, TPZFMatrix< STATE > &val2)
Creates an object TPZBndCond derived of TPZMaterial.
RunStatsTable ldlt_rst("-ldlt_rdt", "Decompose_LDLt() statistics raw data table")
int InsertMaterialObject(TPZMaterial *mat)
Insert a material object in the datastructure.
int PutVal(const int64_t row, const int64_t col, const TVar &element) override
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
Implements a counter by operations. Common.
Contains the TPZArc3D class which implements three dimensional arc.
Implements a geometric node in the pz environment. Geometry.
FileStreamWrapper(bool b)
This class implements a geometric mesh for the pz environment. Geometry.
Implements computational mesh. Computational Mesh.
const T & get_value() const
TPZAutoPointer< TPZMatrix< TVar > > Matrix() const
Returns a pointer to TPZMatrix<>
Contains TPZStepSolver class which defines step solvers class.
int64_t Cols() const
Returns number of cols.
Defines the interface for saving and reading data. Persistency.
int64_t NElements() const
Returns the number of elements of the vector.
void SetDirect(const DecomposeType decomp)
clarg::argInt porder("-porder", "polinomial order", 1)
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
Contains the TPZVTKGeoMesh class which implements the graphical mesh to VTK environment to geometric ...
RunStatsTable clk_rst("-clk_rdt", "Decompose_Cholesky() statistics raw data table")
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
clarg::argInt verb_level("-v", "verbosity level", 0)
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.