Nektar++
InputNek.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: InputNek.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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Nektar file format converter.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef UTILITIES_PREPROCESSING_MESHCONVERT_INPUTNEK
37 #define UTILITIES_PREPROCESSING_MESHCONVERT_INPUTNEK
38 
39 #include "../Module.h"
40 
41 namespace Nektar
42 {
43  namespace Utilities
44  {
45  enum NekCurve
46  {
49  };
50 
52  typedef boost::shared_ptr<HOSurf> HOSurfSharedPtr;
53 
54  /**
55  * Hash class for high-order surfaces.
56  */
57  struct HOSurfHash : std::unary_function<HOSurfSharedPtr, std::size_t>
58  {
59  /**
60  * Calculate hash of a given high-order surface p by taking
61  * successive hashes of the vertex IDs.
62  */
63  std::size_t operator()(HOSurfSharedPtr const& p) const
64  {
65  std::size_t seed = 0;
66  std::vector<int> ids = p->vertId;
67  std::sort(ids.begin(), ids.end());
68  for (int i = 0; i < ids.size(); ++i)
69  {
70  boost::hash_combine(seed, ids[i]);
71  }
72  return seed;
73  }
74  };
75 
76  bool operator==(HOSurfSharedPtr const &p1, HOSurfSharedPtr const &p2);
77 
78  typedef boost::unordered_set<HOSurfSharedPtr, HOSurfHash> HOSurfSet;
79 
80  /**
81  * Converter class for Nektar session files.
82  */
83  class InputNek : public InputModule
84  {
85  public:
87  virtual ~InputNek();
88  virtual void Process();
89 
90  /// Creates an instance of this class.
93  }
94  /// %ModuleKey for class.
96 
97  private:
98  void LoadHOSurfaces();
100 
101  /**
102  * Maps a curve tag to a filename containing surface information.
103  */
104  std::map<string, pair<NekCurve, string> > curveTags;
105 
106  /**
107  * Maps a curve tag to the high-order surface data for that tag.
108  */
109  std::map<string, HOSurfSet> hoData;
110 
111  /**
112  * Maps ordering of hsf standard element to Nektar++ ordering.
113  */
114  std::map<int, int> hoMap;
115  };
116  }
117 }
118 
119 #endif
static ModuleKey className
ModuleKey for class.
Definition: InputNek.h:95
pair< ModuleType, string > ModuleKey
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
std::map< string, HOSurfSet > hoData
Definition: InputNek.h:109
boost::shared_ptr< HOSurf > HOSurfSharedPtr
Definition: InputNek.h:52
std::map< int, int > hoMap
Definition: InputNek.h:114
InputNek(MeshSharedPtr p_m)
Definition: InputNek.cpp:57
HOTriangle< NodeSharedPtr > HOSurf
Definition: InputNek.h:51
std::map< string, pair< NekCurve, string > > curveTags
Definition: InputNek.h:104
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
boost::shared_ptr< Module > ModuleSharedPtr
virtual void Process()
Processes Nektar file format.
Definition: InputNek.cpp:77
boost::unordered_set< HOSurfSharedPtr, HOSurfHash > HOSurfSet
Definition: InputNek.h:78
std::size_t operator()(HOSurfSharedPtr const &p) const
Definition: InputNek.h:63
bool operator==(TriFaceIDs const &p1, TriFaceIDs const &p2)
static ModuleSharedPtr create(MeshSharedPtr m)
Creates an instance of this class.
Definition: InputNek.h:91
int GetNnodes(LibUtilities::ShapeType elType)
Definition: InputNek.cpp:1059
A lightweight struct for dealing with high-order triangle alignment.
Abstract base class for input modules.