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 map< int, 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
 
map< int, 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 46 of file MeshGraph1D.cpp.

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

Definition at line 50 of file MeshGraph1D.cpp.

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

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

Definition at line 58 of file MeshGraph1D.cpp.

59  {
60  }

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:213
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 229 of file MeshGraph1D.cpp.

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

Referenced by ReadGeometry().

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

Referenced by ReadGeometry().

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

References ASSERTL0.

Referenced by MeshGraph1D().

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

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

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

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

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