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

Namespaces

 CADOrientation
 
 CADType
 

Classes

struct  badsubseg
 
struct  badtriang
 
struct  behavior
 
class  BLMesh
 
class  BPoint
 class for a planar boundary based samlping Point More...
 
class  CADCurve
 base class for CAD curves. More...
 
class  CADCurveOCE
 
class  CADObject
 
class  CADSurf
 base class for a cad surface More...
 
class  CADSurfOCE
 
class  CADSystem
 Base class for CAD interface system. More...
 
class  CADSystemOCE
 
class  CADVert
 base class for CAD verticies. More...
 
class  CADVertOCE
 
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  DelaunayTriangle
 
class  Edge
 Represents an edge which joins two points. More...
 
struct  EdgeHash
 Defines a hash function for edges. 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...
 
struct  event
 
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...
 
struct  flipstacker
 
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
 
struct  memorypool
 
struct  mesh
 
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
 
struct  osub
 
struct  otri
 
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...
 
struct  splaynode
 
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...
 
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...
 
struct  triangulateio
 
class  VolumeMesh
 

Typedefs

typedef boost::shared_ptr
< CADCurve
CADCurveSharedPtr
 
typedef
LibUtilities::NekFactory
< std::string, CADCurve
CADCurveFactory
 
typedef boost::shared_ptr
< CADObject
CADObjectSharedPtr
 
typedef boost::shared_ptr
< CADSurf
CADSurfSharedPtr
 
typedef
LibUtilities::NekFactory
< std::string, CADSurf
CADSurfFactory
 
typedef boost::shared_ptr
< CADVert
CADVertSharedPtr
 
typedef boost::shared_ptr
< CADSystem
CADSystemSharedPtr
 
typedef
LibUtilities::NekFactory
< std::string, CADSystem,
std::string > 
EngineFactory
 
typedef
LibUtilities::NekFactory
< std::string, CADVert
CADVertFactory
 
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
 
typedef boost::unordered_set
< FaceSharedPtr, FaceHash
FaceSet
 
typedef HOTriangle< NodeSharedPtrHOSurf
 
typedef boost::shared_ptr< HOSurfHOSurfSharedPtr
 
typedef boost::unordered_set
< HOSurfSharedPtr, HOSurfHash
HOSurfSet
 
typedef boost::shared_ptr< OctreeOctreeSharedPtr
 
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 std::map< int,
std::pair< FaceSharedPtr,
std::vector< int > > > 
PerMap
 
typedef std::pair< ModuleType,
std::string > 
ModuleKey
 
typedef boost::shared_ptr< ModuleModuleSharedPtr
 
typedef
LibUtilities::NekFactory
< ModuleKey, Module,
MeshSharedPtr
ModuleFactory
 
typedef boost::shared_ptr< OctantOctantSharedPtr
 
typedef boost::shared_ptr< SPBaseSPBaseSharedPtr
 
typedef boost::shared_ptr< CPointCPointSharedPtr
 
typedef boost::shared_ptr< BPointBPointSharedPtr
 
typedef boost::shared_ptr
< SrcPoint
SrcPointSharedPtr
 
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 double ** triangle
 
typedef double ** subseg
 
typedef double * vertex
 
typedef boost::shared_ptr< BLMeshBLMeshSharedPtr
 
typedef boost::shared_ptr
< TetMesh
TetMeshSharedPtr
 

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 }
 
enum  locateresult { INTRIANGLE, ONEDGE, ONVERTEX, OUTSIDE }
 
enum  insertvertexresult { SUCCESSFULVERTEX, ENCROACHINGVERTEX, VIOLATINGVERTEX, DUPLICATEVERTEX }
 
enum  finddirectionresult { WITHIN, LEFTCOLLINEAR, RIGHTCOLLINEAR }
 

Functions

CADCurveFactoryGetCADCurveFactory ()
 
CADSurfFactoryGetCADSurfFactory ()
 
EngineFactoryGetEngineFactory ()
 
CADVertFactoryGetCADVertFactory ()
 
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 ()
 
bool operator== (const struct TetOrient &a, const struct TetOrient &b)
 
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

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

Definition at line 141 of file BLMesh.h.

typedef boost::shared_ptr<BPoint> Nektar::NekMeshUtils::BPointSharedPtr

Definition at line 232 of file SourcePoint.hpp.

Definition at line 196 of file CADCurve.h.

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

Definition at line 194 of file CADCurve.h.

Definition at line 112 of file CADObject.h.

Definition at line 174 of file CADSurf.h.

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

Definition at line 172 of file CADSurf.h.

Definition at line 218 of file CADSystem.h.

Definition at line 130 of file CADVert.h.

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

Definition at line 54 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 83 of file Mesh.h.

Definition at line 82 of file Mesh.h.

typedef boost::shared_ptr<CPoint> Nektar::NekMeshUtils::CPointSharedPtr

Definition at line 177 of file SourcePoint.hpp.

Definition at line 182 of file CurveMesh.h.

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

Definition at line 161 of file Edge.h.

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

Shared pointer to an edge.

Definition at line 135 of file Edge.h.

Element factory definition.

Definition at line 415 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 409 of file Element.h.

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

Definition at line 49 of file Edge.h.

Definition at line 220 of file CADSystem.h.

Definition at line 161 of file FaceMesh.h.

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

Definition at line 174 of file Face.h.

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

Definition at line 148 of file Face.h.

Definition at line 180 of file HOAlignment.h.

Definition at line 209 of file HOAlignment.h.

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

Definition at line 181 of file HOAlignment.h.

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

Shared pointer to a mesh.

Definition at line 147 of file Mesh.h.

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

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

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

typedef boost::shared_ptr<Module> Nektar::NekMeshUtils::ModuleSharedPtr

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

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

Definition at line 441 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 48 of file Mesh.h.

Definition at line 82 of file OptimiseFunctions.h.

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

Definition at line 90 of file OptimiseObj.h.

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

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

typedef boost::shared_ptr<SPBase> Nektar::NekMeshUtils::SPBaseSharedPtr

Definition at line 124 of file SourcePoint.hpp.

Definition at line 274 of file SourcePoint.hpp.

typedef double** Nektar::NekMeshUtils::subseg

Definition at line 708 of file Triangle/Triangle.h.

Definition at line 100 of file TetGenInterface.h.

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

Definition at line 89 of file TetMesh.h.

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

Definition at line 371 of file Tetrahedron.cpp.

Definition at line 690 of file Triangle/Triangle.h.

Definition at line 116 of file TriangleInterface.h.

Definition at line 726 of file Triangle/Triangle.h.

Enumeration Type Documentation

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

Enumerator
eDirichlet 
eNeumann 
eRobin 
ePeriodic 
eHOPCondition 
SIZE_ConditionType 

Definition at line 54 of file Mesh.h.

Enumerator
WITHIN 
LEFTCOLLINEAR 
RIGHTCOLLINEAR 

Definition at line 566 of file Triangle/Triangle.h.

Enumerator
INTRIANGLE 
ONEDGE 
ONVERTEX 
OUTSIDE 

Definition at line 539 of file Triangle/Triangle.h.

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 64 of file NekMeshUtils/Module/Module.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.

Enumerator
eCBoundary 
ePBoundary 
eSrcPoint 

Definition at line 47 of file SourcePoint.hpp.

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

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::HOSurfaceMesh::Process().

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

Definition at line 45 of file OptimiseFunctions.cpp.

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

46 {
47  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
48 }
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
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
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
CADCurveFactory & Nektar::NekMeshUtils::GetCADCurveFactory ( )

Definition at line 64 of file CADSystem.cpp.

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

65 {
66  typedef Loki::SingletonHolder<CADCurveFactory, Loki::CreateUsingNew,
67  Loki::NoDestroy, Loki::SingleThreaded>
68  Type;
69  return Type::Instance();
70 }
LibUtilities::NekFactory< std::string, CADCurve > CADCurveFactory
Definition: CADCurve.h:196
CADSurfFactory & Nektar::NekMeshUtils::GetCADSurfFactory ( )

Definition at line 72 of file CADSystem.cpp.

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

73 {
74  typedef Loki::SingletonHolder<CADSurfFactory, Loki::CreateUsingNew,
75  Loki::NoDestroy, Loki::SingleThreaded>
76  Type;
77  return Type::Instance();
78 }
LibUtilities::NekFactory< std::string, CADSurf > CADSurfFactory
Definition: CADSurf.h:174
CADVertFactory & Nektar::NekMeshUtils::GetCADVertFactory ( )

Definition at line 56 of file CADSystem.cpp.

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

57 {
58  typedef Loki::SingletonHolder<CADVertFactory, Loki::CreateUsingNew,
59  Loki::NoDestroy, Loki::SingleThreaded>
60  Type;
61  return Type::Instance();
62 }
LibUtilities::NekFactory< std::string, CADVert > CADVertFactory
Definition: CADVert.h:130
NEKMESHUTILS_EXPORT ElementFactory & Nektar::NekMeshUtils::GetElementFactory ( )

Definition at line 47 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::InputGmsh::Process(), Nektar::NekMeshUtils::VolumeMesh::Process(), Nektar::Utilities::InputNek5000::Process(), Nektar::Utilities::ProcessOptiExtract::Process(), Nektar::Utilities::InputSwan::Process(), Nektar::Utilities::InputVtk::Process(), Nektar::Utilities::ProcessExtrude::Process(), Nektar::Utilities::ProcessSpherigon::Process(), Nektar::Utilities::InputNek::Process(), Nektar::Utilities::ProcessExtractSurf::Process(), Nektar::Utilities::ProcessExtractTetPrismInterface::Process(), Nektar::Utilities::ProcessDetectSurf::Process(), Nektar::NekMeshUtils::Generator2D::Process(), Nektar::Utilities::ProcessTetSplit::Process(), Nektar::Utilities::InputPly::ReadPly(), Nektar::NekMeshUtils::Module::ReorderPrisms(), and Nektar::NekMeshUtils::Octree::WriteOctree().

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:415
EngineFactory & Nektar::NekMeshUtils::GetEngineFactory ( )

Definition at line 48 of file CADSystem.cpp.

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

49 {
50  typedef Loki::SingletonHolder<EngineFactory, Loki::CreateUsingNew,
51  Loki::NoDestroy, Loki::SingleThreaded>
52  Type;
53  return Type::Instance();
54 }
LibUtilities::NekFactory< std::string, CADSystem, std::string > EngineFactory
Definition: CADSystem.h:220
NEKMESHUTILS_EXPORT ModuleFactory & Nektar::NekMeshUtils::GetModuleFactory ( )

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

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

52 {
53  typedef Loki::SingletonHolder<ModuleFactory,
54  Loki::CreateUsingNew,
55  Loki::NoDestroy,
56  Loki::SingleThreaded> Type;
57  return Type::Instance();
58 }
LibUtilities::NekFactory< ModuleKey, Module, FieldSharedPtr > ModuleFactory
OctantFace Nektar::NekMeshUtils::GetReverseFace ( OctantFace  f)
inline

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 
62  return eUp;
63 }
bool Nektar::NekMeshUtils::Infont ( NodeSharedPtr  n,
ElementSharedPtr  el 
)
inline

Definition at line 179 of file BLMesh.cpp.

References Nektar::LibUtilities::ang().

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

180 {
181  vector<NodeSharedPtr> ns1 = el->GetVertexList();
182  Array<OneD, NekDouble> N1 = el->Normal(true);
183 
184  Array<OneD, NekDouble> V(3);
185  V[0] = n->m_x - ns1[0]->m_x;
186  V[1] = n->m_y - ns1[0]->m_y;
187  V[2] = n->m_z - ns1[0]->m_z;
188 
189  NekDouble Vmag = sqrt(V[0] * V[0] + V[1] * V[1] + V[2] * V[2]);
190 
191  NekDouble ang = (N1[0] * V[0] + N1[1] * V[1] + N1[2] * V[2]) / Vmag;
192 
193  return ang > 0.17;
194 }
static NekDouble ang(NekDouble x, NekDouble y)
double NekDouble
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator!= ( NodeSharedPtr const &  p1,
NodeSharedPtr const &  p2 
)

Compares two nodes for inequality based on IDs.

Definition at line 129 of file BooleanOperators.cpp.

130 {
131  if (p1->m_id != p2->m_id)
132  {
133  return true;
134  }
135  else
136  {
137  return false;
138  }
139 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator< ( NodeSharedPtr const &  p1,
NodeSharedPtr const &  p2 
)

Defines ordering between two NodeSharedPtr objects.

Definition at line 144 of file BooleanOperators.cpp.

145 {
146  return *p1 < *p2;
147 }
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 171 of file BooleanOperators.cpp.

172 {
173  return p1->m_id < p2->m_id;
174 }
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 198 of file BooleanOperators.cpp.

199 {
200  return p1->m_id < p2->m_id;
201 }
NEKMESHUTILS_EXPORT std::ostream & Nektar::NekMeshUtils::operator<< ( std::ostream &  os,
const ModuleKey &  rhs 
)

Prints a given module key to a stream.

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

References Nektar::FieldUtils::ModuleTypeMap.

64 {
65  return os << ModuleTypeMap[rhs.first] << ": " << rhs.second;
66 }
const char *const ModuleTypeMap[]
std::ostream & Nektar::NekMeshUtils::operator<< ( std::ostream &  os,
const NodeSharedPtr &  n 
)

Print description of node to given ostream.

Definition at line 152 of file BooleanOperators.cpp.

153 {
154  os << n->m_x << " " << n->m_y << " " << n->m_z;
155  return os;
156 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( ElmtConfig const &  c1,
ElmtConfig const &  c2 
)

Compares two element config structs.

Definition at line 49 of file BooleanOperators.cpp.

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

50 {
51  return (c1.m_e == c2.m_e && c1.m_order == c2.m_order);
52 }
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::operator== ( ElementSharedPtr const &  e1,
ElementSharedPtr const &  e2 
)

Compares two element shared pointers.

Definition at line 57 of file BooleanOperators.cpp.

58 {
59  return e1->GetId() == e2->GetId();
60 }
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 68 of file BooleanOperators.cpp.

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

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

122 {
123  return *p1 == *p2;
124 }
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 162 of file BooleanOperators.cpp.

163 {
164  return ( ((*(p1->m_n1) == *(p2->m_n1)) && (*(p1->m_n2) == *(p2->m_n2)))
165  || ((*(p1->m_n2) == *(p2->m_n1)) && (*(p1->m_n1) == *(p2->m_n2))));
166 }
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 180 of file BooleanOperators.cpp.

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

181 {
183  for (it1 = p1->m_vertexList.begin(); it1 != p1->m_vertexList.end(); ++it1)
184  {
185  if (find(p2->m_vertexList.begin(), p2->m_vertexList.end(), *it1)
186  == p2->m_vertexList.end())
187  {
188  return false;
189  }
190  }
191  return true;
192 }
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:316
bool Nektar::NekMeshUtils::operator== ( const struct TetOrient &  a,
const struct TetOrient &  b 
)

Definition at line 373 of file Tetrahedron.cpp.

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

374 {
375  if (a.nid.size() != b.nid.size())
376  {
377  return false;
378  }
379 
380  for (int i = 0; i < a.nid.size(); ++i)
381  {
382  if (a.nid[i] != b.nid[i])
383  {
384  return false;
385  }
386  }
387 
388  return true;
389 }
bool Nektar::NekMeshUtils::operator== ( OctantSharedPtr const &  p1,
OctantSharedPtr const &  p2 
)

Definition at line 510 of file Octant.cpp.

511 {
512  if (p1->GetId() == p2->GetId())
513  {
514  return true;
515  }
516 
517  return false;
518 }
bool Nektar::NekMeshUtils::sign ( NekDouble  a,
NekDouble  b 
)
inline

Definition at line 351 of file BLMesh.cpp.

352 {
353  return (a * b > 0.0);
354 }
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(), and Nektar::NekMeshUtils::OptiEdge::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 }

Variable Documentation

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

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