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

#include <MeshGraph1D.h>

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

Public Member Functions

 MeshGraph1D ()
 
 MeshGraph1D (const LibUtilities::SessionReaderSharedPtr &pSession, const DomainRangeShPtr &rng=NullDomainRangeShPtr)
 
virtual ~MeshGraph1D ()
 
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...
 
void ReadElements (TiXmlDocument &doc)
 
void ReadComposites (TiXmlDocument &doc)
 
void ResolveGeomRef (const std::string &prevToken, const std::string &token, Composite &composite)
 
int GetCoordim (void)
 
const SegGeomMapGetSeggeoms (void) const
 
int GetVidFromElmt (const int vert, const int elmt) const
 
- 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
 

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 Member Functions inherited from Nektar::SpatialDomains::MeshGraph
ExpansionMapShPtr SetUpExpansionMap (void)
 
- 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 47 of file MeshGraph1D.h.

Constructor & Destructor Documentation

Nektar::SpatialDomains::MeshGraph1D::MeshGraph1D ( )

Definition at line 48 of file MeshGraph1D.cpp.

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

Definition at line 52 of file MeshGraph1D.cpp.

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

54  : MeshGraph(pSession,rng)
55  {
56  ReadGeometry (pSession->GetDocument());
57  ReadExpansions(pSession->GetDocument());
58  }
void ReadGeometry(const std::string &infilename)
Read will read the meshgraph vertices given a filename.
Definition: MeshGraph1D.cpp:65
void ReadExpansions(const std::string &infilename)
Read the expansions given the XML file path.
Definition: MeshGraph.cpp:582
Nektar::SpatialDomains::MeshGraph1D::~MeshGraph1D ( )
virtual

Definition at line 60 of file MeshGraph1D.cpp.

61  {
62  }

Member Function Documentation

int Nektar::SpatialDomains::MeshGraph1D::GetCoordim ( void  )
inline

Definition at line 62 of file MeshGraph1D.h.

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

63  {
64  return GetSpaceDimension();
65  }
int GetSpaceDimension() const
Dimension of the space (can be a 1D curve in 3D space).
Definition: MeshGraph.h:457
const SegGeomMap& Nektar::SpatialDomains::MeshGraph1D::GetSeggeoms ( void  ) const
inline

Definition at line 67 of file MeshGraph1D.h.

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

68  {
69  return m_segGeoms;
70  }
int Nektar::SpatialDomains::MeshGraph1D::GetVidFromElmt ( const int  vert,
const int  elmt 
) const
inline

Definition at line 72 of file MeshGraph1D.h.

References ASSERTL2, and Nektar::SpatialDomains::MeshGraph::m_segGeoms.

73  {
74  ASSERTL2((elmt >=0)&&(elmt < m_segGeoms.size()),
75  "eid is out of range");
76 
77  //return m_segGeoms[elmt]->GetVid(vert);
78  return m_segGeoms.find(elmt)->second->GetVid(vert);
79  }
#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::MeshGraph1D::ReadComposites ( TiXmlDocument &  doc)

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.

Parse out the element components corresponding to type of element.

Keep looking for additional composite definitions.

Definition at line 231 of file MeshGraph1D.cpp.

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

Referenced by ReadGeometry().

232  {
233  TiXmlHandle docHandle(&doc);
234 
235  /// We know we have it since we made it this far.
236  TiXmlElement* mesh = docHandle.FirstChildElement("NEKTAR").FirstChildElement("GEOMETRY").Element();
237  TiXmlElement* field = NULL;
238 
239  ASSERTL0(mesh, "Unable to find GEOMETRY tag in file.");
240 
241  /// Look for elements in ELEMENT block.
242  field = mesh->FirstChildElement("COMPOSITE");
243 
244  ASSERTL0(field, "Unable to find COMPOSITE tag in file.");
245 
246  TiXmlElement *node = field->FirstChildElement("C");
247 
248  // Sequential counter for the composite numbers.
249  int nextCompositeNumber = -1;
250 
251  while (node)
252  {
253  /// All elements are of the form: "<? ID="#"> ... </?>", with
254  /// ? being the element type.
255 
256  nextCompositeNumber++;
257 
258  int indx;
259  int err = node->QueryIntAttribute("ID", &indx);
260  ASSERTL0(err == TIXML_SUCCESS, "Unable to read attribute ID.");
261  //ASSERTL0(indx == nextCompositeNumber, "Composite IDs must begin with zero and be sequential.");
262 
263  TiXmlNode* compositeChild = node->FirstChild();
264  // This is primarily to skip comments that may be present.
265  // Comments appear as nodes just like elements.
266  // We are specifically looking for text in the body
267  // of the definition.
268  while(compositeChild && compositeChild->Type() != TiXmlNode::TINYXML_TEXT)
269  {
270  compositeChild = compositeChild->NextSibling();
271  }
272 
273  ASSERTL0(compositeChild, "Unable to read composite definition body.");
274  std::string compositeStr = compositeChild->ToText()->ValueStr();
275 
276  /// Parse out the element components corresponding to type of element.
277 
278  std::istringstream compositeDataStrm(compositeStr.c_str());
279 
280  try
281  {
282  bool first = true;
283  std::string prevCompositeElementStr;
284 
285  while (!compositeDataStrm.fail())
286  {
287  std::string compositeElementStr;
288  compositeDataStrm >> compositeElementStr;
289 
290  if (!compositeDataStrm.fail())
291  {
292  if (first)
293  {
294  first = false;
295 
296  Composite curVector = MemoryManager<std::vector<GeometrySharedPtr> >::AllocateSharedPtr();
297  m_meshComposites[indx] = curVector;
298  }
299 
300  if (compositeElementStr.length() > 0)
301  {
302  ResolveGeomRef(prevCompositeElementStr, compositeElementStr, m_meshComposites[indx]);
303  }
304  prevCompositeElementStr = compositeElementStr;
305  }
306  }
307  }
308  catch(...)
309  {
311  (std::string("Unable to read COMPOSITE data for composite: ") + compositeStr).c_str());
312  }
313 
314  /// Keep looking for additional composite definitions.
315  node = node->NextSiblingElement("C");
316  }
317 
318  ASSERTL0(nextCompositeNumber >= 0, "At least one composite must be specified.");
319  }
#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
void ResolveGeomRef(const std::string &prevToken, const std::string &token, Composite &composite)
boost::shared_ptr< GeometryVector > Composite
Definition: MeshGraph.h:114
void Nektar::SpatialDomains::MeshGraph1D::ReadElements ( TiXmlDocument &  doc)

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

