Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | Friends | List of all members
Nektar::NekMeshUtils::Octant Class Reference

this class contains the infomration and methods for individal octants in the Octree More...

#include <Octant.h>

Collaboration diagram for Nektar::NekMeshUtils::Octant:
Collaboration graph
[legend]

Public Member Functions

 Octant (int i, OctantSharedPtr p, Array< OneD, OctantFace > dir)
 Defualt constructor. More...
 
 Octant (int i, NekDouble x, NekDouble y, NekDouble z, NekDouble dx, const std::vector< CurvaturePointSharedPtr > &cplist)
 constructor for master octant More...
 
void Subdivide (OctantSharedPtr p, int &numoct)
 Subdivide the octant. More...
 
void CompileLeaves (std::vector< OctantSharedPtr > &Octants)
 Recursive method which gets a list of the leaf octants Moves down levels if octant is not a leaf. More...
 
int GetId ()
 Get the Id of the octant. More...
 
Array< OneD, NekDoubleGetLoc ()
 Get the location of the center of the octant. More...
 
NekDouble DX ()
 Get the octants half dimension. More...
 
std::vector
< CurvaturePointSharedPtr
GetCPList ()
 Get the list of curvature points that are within this octant. More...
 
int NumCurvePoint ()
 Get the number of points in the octants cp list. More...
 
int NumValidCurvePoint ()
 Get the number of valid cp points in the octants list. More...
 
void SetDelta (NekDouble d)
 Set the value for delta for this octant. More...
 
NekDouble GetDelta ()
 Get value of delta. More...
 
void SetChildren (Array< OneD, OctantSharedPtr > c)
 Set the children of this octant. More...
 
bool IsLeaf ()
 Get whether the octant is a leaf or not. More...
 
NekDouble FX (OctantFace f)
 Get the far dimension in a given direction f. More...
 
void RemoveNeigbour (int id, OctantFace f)
 Remove a neigbour from this octants list. More...
 
void SetNeigbour (OctantSharedPtr o, OctantFace f)
 
std::map< OctantFace,
std::vector< OctantSharedPtr > > 
GetNeigbours ()
 Get the map of neigbours. More...
 
bool NeedDivide ()
 Get whether this octants needs to divide based on the curvature sampling. More...
 
NekDouble Distance (OctantSharedPtr o)
 Get the distance from this octant to another. More...
 
bool IsDeltaKnown ()
 Get whether a value of delta has been set or not. More...
 
void SetLocation (OctantLocation l)
 set the location of the octant with respect to the CAD More...
 
CurvaturePointSharedPtr GetCPPoint ()
 Get the first cp point in the list. More...
 
OctantLocation GetLocation ()
 Get the location of the octant with respect to the geometry. More...
 
OctantSharedPtr GetChild (int q)
 Get a specific child of this octant. More...
 
int GetNumBoundary ()
 

Private Attributes

int m_id
 id More...
 
bool m_leaf
 leaf identifer More...
 
OctantSharedPtr m_parent
 parent id More...
 
Array< OneD, OctantSharedPtrm_children
 list of child ids More...
 
Array< OneD, NekDoublem_loc
 x,y,z location of the octant More...
 
NekDouble m_hd
 half dimension of the octant More...
 
std::vector
< CurvaturePointSharedPtr
m_localCPList
 curvature sampling point list More...
 
int m_numValidPoints
 number of valid cp points More...
 
int m_numBoundaryPoints
 
std::pair< bool, NekDoublem_delta
 mesh sizing parameter More...
 
bool m_needToDivide
 idenify if division is needed More...
 
OctantLocation m_location
 idenify if delta has ben set More...
 
std::map< OctantFace,
std::vector< OctantSharedPtr > > 
m_neigbours
 list of neighbours More...
 

Friends

class MemoryManager< Octant >
 

Detailed Description

this class contains the infomration and methods for individal octants in the Octree

Definition at line 81 of file Octant.h.

Constructor & Destructor Documentation

Nektar::NekMeshUtils::Octant::Octant ( int  i,
OctantSharedPtr  p,
Array< OneD, OctantFace dir 
)

Defualt constructor.

Definition at line 63 of file Octant.cpp.

References DX(), Nektar::NekMeshUtils::eBack, Nektar::NekMeshUtils::eDown, Nektar::NekMeshUtils::eForward, Nektar::NekMeshUtils::eLeft, Nektar::NekMeshUtils::eOnBoundary, Nektar::NekMeshUtils::eRight, Nektar::NekMeshUtils::eUnknown, Nektar::NekMeshUtils::eUp, GetDelta(), GetNumBoundary(), m_delta, m_hd, m_leaf, m_loc, m_localCPList, m_location, m_needToDivide, m_neigbours, m_numBoundaryPoints, m_numValidPoints, m_parent, NumValidCurvePoint(), and SetDelta().

Referenced by Subdivide().

