Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InputStar.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: InputStarTec.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: Tecplot (ascii .dat) converter.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef UTILITIES_NEKMESH_INPUTSTAR
37 #define UTILITIES_NEKMESH_INPUTSTAR
38 
39 #include "../Module.h"
40 
41 #include "ccmio.h"
42 
43 namespace Nektar
44 {
45 namespace Utilities
46 {
47 /// Converter for VTK files.
48 class InputStar : public InputModule
49 {
50 public:
51  /// Creates an instance of this class
53  {
55  }
57 
59  virtual ~InputStar();
60 
61  /// Populate and validate required data structures.
62  virtual void Process();
63 
64  void ReadZone(int &nComposite);
65 
66 protected:
67  void GenElement3D(std::vector<NodeSharedPtr> &Nodes,
68  int i,
69  std::vector<int> &ElementFaces,
70  std::map<int, std::vector<int> > &FaceNodes,
71  int ncomposite,
72  bool DoOrient);
73 
74  void GenElement2D(std::vector<NodeSharedPtr> &Nodes,
75  int i,
76  std::vector<int> &FaceNodes,
77  int ncomposite);
78 
79  Array<OneD, int> SortEdgeNodes(std::vector<NodeSharedPtr> &Nodes,
80  std::vector<int> &FaceNodes);
81 
82  Array<OneD, int> SortFaceNodes(std::vector<NodeSharedPtr> &Nodes,
83  std::vector<int> &ElementFaces,
84  std::map<int, std::vector<int> > &FaceNodes);
85 
86  void ResetNodes(std::vector<NodeSharedPtr> &Nodes,
87  Array<OneD, std::vector<int> > &ElementFaces,
88  std::map<int, std::vector<int> > &FaceNodes);
89 
90 private:
91  CCMIOError m_ccmErr; // Star CCM error flag
92  CCMIOID m_ccmTopology; // Star CCM mesh topology
93  CCMIOID m_ccmProcessor;
94  std::map<int, std::string> m_faceLabels; // label from CCM into composite
95 
96  void InitCCM(void);
97 
98  void ReadNodes(std::vector<NodeSharedPtr> &Nodes);
99 
100  void ReadInternalFaces(std::map<int, std::vector<int> > &FacesNodes,
101  Array<OneD, std::vector<int> > &ElementFaces);
102 
103  void ReadBoundaryFaces(std::vector<std::vector<int> > &BndElementFaces,
104  std::map<int, std::vector<int> > &FacesNodes,
105  Array<OneD, std::vector<int> > &ElementFaces,
106  std::vector<std::string> &facelabels);
107 
108  void SetupElements(void);
109 };
110 }
111 }
112 
113 #endif
virtual void Process()
Populate and validate required data structures.
Definition: InputStar.cpp:77
static ModuleSharedPtr create(MeshSharedPtr m)
Creates an instance of this class.
Definition: InputStar.h:52
pair< ModuleType, string > ModuleKey
InputStar(MeshSharedPtr m)
Definition: InputStar.cpp:56
void GenElement2D(std::vector< NodeSharedPtr > &Nodes, int i, std::vector< int > &FaceNodes, int ncomposite)
Definition: InputStar.cpp:458
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void GenElement3D(std::vector< NodeSharedPtr > &Nodes, int i, std::vector< int > &ElementFaces, std::map< int, std::vector< int > > &FaceNodes, int ncomposite, bool DoOrient)
Definition: InputStar.cpp:498
void ReadNodes(std::vector< NodeSharedPtr > &Nodes)
Definition: InputStar.cpp:929
void ReadBoundaryFaces(std::vector< std::vector< int > > &BndElementFaces, std::map< int, std::vector< int > > &FacesNodes, Array< OneD, std::vector< int > > &ElementFaces, std::vector< std::string > &facelabels)
Definition: InputStar.cpp:1063
void ResetNodes(std::vector< NodeSharedPtr > &Nodes, Array< OneD, std::vector< int > > &ElementFaces, std::map< int, std::vector< int > > &FaceNodes)
Definition: InputStar.cpp:210
Converter for VTK files.
Definition: InputStar.h:48
std::map< int, std::string > m_faceLabels
Definition: InputStar.h:94
void ReadInternalFaces(std::map< int, std::vector< int > > &FacesNodes, Array< OneD, std::vector< int > > &ElementFaces)
Definition: InputStar.cpp:969
boost::shared_ptr< Module > ModuleSharedPtr
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:137
Array< OneD, int > SortEdgeNodes(std::vector< NodeSharedPtr > &Nodes, std::vector< int > &FaceNodes)
Definition: InputStar.cpp:559
Array< OneD, int > SortFaceNodes(std::vector< NodeSharedPtr > &Nodes, std::vector< int > &ElementFaces, std::map< int, std::vector< int > > &FaceNodes)
Definition: InputStar.cpp:613
static ModuleKey className
Definition: InputStar.h:56
void ReadZone(int &nComposite)
Abstract base class for input modules.