NeoPZ
TPZStrMatrixGCTP.h
Go to the documentation of this file.
1 #ifndef TPZStructMatrixGCTP_H
2 #define TPZStructMatrixGCTP_H
3 
4 #include <set>
5 #include <map>
6 #include <semaphore.h>
7 #include "pzvec.h"
8 #include "tpzautopointer.h"
9 #include "pzcmesh.h"
10 #include "pzelmat.h"
11 #include "TPZSemaphore.h"
12 #include "TPZEquationFilter.h"
13 #include "TPZGuiInterface.h"
14 #include "pzmatrix.h"
15 #include "pzfmatrix.h"
16 
18 #include "TPZStructMatrixBase.h"
19 
20 #ifdef USING_BOOST
21 #include <boost/atomic.hpp>
22 #endif
23 
30 public:
31 
33  }
34 
36 
38 
40 
42  };
43 
44  virtual TPZMatrix<STATE> * Create() override;
45 
47  unsigned numthreads_assemble, unsigned numthreads_decompose) {
48  SetNumThreads(numthreads_assemble);
49  return CreateAssemble(rhs, guiInterface);
50  }
51 
53 
54  virtual TPZStructMatrixGCTP * Clone() override;
55 
57  virtual void Assemble(TPZMatrix<STATE> & mat, TPZFMatrix<STATE> & rhs, TPZAutoPointer<TPZGuiInterface> guiInterface) override;
58 
60  unsigned numthreads_assemble, unsigned numthreads_decompose) {
61  std::cout << "Nothing to do." << std::endl;
62  }
63 
65  virtual void Assemble(TPZFMatrix<STATE> & rhs, TPZAutoPointer<TPZGuiInterface> guiInterface) override;
66 
67 public:
68  int ClassId() const override;
69  void Read(TPZStream &buf, void *context) override;
70  void Write(TPZStream &buf, int withclassid) const override;
71 
72 protected:
73 
76 
78  virtual void Serial_Assemble(TPZFMatrix<STATE> & rhs, TPZAutoPointer<TPZGuiInterface> guiInterface);
79 
82 
85 
86 public:
87 
89  static void OrderElement(TPZCompMesh *cmesh, TPZVec<int64_t> &ElementOrder);
90 
92  bool ShouldCompute(int matid) const override {
93  const size_t size = fMaterialIds.size();
94  return size == 0 || fMaterialIds.find(matid) != fMaterialIds.end();
95  }
96 
98  const std::set<int> &MaterialIds() override {
99  return fMaterialIds;
100  }
101 
102 protected:
103 
106  int64_t fNColors;
107 };
108 
109 #endif
Contains declaration of the TPZSemaphore class which implements semaphore to threads.
virtual ~TPZStructMatrixGCTP()
void Read(TPZStream &buf, void *context) override
read objects from the stream
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.
Templated vector implementation.
Contains declaration of TPZGuiInterface class.
static void OrderElement(TPZCompMesh *cmesh, TPZVec< int64_t > &ElementOrder)
Find the order to assemble the elements.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
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.
const std::set< int > & MaterialIds() override
Returns the material ids.
bool ShouldCompute(int matid) const override
Establish whether the element should be computed.
virtual void Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
int ClassId() const override
Define the class id associated with the class.
virtual TPZMatrix< STATE > * Create() override
Contains TPZMatrixclass which implements full matrix (using column major representation).
virtual void SetNumThreads(int n)
It is responsible for a interface between Matrix and Finite Element classes. Structural Matrix This c...
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
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 void MultiThread_Assemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global right hand side.
Contains TPZMatrix<TVar>class, root matrix class.
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
virtual TPZStructMatrixGCTP * Clone() override
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
TPZVec< int64_t > fElementColors
TPZManVector< int64_t > fElementOrder