6 #ifndef TPZStructMatrixOT_H 7 #define TPZStructMatrixOT_H 11 #include <semaphore.h> 31 #include <boost/atomic.hpp> 61 unsigned numthreads_assemble,
unsigned numthreads_decompose) {
73 unsigned numthreads_assemble,
unsigned numthreads_decompose) {
74 std::cout <<
"Nothing to do." << std::endl;
154 boost::atomic<int64_t> *fCurrentIndex;
206 boost::atomic<int64_t> fCurrentIndex;
Contains declaration of the TPZSemaphore class which implements semaphore to threads.
int fSomeoneIsSleeping
variable indicating if a thread is sleeping
ThreadData(TPZStructMatrixOT *strmat, int seqnum, TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, std::set< int > &MaterialIds, TPZAutoPointer< TPZGuiInterface > guiInterface)
Initialize the mutex semaphores and others.
TPZVec< int64_t > * fElSequenceColor
TPZVec< int64_t > * fElBlocked
Vector for mesh coloring.
virtual void Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
static void * ThreadWorkResidual(void *datavoid)
virtual void Serial_Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global system of equations into the matrix which has already been created.
Templated vector implementation.
Contains declaration of TPZGuiInterface class.
~ThreadData()
Destructor: Destroy the mutex semaphores and others.
int ClassId() const override
Define the class id associated with the class.
Structure to manipulate thread to solve system equations.
void SetMaterialIds(const std::set< int > &materialids) override
Set the set of material ids which will be considered when assembling the system.
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
static void ElementColoring(TPZCompMesh *cmesh, TPZVec< int64_t > &elSequence, TPZVec< int64_t > &elSequenceColor, TPZVec< int64_t > &elBlocked, TPZVec< int64_t > &NumelColors)
Create blocks of elements to parallel processing.
int64_t * fElementCompleted
All elements below or equal this index have been computed.
static void * ThreadWork(void *threaddata)
The function which will compute the matrices.
virtual void FilterEquations(TPZVec< int64_t > &origindex, TPZVec< int64_t > &destindex) const override
Filter out the equations which are out of the range.
Refines geometrical mesh (all the elements) num times.
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
int64_t fElementCompleted
All elements below or equal this index have been computed.
TPZVec< int64_t > fElSequenceColor
virtual void MultiThread_Assemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global right hand side.
pthread_mutex_t fAccessElement
Mutexes (to choose which element is next)
const std::set< int > & MaterialIds() override
Returns the material ids.
bool ShouldCompute(int matid)
The function which will compute the assembly.
Contains TPZMatrixclass which implements full matrix (using column major representation).
virtual void SetNumThreads(int n)
virtual ~TPZStructMatrixOT()
TPZAutoPointer< TPZGuiInterface > fGuiInterface
Gui interface object.
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
TPZMatrix< STATE > * fGlobMatrix
Global matrix.
std::set< int > fMaterialIds
Set of material ids to be considered. It is a private attribute.
Contains declaration of TPZCompMesh class which is a repository for computational elements...
virtual TPZStructMatrixOT * Clone() override
Contains TPZMatrix<TVar>class, root matrix class.
TPZVec< int64_t > * fComputedElements
vector indicating whether an element has been computed
TPZFMatrix< STATE > * fGlobRhs
Global rhs vector.
void Read(TPZStream &buf, void *context) override
read objects from the stream
pthread_cond_t fCondition
Implements computational mesh. Computational Mesh.
int fThreadSeqNum
sequence number of the thread
pthread_mutex_t * fAccessElement
Mutexes (to choose which element is next)
Defines the interface for saving and reading data. Persistency.
virtual TPZMatrix< STATE > * Create() override
bool ShouldCompute(int matid) const override
Establish whether the element should be computed.
static void OrderElement(TPZCompMesh *cmesh, TPZVec< int64_t > &ElementOrder)
Find the order to assemble the elements.
virtual void Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface) override
Assemble the global system of equations into the matrix which has already been created.
pthread_cond_t * fCondition
TPZVec< int64_t > fElementsComputed
vector of the size of the elements containing 0 or 1 if the element has been computed (in the order o...
TPZStructMatrixOT * fStruct
Current structmatrix object.