Nektar++
Domain.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Domain.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 #ifndef NEKTAR_SPATIALDOMAINS_DOMAIN_H
35 #define NEKTAR_SPATIALDOMAINS_DOMAIN_H
36 
39 
40 class TiXmlDocument;
41 
42 namespace Nektar
43 {
44  namespace SpatialDomains
45  {
47  {
49  eDirichlet,
50  eNeumann,
51  eRobin,
53 
56  };
57 
58  // Corresponds to the entries above. These are the tags within the domain definition
59  // corresponding to type of BC above.
60  const char BoundaryTypeNameMap[] =
61  {
62  'U',// Just a placeholder to get the correct index for the rest.
63  'D',
64  'N',
65  'R',
66  'C'
67  };
68 
70  {
72  std::vector< Composite > m_BoundaryComposites;
73  };
74 
75  typedef std::shared_ptr< BoundaryEntry > BoundarySharedPtr;
76  typedef std::vector< BoundarySharedPtr > BoundaryVector;
77  typedef std::vector< Composite > CompositeVector;
78 
79  class Domain
80  {
81  public:
82  // Must have a MeshGraph from which the composites
83  // and associated items can be obtained.
84  Domain(MeshGraph *meshGraph);
85  virtual ~Domain();
86 
87  void Read(std::string &infilename);
88  void Read(TiXmlDocument &doc);
89  void Write(std::string &outfilename);
90 
91  CompositeVector GetDomain(void) const { return m_Domain; };
92  BoundaryVector GetBoundaries(void) const { return m_Boundaries; };
93 
94  inline void SetFileName(const std::string &inString)
95  {
96  m_FileName = inString;
97  };
98 
99 
100  protected:
101  //std::string m_filename;
103  CompositeVector m_domain;
104  BoundaryVector m_boundaries;
105 
106  private:
107  Domain(){ NEKERROR(ErrorUtil::efatal, "Must provide a meshgraph to create a Domain."); }; // Don't call this.
108  };
109  };
110 }
111 
112 #endif //NEKTAR_SPATIALDOMAINS_DOMAIN_H
void SetFileName(const std::string &inString)
Definition: Domain.h:94
std::vector< BoundarySharedPtr > BoundaryVector
Definition: Domain.h:76
const char BoundaryTypeNameMap[]
Definition: Domain.h:60
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
Definition: Domain.h:69
BoundaryType m_BoundaryType
Definition: Domain.h:71
std::vector< Composite > CompositeVector
Definition: Domain.h:77
CompositeVector m_domain
Definition: Domain.h:103
std::shared_ptr< BoundaryEntry > BoundarySharedPtr
Definition: Domain.h:75
BoundaryVector m_boundaries
Definition: Domain.h:104
BoundaryVector GetBoundaries(void) const
Definition: Domain.h:92
CompositeVector GetDomain(void) const
Definition: Domain.h:91
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap, const bool backup)
This function allows for data to be written to an FLD file when a session and/or communicator is not ...
Definition: FieldIO.cpp:249
Base class for a spectral/hp element mesh.
Definition: MeshGraph.h:167
std::vector< Composite > m_BoundaryComposites
Definition: Domain.h:72