Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Typedefs | Enumerations | Functions
Nektar::NekMeshUtils Namespace Reference

Classes

class  BLMesh
 
class  CADCurve
 class for CAD curves. More...
 
class  CADObj
 class for CAD curves. More...
 
class  CADSurf
 class for handleing a cad surface More...
 
class  CADSystem
 Base class for CAD interface system. More...
 
class  CADVert
 class for CAD curves. More...
 
class  Composite
 A composite is a collection of elements. More...
 
struct  Condition
 Defines a boundary condition. More...
 
class  CurvaturePoint
 class for a curvature samlping Point More...
 
class  CurveMesh
 
class  Edge
 Represents an edge which joins two points. More...
 
struct  EdgeHash
 Defines a hash function for edges. More...
 
struct  EdgeLoop
 struct which descibes a collection of cad edges which for a loop on the cad surface More...
 
class  Element
 Base class for element definitions. More...
 
struct  element_id_less_than
 Define element ordering based on ID. More...
 
struct  ElmtConfig
 Basic information about an element. More...
 
class  Face
 Represents a face comprised of three or more edges. More...
 
struct  FaceHash
 
class  FaceMesh
 class for surface meshes on individual surfaces (paramter plane meshes) More...
 
class  Hexahedron
 A 3-dimensional six-faced element. More...
 
struct  HOSurfHash
 
struct  HOTriangle
 A lightweight struct for dealing with high-order triangle alignment. More...
 
class  Line
 A 1-dimensional line between two vertex nodes. More...
 
struct  linesource
 
class  Mesh
 
class  Node
 Represents a point in the domain. More...
 
struct  NodeHash
 Defines a hash function for nodes. More...
 
class  Octant
 this class contains the infomration and methods for individal octants in the Octree More...
 
class  Octree
 class for octree More...
 
class  OptiEdge
 
class  OptiFace
 
class  OptiObj
 
class  Point
 A 0-dimensional vertex. More...
 
class  Prism
 A 3-dimensional five-faced element (2 triangles, 3 quadrilaterals). More...
 
class  Pyramid
 A 3-dimensional square-based pyramidic element. More...
 
class  Quadrilateral
 A 2-dimensional four-sided element. More...
 
class  SurfaceMesh
 class containing all surface meshing routines methods and classes More...
 
class  TetGenInterface
 Class for interacting with the external library TetGen. More...
 
class  TetMesh
 class for taking surface mesh and octree spec and making a 3d tet mesh More...
 
struct  TetOrient
 
struct  TetOrientHash
 
class  Tetrahedron
 A 3-dimensional four-faced element. More...
 
class  Triangle
 A 2-dimensional three-sided element. More...
 
class  TriangleInterface
 class for interfacing with external library triangle More...
 

Typedefs

typedef boost::shared_ptr< BLMeshBLMeshSharedPtr
 
typedef boost::shared_ptr
< CADCurve
CADCurveSharedPtr
 
typedef boost::shared_ptr< CADObjCADObjSharedPtr
 
typedef boost::shared_ptr
< CADSurf
CADSurfSharedPtr
 
typedef boost::shared_ptr
< CADVert
CADVertSharedPtr
 
typedef boost::shared_ptr
< CADSystem
CADSystemSharedPtr
 
typedef boost::shared_ptr
< TetGenInterface
TetGenInterfaceSharedPtr
 
typedef boost::shared_ptr
< TriangleInterface
TriangleInterfaceSharedPtr
 
typedef boost::shared_ptr
< Composite
CompositeSharedPtr
 Shared pointer to a composite. More...
 
typedef std::map< unsigned int,
CompositeSharedPtr
CompositeMap
 Container of composites; key is the composite id, value is the composite. More...
 
typedef boost::shared_ptr
< Element
ElementSharedPtr
 
typedef boost::shared_ptr< EdgeEdgeSharedPtr
 Shared pointer to an edge. More...
 
typedef boost::unordered_set
< EdgeSharedPtr, EdgeHash
EdgeSet
 
typedef std::map< unsigned int,
std::vector< ElementSharedPtr > > 
ElementMap
 Container for elements; key is expansion dimension, value is vector of elements of that dimension. More...
 
typedef
Nektar::LibUtilities::NekFactory
< LibUtilities::ShapeType,
Element, ElmtConfig,
std::vector< NodeSharedPtr >
, std::vector< int > > 
ElementFactory
 Element factory definition. More...
 
typedef boost::shared_ptr< FaceFaceSharedPtr
 Shared pointer to a face. More...
 
typedef boost::unordered_set
< FaceSharedPtr, FaceHash
FaceSet
 
typedef boost::shared_ptr
< Condition
ConditionSharedPtr
 
typedef std::map< int,
ConditionSharedPtr
ConditionMap
 
typedef boost::shared_ptr< MeshMeshSharedPtr
 Shared pointer to a mesh. More...
 
