NeoPZ
pzsubcmesh.h
Go to the documentation of this file.
1 
6 #ifndef SUBCMESH_H
7 #define SUBCMESH_H
8 
9 #if _MSC_VER > 1000
10 #pragma once
11 #endif
12 
13 #include <stdlib.h>
14 
15 #include "pzcompel.h"
16 #include "pzcmesh.h"
17 #include "pzvec.h"
18 #include "pzreal.h"
19 #include "pzanalysis.h"
20 
21 #include <list>
22 
24 class TPZSubMeshAnalysis;
25 class TPZAnalysis;
26 class TPZGuiInterface;
27 
37 public TPZCompMesh,
38 public TPZCompEl
39 {
40 protected:
43 
47 
52  std::map<int64_t,int64_t> fFatherToLocal;
53 
56 
58  std::list<std::pair<int64_t,int> > fLagrangeEquations;
59 
60 private:
62  int64_t TransferElementTo(TPZCompMesh * mesh, int64_t elindex) override;
64  int64_t TransferElementFrom(TPZCompMesh *mesh, int64_t elindex) override;
65 
67  void MakeInternalFast(int64_t local);
68 
74  void TransferDependencies(int64_t local);
75 
76 public:
82  TPZSubCompMesh(TPZCompMesh &mesh, int64_t &index);
86  virtual ~TPZSubCompMesh();
87 
88  virtual int NConnectShapeF(int inod, int order){
89  PZError << "\nPLEASE IMPLEMENT ME: " << __PRETTY_FUNCTION__ << "\n";
90  return 0;
91  }
92 
93  virtual TPZCompEl *Clone(TPZCompMesh &mesh) const override {
94  std::cout << "TPZSubCompMesh::Clone should be implemented\n";
95  return 0;
96  }
97 
99  std::map<int64_t,int64_t> & gl2lcConMap,
100  std::map<int64_t,int64_t> & gl2lcElMap) const override
101  {
102  std::cout << "TPZSubCompMesh::Clone should be implemented\n";
103  return 0;
104  }
105 
107  void SetAnalysisFrontal(int numThreads, TPZAutoPointer<TPZGuiInterface> guiInterface);
108 
114  void SetAnalysisSkyline(int numThreads, int preconditioned, TPZAutoPointer<TPZGuiInterface> guiInterface);
115 
121  void SetAnalysisSkyline(int numThreads, int preconditioned, TPZAutoPointer<TPZRenumbering> renumber);
122 
124  {
125  return fAnalysis;
126  }
127 
129  virtual void LoadElementReference() override;
130 
137  virtual REAL CompareElement(int var, char *matname) override;
138 
145  int IsAllowedElement(TPZCompMesh *mesh, int64_t elindex);
146 
148  int64_t NumInternalEquations();
149 
154  virtual void SkylineInternal(TPZVec<int64_t> &skyline);
155 
157  void PotentialInternal(std::list<int64_t> &connectindices) const;
158 
163  void MakeExternal(int64_t local);
164 
172  virtual int64_t TransferElement(TPZCompMesh *mesh, int64_t elindex) override;
173 
178  virtual void MakeAllInternal() override;
179 
184  virtual TPZCompMesh * RootMesh(int64_t local) override;
185 
190  virtual void MakeInternal(int64_t local) override;
191 
198  virtual int64_t PutinSuperMesh(int64_t local, TPZCompMesh *super) override;
199 
206  virtual int64_t GetFromSuperMesh(int64_t superind, TPZCompMesh *super) override;
207 
212  virtual TPZCompMesh * CommonMesh (TPZCompMesh *mesh) override;
213 
215  virtual TPZCompMesh * FatherMesh() const override;
216 
221 
227 
232  void PermuteInternalFirst(TPZVec<int64_t> &permute);
233 
239  virtual void Print(std::ostream &out = std::cout) const override;
240 
242  bool NeedsComputing(const std::set<int> &matids) override;
243 
245  virtual int64_t AllocateNewConnect(int nshape, int nstate, int order) override;
246 
248  virtual int64_t AllocateNewConnect(const TPZConnect &connect) override;
249 
251  int64_t NodeIndex(int64_t nolocal, TPZCompMesh *super);
252 
254  int64_t InternalIndex(int64_t IndexinFather);
255 
258  virtual int Dimension() const override;
259 
261  virtual void ComputeNodElCon() override;
262 
264  virtual void ComputeNodElCon(TPZVec<int> &nelconnected) const override;
265 
277  virtual void SetConnectIndex(int inode, int64_t index) override;
278 
280  virtual void Assemble() override;
281 
283  virtual void CalcStiff(TPZElementMatrix &ek,TPZElementMatrix &ef) override;
284 
286  void InitializeEF(TPZElementMatrix &ef);
287 
292  virtual void CalcResidual(TPZElementMatrix &ef) override;
293 
294 
301  virtual void CreateGraphicalElement(TPZGraphMesh & graphmesh, int dimension) override;
302 
304  virtual int64_t ConnectIndex(int i) const override;
305 
307  virtual int NConnects() const override;
308 
310  virtual void BuildCornerConnectList(std::set<int64_t> &connectindexes) const override;
311 
316  virtual void LoadSolution() override;
317 
321  virtual void TransferMultiphysicsElementSolution() override;
322 
326  virtual TPZVec<STATE> IntegrateSolution(const std::string &varname, const std::set<int> &matids) override;
327 
328 
336  virtual void ComputeSolution(TPZVec<REAL> &qsi,
337  TPZSolVec &sol, TPZGradSolVec &dsol,TPZFMatrix<REAL> &axes) override;
338 
351  virtual void ComputeSolution(TPZVec<REAL> &qsi,
352  TPZVec<REAL> &normal,
353  TPZSolVec &leftsol, TPZGradSolVec &dleftsol,TPZFMatrix<REAL> &leftaxes,
354  TPZSolVec &rightsol, TPZGradSolVec &drightsol,TPZFMatrix<REAL> &rightaxes) override;
355 
365  virtual void ComputeSolution(TPZVec<REAL> &qsi, TPZFMatrix<REAL> &phi, TPZFMatrix<REAL> &dphix,
366  const TPZFMatrix<REAL> &axes, TPZSolVec &sol, TPZGradSolVec &dsol) override;
367 
368  virtual void EvaluateError(std::function<void(const TPZVec<REAL> &loc,TPZVec<STATE> &val,TPZFMatrix<STATE> &deriv)> func,
369  TPZVec<REAL> &errors, bool store_error) override;
370 
374  public:
375 
376 virtual int ClassId() const override;
377 
379  virtual void Write(TPZStream &buf, int withclassid) const override;
380 
382  virtual void Read(TPZStream &buf, void *context) override;
383 
386 
388  void AddLagrangeDOF(int64_t connectindex, int idf)
389  {
390  fLagrangeEquations.push_back(std::pair<int64_t,int>(connectindex,idf));
391  SetNumberRigidBodyModes(fLagrangeEquations.size());
392  }
393 
395  void SetNumberRigidBodyModes(int nrigid, unsigned char lagrange = 0);
396 
398  int NumberRigidBodyModes();
399 
401  virtual bool HasMaterial(const std::set<int> &materialids) const override;
402 
404  static int main();
405 };
406 
407 #endif
Represents a graphical mesh used for post processing purposes. Post processing.
Definition: pzgraphmesh.h:34
virtual int64_t GetFromSuperMesh(int64_t superind, TPZCompMesh *super) override
Gets an external connection from the supermesh - Supermesh is one mesh who contains the analised subm...
Definition: pzsubcmesh.cpp:461
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.
Definition: pzsubcmesh.h:98
TPZAutoPointer< TPZAnalysis > fAnalysis
Pointer to submesh analysis object. Defines the resolution type.
Definition: pzsubcmesh.h:42
Contains TPZAnalysis class which implements the sequence of actions to perform a finite element analy...
virtual TPZCompMesh * RootMesh(int64_t local) override
Returns the rootmesh who have the specified connection.
Definition: pzsubcmesh.cpp:590
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
virtual TPZCompEl * Clone(TPZCompMesh &mesh) const override
Method for creating a copy of the element.
Definition: pzsubcmesh.h:93
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...
int64_t NodeIndex(int64_t nolocal, TPZCompMesh *super)
Gives the id node of one local node in containing mesh.
Definition: pzsubcmesh.cpp:358
Analysis procedure to computational sub mesh. Analysis.
Definition: pzsmanal.h:20
virtual void CalcResidual(TPZElementMatrix &ef) override
Computes the element right hand side.
TPZManVector< int64_t > fConnectIndex
Pointer to external location index of the connection.
Definition: pzsubcmesh.h:46
virtual int64_t AllocateNewConnect(int nshape, int nstate, int order) override
Virtual Method to allocate new connect.
Definition: pzsubcmesh.cpp:386
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef) override
Calculates the submesh stiffness matrix.
Contains declaration of TPZCompEl class which defines the interface of a computational element...
Templated vector implementation.
void InitializeEF(TPZElementMatrix &ef)
Initialize the datastructure of ef.
virtual void CreateGraphicalElement(TPZGraphMesh &graphmesh, int dimension) override
Creates corresponding graphical element(s) if the dimension matches graphical elements are used to ge...
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
virtual int Dimension() const override
Virtual Method! See declaration in TPZCompEl class.
Definition: pzsubcmesh.cpp:350
virtual void Print(std::ostream &out=std::cout) const override
Prints the submesh information on the specified device/file out.
Definition: pzsubcmesh.cpp:498
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZSolVec &sol, TPZGradSolVec &dsol, TPZFMatrix< REAL > &axes) override
Computes solution and its derivatives in the local coordinate qsi. SHOULD NEVER BE CALLED...
int64_t fSingularConnect
Number of rigid body modes expected by the internal matrix inversion.
Definition: pzsubcmesh.h:55
int NumberRigidBodyModes()
Return the number of rigid body modes associated with the internal degrees of freedom.
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
virtual void TransferMultiphysicsElementSolution() override
Transfer multiphysics solution.
virtual ~TPZSubCompMesh()
Destructor.
Definition: pzsubcmesh.cpp:194
void PermuteInternalFirst(TPZVec< int64_t > &permute)
Permutes the potentially internal connects to the first on the list Respect the previous order of th...
virtual void LoadElementReference() override
This method will load the elements of the mesh in their corresponding geometric elements.
virtual void SetConnectIndex(int inode, int64_t index) override
Changes the current node index -inode- to the specified node- index.
Definition: pzsubcmesh.cpp:813
virtual TPZCompMesh * FatherMesh() const override
Returns the current submesh father mesh.
Definition: pzsubcmesh.cpp:260
virtual int NConnectShapeF(int inod, int order)
Definition: pzsubcmesh.h:88
void MakeExternal(int64_t local)
Changes an local internal connection to a external connection in the father mesh. ...
Definition: pzsubcmesh.cpp:424
int64_t TransferElementTo(TPZCompMesh *mesh, int64_t elindex) override
Transfers one element from a submesh to another mesh.
Definition: pzsubcmesh.cpp:945
TPZSubCompMesh()
Default constructor.
Definition: pzsubcmesh.cpp:189
Implements the sequence of actions to perform a finite element analysis. Analysis.
Definition: pzanalysis.h:32
virtual void SkylineInternal(TPZVec< int64_t > &skyline)
This method computes the skyline of the system of equations.
virtual void EvaluateError(std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv)> func, TPZVec< REAL > &errors, bool store_error) override
Performs an error estimate on the elemen.
Implements a group of computational elements as a mesh and an element. Computational Mesh...
Definition: pzsubcmesh.h:36
void AddLagrangeDOF(int64_t connectindex, int idf)
Set the connect/degree of freedom as Lagrange variable.
Definition: pzsubcmesh.h:388
virtual void LoadSolution() override
Load the father mesh solution to all submesh connects - (internal and external).
std::map< int64_t, int64_t > fFatherToLocal
Maps indicating the correspondence between the connect index of the father mesh and de local connect ...
Definition: pzsubcmesh.h:52
int64_t InternalIndex(int64_t IndexinFather)
return the index in the subcompmesh of a connect with index within the father
void MakeInternalFast(int64_t local)
Marks the connect to be local.
Definition: pzsubcmesh.cpp:566
virtual int ClassId() const override
Returns the unique identifier for reading/writing objects to streams.
void TransferDependencies(int64_t local)
Transfer the dependency list of a connect. This will make the dependency disappear for the correspond...
Definition: pzsubcmesh.cpp:523
std::list< std::pair< int64_t, int > > fLagrangeEquations
List of connect/degree of freedom which are used as Lagrange multipliers.
Definition: pzsubcmesh.h:58
virtual bool HasMaterial(const std::set< int > &materialids) const override
Verifies if the material associated with the element is contained in the set.
Analysis for substructuring. Use a frontal matrix. Analysis.
Contains declaration of TPZCompMesh class which is a repository for computational elements...
TPZAutoPointer< TPZAnalysis > Analysis()
Definition: pzsubcmesh.h:123
void PotentialInternal(std::list< int64_t > &connectindices) const
Puts the nodes which can be transferred in an ordered list.
Definition: pzsubcmesh.cpp:789
bool NeedsComputing(const std::set< int > &matids) override
Verifies if any element needs to be computed corresponding to the material ids.
void PermuteExternalConnects()
Optimizes the connections positions on block.
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
void ComputePermutationInternalFirst(TPZVec< int64_t > &permute) const
Computes the permutation vector which puts the internal connects to the first on the list Respect th...
static int idf[6]
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const override
adds the connect indexes associated with base shape functions to the set
virtual void Assemble() override
Assemble the stiffness matrix in locally kept datastructure.
This class implements a very simple interface from PZ kernel to GUI. Module: Common.
int IsAllowedElement(TPZCompMesh *mesh, int64_t elindex)
Verifies the transfer possibility of the connection elindex from the mesh to the current submesh...
Definition: pzsubcmesh.cpp:994
virtual int64_t ConnectIndex(int i) const override
Returns the connection index i.
Definition: pzsubcmesh.cpp:346
virtual void ComputeNodElCon() override
Computes the number of elements connected to each connect object.
Definition: pzsubcmesh.cpp:298
static int main()
Static function for validation tests.
Definition: pzsubcmesh.cpp:63
virtual void MakeAllInternal() override
Makes all mesh connections internal mesh connections.
Definition: pzsubcmesh.cpp:602
virtual REAL CompareElement(int var, char *matname) override
This method will initiate the comparison between the current computational mesh and the mesh which is...
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
virtual int64_t TransferElement(TPZCompMesh *mesh, int64_t elindex) override
Transfer the element elindex belonging to mesh to the current mesh and returns its index...
Definition: pzsubcmesh.cpp:987
void SetAnalysisFrontal(int numThreads, TPZAutoPointer< TPZGuiInterface > guiInterface)
Sets the analysis type.
int64_t NumInternalEquations()
Computes the number of internal equations.
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
void SetNumberRigidBodyModes(int nrigid, unsigned char lagrange=0)
Set the number of rigid body modes associated with the internal degrees of freedom.
void SetAnalysisSkyline(int numThreads, int preconditioned, TPZAutoPointer< TPZGuiInterface > guiInterface)
Condense the internal equations using a skyline symetric matrix the preconditioned argument indicates...
bool VerifyDatastructureConsistency()
Method to verify that the datastructures are consistent.
virtual void MakeInternal(int64_t local) override
Makes a specified connection a internal mesh connection.
Definition: pzsubcmesh.cpp:550
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
TPZManVector< int64_t > fExternalLocIndex
Indexes of the external connections.
Definition: pzsubcmesh.h:50
virtual TPZCompMesh * CommonMesh(TPZCompMesh *mesh) override
Gives the commom father mesh of the specified mesh and the current submesh.
Definition: pzsubcmesh.cpp:265
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual int64_t PutinSuperMesh(int64_t local, TPZCompMesh *super) override
Puts an local connection in the supermesh - Supermesh is one mesh who contains the analised submesh...
Definition: pzsubcmesh.cpp:455
int64_t TransferElementFrom(TPZCompMesh *mesh, int64_t elindex) override
Transfers one element from a specified mesh to the current submesh.
Definition: pzsubcmesh.cpp:817
virtual int NConnects() const override
Returns the number of connections.
Definition: pzsubcmesh.cpp:342