64  : m_id(i), m_parent(p)
65 {
66  // initialise variables to defualt states
67  m_leaf = true;
68  m_needToDivide = false;
69  m_numValidPoints = 0;
71  m_delta = pair<bool, NekDouble>(false, 0.0);
72  NekDouble maxDif = 0;
73  NekDouble minDif = numeric_limits<double>::max();
75 
76  // build empty neigbour map
77  m_neigbours[eUp] = vector<OctantSharedPtr>();
78  m_neigbours[eDown] = vector<OctantSharedPtr>();
79  m_neigbours[eForward] = vector<OctantSharedPtr>();
80  m_neigbours[eBack] = vector<OctantSharedPtr>();
81  m_neigbours[eLeft] = vector<OctantSharedPtr>();
82  m_neigbours[eRight] = vector<OctantSharedPtr>();
83 
84  // pull information from parent
85  Array<OneD, NekDouble> parentloc = m_parent->GetLoc();
86  m_hd = m_parent->DX() / 2.0;
87  m_loc = Array<OneD, NekDouble>(3);
88  if (dir[0] == eForward)
89  {
90  m_loc[0] = parentloc[0] + m_hd;
91  }
92  else
93  {
94  m_loc[0] = parentloc[0] - m_hd;
95  }
96  if (dir[1] == eUp)
97  {
98  m_loc[1] = parentloc[1] + m_hd;
99  }
100  else
101  {
102  m_loc[1] = parentloc[1] - m_hd;
103  }
104  if (dir[2] == eLeft)
105  {
106  m_loc[2] = parentloc[2] + m_hd;
107  }
108  else
109  {
110  m_loc[2] = parentloc[2] - m_hd;
111  }
112 
113  vector<CurvaturePointSharedPtr> CurvaturePointList = m_parent->GetCPList();
114 
115  // setup complete
116 
117  // look over the curvature point list provided by the parent,
118  // firstly look to see if it is in the new octant and if so
119  // add it to the conserdation of the delta specification
120  for (int i = 0; i < CurvaturePointList.size(); i++)
121  {
122  Array<OneD, NekDouble> cploc = CurvaturePointList[i]->GetLoc();
123  if (!(cploc[0] > m_loc[0] + m_hd || cploc[0] < m_loc[0] - m_hd ||
124  cploc[1] > m_loc[1] + m_hd || cploc[1] < m_loc[1] - m_hd ||
125  cploc[2] > m_loc[2] + m_hd || cploc[2] < m_loc[2] - m_hd))
126  {
127  m_localCPList.push_back(CurvaturePointList[i]);
128 
129  if (CurvaturePointList[i]->IsValid())
130  {
131  if (CurvaturePointList[i]->GetDelta() > maxDif)
132  {
133  maxDif = CurvaturePointList[i]->GetDelta();
134  }
135 
136  if (CurvaturePointList[i]->GetDelta() < minDif)
137  {
138  minDif = CurvaturePointList[i]->GetDelta();
139  }
141  }
142  if (CurvaturePointList[i]->Isboundary())
143  {
145  }
146  }
147  }
148 
149  // if it has valid points delta can be calculated
150  if (NumValidCurvePoint() > 0)
151  {
152  // geometrically octant should subdivide
153  if (maxDif / minDif > 1.5)
154  {
155  m_needToDivide = true;
156  }
157 
158  SetDelta(minDif);
159 
160  if (GetDelta() > 5.0 * DX())
161  {
162  m_needToDivide = true;
163  }
164  }
165 
166  if (GetNumBoundary() > 0)
167  {
169  }
170 }
NekDouble GetDelta()
Get value of delta.
Definition: Octant.h:183
OctantLocation m_location
idenify if delta has ben set
Definition: Octant.h:344
bool m_leaf
leaf identifer
Definition: Octant.h:325
OctantSharedPtr m_parent
parent id
Definition: Octant.h:327
void SetDelta(NekDouble d)
Set the value for delta for this octant.
Definition: Octant.h:174
NekDouble m_hd
half dimension of the octant
Definition: Octant.h:333
NekDouble DX()
Get the octants half dimension.
Definition: Octant.h:142
std::vector< CurvaturePointSharedPtr > m_localCPList
curvature sampling point list
Definition: Octant.h:335
int m_numValidPoints
number of valid cp points
Definition: Octant.h:337
int NumValidCurvePoint()
Get the number of valid cp points in the octants list.
Definition: Octant.h:166
double NekDouble
Array< OneD, NekDouble > m_loc
x,y,z location of the octant
Definition: Octant.h:331
bool m_needToDivide
idenify if division is needed
Definition: Octant.h:342
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:346
std::pair< bool, NekDouble > m_delta
mesh sizing parameter
Definition: Octant.h:340
Nektar::NekMeshUtils::Octant::Octant ( int  i,
NekDouble  x,
NekDouble  y,
NekDouble  z,
NekDouble  dx,
const std::vector< CurvaturePointSharedPtr > &  cplist 
)

constructor for master octant

Definition at line 173 of file Octant.cpp.

