COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Reader.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #ifndef cf3_mesh_neu_Reader_hpp
8 #define cf3_mesh_neu_Reader_hpp
9 
11 
12 #include "mesh/MeshReader.hpp"
13 #include "common/Table.hpp"
14 #include "mesh/Dictionary.hpp"
15 
16 #include "mesh/neu/LibNeu.hpp"
17 #include "mesh/neu/Shared.hpp"
18 
20 
21 namespace cf3 {
22 namespace mesh {
23  class Elements;
24  class Region;
25  class MergedParallelDistribution;
26 namespace neu {
27 
29 
32 class neu_API Reader : public MeshReader, public Shared
33 {
34 private: // typedefs
35 
36  typedef std::pair<Handle<Elements>,Uint> Region_TableIndex_pair;
37 
38 public: // functions
40  Reader( const std::string& name );
41 
43  static std::string type_name() { return "Reader"; }
44 
45  virtual std::string get_format() { return "neu"; }
46 
47  virtual std::vector<std::string> get_extensions();
48 
49 private: // functions
50 
51  void config_repartition();
52 
53  void read_headerData();
54 
55  void find_ghost_nodes();
56 
57  void read_coordinates();
58 
59  void read_connectivity();
60 
61  void read_groups();
62 
63  void read_boundaries();
64 
65  void get_file_positions();
66 
67  std::string element_type(const Uint neu_type, const Uint nb_nodes);
68 
69 private: // data
70 
71  virtual void do_read_mesh_into(const common::URI& fp, Mesh& mesh);
72 
73  enum HashType { NODES=0, ELEMS=1 };
75 
76  // map< global index , pair< temporary table, index in temporary table > >
77  std::map<Uint,Region_TableIndex_pair> m_global_to_tmp;
78 
79  boost::filesystem::fstream m_file;
83 
84  std::set<Uint> m_ghost_nodes;
85  std::map<Uint,Uint> m_neu_node_to_coord_idx;
86 
89  std::vector<Uint> m_element_group_positions;
90  std::vector<Uint> m_boundary_condition_positions;
91 
92  struct HeaderData
93  {
94  // NUMNP Total number of nodal points in the mesh
95  // NELEM Total number of elements in the mesh
96  // NGPRS Number of element groups
97  // NBSETS Number of boundary condition sets
98  // NDFCD Number of coordinate directions (2 or 3)
99  // NDFVL Number of velocity components (2 or 3)
100  Uint NUMNP, NELEM, NGRPS, NBSETS, NDFCD, NDFVL;
101  std::string mesh_name;
102  } m_headerData;
103 
104  struct GroupData
105  {
106  // NGP Element group number
107  // NELGP Number of elements in group
108  // MTYP Material type (0=Undefined, 1=Conjugate, 2=Fluid, 3=Porous, 4=Solid, 5=Deformable)
109  // NFLAGS Number of solver-dependent flags
110  // ELMMAT Identifying name of element group (or entity or zone)
111  // ELEM Vector of element indices
112  Uint NGP, NELGP, MTYP, NFLAGS;
113  std::string ELMMAT;
114  std::vector<Uint> ELEM;
115  };
116 
117  struct BCData
118  {
119  // NAME Name of boundary-condition set
120  // ITYPE Data type (0 = node; 1 = element/cell)
121  // NENTRY Number of data records in boundary-condition set
122  // NVALUES Number of values for each data record
123  // IBCODE1 (Optional) Boundary condition code 1
124  std::string NAME;
125  Uint ITYPE, NENTRY, NVALUES, IBCODE1;
126  };
127 
128 }; // end Reader
129 
131 
132 } // neu
133 } // mesh
134 } // cf3
135 
137 
138 #endif // cf3_mesh_neu_Reader_hpp
std::string name(ComponentWrapper &self)
std::vector< Uint > m_element_group_positions
Definition: Reader.hpp:89
Safe pointer to an object. This is the supported method for referring to components.
Definition: Handle.hpp:39
Handle< MergedParallelDistribution > m_hash
Definition: Reader.hpp:74
Handle< Region > m_region
Definition: Reader.hpp:81
virtual std::string get_format()
Definition: Reader.hpp:45
boost::filesystem::fstream m_file
Definition: Reader.hpp:79
std::vector< Uint > m_boundary_condition_positions
Definition: Reader.hpp:90
std::map< Uint, Uint > m_neu_node_to_coord_idx
Definition: Reader.hpp:85
std::vector< Uint > ELEM
Definition: Reader.hpp:114
std::map< Uint, Region_TableIndex_pair > m_global_to_tmp
Definition: Reader.hpp:77
static std::string type_name()
Gets the Class name.
Definition: Reader.hpp:43
Handle< Region > m_tmp
Definition: Reader.hpp:82
#define neu_API
Definition: LibNeu.hpp:22
Top-level namespace for coolfluid.
Definition: Action.cpp:18
Handle< Mesh > m_mesh
Definition: Reader.hpp:80
Uint m_nodal_coordinates_position
Definition: Reader.hpp:87
std::set< Uint > m_ghost_nodes
Definition: Reader.hpp:84
unsigned int Uint
typedef for unsigned int
Definition: CF.hpp:90
std::pair< Handle< Elements >, Uint > Region_TableIndex_pair
Definition: Reader.hpp:36
Uint m_elements_cells_position
Definition: Reader.hpp:88
Send comments to:
COOLFluiD Web Admin