typedef boost::shared_ptr< NodeNodeSharedPtr
 
typedef boost::unordered_set
< NodeSharedPtr, NodeHash
NodeSet
 
typedef boost::unordered_set
< struct TetOrient,
TetOrientHash
TetOrientSet
 
typedef HOTriangle< NodeSharedPtrHOSurf
 
typedef boost::shared_ptr< HOSurfHOSurfSharedPtr
 
typedef boost::unordered_set
< HOSurfSharedPtr, HOSurfHash
HOSurfSet
 
typedef boost::shared_ptr
< CurvaturePoint
CurvaturePointSharedPtr
 
typedef boost::shared_ptr< OctantOctantSharedPtr
 
typedef boost::shared_ptr< OctreeOctreeSharedPtr
 
typedef boost::shared_ptr
< OptiObj
OptiObjSharedPtr
 
typedef boost::shared_ptr
< CurveMesh
CurveMeshSharedPtr
 
typedef boost::shared_ptr
< FaceMesh
FaceMeshSharedPtr
 
typedef boost::shared_ptr
< OptiEdge
OptiEdgeSharedPtr
 
typedef boost::shared_ptr
< OptiFace
OptiFaceSharedPtr
 
typedef boost::shared_ptr
< SurfaceMesh
SurfaceMeshSharedPtr
 
typedef boost::shared_ptr
< TetMesh
TetMeshSharedPtr
 

Enumerations

enum  cadType { vert, curve, surf }
 
enum  ConditionType {
  eDirichlet, eNeumann, eRobin, ePeriodic,
  eHOPCondition, SIZE_ConditionType
}
 
enum  OctantFace {
  eUp, eDown, eForward, eBack,
  eLeft, eRight
}
 enumeration of the 6 faces of a cube/octant More...
 
enum  OctantLocation { eInside, eOutside, eOnBoundary, eUnknown }
 enumeration of the possible locations of the octree with respect to the CAD More...
 

Functions

bool operator== (ElmtConfig const &c1, ElmtConfig const &c2)
 
bool operator== (HOSurfSharedPtr const &p1, HOSurfSharedPtr const &p2)
 Compares two HOSurf objects referred to as shared pointers. More...
 
bool operator== (ConditionSharedPtr const &c1, ConditionSharedPtr const &c2)
 Test equality of two conditions - i.e. compare types, fields and values but not composite ids. More...
 
bool operator== (NodeSharedPtr const &p1, NodeSharedPtr const &p2)
 Defines equality between two NodeSharedPtr objects. More...
 
bool operator!= (NodeSharedPtr const &p1, NodeSharedPtr const &p2)
 
bool operator< (NodeSharedPtr const &p1, NodeSharedPtr const &p2)
 Defines ordering between two NodeSharedPtr objects. More...
 
std::ostream & operator<< (std::ostream &os, const NodeSharedPtr &n)
 
bool operator== (EdgeSharedPtr const &p1, EdgeSharedPtr const &p2)
 Defines equality of two edges (equal if IDs of end nodes match in either ordering). More...
 
bool operator< (EdgeSharedPtr const &p1, EdgeSharedPtr const &p2)
 Defines ordering between two edges (based on ID of edges). More...
 
bool operator== (FaceSharedPtr const &p1, FaceSharedPtr const &p2)
 Defines equality of two faces (equal if IDs of vertices are the same.) More...
 
bool operator< (FaceSharedPtr const &p1, FaceSharedPtr const &p2)
 Defines ordering between two faces (depending on ID of faces). More...
 
ElementFactoryGetElementFactory ()
 
bool operator== (const struct TetOrient &a, const struct TetOrient &b)
 
OctantFace GetReverseFace (OctantFace f)
 
bool operator== (OctantSharedPtr const &p1, OctantSharedPtr const &p2)
 
bool BGFSUpdate (OptiObjSharedPtr opti, DNekMat &J, DNekMat &B, DNekMat &H)
 
NekDouble Dot (Array< OneD, NekDouble > a, Array< OneD, NekDouble > b)
 
Array< OneD, NekDoubleTake (Array< OneD, NekDouble > a, Array< OneD, NekDouble > b)
 
Array< OneD, NekDoubleTimes (NekDouble t, Array< OneD, NekDouble > a)
 
Array< OneD, NekDoubleAdd (Array< OneD, NekDouble > a, Array< OneD, NekDouble > b)
 
set< pair< int, int > > ListOfFaceSpings (int nq)
 
map< pair< int, int >, NekDoubleweights (set< pair< int, int > > springs, Array< OneD, NekDouble > u, Array< OneD, NekDouble > v)
 

Typedef Documentation

typedef boost::shared_ptr<BLMesh> Nektar::NekMeshUtils::BLMeshSharedPtr

Definition at line 89 of file BLMesh.h.

typedef boost::shared_ptr< CADCurve > Nektar::NekMeshUtils::CADCurveSharedPtr