References Nektar::NekMeshUtils::eBack, Nektar::NekMeshUtils::eDown, Nektar::NekMeshUtils::eForward, Nektar::NekMeshUtils::eLeft, Nektar::NekMeshUtils::eOnBoundary, Nektar::NekMeshUtils::eRight, Nektar::NekMeshUtils::eUp, m_delta, m_leaf, m_loc, m_localCPList, m_location, m_needToDivide, m_neigbours, and m_numValidPoints.

179  : m_id(i), m_hd(dx)
180 {
181  m_neigbours[eUp] = vector<OctantSharedPtr>();
182  m_neigbours[eDown] = vector<OctantSharedPtr>();
183  m_neigbours[eForward] = vector<OctantSharedPtr>();
184  m_neigbours[eBack] = vector<OctantSharedPtr>();
185  m_neigbours[eLeft] = vector<OctantSharedPtr>();
186  m_neigbours[eRight] = vector<OctantSharedPtr>();
187 
188  // initialise variables to defualt states
189  m_leaf = true;
190  m_needToDivide = true;
191  m_numValidPoints = 0;
192  m_delta = pair<bool, NekDouble>(false, 0.0);
193 
194  m_loc = Array<OneD, NekDouble>(3);
195  m_loc[0] = x;
196  m_loc[1] = y;
197  m_loc[2] = z;
198 
199  m_localCPList = cplist;
200 
201  for (int i = 0; i < m_localCPList.size(); i++)
202  {
203  if (m_localCPList[i]->IsValid())
204  {
206  }
207  }
208 
210 }
OctantLocation m_location
idenify if delta has ben set
Definition: Octant.h:344
bool m_leaf
leaf identifer
Definition: Octant.h:325
NekDouble m_hd
half dimension of the octant
Definition: Octant.h:333
std::vector< CurvaturePointSharedPtr > m_localCPList
curvature sampling point list
Definition: Octant.h:335
int m_numValidPoints
number of valid cp points
Definition: Octant.h:337
Array< OneD, NekDouble > m_loc
x,y,z location of the octant
Definition: Octant.h:331
bool m_needToDivide
idenify if division is needed
Definition: Octant.h:342
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:346
std::pair< bool, NekDouble > m_delta
mesh sizing parameter
Definition: Octant.h:340

Member Function Documentation

void Nektar::NekMeshUtils::Octant::CompileLeaves ( std::vector< OctantSharedPtr > &  Octants)
inline

Recursive method which gets a list of the leaf octants Moves down levels if octant is not a leaf.

Definition at line 110 of file Octant.h.

References IsLeaf(), and m_children.

111  {
112  for (int i = 0; i < 8; i++)
113  {
114  if (m_children[i]->IsLeaf())
115  {
116  Octants.push_back(m_children[i]);
117  }
118  else
119  {
120  m_children[i]->CompileLeaves(Octants);
121  }
122  }
123  }
Array< OneD, OctantSharedPtr > m_children
list of child ids
Definition: Octant.h:329
bool IsLeaf()
Get whether the octant is a leaf or not.
Definition: Octant.h:203
NekDouble Nektar::NekMeshUtils::Octant::Distance ( OctantSharedPtr  o)
inline

Get the distance from this octant to another.

Definition at line 266 of file Octant.h.

References m_loc.

267  {
268  Array<OneD, NekDouble> loc = o->GetLoc();
269  return sqrt((loc[0] - m_loc[0]) * (loc[0] - m_loc[0]) +
270  (loc[1] - m_loc[1]) * (loc[1] - m_loc[1]) +
271  (loc[2] - m_loc[2]) * (loc[2] - m_loc[2]));
272  }
Array< OneD, NekDouble > m_loc
x,y,z location of the octant
Definition: Octant.h:331
NekDouble Nektar::NekMeshUtils::Octant::DX ( )
inline

Get the octants half dimension.

Definition at line 142 of file Octant.h.

References m_hd.

Referenced by Octant().

143  {
144  return m_hd;
145  }
NekDouble m_hd
half dimension of the octant
Definition: Octant.h:333
NekDouble Nektar::NekMeshUtils::Octant::FX ( OctantFace  f)
inline

Get the far dimension in a given direction f.

Definition at line 211 of file Octant.h.

References Nektar::NekMeshUtils::eBack, Nektar::NekMeshUtils::eDown, Nektar::NekMeshUtils::eForward, Nektar::NekMeshUtils::eLeft, Nektar::NekMeshUtils::eRight, Nektar::NekMeshUtils::eUp, m_hd, and m_loc.

212  {
213  switch (f)
214  {
215  case eUp:
216  return m_loc[1] + m_hd;
217  break;
218  case eDown:
219  return m_loc[1] - m_hd;
220  break;
221  case eForward:
222  return m_loc[0] + m_hd;
223  break;
224  case eBack:
225  return m_loc[0] - m_hd;
226  break;
227  case eLeft:
228  return m_loc[2] + m_hd;
229  break;
230  case eRight:
231  return m_loc[2] - m_hd;
232  break;
233  }
234  }
NekDouble m_hd
half dimension of the octant
Definition: Octant.h:333
Array< OneD, NekDouble > m_loc
x,y,z location of the octant
Definition: Octant.h:331
OctantSharedPtr Nektar::NekMeshUtils::Octant::GetChild ( int  q)
inline

