Nektar++
MeshGraphHDF5.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Geometry.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: This file contains the base class specification for the
32 // Geometry class.
33 //
34 //
35 ////////////////////////////////////////////////////////////////////////////////
36 #ifndef NEKTAR_SPATIALDOMAINS_MGHDF5_H
37 #define NEKTAR_SPATIALDOMAINS_MGHDF5_H
38 
42 
43 namespace Nektar
44 {
45 namespace SpatialDomains
46 {
47 
48 class MeshGraphHDF5 : public MeshGraph
49 {
50 public:
52  {
53  }
54 
56  std::string &outfilename,
57  bool defaultExp = false,
58  const LibUtilities::FieldMetaDataMap &metadata
60 
61  virtual ~MeshGraphHDF5()
62  {
63  }
64 
66  {
68  }
69 
70  static std::string className;
71 
72 protected:
74  DomainRangeShPtr rng,
75  bool fillGraph);
78 
79 private:
80 
81  void ReadCurveMap(
82  CurveMap &curveMap,
83  std::string dsName,
84  const std::unordered_set<int> &readIds);
85  void ReadDomain();
86  void ReadComposites();
87 
88  template<class T>
89  void WriteGeometryMap(std::map<int, std::shared_ptr<T>> &geomMap,
90  std::string datasetName);
91 
92  template<class T, typename DataType> void ReadGeometryData(
93  std::map<int, std::shared_ptr<T>> &geomMap,
94  std::string dataSet,
95  const std::unordered_set<int> &readIds,
96  std::vector<int> &ids,
97  std::vector<DataType> &geomData);
98  template<class T, typename DataType> void FillGeomMap(
99  std::map<int, std::shared_ptr<T>> &geomMap,
100  const CurveMap &curveMap,
101  std::vector<int> &ids,
102  std::vector<DataType> &geomData);
103  template<class T, typename DataType> void ConstructGeomObject(
104  std::map<int, std::shared_ptr<T>> &geomMap, int id,
105  DataType *data, CurveSharedPtr curve);
106 
108  std::unordered_map<int, int> &id2row);
109 
110  void WriteCurveMap(CurveMap &curves,
111  std::string dsName,
112  MeshCurvedPts &curvedPts,
113  int &ptOffset,
114  int &newIdx);
115  void WriteCurvePoints(MeshCurvedPts &curvedPts);
116 
117  void WriteComposites(CompositeMap &comps);
118  void WriteDomain(std::vector<CompositeMap> &domain);
119 
120  std::string m_hdf5Name;
125 
126  static const unsigned int FORMAT_VERSION;
127 };
128 
129 } // end of namespace
130 } // end of namespace
131 
132 #endif
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:163
CompositeDescriptor CreateCompositeDescriptor()
Definition: MeshGraph.cpp:3633
LibUtilities::H5::FileSharedPtr m_file
void WriteDomain(std::vector< CompositeMap > &domain)
std::unordered_map< int, CurveSharedPtr > CurveMap
Definition: Curve.hpp:62
static const unsigned int FORMAT_VERSION
Version of the Nektar++ HDF5 geometry format, which is embedded into the main NEKTAR/GEOMETRY group a...
void ReadCurveMap(CurveMap &curveMap, std::string dsName, const std::unordered_set< int > &readIds)
std::map< int, CompositeSharedPtr > CompositeMap
Definition: MeshGraph.h:137
static MeshGraphSharedPtr create()
Definition: MeshGraphHDF5.h:65
void WriteComposites(CompositeMap &comps)
std::shared_ptr< DomainRange > DomainRangeShPtr
Definition: MeshGraph.h:128
std::map< std::string, std::string > FieldMetaDataMap
Definition: FieldIO.h:52
void WriteCurveMap(CurveMap &curves, std::string dsName, MeshCurvedPts &curvedPts, int &ptOffset, int &newIdx)
std::shared_ptr< PList > PListSharedPtr
Definition: H5.h:104
void ConstructGeomObject(std::map< int, std::shared_ptr< T >> &geomMap, int id, DataType *data, CurveSharedPtr curve)
virtual void WriteGeometry(std::string &outfilename, bool defaultExp=false, const LibUtilities::FieldMetaDataMap &metadata=LibUtilities::NullFieldMetaDataMap)
void ReadGeometryData(std::map< int, std::shared_ptr< T >> &geomMap, std::string dataSet, const std::unordered_set< int > &readIds, std::vector< int > &ids, std::vector< DataType > &geomData)
std::shared_ptr< File > FileSharedPtr
Definition: H5.h:100
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
LibUtilities::H5::PListSharedPtr m_readPL
void WriteGeometryMap(std::map< int, std::shared_ptr< T >> &geomMap, std::string datasetName)
std::map< int, std::pair< LibUtilities::ShapeType, std::vector< int > > > CompositeDescriptor
Definition: MeshGraph.h:62
void FillGeomMap(std::map< int, std::shared_ptr< T >> &geomMap, const CurveMap &curveMap, std::vector< int > &ids, std::vector< DataType > &geomData)
void WriteCurvePoints(MeshCurvedPts &curvedPts)
virtual void ReadGeometry(DomainRangeShPtr rng, bool fillGraph)
LibUtilities::H5::GroupSharedPtr m_maps
Base class for a spectral/hp element mesh.
Definition: MeshGraph.h:167
std::shared_ptr< Curve > CurveSharedPtr
Definition: Curve.hpp:61
std::shared_ptr< Group > GroupSharedPtr
Definition: FieldIOHdf5.h:49
static FieldMetaDataMap NullFieldMetaDataMap
Definition: FieldIO.h:53
virtual void PartitionMesh(LibUtilities::SessionReaderSharedPtr session)
Partition the mesh.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
#define SPATIAL_DOMAINS_EXPORT
LibUtilities::H5::GroupSharedPtr m_mesh