Definition at line 168 of file CADCurve.h.

typedef boost::shared_ptr<CADObj> Nektar::NekMeshUtils::CADObjSharedPtr

Definition at line 96 of file CADObj.h.

typedef boost::shared_ptr< CADSurf > Nektar::NekMeshUtils::CADSurfSharedPtr

Definition at line 217 of file CADSurf.h.

Definition at line 185 of file CADSystem.h.

typedef boost::shared_ptr< CADVert > Nektar::NekMeshUtils::CADVertSharedPtr

Definition at line 51 of file CADSystem.h.

typedef std::map<unsigned int, CompositeSharedPtr> Nektar::NekMeshUtils::CompositeMap

Container of composites; key is the composite id, value is the composite.

Definition at line 124 of file Composite.h.

Shared pointer to a composite.

Definition at line 121 of file Composite.h.

Definition at line 79 of file Mesh.h.

Definition at line 78 of file Mesh.h.

Definition at line 144 of file CurvaturePoint.hpp.

Definition at line 165 of file CurveMesh.h.

typedef boost::unordered_set<EdgeSharedPtr, EdgeHash> Nektar::NekMeshUtils::EdgeSet

Definition at line 222 of file Edge.h.

typedef boost::shared_ptr<Edge> Nektar::NekMeshUtils::EdgeSharedPtr

Shared pointer to an edge.

Definition at line 196 of file Edge.h.

Element factory definition.

Definition at line 531 of file Element.h.

typedef std::map<unsigned int, std::vector<ElementSharedPtr> > Nektar::NekMeshUtils::ElementMap

Container for elements; key is expansion dimension, value is vector of elements of that dimension.

Definition at line 525 of file Element.h.

typedef boost::shared_ptr< Element > Nektar::NekMeshUtils::ElementSharedPtr

Definition at line 52 of file Edge.h.

Definition at line 180 of file FaceMesh.h.

typedef boost::unordered_set<FaceSharedPtr, FaceHash> Nektar::NekMeshUtils::FaceSet

Definition at line 404 of file Face.h.

typedef boost::shared_ptr<Face> Nektar::NekMeshUtils::FaceSharedPtr

Shared pointer to a face.

Definition at line 378 of file Face.h.

Definition at line 215 of file Triangle.h.

Definition at line 244 of file Triangle.h.

typedef boost::shared_ptr<HOSurf> Nektar::NekMeshUtils::HOSurfSharedPtr

Definition at line 216 of file Triangle.h.

typedef boost::shared_ptr<Mesh> Nektar::NekMeshUtils::MeshSharedPtr

Shared pointer to a mesh.

Definition at line 137 of file Mesh.h.

typedef boost::unordered_set<NodeSharedPtr, NodeHash> Nektar::NekMeshUtils::NodeSet

Definition at line 357 of file Node.h.

typedef boost::shared_ptr<Node> Nektar::NekMeshUtils::NodeSharedPtr

Definition at line 50 of file Node.h.

typedef boost::shared_ptr<Octant> Nektar::NekMeshUtils::OctantSharedPtr

Definition at line 74 of file Octant.h.

typedef boost::shared_ptr<Octree> Nektar::NekMeshUtils::OctreeSharedPtr

Definition at line 186 of file Octree.h.

Definition at line 82 of file OptimiseFunctions.h.

Definition at line 124 of file OptimiseFunctions.h.

typedef boost::shared_ptr<OptiObj> Nektar::NekMeshUtils::OptiObjSharedPtr

Definition at line 90 of file OptimiseObj.h.

Definition at line 106 of file SurfaceMesh.h.

Definition at line 99 of file TetGenInterface.h.

typedef boost::shared_ptr<TetMesh> Nektar::NekMeshUtils::TetMeshSharedPtr

Definition at line 103 of file TetMesh.h.

typedef boost::unordered_set<struct TetOrient, TetOrientHash> Nektar::NekMeshUtils::TetOrientSet

Definition at line 381 of file Tetrahedron.cpp.

Definition at line 124 of file TriangleInterface.h.

Enumeration Type Documentation

Enumerator
vert 
curve 
surf 

Definition at line 49 of file CADObj.h.

Enumeration of condition types (Dirichlet, Neumann, etc).

Enumerator
eDirichlet 
eNeumann 
eRobin 
ePeriodic 
eHOPCondition 
SIZE_ConditionType 

Definition at line 50 of file Mesh.h.

enumeration of the 6 faces of a cube/octant

Enumerator
eUp 
eDown 
eForward 
eBack 
eLeft 
eRight 

Definition at line 52 of file Octant.h.

enumeration of the possible locations of the octree with respect to the CAD

Enumerator
eInside 
eOutside 
eOnBoundary 
eUnknown 

Definition at line 66 of file Octant.h.

Function Documentation

