Nektar++
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>

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< SPBaseSharedPtr > &splist)
 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< SPBaseSharedPtrGetSPList ()
 Get the list of curvature points that are within this octant. More...
 
SPBaseSharedPtr GetABoundPoint ()
 
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...
 
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< SPBaseSharedPtrm_localSPList
 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 80 of file Octant.h.

Constructor & Destructor Documentation

◆ Octant() [1/2]

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

Defualt constructor.

Definition at line 64 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_localSPList, m_location, m_needToDivide, m_neigbours, m_numBoundaryPoints, m_numValidPoints, m_parent, NumValidCurvePoint(), and SetDelta().

Referenced by Subdivide().

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

◆ Octant() [2/2]

Nektar::NekMeshUtils::Octant::Octant ( int  i,
NekDouble  x,
NekDouble  y,
NekDouble  z,
NekDouble  dx,
const std::vector< SPBaseSharedPtr > &  splist 
)

constructor for master octant

Definition at line 175 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_localSPList, m_location, m_needToDivide, m_neigbours, and m_numValidPoints.

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

Member Function Documentation

◆ CompileLeaves()

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 109 of file Octant.h.

References IsLeaf(), and m_children.

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

◆ Distance()

NekDouble Nektar::NekMeshUtils::Octant::Distance ( OctantSharedPtr  o)
inline

Get the distance from this octant to another.

Definition at line 284 of file Octant.h.

References CG_Iterations::loc, and m_loc.

285  {
286  Array<OneD, NekDouble> loc = o->GetLoc();
287  return sqrt((loc[0] - m_loc[0]) * (loc[0] - m_loc[0]) +
288  (loc[1] - m_loc[1]) * (loc[1] - m_loc[1]) +
289  (loc[2] - m_loc[2]) * (loc[2] - m_loc[2]));
290  }
Array< OneD, NekDouble > m_loc
x,y,z location of the octant
Definition: Octant.h:339

◆ DX()

NekDouble Nektar::NekMeshUtils::Octant::DX ( )
inline

Get the octants half dimension.

Definition at line 141 of file Octant.h.

References m_hd.

Referenced by Octant().

142  {
143  return m_hd;
144  }
NekDouble m_hd
half dimension of the octant
Definition: Octant.h:341

◆ FX()

NekDouble Nektar::NekMeshUtils::Octant::FX ( OctantFace  f)
inline

Get the far dimension in a given direction f.

Definition at line 228 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, m_loc, and RemoveNeigbour().

229  {
230  switch (f)
231  {
232  case eUp:
233  return m_loc[1] + m_hd;
234  break;
235  case eDown:
236  return m_loc[1] - m_hd;
237  break;
238  case eForward:
239  return m_loc[0] + m_hd;
240  break;
241  case eBack:
242  return m_loc[0] - m_hd;
243  break;
244  case eLeft:
245  return m_loc[2] + m_hd;
246  break;
247  case eRight:
248  return m_loc[2] - m_hd;
249  break;
250  }
251  return 0.0;
252  }
NekDouble m_hd
half dimension of the octant
Definition: Octant.h:341
Array< OneD, NekDouble > m_loc
x,y,z location of the octant
Definition: Octant.h:339

◆ GetABoundPoint()

SPBaseSharedPtr Nektar::NekMeshUtils::Octant::GetABoundPoint ( )
inline

Definition at line 154 of file Octant.h.

References ASSERTL0, Nektar::NekMeshUtils::eCBoundary, Nektar::NekMeshUtils::ePBoundary, and m_localSPList.

155  {
156  SPBaseSharedPtr ret;
157  bool found = false;
158  for(int i = 0; i < m_localSPList.size(); i++)
159  {
160  if(m_localSPList[i]->GetType() == eCBoundary ||
161  m_localSPList[i]->GetType() == ePBoundary)
162  {
163  ret = m_localSPList[i];
164  found = true;
165  break;
166  }
167  }
168  ASSERTL0(found,"failed to find point");
169  return ret;
170  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
std::vector< SPBaseSharedPtr > m_localSPList
curvature sampling point list
Definition: Octant.h:343
std::shared_ptr< SPBase > SPBaseSharedPtr

◆ GetChild()

OctantSharedPtr Nektar::NekMeshUtils::Octant::GetChild ( int  q)
inline

Get a specific child of this octant.

Definition at line 319 of file Octant.h.

References m_children.

320  {
321  return m_children[q];
322  }
Array< OneD, OctantSharedPtr > m_children
list of child ids
Definition: Octant.h:337

◆ GetDelta()

NekDouble Nektar::NekMeshUtils::Octant::GetDelta ( )
inline

Get value of delta.

Definition at line 200 of file Octant.h.

References ASSERTL0, and m_delta.

Referenced by Octant().

201  {
202  ASSERTL0(m_delta.first,
203  "Tried to acsess delta of octant"
204  "which has not been set");
205 
206  return m_delta.second;
207  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
std::pair< bool, NekDouble > m_delta
mesh sizing parameter
Definition: Octant.h:348

◆ GetId()

int Nektar::NekMeshUtils::Octant::GetId ( )
inline

Get the Id of the octant.

Definition at line 125 of file Octant.h.

References m_id.

Referenced by RemoveNeigbour(), and Subdivide().

126  {
127  return m_id;
128  }

◆ GetLoc()

Array<OneD, NekDouble> Nektar::NekMeshUtils::Octant::GetLoc ( )
inline

Get the location of the center of the octant.

Definition at line 133 of file Octant.h.

References m_loc.

134  {
135  return m_loc;
136  }
Array< OneD, NekDouble > m_loc
x,y,z location of the octant
Definition: Octant.h:339

◆ GetLocation()

OctantLocation Nektar::NekMeshUtils::Octant::GetLocation ( )
inline

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

Definition at line 311 of file Octant.h.

References m_location.

312  {
313  return m_location;
314  }
OctantLocation m_location
idenify if delta has ben set
Definition: Octant.h:352

◆ GetNeigbours()

std::map<OctantFace, std::vector<OctantSharedPtr> > Nektar::NekMeshUtils::Octant::GetNeigbours ( )
inline

Get the map of neigbours.

Definition at line 267 of file Octant.h.

References m_neigbours.

268  {
269  return m_neigbours;
270  }
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:354

◆ GetNumBoundary()

int Nektar::NekMeshUtils::Octant::GetNumBoundary ( )
inline

Definition at line 324 of file Octant.h.

References m_numBoundaryPoints.

Referenced by Octant().

325  {
326  return m_numBoundaryPoints;
327  }

◆ GetSPList()

std::vector<SPBaseSharedPtr> Nektar::NekMeshUtils::Octant::GetSPList ( )
inline

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

Definition at line 149 of file Octant.h.

References m_localSPList.

150  {
151  return m_localSPList;
152  }
std::vector< SPBaseSharedPtr > m_localSPList
curvature sampling point list
Definition: Octant.h:343

◆ IsDeltaKnown()

bool Nektar::NekMeshUtils::Octant::IsDeltaKnown ( )
inline

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

Definition at line 295 of file Octant.h.

References m_delta.

296  {
297  return m_delta.first;
298  }
std::pair< bool, NekDouble > m_delta
mesh sizing parameter
Definition: Octant.h:348

◆ IsLeaf()

bool Nektar::NekMeshUtils::Octant::IsLeaf ( )
inline

Get whether the octant is a leaf or not.

Definition at line 220 of file Octant.h.

References m_leaf.

Referenced by CompileLeaves().

221  {
222  return m_leaf;
223  }
bool m_leaf
leaf identifer
Definition: Octant.h:333

◆ NeedDivide()

bool Nektar::NekMeshUtils::Octant::NeedDivide ( )
inline

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

Definition at line 276 of file Octant.h.

References m_needToDivide.

277  {
278  return m_needToDivide;
279  }
bool m_needToDivide
idenify if division is needed
Definition: Octant.h:350

◆ NumCurvePoint()

int Nektar::NekMeshUtils::Octant::NumCurvePoint ( )
inline

Get the number of points in the octants cp list.

Definition at line 175 of file Octant.h.

References m_localSPList.

176  {
177  return m_localSPList.size();
178  }
std::vector< SPBaseSharedPtr > m_localSPList
curvature sampling point list
Definition: Octant.h:343

◆ NumValidCurvePoint()

int Nektar::NekMeshUtils::Octant::NumValidCurvePoint ( )
inline

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

Definition at line 183 of file Octant.h.

References m_numValidPoints.

Referenced by Octant().

184  {
185  return m_numValidPoints;
186  }
int m_numValidPoints
number of valid cp points
Definition: Octant.h:345

◆ RemoveNeigbour()

void Nektar::NekMeshUtils::Octant::RemoveNeigbour ( int  id,
OctantFace  f 
)

Remove a neigbour from this octants list.

Definition at line 496 of file Octant.cpp.

References GetId(), and m_neigbours.

Referenced by FX().

497 {
498  vector<OctantSharedPtr> tmp = m_neigbours[f];
499  m_neigbours[f].clear();
500  for (int i = 0; i < tmp.size(); i++)
501  {
502  if (tmp[i]->GetId() != id)
503  {
504  m_neigbours[f].push_back(tmp[i]);
505  }
506  }
507 }
int GetId()
Get the Id of the octant.
Definition: Octant.h:125
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:354

◆ SetChildren()

void Nektar::NekMeshUtils::Octant::SetChildren ( Array< OneD, OctantSharedPtr c)
inline

Set the children of this octant.

Definition at line 212 of file Octant.h.

References m_children.

Referenced by Subdivide().

213  {
214  m_children = c;
215  }
Array< OneD, OctantSharedPtr > m_children
list of child ids
Definition: Octant.h:337

◆ SetDelta()

void Nektar::NekMeshUtils::Octant::SetDelta ( NekDouble  d)
inline

Set the value for delta for this octant.

Definition at line 191 of file Octant.h.

References m_delta.

Referenced by Octant().

192  {
193  m_delta.first = true;
194  m_delta.second = d;
195  }
std::pair< bool, NekDouble > m_delta
mesh sizing parameter
Definition: Octant.h:348

◆ SetLocation()

void Nektar::NekMeshUtils::Octant::SetLocation ( OctantLocation  l)
inline

set the location of the octant with respect to the CAD

Definition at line 303 of file Octant.h.

References m_location.

304  {
305  m_location = l;
306  }
OctantLocation m_location
idenify if delta has ben set
Definition: Octant.h:352

◆ SetNeigbour()

void Nektar::NekMeshUtils::Octant::SetNeigbour ( OctantSharedPtr  o,
OctantFace  f 
)
inline

Definition at line 259 of file Octant.h.

References m_neigbours.

260  {
261  m_neigbours[f].push_back(o);
262  }
std::map< OctantFace, std::vector< OctantSharedPtr > > m_neigbours
list of neighbours
Definition: Octant.h:354

◆ Subdivide()

void Nektar::NekMeshUtils::Octant::Subdivide ( OctantSharedPtr  p,
int &  numoct 
)

Subdivide the octant.

Definition at line 214 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().

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

Friends And Related Function Documentation

◆ MemoryManager< Octant >

friend class MemoryManager< Octant >
friend

Definition at line 83 of file Octant.h.

Member Data Documentation

◆ m_children

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

list of child ids

Definition at line 337 of file Octant.h.

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

◆ m_delta

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

mesh sizing parameter

Definition at line 348 of file Octant.h.

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

◆ m_hd

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

half dimension of the octant

Definition at line 341 of file Octant.h.

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

◆ m_id

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

id

Definition at line 331 of file Octant.h.

Referenced by GetId().

◆ m_leaf

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

leaf identifer

Definition at line 333 of file Octant.h.

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

◆ m_loc

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

x,y,z location of the octant

Definition at line 339 of file Octant.h.

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

◆ m_localSPList

std::vector<SPBaseSharedPtr> Nektar::NekMeshUtils::Octant::m_localSPList
private

curvature sampling point list

Definition at line 343 of file Octant.h.

Referenced by GetABoundPoint(), GetSPList(), NumCurvePoint(), and Octant().

◆ m_location

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

idenify if delta has ben set

Definition at line 352 of file Octant.h.

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

◆ m_needToDivide

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

idenify if division is needed

Definition at line 350 of file Octant.h.

Referenced by NeedDivide(), and Octant().

◆ m_neigbours

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

list of neighbours

Definition at line 354 of file Octant.h.

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

◆ m_numBoundaryPoints

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

Definition at line 346 of file Octant.h.

Referenced by GetNumBoundary(), and Octant().

◆ m_numValidPoints

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

number of valid cp points

Definition at line 345 of file Octant.h.

Referenced by NumValidCurvePoint(), and Octant().

◆ m_parent

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

parent id

Definition at line 335 of file Octant.h.

Referenced by Octant().