Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rocin_block.h
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 // $Id: rocin_block.h,v 1.7 2008/12/06 08:43:19 mtcampbe Exp $
24 
25 #ifndef _ROCIN_BLOCK_H_
26 #define _ROCIN_BLOCK_H_
27 
28 #include <map>
29 
33 struct VarInfo_HDF4 {
35  VarInfo_HDF4(const std::string &name, char pos, COM_Type dType,
36  const std::string& units, int nc, int32 i, int nitems,
37  int ng, bool is_null)
38  : m_name(name), m_position(pos), m_dataType(dType), m_units(units),
39  m_indices(nc, i), m_nitems( nitems), m_ng(ng), m_is_null(nc,is_null)
40  {}
41 
42  std::string m_name;
43  char m_position;
45  std::string m_units;
46  std::vector<int32> m_indices;
47  int m_nitems;
48  int m_ng;
49  std::vector<bool> m_is_null;
50 };
51 
55 struct GridInfo_HDF4 {
57  inline GridInfo_HDF4(int32* size, int ng)
58  : m_name(":st0:"),
59  m_numElements(size[2] - 1
60  * std::max(int32(1), (size[1] - 1))
61  * std::max(int32(1), (size[0] - 1))),
62  m_numGhostElements(ng), m_index(FAIL)
63  { m_name[3] += (size[1] > 1 ? (size[0] > 1 ? 3 : 2) : 1);
64  m_size[0] = size[0]; m_size[1] = size[1]; m_size[2] = size[2]; }
65 
67  inline GridInfo_HDF4(std::string name, int ne, int ng, int32 i)
68  : m_name(name), m_numElements(ne), m_numGhostElements(ng), m_index(i)
69  { m_size[0] = 0; m_size[1] = 0; m_size[2] = 0; }
70 
71  int32 m_size[3];
72  std::string m_name;
75  int32 m_index;
76 };
77 
81 struct Block_HDF4 {
83  inline Block_HDF4(const std::string& file, const std::string& geomFile,
84  int32 indices[], int paneId, const std::string& time,
85  const std::string& units, int numNodes, int ghostNodes)
86  : m_file(file), m_geomFile(geomFile), m_paneId(paneId), time_level(time),
87  m_units(units), m_numNodes(numNodes), m_numGhostNodes(ghostNodes)
88  { m_indices[0] = indices[0]; m_indices[1] = indices[1];
89  m_indices[2] = indices[2]; }
90 
91  std::string m_file;
92  std::string m_geomFile;
93  int32 m_indices[3];
94  int m_paneId;
95  std::string time_level;
96  std::string m_units;
97  int m_numNodes;
99  std::vector<GridInfo_HDF4> m_gridInfo;
100  std::vector<VarInfo_HDF4> m_variables;
101 };
102 typedef std::multimap<std::string, Block_HDF4*> BlockMM_HDF4;
103 
104 #ifdef USE_CGNS
105 
109 struct VarInfo_CGNS {
111  VarInfo_CGNS(const std::string &name, char pos, COM_Type dType,
112  const std::string& units, int nc, int i, int nitems,
113  int ng, bool is_null)
114  : m_name(name), m_position(pos), m_dataType(dType), m_units(units),
115  m_indices(nc, i), m_nitems(nitems), m_ng(ng), m_is_null(nc,is_null)
116  {}
117 
118  std::string m_name;
119  char m_position;
120  COM_Type m_dataType;
121  std::string m_units;
122  std::vector<int> m_indices;
123  int m_nitems;
124  int m_ng;
125  std::vector<bool> m_is_null;
126 };
127 
131 struct GridInfo_CGNS {
133  inline GridInfo_CGNS(int* size, int cellDim, int ng)
134  : m_name(":st0:"), m_numElements(size[cellDim]),
135  m_numGhostElements(ng)
136  { m_name[3] += cellDim; m_size[0] = size[0]; m_size[1] = m_size[2] = 1;
137  if (cellDim > 1) { m_size[1] = size[1]; m_numElements *= size[cellDim+1];
138  if (cellDim > 2) { m_size[2] = size[2]; m_numElements *= size[5]; }
139  } }
140 
142  inline GridInfo_CGNS(std::string name, int ne, int ng)
143  : m_name(name), m_numElements(ne), m_numGhostElements(ng)
144  { m_size[0] = 0; m_size[1] = 0; m_size[2] = 0; }
145 
146  int m_size[3];
147  std::string m_name;
148  int m_numElements;
149  int m_numGhostElements;
150  // We don't really need to save the Element index, since we use all of
151  // them in the Zone.
152 };
153 
157 struct Block_CGNS {
159  inline Block_CGNS(const std::string& file, int B, int Z, int G, int paneId,
160  const std::string& time, const std::string& units,
161  int numNodes, int ghostNodes)
162  : m_file(file), m_B(B), m_Z(Z), m_G(G), m_W(0), m_P(0), m_C(0), m_E(0),
163  m_N(0), m_paneId(paneId), time_level(time), m_units(units),
164  m_numNodes(numNodes), m_numGhostNodes(ghostNodes)
165  {}
166 
167  std::string m_file;
168  int m_B;
169  int m_Z;
170  int m_G;
171  int m_W;
172  int m_P;
173  int m_C;
174  int m_E;
175  int m_N;
176  int m_paneId;
177  std::string time_level;
178  std::string m_units;
179  int m_numNodes;
180  int m_numGhostNodes;
181  std::vector<GridInfo_CGNS> m_gridInfo;
182  std::vector<VarInfo_CGNS> m_variables;
183 };
184 typedef std::multimap<std::string, Block_CGNS*> BlockMM_CGNS;
185 
186 #endif // USE_CGNS
187 
188 #endif
189 
190 
191 
192 
193 
194 
int m_numGhostElements
Number of ghost elements in a mesh.
Definition: rocin_block.h:74
int m_numGhostNodes
Number of ghost nodes in a mesh.
Definition: rocin_block.h:98
Struct containing necessary information on a mesh of a pane.
Definition: rocin_block.h:55
int COM_Type
Indices for derived data types.
Definition: roccom_basic.h:122
std::vector< int32 > m_indices
HDF4 dataset indices for each component.
Definition: rocin_block.h:46
Block_HDF4(const std::string &file, const std::string &geomFile, int32 indices[], int paneId, const std::string &time, const std::string &units, int numNodes, int ghostNodes)
Constructor for fast initialization.
Definition: rocin_block.h:83
int m_ng
Number of ghost items.
Definition: rocin_block.h:48
int m_numNodes
Number of nodes in the mesh.
Definition: rocin_block.h:97
std::vector< bool > m_is_null
Whether or not a component in NULL.
Definition: rocin_block.h:49
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
GridInfo_HDF4(std::string name, int ne, int ng, int32 i)
Constructor for quick initialization. Use for unstructured grids.
Definition: rocin_block.h:67
int32 m_indices[3]
HDF4 dataset indices of the nodal coordinates.
Definition: rocin_block.h:93
Struct containing necessary information for a pane.
Definition: rocin_block.h:81
std::string m_geomFile
External geometry file (may be empty).
Definition: rocin_block.h:92
char m_position
Location, &#39;w&#39;, &#39;p&#39;, &#39;n&#39;, or &#39;e&#39;.
Definition: rocin_block.h:43
std::vector< GridInfo_HDF4 > m_gridInfo
Dimensions or conn table(s)
Definition: rocin_block.h:99
GridInfo_HDF4(int32 *size, int ng)
Constructor for quick initialization. Use for structured grids.
Definition: rocin_block.h:57
int m_paneId
The pane id.
Definition: rocin_block.h:94
std::string m_file
Data file.
Definition: rocin_block.h:91
std::string m_name
Name of variable.
Definition: rocin_block.h:42
COM_Type m_dataType
Roccom datatype.
Definition: rocin_block.h:44
blockLoc i
Definition: read.cpp:79
std::string m_units
Units of measurement.
Definition: rocin_block.h:45
Struct containing necessary information about an attribute in a window.
Definition: rocin_block.h:33
VarInfo_HDF4(const std::string &name, char pos, COM_Type dType, const std::string &units, int nc, int32 i, int nitems, int ng, bool is_null)
Constructor for quick initialization.
Definition: rocin_block.h:35
std::string m_units
The mesh&#39;s units of measurement.
Definition: rocin_block.h:96
int m_nitems
Total number of items.
Definition: rocin_block.h:47
int m_numElements
Number of elements in a mesh.
Definition: rocin_block.h:73
std::string m_name
Grid name &quot;:st?:*&quot;, &quot;:t3:*&quot;, &quot;:B8:*&quot;, etc.
Definition: rocin_block.h:72
std::multimap< std::string, Block_HDF4 * > BlockMM_HDF4
Definition: rocin_block.h:102
unsigned long time()
Get the value of a system timer with a millisecond precision.
Definition: CImg.h:4605
int32 m_size[3]
Grid dimensions (structured only).
Definition: rocin_block.h:71
std::vector< VarInfo_HDF4 > m_variables
Info on each variable.
Definition: rocin_block.h:100
int32 m_index
HDF4 dataset index of conn table (unstr only).
Definition: rocin_block.h:75
std::string time_level
The dataset&#39;s time stamp.
Definition: rocin_block.h:95