Array<OneD, NekDouble> Nektar::NekMeshUtils::Add ( Array< OneD, NekDouble >  a,
Array< OneD, NekDouble >  b 
)

Definition at line 65 of file OptimiseFunctions.cpp.

66 {
67  Array<OneD, NekDouble> ret(3);
68  ret[0] = a[0] + b[0];
69  ret[1] = a[1] + b[1];
70  ret[2] = a[2] + b[2];
71  return ret;
72 }
bool Nektar::NekMeshUtils::BGFSUpdate ( OptiObjSharedPtr  opti,
DNekMat &  J,
DNekMat &  B,
DNekMat &  H 
)

Definition at line 50 of file BGFS-B.cpp.

References Nektar::iterator, and Vmath::Vsub().

Referenced by Nektar::NekMeshUtils::SurfaceMesh::HOSurf().

51 {
52 
53  Array<OneD, NekDouble> xi = opti->Getxi();
54  Array<OneD, NekDouble> ui = opti->Getui();
55  Array<OneD, NekDouble> li = opti->Getli();
56 
57  set<int> Fset;
58  Array<OneD, NekDouble> ti(xi.num_elements());
59  for (int i = 0; i < ti.num_elements(); i++)
60  {
61  if (J(i, 0) < 0)
62  {
63  ti[i] = (xi[i] - ui[i]) / J(i, 0);
64  }
65  else if (J(i, 0) > 0)
66  {
67  ti[i] = (xi[i] - li[i]) / J(i, 0);
68  }
69  else
70  {
71  ti[i] = numeric_limits<double>::max();
72  }
73  if (ti[i] > 0)
74  {
75  Fset.insert(i);
76  }
77  }
78 
79  // intitialise d
80  DNekMat d(xi.num_elements(), 1);
81  for (int i = 0; i < xi.num_elements(); i++)
82  {
83  if (fabs(ti[i]) < 1E-10)
84  {
85  d(i, 0) = 0;
86  }
87  else
88  {
89  d(i, 0) = -1.0 * J(i, 0);
90  }
91  }
92 
93  Array<OneD, NekDouble> xci(xi.num_elements());
94 
95  bool hitbounded = false;
96 
97  for (int i = 0; i < xci.num_elements(); i++)
98  {
99  if (xi[i] + d(i, 0) < li[i])
100  {
101  xci[i] = li[i];
102  Fset.erase(i);
103  cout << "hit bounded" << endl;
104  hitbounded = true;
105  continue;
106  }
107  else
108  {
109  xci[i] = xi[i] + d(i, 0);
110  }
111 
112  if (xi[i] + d(i, 0) > ui[i])
113  {
114  xci[i] = ui[i];
115  Fset.erase(i);
116  cout << "hit bounded" << endl;
117  hitbounded = true;
118  continue;
119  }
120  else
121  {
122  xci[i] = xi[i] + d(i, 0);
123  }
124  }
125 
126  DNekMat Z(xci.num_elements(), xci.num_elements(), 0.0);
127 
129  for (int i = 0; i < xci.num_elements(); i++)
130  {
131  it = Fset.find(i);
132  if (it != Fset.end())
133  {
134  Z(i, i) = 1.0;
135  }
136  }
137 
138  DNekMat dx(xci.num_elements(), 1, 0.0);
139  for (int i = 0; i < xci.num_elements(); i++)
140  {
141  dx(i, 0) = xci[i] - xi[i];
142  }
143 
144  DNekMat rg = Z * (J + B * dx);
145 
146  DNekMat du = -1.0 * H * rg;
147 
148  NekDouble alpha = 1.0;
149  for (it = Fset.begin(); it != Fset.end(); it++)
150  {
151  int i = (*it);
152  if (li[i] - xci[i] > alpha * du(i, 0))
153  {
154  alpha = min(alpha, (li[i] - xci[i]) / du(i, 0));
155  }
156  else if (ui[i] - xci[i] < alpha * du(i, 0))
157  {
158  alpha = min(alpha, (ui[i] - xci[i]) / du(i, 0));
159  }
160  }
161 
162  DNekMat grad = alpha * du;
163 
164  Array<OneD, NekDouble> dk(xci.num_elements()), xibar(xci.num_elements());
165  for (int i = 0; i < xci.num_elements(); i++)
166  {
167  set<int>::iterator f = Fset.find(i);
168  if (f != Fset.end())
169  {
170  xibar[i] = xci[i] + grad(i, 0);
171  }
172  else
173  {
174  xibar[i] = xci[i];
175  }
176  }
177 
178  /*if(hitbounded)
179  {
180  cout << endl << endl << Z << endl << endl;
181  cout << rg << endl << endl;
182  cout << du << endl << endl;
183  cout << alpha << endl << endl;
184  cout << grad << endl << endl;
185 
186  for(int i = 0; i < xi.num_elements(); i++)
187  {
188  cout << xci[i] << " " << xibar[i] << endl;
189  }
190 
191  exit(-1);
192  }*/
193 
194  Vmath::Vsub(xci.num_elements(), &xibar[0], 1, &xi[0], 1, &dk[0], 1);
195 
196  NekDouble c = 0.0;
197  NekDouble r = 0.0;
198  NekDouble l = 0.0;
199  for (int i = 0; i < dk.num_elements(); i++)
200  {
201  c += 1E-4 * J(i, 0) * dk[i];
202  r += J(i, 0) * dk[i];
203  }
204 
205  /*cout << endl << J << endl << endl;
206 
207  for(int i = 0; i < dk.num_elements(); i++)
208  {
209  cout << dk[i] << endl;
210  }
211  cout << endl;*/
212 
213  // this section needs a case evaluation for edges on faces
214  NekDouble lam = 2.0;
215  int iterct = 0;
216  NekDouble fo = opti->F(xi);
217  NekDouble fn;
218  Array<OneD, NekDouble> tst(xi.num_elements());
219  do
220  {
221  if (iterct > 20)
222  {
223  // cout << "failed line search" << endl;
224  return false;
225  }
226  iterct++;
227 
228  lam *= 0.5;
229 
230  for (int i = 0; i < xi.num_elements(); i++)
231  {
232  tst[i] = xi[i] + lam * dk[i];
233  }
234 
235  fn = opti->F(tst);
236 
237  DNekMat jn = opti->dF(tst);
238 
239  l = 0.0;
240  for (int i = 0; i < dk.num_elements(); i++)
241  {
242  l += jn(i, 0) * dk[i];
243  }
244 
245  } while (fn > fo + c || fabs(l) > 0.9 * fabs(r));
246  // wolfe conditions
247 
248  // tst at this point is the new all vector
249  // now need to update hessians
250  DNekMat Jn = opti->dF(tst);
251  DNekMat y = Jn - J;
252  DNekMat yT = Jn - J;
253  yT.Transpose();
254  DNekMat s(dk.num_elements(), 1, 0.0);
255  for (int i = 0; i < dk.num_elements(); i++)
256  {
257  s(i, 0) = lam * dk[i];
258  }
259  DNekMat sT = s;
260  sT.Transpose();
261 
262  DNekMat d1 = yT * s;
263  DNekMat d2 = sT * B * s;
264  DNekMat d3 = sT * y;
265  DNekMat n1 = yT * H * y;
266 
267  NekDouble ynorm = 0.0;
268  for (int i = 0; i < dk.num_elements(); i++)
269  {
270  ynorm += y(i, 0) * y(i, 0);
271  }
272 
273  if (d3(0, 0) > 2.2E-16 * ynorm)
274  {
275  B = B + y * yT * (1.0 / d1(0, 0)) - B * s * sT * B * (1.0 / d2(0, 0));
276  H = H + (d3(0, 0) + n1(0, 0)) / d3(0, 0) / d3(0, 0) * s * sT -
277  1.0 / d3(0, 0) * (H * y * sT + s * yT * H);
278  }
279 
280  J = Jn;
281  opti->Update(tst);
282 
283  return true;
284 }
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:52
double NekDouble
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.
Definition: Vmath.cpp:329
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
NekDouble Nektar::NekMeshUtils::Dot ( Array< OneD, NekDouble >  a,
Array< OneD, NekDouble >  b 
)

Definition at line 45 of file OptimiseFunctions.cpp.

Referenced by Nektar::NekMeshUtils::OptiEdge::dF(), and Nektar::NekMeshUtils::OptiFace::dF().

46 {
47  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
48 }
NEKMESHUTILS_EXPORT ElementFactory & Nektar::NekMeshUtils::GetElementFactory ( )

Definition at line 47 of file Element.cpp.

Referenced by Nektar::NekMeshUtils::FaceMesh::BuildLocalMesh(), Nektar::NekMeshUtils::FaceMesh::DiagonalSwap(), Nektar::Utilities::InputTec::GenElement2D(), Nektar::Utilities::InputStar::GenElement2D(), Nektar::Utilities::InputTec::GenElement3D(), Nektar::Utilities::InputStar::GenElement3D(), Nektar::NekMeshUtils::Octree::GetOctreeMesh(), Nektar::Utilities::InputSem::insertEdge(), Nektar::NekMeshUtils::BLMesh::Mesh(), Nektar::NekMeshUtils::TetMesh::Mesh(), Nektar::Utilities::InputSem::Process(), Nektar::Utilities::InputGmsh::Process(), Nektar::Utilities::InputNekpp::Process(), Nektar::Utilities::ProcessOptiExtract::Process(), Nektar::Utilities::InputVtk::Process(), Nektar::Utilities::InputSwan::Process(), Nektar::Utilities::ProcessSpherigon::Process(), Nektar::Utilities::InputNek::Process(), Nektar::Utilities::ProcessBL::Process(), Nektar::Utilities::ProcessDetectSurf::Process(), Nektar::Utilities::ProcessExtractSurf::Process(), Nektar::Utilities::ProcessTetSplit::Process(), Nektar::Utilities::ProcessExtractTetPrismInterface::Process(), Nektar::Utilities::InputPly::ReadPly(), and Nektar::Utilities::Module::ReorderPrisms().

