Memosa-FVM  0.2
Cell< CellTrait > Class Template Reference

#include <Cell.h>

Public Types

enum  { numFaces = CellTrait::numFaces }
 
enum  { numNodes = CellTrait::numNodes }
 

Public Member Functions

 Cell ()
 
void orderCellFacesAndNodes (const int c, CRConnectivity &cellFaces, CRConnectivity &cellNodes, const CRConnectivity &faceNodes, const CRConnectivity &faceCells, const Array< Vector< double, 3 > > &nodeCoordinates)
 

Private Attributes

unsigned int _faceAllNodesSig [numFaces]
 
unsigned int _nodeFirstFaceSig [numNodes]
 
unsigned int _faceFirstFaceNodesSig [numNodes]
 
map< unsigned int, unsigned int > _faceFirstFaceNodesSigMap
 

Detailed Description

template<class CellTrait>
class Cell< CellTrait >

Definition at line 16 of file Cell.h.

Member Enumeration Documentation

template<class CellTrait >
anonymous enum
Enumerator
numFaces 

Definition at line 20 of file Cell.h.

20 {numFaces = CellTrait::numFaces};
template<class CellTrait >
anonymous enum
Enumerator
numNodes 

Definition at line 21 of file Cell.h.

21 {numNodes = CellTrait::numNodes};

Constructor & Destructor Documentation

template<class CellTrait >
Cell< CellTrait >::Cell ( )

Definition at line 52 of file Cell.cpp.

53 {
54  for(int n=0; n<numNodes; n++) _nodeFirstFaceSig[n] = 0;
55 
56  for(int f=0; f<numFaces; f++)
57  {
58  _faceAllNodesSig[f] = 0;
59  for(unsigned int nf=0; nf<CellTrait::faceNodeCount[f]; nf++)
60  {
61  unsigned int n = CellTrait::faceNodes[f][nf];
62  _faceAllNodesSig[f] |= (1<<n);
63  if (f == 0)
64  _nodeFirstFaceSig[n] = 1<<n;
65  }
66  }
67 
68  for(int f=0; f<numFaces; f++)
69  {
71  for(unsigned int nf=0; nf<CellTrait::faceNodeCount[f]; nf++)
72  {
73  unsigned int n = CellTrait::faceNodes[f][nf];
75  }
77  }
78 
79 #if 0
80  for(int f=0; f<numFaces; f++)
81  cout << _faceAllNodesSig[f] << " ";
82  cout << endl;
83 
84  for(int n=0; n<numNodes; n++)
85  cout << _nodeFirstFaceSig[n] << " " ;
86  cout << endl;
87 
88  for(int f=0; f<numFaces; f++)
89  cout << _faceFirstFaceNodesSig[f] << " " ;
90  cout << endl;
91 #endif
92 }
unsigned int _nodeFirstFaceSig[numNodes]
Definition: Cell.h:36
unsigned int _faceFirstFaceNodesSig[numNodes]
Definition: Cell.h:37
map< unsigned int, unsigned int > _faceFirstFaceNodesSigMap
Definition: Cell.h:39
unsigned int _faceAllNodesSig[numFaces]
Definition: Cell.h:35

Member Function Documentation

template<class CellTrait >
void Cell< CellTrait >::orderCellFacesAndNodes ( const int  c,
CRConnectivity cellFaces,
CRConnectivity cellNodes,
const CRConnectivity faceNodes,
const CRConnectivity faceCells,
const Array< Vector< double, 3 > > &  nodeCoordinates 
)

Definition at line 97 of file Cell.cpp.

References CRConnectivity::getCount().

