Nektar++
MeshGraphIO.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: MeshGraphIO.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_MGIO_H
36#define NEKTAR_SPATIALDOMAINS_MGIO_H
37
41
43{
44
45class MeshGraphIO;
46typedef std::shared_ptr<MeshGraphIO> MeshGraphIOSharedPtr;
47
49{
50public:
53
57 bool fillGraph = true,
58 SpatialDomains::MeshGraphSharedPtr partitionedGraph = nullptr);
59
61 {
62 m_meshGraph = meshGraph;
63 }
64
66 const std::string &outfilename, bool defaultExp = false,
67 const LibUtilities::FieldMetaDataMap &metadata =
69 {
70 v_WriteGeometry(outfilename, defaultExp, metadata);
71 }
72
73 /*an inital read which loads a very light weight data structure*/
75 bool fillGraph)
76 {
77 v_ReadGeometry(rng, fillGraph);
78 }
79
82 {
83 v_PartitionMesh(session);
84 }
85
86 SPATIAL_DOMAINS_EXPORT std::map<int, MeshEntity> CreateMeshEntities();
88
89protected:
93 bool m_meshPartitioned = false;
96
97 std::string GetCompositeString(CompositeSharedPtr comp);
98
100 const std::string &outfilename, bool defaultExp = false,
101 const LibUtilities::FieldMetaDataMap &metadata =
103
105 LibUtilities::DomainRangeShPtr rng, bool fillGraph) = 0;
106
109};
110
113
114} // namespace Nektar::SpatialDomains
115
116#endif // NEKTAR_MESHGRAPHIO_H
#define SPATIAL_DOMAINS_EXPORT
Provides a generic Factory class.
LibUtilities::SessionReaderSharedPtr m_session
Definition: MeshGraphIO.h:90
void ReadGeometry(LibUtilities::DomainRangeShPtr rng, bool fillGraph)
Definition: MeshGraphIO.h:74
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true, SpatialDomains::MeshGraphSharedPtr partitionedGraph=nullptr)
Definition: MeshGraphIO.cpp:53
std::string GetCompositeString(CompositeSharedPtr comp)
Returns a string representation of a composite.
CompositeDescriptor CreateCompositeDescriptor()
virtual void v_PartitionMesh(LibUtilities::SessionReaderSharedPtr session)=0
virtual void v_ReadGeometry(LibUtilities::DomainRangeShPtr rng, bool fillGraph)=0
void PartitionMesh(LibUtilities::SessionReaderSharedPtr session)
Definition: MeshGraphIO.h:80
void WriteGeometry(const std::string &outfilename, bool defaultExp=false, const LibUtilities::FieldMetaDataMap &metadata=LibUtilities::NullFieldMetaDataMap)
Definition: MeshGraphIO.h:65
virtual void v_WriteGeometry(const std::string &outfilename, bool defaultExp=false, const LibUtilities::FieldMetaDataMap &metadata=LibUtilities::NullFieldMetaDataMap)=0
void SetMeshGraph(MeshGraphSharedPtr &meshGraph)
Definition: MeshGraphIO.h:60
std::map< int, MeshEntity > CreateMeshEntities()
Create mesh entities for this graph.
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
static DomainRangeShPtr NullDomainRangeShPtr
Definition: DomainRange.h:65
std::map< int, std::vector< unsigned int > > CompositeOrdering
Definition: MeshGraph.h:107
std::shared_ptr< MeshGraphIO > MeshGraphIOSharedPtr
Definition: MeshGraphIO.h:46
std::map< int, std::pair< LibUtilities::ShapeType, std::vector< int > > > CompositeDescriptor
Definition: MeshGraph.h:61
std::map< int, std::vector< unsigned int > > BndRegionOrdering
Definition: MeshGraph.h:108
std::shared_ptr< Composite > CompositeSharedPtr
Definition: MeshGraph.h:135
LibUtilities::NekFactory< std::string, MeshGraphIO > MeshGraphIOFactory
Definition: MeshGraphIO.h:111
MeshGraphIOFactory & GetMeshGraphIOFactory()
Definition: MeshGraphIO.cpp:47
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174