Nektar++
MeshGraphIOXml.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: MeshGraphIOXml.h
4//
5// For more information, please see: http://www.nektar.info/
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description:
32//
33////////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SPATIALDOMAINS_MGIOXML_H
36#define NEKTAR_SPATIALDOMAINS_MGIOXML_H
37
40
42{
43
45{
46public:
47 friend class MemoryManager<MeshGraphIOXml>;
48
50 std::string outname, std::vector<std::set<unsigned int>> elements,
51 std::vector<unsigned int> partitions);
52
54 {
56 }
57
58 static std::string className;
59
60protected:
61 TiXmlElement *m_xmlGeom{};
62
63 MeshGraphIOXml() = default;
64 ~MeshGraphIOXml() override = default;
65
66 // some of these functions are going to be virtual because they will be
67 // inherited by the XmlCompressed version
68
70 const std::string &outfilename, bool defaultExp = false,
71 const LibUtilities::FieldMetaDataMap &metadata =
74 LibUtilities::DomainRangeShPtr rng, bool fillGraph) override;
77
78 virtual void v_ReadVertices();
79 virtual void v_ReadCurves();
80 void ReadDomain();
81
82 virtual void v_ReadEdges();
83 virtual void v_ReadFaces();
84
85 void ReadElements();
86 void ReadComposites();
87
88 virtual void v_ReadElements1D();
89 virtual void v_ReadElements2D();
90 virtual void v_ReadElements3D();
91
92 void ResolveGeomRef(const std::string &prevToken, const std::string &token,
93 CompositeSharedPtr &composite);
94 void ResolveGeomRef1D(const std::string &prevToken,
95 const std::string &token,
96 CompositeSharedPtr &composite);
97 void ResolveGeomRef2D(const std::string &prevToken,
98 const std::string &token,
99 CompositeSharedPtr &composite);
100 void ResolveGeomRef3D(const std::string &prevToken,
101 const std::string &token,
102 CompositeSharedPtr &composite);
103
104 virtual void v_WriteVertices(TiXmlElement *geomTag, PointGeomMap &verts);
105 virtual void v_WriteEdges(TiXmlElement *geomTag, SegGeomMap &edges);
106 virtual void v_WriteTris(TiXmlElement *faceTag, TriGeomMap &tris);
107 virtual void v_WriteQuads(TiXmlElement *faceTag, QuadGeomMap &quads);
108 virtual void v_WriteHexs(TiXmlElement *elmtTag, HexGeomMap &hexs);
109 virtual void v_WritePrisms(TiXmlElement *elmtTag, PrismGeomMap &pris);
110 virtual void v_WritePyrs(TiXmlElement *elmtTag, PyrGeomMap &pyrs);
111 virtual void v_WriteTets(TiXmlElement *elmtTag, TetGeomMap &tets);
112 virtual void v_WriteCurves(TiXmlElement *geomTag, CurveMap &edges,
113 CurveMap &faces);
114 void WriteComposites(TiXmlElement *geomTag, CompositeMap &comps,
115 std::map<int, std::string> &compLabels);
116 void WriteDomain(TiXmlElement *geomTag,
117 std::map<int, CompositeMap> &domain);
118 void WriteDefaultExpansion(TiXmlElement *root);
119
121};
122
123} // namespace Nektar::SpatialDomains
124
125#endif
#define SPATIAL_DOMAINS_EXPORT
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
virtual void v_WriteHexs(TiXmlElement *elmtTag, HexGeomMap &hexs)
void ResolveGeomRef2D(const std::string &prevToken, const std::string &token, CompositeSharedPtr &composite)
void ResolveGeomRef3D(const std::string &prevToken, const std::string &token, CompositeSharedPtr &composite)
void v_WriteGeometry(const std::string &outfilename, bool defaultExp=false, const LibUtilities::FieldMetaDataMap &metadata=LibUtilities::NullFieldMetaDataMap) override
Write out an XML file containing the GEOMETRY block representing this MeshGraph instance inside a NEK...
virtual void v_WriteCurves(TiXmlElement *geomTag, CurveMap &edges, CurveMap &faces)
void ResolveGeomRef(const std::string &prevToken, const std::string &token, CompositeSharedPtr &composite)
virtual void v_WritePyrs(TiXmlElement *elmtTag, PyrGeomMap &pyrs)
void v_PartitionMesh(LibUtilities::SessionReaderSharedPtr session) override
void WriteDefaultExpansion(TiXmlElement *root)
void v_ReadGeometry(LibUtilities::DomainRangeShPtr rng, bool fillGraph) override
virtual void v_WriteTets(TiXmlElement *elmtTag, TetGeomMap &tets)
void ResolveGeomRef1D(const std::string &prevToken, const std::string &token, CompositeSharedPtr &composite)
virtual void v_WriteEdges(TiXmlElement *geomTag, SegGeomMap &edges)
virtual void v_WritePrisms(TiXmlElement *elmtTag, PrismGeomMap &pris)
void WriteComposites(TiXmlElement *geomTag, CompositeMap &comps, std::map< int, std::string > &compLabels)
void WriteXMLGeometry(std::string outname, std::vector< std::set< unsigned int > > elements, std::vector< unsigned int > partitions)
virtual void v_WriteVertices(TiXmlElement *geomTag, PointGeomMap &verts)
virtual void v_WriteQuads(TiXmlElement *faceTag, QuadGeomMap &quads)
virtual void v_WriteTris(TiXmlElement *faceTag, TriGeomMap &tris)
void WriteDomain(TiXmlElement *geomTag, std::map< int, CompositeMap > &domain)
static MeshGraphIOSharedPtr create()
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:50
std::shared_ptr< SessionReader > SessionReaderSharedPtr
static FieldMetaDataMap NullFieldMetaDataMap
Definition: FieldIO.h:51
std::shared_ptr< DomainRange > DomainRangeShPtr
Definition: DomainRange.h:64
std::map< int, TriGeomSharedPtr > TriGeomMap
Definition: TriGeom.h:57
std::map< int, std::vector< unsigned int > > CompositeOrdering
Definition: MeshGraph.h:107
std::map< int, PyrGeomSharedPtr > PyrGeomMap
Definition: PyrGeom.h:76
std::shared_ptr< MeshGraphIO > MeshGraphIOSharedPtr
Definition: MeshGraphIO.h:46
std::map< int, QuadGeomSharedPtr > QuadGeomMap
Definition: QuadGeom.h:53
std::shared_ptr< Composite > CompositeSharedPtr
Definition: MeshGraph.h:135
std::map< int, SegGeomSharedPtr > SegGeomMap
Definition: SegGeom.h:50
std::unordered_map< int, CurveSharedPtr > CurveMap
Definition: Curve.hpp:59
std::map< int, TetGeomSharedPtr > TetGeomMap
Definition: TetGeom.h:84
std::map< int, PrismGeomSharedPtr > PrismGeomMap
Definition: PrismGeom.h:83
std::map< int, HexGeomSharedPtr > HexGeomMap
Definition: HexGeom.h:85
std::map< int, PointGeomSharedPtr > PointGeomMap
Definition: PointGeom.h:51
std::map< int, CompositeSharedPtr > CompositeMap
Definition: MeshGraph.h:136