43 static LoggerPtr logger(Logger::getLogger(
"pz.strmatrix.frontstructmatrix"));
48 pthread_mutex_t
mutex = PTHREAD_MUTEX_INITIALIZER;
57 pthread_cond_t
stackfull = PTHREAD_COND_INITIALIZER;
114 if (logger->isDebugEnabled())
116 std::stringstream sout;
117 sout <<
"Entering cond_wait because of stack overflow ";
121 PZ_PTHREAD_COND_WAIT(&stackfull,&mutex_element_assemble,
"TPZParFrontStructMatrix<front>::ElementAssemble()");
139 if (logger->isDebugEnabled())
141 std::stringstream sout;
142 sout <<
"Computing element " << local_element;
168 PZ_PTHREAD_MUTEX_LOCK(&mutex_global_assemble,
"TPZParFrontStructMatrix<front>::ElementGlobalAssemble()");
179 if (logger->isDebugEnabled())
181 std::stringstream sout;
217 if (logger->isDebugEnabled())
219 std::stringstream sout;
220 sout << __PRETTY_FUNCTION__ <<
" Falling through";
224 std::cout << __PRETTY_FUNCTION__ <<
" Falling through \n";
234 template<
class front>
271 int matid = mat->
Id();
282 if(!submesh && ! elgrp && ! condel)
294 if (logger->isDebugEnabled())
296 std::stringstream sout;
297 sout <<
"Acquired mutex_global_assemble";
301 while(aux != local_element){
303 if(parfront->
felnum[i] == local_element){
305 aux = parfront->
felnum[i];
316 parfront->
felnum[i] = itemp;
324 if(aux!=local_element){
327 if (logger->isDebugEnabled())
329 std::stringstream sout;
330 sout <<
"Waiting on condassemble";
334 PZ_PTHREAD_COND_WAIT(&condassemble, &mutex_global_assemble,
"TPZParFrontStructMatrix<front>::GlobalAssemble()");
338 if (logger->isDebugEnabled())
340 std::stringstream sout;
341 sout <<
"Unlocking mutex_global_assemble";
357 if (logger->isDebugEnabled())
359 std::stringstream sout;
360 sout <<
"fFinishedComputing set to 1";
383 if (logger->isDebugEnabled())
385 std::stringstream sout;
386 sout <<
"Terminating assemble thread";
390 cout <<
"Matrix assembled\n";
396 template<
class front>
409 cout << __PRETTY_FUNCTION__ <<
" we are in serious trouble : wrong type of matrix"<< endl;
420 cout <<
"Number of Threads " << this->
fNumThreads << endl;
425 pthread_t *allthreads =
new pthread_t[
nthreads];
445 if (logger->isDebugEnabled()) {
446 std::stringstream sout;
473 if(!res[nthreads-1]){
475 cout <<
"GlobalAssemble Thread created Successfuly "<< allthreads[nthreads-1].x << endl;
477 cout <<
"GlobalAssemble Thread created Successfuly "<< allthreads[nthreads-1] << endl;
482 cout <<
"GlobalAssemble Thread Fail "<< allthreads[nthreads-1].x << endl;
484 cout <<
"GlobalAssemble Thread Fail "<< allthreads[nthreads-1] << endl;
491 if(!res[nthreads-2]){
493 cout <<
"WriteFile Thread created Successfuly "<< allthreads[nthreads-2].x << endl;
495 cout <<
"WriteFile Thread created Successfuly "<< allthreads[nthreads-2] << endl;
500 cout <<
"WriteFile Thread Fail "<< allthreads[nthreads-2].x << endl;
502 cout <<
"WriteFile Thread Fail "<< allthreads[nthreads-2] << endl;
508 for(i=0;i<nthreads-2;i++){
513 cout <<
"ElementAssemble Thread "<< i+1 <<
" created Successfuly "<< allthreads[i].x << endl;
515 cout <<
"ElementAssemble Thread "<< i+1 <<
" created Successfuly "<< allthreads[i] << endl;
519 cout <<
"Error " << res[i] <<
"\t";
521 cout <<
"ElementAssemble Thread "<< i+1 <<
" Fail " << allthreads[i].x << endl;
523 cout <<
"ElementAssemble Thread "<< i+1 <<
" Fail " << allthreads[i] << endl;
541 #ifndef STATE_COMPLEX 544 template<
class front>
552 double coordstore[4][3] = {{0.,0.,0.},{1.,0.,0.},{1.,1.,0.},
559 for (j=0; j<3; j++) coord[j] = coordstore[i][j];
568 for(el=0; el<1; el++) {
572 for(i=0; i<4; i++) indices[i] = i;
584 cout <<
"Refinement ";
603 cout <<
"Interpolation order ";
614 ofstream output(
"outputPar.dat");
625 ofstream out(
"cmeshBlock_out.txt");
632 if(seqn < 0)
continue;
634 int64_t lasteq = firsteq+cmesh.
Block().
Size(seqn);
636 int temp = cmesh.
ConnectVec()[ic].NElConnected();
637 for(ind=firsteq;ind<lasteq;ind++) {
638 numelconnected[ind] = temp;
656 cout <<
"Number of Threads ";
683 an.
Print(
"solution of frontal solver", output);
722 template<
class front>
void GetNumElConnected(TPZVec< int > &numelconnected)
Returns a vector containing all elements connected to a degree of freedom.
int64_t NElements() const
Number of computational elements allocated.
int fNumThreads
Number of threads in Assemble process.
#define PZ_PTHREAD_MUTEX_UNLOCK(mutex, fn)
Contains the TPZFrontSym class which implements decomposition process of the frontal matrix (case sym...
void OrderElement()
It is applied over fElementOrder putting it in the correct order.
pthread_mutex_t mutex
Semaphore which controls multiple threads.
Contains TPZAnalysis class which implements the sequence of actions to perform a finite element analy...
TPZStack< TPZElementMatrix * > fekstack
int Position(const int block_diagonal) const
Returns the position of first element block dependent on matrix diagonal.
clarg::argInt num_threads("-ntdec", "Number of threads to decompose in TPZParFrontStructMatrix.", 6)
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
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.
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
FrontMatrix with parallel techniques included. Frontal.
void Print(const std::string &name, std::ostream &out)
Print connect and solution information.
virtual TPZGeoEl * CreateGeoElement(MElementType type, TPZVec< int64_t > &cornerindexes, int matid, int64_t &index, int reftype=1)
Generic method for creating a geometric element. Putting this method centrally facilitates the modifi...
Contains the TPZFrontStructMatrix class which responsible for a interface among Finite Element Packag...
int64_t fCurrentAssembled
Current assembled element in the global stiffness matrix.
TPZFront< TVar > & GetFront() override
returns a pointer to the front matrix
int64_t NEquations()
This computes the number of equations associated with non-restrained nodes.
Contains the declaration of the TPZElementGroup class, which implements an computational element whic...
pthread_cond_t condassemble
Semaphore which controls condensed assembling.
pthread_mutex_t mutex_global_assemble
Semaphore which controls thread assembling global matrices.
Defines step solvers class. Solver.
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Returns a pointer to TPZMatrix.
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
Contains the TPZFrontNonSym class which implements storage and decomposition process of the frontal m...
static void * WriteFile(void *t)
Used in an independent thread to write decomposed equations to a binary file.
static void * GlobalAssemble(void *t)
It assembles element matrices in the global stiffness matrix, it is also executed in an independent t...
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
TPZEquationFilter fEquationFilter
Object which will determine which equations will be assembled.
Contains the TPZParFrontMatrix class which implements FrontMatrix with parallel techniques.
Abstract class implements storage and decomposition process of the frontal matrix involving simmetry ...
Class which groups elements to characterize dense matrices.
int64_t NElements() const
Access method to query the number of elements of the vector.
Implements a chunk vector with free store administration. Utility.
#define PZ_PTHREAD_COND_WAIT(cond, mutex, fn)
Contains the TPZStructMatrixOR class which responsible for a interface among Matrix and Finite Elemen...
TPZParFrontStructMatrix(TPZCompMesh *mesh)
Constructor passing as parameter a TPZCompMesh.
void ProductTensorMTInitData(int nthreads)
Contains the TPZFStructMatrix class which implements Full Structural Matrices.
void SetDefaultOrder(int order)
Refines geometrical mesh (all the elements) num times.
This abstract class defines the behaviour which each derived class needs to implement.
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
TPZCompMesh * fMesh
Pointer to the computational mesh from which the matrix will be generated.
#define PZ_PTHREAD_JOIN(thread, val, fn)
DecomposeType fDecomposeType
Used Decomposition method.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
TPZVec< int > fElementOrder
This vector contains an ordered list.
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
void AssembleElement(TPZCompEl *el, TPZElementMatrix &ek, TPZElementMatrix &ef, TPZMatrix< STATE > &stiffness, TPZFMatrix< STATE > &rhs)
Computes element matrices.
static void * ElementAssemble(void *t)
It computes element matrices in an independent thread.
Implements the sequence of actions to perform a finite element analysis. Analysis.
void Push(const T object)
Pushes a copy of the object on the stack.
int64_t NActiveEquations() const
Retorna o numero de equacoes ativas do sistema.
#define PZ_PTHREAD_MUTEX_LOCK(mutex, fn)
TPZAutoPointer< TPZGuiInterface > fGuiInterface
Implements a group of computational elements as a mesh and an element. Computational Mesh...
#define DebugStop()
Returns a message to user put a breakpoint in.
TPZStructMatrix * Clone()
It clones a TPZStructMatrix.
virtual void SetNumThreads(int n)
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
void SetNumElConnected(TPZVec< int > &numelconnected)
Initializes the number of elements connected to each equation.
void ProductTensorMTFinish()
void
virtual void AutoBuild(const std::set< int > *MaterialIDs)
Creates the computational elements, and the degree of freedom nodes.
int HasDependency() const
Returns whether exist dependecy information.
pthread_cond_t stackfull
Semaphore.
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Responsible for a interface among Finite Element Package and Matrices package to frontal method...
Contains the TPZMat2dLin class which implements a bi-dimensional linear problem.
int fMaxStackSize
Maximum stack size allowed.
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Class which implements an element which condenses the internal connects.
virtual bool ShouldCompute(int matid) const
Establish whether the element should be computed.
Contains declaration of TPZCompMesh class which is a repository for computational elements...
Contains the TPZFileEqnStorage class which implements an equation array and stores the EqnArrays...
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
void SetMaterial(TPZFMatrix< STATE > &xkin, TPZFMatrix< STATE > &xcin, TPZFMatrix< STATE > &xfin)
virtual void Run(std::ostream &out=std::cout)
Calls the appropriate sequence of methods to build a solution or a time stepping sequence.
pthread_mutex_t mutex_element_assemble
Semaphore which controls threads assembling elements.
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
virtual void SetDecomposeType(DecomposeType dectype)=0
Set the decomposition type.
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.
Contains declaration of TPZSubCompMesh class which implements a group of computational elements as a ...
int64_t fCurrentElement
Current computed element.
int InsertMaterialObject(TPZMaterial *mat)
Insert a material object in the datastructure.
T Pop()
Retrieve an object from the stack.
virtual void Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble a stiffness matrix.
This class implements a geometric mesh for the pz environment. Geometry.
Implements a bi-dimensional linear problem.
Implements computational mesh. Computational Mesh.
int Size(const int block_diagonal) const
Returns block dimension.
const T & get_value() const
Contains the TPZAbstractFrontMatrix class which implements a matrix stored in a frontal decomposition...
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Contains TPZSolver class which defines a abstract class of solvers which will be used by matrix class...
#define PZ_PTHREAD_CREATE(thread, attr, routine, args, fn)
Contains TPZStepSolver class which defines step solvers class.
int64_t NElements() const
Returns the number of elements of the vector.
int64_t fNElements
Total number of elements.
void FinishWriting()
Sets the flag fFinish to its true value.
void SetDirect(const DecomposeType decomp)
Contains the TPZDXGraphMesh class which implements the interface of the graphmesh to the OpenDX graph...
void InitializeBlock()
Resequence the block object, remove unconnected connect objects and reset the dimension of the soluti...
virtual ~TPZParFrontStructMatrix()
Destructor.
TPZFMatrix< STATE > * fRhs
Local pointer to load matrix.
TPZStack< int64_t > felnum
Stack containing elements to be assembled on Stiffness matrix.
Is a structural matrix with parallel techniques included. Structural Matrix Frontal.
Defines the interface of a computational element. Computational Element.
bool IsCondensed() const
Access method to return the indication whether the connect is condensed or not.
TPZMatrix< STATE > * fStiffness
Local pointer to stiffness matrix.
TPZStack< TPZElementMatrix * > fefstack
Contains the declaration of the TPZCondensedCompEl class, which implements an computational element w...
Contains the TPZParFrontStructMatrix class which is a structural matrix with parallel techniques incl...
Abstract class implements storage and decomposition process of the frontal matrix involving non-simet...
virtual void Print(std::ostream &out=std::cout) const
Prints mesh data.
#define PZ_PTHREAD_COND_BROADCAST(cond, fn)