NeoPZ
pzstrmatrixst.h
Go to the documentation of this file.
1 
6 #ifndef TPZStructMatrixST_H
7 #define TPZStructMatrixST_H
8 
9 #include <set>
10 #include <map>
11 #include <semaphore.h>
12 #include "pzvec.h"
13 #include "tpzautopointer.h"
14 #include "pzcmesh.h"
15 #include "pzelmat.h"
16 #include "TPZSemaphore.h"
17 #include "TPZEquationFilter.h"
18 #include "TPZGuiInterface.h"
19 #include "pzmatrix.h"
20 #include "pzfmatrix.h"
21 
22 class TPZStructMatrixST;
23 #include "TPZStructMatrixBase.h"
24 
25 
31 
32 public:
33 
35 
37 
39 
41 
42  virtual ~TPZStructMatrixST(){};
43 
45  virtual TPZMatrix<STATE> * Create() override;
46 
48  virtual TPZStructMatrixST * Clone() override;
49 
52 
55  unsigned numthreads_assemble, unsigned numthreads_decompose) {
56  SetNumThreads(numthreads_assemble);
57  return CreateAssemble(rhs, guiInterface);
58  }
59 
61  virtual void Assemble(TPZMatrix<STATE> &mat, TPZFMatrix<STATE> &rhs, TPZAutoPointer<TPZGuiInterface> guiInterface) override;
62 
65  unsigned numthreads_assemble, unsigned numthreads_decompose) {
66  std::cout << "Nothing to do." << std::endl;
67  }
68 
70  virtual void Assemble(TPZFMatrix<STATE> &rhs, TPZAutoPointer<TPZGuiInterface> guiInterface) override;
71 
72  public:
73 int ClassId() const override;
74  void Read(TPZStream &buf, void *context) override;
75  void Write(TPZStream &buf, int withclassid) const override;
76 
77 
78 protected:
79 
82 
84  virtual void OnlyAssemble(TPZFMatrix<STATE> *rhs, TPZAutoPointer<TPZGuiInterface> guiInterface);
85 
87  virtual void ExecuteAssemble(TPZMatrix<STATE> *fGlobMatrix, TPZFMatrix<STATE> *fGlobRhs, TPZAutoPointer<TPZGuiInterface> guiInterface);
88 
89 public:
90 
92  void SetEquationRange(int64_t mineq, int64_t maxeq) override
93  {
95  fEquationFilter.SetMinMaxEq(mineq, maxeq);
96  }
97 
99  virtual bool HasRange() const override
100  {
101  return fEquationFilter.IsActive();
102  }
103 
106  {
107  return fEquationFilter;
108  }
109 
111  int64_t NReducedEquations() const override
112  {
114  }
115 
117  TPZCompMesh *Mesh() const override
118  {
119  return fMesh;
120  }
121 
123  virtual void FilterEquations(TPZVec<int64_t> &origindex, TPZVec<int64_t> &destindex) const override;
124 
126  void SetMaterialIds(const std::set<int> &materialids) override;
127 
129  bool ShouldCompute(int matid) const override
130  {
131  const size_t size = fMaterialIds.size();
132  return size == 0 || fMaterialIds.find(matid) != fMaterialIds.end();
133  }
135  const std::set<int> &MaterialIds() override
136  {
137  return fMaterialIds;
138  }
139 
140 protected:
141 
148 
149 protected:
150 
153  std::set<int> fMaterialIds;
154 
157 };
158 
159 #endif
Contains declaration of the TPZSemaphore class which implements semaphore to threads.
void SetMaterialIds(const std::set< int > &materialids) override
Set the set of material ids which will be considered when assembling the system.
TPZEquationFilter fEquationFilter
Object which will determine which equations will be assembled.
int64_t NReducedEquations() const override
number of equations after applying the filter
std::set< int > fMaterialIds
Set of material ids to be considered. It is a private attribute.
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface) override
Templated vector implementation.
Contains declaration of TPZGuiInterface class.
virtual ~TPZStructMatrixST()
Definition: pzstrmatrixst.h:42
virtual void FilterEquations(TPZVec< int64_t > &origindex, TPZVec< int64_t > &destindex) const override
Filter out the equations which are out of the range.
TPZCompMesh * fMesh
Pointer to the computational mesh from which the matrix will be generated.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
bool ShouldCompute(int matid) const override
Establish whether the element should be computed.
It is responsible for a interface among Matrix and Finite Element classes. Structural Matrix...
Definition: pzstrmatrixst.h:30
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
Definition: pzstrmatrixst.h:54
virtual TPZStructMatrixST * Clone() override
const std::set< int > & MaterialIds() override
Returns the material ids.
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
int64_t NActiveEquations() const
Retorna o numero de equacoes ativas do sistema.
virtual void ExecuteAssemble(TPZMatrix< STATE > *fGlobMatrix, TPZFMatrix< STATE > *fGlobRhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Contains TPZMatrixclass which implements full matrix (using column major representation).
TPZCompMesh * Mesh() const override
Access method for the mesh pointer.
virtual void SetNumThreads(int n)
virtual bool HasRange() const override
Verify if a range has been specified.
Definition: pzstrmatrixst.h:99
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.
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
TPZAutoPointer< TPZCompMesh > fCompMesh
Autopointer control of the computational mesh.
virtual void Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
Definition: pzstrmatrixst.h:64
int fNumThreads
Number of threads in Assemble process.
Contains declaration of TPZCompMesh class which is a repository for computational elements...
int ClassId() const override
Define the class id associated with the class.
Contains TPZMatrix<TVar>class, root matrix class.
void SetEquationRange(int64_t mineq, int64_t maxeq) override
Determine that the assembly refers to a range of equations.
Definition: pzstrmatrixst.h:92
void SetMinMaxEq(int64_t mineq, int64_t maxeq)
Define as equacoes ativas de [mineq, maxeq)
TPZEquationFilter & EquationFilter() override
access method for the equation filter
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
void Read(TPZStream &buf, void *context) override
read objects from the stream
virtual TPZMatrix< STATE > * Create() override
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
virtual void OnlyAssemble(TPZMatrix< STATE > *mat, TPZFMatrix< STATE > *rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global system of equations into the matrix which has already been created.
void Reset()
Reset method.