Nektar++
Loading...
Searching...
No Matches
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
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 =
73 SPATIAL_DOMAINS_EXPORT void v_ReadGeometry(bool fillGraph) override;
76
79
80 virtual void v_ReadVertices();
81 virtual void v_ReadCurves();
82 void ReadDomain();
83
84 virtual void v_ReadEdges();
85 virtual void v_ReadFaces();
86
87 void ReadElements();
88 void ReadComposites();
89
90 virtual void v_ReadElements1D();
91 virtual void v_ReadElements2D();
92 virtual void v_ReadElements3D();
93
94 void ResolveGeomRef(const std::string &prevToken, const std::string &token,
95 CompositeSharedPtr &composite);
96 void ResolveGeomRef1D(const std::string &prevToken,
97 const std::string &token,
98 CompositeSharedPtr &composite);
99 void ResolveGeomRef2D(const std::string &prevToken,
100 const std::string &token,
101 CompositeSharedPtr &composite);
102 void ResolveGeomRef3D(const std::string &prevToken,
103 const std::string &token,
104 CompositeSharedPtr &composite);
105
106 // *keysToWrite specifies a subset of GeomMap to write during partitioning.
107 virtual void v_WriteVertices(
108 TiXmlElement *geomTag,
109 std::vector<int> keysToWrite = std::vector<int>());
110 virtual void v_WriteEdges(
111 TiXmlElement *geomTag,
112 std::vector<int> keysToWrite = std::vector<int>());
113 virtual void v_WriteTris(TiXmlElement *faceTag,
114 std::vector<int> keysToWrite = std::vector<int>());
115 virtual void v_WriteQuads(
116 TiXmlElement *faceTag,
117 std::vector<int> keysToWrite = std::vector<int>());
118 virtual void v_WriteHexs(TiXmlElement *elmtTag,
119 std::vector<int> keysToWrite = std::vector<int>());
120 virtual void v_WritePrisms(
121 TiXmlElement *elmtTag,
122 std::vector<int> keysToWrite = std::vector<int>());
123 virtual void v_WritePyrs(TiXmlElement *elmtTag,
124 std::vector<int> keysToWrite = std::vector<int>());
125 virtual void v_WriteTets(TiXmlElement *elmtTag,
126 std::vector<int> keysToWrite = std::vector<int>());
127 virtual void v_WriteCurves(TiXmlElement *geomTag, CurveMap &edges,
128 CurveMap &faces);
129 void WriteComposites(TiXmlElement *geomTag, CompositeMap &comps,
130 std::map<int, std::string> &compLabels);
131 void WriteDomain(TiXmlElement *geomTag,
132 std::map<int, CompositeMap> &domain);
133 void WriteDefaultExpansion(TiXmlElement *root);
134
136};
137
138} // namespace Nektar::SpatialDomains
139
140#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.
void ResolveGeomRef2D(const std::string &prevToken, const std::string &token, CompositeSharedPtr &composite)
void ResolveGeomRef3D(const std::string &prevToken, const std::string &token, CompositeSharedPtr &composite)
virtual void v_WritePrisms(TiXmlElement *elmtTag, std::vector< int > keysToWrite=std::vector< int >())
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_WriteEdges(TiXmlElement *geomTag, std::vector< int > keysToWrite=std::vector< int >())
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, std::vector< int > keysToWrite=std::vector< int >())
void v_PartitionMesh(LibUtilities::SessionReaderSharedPtr session) override
void WriteDefaultExpansion(TiXmlElement *root)
void ResolveGeomRef1D(const std::string &prevToken, const std::string &token, CompositeSharedPtr &composite)
virtual void v_WriteTris(TiXmlElement *faceTag, std::vector< int > keysToWrite=std::vector< int >())
virtual void v_WriteVertices(TiXmlElement *geomTag, std::vector< int > keysToWrite=std::vector< int >())
void v_ReadGeometry(bool fillGraph) override
virtual void v_WriteQuads(TiXmlElement *faceTag, std::vector< int > keysToWrite=std::vector< int >())
virtual void v_WriteHexs(TiXmlElement *elmtTag, std::vector< int > keysToWrite=std::vector< int >())
void WriteComposites(TiXmlElement *geomTag, CompositeMap &comps, std::map< int, std::string > &compLabels)
void SetupCompositeRange(LibUtilities::DomainRangeShPtr &rng)
void WriteXMLGeometry(std::string outname, std::vector< std::set< unsigned int > > elements, std::vector< unsigned int > partitions)
virtual void v_WriteTets(TiXmlElement *elmtTag, std::vector< int > keysToWrite=std::vector< int >())
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:69
std::map< int, std::vector< unsigned int > > CompositeOrdering
Definition MeshGraph.h:170
std::shared_ptr< MeshGraphIO > MeshGraphIOSharedPtr
Definition MeshGraphIO.h:46
std::shared_ptr< Composite > CompositeSharedPtr
Definition MeshGraph.h:178
std::unordered_map< int, CurveSharedPtr > CurveMap
Definition Curve.hpp:61
std::map< int, CompositeSharedPtr > CompositeMap
Definition MeshGraph.h:179