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

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

Definition at line 53 of file MeshGraph1D.cpp.

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

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

Definition at line 61 of file MeshGraph1D.cpp.

62  {
63  }

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:250
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 232 of file MeshGraph1D.cpp.

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

Referenced by ReadGeometry().

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

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

Read will read the meshgraph vertices given a filename.

Reimplemented from Nektar::SpatialDomains::MeshGraph.

Definition at line 66 of file MeshGraph1D.cpp.

References ASSERTL0.

Referenced by MeshGraph1D().

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

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

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

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

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