Look for elements in ELEMENT block.

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

See if this face has curves.

Parse out the element components corresponding to type of element. Read two vertex numbers

Keep looking for additional segments

Definition at line 99 of file MeshGraph1D.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;
105 
106  /// Look for elements in ELEMENT block.
107  field = mesh->FirstChildElement("ELEMENT");
108 
109  ASSERTL0(field, "Unable to find ELEMENT tag in file.");
110 
111  /// All elements are of the form: "<S ID = n> ... </S>", with
112  /// ? being the element type.
113 
114  TiXmlElement *segment = field->FirstChildElement("S");
116 
117  while (segment)
118  {
119  string IsCompressed;
120  segment->QueryStringAttribute("COMPRESSED",&IsCompressed);
121 
122  if(IsCompressed.size())
123  {
124  ASSERTL0(boost::iequals(IsCompressed,
126  "Compressed formats do not match. Expected :"
128  + " but got " + std::string(IsCompressed));
129 
130  // Extract the face body
131  TiXmlNode* child = segment->FirstChild();
132  ASSERTL0(child, "Unable to extract the data from "
133  "the compressed face tag.");
134 
135  std::string str;
136  if (child->Type() == TiXmlNode::TINYXML_TEXT)
137  {
138  str += child->ToText()->ValueStr();
139  }
140 
141  int indx;
142 
143  std::vector<LibUtilities::MeshEdge> data;
145  data);
146 
147  for(int i = 0; i < data.size(); ++i)
148  {
149  indx = data[i].id;
150 
151  /// See if this face has curves.
152  it = m_curvedEdges.find(indx);
153 
154  PointGeomSharedPtr vertices[2] = {
155  GetVertex(data[i].v0), GetVertex(data[i].v1)};
156  SegGeomSharedPtr seg;
157 
158  if (it == m_curvedEdges.end())
159  {
161  indx, m_spaceDimension, vertices);
162  seg->SetGlobalID(indx); // Set global mesh id
163  }
164  else
165  {
167  indx, m_spaceDimension,
168  vertices, it->second);
169  seg->SetGlobalID(indx); //Set global mesh id
170  }
171  seg->SetGlobalID(indx);
172  m_segGeoms[indx] = seg;
173  }
174  }
175  else
176  {
177 
178  int indx;
179  int err = segment->QueryIntAttribute("ID", &indx);
180  ASSERTL0(err == TIXML_SUCCESS, "Unable to read element attribute ID.");
181 
182  TiXmlNode* elementChild = segment->FirstChild();
183  while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
184  {
185  elementChild = elementChild->NextSibling();
186  }
187 
188  ASSERTL0(elementChild, "Unable to read element description body.");
189  std::string elementStr = elementChild->ToText()->ValueStr();
190 
191  /// Parse out the element components corresponding to type of element.
192  /// Read two vertex numbers
193  int vertex1, vertex2;
194  std::istringstream elementDataStrm(elementStr.c_str());
195 
196  try
197  {
198  elementDataStrm >> vertex1;
199  elementDataStrm >> vertex2;
200 
201  ASSERTL0(!elementDataStrm.fail(), (std::string("Unable to read element data for SEGMENT: ") + elementStr).c_str());
202 
203  PointGeomSharedPtr vertices[2] = {GetVertex(vertex1), GetVertex(vertex2)};
204  SegGeomSharedPtr seg;
205  it = m_curvedEdges.find(indx);
206 
207  if (it == m_curvedEdges.end())
208  {
210  seg->SetGlobalID(indx); // Set global mesh id
211  }
212  else
213  {
214  seg = MemoryManager<SegGeom>::AllocateSharedPtr(indx, m_spaceDimension, vertices, it->second);
215  seg->SetGlobalID(indx); //Set global mesh id
216  }
217  seg->SetGlobalID(indx);
218  m_segGeoms[indx] = seg;
219  }
220  catch(...)
221  {
223  (std::string("Unable to read element data for segment: ") + elementStr).c_str());
224  }
225  }
226  /// Keep looking for additional segments
227  segment = segment->NextSiblingElement("S");
228  }
229  }
#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::MeshGraph1D::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 MeshGraph1D.cpp.

