Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
Nektar::SpatialDomains::MeshGraph2D Class Reference

#include <MeshGraph2D.h>

Inheritance diagram for Nektar::SpatialDomains::MeshGraph2D:
Inheritance graph
[legend]
Collaboration diagram for Nektar::SpatialDomains::MeshGraph2D:
Collaboration graph
[legend]

Public Member Functions

 MeshGraph2D ()
 
 MeshGraph2D (const LibUtilities::SessionReaderSharedPtr &pSession, const DomainRangeShPtr &rng=NullDomainRangeShPtr)
 
virtual ~MeshGraph2D ()
 
void ReadGeometry (const std::string &infilename)
 Read will read the meshgraph vertices given a filename. More...
 
void ReadGeometry (TiXmlDocument &doc)
 Read will read the meshgraph vertices given a TiXmlDocument. More...
 
SegGeomSharedPtr GetSegGeom (int eID)
 
int GetCoordim (void)
 
const TriGeomMapGetTrigeoms (void) const
 
const QuadGeomMapGetQuadgeoms (void) const
 
void GenXGeoFac ()
 
int GetNseggeoms () const
 
int GetVidFromElmt (LibUtilities::ShapeType shape, const int vert, const int elmt) const
 
int GetEidFromElmt (LibUtilities::ShapeType shape, const int edge, const int elmt) const
 
StdRegions::Orientation GetEorientFromElmt (LibUtilities::ShapeType shape, const int edge, const int elmt) const
 
StdRegions::Orientation GetCartesianEorientFromElmt (LibUtilities::ShapeType shape, const int edge, const int elmt) const
 
int GetNumComposites (void)
 
int GetNumCompositeItems (int whichComposite)
 
ElementEdgeVectorSharedPtr GetElementsFromEdge (SegGeomSharedPtr edge)
 Return the elements (shared ptrs) that have this edge. More...
 
ElementEdgeVectorSharedPtr GetElementsFromEdge (Geometry1DSharedPtr edge)
 
LibUtilities::BasisKey GetEdgeBasisKey (SegGeomSharedPtr edge, const std::string variable="DefaultVar")
 Return the BasisKey corresponding to an edge of an element If the expansion is a triangle the Modified_B direction is modified to be one-dimensional Modified_A,GaussLobattoLegendre. More...
 
- Public Member Functions inherited from Nektar::SpatialDomains::MeshGraph
 MeshGraph ()
 
 MeshGraph (unsigned int meshDimension, unsigned int spaceDimension)
 
 MeshGraph (const LibUtilities::SessionReaderSharedPtr &pSession, const DomainRangeShPtr &rng=NullDomainRangeShPtr)
 
virtual ~MeshGraph ()
 
void ReadGeometryInfo (const std::string &infilename)
 Read geometric information from a file. More...
 
void ReadGeometryInfo (TiXmlDocument &doc)
 Read geometric information from an XML document. More...
 
void ReadExpansions (const std::string &infilename)
 Read the expansions given the XML file path. More...
 
void ReadExpansions (TiXmlDocument &doc)
 Read the expansions given the XML document reference. More...
 
void ReadDomain (TiXmlDocument &doc)
 
void ReadCurves (TiXmlDocument &doc)
 
void ReadCurves (std::string &infilename)
 
void WriteGeometry (std::string &outfilename)
 Write out an XML file containing the GEOMETRY block representing this MeshGraph instance inside a NEKTAR tag. More...
 
void WriteGeometry (TiXmlDocument &doc)
 Populate a TinyXML document with a GEOMETRY tag inside the NEKTAR tag. More...
 
int GetMeshDimension () const
 Dimension of the mesh (can be a 1D curve in 3D space). More...
 
int GetSpaceDimension () const
 Dimension of the space (can be a 1D curve in 3D space). More...
 
void SetDomainRange (NekDouble xmin, NekDouble xmax, NekDouble ymin=NekConstants::kNekUnsetDouble, NekDouble ymax=NekConstants::kNekUnsetDouble, NekDouble zmin=NekConstants::kNekUnsetDouble, NekDouble zmax=NekConstants::kNekUnsetDouble)
 
bool CheckRange (Geometry2D &geom)
 Check if goemetry is in range definition if activated. More...
 
bool CheckRange (Geometry3D &geom)
 Check if goemetry is in range definition if activated. More...
 
Composite GetComposite (int whichComposite) const
 
GeometrySharedPtr GetCompositeItem (int whichComposite, int whichItem)
 
void GetCompositeList (const std::string &compositeStr, CompositeMap &compositeVector) const
 
const CompositeMapGetComposites () const
 
const std::map< int,
std::string > & 
GetCompositesLabels () const
 Return a map of integers and strings containing the labels of each composite. More...
 
const std::vector< CompositeMap > & GetDomain (void) const
 
const CompositeMapGetDomain (int domain) const
 
const ExpansionMapGetExpansions ()
 
const ExpansionMapGetExpansions (const std::string variable)
 
ExpansionShPtr GetExpansion (GeometrySharedPtr geom, const std::string variable="DefaultVar")
 
void SetExpansions (std::vector< LibUtilities::FieldDefinitionsSharedPtr > &fielddef)
 Sets expansions given field definitions. More...
 
void SetExpansions (std::vector< LibUtilities::FieldDefinitionsSharedPtr > &fielddef, std::vector< std::vector< LibUtilities::PointsType > > &pointstype)
 Sets expansions given field definition, quadrature points. More...
 
void SetExpansionsToEvenlySpacedPoints (int npoints=0)
 Sets expansions to have equispaced points. More...
 
void SetExpansionsToPolyOrder (int nmodes)
 Reset expansion to have specified polynomial order nmodes. More...
 
void SetExpansionsToPointOrder (int npts)
 Reset expansion to have specified point order npts. More...
 
void SetExpansions (const std::string variable, ExpansionMapShPtr &exp)
 This function sets the expansion #exp in map with entry #variable. More...
 
void SetBasisKey (LibUtilities::ShapeType shape, LibUtilities::BasisKeyVector &keys, std::string var="DefaultVar")
 Sets the basis key for all expansions of the given shape. More...
 
bool SameExpansions (const std::string var1, const std::string var2)
 
bool CheckForGeomInfo (std::string parameter)
 
const std::string GetGeomInfo (std::string parameter)
 
LibUtilities::BasisKeyVector DefineBasisKeyFromExpansionTypeHomo (GeometrySharedPtr in, ExpansionType type_x, ExpansionType type_y, ExpansionType type_z, const int nummodes_x, const int nummodes_y, const int nummodes_z)
 
int GetNvertices () const
 
PointGeomSharedPtr GetVertex (int id)
 
PointGeomSharedPtr AddVertex (NekDouble x, NekDouble y, NekDouble z)
 Adds a vertex to the with the next available ID. More...
 
SegGeomSharedPtr AddEdge (PointGeomSharedPtr v0, PointGeomSharedPtr v1, CurveSharedPtr curveDefinition=CurveSharedPtr())
 Adds an edge between two points. If curveDefinition is null, then the edge is straight, otherwise it is curved according to the curveDefinition. More...
 
SegGeomSharedPtr GetEdge (unsigned int id)
 