Get a specific child of this octant.

Definition at line 311 of file Octant.h.

References m_children.

312  {
313  return m_children[q];
314  }
Array< OneD, OctantSharedPtr > m_children
list of child ids
Definition: Octant.h:329
std::vector<CurvaturePointSharedPtr> Nektar::NekMeshUtils::Octant::GetCPList ( )
inline

Get the list of curvature points that are within this octant.

Definition at line 150 of file Octant.h.

References m_localCPList.

151  {
152  return m_localCPList;
153  }
std::vector< CurvaturePointSharedPtr > m_localCPList
curvature sampling point list
Definition: Octant.h:335
CurvaturePointSharedPtr Nektar::NekMeshUtils::Octant::GetCPPoint ( )
inline

Get the first cp point in the list.

Definition at line 293 of file Octant.h.

References ASSERTL0, and m_localCPList.

294  {
295  ASSERTL0(m_localCPList.size() > 0,
296  "tried to get cp point where there is none");
297  return m_localCPList[0];
298  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
std::vector< CurvaturePointSharedPtr > m_localCPList
curvature sampling point list
Definition: Octant.h:335
NekDouble Nektar::NekMeshUtils::Octant::GetDelta ( )
inline

Get value of delta.

Definition at line 183 of file Octant.h.

References ASSERTL0, and m_delta.

Referenced by Octant().

184  {
185  ASSERTL0(m_delta.first,
186  "Tried to acsess delta of octant"
187  "which has not been set");
188 
189  return m_delta.second;
190  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
std::pair< bool, NekDouble > m_delta
mesh sizing parameter
Definition: Octant.h:340
int Nektar::NekMeshUtils::Octant::GetId ( )
inline

Get the Id of the octant.

Definition at line 126 of file Octant.h.

References m_id.

Referenced by RemoveNeigbour(), and Subdivide().

127  {
128  return m_id;
129  }
Array<OneD, NekDouble> Nektar::NekMeshUtils::Octant::GetLoc ( )
inline

Get the location of the center of the octant.

Definition at line 134 of file Octant.h.

References m_loc.

135  {
136  return m_loc;
137  }
Array< OneD, NekDouble > m_loc
x,y,z location of the octant
Definition: Octant.h:331
OctantLocation Nektar::NekMeshUtils::Octant::GetLocation ( )
inline

Get the location of the octant with respect to the geometry.

Definition at line 303 of file Octant.h.

References m_location.

304  {
305  return m_location;
306  }
OctantLocation m_location
idenify if delta has ben set
Definition: Octant.h:344
std::map<OctantFace, std::vector<OctantSharedPtr> > Nektar::NekMeshUtils::Octant::GetNeigbours ( )
inline

Get the map of neigbours.

Definition at line 249 of file Octant.h.

References m_neigbours.

250  {
251  return m_neigbours;
252  }
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:346
int Nektar::NekMeshUtils::Octant::GetNumBoundary ( )
inline

Definition at line 316 of file Octant.h.

References m_numBoundaryPoints.

Referenced by Octant().

317  {
318  return m_numBoundaryPoints;
319  }
bool Nektar::NekMeshUtils::Octant::IsDeltaKnown ( )
inline

Get whether a value of delta has been set or not.

Definition at line 277 of file Octant.h.

References m_delta.

278  {
279  return m_delta.first;
280  }
std::pair< bool, NekDouble > m_delta
mesh sizing parameter
Definition: Octant.h:340
bool Nektar::NekMeshUtils::Octant::IsLeaf ( )
inline

Get whether the octant is a leaf or not.

Definition at line 203 of file Octant.h.

References m_leaf.

Referenced by CompileLeaves().

204  {
205  return m_leaf;
206  }
bool m_leaf
leaf identifer
Definition: Octant.h:325
bool Nektar::NekMeshUtils::Octant::NeedDivide ( )
inline

Get whether this octants needs to divide based on the curvature sampling.

Definition at line 258 of file Octant.h.

References m_needToDivide.

259  {
260  return m_needToDivide;
261  }
bool m_needToDivide
idenify if division is needed
Definition: Octant.h:342
int Nektar::NekMeshUtils::Octant::NumCurvePoint ( )
inline

Get the number of points in the octants cp list.

Definition at line 158 of file Octant.h.

References m_localCPList.

159  {
160  return m_localCPList.size();
161  }
std::vector< CurvaturePointSharedPtr > m_localCPList
curvature sampling point list
Definition: Octant.h:335
int Nektar::NekMeshUtils::Octant::NumValidCurvePoint ( )
inline

Get the number of valid cp points in the octants list.

Definition at line 166 of file Octant.h.

References m_numValidPoints.

Referenced by Octant().

167  {
168  return m_numValidPoints;
169  }
int m_numValidPoints
number of valid cp points
Definition: Octant.h:337
void Nektar::NekMeshUtils::Octant::RemoveNeigbour ( int  id,
OctantFace  f 
)

Remove a neigbour from this octants list.

Definition at line 494 of file Octant.cpp.

References GetId(), and m_neigbours.

495 {
496  vector<OctantSharedPtr> tmp = m_neigbours[f];
497  m_neigbours[f].clear();
498  bool found = false;
499  for (int i = 0; i < tmp.size(); i++)
500  {
501  if (tmp[i]->GetId() == id)
502  {
503  found = true;
504  }
505  else
506  {
507  m_neigbours[f].push_back(tmp[i]);
508  }
509  }
510  if (!found)
511  {
512  // cout << "!!!!!" << "NOT FOUND" << "!!!!!" << endl;
513  }
514 }
int GetId()
Get the Id of the octant.
Definition: Octant.h:126
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:346
void Nektar::NekMeshUtils::Octant::SetChildren ( Array< OneD, OctantSharedPtr c)
inline

Set the children of this octant.

Definition at line 195 of file Octant.h.

References m_children.

Referenced by Subdivide().

196  {
197  m_children = c;
198  }
Array< OneD, OctantSharedPtr > m_children
list of child ids
Definition: Octant.h:329
void Nektar::NekMeshUtils::Octant::SetDelta ( NekDouble  d)
inline

Set the value for delta for this octant.

Definition at line 174 of file Octant.h.

References m_delta.

Referenced by Octant().

175  {
176  m_delta.first = true;
177  m_delta.second = d;
178  }
std::pair< bool, NekDouble > m_delta
mesh sizing parameter
Definition: Octant.h:340
void Nektar::NekMeshUtils::Octant::SetLocation ( OctantLocation  l)
inline

set the location of the octant with respect to the CAD

Definition at line 285 of file Octant.h.

References m_location.

286  {
287  m_location = l;
288  }
OctantLocation m_location
idenify if delta has ben set
Definition: Octant.h:344
void Nektar::NekMeshUtils::Octant::SetNeigbour ( OctantSharedPtr  o,
OctantFace  f 
)
inline

Definition at line 241 of file Octant.h.

References m_neigbours.

242  {
243  m_neigbours[f].push_back(o);
244  }
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:346
void Nektar::NekMeshUtils::Octant::Subdivide ( OctantSharedPtr  p,
int &  numoct 
)

Subdivide the octant.

Definition at line 212 of file Octant.cpp.

References ASSERTL0, Nektar::NekMeshUtils::eBack, Nektar::NekMeshUtils::eDown, Nektar::NekMeshUtils::eForward, Nektar::NekMeshUtils::eLeft, Nektar::NekMeshUtils::eRight, Nektar::NekMeshUtils::eUp, GetId(), Nektar::NekMeshUtils::GetReverseFace(), m_leaf, m_neigbours, Octant(), and SetChildren().

213 {
214  ASSERTL0(m_leaf, "octant must be a leaf for subdivision");
215 
216  m_leaf = false; // set as not leaf and make children
217 
218  // need to loop over all neigbours and remove this octant from their lists
219  for (int i = 0; i < 6; i++)
220  {
221  OctantFace f = static_cast<OctantFace>(i);
222  vector<OctantSharedPtr> os = m_neigbours[f];
223  for (int j = 0; j < os.size(); j++)
224  {
225  os[j]->RemoveNeigbour(GetId(), GetReverseFace(f));
226  }
227  }
228 
229  Array<OneD, OctantSharedPtr> children(8);
230 
231  for (int i = 0; i < 8; i++)
232  {
233  // set up x,y,z ordering of the 8 octants
234  Array<OneD, OctantFace> dir(3);
235  if (i < 4)
236  {
237  dir[0] = eForward;
238  if (i < 2)
239  {
240  dir[1] = eUp;
241  }
242  else
243  {
244  dir[1] = eDown;
245  }
246  if (i == 0 || i == 2)
247  {
248  dir[2] = eLeft;
249  }
250  else
251  {
252  dir[2] = eRight;
253  }
254  }
255  else
256  {
257  dir[0] = eBack;
258  if (i < 6)
259  {
260  dir[1] = eUp;
261  }
262  else
263  {
264  dir[1] = eDown;
265  }
266  if (i == 4 || i == 6)
267  {
268  dir[2] = eLeft;
269  }
270  else
271  {
272  dir[2] = eRight;
273  }
274  }
275 
276  children[i] = boost::shared_ptr<Octant>(new Octant(numoct++, p, dir));
277  }
278 
279  SetChildren(children);
280 
281  // this set of neibours are based on the children of the octant, only covers
282  // three sides
283  children[0]->SetNeigbour(children[1], eRight);
284  children[0]->SetNeigbour(children[4], eBack);
285  children[0]->SetNeigbour(children[2], eDown);
286 
287  children[1]->SetNeigbour(children[0], eLeft);
288  children[1]->SetNeigbour(children[5], eBack);
289  children[1]->SetNeigbour(children[3], eDown);
290 
291  children[2]->SetNeigbour(children[3], eRight);
292  children[2]->SetNeigbour(children[6], eBack);
293  children[2]->SetNeigbour(children[0], eUp);
294 
295  children[3]->SetNeigbour(children[2], eLeft);
296  children[3]->SetNeigbour(children[7], eBack);
297  children[3]->SetNeigbour(children[1], eUp);
298 
299  children[4]->SetNeigbour(children[5], eRight);
300  children[4]->SetNeigbour(children[0], eForward);
301  children[4]->SetNeigbour(children[6], eDown);
302 
303  children[5]->SetNeigbour(children[4], eLeft);
304  children[5]->SetNeigbour(children[1], eForward);
305  children[5]->SetNeigbour(children[7], eDown);
306 
307  children[6]->SetNeigbour(children[7], eRight);
308  children[6]->SetNeigbour(children[2], eForward);
309  children[6]->SetNeigbour(children[4], eUp);
310 
311  children[7]->SetNeigbour(children[6], eLeft);
312  children[7]->SetNeigbour(children[3], eForward);
313  children[7]->SetNeigbour(children[5], eUp);
314 
315  // need to obtain the remaning information from the parents neigbours
316  // (m_neigbours)
317  // consider top face
318  if (m_neigbours[eUp].size() == 1)
319  {
320  children[0]->SetNeigbour(m_neigbours[eUp][0], eUp);
321  children[1]->SetNeigbour(m_neigbours[eUp][0], eUp);
322  children[4]->SetNeigbour(m_neigbours[eUp][0], eUp);
323  children[5]->SetNeigbour(m_neigbours[eUp][0], eUp);
324  m_neigbours[eUp][0]->SetNeigbour(children[0], eDown);
325  m_neigbours[eUp][0]->SetNeigbour(children[1], eDown);
326  m_neigbours[eUp][0]->SetNeigbour(children[4], eDown);
327  m_neigbours[eUp][0]->SetNeigbour(children[5], eDown);
328  }
329  else if (m_neigbours[eUp].size() == 4)
330  {
331  children[0]->SetNeigbour(m_neigbours[eUp][0], eUp); // 2
332  children[1]->SetNeigbour(m_neigbours[eUp][1], eUp); // 3
333  children[4]->SetNeigbour(m_neigbours[eUp][2], eUp); // 6
334  children[5]->SetNeigbour(m_neigbours[eUp][3], eUp); // 7
335  m_neigbours[eUp][0]->SetNeigbour(children[0], eDown);
336  m_neigbours[eUp][1]->SetNeigbour(children[1], eDown);
337  m_neigbours[eUp][2]->SetNeigbour(children[4], eDown);
338  m_neigbours[eUp][3]->SetNeigbour(children[5], eDown);
339  }
340  else if (m_neigbours[eUp].size() != 0)
341  {
342  cout << "!!!!!"
343  << "NOT GOOD"
344  << "!!!!! " << m_neigbours[eUp].size() << endl;
345  }
346 
347  if (m_neigbours[eDown].size() == 1)
348  {
349  children[2]->SetNeigbour(m_neigbours[eDown][0], eDown);
350  children[3]->SetNeigbour(m_neigbours[eDown][0], eDown);
351  children[6]->SetNeigbour(m_neigbours[eDown][0], eDown);
352  children[7]->SetNeigbour(m_neigbours[eDown][0], eDown);
353  m_neigbours[eDown][0]->SetNeigbour(children[2], eUp);
354  m_neigbours[eDown][0]->SetNeigbour(children[3], eUp);
355  m_neigbours[eDown][0]->SetNeigbour(children[6], eUp);
356  m_neigbours[eDown][0]->SetNeigbour(children[7], eUp);
357  }
358  else if (m_neigbours[eDown].size() == 4)
359  {
360  children[2]->SetNeigbour(m_neigbours[eDown][0], eDown); // 0
361  children[3]->SetNeigbour(m_neigbours[eDown][1], eDown); // 1
362  children[6]->SetNeigbour(m_neigbours[eDown][2], eDown); // 4
363  children[7]->SetNeigbour(m_neigbours[eDown][3], eDown); // 5
364  m_neigbours[eDown][0]->SetNeigbour(children[2], eUp);
365  m_neigbours[eDown][1]->SetNeigbour(children[3], eUp);
366  m_neigbours[eDown][2]->SetNeigbour(children[6], eUp);
367  m_neigbours[eDown][3]->SetNeigbour(children[7], eUp);
368  }
369  else if (m_neigbours[eDown].size() != 0)
370  {
371  cout << "!!!!!"
372  << "NOT GOOD"
373  << "!!!!! " << m_neigbours[eDown].size() << endl;
374  }
375 
376  if (m_neigbours[eForward].size() == 1)
377  {
378  children[0]->SetNeigbour(m_neigbours[eForward][0], eForward);
379  children[1]->SetNeigbour(m_neigbours[eForward][0], eForward);
380  children[2]->SetNeigbour(m_neigbours[eForward][0], eForward);
381  children[3]->SetNeigbour(m_neigbours[eForward][0], eForward);
382  m_neigbours[eForward][0]->SetNeigbour(children[0], eBack);
383  m_neigbours[eForward][0]->SetNeigbour(children[1], eBack);
384  m_neigbours[eForward][0]->SetNeigbour(children[2], eBack);
385  m_neigbours[eForward][0]->SetNeigbour(children[3], eBack);
386  }
387  else if (m_neigbours[eForward].size() == 4)
388  {
389  children[0]->SetNeigbour(m_neigbours[eForward][0], eForward); // 4
390  children[1]->SetNeigbour(m_neigbours[eForward][1], eForward); // 5
391  children[2]->SetNeigbour(m_neigbours[eForward][2], eForward); // 6
392  children[3]->SetNeigbour(m_neigbours[eForward][3], eForward); // 7
393  m_neigbours[eForward][0]->SetNeigbour(children[0], eBack);
394  m_neigbours[eForward][1]->SetNeigbour(children[1], eBack);
395  m_neigbours[eForward][2]->SetNeigbour(children[2], eBack);
396  m_neigbours[eForward][3]->SetNeigbour(children[3], eBack);
397  }
398  else if (m_neigbours[eForward].size() != 0)
399  {
400  cout << "!!!!!"
401  << "NOT GOOD"
402  << "!!!!! " << m_neigbours[eForward].size() << endl;
403  }
404 
405  if (m_neigbours[eBack].size() == 1)
406  {
407  children[4]->SetNeigbour(m_neigbours[eBack][0], eBack);
408  children[5]->SetNeigbour(m_neigbours[eBack][0], eBack);
409  children[6]->SetNeigbour(m_neigbours[eBack][0], eBack);
410  children[7]->SetNeigbour(m_neigbours[eBack][0], eBack);
411  m_neigbours[eBack][0]->SetNeigbour(children[4], eForward);
412  m_neigbours[eBack][0]->SetNeigbour(children[5], eForward);
413  m_neigbours[eBack][0]->SetNeigbour(children[6], eForward);
414  m_neigbours[eBack][0]->SetNeigbour(children[7], eForward);
415  }
416  else if (m_neigbours[eBack].size() == 4)
417  {
418  children[4]->SetNeigbour(m_neigbours[eBack][0], eBack); // 0
419  children[5]->SetNeigbour(m_neigbours[eBack][1], eBack); // 1
420  children[6]->SetNeigbour(m_neigbours[eBack][2], eBack); // 2
421  children[7]->SetNeigbour(m_neigbours[eBack][3], eBack); // 3
422  m_neigbours[eBack][0]->SetNeigbour(children[4], eForward);
423  m_neigbours[eBack][1]->SetNeigbour(children[5], eForward);
424  m_neigbours[eBack][2]->SetNeigbour(children[6], eForward);
425  m_neigbours[eBack][3]->SetNeigbour(children[7], eForward);
426  }
427  else if (m_neigbours[eBack].size() != 0)
428  {
429  cout << "!!!!!"
430  << "NOT GOOD"
431  << "!!!!! " << m_neigbours[eBack].size() << endl;
432  }
433 
434  if (m_neigbours[eLeft].size() == 1)
435  {
436  children[0]->SetNeigbour(m_neigbours[eLeft][0], eLeft);
437  children[2]->SetNeigbour(m_neigbours[eLeft][0], eLeft);
438  children[4]->SetNeigbour(m_neigbours[eLeft][0], eLeft);
439  children[6]->SetNeigbour(m_neigbours[eLeft][0], eLeft);
440  m_neigbours[eLeft][0]->SetNeigbour(children[0], eRight);
441  m_neigbours[eLeft][0]->SetNeigbour(children[2], eRight);
442  m_neigbours[eLeft][0]->SetNeigbour(children[4], eRight);
443  m_neigbours[eLeft][0]->SetNeigbour(children[6], eRight);
444  }
445  else if (m_neigbours[eLeft].size() == 4)
446  {
447  children[0]->SetNeigbour(m_neigbours[eLeft][0], eLeft); // 1
448  children[2]->SetNeigbour(m_neigbours[eLeft][1], eLeft); // 3
449  children[4]->SetNeigbour(m_neigbours[eLeft][2], eLeft); // 5
450  children[6]->SetNeigbour(m_neigbours[eLeft][3], eLeft); // 7
451  m_neigbours[eLeft][0]->SetNeigbour(children[0], eRight);
452  m_neigbours[eLeft][1]->SetNeigbour(children[2], eRight);
453  m_neigbours[eLeft][2]->SetNeigbour(children[4], eRight);
454  m_neigbours[eLeft][3]->SetNeigbour(children[6], eRight);
455  }
456  else if (m_neigbours[eLeft].size() != 0)
457  {
458  cout << "!!!!!"
459  << "NOT GOOD"
460  << "!!!!! " << m_neigbours[eLeft].size() << endl;
461  cout << m_neigbours[eLeft].size() << endl;
462  }
463 
464  if (m_neigbours[eRight].size() == 1)
465  {
466  children[1]->SetNeigbour(m_neigbours[eRight][0], eRight);
467  children[3]->SetNeigbour(m_neigbours[eRight][0], eRight);
468  children[5]->SetNeigbour(m_neigbours[eRight][0], eRight);
469  children[7]->SetNeigbour(m_neigbours[eRight][0], eRight);
470  m_neigbours[eRight][0]->SetNeigbour(children[1], eLeft);
471  m_neigbours[eRight][0]->SetNeigbour(children[3], eLeft);
472  m_neigbours[eRight][0]->SetNeigbour(children[5], eLeft);
473  m_neigbours[eRight][0]->SetNeigbour(children[7], eLeft);
474  }
475  else if (m_neigbours[eRight].size() == 4)
476  {
477  children[1]->SetNeigbour(m_neigbours[eRight][0], eRight); // 0
478  children[3]->SetNeigbour(m_neigbours[eRight][1], eRight); // 2
479  children[5]->SetNeigbour(m_neigbours[eRight][2], eRight); // 4
480  children[7]->SetNeigbour(m_neigbours[eRight][3], eRight); // 6
481  m_neigbours[eRight][0]->SetNeigbour(children[1], eLeft);
482  m_neigbours[eRight][1]->SetNeigbour(children[3], eLeft);
483  m_neigbours[eRight][2]->SetNeigbour(children[5], eLeft);
484  m_neigbours[eRight][3]->SetNeigbour(children[7], eLeft);
485  }
486  else if (m_neigbours[eRight].size() != 0)
487  {
488  cout << "!!!!!"
489  << "NOT GOOD"
490  << "!!!!! " << m_neigbours[eRight].size() << endl;
491  }
492 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
bool m_leaf
leaf identifer
Definition: Octant.h:325
Octant(int i, OctantSharedPtr p, Array< OneD, OctantFace > dir)
Defualt constructor.
Definition: Octant.cpp:63
int GetId()
Get the Id of the octant.
Definition: Octant.h:126
OctantFace GetReverseFace(OctantFace f)
Definition: Octant.cpp:44
OctantFace
enumeration of the 6 faces of a cube/octant
Definition: Octant.h:52
void SetChildren(Array< OneD, OctantSharedPtr > c)
Set the children of this octant.
Definition: Octant.h:195
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:346

Friends And Related Function Documentation

friend class MemoryManager< Octant >
friend

Definition at line 84 of file Octant.h.

Member Data Documentation

Array<OneD, OctantSharedPtr> Nektar::NekMeshUtils::Octant::m_children
private

list of child ids

Definition at line 329 of file Octant.h.

Referenced by CompileLeaves(), GetChild(), and SetChildren().

std::pair<bool, NekDouble> Nektar::NekMeshUtils::Octant::m_delta
private

mesh sizing parameter

Definition at line 340 of file Octant.h.

Referenced by GetDelta(), IsDeltaKnown(), Octant(), and SetDelta().

NekDouble Nektar::NekMeshUtils::Octant::m_hd
private

half dimension of the octant

Definition at line 333 of file Octant.h.

Referenced by DX(), FX(), and Octant().

int Nektar::NekMeshUtils::Octant::m_id
private

id

Definition at line 323 of file Octant.h.

Referenced by GetId().

bool Nektar::NekMeshUtils::Octant::m_leaf
private

leaf identifer

Definition at line 325 of file Octant.h.

Referenced by IsLeaf(), Octant(), and Subdivide().

Array<OneD, NekDouble> Nektar::NekMeshUtils::Octant::m_loc
private

x,y,z location of the octant

Definition at line 331 of file Octant.h.

Referenced by Distance(), FX(), GetLoc(), and Octant().

std::vector<CurvaturePointSharedPtr> Nektar::NekMeshUtils::Octant::m_localCPList
private

curvature sampling point list

Definition at line 335 of file Octant.h.

Referenced by GetCPList(), GetCPPoint(), NumCurvePoint(), and Octant().

OctantLocation Nektar::NekMeshUtils::Octant::m_location
private

idenify if delta has ben set

Definition at line 344 of file Octant.h.

Referenced by GetLocation(), Octant(), and SetLocation().

bool Nektar::NekMeshUtils::Octant::m_needToDivide
private

idenify if division is needed

Definition at line 342 of file Octant.h.

Referenced by NeedDivide(), and Octant().

std::map<OctantFace, std::vector<OctantSharedPtr> > Nektar::NekMeshUtils::Octant::m_neigbours
private

list of neighbours

Definition at line 346 of file Octant.h.

Referenced by GetNeigbours(), Octant(), RemoveNeigbour(), SetNeigbour(), and Subdivide().

int Nektar::NekMeshUtils::Octant::m_numBoundaryPoints
private

Definition at line 338 of file Octant.h.

Referenced by GetNumBoundary(), and Octant().

int Nektar::NekMeshUtils::Octant::m_numValidPoints
private

number of valid cp points

Definition at line 337 of file Octant.h.

Referenced by NumValidCurvePoint(), and Octant().

OctantSharedPtr Nektar::NekMeshUtils::Octant::m_parent
private

parent id

Definition at line 327 of file Octant.h.

Referenced by Octant().