103 {
104 
105  int face0 = 0;
106  int face0NodeCount=0;
107  bool reverseFace0Nodes = false;
108 
109  for(int nf=0; nf<numFaces; nf++)
110  {
111  const int f = cellFaces(c,nf);
112  if ((unsigned int)faceNodes.getCount(f) == CellTrait::faceNodeCount[0])
113  {
114  face0 = f;
115  face0NodeCount = faceNodes.getCount(f);
116  if (faceCells(f,0) != c)
117  {
118  if (faceCells(f,1) != c)
119  cerr << "malformed grid " << endl;
120  reverseFace0Nodes = true;
121  }
122  break;
123  }
124  }
125 
126  map<int, unsigned int> thisNodesFirstFaceNodesSig;
127 
128  for(unsigned int nn=0; nn<(unsigned int)face0NodeCount; nn++)
129  {
130  int node = faceNodes(face0,nn);
131  if (reverseFace0Nodes) node = faceNodes(face0,face0NodeCount-nn-1);
132  thisNodesFirstFaceNodesSig[node] = 1<<nn;
133  }
134 
135  int orderedFaces[numFaces];
136 
137  for(int nf=0; nf<numFaces; nf++)
138  {
139  unsigned int thisFaceFirstFaceNodesSig = 0;
140  const int f = cellFaces(c,nf);
141 
142  for(int nn=0; nn<faceNodes.getCount(f); nn++)
143  {
144  const int n = faceNodes(f,nn);
145 
146  if (thisNodesFirstFaceNodesSig.find(n) !=
147  thisNodesFirstFaceNodesSig.end())
148  thisFaceFirstFaceNodesSig |= thisNodesFirstFaceNodesSig[n];
149  }
150 
151  int faceOrder = _faceFirstFaceNodesSigMap[thisFaceFirstFaceNodesSig];
152  orderedFaces[faceOrder] = f;
153  }
154 
155  for(int nf=0; nf<numFaces; nf++)
156  cellFaces(c,nf) = orderedFaces[nf];
157 
158 
159  map<int, unsigned int> thisNodesAllFaceNodesSig;
160 
161  for(int nf=0; nf<numFaces; nf++)
162  {
163  // unsigned int thisFaceFirstFaceNodeSig = 0;
164  const int f = cellFaces(c,nf);
165 
166  // bool reverseFaceNodes = (faceCells(f,0) != c);
167 
168  const int faceNodeCount = faceNodes.getCount(f);
169  for(int nn=0; nn<faceNodeCount; nn++)
170  {
171  int n = faceNodes(f,nn);
172  if (reverseFace0Nodes) n = faceNodes(f,faceNodeCount-nn-1);
173 
174  if (thisNodesAllFaceNodesSig.find(n) ==
175  thisNodesAllFaceNodesSig.end())
176  {
177  thisNodesAllFaceNodesSig[n] =
178  _faceAllNodesSig[nf];
179  }
180  else
181  {
182  thisNodesAllFaceNodesSig[n] &=
183  _faceAllNodesSig[nf];
184  }
185  }
186  }
187 
188  for( map<int,unsigned int>::const_iterator pos =
189  thisNodesAllFaceNodesSig.begin();
190  pos != thisNodesAllFaceNodesSig.end();
191  ++pos)
192  {
193  const int node = pos->first;
194  // log2 missing in msvc ?
195  const int index = (int) log2(pos->second);
196  // const int index = (int) (log( (double) pos->second)/log(2.));
197  cellNodes(c,index) = node;
198  }
199 
200 }
int getCount(const int i) const
map< unsigned int, unsigned int > _faceFirstFaceNodesSigMap
Definition: Cell.h:39
unsigned int _faceAllNodesSig[numFaces]
Definition: Cell.h:35

Member Data Documentation

template<class CellTrait >
unsigned int Cell< CellTrait >::_faceAllNodesSig[numFaces]
private

Definition at line 35 of file Cell.h.

template<class CellTrait >
unsigned int Cell< CellTrait >::_faceFirstFaceNodesSig[numNodes]
private

Definition at line 37 of file Cell.h.

template<class CellTrait >
map<unsigned int, unsigned int> Cell< CellTrait >::_faceFirstFaceNodesSigMap
private

Definition at line 39 of file Cell.h.

template<class CellTrait >
unsigned int Cell< CellTrait >::_nodeFirstFaceSig[numNodes]
private

Definition at line 36 of file Cell.h.


The documentation for this class was generated from the following files: