Nektar++
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Nektar::NekMeshUtils Namespace Reference

Namespaces

 CADOrientation
 
 CADType
 

Classes

class  BLMesh
 
class  BPoint
 class for a planar boundary based samlping Point More...
 
class  CADCurve
 base class for CAD curves. More...
 
class  CADCurveCFI
 
class  CADCurveOCE
 
class  CADObject
 
class  CADSurf
 base class for a cad surface More...
 
class  CADSurfCFI
 
class  CADSurfOCE
 
class  CADSystem
 Base class for CAD interface system. More...
 
class  CADSystemCFI
 
class  CADSystemOCE
 
class  CADVert
 base class for CAD verticies. More...
 
class  CADVertCFI
 
class  CADVertOCE
 
class  CFIMesh
 class containing all surface meshing routines methods and classes More...
 
class  Composite
 A composite is a collection of elements. More...
 
struct  Condition
 Defines a boundary condition. More...
 
struct  ConfigOption
 Represents a command-line configuration option. More...
 
class  CPoint
 class for a curvature based samlping Point More...
 
class  CurveMesh
 class for meshing individual curves (1d meshing) More...
 
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 are 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  Generator2D
 class containing all surface meshing routines methods and classes More...
 
class  Hexahedron
 A 3-dimensional six-faced element. More...
 
struct  HOQuadrilateral
 A lightweight struct for dealing with high-order quadrilateral alignment. More...
 
class  HOSurfaceMesh
 
struct  HOSurfHash
 
struct  HOTriangle
 A lightweight struct for dealing with high-order triangle alignment. More...
 
class  InputModule
 Abstract base class for input modules. More...
 
class  Line
 A 1-dimensional line between two vertex nodes. More...
 
struct  linesource
 
class  Mesh
 
class  Module
 
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  OptiObj
 
class  OutputModule
 Abstract base class for output modules. More...
 
class  Point
 A 0-dimensional vertex. More...
 
class  Prism
 A 3-dimensional five-faced element (2 triangles, 3 quadrilaterals). More...
 
class  ProcessLoadCAD
 
class  ProcessLoadOctree
 
class  ProcessModule
 Abstract base class for processing modules. More...
 
class  Pyramid
 A 3-dimensional square-based pyramidic element. More...
 
class  Quadrilateral
 A 2-dimensional four-sided element. More...
 
class  SPBase
 base class of sizing point for octree construction these carry information the octree needs and have various types More...
 
class  SrcPoint
 class for a general source point 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...
 
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...
 
class  VolumeMesh
 

Typedefs

typedef std::shared_ptr< CADVertCADVertSharedPtr
 
typedef std::shared_ptr< CADSurfCADSurfSharedPtr
 
typedef std::shared_ptr< CADCurveCADCurveSharedPtr
 
typedef LibUtilities::NekFactory< std::string, CADCurveCADCurveFactory
 
typedef std::shared_ptr< CADObjectCADObjectSharedPtr
 
typedef std::shared_ptr< EdgeLoopEdgeLoopSharedPtr
 
typedef LibUtilities::NekFactory< std::string, CADSurfCADSurfFactory
 
typedef std::shared_ptr< CADSystemCADSystemSharedPtr
 
typedef LibUtilities::NekFactory< std::string, CADSystem, std::string > EngineFactory
 
typedef std::shared_ptr< NodeNodeSharedPtr
 
typedef LibUtilities::NekFactory< std::string, CADVertCADVertFactory
 
typedef std::shared_ptr< CADSystemCFICADSystemCFISharedPtr
 
typedef std::shared_ptr< CADSystemOCECADSystemOCESharedPtr
 
typedef std::shared_ptr< TetGenInterfaceTetGenInterfaceSharedPtr
 
typedef std::shared_ptr< TriangleInterfaceTriangleInterfaceSharedPtr
 
typedef std::shared_ptr< CompositeCompositeSharedPtr
 Shared pointer to a composite. More...
 
typedef std::map< unsigned int, CompositeSharedPtrCompositeMap
 Container of composites; key is the composite id, value is the composite. More...
 
typedef std::shared_ptr< ElementElementSharedPtr
 
typedef std::shared_ptr< EdgeEdgeSharedPtr
 Shared pointer to an edge. More...
 
typedef std::unordered_set< EdgeSharedPtr, EdgeHashEdgeSet
 
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 std::shared_ptr< FaceFaceSharedPtr
 
typedef std::unordered_set< FaceSharedPtr, FaceHashFaceSet
 
typedef HOTriangle< NodeSharedPtrHOSurf
 
typedef std::shared_ptr< HOSurfHOSurfSharedPtr
 
typedef std::unordered_set< HOSurfSharedPtr, HOSurfHashHOSurfSet
 
typedef std::shared_ptr< OctreeOctreeSharedPtr
 
typedef std::shared_ptr< ConditionConditionSharedPtr
 
typedef std::map< int, ConditionSharedPtrConditionMap
 
typedef std::shared_ptr< MeshMeshSharedPtr
 Shared pointer to a mesh. More...
 
typedef std::unordered_set< NodeSharedPtr, NodeHashNodeSet
 
typedef std::map< int, std::pair< FaceSharedPtr, std::vector< int > > > PerMap
 
typedef std::pair< ModuleType, std::string > ModuleKey
 
typedef std::shared_ptr< ModuleModuleSharedPtr
 
typedef LibUtilities::NekFactory< ModuleKey, Module, MeshSharedPtrModuleFactory
 
typedef std::shared_ptr< OctantOctantSharedPtr
 
typedef std::shared_ptr< SPBaseSPBaseSharedPtr
 
typedef std::shared_ptr< CPointCPointSharedPtr
 
typedef std::shared_ptr< BPointBPointSharedPtr
 
typedef std::shared_ptr< SrcPointSrcPointSharedPtr
 
typedef std::shared_ptr< OptiObjOptiObjSharedPtr
 
typedef std::shared_ptr< CurveMeshCurveMeshSharedPtr
 
typedef std::shared_ptr< FaceMeshFaceMeshSharedPtr
 
typedef std::shared_ptr< OptiEdgeOptiEdgeSharedPtr
 
typedef std::shared_ptr< BLMeshBLMeshSharedPtr
 
typedef std::shared_ptr< TetMeshTetMeshSharedPtr
 

Enumerations

enum  ConditionType {
  eDirichlet, eNeumann, eRobin, ePeriodic,
  eHOPCondition, SIZE_ConditionType
}
 
enum  ModuleType { eInputModule, eProcessModule, eOutputModule, SIZE_ModuleType }
 
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...
 
enum  SPType { eCBoundary, ePBoundary, eSrcPoint }
 

Functions

CADCurveFactoryGetCADCurveFactory ()
 
CADSurfFactoryGetCADSurfFactory ()
 
EngineFactoryGetEngineFactory ()
 
CADVertFactoryGetCADVertFactory ()
 
void P (NekDouble t, NekDouble &x, NekDouble &y, NekDouble &z)
 
void P (Array< OneD, NekDouble > uv, NekDouble &x, NekDouble &y, NekDouble &z)
 
void filterModShape (TopTools_DataMapOfShapeShape &modShape, TopoDS_Shape &S)
 
bool operator== (ElmtConfig const &c1, ElmtConfig const &c2)
 Compares two element config structs. More...
 
bool operator== (ElementSharedPtr const &e1, ElementSharedPtr const &e2)
 Compares two element shared pointers. More...
 
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)
 Compares two nodes for inequality based on IDs. More...
 
bool operator< (NodeSharedPtr const &p1, NodeSharedPtr const &p2)
 Defines ordering between two NodeSharedPtr objects. More...
 
std::ostream & operator<< (std::ostream &os, const NodeSharedPtr &n)
 Print description of node to given ostream. More...
 
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 ()
 
template<typename K >
void sort3 (K &x, K &y, K &z)
 Helper function to sort 3 numbers using sorting network. More...
 
ModuleFactoryGetModuleFactory ()
 
std::ostream & operator<< (std::ostream &os, const ModuleKey &rhs)
 
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)
 
box GetBox (ElementSharedPtr el, NekDouble ov)
 
box GetBox (vector< ElementSharedPtr > els, NekDouble ov)
 
box GetBox (NodeSharedPtr n, NekDouble ov)
 
bool Infont (NodeSharedPtr n, ElementSharedPtr el)
 
bool sign (NekDouble a, NekDouble b)
 

Variables

const char *const ModuleTypeMap []
 

Typedef Documentation

◆ BLMeshSharedPtr

Definition at line 138 of file BLMesh.h.

◆ BPointSharedPtr

Definition at line 240 of file SourcePoint.hpp.

◆ CADCurveFactory

Definition at line 221 of file CADCurve.h.

◆ CADCurveSharedPtr

Definition at line 219 of file CADCurve.h.

◆ CADObjectSharedPtr

Definition at line 133 of file CADObject.h.

◆ CADSurfFactory

Definition at line 216 of file CADSurf.h.

◆ CADSurfSharedPtr

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

Definition at line 51 of file CADCurve.h.

◆ CADSystemCFISharedPtr

Definition at line 104 of file CADSystemCFI.h.

◆ CADSystemOCESharedPtr

Definition at line 88 of file CADSystemOCE.h.

◆ CADSystemSharedPtr

Definition at line 240 of file CADSystem.h.

◆ CADVertFactory

Definition at line 139 of file CADVert.h.

◆ CADVertSharedPtr

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

Definition at line 49 of file CADCurve.h.

◆ CompositeMap

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

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

Definition at line 73 of file Composite.h.

◆ CompositeSharedPtr

Shared pointer to a composite.

Definition at line 70 of file Composite.h.

◆ ConditionMap

Definition at line 86 of file Mesh.h.

◆ ConditionSharedPtr

Definition at line 85 of file Mesh.h.

◆ CPointSharedPtr

Definition at line 184 of file SourcePoint.hpp.

◆ CurveMeshSharedPtr

Definition at line 51 of file CurveMesh.h.

◆ EdgeLoopSharedPtr

Definition at line 65 of file CADSurf.h.

◆ EdgeSet

Definition at line 159 of file Edge.h.

◆ EdgeSharedPtr

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

Shared pointer to an edge.

Definition at line 136 of file Edge.h.

◆ ElementFactory

Element factory definition.

Definition at line 497 of file Element.h.

◆ ElementMap

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 491 of file Element.h.

◆ ElementSharedPtr

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

Definition at line 49 of file Edge.h.

◆ EngineFactory

Definition at line 242 of file CADSystem.h.

◆ FaceMeshSharedPtr

Definition at line 165 of file FaceMesh.h.

◆ FaceSet

Definition at line 181 of file Face.h.

◆ FaceSharedPtr

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

Definition at line 155 of file Face.h.

◆ HOSurf

Definition at line 179 of file HOAlignment.h.

◆ HOSurfSet

Definition at line 202 of file HOAlignment.h.

◆ HOSurfSharedPtr

Definition at line 180 of file HOAlignment.h.

◆ MeshSharedPtr

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

Shared pointer to a mesh.

Definition at line 156 of file Mesh.h.

◆ ModuleFactory

Definition at line 259 of file NekMeshUtils/Module/Module.h.

◆ ModuleKey

typedef std::pair<ModuleType,std::string> Nektar::NekMeshUtils::ModuleKey

Definition at line 255 of file NekMeshUtils/Module/Module.h.

◆ ModuleSharedPtr

Definition at line 258 of file NekMeshUtils/Module/Module.h.

◆ NodeSet

Definition at line 447 of file Node.h.

◆ NodeSharedPtr

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

Definition at line 49 of file CADVert.h.

◆ OctantSharedPtr

Definition at line 73 of file Octant.h.

◆ OctreeSharedPtr

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

Definition at line 51 of file Mesh.h.

◆ OptiEdgeSharedPtr

Definition at line 81 of file OptimiseFunctions.h.

◆ OptiObjSharedPtr

Definition at line 104 of file OptimiseObj.h.

◆ PerMap

typedef std::map<int, std::pair<FaceSharedPtr, std::vector<int> > > Nektar::NekMeshUtils::PerMap

Definition at line 77 of file NekMeshUtils/Module/Module.h.

◆ SPBaseSharedPtr

Definition at line 131 of file SourcePoint.hpp.

◆ SrcPointSharedPtr

Definition at line 283 of file SourcePoint.hpp.

◆ TetGenInterfaceSharedPtr

Definition at line 99 of file TetGenInterface.h.

◆ TetMeshSharedPtr

Definition at line 86 of file TetMesh.h.

◆ TriangleInterfaceSharedPtr

Definition at line 131 of file TriangleInterface.h.

Enumeration Type Documentation

◆ ConditionType

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

Enumerator
eDirichlet 
eNeumann 
eRobin 
ePeriodic 
eHOPCondition 
SIZE_ConditionType 

Definition at line 57 of file Mesh.h.

◆ ModuleType

Denotes different types of mesh converter modules: so far only input, output and process modules are defined.

Enumerator
eInputModule 
eProcessModule 
eOutputModule 
SIZE_ModuleType 

Definition at line 63 of file NekMeshUtils/Module/Module.h.

◆ OctantFace

enumeration of the 6 faces of a cube/octant

Enumerator
eUp 
eDown 
eForward 
eBack 
eLeft 
eRight 

Definition at line 51 of file Octant.h.

◆ OctantLocation

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

Enumerator
eInside 
eOutside 
eOnBoundary 
eUnknown 

Definition at line 65 of file Octant.h.

◆ SPType

Enumerator
eCBoundary 
ePBoundary 
eSrcPoint 

Definition at line 48 of file SourcePoint.hpp.

49 {
50  eCBoundary, // on a curved boundary
51  ePBoundary, // on a planar boundary (R=inf)
52  eSrcPoint // source point
53 };

Function Documentation

◆ Add()

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

Definition at line 64 of file OptimiseFunctions.cpp.

65 {
66  Array<OneD, NekDouble> ret(3);
67  ret[0] = a[0] + b[0];
68  ret[1] = a[1] + b[1];
69  ret[2] = a[2] + b[2];
70  return ret;
71 }

◆ BGFSUpdate()

bool Nektar::NekMeshUtils::BGFSUpdate ( OptiObjSharedPtr  opti,
DNekMat J,
DNekMat B,
DNekMat H 
)

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

References Vmath::Vsub().

Referenced by Nektar::NekMeshUtils::HOSurfaceMesh::Process().

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

◆ Dot()

NekDouble Nektar::NekMeshUtils::Dot ( Array< OneD, NekDouble a,
Array< OneD, NekDouble b 
)
inline

Definition at line 44 of file OptimiseFunctions.cpp.

Referenced by Nektar::NekMeshUtils::OptiEdge::dF().

45 {
46  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
47 }

◆ filterModShape()

void Nektar::NekMeshUtils::filterModShape ( TopTools_DataMapOfShapeShape &  modShape,
TopoDS_Shape &  S 
)

Definition at line 56 of file CADSystemOCE.cpp.

Referenced by Nektar::NekMeshUtils::CADSystemOCE::LoadCAD().

57 {
58  bool repeat = true;
59  while (repeat)
60  {
61  repeat = false;
62  if (modShape.IsBound(S))
63  {
64  repeat = true;
65  S = modShape.Find(S);
66  }
67  }
68 }

◆ GetBox() [1/3]

box Nektar::NekMeshUtils::GetBox ( ElementSharedPtr  el,
NekDouble  ov 
)
inline

Definition at line 63 of file BLMesh.cpp.

64 {
65  NekDouble xmin = numeric_limits<double>::max(),
66  xmax = -1.0 * numeric_limits<double>::max(),
67  ymin = numeric_limits<double>::max(),
68  ymax = -1.0 * numeric_limits<double>::max(),
69  zmin = numeric_limits<double>::max(),
70  zmax = -1.0 * numeric_limits<double>::max();
71 
72  vector<NodeSharedPtr> ns = el->GetVertexList();
73  for (int i = 0; i < ns.size(); i++)
74  {
75  xmin = min(xmin, ns[i]->m_x);
76  xmax = max(xmax, ns[i]->m_x);
77  ymin = min(ymin, ns[i]->m_y);
78  ymax = max(ymax, ns[i]->m_y);
79  zmin = min(zmin, ns[i]->m_z);
80  zmax = max(zmax, ns[i]->m_z);
81  }
82 
83  return box(point(xmin - ov, ymin - ov, zmin - ov),
84  point(xmax + ov, ymax + ov, zmax + ov));
85 }
bg::model::box< point > box
Definition: BLMesh.cpp:54
double NekDouble
bg::model::point< double, 3, bg::cs::cartesian > point
Definition: BLMesh.cpp:53

◆ GetBox() [2/3]

box Nektar::NekMeshUtils::GetBox ( vector< ElementSharedPtr els,
NekDouble  ov 
)
inline

Definition at line 87 of file BLMesh.cpp.

88 {
89  NekDouble xmin = numeric_limits<double>::max(),
90  xmax = -1.0 * numeric_limits<double>::max(),
91  ymin = numeric_limits<double>::max(),
92  ymax = -1.0 * numeric_limits<double>::max(),
93  zmin = numeric_limits<double>::max(),
94  zmax = -1.0 * numeric_limits<double>::max();
95 
96  for (int j = 0; j < els.size(); j++)
97  {
98  vector<NodeSharedPtr> ns = els[j]->GetVertexList();
99  for (int i = 0; i < ns.size(); i++)
100  {
101  xmin = min(xmin, ns[i]->m_x);
102  xmax = max(xmax, ns[i]->m_x);
103  ymin = min(ymin, ns[i]->m_y);
104  ymax = max(ymax, ns[i]->m_y);
105  zmin = min(zmin, ns[i]->m_z);
106  zmax = max(zmax, ns[i]->m_z);
107  }
108  }
109 
110  return box(point(xmin - ov, ymin - ov, zmin - ov),
111  point(xmax + ov, ymax + ov, zmax + ov));
112 }
bg::model::box< point > box
Definition: BLMesh.cpp:54
double NekDouble
bg::model::point< double, 3, bg::cs::cartesian > point
Definition: BLMesh.cpp:53

◆ GetBox() [3/3]

box Nektar::NekMeshUtils::GetBox ( NodeSharedPtr  n,
NekDouble  ov 
)
inline

Definition at line 114 of file BLMesh.cpp.

Referenced by Nektar::NekMeshUtils::BLMesh::GrowLayers().

115 {
116  return box(point(n->m_x - ov, n->m_y - ov, n->m_z - ov),
117  point(n->m_x + ov, n->m_y + ov, n->m_z + ov));
118 }
bg::model::box< point > box
Definition: BLMesh.cpp:54
bg::model::point< double, 3, bg::cs::cartesian > point
Definition: BLMesh.cpp:53

◆ GetCADCurveFactory()

CADCurveFactory & Nektar::NekMeshUtils::GetCADCurveFactory ( )

Definition at line 59 of file CADSystem.cpp.

Referenced by Nektar::NekMeshUtils::CADSystemOCE::AddCurve(), and Nektar::NekMeshUtils::CADSystemCFI::AddCurve().

60 {
61  static CADCurveFactory instance;
62  return instance;
63 }
LibUtilities::NekFactory< std::string, CADCurve > CADCurveFactory
Definition: CADCurve.h:221

◆ GetCADSurfFactory()

CADSurfFactory & Nektar::NekMeshUtils::GetCADSurfFactory ( )

Definition at line 65 of file CADSystem.cpp.

Referenced by Nektar::NekMeshUtils::CADSystemOCE::AddSurf(), and Nektar::NekMeshUtils::CADSystemCFI::AddSurf().

66 {
67  static CADSurfFactory instance;
68  return instance;
69 }
LibUtilities::NekFactory< std::string, CADSurf > CADSurfFactory
Definition: CADSurf.h:216

◆ GetCADVertFactory()

CADVertFactory & Nektar::NekMeshUtils::GetCADVertFactory ( )

Definition at line 53 of file CADSystem.cpp.

Referenced by Nektar::NekMeshUtils::CADSystemOCE::AddVert(), and Nektar::NekMeshUtils::CADSystemCFI::AddVert().

54 {
55  static CADVertFactory instance;
56  return instance;
57 }
LibUtilities::NekFactory< std::string, CADVert > CADVertFactory
Definition: CADVert.h:139

◆ GetElementFactory()

NEKMESHUTILS_EXPORT ElementFactory & Nektar::NekMeshUtils::GetElementFactory ( )

Definition at line 44 of file Element.cpp.

Referenced by Nektar::Utilities::ProcessBL::BoundaryLayer2D(), Nektar::Utilities::ProcessBL::BoundaryLayer3D(), Nektar::NekMeshUtils::BLMesh::BuildElements(), 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::Utilities::InputSem::insertEdge(), Nektar::Utilities::ProcessLinear::Invalid(), Nektar::NekMeshUtils::Generator2D::MakeBL(), Nektar::NekMeshUtils::TetMesh::Mesh(), Nektar::Utilities::InputNekpp::Process(), Nektar::Utilities::InputSem::Process(), Nektar::Utilities::InputNek5000::Process(), Nektar::NekMeshUtils::VolumeMesh::Process(), Nektar::Utilities::ProcessOptiExtract::Process(), Nektar::Utilities::ProcessExtrude::Process(), Nektar::Utilities::InputSwan::Process(), Nektar::Utilities::InputVtk::Process(), Nektar::Utilities::ProcessSpherigon::Process(), Nektar::NekMeshUtils::CFIMesh::Process(), Nektar::Utilities::InputNek::Process(), Nektar::Utilities::ProcessTetSplit::Process(), Nektar::Utilities::ProcessExtractTetPrismInterface::Process(), Nektar::Utilities::ProcessDetectSurf::Process(), Nektar::Utilities::ProcessExtractSurf::Process(), Nektar::NekMeshUtils::Generator2D::Process(), Nektar::Utilities::InputGmsh::ReadNextElement(), Nektar::Utilities::InputPly::ReadPly(), Nektar::NekMeshUtils::Module::ReorderPrisms(), and Nektar::NekMeshUtils::Octree::WriteOctree().

45 {
46  static ElementFactory instance;
47  return instance;
48 }
Nektar::LibUtilities::NekFactory< LibUtilities::ShapeType, Element, ElmtConfig, std::vector< NodeSharedPtr >, std::vector< int > > ElementFactory
Element factory definition.
Definition: Element.h:497

◆ GetEngineFactory()

EngineFactory & Nektar::NekMeshUtils::GetEngineFactory ( )

Definition at line 47 of file CADSystem.cpp.

Referenced by Nektar::NekMeshUtils::ProcessLoadCAD::Process().

48 {
49  static EngineFactory instance;
50  return instance;
51 }
LibUtilities::NekFactory< std::string, CADSystem, std::string > EngineFactory
Definition: CADSystem.h:242

◆ GetModuleFactory()

NEKMESHUTILS_EXPORT ModuleFactory & Nektar::NekMeshUtils::GetModuleFactory ( )

Returns an instance of the module factory, held as a singleton.

Definition at line 50 of file NekMeshUtils/Module/Module.cpp.

51 {
52  static ModuleFactory instance;
53  return instance;
54 }
LibUtilities::NekFactory< ModuleKey, Module, FieldSharedPtr > ModuleFactory

◆ GetReverseFace()

OctantFace Nektar::NekMeshUtils::GetReverseFace ( OctantFace  f)
inline

Definition at line 43 of file Octant.cpp.

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

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

44 {
45  switch (f)
46  {
47  case eUp:
48  return eDown;
49  case eDown:
50  return eUp;
51  case eForward:
52  return eBack;
53  case eBack:
54  return eForward;
55  case eLeft:
56  return eRight;
57  case eRight:
58  return eLeft;
59  }
60 
61  return eUp;
62 }

◆ Infont()

bool Nektar::NekMeshUtils::Infont ( NodeSharedPtr  n,
ElementSharedPtr  el 
)
inline

Definition at line 178 of file BLMesh.cpp.

References Nektar::LibUtilities::ang().

Referenced by Nektar::NekMeshUtils::BLMesh::GrowLayers().

179 {
180  vector<NodeSharedPtr> ns1 = el->GetVertexList();
181  Array<OneD, NekDouble> N1 = el->Normal(true);
182 
183  Array<OneD, NekDouble> V(3);
184  V[0] = n->m_x - ns1[0]->m_x;
185  V[1] = n->m_y - ns1[0]->m_y;
186  V[2] = n->m_z - ns1[0]->m_z;
187 
188  NekDouble Vmag = sqrt(V[0] * V[0] + V[1] * V[1] + V[2] * V[2]);
189 
190  NekDouble ang = (N1[0] * V[0] + N1[1] * V[1] + N1[2] * V[2]) / Vmag;
191 
192  return ang > 0.17;
193 }
static NekDouble ang(NekDouble x, NekDouble y)
Definition: Interpreter.cpp:91
double NekDouble

◆ operator!=()

NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator!= ( NodeSharedPtr const &  p1,
NodeSharedPtr const &  p2 
)

Compares two nodes for inequality based on IDs.

Definition at line 128 of file BooleanOperators.cpp.

129 {
130  if (p1->m_id != p2->m_id)
131  {
132  return true;
133  }
134  else
135  {
136  return false;
137  }
138 }

◆ operator<() [1/3]

NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator< ( NodeSharedPtr const &  p1,
NodeSharedPtr const &  p2 
)

Defines ordering between two NodeSharedPtr objects.

Definition at line 143 of file BooleanOperators.cpp.

144 {
145  return *p1 < *p2;
146 }

◆ operator<() [2/3]

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 170 of file BooleanOperators.cpp.

171 {
172  return p1->m_id < p2->m_id;
173 }

◆ operator<() [3/3]

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 197 of file BooleanOperators.cpp.

198 {
199  return p1->m_id < p2->m_id;
200 }

◆ operator<<() [1/2]

NEKMESHUTILS_EXPORT std::ostream & Nektar::NekMeshUtils::operator<< ( std::ostream &  os,
const ModuleKey rhs 
)

Prints a given module key to a stream.

Definition at line 59 of file NekMeshUtils/Module/Module.cpp.

References Nektar::FieldUtils::ModuleTypeMap.

60 {
61  return os << ModuleTypeMap[rhs.first] << ": " << rhs.second;
62 }
const char *const ModuleTypeMap[]
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs

◆ operator<<() [2/2]

NEKMESHUTILS_EXPORT std::ostream & Nektar::NekMeshUtils::operator<< ( std::ostream &  os,
const NodeSharedPtr n 
)

Print description of node to given ostream.

Definition at line 151 of file BooleanOperators.cpp.

152 {
153  os << n->m_x << " " << n->m_y << " " << n->m_z;
154  return os;
155 }

◆ operator==() [1/8]

NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( ElmtConfig const &  c1,
ElmtConfig const &  c2 
)

Compares two element config structs.

Definition at line 48 of file BooleanOperators.cpp.

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

Referenced by Nektar::NekMeshUtils::HOSurfHash::operator()().

49 {
50  return (c1.m_e == c2.m_e && c1.m_order == c2.m_order);
51 }

◆ operator==() [2/8]

NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( ElementSharedPtr const &  e1,
ElementSharedPtr const &  e2 
)

Compares two element shared pointers.

Definition at line 56 of file BooleanOperators.cpp.

57 {
58  return e1->GetId() == e2->GetId();
59 }

◆ operator==() [3/8]

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 67 of file BooleanOperators.cpp.

68 {
69  if (p1->vertId.size() != p2->vertId.size())
70  {
71  return false;
72  }
73 
74  vector<int> ids1 = p1->vertId;
75  vector<int> ids2 = p2->vertId;
76  sort(ids1.begin(), ids1.end());
77  sort(ids2.begin(), ids2.end());
78 
79  for (int i = 0; i < ids1.size(); ++i)
80  {
81  if (ids1[i] != ids2[i])
82  return false;
83  }
84 
85  return true;
86 }

◆ operator==() [4/8]

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 92 of file BooleanOperators.cpp.

93 {
94  int i, n = c1->type.size();
95 
96  if (n != c2->type.size())
97  {
98  return false;
99  }
100 
101  for (i = 0; i < n; ++i)
102  {
103  if (c1->type[i] != c2->type[i])
104  {
105  return false;
106  }
107 
108  if (c1->field[i] != c2->field[i] || c1->value[i] != c2->value[i])
109  {
110  return false;
111  }
112  }
113 
114  return true;
115 }

◆ operator==() [5/8]

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 120 of file BooleanOperators.cpp.

121 {
122  return *p1 == *p2;
123 }

◆ operator==() [6/8]

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 161 of file BooleanOperators.cpp.

162 {
163  return ( ((*(p1->m_n1) == *(p2->m_n1)) && (*(p1->m_n2) == *(p2->m_n2)))
164  || ((*(p1->m_n2) == *(p2->m_n1)) && (*(p1->m_n1) == *(p2->m_n2))));
165 }

◆ operator==() [7/8]

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 179 of file BooleanOperators.cpp.

References Nektar::StdRegions::find().

180 {
181  std::vector<NodeSharedPtr>::iterator it1;
182  for (it1 = p1->m_vertexList.begin(); it1 != p1->m_vertexList.end(); ++it1)
183  {
184  if (find(p2->m_vertexList.begin(), p2->m_vertexList.end(), *it1)
185  == p2->m_vertexList.end())
186  {
187  return false;
188  }
189  }
190  return true;
191 }
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
Definition: StdRegions.hpp:358

◆ operator==() [8/8]

bool Nektar::NekMeshUtils::operator== ( OctantSharedPtr const &  p1,
OctantSharedPtr const &  p2 
)

Definition at line 509 of file Octant.cpp.

510 {
511  if (p1->GetId() == p2->GetId())
512  {
513  return true;
514  }
515 
516  return false;
517 }

◆ P() [1/2]

void Nektar::NekMeshUtils::P ( Array< OneD, NekDouble uv,
NekDouble x,
NekDouble y,
NekDouble z 
)

Definition at line 121 of file CADSurfCFI.cpp.

References CellMLToNektar.cellml_metadata::p.

Referenced by Nektar::NekMeshUtils::CADSurfCFI::D1(), Nektar::NekMeshUtils::CADSurfCFI::D2(), and Nektar::NekMeshUtils::CADSurfCFI::locuv().

122 {
123  cfi::UVPosition uvp(uv[0], uv[1]);
124  cfi::Position p = m_cfiSurface->calcXYZAtUV(uvp);
125  x = p.x * m_scal;
126  y = p.y * m_scal;
127  z = p.z * m_scal;
128 }

◆ P() [2/2]

void Nektar::NekMeshUtils::P ( NekDouble  t,
NekDouble x,
NekDouble y,
NekDouble z 
)

Definition at line 136 of file CADCurveCFI.cpp.

References CellMLToNektar.cellml_metadata::p.

Referenced by Nektar::NekMeshUtils::CADSurf::SetEdges().

137 {
138  cfi::Position p = m_cfiEdge->calcXYZAtT(t);
139 
140  x = p.x * m_scal;
141  y = p.y * m_scal;
142  z = p.z * m_scal;
143 }

◆ sign()

bool Nektar::NekMeshUtils::sign ( NekDouble  a,
NekDouble  b 
)
inline

Definition at line 350 of file BLMesh.cpp.

References Vmath::Dot().

351 {
352  return (a * b > 0.0);
353 }

◆ sort3()

template<typename K >
void Nektar::NekMeshUtils::sort3 ( K &  x,
K &  y,
K &  z 
)

Helper function to sort 3 numbers using sorting network.

Definition at line 443 of file Tetrahedron.cpp.

References SWAP.

Referenced by Nektar::NekMeshUtils::Tetrahedron::OrientTet().

444 {
445 #define SWAP(a,b) if (a > b) std::swap(a,b);
446  SWAP(y, z);
447  SWAP(x, z);
448  SWAP(x, y);
449 #undef SWAP
450 }
#define SWAP(a, b)

◆ Take()

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

Definition at line 48 of file OptimiseFunctions.cpp.

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

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

◆ Times()

Array<OneD, NekDouble> Nektar::NekMeshUtils::Times ( NekDouble  t,
Array< OneD, NekDouble a 
)

Definition at line 56 of file OptimiseFunctions.cpp.

57 {
58  Array<OneD, NekDouble> ret(3);
59  ret[0] = a[0] * t;
60  ret[1] = a[1] * t;
61  ret[2] = a[2] * t;
62  return ret;
63 }

Variable Documentation

◆ ModuleTypeMap

const char* const Nektar::NekMeshUtils::ModuleTypeMap[]
Initial value:
=
{
"Input",
"Process",
"Output"
}

Definition at line 70 of file NekMeshUtils/Module/Module.h.