NeoPZ
pzcondensedcompel.h
Go to the documentation of this file.
1 
6 #ifndef TPZCONDENSEDCOMPELH
7 #define TPZCONDENSEDCOMPELH
8 
9 #include "pzcompel.h"
10 #include "pzmatred.h"
11 #include "pzmanvector.h"
12 #include "pzelmat.h"
13 
14 #ifdef USING_BLAS
15 //#define USING_DGER
16 #ifdef USING_MKL
17 #include <mkl.h>
18 #elif MACOSX
19 #include <Accelerate/Accelerate.h>
20 #else
21 #include "cblas.h"
22 #endif
23 #endif
24 
25 
26 
33 {
34 
35  //TPZMatRed<REAL, TPZFMatrix<REAL> > fCondensed;
36  int64_t fNumInternalEqs = 0;
37  int64_t fNumTotalEqs = 0;
41  bool fKeepMatrix = true;
42  void Resequence();
43 
44 public:
45 
46  TPZCondensedCompEl(TPZCompEl *ref, bool keepmatrix = true);
47 
50 
51  virtual ~TPZCondensedCompEl();
52 
57  virtual void Print(std::ostream &out = std::cout) const override;
58 
60  void Unwrap();
61 
67  virtual void SetConnectIndex(int inode, int64_t index) override;
68 
70  virtual int NConnects() const override
71  {
72  return fReferenceCompEl->NConnects();
73  }
74 
79  virtual int64_t ConnectIndex(int i) const override
80  {
81  return fReferenceCompEl->ConnectIndex(fIndexes[i]);
82  }
83 
85  return fReferenceCompEl;
86  }
87 
89  virtual bool NeedsComputing(const std::set<int> &materialids) override
90  {
91  if(fReferenceCompEl)
92  {
93  return fReferenceCompEl->NeedsComputing(materialids);
94  }
95  else
96  {
97  return false;
98  }
99  }
100 
101 
102  virtual void LoadElementReference() override
103  {
104  if(fReferenceCompEl)
105  {
106  fReferenceCompEl->LoadElementReference();
107  }
108  }
109 
111  virtual void BuildCornerConnectList(std::set<int64_t> &connectindexes) const override;
112 
114  void SetKeepMatrix(bool keep)
115  {
116  fKeepMatrix = keep;
117  }
118 
120  virtual int Dimension() const override
121  {
122  return fReferenceCompEl->Dimension();
123  }
125  virtual TPZCompEl *Clone(TPZCompMesh &mesh) const override
126  {
127  return new TPZCondensedCompEl(*this,mesh);
128  }
129 
135  virtual void LoadSolution() override;
136 
137  virtual void TransferMultiphysicsElementSolution() override
138  {
139  if(fReferenceCompEl)
140  {
141  fReferenceCompEl->TransferMultiphysicsElementSolution();
142  }
143  }
144 
145 
157  virtual TPZCompEl *ClonePatchEl(TPZCompMesh &mesh,
158  std::map<int64_t,int64_t> & gl2lcConMap,
159  std::map<int64_t,int64_t> & gl2lcElMap) const override;
160 
161 private:
169  virtual void ComputeSolution(TPZVec<REAL> &qsi,
170  TPZSolVec &sol, TPZGradSolVec &dsol,TPZFMatrix<REAL> &axes) override;
171 
172 public:
179  virtual void ComputeSolution(TPZVec<REAL> &qsi, TPZMaterialData &data) override ;
180 
184  virtual TPZVec<STATE> IntegrateSolution(const std::string &varname, const std::set<int> &matids) override
185  {
186  return fReferenceCompEl->IntegrateSolution(varname, matids);
187  }
191  virtual TPZVec<STATE> IntegrateSolution(int var) const override
192  {
193  return fReferenceCompEl->IntegrateSolution(var);
194  }
207  virtual void ComputeSolution(TPZVec<REAL> &qsi,
208  TPZVec<REAL> &normal,
209  TPZSolVec &leftsol, TPZGradSolVec &dleftsol,TPZFMatrix<REAL> &leftaxes,
210  TPZSolVec &rightsol, TPZGradSolVec &drightsol,TPZFMatrix<REAL> &rightaxes) override;
211 
221  virtual void ComputeSolution(TPZVec<REAL> &qsi, TPZFMatrix<REAL> &phi, TPZFMatrix<REAL> &dphix,
222  const TPZFMatrix<REAL> &axes, TPZSolVec &sol, TPZGradSolVec &dsol) override;
223 
225  virtual void Assemble() override;
231  virtual void CalcStiff(TPZElementMatrix &ek,TPZElementMatrix &ef) override;
232 
233 
238  virtual void CalcResidual(TPZElementMatrix &ef) override;
239 
241  virtual bool HasMaterial(const std::set<int> &materialids) const override;
242 
243  void EvaluateError(std::function<void(const TPZVec<REAL> &loc,TPZVec<STATE> &val,TPZFMatrix<STATE> &deriv)> func,
244  TPZVec<REAL> &errors, bool store_errors) override {
245  fReferenceCompEl->EvaluateError(func, errors, store_errors);
246  }
247 
254  virtual void CreateGraphicalElement(TPZGraphMesh & graphmesh, int dimension) override
255  {
256  fReferenceCompEl->CreateGraphicalElement(graphmesh, dimension);
257  }
258 
259 
260  int ComputeIntegrationOrder() const override {
261  std::cout << "This method should not be called. " << __PRETTY_FUNCTION__ << std::endl;
262  DebugStop();
263  return 0;
264  }
265 
266 virtual int ClassId() const override;
267 
268 
269 };
270 
271 #endif
virtual TPZVec< STATE > IntegrateSolution(int var) const
Compute the integral of a variable.
Definition: pzcompel.cpp:1054
Represents a graphical mesh used for post processing purposes. Post processing.
Definition: pzgraphmesh.h:34
virtual void TransferMultiphysicsElementSolution() override
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZSolVec &sol, TPZGradSolVec &dsol, TPZFMatrix< REAL > &axes) override
Computes solution and its derivatives in the local coordinate qsi.
virtual void EvaluateError(std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv)> func, TPZVec< REAL > &errors, bool store_error)
Performs an error estimate on the elemen.
Definition: pzcompel.cpp:415
virtual void CreateGraphicalElement(TPZGraphMesh &graphmesh, int dimension) override
Creates corresponding graphical element(s) if the dimension matches graphical elements are used to ge...
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
Contains declaration of TPZCompEl class which defines the interface of a computational element...
int ComputeIntegrationOrder() const override
virtual int Dimension() const =0
Dimension of the element.
virtual bool NeedsComputing(const std::set< int > &materialids)
return true if the element has a variational statement associated with the material ids ...
Definition: pzcompel.h:170
virtual int64_t ConnectIndex(int i) const override
Returns the index of the ith connectivity of the element.
TPZCompEl * ReferenceCompEl()
virtual void CreateGraphicalElement(TPZGraphMesh &graphmesh, int dimension)
Creates corresponding graphical element(s) if the dimension matches graphical elements are used to ge...
Definition: pzcompel.h:785
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
Contains TPZMatRed class which implements a simple substructuring of a linear system of equations...
virtual int Dimension() const override
Dimension of the element.
virtual void LoadElementReference()
Loads the geometric element reference.
Definition: pzcompel.cpp:601
virtual TPZCompEl * ClonePatchEl(TPZCompMesh &mesh, std::map< int64_t, int64_t > &gl2lcConMap, std::map< int64_t, int64_t > &gl2lcElMap) const override
Method for creating a copy of the element in a patch mesh.
virtual void LoadSolution() override
Loads the solution within the internal data structure of the element.
virtual void TransferMultiphysicsElementSolution()
Definition: pzcompel.h:415
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const override
adds the connect indexes associated with base shape functions to the set
TPZMatRed< STATE, TPZFMatrix< STATE > > fCondensed
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual int NConnects() const override
Returns the number of nodes of the element.
void Unwrap()
unwrap the condensed element from the computational element and delete the condensed element ...
virtual TPZCompEl * Clone(TPZCompMesh &mesh) const override
Method for creating a copy of the element.
TPZCompEl * fReferenceCompEl
virtual int ClassId() const override
Define the class id associated with the class.
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
virtual void SetConnectIndex(int inode, int64_t index) override
Set the index i to node inode.
Free store vector implementation.
virtual bool NeedsComputing(const std::set< int > &materialids) override
return true if the element has a variational statement associated with the material ids ...
virtual bool HasMaterial(const std::set< int > &materialids) const override
Verifies if the material associated with the element is contained in the set.
virtual TPZVec< STATE > IntegrateSolution(const std::string &varname, const std::set< int > &matids) override
Compute the integral of a variable defined by the string if the material id is included in matids...
Class which implements an element which condenses the internal connects.
TPZManVector< int64_t, 27 > fIndexes
virtual TPZVec< STATE > IntegrateSolution(int var) const override
Compute the integral of a variable defined by the string if the material id is included in matids...
void EvaluateError(std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv)> func, TPZVec< REAL > &errors, bool store_errors) override
Performs an error estimate on the elemen.
virtual int64_t ConnectIndex(int i) const =0
Returns the index of the ith connectivity of the element.
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
virtual void LoadElementReference() override
Loads the geometric element reference.
virtual int NConnects() const =0
Returns the number of nodes of the element.
Implements a simple substructuring of a linear system of equations, composed of 4 submatrices...
Definition: pzmatred.h:34
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef) override
Computes the element stifness matrix and right hand side.
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
virtual void Print(std::ostream &out=std::cout) const override
Prints element data.
TPZCondensedCompEl(TPZCompEl *ref, bool keepmatrix=true)
virtual void Assemble() override
Assemble the stiffness matrix in locally kept datastructure.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
void SetKeepMatrix(bool keep)
Set the flag that determines whether the matrix needs to be kept or not.
virtual void CalcResidual(TPZElementMatrix &ef) override
Computes the element right hand side.