NeoPZ
TPZCutHillMcKee.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------
2 
3 #ifndef TPZCutHillMcKeeH
4 #define TPZCutHillMcKeeH
5 
6 #include "TPZRenumbering.h"
7 #include <map>
8 #include "pzmanvector.h"
9 #include <queue>
10 #include "pzstack.h"
11 
13 
14  public:
15 
16  struct SGraph{
17 
19 
21 
22  int64_t NNodes(){
23  return fnodegraphindex.NElements()-1;
24  }
25 
26  int64_t Degree(int64_t node){
27  return fnodegraphindex[node+1]-fnodegraphindex[node];
28  }
29 
30  //according to suggestion of INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL. 28,2651-2679 (1989)
31  //A FORTRAN PROGRAM FOR PROFILE AND WAVEFRONT REDUCTION by S. W. SLOAN
32  //removing nodes with same degree
33  //Previously, Sloan had suggested LastLevel.Resize( (LastLevel.NElements()+2)/2 );
34  void ShrinkLastLevel(TPZVec<int64_t> &LastLevel);
35 
36  void RootedLevelStructure(int64_t rootNode, TPZStack< TPZStack<int64_t> > &LevelStructure);
37 
38  int64_t SmallestDegree(TPZVec<int64_t> &ExploredNodes);
39 
40  void AdjacentNodes(int64_t parent, TPZVec<int64_t> &adjNodes);
41 
42  int64_t * AdjacentNodesPtr(int64_t parent, int64_t &n){
43  n = this->Degree(parent);
44  return & ( fnodegraph[ fnodegraphindex[parent] ] );
45  }//method
46 
47  void GetAdjacentNodes(const TPZVec<int64_t> &parents,
48  const TPZVec< int64_t > &exceptedNodes,
49  TPZStack<int64_t> &adjNodes);
50 
51  void AdjacentNodesOrdered(int64_t parent, const TPZVec<int64_t> &exceptedNodes, TPZVec<int64_t> &adjNodes);
52 
53  void SortNodes(TPZVec<int64_t> &nodes);
54 
55  void PseudoPeripheralNodes(int64_t &startNode, int64_t &endNode);
56 
57  void Set2Vec(const std::set<int64_t> &myset, TPZVec<int64_t> &myVec) const;
58 
59  };//SGraph
60 
61  private:
62 
63  void ProcessParentNode(int64_t Parent,
64  SGraph &graph,
65  TPZVec<int64_t> &ExploredNodes,
67  std::queue<int64_t> &Q,
68  TPZVec<int64_t> &adjNodes);
69 
70  bool fReverse;
71 
72  virtual void Resequence(TPZVec<int64_t> &permGather, TPZVec<int64_t> &permScatter,
73  TPZVec<int64_t> &permGatherReverse, TPZVec<int64_t> &permScatterReverse);
74 
75  public:
76 
77 
78  virtual void Resequence(TPZVec<int64_t> &perm, TPZVec<int64_t> &iperm);
79 
81 
82  TPZCutHillMcKee(int64_t NElements, int64_t NNodes, bool Reverse = true);
83 
84  virtual ~TPZCutHillMcKee();
85 
86  bool fVerbose;
87 
88 };
89 //---------------------------------------------------------------------------
90 #endif
void Set2Vec(const std::set< int64_t > &myset, TPZVec< int64_t > &myVec) const
TPZManVector< int64_t > fnodegraph
void ShrinkLastLevel(TPZVec< int64_t > &LastLevel)
void GetAdjacentNodes(const TPZVec< int64_t > &parents, const TPZVec< int64_t > &exceptedNodes, TPZStack< int64_t > &adjNodes)
virtual void Resequence(TPZVec< int64_t > &permGather, TPZVec< int64_t > &permScatter, TPZVec< int64_t > &permGatherReverse, TPZVec< int64_t > &permScatterReverse)
virtual ~TPZCutHillMcKee()
Contains the TPZRenumbering class which defines the behavior to implementing node sequence numbering ...
void AdjacentNodes(int64_t parent, TPZVec< int64_t > &adjNodes)
int64_t Degree(int64_t node)
void RootedLevelStructure(int64_t rootNode, TPZStack< TPZStack< int64_t > > &LevelStructure)
This abstract class which defines the behavior which derived classes need to implement for implement...
int64_t SmallestDegree(TPZVec< int64_t > &ExploredNodes)
Free store vector implementation.
void AdjacentNodesOrdered(int64_t parent, const TPZVec< int64_t > &exceptedNodes, TPZVec< int64_t > &adjNodes)
A simple stack.
TPZManVector< int64_t > fnodegraphindex
This class implements a stack object. Utility.
Definition: pzcheckmesh.h:14
int64_t * AdjacentNodesPtr(int64_t parent, int64_t &n)
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
void SortNodes(TPZVec< int64_t > &nodes)
void PseudoPeripheralNodes(int64_t &startNode, int64_t &endNode)
void ProcessParentNode(int64_t Parent, SGraph &graph, TPZVec< int64_t > &ExploredNodes, TPZStack< int64_t > &R, std::queue< int64_t > &Q, TPZVec< int64_t > &adjNodes)
void