References ASSERTL0.

Referenced by MeshGraph1D().

66  {
67  TiXmlDocument doc(infilename);
68 
69  bool loadOkay = doc.LoadFile();
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:188
void ReadGeometry(const std::string &infilename)
Read will read the meshgraph vertices given a filename.
Definition: MeshGraph1D.cpp:65
void Nektar::SpatialDomains::MeshGraph1D::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 MeshGraph1D.cpp.

References ASSERTL0, ReadComposites(), Nektar::SpatialDomains::MeshGraph::ReadCurves(), Nektar::SpatialDomains::MeshGraph::ReadDomain(), 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  ReadElements(doc);
95  ReadComposites(doc);
96  ReadDomain(doc);
97  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:188
void ReadCurves(TiXmlDocument &doc)
Definition: MeshGraph.cpp:1160
virtual void ReadGeometry(const std::string &infilename)
Read will read the meshgraph vertices given a filename.
Definition: MeshGraph.cpp:232
void ReadElements(TiXmlDocument &doc)
Definition: MeshGraph1D.cpp:99
void ReadDomain(TiXmlDocument &doc)
Definition: MeshGraph.cpp:1066
void ReadComposites(TiXmlDocument &doc)
void Nektar::SpatialDomains::MeshGraph1D::ResolveGeomRef ( const std::string &  prevToken,
const std::string &  token,
Composite composite 
)

Definition at line 326 of file MeshGraph1D.cpp.

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

Referenced by ReadComposites().

328  {
329  try
330  {
331  std::istringstream tokenStream(token);
332  std::istringstream prevTokenStream(prevToken);
333 
334  char type;
335  char prevType;
336 
337  tokenStream >> type;
338 
339  std::string::size_type indxBeg = token.find_first_of('[') + 1;
340  std::string::size_type indxEnd = token.find_last_of(']') - 1;
341 
342  ASSERTL0(indxBeg <= indxEnd, (std::string("Error reading index definition:") + token).c_str());
343 
344  std::string indxStr = token.substr(indxBeg, indxEnd - indxBeg + 1);
345 
346  typedef vector<unsigned int> SeqVectorType;
347  SeqVectorType seqVector;
348 
349  if (!ParseUtils::GenerateSeqVector(indxStr.c_str(), seqVector))
350  {
351  NEKERROR(ErrorUtil::efatal, (std::string("Ill-formed sequence definition: ") + indxStr).c_str());
352  }
353 
354  prevTokenStream >> prevType;
355 
356  // All composites must be of the same dimension.
357  bool validSequence = (prevToken.empty() || // No previous, then current is just fine.
358  (type == 'V' && prevType == 'V') ||
359  (type == 'S' && prevType == 'S'));
360 
361  ASSERTL0(validSequence, (std::string("Invalid combination of composite items: ")
362  + type + " and " + prevType + ".").c_str());
363 
364  switch(type)
365  {
366  case 'V': // Vertex
367  for (SeqVectorType::iterator iter=seqVector.begin(); iter!=seqVector.end(); ++iter)
368  {
369  if (m_vertSet.find(*iter) == m_vertSet.end())
370  {
371  char errStr[16] = "";
372  ::sprintf(errStr, "%d", *iter);
373  NEKERROR(ErrorUtil::ewarning, (std::string("Unknown vertex index: ") + errStr).c_str());
374  }
375  else
376  {
377  composite->push_back(m_vertSet[*iter]);
378  }
379  }
380  break;
381 
382  case 'S': // Segment
383  for (SeqVectorType::iterator iter=seqVector.begin(); iter!=seqVector.end(); ++iter)
384  {
385  if (m_segGeoms.find(*iter) == m_segGeoms.end())
386  {
387  char errStr[16] = "";
388  ::sprintf(errStr, "%d", *iter);
389  NEKERROR(ErrorUtil::ewarning, (std::string("Unknown segment index: ") + errStr).c_str());
390  }
391  else
392  {
393  composite->push_back(m_segGeoms[*iter]);
394  }
395  }
396  break;
397 
398  default:
399  NEKERROR(ErrorUtil::efatal, (std::string("Unrecognized composite token: ") + token).c_str());
400  }
401  }
402  catch(...)
403  {
404  NEKERROR(ErrorUtil::efatal, (std::string("Problem processing composite token: ") + token).c_str());
405  }
406 
407  return;
408  }
#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