![]() |
NeoPZ
|
Structure to manipulate thread to solve system equations. More...
#include <pzstrmatrix.h>
Public Member Functions | |
ThreadData (TPZStructMatrixOR *strmat, TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, std::set< int > &MaterialIds, TPZAutoPointer< TPZGuiInterface > guiInterface) | |
Initialize the mutex semaphores and others. More... | |
ThreadData (TPZStructMatrixOR *strmat, TPZFMatrix< STATE > &rhs, std::set< int > &MaterialIds, TPZAutoPointer< TPZGuiInterface > guiInterface) | |
Initialize the mutex semaphores and others. More... | |
~ThreadData () | |
Destructor: Destroy the mutex semaphores and others. More... | |
int64_t | NextElement () |
Look for an element index which needs to be computed and put it on the stack. More... | |
void | ComputedElementMatrix (int64_t iel, TPZAutoPointer< TPZElementMatrix > &ek, TPZAutoPointer< TPZElementMatrix > &ef) |
Put the computed element matrices in the map. More... | |
bool | ShouldCompute (int matid) |
Establish whether the element should be computed. More... | |
Static Public Member Functions | |
static void * | ThreadWork (void *threaddata) |
The function which will compute the matrices. More... | |
static void * | ThreadAssembly (void *threaddata) |
The function which will compute the assembly. More... | |
Public Attributes | |
TPZStructMatrixOR * | fStruct |
Current structmatrix object. More... | |
TPZAutoPointer< TPZGuiInterface > | fGuiInterface |
Gui interface object. More... | |
TPZMatrix< STATE > * | fGlobMatrix |
Global matrix. More... | |
TPZFMatrix< STATE > * | fGlobRhs |
Global rhs vector. More... | |
std::map< int, std::pair< TPZAutoPointer< TPZElementMatrix >, TPZAutoPointer< TPZElementMatrix > > > | fSubmitted |
List of computed element matrices (autopointers?) More... | |
std::set< int > | fProcessed |
Elements which are being processed. More... | |
int64_t | fNextElement |
Current element. More... | |
pthread_mutex_t | fAccessElement |
Mutexes (to choose which element is next) More... | |
TPZSemaphore | fAssembly |
Semaphore (to wake up assembly thread) More... | |
Structure to manipulate thread to solve system equations.
Definition at line 40 of file pzstrmatrix.h.
TPZStructMatrixOR::ThreadData::ThreadData | ( | TPZStructMatrixOR * | strmat, |
TPZMatrix< STATE > & | mat, | ||
TPZFMatrix< STATE > & | rhs, | ||
std::set< int > & | MaterialIds, | ||
TPZAutoPointer< TPZGuiInterface > | guiInterface | ||
) |
Initialize the mutex semaphores and others.
Definition at line 527 of file pzstrmatrix.cpp.
References fAccessElement, and PZ_PTHREAD_MUTEX_INIT.
TPZStructMatrixOR::ThreadData::ThreadData | ( | TPZStructMatrixOR * | strmat, |
TPZFMatrix< STATE > & | rhs, | ||
std::set< int > & | MaterialIds, | ||
TPZAutoPointer< TPZGuiInterface > | guiInterface | ||
) |
Initialize the mutex semaphores and others.
Definition at line 572 of file pzstrmatrix.cpp.
References fAccessElement, and PZ_PTHREAD_MUTEX_INIT.
TPZStructMatrixOR::ThreadData::~ThreadData | ( | ) |
Destructor: Destroy the mutex semaphores and others.
Definition at line 604 of file pzstrmatrix.cpp.
References fAccessElement, and PZ_PTHREAD_MUTEX_DESTROY.
void TPZStructMatrixOR::ThreadData::ComputedElementMatrix | ( | int64_t | iel, |
TPZAutoPointer< TPZElementMatrix > & | ek, | ||
TPZAutoPointer< TPZElementMatrix > & | ef | ||
) |
Put the computed element matrices in the map.
Definition at line 886 of file pzstrmatrix.cpp.
References fAccessElement, fAssembly, fSubmitted, TPZSemaphore::Post(), PZ_PTHREAD_MUTEX_LOCK, and PZ_PTHREAD_MUTEX_UNLOCK.
Referenced by ThreadWork().
int64_t TPZStructMatrixOR::ThreadData::NextElement | ( | ) |
Look for an element index which needs to be computed and put it on the stack.
Definition at line 854 of file pzstrmatrix.cpp.
References TPZCompMesh::ElementVec(), fAccessElement, TPZStructMatrixBase::fMaterialIds, TPZStructMatrixBase::fMesh, fNextElement, fProcessed, fStruct, LOGPZ_DEBUG, TPZCompEl::NeedsComputing(), TPZChunkVector< T, EXP >::NElements(), PZ_PTHREAD_MUTEX_LOCK, and PZ_PTHREAD_MUTEX_UNLOCK.
Referenced by ThreadWork().
|
inline |
Establish whether the element should be computed.
Definition at line 57 of file pzstrmatrix.h.
References fStruct, and TPZStructMatrixBase::ShouldCompute().
|
static |
The function which will compute the assembly.
Definition at line 735 of file pzstrmatrix.cpp.
References TPZFMatrix< TVar >::AddFel(), TPZMatrix< TVar >::AddKel(), TPZGuiInterface::AmIKilled(), EMathematicaInput, fAccessElement, fAssembly, TPZElementMatrix::fConstrMat, TPZElementMatrix::fDestinationIndex, fGlobMatrix, fGlobRhs, fGuiInterface, TPZElementMatrix::fMat, TPZStructMatrixBase::fMesh, fNextElement, fProcessed, TPZElementMatrix::fSourceIndex, fStruct, fSubmitted, TPZElementMatrix::HasDependency(), LOGPZ_DEBUG, LOGPZ_ERROR, TPZCompMesh::NElements(), TPZMatrix< TVar >::Print(), PZ_PTHREAD_MUTEX_LOCK, PZ_PTHREAD_MUTEX_UNLOCK, and TPZSemaphore::Wait().
Referenced by TPZStructMatrixOR::MultiThread_Assemble().
|
static |
The function which will compute the matrices.
Definition at line 617 of file pzstrmatrix.cpp.
References TPZGuiInterface::AmIKilled(), TPZElementMatrix::ApplyConstraints(), TPZCompEl::CalcResidual(), TPZCompEl::CalcStiff(), ComputedElementMatrix(), TPZElementMatrix::ComputeDestinationIndices(), DebugStop, TPZElementMatrix::EF, TPZElementMatrix::EK, TPZCompMesh::ElementVec(), fAccessElement, fAssembly, TPZElementMatrix::fConstrMat, TPZElementMatrix::fDestinationIndex, fGlobMatrix, fGuiInterface, TPZStructMatrixBase::FilterEquations(), TPZElementMatrix::fMat, TPZStructMatrixBase::fMesh, TPZElementMatrix::fSourceIndex, fStruct, TPZCompEl::HasDependency(), TPZStructMatrixBase::HasRange(), TPZInterpolationSpace::InitializeElementMatrix(), TPZCompEl::IsInterface(), LOGPZ_DEBUG, TPZGeoEl::MaterialId(), TPZCompMesh::NElements(), NextElement(), TPZSemaphore::Post(), TPZElementMatrix::Print(), TPZMatrix< TVar >::Print(), TPZCompEl::Print(), TPZGeoEl::Print(), PZ_PTHREAD_MUTEX_LOCK, PZ_PTHREAD_MUTEX_UNLOCK, and TPZCompEl::Reference().
Referenced by TPZStructMatrixOR::MultiThread_Assemble().
pthread_mutex_t TPZStructMatrixOR::ThreadData::fAccessElement |
Mutexes (to choose which element is next)
Definition at line 77 of file pzstrmatrix.h.
Referenced by ComputedElementMatrix(), NextElement(), ThreadAssembly(), ThreadData(), ThreadWork(), and ~ThreadData().
TPZSemaphore TPZStructMatrixOR::ThreadData::fAssembly |
Semaphore (to wake up assembly thread)
Definition at line 79 of file pzstrmatrix.h.
Referenced by ComputedElementMatrix(), ThreadAssembly(), and ThreadWork().
TPZMatrix<STATE>* TPZStructMatrixOR::ThreadData::fGlobMatrix |
Global matrix.
Definition at line 67 of file pzstrmatrix.h.
Referenced by ThreadAssembly(), and ThreadWork().
TPZFMatrix<STATE>* TPZStructMatrixOR::ThreadData::fGlobRhs |
TPZAutoPointer<TPZGuiInterface> TPZStructMatrixOR::ThreadData::fGuiInterface |
Gui interface object.
Definition at line 65 of file pzstrmatrix.h.
Referenced by ThreadAssembly(), and ThreadWork().
int64_t TPZStructMatrixOR::ThreadData::fNextElement |
Current element.
Definition at line 75 of file pzstrmatrix.h.
Referenced by NextElement(), and ThreadAssembly().
std::set<int> TPZStructMatrixOR::ThreadData::fProcessed |
Elements which are being processed.
Definition at line 73 of file pzstrmatrix.h.
Referenced by NextElement(), and ThreadAssembly().
TPZStructMatrixOR* TPZStructMatrixOR::ThreadData::fStruct |
Current structmatrix object.
Definition at line 63 of file pzstrmatrix.h.
Referenced by NextElement(), ShouldCompute(), ThreadAssembly(), and ThreadWork().
std::map<int, std::pair< TPZAutoPointer<TPZElementMatrix>, TPZAutoPointer<TPZElementMatrix> > > TPZStructMatrixOR::ThreadData::fSubmitted |
List of computed element matrices (autopointers?)
Definition at line 71 of file pzstrmatrix.h.
Referenced by ComputedElementMatrix(), and ThreadAssembly().