Nektar++
Loading...
Searching...
No Matches
MeshGraphIOHDF5.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: MeshGraphIOHDF5.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_MGIOHDF5_H
36#define NEKTAR_SPATIALDOMAINS_MGIOHDF5_H
37
41
43{
44
46{
47public:
48 friend class MemoryManager<MeshGraphIOHDF5>;
49
54
55 static std::string className, cmdSwitch;
56
57protected:
58 TiXmlElement *m_xmlGeom{};
59
60 MeshGraphIOHDF5() = default;
61 ~MeshGraphIOHDF5() override = default;
62
63 // some of these functions are going to be virtual because they will be
64 // inherited by the XmlCompressed version
65
67 const std::string &outfilename, bool defaultExp = false,
68 const LibUtilities::FieldMetaDataMap &metadata =
70 SPATIAL_DOMAINS_EXPORT void v_ReadGeometry(bool fillGraph) final;
73
74private:
75 void ReadCurveMap(CurveMap &curveMap, std::string dsName,
76 const std::unordered_set<int> &readIds);
77 void ReadDomain();
78 void ReadComposites();
80
81 template <class T>
82 void WriteGeometryMap(GeomMapView<T> &geomMap, std::string datasetName);
83
84 template <class T, typename DataType>
85 void ReadGeometryData(GeomMapView<T> &geomMap, std::string dataSet,
86 const std::unordered_set<int> &readIds,
87 std::vector<int> &ids,
88 std::vector<DataType> &geomData);
89 template <class T, typename DataType>
90 void FillGeomMap(GeomMapView<T> &geomMap, const CurveMap &curveMap,
91 std::vector<int> &ids, std::vector<DataType> &geomData);
92 template <class T, typename DataType>
93 void ConstructGeomObject(GeomMapView<T> &geomMap, int id, DataType *data,
94 CurveSharedPtr curve);
95
97 std::unordered_map<int, int> &id2row);
98
99 void WriteCurveMap(CurveMap &curves, std::string dsName,
100 MeshCurvedPts &curvedPts, int &ptOffset, int &newIdx);
101 void WriteCurvePoints(MeshCurvedPts &curvedPts);
102
103 void WriteComposites(CompositeMap &comps);
104 void WriteDomain(std::map<int, CompositeMap> &domain);
105
106 std::string m_hdf5Name;
111 unsigned int m_inFormatVersion;
112
113 static const unsigned int FORMAT_VERSION;
114};
115
116} // namespace Nektar::SpatialDomains
117
118#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 FillGeomMap(GeomMapView< T > &geomMap, const CurveMap &curveMap, std::vector< int > &ids, std::vector< DataType > &geomData)
void v_PartitionMesh(LibUtilities::SessionReaderSharedPtr session) final
Partition the mesh.
void SetupCompositeRange(LibUtilities::DomainRangeShPtr &rng)
LibUtilities::H5::GroupSharedPtr m_mesh
LibUtilities::H5::GroupSharedPtr m_maps
void ConstructGeomObject(GeomMapView< T > &geomMap, int id, DataType *data, CurveSharedPtr curve)
void v_ReadGeometry(bool fillGraph) final
void WriteDomain(std::map< int, CompositeMap > &domain)
static const unsigned int FORMAT_VERSION
Version of the Nektar++ HDF5 geometry format, which is embedded into the main NEKTAR/GEOMETRY group a...
void WriteCurveMap(CurveMap &curves, std::string dsName, MeshCurvedPts &curvedPts, int &ptOffset, int &newIdx)
void v_WriteGeometry(const std::string &outfilename, bool defaultExp=false, const LibUtilities::FieldMetaDataMap &metadata=LibUtilities::NullFieldMetaDataMap) final
void WriteCurvePoints(MeshCurvedPts &curvedPts)
LibUtilities::H5::FileSharedPtr m_file
void ReadCurveMap(CurveMap &curveMap, std::string dsName, const std::unordered_set< int > &readIds)
void ReadGeometryData(GeomMapView< T > &geomMap, std::string dataSet, const std::unordered_set< int > &readIds, std::vector< int > &ids, std::vector< DataType > &geomData)
void WriteGeometryMap(GeomMapView< T > &geomMap, std::string datasetName)
LibUtilities::H5::PListSharedPtr m_readPL
static MeshGraphIOSharedPtr create()
CompositeDescriptor CreateCompositeDescriptor()
std::shared_ptr< PList > PListSharedPtr
Definition H5.h:92
std::shared_ptr< File > FileSharedPtr
Definition H5.h:88
std::shared_ptr< Group > GroupSharedPtr
Definition FieldIOHdf5.h:48
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::shared_ptr< MeshGraphIO > MeshGraphIOSharedPtr
Definition MeshGraphIO.h:46
std::map< int, std::pair< LibUtilities::ShapeType, std::vector< int > > > CompositeDescriptor
Definition MeshGraph.h:124
std::shared_ptr< Curve > CurveSharedPtr
Definition Curve.hpp:60
std::unordered_map< int, CurveSharedPtr > CurveMap
Definition Curve.hpp:61
std::map< int, CompositeSharedPtr > CompositeMap
Definition MeshGraph.h:179