NeoPZ
|
Contains the thread data for matrices divided in sub structures. More...
#include <tpzpairstructmatrix.h>
Public Member Functions | |
ThreadData (TPZStructMatrix *strmatrix, TPZMatrix< STATE > &mat1, TPZMatrix< STATE > &mat2, TPZFMatrix< STATE > &rhs) | |
Initialize the mutex semaphores and others. More... | |
~ThreadData () | |
Destroy the mutex semaphores and others. More... | |
int | NextElement () |
Look for an element index which needs to be computed and put it on the stack. More... | |
void | ComputedElementMatrix (int 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... | |
void | PermuteScatter (TPZVec< int > &index) |
void | PermuteScatter (TPZVec< int64_t > &index) |
Static Public Member Functions | |
static void * | ThreadWork (void *threaddata) |
The function which will compute the matrices. More... | |
static void * | ThreadAssembly1 (void *threaddata) |
The function which will compute the assembly. More... | |
static void * | ThreadAssembly2 (void *threaddata) |
The function which will compute the assembly. More... | |
Public Attributes | |
TPZStructMatrix * | fStrMatrix |
Current structmatrix object. More... | |
pthread_mutex_t | fAccessElement |
Mutexes (to choose which element is next) More... | |
TPZSemaphore | fAssembly1 |
Semaphore (to wake up the first assembly thread) More... | |
TPZSemaphore | fAssembly2 |
Semaphore (to wake up the second assembly thread) More... | |
TPZMatrix< STATE > * | fGlobMatrix1 |
Global matrix1. More... | |
TPZMatrix< STATE > * | fGlobMatrix2 |
Global matrix2. More... | |
TPZFMatrix< STATE > * | fGlobRhs |
Global rhs. More... | |
TPZVec< int > | fPermuteScatter |
Vector which defines the permutation of all equations to internal equations. More... | |
std::map< int, std::pair< TPZAutoPointer< TPZElementMatrix >, TPZAutoPointer< TPZElementMatrix > > > | fSubmitted1 |
List of computed element matrices (autopointers?) More... | |
std::map< int, TPZAutoPointer< TPZElementMatrix > > | fSubmitted2 |
List of computed element matrices (autopointers?) More... | |
std::set< int > | fProcessed1 |
Elements which are being processed maintained by the first global matrix. More... | |
std::set< int > | fProcessed2 |
Elements which are being processed maintained by the second global matrix. More... | |
int | fNextElement |
Current element. More... | |
Contains the thread data for matrices divided in sub structures.
Definition at line 60 of file tpzpairstructmatrix.h.
TPZPairStructMatrix::ThreadData::ThreadData | ( | TPZStructMatrix * | strmatrix, |
TPZMatrix< STATE > & | mat1, | ||
TPZMatrix< STATE > & | mat2, | ||
TPZFMatrix< STATE > & | rhs | ||
) |
Initialize the mutex semaphores and others.
Definition at line 590 of file tpzpairstructmatrix.cpp.
References fAccessElement, and PZ_PTHREAD_MUTEX_INIT.
TPZPairStructMatrix::ThreadData::~ThreadData | ( | ) |
Destroy the mutex semaphores and others.
Definition at line 598 of file tpzpairstructmatrix.cpp.
References fAccessElement, and PZ_PTHREAD_MUTEX_DESTROY.
void TPZPairStructMatrix::ThreadData::ComputedElementMatrix | ( | int | iel, |
TPZAutoPointer< TPZElementMatrix > & | ek, | ||
TPZAutoPointer< TPZElementMatrix > & | ef | ||
) |
Put the computed element matrices in the map.
Definition at line 868 of file tpzpairstructmatrix.cpp.
References fAccessElement, fAssembly1, fAssembly2, fSubmitted1, fSubmitted2, TPZSemaphore::Post(), PZ_PTHREAD_MUTEX_LOCK, and PZ_PTHREAD_MUTEX_UNLOCK.
Referenced by ThreadWork().
int TPZPairStructMatrix::ThreadData::NextElement | ( | ) |
Look for an element index which needs to be computed and put it on the stack.
Definition at line 817 of file tpzpairstructmatrix.cpp.
References TPZCompMesh::ElementVec(), fAccessElement, fNextElement, fProcessed1, fProcessed2, fStrMatrix, TPZMaterial::Id(), LOGPZ_DEBUG, TPZCompEl::Material(), TPZStructMatrixBase::MaterialIds(), TPZStructMatrixBase::Mesh(), TPZSubCompMesh::NeedsComputing(), TPZChunkVector< T, EXP >::NElements(), PZ_PTHREAD_MUTEX_LOCK, PZ_PTHREAD_MUTEX_UNLOCK, and ShouldCompute().
Referenced by ThreadWork().
void TPZPairStructMatrix::ThreadData::PermuteScatter | ( | TPZVec< int > & | index | ) |
Definition at line 657 of file tpzpairstructmatrix.cpp.
References fPermuteScatter, and TPZVec< T >::NElements().
Referenced by ShouldCompute(), and ThreadAssembly2().
void TPZPairStructMatrix::ThreadData::PermuteScatter | ( | TPZVec< int64_t > & | index | ) |
Definition at line 666 of file tpzpairstructmatrix.cpp.
References fPermuteScatter, and TPZVec< T >::NElements().
|
inline |
Establish whether the element should be computed.
Definition at line 104 of file tpzpairstructmatrix.h.
References PermuteScatter(), and TPZStructMatrixBase::ShouldCompute().
Referenced by NextElement().
|
static |
The function which will compute the assembly.
Definition at line 678 of file tpzpairstructmatrix.cpp.
References TPZFMatrix< TVar >::AddFel(), TPZMatrix< TVar >::AddKel(), fAccessElement, fAssembly1, TPZElementMatrix::fConstrMat, TPZElementMatrix::fDestinationIndex, fGlobMatrix1, fGlobRhs, TPZElementMatrix::fMat, fNextElement, fProcessed1, TPZElementMatrix::fSourceIndex, fStrMatrix, fSubmitted1, TPZElementMatrix::HasDependency(), LOGPZ_DEBUG, TPZStructMatrixBase::Mesh(), TPZCompMesh::NElements(), PZ_PTHREAD_MUTEX_LOCK, PZ_PTHREAD_MUTEX_UNLOCK, and TPZSemaphore::Wait().
Referenced by TPZPairStructMatrix::MultiThread_Assemble().
|
static |
The function which will compute the assembly.
Definition at line 748 of file tpzpairstructmatrix.cpp.
References TPZMatrix< TVar >::AddKel(), fAccessElement, fAssembly2, TPZElementMatrix::fConstrMat, TPZElementMatrix::fDestinationIndex, fGlobMatrix2, TPZElementMatrix::fMat, fNextElement, fProcessed2, TPZElementMatrix::fSourceIndex, fStrMatrix, fSubmitted2, TPZElementMatrix::HasDependency(), LOGPZ_DEBUG, TPZStructMatrixBase::Mesh(), TPZCompMesh::NElements(), PermuteScatter(), PZ_PTHREAD_MUTEX_LOCK, PZ_PTHREAD_MUTEX_UNLOCK, and TPZSemaphore::Wait().
Referenced by TPZPairStructMatrix::MultiThread_Assemble().
|
static |
The function which will compute the matrices.
Definition at line 603 of file tpzpairstructmatrix.cpp.
References TPZElementMatrix::ApplyConstraints(), TPZCompEl::CalcStiff(), ComputedElementMatrix(), TPZElementMatrix::ComputeDestinationIndices(), TPZElementMatrix::EF, TPZElementMatrix::EK, TPZCompMesh::ElementVec(), fAssembly1, fAssembly2, TPZElementMatrix::fDestinationIndex, TPZStructMatrixBase::FilterEquations(), TPZElementMatrix::fMat, TPZElementMatrix::fSourceIndex, fStrMatrix, TPZCompEl::HasDependency(), LOGPZ_DEBUG, TPZStructMatrixBase::Mesh(), TPZCompMesh::NElements(), NextElement(), TPZSemaphore::Post(), and TPZMatrix< TVar >::Print().
Referenced by TPZPairStructMatrix::MultiThread_Assemble().
pthread_mutex_t TPZPairStructMatrix::ThreadData::fAccessElement |
Mutexes (to choose which element is next)
Definition at line 69 of file tpzpairstructmatrix.h.
Referenced by ComputedElementMatrix(), NextElement(), ThreadAssembly1(), ThreadAssembly2(), ThreadData(), and ~ThreadData().
TPZSemaphore TPZPairStructMatrix::ThreadData::fAssembly1 |
Semaphore (to wake up the first assembly thread)
Definition at line 71 of file tpzpairstructmatrix.h.
Referenced by ComputedElementMatrix(), ThreadAssembly1(), and ThreadWork().
TPZSemaphore TPZPairStructMatrix::ThreadData::fAssembly2 |
Semaphore (to wake up the second assembly thread)
Definition at line 73 of file tpzpairstructmatrix.h.
Referenced by ComputedElementMatrix(), ThreadAssembly2(), and ThreadWork().
TPZMatrix<STATE>* TPZPairStructMatrix::ThreadData::fGlobMatrix1 |
Global matrix1.
Definition at line 75 of file tpzpairstructmatrix.h.
Referenced by ThreadAssembly1().
TPZMatrix<STATE>* TPZPairStructMatrix::ThreadData::fGlobMatrix2 |
Global matrix2.
Definition at line 77 of file tpzpairstructmatrix.h.
Referenced by ThreadAssembly2().
TPZFMatrix<STATE>* TPZPairStructMatrix::ThreadData::fGlobRhs |
int TPZPairStructMatrix::ThreadData::fNextElement |
Current element.
Definition at line 91 of file tpzpairstructmatrix.h.
Referenced by NextElement(), ThreadAssembly1(), and ThreadAssembly2().
TPZVec<int> TPZPairStructMatrix::ThreadData::fPermuteScatter |
Vector which defines the permutation of all equations to internal equations.
Definition at line 81 of file tpzpairstructmatrix.h.
Referenced by TPZPairStructMatrix::MultiThread_Assemble(), and PermuteScatter().
std::set<int> TPZPairStructMatrix::ThreadData::fProcessed1 |
Elements which are being processed maintained by the first global matrix.
Definition at line 87 of file tpzpairstructmatrix.h.
Referenced by NextElement(), and ThreadAssembly1().
std::set<int> TPZPairStructMatrix::ThreadData::fProcessed2 |
Elements which are being processed maintained by the second global matrix.
Definition at line 89 of file tpzpairstructmatrix.h.
Referenced by NextElement(), and ThreadAssembly2().
TPZStructMatrix* TPZPairStructMatrix::ThreadData::fStrMatrix |
Current structmatrix object.
Definition at line 67 of file tpzpairstructmatrix.h.
Referenced by NextElement(), TPZPairStructMatrix::SetMaterialIds(), ThreadAssembly1(), ThreadAssembly2(), and ThreadWork().
std::map<int, std::pair< TPZAutoPointer<TPZElementMatrix>, TPZAutoPointer<TPZElementMatrix> > > TPZPairStructMatrix::ThreadData::fSubmitted1 |
List of computed element matrices (autopointers?)
Definition at line 83 of file tpzpairstructmatrix.h.
Referenced by ComputedElementMatrix(), and ThreadAssembly1().
std::map<int, TPZAutoPointer<TPZElementMatrix> > TPZPairStructMatrix::ThreadData::fSubmitted2 |
List of computed element matrices (autopointers?)
Definition at line 85 of file tpzpairstructmatrix.h.
Referenced by ComputedElementMatrix(), and ThreadAssembly2().