48 {
49  typedef Loki::SingletonHolder<ElementFactory, Loki::CreateUsingNew,
50  Loki::NoDestroy> Type;
51  return Type::Instance();
52 }
Nektar::LibUtilities::NekFactory< LibUtilities::ShapeType, Element, ElmtConfig, std::vector< NodeSharedPtr >, std::vector< int > > ElementFactory
Element factory definition.
Definition: Element.h:531
OctantFace Nektar::NekMeshUtils::GetReverseFace ( OctantFace  f)

Definition at line 44 of file Octant.cpp.

References eBack, eDown, eForward, eLeft, eRight, and eUp.

Referenced by Nektar::NekMeshUtils::Octant::Subdivide().

45 {
46  switch (f)
47  {
48  case eUp:
49  return eDown;
50  case eDown:
51  return eUp;
52  case eForward:
53  return eBack;
54  case eBack:
55  return eForward;
56  case eLeft:
57  return eRight;
58  case eRight:
59  return eLeft;
60  }
61 }
set<pair<int, int> > Nektar::NekMeshUtils::ListOfFaceSpings ( int  nq)

Definition at line 52 of file SurfaceMeshHOMesh.cpp.

References Nektar::iterator.

Referenced by Nektar::NekMeshUtils::SurfaceMesh::HOSurf().

53 {
54  map<pair<int, int>, int> nodeorder;
55  map<int, pair<int, int> > nodeorderRev;
56  pair<int, int> id;
57 
58  id.first = 0;
59  id.second = 0;
60  nodeorder[id] = 0;
61  nodeorderRev[0] = id;
62 
63  id.first = nq - 1;
64  id.second = 0;
65  nodeorder[id] = 1;
66  nodeorderRev[1] = id;
67 
68  id.first = 0;
69  id.second = nq - 1;
70  nodeorder[id] = 2;
71  nodeorderRev[2] = id;
72 
73  for (int i = 0; i < nq - 2; i++)
74  {
75  id.second = 0;
76  id.first = i + 1;
77  nodeorder[id] = i + 3;
78  nodeorderRev[i + 3] = id;
79  }
80  for (int i = 0; i < nq - 2; i++)
81  {
82  id.first = nq - 2 - i;
83  id.second = 1 + i;
84  nodeorder[id] = nq + 1 + i;
85  nodeorderRev[nq + 1 + i] = id;
86  }
87  for (int i = 0; i < nq - 2; i++)
88  {
89  id.first = 0;
90  id.second = nq - 2 - i;
91  nodeorder[id] = nq + nq - 1 + i;
92  nodeorderRev[nq + nq - 1 + i] = id;
93  }
94 
95  int i = 1;
96  int j = 1;
97  int limit = nq - 3;
98  for (int k = 0; k < (nq - 3) * (nq - 2) / 2; k++)
99  {
100  id.first = i;
101  id.second = j;
102  nodeorder[id] = 3 * (nq - 1) + k;
103  nodeorderRev[3 * (nq - 1) + k] = id;
104  i++;
105  if (i > limit)
106  {
107  limit--;
108  j++;
109  i = 1;
110  }
111  }
112 
113  map<int, vector<int> > nodetosix;
114 
115  for (int i = (nq + 1) * nq / 2 - (nq - 3) * (nq - 2) / 2;
116  i < (nq + 1) * nq / 2;
117  i++)
118  {
119  vector<int> ids;
120  int pr;
121 
122  pair<int, int> p = nodeorderRev[i];
123  p.first -= 1;
124  pr = nodeorder[p];
125 
126  ids.push_back(pr);
127 
128  p = nodeorderRev[i];
129  p.second -= 1;
130  pr = nodeorder[p];
131 
132  ids.push_back(pr);
133 
134  p = nodeorderRev[i];
135  p.first += 1;
136  pr = nodeorder[p];
137 
138  ids.push_back(pr);
139 
140  p = nodeorderRev[i];
141  p.second += 1;
142  pr = nodeorder[p];
143 
144  ids.push_back(pr);
145 
146  p = nodeorderRev[i];
147  p.first += 1;
148  p.second -= 1;
149  pr = nodeorder[p];
150 
151  ids.push_back(pr);
152 
153  p = nodeorderRev[i];
154  p.first -= 1;
155  p.second += 1;
156  pr = nodeorder[p];
157 
158  ids.push_back(pr);
159 
160  nodetosix[i] = ids;
161  }
162 
163  set<pair<int, int> > ret;
164  map<int, vector<int> >::iterator it;
165  for (it = nodetosix.begin(); it != nodetosix.end(); it++)
166  {
167  vector<int> ns = it->second;
168  for (int i = 0; i < ns.size(); i++)
169  {
170  pair<int, int> sp(min(it->first, ns[i]), max(it->first, ns[i]));
171  ret.insert(sp);
172  }
173  }
174 
175  return ret;
176 }
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator!= ( NodeSharedPtr const &  p1,
NodeSharedPtr const &  p2 
)

