35#ifndef NEKTAR_SPATIALDOMAINS_MESHGRAPH_H
36#define NEKTAR_SPATIALDOMAINS_MESHGRAPH_H
38#include <unordered_map>
63PoolAllocator<SpatialDomains::PointGeom>
87namespace SpatialDomains
90template <
typename T>
using GeomMap = std::map<int, unique_ptr_objpool<T>>;
94typedef std::shared_ptr<PointGeom>
123typedef std::map<int, std::pair<LibUtilities::ShapeType, std::vector<int>>>
155 "MODIFIEDGLLRADAU10",
160 "GAUSS_LAGRANGE_SEM",
208typedef std::shared_ptr<std::vector<std::pair<Geometry *, int>>>
238 return {
m_it->first,
m_it->second.get()};
280 auto it =
m_map.find(
id);
281 return it !=
m_map.end() ? it->second.get() :
nullptr;
363 "Composite not found.");
371 const std::string &compositeStr,
CompositeMap &compositeVector)
const;
383 std::map<int, std::map<int, CompositeSharedPtr>> &
GetDomain()
388 std::map<int, CompositeSharedPtr> &
GetDomain(
int domain)
391 "Request for domain which does not exist");
401 const std::string variable =
"DefaultVar");
408 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
412 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef,
413 std::vector<std::vector<LibUtilities::PointsType>> &pointstype);
445 std::string var =
"DefaultVar");
452 const std::string var2);
468 const int nummodes_x,
469 const int nummodes_y,
470 const int nummodes_z);
560 if constexpr (std::is_same_v<T, PointGeom>)
562 m_pointGeoms.insert(std::make_pair(
id, std::move(geom)));
564 else if constexpr (std::is_same_v<T, SegGeom>)
566 m_segGeoms.insert(std::make_pair(
id, std::move(geom)));
568 else if constexpr (std::is_same_v<T, QuadGeom>)
570 m_quadGeoms.insert(std::make_pair(
id, std::move(geom)));
572 else if constexpr (std::is_same_v<T, TriGeom>)
574 m_triGeoms.insert(std::make_pair(
id, std::move(geom)));
576 else if constexpr (std::is_same_v<T, TetGeom>)
578 m_tetGeoms.insert(std::make_pair(
id, std::move(geom)));
580 else if constexpr (std::is_same_v<T, PyrGeom>)
582 m_pyrGeoms.insert(std::make_pair(
id, std::move(geom)));
584 else if constexpr (std::is_same_v<T, PrismGeom>)
586 m_prismGeoms.insert(std::make_pair(
id, std::move(geom)));
588 else if constexpr (std::is_same_v<T, HexGeom>)
590 m_hexGeoms.insert(std::make_pair(
id, std::move(geom)));
594 ASSERTL0(
false,
"Unknown geometry type");
605 auto ret = geom.get();
611 int id,
int coordim, std::array<PointGeom *, SegGeom::kNverts> vertex,
616 auto ret = geom.get();
622 int id, std::array<SegGeom *, QuadGeom::kNedges> edges,
627 auto ret = geom.get();
633 int id, std::array<SegGeom *, TriGeom::kNedges> edges,
638 auto ret = geom.get();
644 int id, std::array<TriGeom *, TetGeom::kNfaces> faces)
647 auto ret = geom.get();
653 int id, std::array<QuadGeom *, HexGeom::kNfaces> faces)
656 auto ret = geom.get();
662 int id, std::array<Geometry2D *, PrismGeom::kNfaces> faces)
665 auto ret = geom.get();
671 int id, std::array<Geometry2D *, PyrGeom::kNfaces> faces)
674 auto ret = geom.get();
691 if constexpr (std::is_same_v<T, PointGeom>)
695 else if constexpr (std::is_same_v<T, SegGeom>)
699 else if constexpr (std::is_same_v<T, TriGeom>)
703 else if constexpr (std::is_same_v<T, QuadGeom>)
707 else if constexpr (std::is_same_v<T, TetGeom>)
711 else if constexpr (std::is_same_v<T, PrismGeom>)
715 else if constexpr (std::is_same_v<T, PyrGeom>)
719 else if constexpr (std::is_same_v<T, HexGeom>)
725 "MeshGraph does not support the supplied geometry type.");
746 return it1->second.get();
752 return it2->second.get();
809 auto it = geomMap.find(
id);
811 "Unable to find geometry with ID " + std::to_string(
id));
812 return it->second.get();
893 (std::string(
"ExpansionInfo field is already set for variable ") +
915 const std::string var2)
920 if (expVec1.get() == expVec2.get())
#define ASSERTL0(condition, msg)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
#define SPATIAL_DOMAINS_EXPORT
Provides a generic Factory class.
Generic object pool allocator/deallocator.
static std::unique_ptr< DataType, UniquePtrDeleter > AllocateUniquePtr(const Args &...args)
std::vector< QuadGeomUniquePtr > m_quadVec
std::vector< PrismGeomUniquePtr > m_prismVec
std::vector< PyrGeomUniquePtr > m_pyrVec
std::vector< HexGeomUniquePtr > m_hexVec
std::vector< PointGeomUniquePtr > m_pointVec
std::vector< SegGeomUniquePtr > m_segVec
std::vector< TriGeomUniquePtr > m_triVec
std::vector< TetGeomUniquePtr > m_tetVec
bool operator==(const Iterator &other) const
Iterator(typename GeomMap< T >::const_iterator it)
value_type operator*() const
bool operator!=(const Iterator &other) const
std::pair< int, T * > value_type
GeomMap< T >::const_iterator m_it
const GeomMap< T > & m_map
Iterator find(int id) const
GeomMapView(const GeomMap< T > &map)
Base class for shape geometry information.
Base class for a spectral/hp element mesh.
PyrGeom * CreatePyrGeom(int id, std::array< Geometry2D *, PyrGeom::kNfaces > faces)
GeomMapView< SegGeom > m_segMapView
void SetDomainRange(NekDouble xmin, NekDouble xmax, NekDouble ymin=NekConstants::kNekUnsetDouble, NekDouble ymax=NekConstants::kNekUnsetDouble, NekDouble zmin=NekConstants::kNekUnsetDouble, NekDouble zmax=NekConstants::kNekUnsetDouble)
GeomMapView< TriGeom > m_triMapView
TriGeom * GetTriGeom(int id)
Returns triangle id from the MeshGraph.
GeomMapView< QuadGeom > m_quadMapView
static LibUtilities::BasisKeyVector DefineBasisKeyFromExpansionType(Geometry *in, ExpansionType type, const int order)
bool CheckRange(Geometry2D &geom)
Check if goemetry is in range definition if activated.
void FillBoundingBoxTree()
std::map< int, RefRegion * > m_refRegion
Link the refinement id with the surface region data.
void SetCompositeOrdering(CompositeOrdering p_compOrder)
int GetMeshDimension()
Dimension of the mesh (can be a 1D curve in 3D space).
std::vector< PointGeomUniquePtr > & GetAllCurveNodes()
const std::string GetGeomInfo(std::string parameter)
PointGeom * GetVertex(int id)
Returns vertex id from the MeshGraph.
GeometryLinkSharedPtr GetElementsFromFace(Geometry2D *face)
void SetRefinementInfo(ExpansionInfoMapShPtr &expansionMap)
This function sets the expansion #exp in map with entry #variable.
std::map< int, std::map< int, CompositeSharedPtr > > & GetDomain()
GeomMapView< HexGeom > m_hexMapView
void PopulateFaceToElMap(Geometry3D *element, int kNfaces)
Given a 3D geometry object #element, populate the face to element map m_faceToElMap which maps faces ...
PrismGeom * CreatePrismGeom(int id, std::array< Geometry2D *, PrismGeom::kNfaces > faces)
Geometry * GetCompositeItem(int whichComposite, int whichItem)
void SetExpansionInfoToEvenlySpacedPoints(int npoints=0)
Sets expansions to have equispaced points.
HexGeom * CreateHexGeom(int id, std::array< QuadGeom *, HexGeom::kNfaces > faces)
GeometryLinkSharedPtr GetElementsFromEdge(Geometry1D *edge)
std::map< int, CompositeSharedPtr > & GetComposites()
TriGeom * CreateTriGeom(int id, std::array< SegGeom *, TriGeom::kNedges > edges, const CurveSharedPtr curve=CurveSharedPtr())
std::unordered_map< int, GeometryLinkSharedPtr > & GetAllFaceToElMap()
PrismGeom * GetPrismGeom(int id)
Returns prism id from the MeshGraph.
LibUtilities::SessionReaderSharedPtr m_session
LibUtilities::DomainRangeShPtr & GetDomainRange()
SegGeom * GetSegGeom(int id)
Returns segment id from the MeshGraph.
std::map< int, CompositeMap > m_domain
void SetPartition(SpatialDomains::MeshGraphSharedPtr graph)
std::unique_ptr< GeomRTree > m_boundingBoxTree
ExpansionInfoMapShPtr SetUpExpansionInfoMap()
std::map< int, CompositeSharedPtr > & GetDomain(int domain)
void SetExpansionInfoToPointOrder(int npts)
Reset expansion to have specified point order npts.
bool SameExpansionInfo(const std::string var1, const std::string var2)
void AddGeom(int id, unique_ptr_objpool< T > geom)
Convenience function to add a geometry geom to the MeshGraph with geometry ID id. Retains ownership o...
PointGeom * CreatePointGeom(const int coordim, const int vid, NekDouble x, NekDouble y, NekDouble z)
CompositeOrdering m_compOrder
std::map< int, CompositeMap > m_refComposite
Link the refinement id with the composites.
bool ExpansionInfoDefined(const std::string var)
GeomMapView< TetGeom > m_tetMapView
SegGeom * CreateSegGeom(int id, int coordim, std::array< PointGeom *, SegGeom::kNverts > vertex, const CurveSharedPtr curve=CurveSharedPtr())
GeomMapView< PointGeom > m_pointMapView
void SetMeshPartitioned(bool meshPartitioned)
void GetCompositeList(const std::string &compositeStr, CompositeMap &compositeVector) const
void PRefinementElmts(ExpansionInfoMapShPtr &expansionMap, RefRegion *®ion, Geometry *geomVecIter)
Perform the p-refinement in the selected elements.
std::vector< int > GetElementsContainingPoint(PointGeom *p)
CompositeMap m_meshComposites
void Empty(int dim, int space)
GeomMap< PyrGeom > m_pyrGeoms
HexGeom * GetHexGeom(int id)
Returns hex id from the MeshGraph.
QuadGeom * CreateQuadGeom(int id, std::array< SegGeom *, QuadGeom::kNedges > edges, const CurveSharedPtr curve=CurveSharedPtr())
GeomMapView< PyrGeom > m_pyrMapView
const ExpansionInfoMap & GetExpansionInfo(const std::string variable="DefaultVar")
ExpansionInfoMapShPtrMap m_expansionMapShPtrMap
GeomMap< SegGeom > m_segGeoms
int GetSpaceDimension()
Dimension of the space (can be a 1D curve in 3D space).
PyrGeom * GetPyrGeom(int id)
Returns pyramid id from the MeshGraph.
MovementSharedPtr m_movement
BndRegionOrdering & GetBndRegionOrdering()
std::string GetCompositeString(CompositeSharedPtr comp)
Returns a string representation of a composite.
T * GetGeom(int id, GeomMap< T > &geomMap)
Helper function for geometry lookups.
void ResetExpansionInfoToBasisKey(ExpansionInfoMapShPtr &expansionMap, LibUtilities::ShapeType shape, LibUtilities::BasisKeyVector &keys)
std::vector< PointGeomUniquePtr > m_nodeSet
Vector of all unique curve nodes, not including vertices.
GeomMap< PointGeom > m_pointGeoms
void SetExpansionInfoToNumModes(int nmodes)
Reset expansion to have specified polynomial order nmodes.
void SetMeshDimension(int dim)
LibUtilities::BasisKeyVector DefineBasisKeyFromExpansionTypeHomo(Geometry *in, ExpansionType type_x, ExpansionType type_y, ExpansionType type_z, const int nummodes_x, const int nummodes_y, const int nummodes_z)
std::unordered_map< int, GeometryLinkSharedPtr > m_faceToElMap
MovementSharedPtr & GetMovement()
CompositeSharedPtr GetComposite(int whichComposite)
GeomMap< TriGeom > m_triGeoms
PointGeom * GetPointGeom(int id)
Returns vertex id from the MeshGraph.
void SetExpansionInfo(std::vector< LibUtilities::FieldDefinitionsSharedPtr > &fielddef)
Sets expansions given field definitions.
void SetBndRegionOrdering(BndRegionOrdering p_bndRegOrder)
CompositeOrdering & GetCompositeOrdering()
std::map< int, MeshEntity > CreateMeshEntities()
Create mesh entities for this graph.
CurveMap & GetCurvedFaces()
GeomMapView< PrismGeom > m_prismMapView
bool CheckForGeomInfo(std::string parameter)
GeomMap< QuadGeom > m_quadGeoms
CompositeDescriptor CreateCompositeDescriptor()
CurveMap & GetCurvedEdges()
TetGeom * CreateTetGeom(int id, std::array< TriGeom *, TetGeom::kNfaces > faces)
GeomMap< HexGeom > m_hexGeoms
void ReadRefinementInfo()
Read refinement info.
void SetBasisKey(LibUtilities::ShapeType shape, LibUtilities::BasisKeyVector &keys, std::string var="DefaultVar")
Sets the basis key for all expansions of the given shape.
std::map< int, std::string > m_compositesLabels
GeomMap< TetGeom > m_tetGeoms
QuadGeom * GetQuadGeom(int id)
Returns quadrilateral id from the MeshGraph.
std::map< int, std::string > & GetCompositesLabels()
void SetSpaceDimension(int dim)
GeomMapView< T > & GetGeomMap()
void SetSession(LibUtilities::SessionReaderSharedPtr pSession)
Geometry2D * GetGeometry2D(int gID)
GeomMap< PrismGeom > m_prismGeoms
LibUtilities::DomainRangeShPtr m_domainRange
TetGeom * GetTetGeom(int id)
Returns tetrahedron id from the MeshGraph.
BndRegionOrdering m_bndRegOrder
Abstract base class for the refinement surface region.
std::vector< BasisKey > BasisKeyVector
Name for a vector of BasisKeys.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< DomainRange > DomainRangeShPtr
static const NekDouble kNekUnsetDouble
std::map< int, unique_ptr_objpool< T > > GeomMap
unique_ptr_objpool< HexGeom > HexGeomUniquePtr
std::shared_ptr< std::vector< std::pair< Geometry *, int > > > GeometryLinkSharedPtr
std::map< std::string, std::string > GeomInfoMap
std::map< int, std::vector< unsigned int > > CompositeOrdering
unique_ptr_objpool< Geometry3D > Geometry3DUniquePtr
std::map< int, std::pair< LibUtilities::ShapeType, std::vector< int > > > CompositeDescriptor
std::map< int, std::vector< unsigned int > > BndRegionOrdering
unique_ptr_objpool< QuadGeom > QuadGeomUniquePtr
std::shared_ptr< Composite > CompositeSharedPtr
std::shared_ptr< ExpansionInfoMap > ExpansionInfoMapShPtr
std::shared_ptr< Movement > MovementSharedPtr
std::shared_ptr< Curve > CurveSharedPtr
unique_ptr_objpool< PyrGeom > PyrGeomUniquePtr
std::unordered_map< int, CurveSharedPtr > CurveMap
LibUtilities::NekFactory< std::string, MeshGraph > MeshGraphFactory
unique_ptr_objpool< PrismGeom > PrismGeomUniquePtr
std::shared_ptr< ExpansionInfo > ExpansionInfoShPtr
const std::string kExpansionTypeStr[]
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::map< std::string, std::string > MeshMetaDataMap
unique_ptr_objpool< Geometry2D > Geometry2DUniquePtr
std::shared_ptr< PointGeom > PointGeomSharedPtr
unique_ptr_objpool< SegGeom > SegGeomUniquePtr
unique_ptr_objpool< PointGeom > PointGeomUniquePtr
MeshGraphFactory & GetMeshGraphFactory()
unique_ptr_objpool< TriGeom > TriGeomUniquePtr
std::map< std::string, ExpansionInfoMapShPtr > ExpansionInfoMapShPtrMap
std::map< int, ExpansionInfoShPtr > ExpansionInfoMap
unique_ptr_objpool< TetGeom > TetGeomUniquePtr
std::map< int, CompositeSharedPtr > CompositeMap
boost::fast_pool_allocator< DataType, boost::default_user_allocator_new_delete, boost::details::pool::null_mutex > PoolAllocator
std::unique_ptr< T, typename ObjPoolManager< T >::UniquePtrDeleter > unique_ptr_objpool
std::vector< Geometry * > m_geomVec
ExpansionInfo(Geometry *geomPtr, const LibUtilities::BasisKeyVector basiskeyvec)
LibUtilities::BasisKeyVector m_basisKeyVector
ExpansionInfo(ExpansionInfoShPtr ExpInfo)