Nektar++
Geometry.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Geometry.h
4 //
5 // For more information, please see: http://www.nektar.info/
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: This file contains the base class specification for the
32 // Geometry class.
33 //
34 //
35 ////////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NEKTAR_SPATIALDOMAINS_GEOMETRY_H
38 #define NEKTAR_SPATIALDOMAINS_GEOMETRY_H
39 
43 
44 #include <unordered_map>
45 #include <array>
46 
47 namespace Nektar
48 {
49 
50 namespace SpatialDomains
51 {
52 
53 class Geometry; // Forward declaration for typedef.
54 typedef std::shared_ptr<Geometry> GeometrySharedPtr;
55 typedef std::vector<GeometrySharedPtr> GeometryVector;
56 typedef std::unordered_set<GeometrySharedPtr> GeometrySet;
57 typedef std::shared_ptr<GeometryVector> GeometryVectorSharedPtr;
58 
59 class PointGeom;
60 typedef std::shared_ptr<PointGeom> PointGeomSharedPtr;
61 
62 class Geometry1D;
63 class Geometry2D;
64 typedef std::shared_ptr<Geometry1D> Geometry1DSharedPtr;
65 typedef std::shared_ptr<Geometry2D> Geometry2DSharedPtr;
66 
67 struct Curve;
68 typedef std::shared_ptr<Curve> CurveSharedPtr;
69 typedef std::unordered_map<int, CurveSharedPtr> CurveMap;
70 static CurveMap NullCurveMap;
71 
72 /// \brief Less than operator to sort Geometry objects by global id when sorting
73 /// STL containers.
75  const std::shared_ptr<Geometry> &lhs,
76  const std::shared_ptr<Geometry> &rhs);
77 
79  const std::shared_ptr<Geometry> &lhs,
80  const std::shared_ptr<Geometry> &rhs);
81 
82 /// Base class for shape geometry information
83 class Geometry
84 {
85 public:
87  SPATIAL_DOMAINS_EXPORT Geometry(int coordim);
88 
90 
91  //---------------------------------------
92  // Helper functions
93  //---------------------------------------
94 
95  SPATIAL_DOMAINS_EXPORT inline int GetCoordim() const;
96  SPATIAL_DOMAINS_EXPORT inline void SetCoordim(int coordim);
97 
103 
104  //---------------------------------------
105  // Set and get ID
106  //---------------------------------------
107  SPATIAL_DOMAINS_EXPORT inline int GetGlobalID(void) const;
108  SPATIAL_DOMAINS_EXPORT inline void SetGlobalID(int globalid);
109 
110  //---------------------------------------
111  // Vertex, edge and face access
112  //---------------------------------------
113  SPATIAL_DOMAINS_EXPORT int GetVid(int i) const;
114  SPATIAL_DOMAINS_EXPORT int GetEid(int i) const;
115  SPATIAL_DOMAINS_EXPORT int GetFid(int i) const;
116  SPATIAL_DOMAINS_EXPORT inline int GetTid(int i) const;
117  SPATIAL_DOMAINS_EXPORT inline PointGeomSharedPtr GetVertex(int i) const;
118  SPATIAL_DOMAINS_EXPORT inline Geometry1DSharedPtr GetEdge(int i) const;
119  SPATIAL_DOMAINS_EXPORT inline Geometry2DSharedPtr GetFace(int i) const;
121  const int i) const;
123  const int i) const;
124  SPATIAL_DOMAINS_EXPORT inline int GetNumVerts() const;
125  SPATIAL_DOMAINS_EXPORT inline int GetNumEdges() const;
126  SPATIAL_DOMAINS_EXPORT inline int GetNumFaces() const;
127  SPATIAL_DOMAINS_EXPORT inline int GetShapeDim() const;
128 
129  //---------------------------------------
130  // \chi mapping access
131  //---------------------------------------
134  SPATIAL_DOMAINS_EXPORT inline const
135  Array<OneD, const NekDouble> &GetCoeffs(const int i) const;
136  SPATIAL_DOMAINS_EXPORT inline void FillGeom();
137 
138  //---------------------------------------
139  // Point lookups
140  //---------------------------------------
141  SPATIAL_DOMAINS_EXPORT std::array<NekDouble, 6> GetBoundingBox();
142 
144  const Array<OneD, const NekDouble> &gloCoord,
145  NekDouble tol = 0.0);
147  const Array<OneD, const NekDouble> &gloCoord,
148  Array<OneD, NekDouble> &locCoord,
149  NekDouble tol);
151  const Array<OneD, const NekDouble> &gloCoord,
152  Array<OneD, NekDouble> &locCoord,
153  NekDouble tol,
154  NekDouble &resid);
156  const Array<OneD, const NekDouble> &coords,
157  Array<OneD, NekDouble> &Lcoords);
159  const int i, const Array<OneD, const NekDouble> &Lcoord);
161  const Array<OneD, const NekDouble> &gloCoord);
163  Array<OneD, NekDouble> &locCoord,
164  NekDouble tol);
165 
166  //---------------------------------------
167  // Misc. helper functions
168  //---------------------------------------
169  SPATIAL_DOMAINS_EXPORT inline int GetVertexEdgeMap(int i, int j) const;
170  SPATIAL_DOMAINS_EXPORT inline int GetVertexFaceMap(int i, int j) const;
171  SPATIAL_DOMAINS_EXPORT inline int GetEdgeFaceMap(int i, int j) const;
172 
173  SPATIAL_DOMAINS_EXPORT inline void Reset(CurveMap &curvedEdges,
174  CurveMap &curvedFaces);
175  SPATIAL_DOMAINS_EXPORT inline void Setup();
176 
177 protected:
179  GeomFactorsSharedPtr geomFactor);
181 
182  /// Coordinate dimension of this geometry object.
184  /// Geometric factors.
186  /// State of the geometric factors
188  /// \f$\chi\f$ mapping containing isoparametric transformation.
190  /// Enumeration to dictate whether coefficients are filled.
192  /// Wether or not the setup routines have been run
194  /// Type of geometry.
196  /// Type of shape.
198  /// Global ID
200  /// Array containing expansion coefficients of @p m_xmap
202 
203  /// Handles generation of geometry factors.
204  void GenGeomFactors();
205 
206  //---------------------------------------
207  // Helper functions
208  //---------------------------------------
209  virtual PointGeomSharedPtr v_GetVertex(int i) const = 0;
210  virtual Geometry1DSharedPtr v_GetEdge(int i) const;
211  virtual Geometry2DSharedPtr v_GetFace(int i) const;
212  virtual StdRegions::Orientation v_GetEorient(const int i) const;
213  virtual StdRegions::Orientation v_GetForient(const int i) const;
214  virtual int v_GetNumVerts() const;
215  virtual int v_GetNumEdges() const;
216  virtual int v_GetNumFaces() const;
217  virtual int v_GetShapeDim() const;
218 
220  virtual void v_FillGeom();
221 
222  virtual bool v_ContainsPoint(const Array<OneD, const NekDouble> &gloCoord,
223  Array<OneD, NekDouble> &locCoord,
224  NekDouble tol,
225  NekDouble &resid);
226 
227  virtual NekDouble v_GetCoord(const int i,
228  const Array<OneD, const NekDouble> &Lcoord);
230  Array<OneD, NekDouble> &Lcoords);
231 
232  virtual int v_GetVertexEdgeMap(int i, int j) const;
233  virtual int v_GetVertexFaceMap(int i, int j) const;
234  virtual int v_GetEdgeFaceMap(int i, int j) const;
235 
236  virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces);
237  virtual void v_Setup();
238  virtual void v_GenGeomFactors() = 0;
239 
240  inline void SetUpCoeffs(const int nCoeffs);
241 }; // class Geometry
242 
243 /**
244  * @brief Unary function that constructs a hash of a Geometry object, based on
245  * the vertex IDs.
246  */
247 struct GeometryHash : std::unary_function<GeometrySharedPtr, std::size_t>
248 {
249  std::size_t operator()(GeometrySharedPtr const& p) const
250  {
251  int i;
252  size_t seed = 0;
253  int nVert = p->GetNumVerts();
254  std::vector<unsigned int> ids(nVert);
255 
256  for (i = 0; i < nVert; ++i)
257  {
258  ids[i] = p->GetVid(i);
259  }
260  std::sort(ids.begin(), ids.end());
261  hash_range(seed, ids.begin(), ids.end());
262 
263  return seed;
264  }
265 };
266 
267 /**
268  * @brief Return the coordinate dimension of this object (i.e. the dimension of
269  * the space in which this object is embedded).
270  */
271 inline int Geometry::GetCoordim() const
272 {
273  return m_coordim;
274 }
275 
276 /**
277  * @brief Sets the coordinate dimension of this object (i.e. the dimension of
278  * the space in which this object is embedded).
279  */
280 inline void Geometry::SetCoordim(int dim)
281 {
282  m_coordim = dim;
283 }
284 
285 /**
286  * @brief Get the geometric factors for this object, generating them if
287  * required.
288  */
290 {
291  GenGeomFactors();
293 }
294 
295 /**
296  * @brief Get the geometric factors for this object.
297  */
299 {
300  return m_geomFactors;
301 }
302 
303 /**
304  * @brief Get the geometric shape type of this object.
305  */
307 {
308  return m_shapeType;
309 }
310 
311 /**
312  * @brief Get the ID of this object.
313  */
314 inline int Geometry::GetGlobalID(void) const
315 {
316  return m_globalID;
317 }
318 
319 /**
320  * @brief Set the ID of this object.
321  */
322 inline void Geometry::SetGlobalID(int globalid)
323 {
324  m_globalID = globalid;
325 }
326 
327 /**
328  * @brief Get the ID of trace @p i of this object.
329  *
330  * The trace element is the facet one dimension lower than the object; for
331  * example, a quadrilateral has four trace segments forming its boundary.
332  */
333 inline int Geometry::GetTid(int i) const
334 {
335  const int nDim = GetShapeDim();
336  return nDim == 1 ? GetVid(i) : nDim == 2 ? GetEid(i) :
337  nDim == 3 ? GetFid(i) : 0;
338 }
339 
340 /**
341  * @brief Returns vertex @p i of this object.
342  */
343 inline PointGeomSharedPtr Geometry::GetVertex(int i) const
344 {
345  return v_GetVertex(i);
346 }
347 
348 /**
349  * @brief Returns edge @p i of this object.
350  */
351 inline Geometry1DSharedPtr Geometry::GetEdge(int i) const
352 {
353  return v_GetEdge(i);
354 }
355 
356 /**
357  * @brief Returns face @p i of this object.
358  */
359 inline Geometry2DSharedPtr Geometry::GetFace(int i) const
360 {
361  return v_GetFace(i);
362 }
363 
364 /**
365  * @brief Returns the orientation of edge @p i with respect to the ordering of
366  * edges in the standard element.
367  */
369 {
370  return v_GetEorient(i);
371 }
372 
373 /**
374  * @brief Returns the orientation of face @p i with respect to the ordering of
375  * faces in the standard element.
376  */
378 {
379  return v_GetForient(i);
380 }
381 
382 /**
383  * @brief Get the number of vertices of this object.
384  */
385 inline int Geometry::GetNumVerts() const
386 {
387  return v_GetNumVerts();
388 }
389 
390 /**
391  * @brief Get the number of edges of this object.
392  */
393 inline int Geometry::GetNumEdges() const
394 {
395  return v_GetNumEdges();
396 }
397 
398 /**
399  * @brief Get the number of faces of this object.
400  */
401 inline int Geometry::GetNumFaces() const
402 {
403  return v_GetNumFaces();
404 }
405 
406 /**
407  * @brief Get the object's shape dimension.
408  *
409  * For example, a segment is one dimensional and quadrilateral is two
410  * dimensional.
411  */
412 inline int Geometry::GetShapeDim() const
413 {
414  return v_GetShapeDim();
415 }
416 
417 /**
418  * @brief Return the mapping object Geometry::m_xmap that represents the
419  * coordinate transformation from standard element to physical element.
420  */
422 {
423  return v_GetXmap();
424 }
425 
426 /**
427  * @brief Return the coefficients of the transformation Geometry::m_xmap in
428  * coordinate direction @p i.
429  */
431  const int i) const
432 {
433  return m_coeffs[i];
434 }
435 
436 /**
437  * @brief Populate the coordinate mapping Geometry::m_coeffs information from
438  * any children geometry elements.
439  *
440  * @see v_FillGeom()
441  */
442 inline void Geometry::FillGeom()
443 {
444  v_FillGeom();
445 }
446 
447 /**
448  * @brief Determine whether an element contains a particular Cartesian
449  * coordinate \f$(x,y,z)\f$.
450  *
451  * @see Geometry::ContainsPoint
452  */
454  const Array<OneD, const NekDouble> &gloCoord,
455  NekDouble tol)
456 {
457  Array<OneD,NekDouble> locCoord(GetCoordim(), 0.0);
458  NekDouble resid;
459  return v_ContainsPoint(gloCoord, locCoord, tol, resid);
460 }
461 
462 /**
463  * @brief Determine whether an element contains a particular Cartesian
464  * coordinate \f$(x,y,z)\f$.
465  *
466  * @see Geometry::ContainsPoint
467  */
469  const Array<OneD, const NekDouble> &gloCoord,
470  Array<OneD, NekDouble> &locCoord,
471  NekDouble tol)
472 {
473  NekDouble resid;
474  return v_ContainsPoint(gloCoord, locCoord, tol, resid);
475 }
476 
477 /**
478  * @brief Determine whether an element contains a particular Cartesian
479  * coordinate \f$\vec{x} = (x,y,z)\f$.
480  *
481  * For curvilinear and non-affine elements (i.e. where the Jacobian varies as a
482  * function of the standard element coordinates), this is a non-linear
483  * optimisation problem that requires the use of a Newton iteration. Note
484  * therefore that this can be an expensive operation.
485  *
486  * The parameter @p tol which is by default 0, can be used to expand the
487  * coordinate range of the standard element from \f$[-1,1]^d\f$ to
488  * \f$[-1-\epsilon,1+\epsilon\f$ to handle challenging edge cases. The function
489  * also returns the local coordinates corresponding to @p gloCoord that can be
490  * used to speed up subsequent searches.
491  *
492  * @param gloCoord The coordinate \f$ (x,y,z) \f$.
493  * @param locCoord On exit, this is the local coordinate \f$\vec{\xi}\f$ such
494  * that \f$\chi(\vec{\xi}) = \vec{x}\f$.
495  * @param tol The tolerance used to dictate the bounding box of the
496  * standard coordinates \f$\vec{\xi}\f$.
497  * @param resid On exit, returns the minimum distance between @p gloCoord
498  * and the quadrature points inside the element.
499  *
500  * @return `true` if the coordinate @p gloCoord is contained in the element;
501  * false otherwise.
502  *
503  * @see Geometry::GetLocCoords.
504  */
506  const Array<OneD, const NekDouble> &gloCoord,
507  Array<OneD, NekDouble> &locCoord,
508  NekDouble tol,
509  NekDouble &resid)
510 {
511  return v_ContainsPoint(gloCoord, locCoord, tol, resid);
512 }
513 
514 /**
515  * @brief Determine the local collapsed coordinates that correspond to a
516  * given Cartesian coordinate for this geometry object.
517  *
518  * For curvilinear and non-affine elements (i.e. where the Jacobian varies as a
519  * function of the standard element coordinates), this is a non-linear
520  * optimisation problem that requires the use of a Newton iteration. Note
521  * therefore that this can be an expensive operation.
522  *
523  * Note that, clearly, the provided Cartesian coordinate lie outside the
524  * element. The function therefore returns the minimum distance from some
525  * position in the element to . @p Lcoords will also be constrained to fit
526  * within the range \f$[-1,1]^d\f$ where \f$ d \f$ is the dimension of the
527  * element.
528  *
529  * @param coords Input Cartesian global coordinates
530  * @param Lcoords Corresponding local coordinates
531  *
532  * @return Distance between obtained coordinates and provided ones.
533  */
535  const Array<OneD, const NekDouble> &coords,
536  Array<OneD, NekDouble> &Lcoords)
537 {
538  return v_GetLocCoords(coords, Lcoords);
539 }
540 
541 /**
542  * @brief Given local collapsed coordinate @p Lcoord, return the value of
543  * physical coordinate in direction @p i.
544  */
545 inline NekDouble Geometry::GetCoord(const int i,
546  const Array<OneD, const NekDouble> &Lcoord)
547 {
548  return v_GetCoord(i, Lcoord);
549 }
550 
551 /**
552  * @brief Returns the standard element edge IDs that are connected to a given
553  * vertex.
554  *
555  * For example, on a prism, vertex 0 is connnected to edges 0, 3, and 4;
556  * `GetVertexEdgeMap(0,j)` would therefore return the values 0, 1 and 4
557  * respectively. We assume that @p j runs between 0 and 2 inclusive, which is
558  * true for every 3D element asides from the pyramid.
559  *
560  * This function is used in the construction of the low-energy preconditioner.
561  *
562  * @param i The vertex to query connectivity for.
563  * @param j The local edge index between 0 and 2 connected to this element.
564  *
565  * @todo Expand to work with pyramid elements.
566  * @see MultiRegions::PreconditionerLowEnergy
567  */
568 inline int Geometry::GetVertexEdgeMap(int i, int j) const
569 {
570  return v_GetVertexEdgeMap(i, j);
571 }
572 
573 /**
574  * @brief Returns the standard element face IDs that are connected to a given
575  * vertex.
576  *
577  * For example, on a hexahedron, vertex 0 is connnected to faces 0, 1, and 4;
578  * `GetVertexFaceMap(0,j)` would therefore return the values 0, 1 and 4
579  * respectively. We assume that @p j runs between 0 and 2 inclusive, which is
580  * true for every 3D element asides from the pyramid.
581  *
582  * This is used in the construction of the low-energy preconditioner.
583  *
584  * @param i The vertex to query connectivity for.
585  * @param j The local face index between 0 and 2 connected to this element.
586  *
587  * @todo Expand to work with pyramid elements.
588  * @see MultiRegions::PreconditionerLowEnergy
589  */
590 inline int Geometry::GetVertexFaceMap(int i, int j) const
591 {
592  return v_GetVertexFaceMap(i, j);
593 }
594 
595 /**
596  * @brief Returns the standard element edge IDs that are connected to a given
597  * face.
598  *
599  * For example, on a prism, edge 0 is connnected to faces 0 and 1;
600  * `GetEdgeFaceMap(0,j)` would therefore return the values 0 and 1
601  * respectively. We assume that @p j runs between 0 and 1 inclusive, since every
602  * face is connected to precisely two faces for all 3D elements.
603  *
604  * This function is used in the construction of the low-energy preconditioner.
605  *
606  * @param i The edge to query connectivity for.
607  * @param j The local face index between 0 and 1 connected to this element.
608  *
609  * @see MultiRegions::PreconditionerLowEnergy
610  */
611 inline int Geometry::GetEdgeFaceMap(int i, int j) const
612 {
613  return v_GetEdgeFaceMap(i, j);
614 }
615 
616 /**
617  * @brief Reset this geometry object: unset the current state, zero
618  * Geometry::m_coeffs and remove allocated GeomFactors.
619  */
620 inline void Geometry::Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
621 {
622  v_Reset(curvedEdges, curvedFaces);
623 }
624 inline void Geometry::Setup()
625 {
626  v_Setup();
627 }
628 
629 /**
630  * @brief Generate the geometric factors (i.e. derivatives of \f$\chi\f$) and
631  * related metrics.
632  *
633  * @see SpatialDomains::GeomFactors
634  */
636 {
637  return v_GenGeomFactors();
638 }
639 
640 /**
641  * @brief Initialise the Geometry::m_coeffs array.
642  */
643 inline void Geometry::SetUpCoeffs(const int nCoeffs)
644 {
646 
647  for (int i = 0; i < m_coordim; ++i)
648  {
649  m_coeffs[i] = Array<OneD, NekDouble>(nCoeffs, 0.0);
650  }
651 }
652 
653 }
654 }
655 
656 #endif // NEKTAR_SPATIALDOMAINS_GEOMETRY_H
StdRegions::StdExpansionSharedPtr m_xmap
mapping containing isoparametric transformation.
Definition: Geometry.h:189
void GenGeomFactors()
Handles generation of geometry factors.
Definition: Geometry.h:635
static CurveMap NullCurveMap
Definition: Geometry.h:70
std::size_t hash_range(Iter first, Iter last)
Definition: HashUtils.hpp:69
GeomFactorsSharedPtr GetRefGeomFactors(const Array< OneD, const LibUtilities::BasisSharedPtr > &tbasis)
virtual Geometry2DSharedPtr v_GetFace(int i) const
Returns face i of this object.
Definition: Geometry.cpp:172
int GetShapeDim() const
Get the object&#39;s shape dimension.
Definition: Geometry.h:412
int GetTid(int i) const
Get the ID of trace i of this object.
Definition: Geometry.h:333
int GetEid(int i) const
Get the ID of edge i of this object.
Definition: Geometry.cpp:145
int GetFid(int i) const
Get the ID of face i of this object.
Definition: Geometry.cpp:153
virtual PointGeomSharedPtr v_GetVertex(int i) const =0
virtual int v_GetEdgeFaceMap(int i, int j) const
Returns the standard element edge IDs that are connected to a given face.
Definition: Geometry.cpp:291
virtual bool v_ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, Array< OneD, NekDouble > &locCoord, NekDouble tol, NekDouble &resid)
Definition: Geometry.cpp:255
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
Definition: Geometry.h:65
void SetGlobalID(int globalid)
Set the ID of this object.
Definition: Geometry.h:322
Base class for shape geometry information.
Definition: Geometry.h:83
GeomFactorsSharedPtr m_geomFactors
Geometric factors.
Definition: Geometry.h:185
StdRegions::StdExpansionSharedPtr GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition: Geometry.h:421
Geometry2DSharedPtr GetFace(int i) const
Returns face i of this object.
Definition: Geometry.h:359
std::unordered_map< int, CurveSharedPtr > CurveMap
Definition: Curve.hpp:62
std::shared_ptr< GeomFactors > GeomFactorsSharedPtr
Pointer to a GeomFactors object.
Definition: GeomFactors.h:62
bool MinMaxCheck(const Array< OneD, const NekDouble > &gloCoord)
Check if given global coord is within twice the min/max distance of the element.
Definition: Geometry.cpp:435
static GeomFactorsSharedPtr ValidateRegGeomFactor(GeomFactorsSharedPtr geomFactor)
Check to see if a geometric factor has already been created that contains the same regular informatio...
Definition: Geometry.cpp:90
std::vector< GeometrySharedPtr > GeometryVector
Definition: Geometry.h:55
virtual NekDouble v_GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this ge...
Definition: Geometry.cpp:314
GeomFactorsSharedPtr GetGeomFactors()
Get the geometric factors for this object, generating them if required.
Definition: Geometry.h:289
virtual void v_Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
Definition: Geometry.cpp:335
int GetVertexEdgeMap(int i, int j) const
Returns the standard element edge IDs that are connected to a given vertex.
Definition: Geometry.h:568
void ClampLocCoords(Array< OneD, NekDouble > &locCoord, NekDouble tol)
Clamp local coords to be within standard regions [-1, 1]^dim.
Definition: Geometry.cpp:478
int GetVertexFaceMap(int i, int j) const
Returns the standard element face IDs that are connected to a given vertex.
Definition: Geometry.h:590
static GeomFactorsVector m_regGeomFactorsManager
Definition: Geometry.h:180
void Reset(CurveMap &curvedEdges, CurveMap &curvedFaces)
Reset this geometry object: unset the current state, zero Geometry::m_coeffs and remove allocated Geo...
Definition: Geometry.h:620
virtual StdRegions::Orientation v_GetEorient(const int i) const
Returns the orientation of edge i with respect to the ordering of edges in the standard element...
Definition: Geometry.cpp:193
GeomState m_geomFactorsState
State of the geometric factors.
Definition: Geometry.h:187
int GetGlobalID(void) const
Get the ID of this object.
Definition: Geometry.h:314
std::size_t operator()(GeometrySharedPtr const &p) const
Definition: Geometry.h:249
StandardMatrixTag & lhs
virtual int v_GetNumFaces() const
Get the number of faces of this object.
Definition: Geometry.cpp:225
virtual int v_GetShapeDim() const
Get the object&#39;s shape dimension.
Definition: Geometry.cpp:235
int GetNumFaces() const
Get the number of faces of this object.
Definition: Geometry.h:401
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
int GetCoordim() const
Return the coordinate dimension of this object (i.e. the dimension of the space in which this object ...
Definition: Geometry.h:271
StdRegions::Orientation GetEorient(const int i) const
Returns the orientation of edge i with respect to the ordering of edges in the standard element...
Definition: Geometry.h:368
std::vector< GeomFactorsSharedPtr > GeomFactorsVector
A vector of GeomFactor pointers.
Definition: GeomFactors.h:64
std::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:53
bool ContainsPoint(const Array< OneD, const NekDouble > &gloCoord, NekDouble tol=0.0)
Determine whether an element contains a particular Cartesian coordinate .
Definition: Geometry.h:453
virtual StdRegions::StdExpansionSharedPtr v_GetXmap() const
Return the mapping object Geometry::m_xmap that represents the coordinate transformation from standar...
Definition: Geometry.cpp:245
std::unordered_set< GeometrySharedPtr > GeometrySet
Definition: Geometry.h:56
double NekDouble
GeomState
Indicates if the geometric information for an element has been populated.
bool GlobalIdEquality(const std::shared_ptr< Geometry > &lhs, const std::shared_ptr< Geometry > &rhs)
Definition: Geometry.cpp:128
void FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements...
Definition: Geometry.h:442
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:59
bool m_setupState
Wether or not the setup routines have been run.
Definition: Geometry.h:193
int GetVid(int i) const
Get the ID of vertex i of this object.
Definition: Geometry.cpp:137
int GetNumVerts() const
Get the number of vertices of this object.
Definition: Geometry.h:385
const Array< OneD, const NekDouble > & GetCoeffs(const int i) const
Return the coefficients of the transformation Geometry::m_xmap in coordinate direction i...
Definition: Geometry.h:430
std::shared_ptr< GeometryVector > GeometryVectorSharedPtr
Definition: Geometry.h:57
1D geometry information
Definition: Geometry1D.h:54
Array< OneD, Array< OneD, NekDouble > > m_coeffs
Array containing expansion coefficients of m_xmap.
Definition: Geometry.h:201
2D geometry information
Definition: Geometry2D.h:68
virtual int v_GetNumVerts() const
Get the number of vertices of this object.
Definition: Geometry.cpp:183
std::shared_ptr< Curve > CurveSharedPtr
Definition: Curve.hpp:61
int GetEdgeFaceMap(int i, int j) const
Returns the standard element edge IDs that are connected to a given face.
Definition: Geometry.h:611
GeomType m_geomType
Type of geometry.
Definition: Geometry.h:195
int GetNumEdges() const
Get the number of edges of this object.
Definition: Geometry.h:393
virtual StdRegions::Orientation v_GetForient(const int i) const
Returns the orientation of face i with respect to the ordering of faces in the standard element...
Definition: Geometry.cpp:204
NekDouble GetLocCoords(const Array< OneD, const NekDouble > &coords, Array< OneD, NekDouble > &Lcoords)
Determine the local collapsed coordinates that correspond to a given Cartesian coordinate for this ge...
Definition: Geometry.h:534
Geometry1DSharedPtr GetEdge(int i) const
Returns edge i of this object.
Definition: Geometry.h:351
LibUtilities::ShapeType m_shapeType
Type of shape.
Definition: Geometry.h:197
std::shared_ptr< Geometry1D > Geometry1DSharedPtr
Definition: Geometry.h:63
StdRegions::Orientation GetForient(const int i) const
Returns the orientation of face i with respect to the ordering of faces in the standard element...
Definition: Geometry.h:377
void SetUpCoeffs(const int nCoeffs)
Initialise the Geometry::m_coeffs array.
Definition: Geometry.h:643
NekDouble GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord)
Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i...
Definition: Geometry.h:545
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs
virtual int v_GetNumEdges() const
Get the number of edges of this object.
Definition: Geometry.cpp:215
GeomFactorsSharedPtr GetMetricInfo()
Get the geometric factors for this object.
Definition: Geometry.h:298
GeomType
Indicates the type of element geometry.
GeomState m_state
Enumeration to dictate whether coefficients are filled.
Definition: Geometry.h:191
virtual NekDouble v_GetCoord(const int i, const Array< OneD, const NekDouble > &Lcoord)
Given local collapsed coordinate Lcoord, return the value of physical coordinate in direction i...
Definition: Geometry.cpp:302
virtual int v_GetVertexFaceMap(int i, int j) const
Returns the standard element face IDs that are connected to a given vertex.
Definition: Geometry.cpp:280
virtual ~Geometry()
Default destructor.
Definition: Geometry.cpp:72
virtual void v_FillGeom()
Populate the coordinate mapping Geometry::m_coeffs information from any children geometry elements...
Definition: Geometry.cpp:326
virtual int v_GetVertexEdgeMap(int i, int j) const
Returns the standard element edge IDs that are connected to a given vertex.
Definition: Geometry.cpp:269
bool SortByGlobalId(const std::shared_ptr< Geometry > &lhs, const std::shared_ptr< Geometry > &rhs)
Less than operator to sort Geometry objects by global id when sorting STL containers.
Definition: Geometry.cpp:122
virtual Geometry1DSharedPtr v_GetEdge(int i) const
Returns edge i of this object.
Definition: Geometry.cpp:161
PointGeomSharedPtr GetVertex(int i) const
Returns vertex i of this object.
Definition: Geometry.h:343
int m_coordim
Coordinate dimension of this geometry object.
Definition: Geometry.h:183
Geometry()
Default constructor.
Definition: Geometry.cpp:54
std::array< NekDouble, 6 > GetBoundingBox()
Generates the bounding box for the element.
Definition: Geometry.cpp:363
LibUtilities::ShapeType GetShapeType(void)
Get the geometric shape type of this object.
Definition: Geometry.h:306
#define SPATIAL_DOMAINS_EXPORT
void SetCoordim(int coordim)
Sets the coordinate dimension of this object (i.e. the dimension of the space in which this object is...
Definition: Geometry.h:280
Unary function that constructs a hash of a Geometry object, based on the vertex IDs.
Definition: Geometry.h:247