Definition at line 115 of file BooleanOperators.cpp.

116 {
117  if(p1->m_id != p2->m_id)
118  {
119  return true;
120  }
121  else
122  {
123  return false;
124  }
125 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator< ( NodeSharedPtr const &  p1,
NodeSharedPtr const &  p2 
)

Defines ordering between two NodeSharedPtr objects.

Definition at line 130 of file BooleanOperators.cpp.

131 {
132  return *p1 < *p2;
133 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator< ( EdgeSharedPtr const &  p1,
EdgeSharedPtr const &  p2 
)

Defines ordering between two edges (based on ID of edges).

Definition at line 154 of file BooleanOperators.cpp.

155 {
156  return p1->m_id < p2->m_id;
157 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator< ( FaceSharedPtr const &  p1,
FaceSharedPtr const &  p2 
)

Defines ordering between two faces (depending on ID of faces).

Definition at line 181 of file BooleanOperators.cpp.

182 {
183  return p1->m_id < p2->m_id;
184 }
std::ostream & Nektar::NekMeshUtils::operator<< ( std::ostream &  os,
const NodeSharedPtr &  n 
)

Definition at line 135 of file BooleanOperators.cpp.

136 {
137  os << n->m_x << " " << n->m_y << " " << n->m_z;
138  return os;
139 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( ElmtConfig const &  c1,
ElmtConfig const &  c2 
)

Definition at line 46 of file BooleanOperators.cpp.

References Nektar::NekMeshUtils::ElmtConfig::m_e, and Nektar::NekMeshUtils::ElmtConfig::m_order.

47 {
48  return (c1.m_e == c2.m_e && c1.m_order == c2.m_order);
49 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( HOSurfSharedPtr const &  p1,
HOSurfSharedPtr const &  p2 
)

Compares two HOSurf objects referred to as shared pointers.

Two HOSurf objects are defined to be equal if they contain identical vertex ids contained in HOSurf::vertId.

Definition at line 57 of file BooleanOperators.cpp.

58 {
59  if (p1->vertId.size() != p2->vertId.size())
60  {
61  return false;
62  }
63 
64  vector<int> ids1 = p1->vertId;
65  vector<int> ids2 = p2->vertId;
66  sort(ids1.begin(), ids1.end());
67  sort(ids2.begin(), ids2.end());
68 
69  for (int i = 0; i < ids1.size(); ++i)
70  {
71  if (ids1[i] != ids2[i])
72  return false;
73  }
74 
75  return true;
76 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( ConditionSharedPtr const &  c1,
ConditionSharedPtr const &  c2 
)

Test equality of two conditions - i.e. compare types, fields and values but not composite ids.

Definition at line 82 of file BooleanOperators.cpp.

83 {
84  int i, n = c1->type.size();
85 
86  if (n != c2->type.size())
87  {
88  return false;
89  }
90 
91  for (i = 0; i < n; ++i)
92  {
93  if (c1->type[i] != c2->type[i])
94  {
95  return false;
96  }
97 
98  if (c1->field[i] != c2->field[i] || c1->value[i] != c2->value[i])
99  {
100  return false;
101  }
102  }
103 
104  return true;
105 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( NodeSharedPtr const &  p1,
NodeSharedPtr const &  p2 
)

Defines equality between two NodeSharedPtr objects.

Shared pointer to a Node.

Definition at line 110 of file BooleanOperators.cpp.

111 {
112  return *p1 == *p2;
113 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( EdgeSharedPtr const &  p1,
EdgeSharedPtr const &  p2 
)

Defines equality of two edges (equal if IDs of end nodes match in either ordering).

Definition at line 145 of file BooleanOperators.cpp.

146 {
147  return ( ((*(p1->m_n1) == *(p2->m_n1)) && (*(p1->m_n2) == *(p2->m_n2)))
148  || ((*(p1->m_n2) == *(p2->m_n1)) && (*(p1->m_n1) == *(p2->m_n2))));
149 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( FaceSharedPtr const &  p1,
FaceSharedPtr const &  p2 
)

Defines equality of two faces (equal if IDs of vertices are the same.)

Definition at line 163 of file BooleanOperators.cpp.

References Nektar::StdRegions::find(), and Nektar::iterator.

164 {
166  for (it1 = p1->m_vertexList.begin(); it1 != p1->m_vertexList.end(); ++it1)
167  {
168  if (find(p2->m_vertexList.begin(), p2->m_vertexList.end(), *it1)
169  == p2->m_vertexList.end())
170  {
171  return false;
172  }
173  }
174  return true;
175 }
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:315
bool Nektar::NekMeshUtils::operator== ( const struct TetOrient &  a,
const struct TetOrient &  b 
)

Definition at line 383 of file Tetrahedron.cpp.

References Nektar::NekMeshUtils::TetOrient::nid.

384 {
385  if (a.nid.size() != b.nid.size())
386  {
387  return false;
388  }
389 
390  for (int i = 0; i < a.nid.size(); ++i)
391  {
392  if (a.nid[i] != b.nid[i])
393  {
394  return false;
395  }
396  }
397 
398  return true;
399 }
bool Nektar::NekMeshUtils::operator== ( OctantSharedPtr const &  p1,
OctantSharedPtr const &  p2 
)

Definition at line 516 of file Octant.cpp.

517 {
518  if (p1->GetId() == p2->GetId())
519  return true;
520  else
521  return false;
522 }
Array<OneD, NekDouble> Nektar::NekMeshUtils::Take ( Array< OneD, NekDouble >  a,
Array< OneD, NekDouble >  b 
)

Definition at line 49 of file OptimiseFunctions.cpp.

Referenced by Nektar::NekMeshUtils::OptiEdge::dF(), Nektar::NekMeshUtils::OptiFace::dF(), Nektar::NekMeshUtils::OptiEdge::F(), and Nektar::NekMeshUtils::OptiFace::F().

50 {
51  Array<OneD, NekDouble> ret(3);
52  ret[0] = a[0] - b[0];
53  ret[1] = a[1] - b[1];
54  ret[2] = a[2] - b[2];
55  return ret;
56 }
Array<OneD, NekDouble> Nektar::NekMeshUtils::Times ( NekDouble  t,
Array< OneD, NekDouble >  a 
)

Definition at line 57 of file OptimiseFunctions.cpp.

58 {
59  Array<OneD, NekDouble> ret(3);
60  ret[0] = a[0] * t;
61  ret[1] = a[1] * t;
62  ret[2] = a[2] * t;
63  return ret;
64 }
map<pair<int, int>, NekDouble> Nektar::NekMeshUtils::weights ( set< pair< int, int > >  springs,
Array< OneD, NekDouble >  u,
Array< OneD, NekDouble >  v 
)

Definition at line 178 of file SurfaceMeshHOMesh.cpp.

References Nektar::iterator.

Referenced by Nektar::LibUtilities::PtsField::GetWeights(), Nektar::NekMeshUtils::SurfaceMesh::HOSurf(), and Nektar::LibUtilities::PtsField::SetWeights().

181 {
182  map<pair<int, int>, NekDouble> ret;
183 
184  // setup map from right angled reference triangle to equilateral reference
185  // triangle
186  DNekMat A(3, 3, 1.0);
187  A(0, 0) = -1.0;
188  A(1, 0) = -1.0;
189  A(0, 1) = 1.0;
190  A(1, 1) = -1.0;
191  A(0, 2) = 0.0;
192  A(1, 2) = -1.0 + sqrt(3.0);
193 
194  DNekMat B(3, 3, 1.0);
195  B(0, 0) = -1.0;
196  B(1, 0) = -1.0;
197  B(0, 1) = 1.0;
198  B(1, 1) = -1.0;
199  B(0, 2) = -1.0;
200  B(1, 2) = 1.0;
201 
202  B.Invert();
203 
204  DNekMat M = A * B;
205 
206  DNekMat C(3, u.num_elements(), 1.0);
207  for (int i = 0; i < u.num_elements(); i++)
208  {
209  C(0, i) = u[i];
210  C(1, i) = v[i];
211  }
212 
213  DNekMat pts = M * C;
214 
215  /*for(int i = 0; i < u.num_elements(); i++)
216  {
217  cout << pts(0,i) << " " << pts(1,i) << endl;
218  }
219  exit(-1);*/
220 
221  set<pair<int, int> >::iterator it;
222  for (it = springs.begin(); it != springs.end(); it++)
223  {
224  ret[(*it)] = sqrt((pts(0, (*it).first) - pts(0, (*it).second)) *
225  (pts(0, (*it).first) - pts(0, (*it).second)) +
226  (pts(1, (*it).first) - pts(1, (*it).second)) *
227  (pts(1, (*it).first) - pts(1, (*it).second)));
228 
229  if ((*it).first == 12 && (*it).second == 13)
230  ret[(*it)] *= 1.2;
231 
232  if ((*it).first == 12 && (*it).second == 14)
233  ret[(*it)] *= 1.2;
234 
235  if ((*it).first == 13 && (*it).second == 14)
236  ret[(*it)] *= 1.2;
237  }
238  return ret;
239 }
NekMatrix< NekDouble, StandardMatrixTag > DNekMat
Definition: NekTypeDefs.hpp:52
double NekDouble
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator