IOSS  2.0
vtkExodusIIMultiBlockDataSet.h
Go to the documentation of this file.
1 /*
2  * Copyright(C) 2010-2017 National Technology & Engineering Solutions
3  * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
4  * NTESS, the U.S. Government retains certain rights in this software.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  *
18  * * Neither the name of NTESS nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 #ifndef __VTK_EXODUS_II_MULTI_BLOCK_DATA_SET_H
35 #define __VTK_EXODUS_II_MULTI_BLOCK_DATA_SET_H
36 
37 #include "vtkMultiBlockDataSet.h"
38 #include <map>
39 #include <string>
40 #include <vector>
41 
42 class vtkVariant;
43 class vtkPoints;
44 class Ve2mSideSetInfo;
45 
46 class vtkExodusIIMultiBlockDataSet : public vtkMultiBlockDataSet
47 {
48 public:
49  vtkTypeMacro(vtkExodusIIMultiBlockDataSet, vtkMultiBlockDataSet);
50  void PrintSelf(ostream &os, vtkIndent indent);
51 
53 
54  // Description:
55  // Initializes the element blocks to NULL data sets with ids in element_block_id_list.
56  // This method must be called first.
57  void InitializeElementBlocks(const std::vector<int> &element_block_id_list);
58 
59  // Description:
60  // Initializes the vtkMultiBlockDataSet with a global array of points
61  // defined by num_points, dimension (2,3), and data. Clears any existing data.
62  void InitializeGlobalPoints(int num_points, int dimension, const double *data);
63 
64  // Description:
65  // Clears all nodal and element variables from the vtkMultiBlockDataSet.
66  // Clears the global vtkPoints.
67  void ReleaseMemory();
68 
69  // Description:
70  // Creates a global variable on the vtkExodusIIMultiBlockDataSet.
71  // Input argument v must have the same type as the data
72  // contained in input the argument array data. Creates
73  // the global variable on all element blocks.
74  void CreateGlobalVariable(std::vector<std::string> &component_names, vtkVariant &v,
75  const void *data);
76 
77  // Description:
78  // Creates a vtkUnstructuredGrid on the vtkExodusIIMultiBlockDataSet
79  // that represents and element block in the Exodus II data. The global_points
80  // array contains all of the points in the Exodus II file.
81  void CreateElementBlock(const char *elem_block_name, int elem_block_id,
82  const std::string &elem_type, int nodes_per_elem, int num_elem,
83  vtkVariant &v, const int64_t *global_elem_ids, void *connectivity);
84 
85  // Description:
86  // Creates an element variable the vtkExodusIIMultiBlockDataSet.
87  void CreateElementVariable(std::vector<std::string> &component_names, int elem_block_id,
88  vtkVariant &v, const void *data);
89 
90  // Description:
91  // Creates a nodal variable the vtkExodusIIMultiBlockDataSet.
92  void CreateNodalVariable(std::vector<std::string> &component_names, vtkVariant &v,
93  const void *data);
94 
95  // Description:
96  // Creates a vtkUnstructuredGrid representing the node set in the Exodus II
97  // data. Node sets are arbitrary lists of mesh point ids.
98  void CreateNodeSet(const char *node_set_name, int node_set_id, int num_ids, vtkVariant &v,
99  const void *ids);
100 
101  // Description:
102  // Creates a vtkUnstructuredGrid representing the side set (also Side Block) in
103  // the Exodus II data. Side sets are collections of element faces and edges.
104  void CreateSideSet(/*const char* side_set_name,*/
105  const char *ss_owner_name, int side_set_id, int num_ids, vtkVariant &v,
106  const void *element_ids, const void *face_ids);
107 
108  // Description:
109  // If true (the default), vector variables will contain a
110  // trailing underscore in their name. The default behavior
111  // is consistent with the ParaView Exodus II file reader.
115 
116  // Description:
117  // If true (the default), displacements will be applied to the
118  // mesh nodes before being sent to the in-situ pipeline. The node
119  // displacement variable is called either DISPL or displ. The
120  // default behavior is consistent with the ParaView Exodus II
121  // file reader.
125 
126 protected:
129 
130 private:
131  vtkExodusIIMultiBlockDataSet(const vtkExodusIIMultiBlockDataSet &); // Not implemented.
132  void operator=(const vtkExodusIIMultiBlockDataSet &); // Not implemented.
133  std::map<int, std::map<int, int>> ebmap;
134  std::map<int, std::map<int, int>> ebmap_reverse;
135  std::map<int, std::map<int, int>> global_elem_id_map;
137  std::map<int, unsigned int> ebidmap;
138  std::map<int, unsigned int> nsidmap;
139  std::map<int, std::map<int, int>> nsmap;
140  std::map<int, unsigned int> ssidmap;
141 
142  // ssinfomap is used to help track when we see a new sideset. CreateSideSet
143  // is called once for each sideset for each block which the sideset spans,
144  // and we combine those into a single sideset entity in the vtk
145  // representation; also lets us do the necessary bookkeeping to combine
146  // the data from the different blocks into the same sideset
147  std::map<int, Ve2mSideSetInfo *> ssinfomap;
148 
149  std::map<int, std::map<int, int>> ssmap;
150  void ContainsVector(std::vector<std::string> &component_names,
151  std::vector<std::string> &prefix_name);
152  double GetArrayValue(vtkVariant &v, const void *data, int index);
153  void ReleaseGlobalPoints();
154  vtkPoints *global_points;
158  void CreateGlobalVariableInternal(std::vector<std::string> &component_names,
159  vtkMultiBlockDataSet *eb, unsigned int bid, vtkVariant &v,
160  const void *data);
161  void CreateNodalVariableInternal(std::vector<std::string> &component_names,
162  vtkMultiBlockDataSet *eb, std::map<int, unsigned int> &id_map,
163  std::map<int, std::map<int, int>> &point_map, vtkVariant &v,
164  const void *data);
165  void CreateElementVariableInternal(std::vector<std::string> &component_names,
166  vtkMultiBlockDataSet *eb, unsigned int bid, vtkVariant &v,
167  const void *data);
168  void ReleaseMemoryInternal(vtkMultiBlockDataSet *eb);
169 };
170 
171 // see ssinfomap above, lets us combine sidesets which span multiple
172 // blocks int a single sideset entity
174 {
175 public:
176  Ve2mSideSetInfo();
177  ~Ve2mSideSetInfo();
178 
179  int bid;
180  std::map<int, int> unique_points;
181  std::vector<int> object_ids;
182 };
183 
184 #endif /* __VTK_EXODUS_II_MULTI_BLOCK_DATA_SET_H */
void CreateNodalVariable(std::vector< std::string > &component_names, vtkVariant &v, const void *data)
std::map< int, int > unique_points
Definition: vtkExodusIIMultiBlockDataSet.h:180
void CreateNodeSet(const char *node_set_name, int node_set_id, int num_ids, vtkVariant &v, const void *ids)
void InitializeElementBlocks(const std::vector< int > &element_block_id_list)
void CreateNodalVariableInternal(std::vector< std::string > &component_names, vtkMultiBlockDataSet *eb, std::map< int, unsigned int > &id_map, std::map< int, std::map< int, int >> &point_map, vtkVariant &v, const void *data)
vtkBooleanMacro(UnderscoreVectors, int)
std::vector< int > object_ids
Definition: vtkExodusIIMultiBlockDataSet.h:181
std::map< int, std::map< int, int > > nsmap
Definition: vtkExodusIIMultiBlockDataSet.h:139
vtkPoints * global_points
Definition: vtkExodusIIMultiBlockDataSet.h:154
double GetArrayValue(vtkVariant &v, const void *data, int index)
std::map< int, std::map< int, int > > global_elem_id_map
Definition: vtkExodusIIMultiBlockDataSet.h:135
void CreateElementBlock(const char *elem_block_name, int elem_block_id, const std::string &elem_type, int nodes_per_elem, int num_elem, vtkVariant &v, const int64_t *global_elem_ids, void *connectivity)
void ContainsVector(std::vector< std::string > &component_names, std::vector< std::string > &prefix_name)
vtkSetMacro(UnderscoreVectors, int)
Definition: vtkExodusIIMultiBlockDataSet.h:46
void InitializeGlobalPoints(int num_points, int dimension, const double *data)
void CreateGlobalVariable(std::vector< std::string > &component_names, vtkVariant &v, const void *data)
vtkTypeMacro(vtkExodusIIMultiBlockDataSet, vtkMultiBlockDataSet)
int num_global_points
Definition: vtkExodusIIMultiBlockDataSet.h:155
void operator=(const vtkExodusIIMultiBlockDataSet &)
std::map< int, Ve2mSideSetInfo * > ssinfomap
Definition: vtkExodusIIMultiBlockDataSet.h:147
void CreateGlobalVariableInternal(std::vector< std::string > &component_names, vtkMultiBlockDataSet *eb, unsigned int bid, vtkVariant &v, const void *data)
Definition: vtkExodusIIMultiBlockDataSet.h:173
std::map< int, std::map< int, int > > ssmap
Definition: vtkExodusIIMultiBlockDataSet.h:149
std::map< int, std::map< int, int > > ebmap
Definition: vtkExodusIIMultiBlockDataSet.h:133
std::map< int, unsigned int > ssidmap
Definition: vtkExodusIIMultiBlockDataSet.h:140
void PrintSelf(ostream &os, vtkIndent indent)
std::map< int, std::map< int, int > > ebmap_reverse
Definition: vtkExodusIIMultiBlockDataSet.h:134
int ApplyDisplacements
Definition: vtkExodusIIMultiBlockDataSet.h:157
vtkGetMacro(UnderscoreVectors, int)
static vtkExodusIIMultiBlockDataSet * New()
void CreateSideSet(const char *ss_owner_name, int side_set_id, int num_ids, vtkVariant &v, const void *element_ids, const void *face_ids)
std::map< int, unsigned int > nsidmap
Definition: vtkExodusIIMultiBlockDataSet.h:138
void CreateElementVariable(std::vector< std::string > &component_names, int elem_block_id, vtkVariant &v, const void *data)
std::map< int, unsigned int > ebidmap
Definition: vtkExodusIIMultiBlockDataSet.h:137
int bid
Definition: vtkExodusIIMultiBlockDataSet.h:179
std::vector< int > global_point_id_to_global_elem_id
Definition: vtkExodusIIMultiBlockDataSet.h:136
std::vector< char > data
Definition: Ioss_Utils.C:78
void ReleaseMemoryInternal(vtkMultiBlockDataSet *eb)
void CreateElementVariableInternal(std::vector< std::string > &component_names, vtkMultiBlockDataSet *eb, unsigned int bid, vtkVariant &v, const void *data)
int UnderscoreVectors
Definition: vtkExodusIIMultiBlockDataSet.h:156