TriGeomSharedPtr AddTriangle (SegGeomSharedPtr edges[], StdRegions::Orientation orient[])
 
QuadGeomSharedPtr AddQuadrilateral (SegGeomSharedPtr edges[], StdRegions::Orientation orient[])
 
TetGeomSharedPtr AddTetrahedron (TriGeomSharedPtr tfaces[TetGeom::kNtfaces])
 
PyrGeomSharedPtr AddPyramid (TriGeomSharedPtr tfaces[PyrGeom::kNtfaces], QuadGeomSharedPtr qfaces[PyrGeom::kNqfaces])
 
PrismGeomSharedPtr AddPrism (TriGeomSharedPtr tfaces[PrismGeom::kNtfaces], QuadGeomSharedPtr qfaces[PrismGeom::kNqfaces])
 
HexGeomSharedPtr AddHexahedron (QuadGeomSharedPtr qfaces[HexGeom::kNqfaces])
 
const PointGeomMapGetVertSet () const
 
CurveMapGetCurvedEdges ()
 
CurveMapGetCurvedFaces ()
 
const PointGeomMapGetAllPointGeoms () const
 
const SegGeomMapGetAllSegGeoms () const
 
const TriGeomMapGetAllTriGeoms () const
 
const QuadGeomMapGetAllQuadGeoms () const
 
const TetGeomMapGetAllTetGeoms () const
 
const PyrGeomMapGetAllPyrGeoms () const
 
const PrismGeomMapGetAllPrismGeoms () const
 
const HexGeomMapGetAllHexGeoms () const
 
template<typename ElementType >
const std::map< int,
boost::shared_ptr< ElementType > > & 
GetAllElementsOfType () const
 Convenience method for ElVis. More...
 
template<>
const std::map< int,
boost::shared_ptr< SegGeom > > & 
GetAllElementsOfType () const
 
template<>
const std::map< int,
boost::shared_ptr< TriGeom > > & 
GetAllElementsOfType () const
 
template<>
const std::map< int,
boost::shared_ptr< QuadGeom > > & 
GetAllElementsOfType () const
 
template<>
const std::map< int,
boost::shared_ptr< HexGeom > > & 
GetAllElementsOfType () const
 
template<>
const std::map< int,
boost::shared_ptr< PrismGeom > > & 
GetAllElementsOfType () const
 
template<>
const std::map< int,
boost::shared_ptr< TetGeom > > & 
GetAllElementsOfType () const
 
template<>
const std::map< int,
boost::shared_ptr< PyrGeom > > & 
GetAllElementsOfType () const
 

Protected Member Functions

void ReadEdges (TiXmlDocument &doc)
 
void ReadElements (TiXmlDocument &doc)
 
void ReadComposites (TiXmlDocument &doc)
 
void ResolveGeomRef (const std::string &prevToken, const std::string &token, Composite &composite)
 
