NeoPZ
TPZRenumbering.h
Go to the documentation of this file.
1 
6 #ifndef TPZRENUMBERING_H
7 #define TPZRENUMBERING_H
8 
9 #include "pzvec.h"
10 #include "pzmanvector.h"
11 #include <set>
12 #include "TPZSavable.h"
13 
14 class TPZCompMesh;
15 
21 class TPZRenumbering : public TPZSavable {
22 public:
23 
25 
27  {
28  }
29 
30  TPZRenumbering(int64_t NElements, int64_t NNodes);
31 
32  virtual ~TPZRenumbering()
33  {
34  }
35  int ClassId() const override;
36  void Read(TPZStream &buf, void *context) override;
37  void Write(TPZStream &buf, int withclassid) const override;
38 
39  void SetElementsNodes(int64_t NElements, int64_t NNodes)
40  {
41  this->fNElements = NElements;
42  this->fNNodes = NNodes;
43  }
53  void SetElementGraph(TPZVec<int64_t> &elgraph, TPZVec<int64_t> &elgraphindex);
54 
57  void SetNodeWeights(TPZVec<int> &weights)
58  {
59  fNodeWeights = weights;
60  }
61 
64  virtual void ClearDataStructures();
65 
66  virtual void Resequence(TPZVec<int64_t> &perm, TPZVec<int64_t> &iperm)
67  {
68  /*if(fHDivPermute)
69  {
70  AdjustHDivPermutation(perm, iperm);
71  }*/
72  std::cout << "Resequence not implemented\n";
73  DebugStop();
74  }
75 
76 
81  void ConvertGraph(TPZVec<int64_t> &elgraph, TPZVec<int64_t> &elgraphindex, TPZManVector<int64_t> &nodegraph, TPZManVector<int64_t> &nodegraphindex);
82 
84  void ConvertToElementoToElementGraph(TPZVec<int64_t> &elgraph, TPZVec<int64_t> &elgraphindex, TPZVec<int64_t> &eltotelgraph, TPZVec<int> &eltoelweight, TPZVec<int64_t> &eltoelgraphindex);
85 
87  void NodeToElGraph(TPZVec<int64_t> &elgraph, TPZVec<int64_t> &elgraphindex, TPZVec<int64_t> &nodetoelgraph, TPZVec<int64_t> &nodetoelgraphindex);
88 
93  int64_t ColorNodes(TPZVec<int64_t> &nodegraph, TPZVec<int64_t> &nodegraphindex, TPZVec<int> &family, TPZVec<int> &colors);
94 
100  static int64_t ColorElements(const TPZCompMesh *cmesh, const TPZVec<int64_t> &elementIndices, TPZVec<int64_t> &elementColors);
101 
103  void Print(TPZVec<int64_t> &grapho, TPZVec<int64_t> &graphoindex, const char *name = 0, std::ostream &out = std::cout);
104 
109  void CornerEqs(unsigned int mincorners, int64_t nelconsider, std::set<int> &eligible, std::set<int> &cornernodes);
110 
111 protected:
113  int64_t fNElements;
114 
116  int64_t fNNodes;
117 
120 
123 
129 
130 };
131 
132 class TPZCompMesh;
134 void ResequenceByGeometry(TPZCompMesh *cmesh,const TPZVec<REAL> &normal);
135 
136 #endif //TPZRENUMBERING_H
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
Contains declaration of the TPZSavable class which defines the interface to save and restore objects ...
void SetElementGraph(TPZVec< int64_t > &elgraph, TPZVec< int64_t > &elgraphindex)
This method declares the element graph to the object.
void ConvertGraph(TPZVec< int64_t > &elgraph, TPZVec< int64_t > &elgraphindex, TPZManVector< int64_t > &nodegraph, TPZManVector< int64_t > &nodegraphindex)
Will convert an element graph defined by elgraph and elgraphindex into a node graph defined by nodegr...
Templated vector implementation.
TPZVec< int > fNodeWeights
Number of equations associated with each node.
int ClassId() const override
Define the class id associated with the class.
TPZVec< int64_t > fElementGraphIndex
Indicates for each element the index of the first entry with fElementGraph for that element The size ...
This abstract class which defines the behavior which derived classes need to implement for implement...
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
void CornerEqs(unsigned int mincorners, int64_t nelconsider, std::set< int > &eligible, std::set< int > &cornernodes)
Analyzes the graph, finds the corner nodes Number of elements which should be considered for determi...
Free store vector implementation.
int64_t fNElements
Number of elements in the graph.
void SetElementsNodes(int64_t NElements, int64_t NNodes)
void ConvertToElementoToElementGraph(TPZVec< int64_t > &elgraph, TPZVec< int64_t > &elgraphindex, TPZVec< int64_t > &eltotelgraph, TPZVec< int > &eltoelweight, TPZVec< int64_t > &eltoelgraphindex)
Convert a traditional elgraph to an element to element graph.
void Read(TPZStream &buf, void *context) override
read objects from the stream
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
void SetNodeWeights(TPZVec< int > &weights)
Sets the number of equations associated with each node.
void Print(TPZVec< int64_t > &grapho, TPZVec< int64_t > &graphoindex, const char *name=0, std::ostream &out=std::cout)
Prints graph.
static int64_t ColorElements(const TPZCompMesh *cmesh, const TPZVec< int64_t > &elementIndices, TPZVec< int64_t > &elementColors)
Assigns a color to the elements in the elementIndices list such that two elements that share a connec...
void ResequenceByGeometry(TPZCompMesh *cmesh, const TPZVec< REAL > &normal)
Makes resequence to renumbering.
int64_t fNNodes
Number of nodes in the graph.
virtual void ClearDataStructures()
This will reset all datastructures the object may contain.
TPZVec< int64_t > fElementGraph
Node number of each element.
virtual ~TPZRenumbering()
void NodeToElGraph(TPZVec< int64_t > &elgraph, TPZVec< int64_t > &elgraphindex, TPZVec< int64_t > &nodetoelgraph, TPZVec< int64_t > &nodetoelgraphindex)
Stores the graph of nodes to elements.
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
virtual void Resequence(TPZVec< int64_t > &perm, TPZVec< int64_t > &iperm)
This class defines the interface to save and restore objects from TPZStream objects. Persistency.
Definition: TPZSavable.h:67
int64_t ColorNodes(TPZVec< int64_t > &nodegraph, TPZVec< int64_t > &nodegraphindex, TPZVec< int > &family, TPZVec< int > &colors)
Will assign a color to the nodes in the graph such that no two connected nodes have the same color th...