Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 49 of file MeshGraph2D.cpp.

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

Definition at line 57 of file MeshGraph2D.cpp.

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

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

Definition at line 53 of file MeshGraph2D.cpp.

54  {
55  }

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:250
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 822 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().

823  {
825  // Perhaps, a check should be done here to ensure that
826  // in case elements->size!=1, all elements to which
827  // the edge belongs have the same type and order of
828  // expansion such that no confusion can arise.
829  ExpansionShPtr expansion = GetExpansion((*elements)[0]->m_Element, variable);
830 
831  int edge_id = (*elements)[0]->m_EdgeIndx;
832 
833  if((*elements)[0]->m_Element->GetShapeType() == LibUtilities::eTriangle)
834  {
835  edge_id = (edge_id)? 1:0;
836  }
837  else
838  {
839  edge_id = edge_id%2;
840  }
841 
842  int nummodes = expansion->m_basisKeyVector[edge_id].GetNumModes();
843  int numpoints = expansion->m_basisKeyVector[edge_id].GetNumPoints();
844 
845  if((*elements)[0]->m_Element->GetShapeType() == LibUtilities::eTriangle)
846  {
847  // Use edge 0 to define basis of order relevant to edge
848  switch(expansion->m_basisKeyVector[edge_id].GetBasisType())
849  {
851  {
852  switch(expansion->m_basisKeyVector[edge_id].GetPointsType())
853  {
855  {
856  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
857  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
858  }
859  break;
860 
861  default:
862  ASSERTL0(false,"Unexpected points distribution");
863 
864  // It doesn't matter what we return
865  // here since the ASSERT will stop
866  // execution. Just return something
867  // to prevent warnings messages.
868  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
869  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
870  break;
871  }
872  }
873  break;
874  case LibUtilities::eOrtho_B: // Assume this is called from nodal triangular basis
875  {
876  switch(expansion->m_basisKeyVector[edge_id].GetPointsType())
877  {
879  {
880  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
881  return LibUtilities::BasisKey(LibUtilities::eGLL_Lagrange,nummodes,pkey);
882  }
883  break;
884 
885  default:
886  ASSERTL0(false,"Unexpected points distribution");
887 
888  // It doesn't matter what we return
889  // here since the ASSERT will stop
890  // execution. Just return something
891  // to prevent warnings messages.
892  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
893  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
894  break;
895  }
896  }
897  break;
899  {
900  switch(expansion->m_basisKeyVector[edge_id].GetPointsType())
901  {
903  {
904  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
905  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
906  }
907  break;
909  {
910  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
911  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
912  }
913  break;
914 
915  default:
916  ASSERTL0(false,"Unexpected points distribution");
917 
918  // It doesn't matter what we return
919  // here since the ASSERT will stop
920  // execution. Just return something
921  // to prevent warnings messages.
922  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
923  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
924  break;
925  }
926  }
927  break;
929  {
930  switch(expansion->m_basisKeyVector[edge_id].GetPointsType())
931  {
933  {
934  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
935  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
936  }
937  break;
938  default:
939  ASSERTL0(false,"Unexpected points distribution");
940  // It doesn't matter what we return here
941  // since the ASSERT will stop execution.
942  // Just return something to prevent
943  // warnings messages.
944  const LibUtilities::PointsKey pkey(numpoints,LibUtilities::eGaussLobattoLegendre);
945  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
946  break;
947  }
948  }
949  break;
950 
951  default:
952  ASSERTL0(false,"Unexpected basis distribution");
953  // It doesn't matter what we return here since the
954  // ASSERT will stop execution. Just return
955  // something to prevent warnings messages.
956  const LibUtilities::PointsKey pkey(numpoints+1,LibUtilities::eGaussLobattoLegendre);
957  return LibUtilities::BasisKey(expansion->m_basisKeyVector[0].GetBasisType(),nummodes,pkey);
958  }
959  }
960  else
961  {
962  // Quadrilateral
963  const LibUtilities::PointsKey pkey(numpoints,expansion->m_basisKeyVector[edge_id].GetPointsType());
964  return LibUtilities::BasisKey(expansion->m_basisKeyVector[edge_id].GetBasisType(),nummodes,pkey);
965  }
966 
967  ASSERTL0(false, "Unable to determine edge points type.");
969  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
Principle Modified Functions .
Definition: BasisType.h:49
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:59
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:2352
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:52
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:250
ElementEdgeVectorSharedPtr Nektar::SpatialDomains::MeshGraph2D::GetElementsFromEdge ( SegGeomSharedPtr  edge)

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

Definition at line 766 of file MeshGraph2D.cpp.

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

Referenced by GetEdgeBasisKey(), and GetElementsFromEdge().

767  {
768  // Search tris and quads
769  // Need to iterate through vectors because there may be multiple
770  // occurrences.
771  ElementEdgeSharedPtr elementEdge;
772  //TriGeomVectorIter triIter;
773 
775 
776  CompositeMapIter compIter;
777  TriGeomSharedPtr triGeomShPtr;
778  QuadGeomSharedPtr quadGeomShPtr;
779 
780  GeometryVectorIter geomIter;
781 
782  for(int d = 0; d < m_domain.size(); ++d)
783  {
784  for (compIter = m_domain[d].begin(); compIter != m_domain[d].end(); ++compIter)
785  {
786  for (geomIter = (compIter->second)->begin(); geomIter != (compIter->second)->end(); ++geomIter)
787  {
788  triGeomShPtr = boost::dynamic_pointer_cast<TriGeom>(*geomIter);
789  quadGeomShPtr = boost::dynamic_pointer_cast<QuadGeom>(*geomIter);
790 
791  if (triGeomShPtr || quadGeomShPtr)
792  {
793  int edgeNum;
794  if (triGeomShPtr)
795  {
796  if ((edgeNum = triGeomShPtr->WhichEdge(edge)) > -1)
797  {
799  elementEdge->m_Element = triGeomShPtr;
800  elementEdge->m_EdgeIndx = edgeNum;
801  returnval->push_back(elementEdge);
802  }
803  }
804  else if (quadGeomShPtr)
805  {
806  if ((edgeNum = quadGeomShPtr->WhichEdge(edge)) > -1)
807  {
809  elementEdge->m_Element = quadGeomShPtr;
810  elementEdge->m_EdgeIndx = edgeNum;
811  returnval->push_back(elementEdge);
812  }
813  }
814  }
815  }
816  }
817  }
818 
819  return returnval;
820  }
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 754 of file MeshGraph2D.cpp.

References ASSERTL0, and GetElementsFromEdge().

755  {
756  SegGeomSharedPtr Sedge;
757 
758  if(!(Sedge = boost::dynamic_pointer_cast<SegGeom>(edge)))
759  {
760  ASSERTL0(false,"Dynamics cast failed");
761 
762  }
763  return GetElementsFromEdge(Sedge);
764 
765  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
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:250
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:191
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 612 of file MeshGraph2D.cpp.

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

Referenced by ReadElements().

613  {
614  SegGeomSharedPtr returnval;
615  SegGeomMap::iterator x = m_segGeoms.find(eID);
616  ASSERTL0(x != m_segGeoms.end(), "Segment not found.");
617  return x->second;
618  };
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
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:250
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 518 of file MeshGraph2D.cpp.

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

Referenced by ReadGeometry().

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

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

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

References ASSERTL0.

Referenced by MeshGraph2D().

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

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

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

Definition at line 627 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().

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