- Protected Member Functions inherited from Nektar::SpatialDomains::MeshGraph
ExpansionMapShPtr SetUpExpansionMap (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from Nektar::SpatialDomains::MeshGraph
static boost::shared_ptr
< MeshGraph
Read (const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
 
static boost::shared_ptr
< MeshGraph
Read (const std::string &infilename, bool pReadExpansions=true)
 
static LibUtilities::BasisKeyVector DefineBasisKeyFromExpansionType (GeometrySharedPtr in, ExpansionType type, const int order)
 
- Protected Attributes inherited from Nektar::SpatialDomains::MeshGraph
LibUtilities::SessionReaderSharedPtr m_session
 
PointGeomMap m_vertSet
 
InterfaceCompList m_iComps
 
CurveMap m_curvedEdges
 
CurveMap m_curvedFaces
 
SegGeomMap m_segGeoms
 
TriGeomMap m_triGeoms
 
QuadGeomMap m_quadGeoms
 
TetGeomMap m_tetGeoms
 
PyrGeomMap m_pyrGeoms
 
PrismGeomMap m_prismGeoms
 
HexGeomMap m_hexGeoms
 
int m_meshDimension
 
int m_spaceDimension
 
int m_partition
 
bool m_meshPartitioned
 
CompositeMap m_meshComposites
 
std::map< int, std::string > m_compositesLabels
 
std::vector< CompositeMapm_domain
 
DomainRangeShPtr m_domainRange
 
ExpansionMapShPtrMap m_expansionMapShPtrMap
 
GeomInfoMap m_geomInfo
 

Detailed Description

Definition at line 54 of file MeshGraph2D.h.

Constructor & Destructor Documentation

Nektar::SpatialDomains::MeshGraph2D::MeshGraph2D ( )

Definition at line 48 of file MeshGraph2D.cpp.

49  {
50  }
Nektar::SpatialDomains::MeshGraph2D::MeshGraph2D ( const LibUtilities::SessionReaderSharedPtr pSession,
const DomainRangeShPtr rng = NullDomainRangeShPtr 
)

Definition at line 56 of file MeshGraph2D.cpp.

References Nektar::SpatialDomains::MeshGraph::ReadExpansions(), and ReadGeometry().

58  : MeshGraph(pSession,rng)
59  {
60  ReadGeometry(pSession->GetDocument());
61  ReadExpansions(pSession->GetDocument());
62  }
void ReadGeometry(const std::string &infilename)
Read will read the meshgraph vertices given a filename.
Definition: MeshGraph2D.cpp:64
void ReadExpansions(const std::string &infilename)
Read the expansions given the XML file path.
Definition: MeshGraph.cpp:582
Nektar::SpatialDomains::MeshGraph2D::~MeshGraph2D ( )
virtual

Definition at line 52 of file MeshGraph2D.cpp.

53  {
54  }

Member Function Documentation

void Nektar::SpatialDomains::MeshGraph2D::GenXGeoFac ( )
StdRegions::Orientation Nektar::SpatialDomains::MeshGraph2D::GetCartesianEorientFromElmt ( LibUtilities::ShapeType  shape,
const int  edge,
const int  elmt 
) const
inline

Definition at line 154 of file MeshGraph2D.h.

References ASSERTL2, Nektar::StdRegions::eBackwards, Nektar::StdRegions::eForwards, Nektar::LibUtilities::eTriangle, Nektar::SpatialDomains::MeshGraph::m_quadGeoms, and Nektar::SpatialDomains::MeshGraph::m_triGeoms.

155  {
156  StdRegions::Orientation returnval;
157 
158  if(shape == LibUtilities::eTriangle)
159  {
160  ASSERTL2(m_triGeoms.find(elmt) != m_triGeoms.end(),
161  "eid is out of range");
162 
163  returnval = m_triGeoms.find(elmt)->second->GetEorient(edge);
164  }
165  else
166  {
167  ASSERTL2(m_quadGeoms.find(elmt) != m_quadGeoms.end(),
168  "eid is out of range");
169 
170  returnval = m_quadGeoms.find(elmt)->second->GetEorient(edge);
171  }
172 
173  // swap orientation if on edge 2 & 3 (if quad)
174  if(edge >= 2)
175  {
176  if(returnval == StdRegions::eForwards)
177  {
178  returnval = StdRegions::eBackwards;
179  }
180  else
181  {
182  returnval = StdRegions::eForwards;
183  }
184  }
185  return returnval;
186  }
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:240
int Nektar::SpatialDomains::MeshGraph2D::GetCoordim ( void  )
inline

Definition at line 69 of file MeshGraph2D.h.

References Nektar::SpatialDomains::MeshGraph::GetSpaceDimension().

69  {
70  return GetSpaceDimension();
71  }
int GetSpaceDimension() const
Dimension of the space (can be a 1D curve in 3D space).
Definition: MeshGraph.h:457
LibUtilities::BasisKey Nektar::SpatialDomains::MeshGraph2D::GetEdgeBasisKey ( SegGeomSharedPtr  edge,
const std::string  variable = "DefaultVar" 
)

Return the BasisKey corresponding to an edge of an element If the expansion is a triangle the Modified_B direction is modified to be one-dimensional Modified_A,GaussLobattoLegendre.

Definition at line 821 of file MeshGraph2D.cpp.

References ASSERTL0, Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eGaussRadauMAlpha1Beta0, Nektar::LibUtilities::eGLL_Lagrange, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::eModified_B, Nektar::LibUtilities::eOrtho_B, Nektar::LibUtilities::eTriangle, GetElementsFromEdge(), Nektar::SpatialDomains::MeshGraph::GetExpansion(), and Nektar::LibUtilities::NullBasisKey().

822  {
824  // Perhaps, a check should be done here to ensure that
825  // in case elements->size!=1, all elements to which
826  // the edge belongs have the same type and order of
827  // expansion such that no confusion can arise.
828  ExpansionShPtr expansion = GetExpansion((*elements)[0]->m_Element, variable);
829 
830  int edge_id = (*elements)[0]->m_EdgeIndx;
831 
832  if((*elements)[0]->m_Element->GetShapeType() == LibUtilities::eTriangle)
833  {
834  edge_id = (edge_id)? 1:0;
835  }
836  else
837  {
838  edge_id = edge_id%2;
839  }
840 
841  int nummodes = expansion->m_basisKeyVector[edge_id].GetNumModes();
842  int numpoints = expansion->m_basisKeyVector[edge_id].GetNumPoints();
843 
844  if((*elements)[0]->m_Element->GetShapeType() == LibUtilities::eTriangle)
845  {
846  // Use edge 0 to define basis of order relevant to edge
847  switch(expansion->m_basisKeyVector[edge_id].GetBasisType())
848  {
850  {
851  switch(expansion->m_basisKeyVector[edge_id].GetPointsType())
852  {
854  {
855  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
856  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
857  }
858  break;
859 
860  default:
861  ASSERTL0(false,"Unexpected points distribution");
862 
863  // It doesn't matter what we return
864  // here since the ASSERT will stop
865  // execution. Just return something
866  // to prevent warnings messages.
867  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
868  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
869  break;
870  }
871  }
872  break;
873  case LibUtilities::eOrtho_B: // Assume this is called from nodal triangular basis
874  {
875  switch(expansion->m_basisKeyVector[edge_id].GetPointsType())
876  {
878  {
879  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
880  return LibUtilities::BasisKey(LibUtilities::eGLL_Lagrange,nummodes,pkey);
881  }
882  break;
883 
884  default:
885  ASSERTL0(false,"Unexpected points distribution");
886 
887  // It doesn't matter what we return
888  // here since the ASSERT will stop
889  // execution. Just return something
890  // to prevent warnings messages.
891  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
892  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
893  break;
894  }
895  }
896  break;
898  {
899  switch(expansion->m_basisKeyVector[edge_id].GetPointsType())
900  {
902  {
903  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
904  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
905  }
906  break;
908  {
909  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
910  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
911  }
912  break;
913 
914  default:
915  ASSERTL0(false,"Unexpected points distribution");
916 
917  // It doesn't matter what we return
918  // here since the ASSERT will stop
919  // execution. Just return something
920  // to prevent warnings messages.
921  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
922  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
923  break;
924  }
925  }
926  break;
928  {
929  switch(expansion->m_basisKeyVector[edge_id].GetPointsType())
930  {
932  {
933  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
934  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
935  }
936  break;
937  default:
938  ASSERTL0(false,"Unexpected points distribution");
939  // It doesn't matter what we return here
940  // since the ASSERT will stop execution.
941  // Just return something to prevent
942  // warnings messages.
943  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
944  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
945  break;
946  }
947  }
948  break;
949 
950  default:
951  ASSERTL0(false,"Unexpected basis distribution");
952  // It doesn't matter what we return here since the
953  // ASSERT will stop execution. Just return
954  // something to prevent warnings messages.
955  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
956  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
957  }
958  }
959  else
960  {
961  // Quadrilateral
962  const LibUtilities::PointsKey pkey(numpoints,expansion->m_basisKeyVector[edge_id].GetPointsType());
963  return LibUtilities::BasisKey(expansion->m_basisKeyVector[edge_id].GetBasisType(),nummodes,pkey);
964  }
965 
966  ASSERTL0(false, "Unable to determine edge points type.");
968  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
Principle Modified Functions .
Definition: BasisType.h:49
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:57
Principle Orthogonal Functions .
Definition: BasisType.h:47
Principle Modified Functions .
Definition: BasisType.h:50
ElementEdgeVectorSharedPtr GetElementsFromEdge(SegGeomSharedPtr edge)
Return the elements (shared ptrs) that have this edge.
boost::shared_ptr< ElementEdgeVector > ElementEdgeVectorSharedPtr
Definition: MeshGraph.h:134
boost::shared_ptr< Expansion > ExpansionShPtr
Definition: MeshGraph.h:173
ExpansionShPtr GetExpansion(GeometrySharedPtr geom, const std::string variable="DefaultVar")
Definition: MeshGraph.cpp:2325
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey)
Defines a null basis with no type or points.
Lagrange for SEM basis .
Definition: BasisType.h:53
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:50
int Nektar::SpatialDomains::MeshGraph2D::GetEidFromElmt ( LibUtilities::ShapeType  shape,
const int  edge,
const int  elmt 
) const
inline

Definition at line 116 of file MeshGraph2D.h.

References ASSERTL2, Nektar::LibUtilities::eTriangle, Nektar::SpatialDomains::MeshGraph::m_quadGeoms, and Nektar::SpatialDomains::MeshGraph::m_triGeoms.

118  {
119  if(shape == LibUtilities::eTriangle)
120  {
121  ASSERTL2(m_triGeoms.find(elmt) != m_triGeoms.end(),
122  "eid is out of range");
123 
124  return m_triGeoms.find(elmt)->second->GetEid(edge);
125  }
126  else
127  {
128  ASSERTL2(m_quadGeoms.find(elmt) != m_quadGeoms.end(),
129  "eid is out of range");
130 
131  return m_quadGeoms.find(elmt)->second->GetEid(edge);
132  }
133  }
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:240
ElementEdgeVectorSharedPtr Nektar::SpatialDomains::MeshGraph2D::GetElementsFromEdge ( SegGeomSharedPtr  edge)

Return the elements (shared ptrs) that have this edge.

Definition at line 765 of file MeshGraph2D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and Nektar::SpatialDomains::MeshGraph::m_domain.

Referenced by GetEdgeBasisKey(), and GetElementsFromEdge().

766  {
767  // Search tris and quads
768  // Need to iterate through vectors because there may be multiple
769  // occurrences.
770  ElementEdgeSharedPtr elementEdge;
771  //TriGeomVectorIter triIter;
772 
774 
775  CompositeMapIter compIter;
776  TriGeomSharedPtr triGeomShPtr;
777  QuadGeomSharedPtr quadGeomShPtr;
778 
779  GeometryVectorIter geomIter;
780 
781  for(int d = 0; d < m_domain.size(); ++d)
782  {
783  for (compIter = m_domain[d].begin(); compIter != m_domain[d].end(); ++compIter)
784  {
785  for (geomIter = (compIter->second)->begin(); geomIter != (compIter->second)->end(); ++geomIter)
786  {
787  triGeomShPtr = boost::dynamic_pointer_cast<TriGeom>(*geomIter);
788  quadGeomShPtr = boost::dynamic_pointer_cast<QuadGeom>(*geomIter);
789 
790  if (triGeomShPtr || quadGeomShPtr)
791  {
792  int edgeNum;
793  if (triGeomShPtr)
794  {
795  if ((edgeNum = triGeomShPtr->WhichEdge(edge)) > -1)
796  {
798  elementEdge->m_Element = triGeomShPtr;
799  elementEdge->m_EdgeIndx = edgeNum;
800  returnval->push_back(elementEdge);
801  }
802  }
803  else if (quadGeomShPtr)
804  {
805  if ((edgeNum = quadGeomShPtr->WhichEdge(edge)) > -1)
806  {
808  elementEdge->m_Element = quadGeomShPtr;
809  elementEdge->m_EdgeIndx = edgeNum;
810  returnval->push_back(elementEdge);
811  }
812  }
813  }
814  }
815  }
816  }
817 
818  return returnval;
819  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< QuadGeom > QuadGeomSharedPtr
Definition: QuadGeom.h:54
std::vector< GeometrySharedPtr >::iterator GeometryVectorIter
Definition: Geometry.h:58
boost::shared_ptr< ElementEdge > ElementEdgeSharedPtr
Definition: MeshGraph.h:132
std::map< int, Composite >::iterator CompositeMapIter
Definition: MeshGraph.h:116
boost::shared_ptr< ElementEdgeVector > ElementEdgeVectorSharedPtr
Definition: MeshGraph.h:134
std::vector< CompositeMap > m_domain
Definition: MeshGraph.h:432
boost::shared_ptr< TriGeom > TriGeomSharedPtr
Definition: TriGeom.h:58
ElementEdgeVectorSharedPtr Nektar::SpatialDomains::MeshGraph2D::GetElementsFromEdge ( Geometry1DSharedPtr  edge)

Definition at line 753 of file MeshGraph2D.cpp.

References ASSERTL0, and GetElementsFromEdge().

754  {
755  SegGeomSharedPtr Sedge;
756 
757  if(!(Sedge = boost::dynamic_pointer_cast<SegGeom>(edge)))
758  {
759  ASSERTL0(false,"Dynamics cast failed");
760 
761  }
762  return GetElementsFromEdge(Sedge);
763 
764  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:60
ElementEdgeVectorSharedPtr GetElementsFromEdge(SegGeomSharedPtr edge)
Return the elements (shared ptrs) that have this edge.
StdRegions::Orientation Nektar::SpatialDomains::MeshGraph2D::GetEorientFromElmt ( LibUtilities::ShapeType  shape,
const int  edge,
const int  elmt 
) const
inline

Definition at line 135 of file MeshGraph2D.h.

References ASSERTL2, Nektar::LibUtilities::eTriangle, Nektar::SpatialDomains::MeshGraph::m_quadGeoms, and Nektar::SpatialDomains::MeshGraph::m_triGeoms.

136  {
137  if(shape == LibUtilities::eTriangle)
138  {
139  ASSERTL2(m_triGeoms.find(elmt) != m_triGeoms.end(),
140  "eid is out of range");
141 
142  return m_triGeoms.find(elmt)->second->GetEorient(edge);
143  }
144  else
145  {
146  ASSERTL2(m_quadGeoms.find(elmt) != m_quadGeoms.end(),
147  "eid is out of range");
148 
149  return m_quadGeoms.find(elmt)->second->GetEorient(edge);
150  }
151  }
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:240
int Nektar::SpatialDomains::MeshGraph2D::GetNseggeoms ( ) const
inline

Definition at line 92 of file MeshGraph2D.h.

References Nektar::SpatialDomains::MeshGraph::m_segGeoms.

93  {
94  return int(m_segGeoms.size());
95  }
int Nektar::SpatialDomains::MeshGraph2D::GetNumCompositeItems ( int  whichComposite)
inline

Definition at line 193 of file MeshGraph2D.h.

References ErrorUtil::efatal, Nektar::SpatialDomains::MeshGraph::m_meshComposites, and NEKERROR.

194  {
195  int returnval = -1;
196 
197  try
198  {
199  returnval = int(m_meshComposites[whichComposite]->size());
200  }
201  catch(...)
202  {
203  std::ostringstream errStream;
204  errStream << "Unable to access composite item [" << whichComposite << "].";
205  NEKERROR(ErrorUtil::efatal, errStream.str());
206  }
207 
208  return returnval;
209  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:185
int Nektar::SpatialDomains::MeshGraph2D::GetNumComposites ( void  )
inline

Definition at line 188 of file MeshGraph2D.h.

References Nektar::SpatialDomains::MeshGraph::m_meshComposites.

189  {
190  return int(m_meshComposites.size());
191  }
const QuadGeomMap& Nektar::SpatialDomains::MeshGraph2D::GetQuadgeoms ( void  ) const
inline

Definition at line 78 of file MeshGraph2D.h.

References Nektar::SpatialDomains::MeshGraph::m_quadGeoms.

79  {
80  return m_quadGeoms;
81  }
SegGeomSharedPtr Nektar::SpatialDomains::MeshGraph2D::GetSegGeom ( int  eID)

Definition at line 611 of file MeshGraph2D.cpp.

References ASSERTL0, Nektar::iterator, and Nektar::SpatialDomains::MeshGraph::m_segGeoms.

Referenced by ReadElements().

612  {
613  SegGeomSharedPtr returnval;
614  SegGeomMap::iterator x = m_segGeoms.find(eID);
615  ASSERTL0(x != m_segGeoms.end(), "Segment not found.");
616  return x->second;
617  };
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:60
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
const TriGeomMap& Nektar::SpatialDomains::MeshGraph2D::GetTrigeoms ( void  ) const
inline

Definition at line 73 of file MeshGraph2D.h.

References Nektar::SpatialDomains::MeshGraph::m_triGeoms.

74  {
75  return m_triGeoms;
76  }
int Nektar::SpatialDomains::MeshGraph2D::GetVidFromElmt ( LibUtilities::ShapeType  shape,
const int  vert,
const int  elmt 
) const
inline

Definition at line 97 of file MeshGraph2D.h.

References ASSERTL2, Nektar::LibUtilities::eTriangle, Nektar::SpatialDomains::MeshGraph::m_quadGeoms, and Nektar::SpatialDomains::MeshGraph::m_triGeoms.

99  {
100  if(shape == LibUtilities::eTriangle)
101  {
102  ASSERTL2(m_triGeoms.find(elmt) != m_triGeoms.end(),
103  "eid is out of range");
104 
105  return m_triGeoms.find(elmt)->second->GetVid(vert);
106  }
107  else
108  {
109  ASSERTL2(m_quadGeoms.find(elmt) != m_quadGeoms.end(),
110  "eid is out of range");
111 
112  return m_quadGeoms.find(elmt)->second->GetVid(vert);
113  }
114  }
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
Definition: ErrorUtil.hpp:240
void Nektar::SpatialDomains::MeshGraph2D::ReadComposites ( TiXmlDocument &  doc)
protected

We know we have it since we made it this far.

Look for elements in ELEMENT block.

All elements are of the form: "<C ID = "N"> ... </C>". Read the ID field first.

Parse out the element components corresponding to type of element.

Keep looking

Definition at line 517 of file MeshGraph2D.cpp.

References ASSERTL0, ErrorUtil::efatal, Nektar::SpatialDomains::MeshGraph::m_compositesLabels, Nektar::SpatialDomains::MeshGraph::m_meshComposites, NEKERROR, and ResolveGeomRef().

Referenced by ReadGeometry().

518  {
519  TiXmlHandle docHandle(&doc);
520 
521  /// We know we have it since we made it this far.
522  TiXmlElement* mesh = docHandle.FirstChildElement("NEKTAR").FirstChildElement("GEOMETRY").Element();
523  TiXmlElement* field = NULL;
524 
525  ASSERTL0(mesh, "Unable to find GEOMETRY tag in file.");
526 
527  /// Look for elements in ELEMENT block.
528  field = mesh->FirstChildElement("COMPOSITE");
529 
530  ASSERTL0(field, "Unable to find COMPOSITE tag in file.");
531 
532  int nextCompositeNumber = -1;
533 
534  /// All elements are of the form: "<C ID = "N"> ... </C>".
535  /// Read the ID field first.
536  TiXmlElement *composite = field->FirstChildElement("C");
537 
538  while (composite)
539  {
540  nextCompositeNumber++;
541 
542  int indx;
543  int err = composite->QueryIntAttribute("ID", &indx);
544  ASSERTL0(err == TIXML_SUCCESS, "Unable to read attribute ID.");
545 
546  // read and store label if they exist
547  string labelstr;
548  err = composite->QueryStringAttribute("LABEL", &labelstr);
549  if(err == TIXML_SUCCESS)
550  {
551  m_compositesLabels[indx] = labelstr;
552  }
553 
554  TiXmlNode* compositeChild = composite->FirstChild();
555  // This is primarily to skip comments that may be present.
556  // Comments appear as nodes just like elements.
557  // We are specifically looking for text in the body
558  // of the definition.
559  while(compositeChild && compositeChild->Type() != TiXmlNode::TINYXML_TEXT)
560  {
561  compositeChild = compositeChild->NextSibling();
562  }
563 
564  ASSERTL0(compositeChild, "Unable to read composite definition body.");
565  std::string compositeStr = compositeChild->ToText()->ValueStr();
566 
567  /// Parse out the element components corresponding to type of element.
568 
569  std::istringstream compositeDataStrm(compositeStr.c_str());
570 
571  try
572  {
573  bool first = true;
574  std::string prevCompositeElementStr;
575 
576  while (!compositeDataStrm.fail())
577  {
578  std::string compositeElementStr;
579  compositeDataStrm >> compositeElementStr;
580 
581  if (!compositeDataStrm.fail())
582  {
583  if (first)
584  {
585  first = false;
586 
587  Composite curVector(MemoryManager<GeometryVector>::AllocateSharedPtr());
588  m_meshComposites[indx] = curVector;
589  }
590 
591  if (compositeElementStr.length() > 0)
592  {
593  ResolveGeomRef(prevCompositeElementStr, compositeElementStr, m_meshComposites[indx]);
594  }
595  prevCompositeElementStr = compositeElementStr;
596  }
597  }
598  }
599  catch(...)
600  {
602  (std::string("Unable to read COMPOSITE data for composite: ") + compositeStr).c_str());
603  }
604 
605  /// Keep looking
606  composite = composite->NextSiblingElement("C");
607  }
608  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:185
std::map< int, std::string > m_compositesLabels
Definition: MeshGraph.h:431
boost::shared_ptr< GeometryVector > Composite
Definition: MeshGraph.h:114
void ResolveGeomRef(const std::string &prevToken, const std::string &token, Composite &composite)
void Nektar::SpatialDomains::MeshGraph2D::ReadEdges ( TiXmlDocument &  doc)
protected

We know we have it since we made it this far.

Look for elements in ELEMENT block.

All elements are of the form: "<E ID="#"> ... </E>", with ? being the element type. Read the ID field first.

Since all edge data is one big text block, we need to accumulate all TINYXML_TEXT data and then parse it. This approach effectively skips all comments or other node types since we only care about the edge list. We cannot handle missing edge numbers as we could with missing element numbers due to the text block format.

Now parse out the edges, three fields at a time.

Definition at line 99 of file MeshGraph2D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, ErrorUtil::efatal, Nektar::LibUtilities::CompressData::GetCompressString(), Nektar::SpatialDomains::MeshGraph::GetVertex(), Nektar::iterator, Nektar::SpatialDomains::MeshGraph::m_curvedEdges, Nektar::SpatialDomains::MeshGraph::m_segGeoms, Nektar::SpatialDomains::MeshGraph::m_spaceDimension, NEKERROR, and Nektar::LibUtilities::CompressData::ZlibDecodeFromBase64Str().

Referenced by ReadGeometry().

100  {
101  /// We know we have it since we made it this far.
102  TiXmlHandle docHandle(&doc);
103  TiXmlElement* mesh = docHandle.FirstChildElement("NEKTAR").FirstChildElement("GEOMETRY").Element();
104  TiXmlElement* field = NULL;
106 
107  /// Look for elements in ELEMENT block.
108  field = mesh->FirstChildElement("EDGE");
109 
110  ASSERTL0(field, "Unable to find EDGE tag in file.");
111 
112  string IsCompressed;
113  field->QueryStringAttribute("COMPRESSED",&IsCompressed);
114 
115  if(IsCompressed.size())
116  {
117  ASSERTL0(boost::iequals(IsCompressed,
119  "Compressed formats do not match. Expected :"
121  + " but got " + std::string(IsCompressed));
122 
123  // Extract the edge body
124  TiXmlNode* edgeChild = field->FirstChild();
125  ASSERTL0(edgeChild, "Unable to extract the data from "
126  "the compressed edge tag.");
127 
128  std::string edgeStr;
129  if (edgeChild->Type() == TiXmlNode::TINYXML_TEXT)
130  {
131  edgeStr += edgeChild->ToText()->ValueStr();
132  }
133 
134  std::vector<LibUtilities::MeshEdge> edgeData;
136  edgeData);
137  int indx;
138  for(int i = 0; i < edgeData.size(); ++i)
139  {
140  indx = edgeData[i].id;
141 
142  PointGeomSharedPtr vertices[2] =
143  {GetVertex(edgeData[i].v0), GetVertex(edgeData[i].v1)};
144  SegGeomSharedPtr edge;
145 
146  it = m_curvedEdges.find(indx);
147  if (it == m_curvedEdges.end())
148  {
150  indx, m_spaceDimension, vertices);
151  }
152  else
153  {
155  indx, m_spaceDimension, vertices,
156  it->second);
157  }
158  m_segGeoms[indx] = edge;
159  }
160  }
161  else
162  {
163  /// All elements are of the form: "<E ID="#"> ... </E>", with
164  /// ? being the element type.
165  /// Read the ID field first.
166  TiXmlElement *edge = field->FirstChildElement("E");
167 
168  /// Since all edge data is one big text block, we need to
169  /// accumulate all TINYXML_TEXT data and then parse it. This
170  /// approach effectively skips all comments or other node
171  /// types since we only care about the edge list. We
172  /// cannot handle missing edge numbers as we could with
173  /// missing element numbers due to the text block format.
174  std::string edgeStr;
175  int indx;
176 
177  while(edge)
178  {
179  int err = edge->QueryIntAttribute("ID",&indx);
180  ASSERTL0(err == TIXML_SUCCESS, "Unable to read edge attribute ID.");
181 
182  TiXmlNode *child = edge->FirstChild();
183  edgeStr.clear();
184  if (child->Type() == TiXmlNode::TINYXML_TEXT)
185  {
186  edgeStr += child->ToText()->ValueStr();
187  }
188 
189  /// Now parse out the edges, three fields at a time.
190  int vertex1, vertex2;
191  std::istringstream edgeDataStrm(edgeStr.c_str());
192 
193  try
194  {
195  while (!edgeDataStrm.fail())
196  {
197  edgeDataStrm >> vertex1 >> vertex2;
198 
199  // Must check after the read because we may be
200  // at the end and not know it. If we are at
201  // the end we will add a duplicate of the last
202  // entry if we don't check here.
203  if (!edgeDataStrm.fail())
204  {
205  PointGeomSharedPtr vertices[2] = {GetVertex(vertex1), GetVertex(vertex2)};
206 
207  SegGeomSharedPtr edge;
208 
209  it = m_curvedEdges.find(indx);
210 
211  if(it == m_curvedEdges.end())
212  {
214  edge->SetGlobalID(indx); // Set global mesh id
215  }
216  else
217  {
218  edge = MemoryManager<SegGeom>::AllocateSharedPtr(indx, m_spaceDimension, vertices, it->second);
219  edge->SetGlobalID(indx); //Set global mesh id
220  }
221 
222  m_segGeoms[indx] = edge;
223  }
224  }
225  }
226  catch(...)
227  {
228  NEKERROR(ErrorUtil::efatal, (std::string("Unable to read edge data: ") + edgeStr).c_str());
229  }
230 
231  edge = edge->NextSiblingElement("E");
232  }
233  }
234  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:185
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
PointGeomSharedPtr GetVertex(int id)
Definition: MeshGraph.h:587
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:60
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:60
int ZlibDecodeFromBase64Str(std::string &in64, std::vector< T > &out)
Definition: CompressData.h:243
void Nektar::SpatialDomains::MeshGraph2D::ReadElements ( TiXmlDocument &  doc)
protected

We know we have it since we made it this far.

Look for elements in ELEMENT block.

All elements are of the form: "<? ID="#"> ... </?>", with ? being the element type.

See if this face has curves.

Create a TriGeom to hold the new definition.

See if this face has curves.

Create a QuadGeom to hold the new definition.

Read id attribute.

Read text element description.

Parse out the element components corresponding to type of element.

Create a TriGeom to hold the new definition.

Create a QuadGeom to hold the new definition.

Keep looking

Definition at line 236 of file MeshGraph2D.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, ErrorUtil::efatal, Nektar::LibUtilities::CompressData::GetCompressString(), Nektar::SpatialDomains::SegGeom::GetEdgeOrientation(), GetSegGeom(), Nektar::iterator, Nektar::SpatialDomains::TriGeom::kNedges, Nektar::SpatialDomains::QuadGeom::kNedges, Nektar::SpatialDomains::MeshGraph::m_curvedEdges, Nektar::SpatialDomains::MeshGraph::m_curvedFaces, Nektar::SpatialDomains::MeshGraph::m_quadGeoms, Nektar::SpatialDomains::MeshGraph::m_triGeoms, NEKERROR, and Nektar::LibUtilities::CompressData::ZlibDecodeFromBase64Str().

Referenced by ReadGeometry().

237  {
238  /// We know we have it since we made it this far.
239  TiXmlHandle docHandle(&doc);
240  TiXmlElement* mesh = docHandle.FirstChildElement("NEKTAR").FirstChildElement("GEOMETRY").Element();
241  TiXmlElement* field = NULL;
242 
243  /// Look for elements in ELEMENT block.
244  field = mesh->FirstChildElement("ELEMENT");
245 
246  ASSERTL0(field, "Unable to find ELEMENT tag in file.");
247 
248  // Set up curve map for curved elements on an embedded manifold.
250 
251  /// All elements are of the form: "<? ID="#"> ... </?>", with
252  /// ? being the element type.
253 
254  TiXmlElement *element = field->FirstChildElement();
255 
256  while (element)
257  {
258  std::string elementType(element->ValueStr());
259 
260  ASSERTL0(elementType == "Q" || elementType == "T",
261  (std::string("Unknown 2D element type: ") + elementType).c_str());
262 
263  string IsCompressed;
264  element->QueryStringAttribute("COMPRESSED",&IsCompressed);
265 
266  if(IsCompressed.size())
267  {
268  ASSERTL0(boost::iequals(IsCompressed,
270  "Compressed formats do not match. Expected :"
272  + " but got " + std::string(IsCompressed));
273 
274  // Extract the face body
275  TiXmlNode* faceChild = element->FirstChild();
276  ASSERTL0(faceChild, "Unable to extract the data from "
277  "the compressed face tag.");
278 
279  std::string faceStr;
280  if (faceChild->Type() == TiXmlNode::TINYXML_TEXT)
281  {
282  faceStr += faceChild->ToText()->ValueStr();
283  }
284 
285  int indx;
286  if(elementType == "T")
287  {
288  std::vector<LibUtilities::MeshTri> faceData;
290  faceStr, faceData);
291 
292  for(int i = 0; i < faceData.size(); ++i)
293  {
294  indx = faceData[i].id;
295 
296  /// See if this face has curves.
297  it = m_curvedFaces.find(indx);
298 
299  /// Create a TriGeom to hold the new definition.
301  {
302  GetSegGeom(faceData[i].e[0]),
303  GetSegGeom(faceData[i].e[1]),
304  GetSegGeom(faceData[i].e[2])
305  };
306 
308  {
309  SegGeom::GetEdgeOrientation(*edges[0], *edges[1]),
310  SegGeom::GetEdgeOrientation(*edges[1], *edges[2]),
311  SegGeom::GetEdgeOrientation(*edges[2], *edges[0])
312  };
313 
314  TriGeomSharedPtr trigeom;
315  if (it == m_curvedFaces.end())
316  {
317  trigeom =
319  indx, edges, edgeorient);
320  }
321  else
322  {
323  trigeom =
325  indx, edges, edgeorient,
326  it->second);
327  }
328  trigeom->SetGlobalID(indx);
329  m_triGeoms[indx] = trigeom;
330  }
331  }
332  else if (elementType == "Q")
333  {
334  std::vector<LibUtilities::MeshQuad> faceData;
336  faceStr,faceData);
337 
338  for(int i = 0; i < faceData.size(); ++i)
339  {
340  indx = faceData[i].id;
341 
342  /// See if this face has curves.
343  it = m_curvedFaces.find(indx);
344 
345  /// Create a QuadGeom to hold the new definition.
347  {GetSegGeom(faceData[i].e[0]),
348  GetSegGeom(faceData[i].e[1]),
349  GetSegGeom(faceData[i].e[2]),
350  GetSegGeom(faceData[i].e[3])};
351 
353  {
354  SegGeom::GetEdgeOrientation(*edges[0], *edges[1]),
355  SegGeom::GetEdgeOrientation(*edges[1], *edges[2]),
356  SegGeom::GetEdgeOrientation(*edges[2], *edges[3]),
357  SegGeom::GetEdgeOrientation(*edges[3], *edges[0])
358  };
359 
360  QuadGeomSharedPtr quadgeom;
361  if (it == m_curvedEdges.end())
362  {
363  quadgeom =
365  indx, edges, edgeorient);
366  }
367  else
368  {
369  quadgeom =
371  indx, edges, edgeorient,
372  it->second);
373  }
374  quadgeom->SetGlobalID(indx);
375  m_quadGeoms[indx] = quadgeom;
376  }
377  }
378  }
379  else
380  {
381  /// Read id attribute.
382  int indx;
383  int err = element->QueryIntAttribute("ID", &indx);
384  ASSERTL0(err == TIXML_SUCCESS, "Unable to read element attribute ID.");
385 
386  it = m_curvedFaces.find(indx);
387 
388  /// Read text element description.
389  TiXmlNode* elementChild = element->FirstChild();
390  std::string elementStr;
391  while(elementChild)
392  {
393  if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
394  {
395  elementStr += elementChild->ToText()->ValueStr();
396  }
397  elementChild = elementChild->NextSibling();
398  }
399 
400  ASSERTL0(!elementStr.empty(), "Unable to read element description body.");
401 
402  /// Parse out the element components corresponding to type of element.
403  if (elementType == "T")
404  {
405  // Read three edge numbers
406  int edge1, edge2, edge3;
407  std::istringstream elementDataStrm(elementStr.c_str());
408 
409  try
410  {
411  elementDataStrm >> edge1;
412  elementDataStrm >> edge2;
413  elementDataStrm >> edge3;
414 
415  ASSERTL0(!elementDataStrm.fail(), (std::string("Unable to read element data for TRIANGLE: ") + elementStr).c_str());
416 
417  /// Create a TriGeom to hold the new definition.
419  {
420  GetSegGeom(edge1),
421  GetSegGeom(edge2),
422  GetSegGeom(edge3)
423  };
424 
426  {
427  SegGeom::GetEdgeOrientation(*edges[0], *edges[1]),
428  SegGeom::GetEdgeOrientation(*edges[1], *edges[2]),
429  SegGeom::GetEdgeOrientation(*edges[2], *edges[0])
430  };
431 
432  TriGeomSharedPtr trigeom;
433  if (it == m_curvedFaces.end())
434  {
435  trigeom = MemoryManager<TriGeom>
437  edges,
438  edgeorient);
439  }
440  else
441  {
442  trigeom = MemoryManager<TriGeom>
444  edges,
445  edgeorient,
446  it->second);
447  }
448  trigeom->SetGlobalID(indx);
449 
450  m_triGeoms[indx] = trigeom;
451  }
452  catch(...)
453  {
454  NEKERROR(ErrorUtil::efatal, (std::string("Unable to read element data for TRIANGLE: ") + elementStr).c_str());
455  }
456  }
457  else if (elementType == "Q")
458  {
459  // Read four edge numbers
460  int edge1, edge2, edge3, edge4;
461  std::istringstream elementDataStrm(elementStr.c_str());
462 
463  try
464  {
465  elementDataStrm >> edge1;
466  elementDataStrm >> edge2;
467  elementDataStrm >> edge3;
468  elementDataStrm >> edge4;
469 
470  ASSERTL0(!elementDataStrm.fail(), (std::string("Unable to read element data for QUAD: ") + elementStr).c_str());
471 
472  /// Create a QuadGeom to hold the new definition.
474  {GetSegGeom(edge1),GetSegGeom(edge2),
475  GetSegGeom(edge3),GetSegGeom(edge4)};
476 
478  {
479  SegGeom::GetEdgeOrientation(*edges[0], *edges[1]),
480  SegGeom::GetEdgeOrientation(*edges[1], *edges[2]),
481  SegGeom::GetEdgeOrientation(*edges[2], *edges[3]),
482  SegGeom::GetEdgeOrientation(*edges[3], *edges[0])
483  };
484 
485  QuadGeomSharedPtr quadgeom;
486  if (it == m_curvedFaces.end())
487  {
488  quadgeom = MemoryManager<QuadGeom>
490  edges,
491  edgeorient);
492  }
493  else
494  {
495  quadgeom = MemoryManager<QuadGeom>
497  edges,
498  edgeorient,
499  it->second);
500  }
501  quadgeom->SetGlobalID(indx);
502 
503  m_quadGeoms[indx] = quadgeom;
504 
505  }
506  catch(...)
507  {
508  NEKERROR(ErrorUtil::efatal,(std::string("Unable to read element data for QUAD: ") + elementStr).c_str());
509  }
510  }
511  }
512  /// Keep looking
513  element = element->NextSiblingElement();
514  }
515  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:185
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< QuadGeom > QuadGeomSharedPtr
Definition: QuadGeom.h:54
static StdRegions::Orientation GetEdgeOrientation(const SegGeom &edge1, const SegGeom &edge2)
Get the orientation of edge1.
Definition: SegGeom.cpp:293
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:60
static const int kNedges
Get the orientation of face1.
Definition: TriGeom.h:98
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
boost::shared_ptr< TriGeom > TriGeomSharedPtr
Definition: TriGeom.h:58
int ZlibDecodeFromBase64Str(std::string &in64, std::vector< T > &out)
Definition: CompressData.h:243
SegGeomSharedPtr GetSegGeom(int eID)
void Nektar::SpatialDomains::MeshGraph2D::ReadGeometry ( const std::string &  infilename)
virtual

