VTK
vtkExodusIIWriter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkExodusIIWriter.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*----------------------------------------------------------------------------
16 Copyright (c) Sandia Corporation
17 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18----------------------------------------------------------------------------*/
19
71#ifndef vtkExodusIIWriter_h
72#define vtkExodusIIWriter_h
73
74#include "vtkIOExodusModule.h" // For export macro
75#include "vtkWriter.h"
76#include "vtkSmartPointer.h" // For vtkSmartPointer
77
78#include <vector> // STL Header
79#include <map> // STL Header
80#include <string> // STL Header
81
83class vtkDoubleArray;
84class vtkIntArray;
86
87class VTKIOEXODUS_EXPORT vtkExodusIIWriter : public vtkWriter
88{
89public:
92 void PrintSelf (ostream& os, vtkIndent indent);
93
105 vtkGetObjectMacro(ModelMetadata, vtkModelMetadata);
106
114 vtkSetStringMacro(FileName);
116
124 vtkSetMacro(StoreDoubles, int);
125 vtkGetMacro(StoreDoubles, int);
126
132 vtkSetMacro(GhostLevel, int);
133 vtkGetMacro(GhostLevel, int);
134
141 vtkSetMacro(WriteOutBlockIdArray, int);
142 vtkGetMacro(WriteOutBlockIdArray, int);
143 vtkBooleanMacro(WriteOutBlockIdArray, int);
144
151 vtkSetMacro(WriteOutGlobalNodeIdArray, int);
152 vtkGetMacro(WriteOutGlobalNodeIdArray, int);
153 vtkBooleanMacro(WriteOutGlobalNodeIdArray, int);
154
161 vtkSetMacro(WriteOutGlobalElementIdArray, int);
162 vtkGetMacro(WriteOutGlobalElementIdArray, int);
163 vtkBooleanMacro(WriteOutGlobalElementIdArray, int);
164
170 vtkSetMacro(WriteAllTimeSteps, int);
171 vtkGetMacro(WriteAllTimeSteps, int);
172 vtkBooleanMacro(WriteAllTimeSteps, int);
173
174 vtkSetStringMacro(BlockIdArrayName);
175 vtkGetStringMacro(BlockIdArrayName);
176
177protected:
180
182
184
185 char *FileName;
186 int fid;
187
190
192
200
205
207 std::vector< vtkSmartPointer<vtkUnstructuredGrid> > FlattenedInput;
208 std::vector< vtkSmartPointer<vtkUnstructuredGrid> > NewFlattenedInput;
209
210 std::vector< vtkStdString > FlattenedNames;
211 std::vector< vtkStdString > NewFlattenedNames;
212
213 std::vector< vtkIntArray* > BlockIdList;
214
215 struct Block
216 {
218 {
219 this->Name = 0;
220 this->Type = 0;
221 this->NumElements = 0;
222 this->ElementStartIndex = -1;
223 this->NodesPerElement = 0;
224 this->EntityCounts = std::vector<int>();
225 this->EntityNodeOffsets = std::vector<int>();
226 this->GridIndex = 0;
227 this->OutputIndex = -1;
228 this->NumAttributes = 0;
229 this->BlockAttributes = 0;
230 };
231 const char *Name;
232 int Type;
236 std::vector<int> EntityCounts;
237 std::vector<int> EntityNodeOffsets;
238 size_t GridIndex;
239 // std::vector<int> CellIndex;
242 float *BlockAttributes; // Owned by metamodel or null. Don't delete.
243 };
244 std::map<int, Block> BlockInfoMap;
245 int NumCells, NumPoints, MaxId;
246
247 std::vector<vtkIdType*> GlobalElementIdList;
248 std::vector<vtkIdType*> GlobalNodeIdList;
249
252
254 {
258 std::vector<std::string> OutNames;
259 };
260 std::map<std::string, VariableInfo> GlobalVariableMap;
261 std::map<std::string, VariableInfo> BlockVariableMap;
262 std::map<std::string, VariableInfo> NodeVariableMap;
266
267 std::vector< std::vector<int> > CellToElementOffset;
268
269 // By BlockId, and within block ID by element variable, with variables
270 // appearing in the same order in which they appear in OutputElementArrayNames
271
274
275 int BlockVariableTruthValue(int blockIdx, int varIdx);
276
277 char *StrDupWithNew (const char *s);
279
281 vtkInformationVector** inputVector,
282 vtkInformationVector* outputVector);
283
285 vtkInformationVector** inputVector,
286 vtkInformationVector* outputVector);
287
288 virtual int RequestUpdateExtent (vtkInformation* request,
289 vtkInformationVector** inputVector,
290 vtkInformationVector* outputVector);
291
293
295 vtkInformationVector** inputVector,
296 vtkInformationVector* outputVector);
297
298 void WriteData ();
299
300 int FlattenHierarchy (vtkDataObject* input, const char *name, bool& changed);
301
304
305 int IsDouble ();
307 int CheckParametersInternal (int NumberOfProcesses, int MyRank);
308 virtual int CheckParameters ();
309 // If writing in parallel multiple time steps exchange after each time step
310 // if we should continue the execution. Pass local continueExecution as a
311 // parameter and return the global continueExecution.
312 virtual int GlobalContinueExecuting(int localContinueExecution);
314 virtual void CheckBlockInfoMap();
319 char *GetCellTypeName (int t);
320
324
325 void ConvertVariableNames (std::map<std::string, VariableInfo>& variableMap);
327 int nScalarArrays,
328 const std::map<std::string, VariableInfo>& variableMap);
330 int component,
331 int numComponents);
332
333 std::map<vtkIdType, vtkIdType> *LocalNodeIdMap;
334 std::map<vtkIdType, vtkIdType> *LocalElementIdMap;
335
339
353 const char* BlockIdArrayName, vtkUnstructuredGrid* input);
354 static bool SameTypeOfCells (vtkIntArray* cellToBlockId,
355 vtkUnstructuredGrid* input);
356
357 double ExtractGlobalData (const char *name, int comp, int ts);
358 int WriteGlobalData (int timestep, vtkDataArray *buffer);
359 void ExtractCellData (const char *name, int comp, vtkDataArray *buffer);
360 int WriteCellData (int timestep, vtkDataArray *buffer);
361 void ExtractPointData (const char *name, int comp, vtkDataArray *buffer);
362 int WritePointData (int timestep, vtkDataArray *buffer);
363
364private:
365 vtkExodusIIWriter (const vtkExodusIIWriter&) VTK_DELETE_FUNCTION;
366 void operator= (const vtkExodusIIWriter&) VTK_DELETE_FUNCTION;
367};
368
369#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
general representation of visualization data
Definition: vtkDataObject.h:65
dynamic, self-adjusting array of double
Write Exodus II files.
int WriteSideSetInformation()
std::vector< vtkSmartPointer< vtkUnstructuredGrid > > NewFlattenedInput
std::vector< vtkIntArray * > BlockIdList
void StringUppercase(std::string &str)
vtkIntArray * GetBlockIdArray(const char *BlockIdArrayName, vtkUnstructuredGrid *input)
std::map< vtkIdType, vtkIdType > * LocalNodeIdMap
void SetModelMetadata(vtkModelMetadata *)
Specify the vtkModelMetadata object which contains the Exodus file model information (metadata) absen...
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
int WriteVariableArrayNames()
std::map< std::string, VariableInfo > BlockVariableMap
int WriteNodeSetInformation()
vtkIdType GetNodeLocalId(vtkIdType id)
int BlockVariableTruthValue(int blockIdx, int varIdx)
void ConvertVariableNames(std::map< std::string, VariableInfo > &variableMap)
virtual int GlobalContinueExecuting(int localContinueExecution)
static bool SameTypeOfCells(vtkIntArray *cellToBlockId, vtkUnstructuredGrid *input)
int GetElementType(vtkIdType id)
int CreateBlockVariableMetadata(vtkModelMetadata *em)
int FillInputPortInformation(int port, vtkInformation *info)
Fill the input port information objects for this algorithm.
std::vector< vtkStdString > FlattenedNames
int WriteBlockInformation()
int CheckParametersInternal(int NumberOfProcesses, int MyRank)
int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
char * StrDupWithNew(const char *s)
vtkDoubleArray * TimeValues
vtkModelMetadata * ModelMetadata
int WritePointData(int timestep, vtkDataArray *buffer)
vtkIdType GetElementLocalId(vtkIdType id)
virtual void CheckBlockInfoMap()
virtual int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int FlattenHierarchy(vtkDataObject *input, const char *name, bool &changed)
std::string CreateNameForScalarArray(const char *root, int component, int numComponents)
int WriteGlobalElementIds()
int CreateSetsMetadata(vtkModelMetadata *em)
vtkDataObject * OriginalInput
std::vector< vtkSmartPointer< vtkUnstructuredGrid > > FlattenedInput
std::map< std::string, VariableInfo > GlobalVariableMap
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int ConstructVariableInfoMaps()
std::map< std::string, VariableInfo > NodeVariableMap
double ExtractGlobalData(const char *name, int comp, int ts)
int ConstructBlockInfoMap()
int CreateDefaultMetadata()
int WriteCellData(int timestep, vtkDataArray *buffer)
int WriteInitializationParameters()
std::vector< vtkIdType * > GlobalNodeIdList
std::vector< vtkStdString > NewFlattenedNames
std::map< vtkIdType, vtkIdType > * LocalElementIdMap
char ** FlattenOutVariableNames(int nScalarArrays, const std::map< std::string, VariableInfo > &variableMap)
void ExtractPointData(const char *name, int comp, vtkDataArray *buffer)
std::vector< vtkIdType * > GlobalElementIdList
int * BlockElementVariableTruthTable
virtual int CheckParameters()
int WriteCoordinateNames()
static vtkExodusIIWriter * New()
void ExtractCellData(const char *name, int comp, vtkDataArray *buffer)
char * GetCellTypeName(int t)
std::map< int, Block > BlockInfoMap
int WriteGlobalData(int timestep, vtkDataArray *buffer)
std::vector< std::vector< int > > CellToElementOffset
int CreateBlockIdMetadata(vtkModelMetadata *em)
int WriteInformationRecords()
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:46
This class encapsulates the metadata that appear in mesh-based file formats but do not appear in vtkU...
dataset represents arbitrary combinations of all possible cell types
abstract class to write data to file(s)
Definition: vtkWriter.h:43
@ component
Definition: vtkX3D.h:175
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ name
Definition: vtkX3D.h:219
@ string
Definition: vtkX3D.h:490
std::vector< int > EntityNodeOffsets
std::vector< int > EntityCounts
std::vector< std::string > OutNames
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
int vtkIdType
Definition: vtkType.h:287