Read will read the meshgraph vertices given a filename.

Reimplemented from Nektar::SpatialDomains::MeshGraph.

Definition at line 64 of file MeshGraph2D.cpp.

References ASSERTL0.

Referenced by MeshGraph2D().

65  {
66  TiXmlDocument doc(infilename);
67  bool loadOkay = doc.LoadFile();
68 
69  std::stringstream errstr;
70  errstr << "Unable to load file: " << infilename << "\n";
71  errstr << doc.ErrorDesc() << " (Line " << doc.ErrorRow()
72  << ", Column " << doc.ErrorCol() << ")";
73  ASSERTL0(loadOkay, errstr.str());
74 
75  ReadGeometry(doc);
76  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
void ReadGeometry(const std::string &infilename)
Read will read the meshgraph vertices given a filename.
Definition: MeshGraph2D.cpp:64
void Nektar::SpatialDomains::MeshGraph2D::ReadGeometry ( TiXmlDocument &  doc)
virtual

Read will read the meshgraph vertices given a TiXmlDocument.

Look for all geometry related data in GEOMETRY block.

Error value returned by TinyXML.

Reimplemented from Nektar::SpatialDomains::MeshGraph.

Definition at line 79 of file MeshGraph2D.cpp.

References ASSERTL0, ReadComposites(), Nektar::SpatialDomains::MeshGraph::ReadCurves(), Nektar::SpatialDomains::MeshGraph::ReadDomain(), ReadEdges(), ReadElements(), and Nektar::SpatialDomains::MeshGraph::ReadGeometry().

80  {
81  // Read mesh first
83  TiXmlHandle docHandle(&doc);
84 
85  TiXmlElement* mesh = NULL;
86 
87  /// Look for all geometry related data in GEOMETRY block.
88  mesh = docHandle.FirstChildElement("NEKTAR").FirstChildElement("GEOMETRY").Element();
89 
90  ASSERTL0(mesh, "Unable to find GEOMETRY tag in file.");
91 
92  ReadCurves(doc);
93  ReadEdges(doc);
94  ReadElements(doc);
95  ReadComposites(doc);
96  ReadDomain(doc);
97  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
void ReadEdges(TiXmlDocument &doc)
Definition: MeshGraph2D.cpp:99
void ReadComposites(TiXmlDocument &doc)
void ReadCurves(TiXmlDocument &doc)
Definition: MeshGraph.cpp:1160
void ReadElements(TiXmlDocument &doc)
virtual void ReadGeometry(const std::string &infilename)
Read will read the meshgraph vertices given a filename.
Definition: MeshGraph.cpp:232
void ReadDomain(TiXmlDocument &doc)
Definition: MeshGraph.cpp:1066
void Nektar::SpatialDomains::MeshGraph2D::ResolveGeomRef ( const std::string &  prevToken,
const std::string &  token,
Composite composite 
)
protected

Definition at line 626 of file MeshGraph2D.cpp.

References ASSERTL0, Nektar::SpatialDomains::MeshGraph::CheckRange(), ErrorUtil::efatal, ErrorUtil::ewarning, Nektar::ParseUtils::GenerateSeqVector(), Nektar::iterator, Nektar::SpatialDomains::MeshGraph::m_quadGeoms, Nektar::SpatialDomains::MeshGraph::m_segGeoms, Nektar::SpatialDomains::MeshGraph::m_triGeoms, Nektar::SpatialDomains::MeshGraph::m_vertSet, and NEKERROR.

Referenced by ReadComposites().

628  {
629  try
630  {
631  std::istringstream tokenStream(token);
632  std::istringstream prevTokenStream(prevToken);
633 
634  char type;
635  char prevType;
636 
637  tokenStream >> type;
638 
639  std::string::size_type indxBeg = token.find_first_of('[') + 1;
640  std::string::size_type indxEnd = token.find_last_of(']') - 1;
641 
642  ASSERTL0(indxBeg <= indxEnd, (std::string("Error reading index definition:") + token).c_str());
643 
644  std::string indxStr = token.substr(indxBeg, indxEnd - indxBeg + 1);
645  std::vector<unsigned int> seqVector;
647 
648  bool err = ParseUtils::GenerateSeqVector(indxStr.c_str(), seqVector);
649 
650  ASSERTL0(err, (std::string("Error reading composite elements: ") + indxStr).c_str());
651 
652  prevTokenStream >> prevType;
653 
654  // All composites must be of the same dimension.
655  bool validSequence = (prevToken.empty() || // No previous, then current is just fine.
656  (type == 'V' && prevType == 'V') ||
657  (type == 'E' && prevType == 'E') ||
658  ((type == 'T' || type == 'Q') &&
659  (prevType == 'T' || prevType == 'Q')));
660 
661  ASSERTL0(validSequence, (std::string("Invalid combination of composite items: ")
662  + type + " and " + prevType + ".").c_str());
663 
664 
665  switch(type)
666  {
667  case 'E': // Edge
668  for (seqIter = seqVector.begin(); seqIter != seqVector.end(); ++seqIter)
669  {
670  if (m_segGeoms.find(*seqIter) == m_segGeoms.end())
671  {
672  char errStr[16] = "";
673  ::sprintf(errStr, "%d", *seqIter);
674  NEKERROR(ErrorUtil::ewarning, (std::string("Unknown edge index: ") + errStr).c_str());
675  }
676  else
677  {
678  composite->push_back(m_segGeoms[*seqIter]);
679  }
680  }
681  break;
682 
683  case 'T': // Triangle
684  {
685  for (seqIter = seqVector.begin(); seqIter != seqVector.end(); ++seqIter)
686  {
687  if (m_triGeoms.count(*seqIter) == 0 )
688  {
689  char errStr[16] = "";
690  ::sprintf(errStr, "%d", *seqIter);
691  NEKERROR(ErrorUtil::ewarning, (std::string("Unknown triangle index: ") + errStr).c_str());
692  }
693  else
694  {
695  if(CheckRange(*m_triGeoms[*seqIter]))
696  {
697  composite->push_back(m_triGeoms[*seqIter]);
698  }
699  }
700  }
701  }
702  break;
703 
704  case 'Q': // Quad
705  {
706  for (seqIter = seqVector.begin(); seqIter != seqVector.end(); ++seqIter)
707  {
708  if (m_quadGeoms.count(*seqIter) == 0)
709  {
710  char errStr[16] = "";
711  ::sprintf(errStr, "%d", *seqIter);
712  NEKERROR(ErrorUtil::ewarning, (std::string("Unknown quad index: ") + errStr +std::string(" in Composite section")).c_str());
713  }
714  else
715  {
716  if(CheckRange(*m_quadGeoms[*seqIter]))
717  {
718  composite->push_back(m_quadGeoms[*seqIter]);
719  }
720  }
721  }
722  }
723  break;
724 
725  case 'V': // Vertex
726  for (seqIter = seqVector.begin(); seqIter != seqVector.end(); ++seqIter)
727  {
728  if (*seqIter >= m_vertSet.size())
729  {
730  char errStr[16] = "";
731  ::sprintf(errStr, "%d", *seqIter);
732  NEKERROR(ErrorUtil::ewarning, (std::string("Unknown vertex index: ") + errStr).c_str());
733  }
734  else
735  {
736  composite->push_back(m_vertSet[*seqIter]);
737  }
738  }
739  break;
740 
741  default:
742  NEKERROR(ErrorUtil::efatal, (std::string("Unrecognized composite token: ") + token).c_str());
743  }
744  }
745  catch(...)
746  {
747  NEKERROR(ErrorUtil::efatal, (std::string("Problem processing composite token: ") + token).c_str());
748  }
749 
750  return;
751  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:185
static bool GenerateSeqVector(const char *const str, std::vector< unsigned int > &vec)
Definition: ParseUtils.hpp:79
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
bool CheckRange(Geometry2D &geom)
Check if goemetry is in range definition if activated.
Definition: MeshGraph.cpp:2002