VTK  9.2.6
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
90#ifndef vtkExodusIIWriter_h
91#define vtkExodusIIWriter_h
92
93#include "vtkIOExodusModule.h" // For export macro
94#include "vtkSmartPointer.h" // For vtkSmartPointer
95#include "vtkWriter.h"
96
97#include <map> // STL Header
98#include <string> // STL Header
99#include <vector> // STL Header
100
101class vtkModelMetadata;
102class vtkDoubleArray;
103class vtkIntArray;
105
106class VTKIOEXODUS_EXPORT vtkExodusIIWriter : public vtkWriter
107{
108public:
111 void PrintSelf(ostream& os, vtkIndent indent) override;
112
124 vtkGetObjectMacro(ModelMetadata, vtkModelMetadata);
125
135
143 vtkSetMacro(StoreDoubles, int);
144 vtkGetMacro(StoreDoubles, int);
145
151 vtkSetMacro(GhostLevel, int);
152 vtkGetMacro(GhostLevel, int);
153
160 vtkSetMacro(WriteOutBlockIdArray, vtkTypeBool);
161 vtkGetMacro(WriteOutBlockIdArray, vtkTypeBool);
162 vtkBooleanMacro(WriteOutBlockIdArray, vtkTypeBool);
163
170 vtkSetMacro(WriteOutGlobalNodeIdArray, vtkTypeBool);
171 vtkGetMacro(WriteOutGlobalNodeIdArray, vtkTypeBool);
172 vtkBooleanMacro(WriteOutGlobalNodeIdArray, vtkTypeBool);
173
180 vtkSetMacro(WriteOutGlobalElementIdArray, vtkTypeBool);
181 vtkGetMacro(WriteOutGlobalElementIdArray, vtkTypeBool);
182 vtkBooleanMacro(WriteOutGlobalElementIdArray, vtkTypeBool);
183
189 vtkSetMacro(WriteAllTimeSteps, vtkTypeBool);
190 vtkGetMacro(WriteAllTimeSteps, vtkTypeBool);
191 vtkBooleanMacro(WriteAllTimeSteps, vtkTypeBool);
192
193 vtkSetStringMacro(BlockIdArrayName);
194 vtkGetStringMacro(BlockIdArrayName);
195
201 vtkSetMacro(IgnoreMetaDataWarning, bool);
202 vtkGetMacro(IgnoreMetaDataWarning, bool);
203 vtkBooleanMacro(IgnoreMetaDataWarning, bool);
204
205protected:
208
210
212
213 char* FileName;
214 int fid;
215
218
220
228
233
235 std::vector<vtkSmartPointer<vtkUnstructuredGrid>> FlattenedInput;
236 std::vector<vtkSmartPointer<vtkUnstructuredGrid>> NewFlattenedInput;
237
238 std::vector<vtkStdString> FlattenedNames;
239 std::vector<vtkStdString> NewFlattenedNames;
240
241 std::vector<vtkIntArray*> BlockIdList;
242
243 struct Block
244 {
246 {
247 this->Name = nullptr;
248 this->Type = 0;
249 this->NumElements = 0;
250 this->ElementStartIndex = -1;
251 this->NodesPerElement = 0;
252 this->EntityCounts = std::vector<int>();
253 this->EntityNodeOffsets = std::vector<int>();
254 this->GridIndex = 0;
255 this->OutputIndex = -1;
256 this->NumAttributes = 0;
257 this->BlockAttributes = nullptr;
258 };
259 const char* Name;
260 int Type;
264 std::vector<int> EntityCounts;
265 std::vector<int> EntityNodeOffsets;
266 size_t GridIndex;
267 // std::vector<int> CellIndex;
270 float* BlockAttributes; // Owned by metamodel or null. Don't delete.
271 };
272 std::map<int, Block> BlockInfoMap;
273 int NumCells, NumPoints, MaxId;
274
275 std::vector<vtkIdType*> GlobalElementIdList;
276 std::vector<vtkIdType*> GlobalNodeIdList;
277
280
282 {
286 std::vector<std::string> OutNames;
287 };
288 std::map<std::string, VariableInfo> GlobalVariableMap;
289 std::map<std::string, VariableInfo> BlockVariableMap;
290 std::map<std::string, VariableInfo> NodeVariableMap;
294
295 std::vector<std::vector<int>> CellToElementOffset;
296
297 // By BlockId, and within block ID by element variable, with variables
298 // appearing in the same order in which they appear in OutputElementArrayNames
299
302
303 int BlockVariableTruthValue(int blockIdx, int varIdx);
304
305 char* StrDupWithNew(const char* s);
307
309 vtkInformationVector* outputVector) override;
310
312 vtkInformationVector* outputVector);
313
314 virtual int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
315 vtkInformationVector* outputVector);
316
318
320 vtkInformationVector* outputVector) override;
321
322 void WriteData() override;
323
324 int FlattenHierarchy(vtkDataObject* input, const char* name, bool& changed);
325
328
329 int IsDouble();
331 int CheckParametersInternal(int numberOfProcesses, int myRank);
332 virtual int CheckParameters();
333 // If writing in parallel multiple time steps exchange after each time step
334 // if we should continue the execution. Pass local continueExecution as a
335 // parameter and return the global continueExecution.
336 virtual int GlobalContinueExecuting(int localContinueExecution);
338 virtual void CheckBlockInfoMap();
343 char* GetCellTypeName(int t);
344
348
349 void ConvertVariableNames(std::map<std::string, VariableInfo>& variableMap);
351 int nScalarArrays, const std::map<std::string, VariableInfo>& variableMap);
352 std::string CreateNameForScalarArray(const char* root, int component, int numComponents);
353
354 std::map<vtkIdType, vtkIdType>* LocalNodeIdMap;
355 std::map<vtkIdType, vtkIdType>* LocalElementIdMap;
356
360
373 vtkIntArray* GetBlockIdArray(const char* BlockIdArrayName, vtkUnstructuredGrid* input);
374 static bool SameTypeOfCells(vtkIntArray* cellToBlockId, vtkUnstructuredGrid* input);
375
376 double ExtractGlobalData(const char* name, int comp, int ts);
377 int WriteGlobalData(int timestep, vtkDataArray* buffer);
378 void ExtractCellData(const char* name, int comp, vtkDataArray* buffer);
379 int WriteCellData(int timestep, vtkDataArray* buffer);
380 void ExtractPointData(const char* name, int comp, vtkDataArray* buffer);
381 int WritePointData(int timestep, vtkDataArray* buffer);
382
387 virtual unsigned int GetMaxNameLength();
388
389private:
390 vtkExodusIIWriter(const vtkExodusIIWriter&) = delete;
391 void operator=(const vtkExodusIIWriter&) = delete;
392};
393
394#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
general representation of visualization data
dynamic, self-adjusting array of double
Write Exodus II files.
int WriteSideSetInformation()
std::vector< std::vector< int > > CellToElementOffset
void StringUppercase(std::string &str)
vtkIntArray * GetBlockIdArray(const char *BlockIdArrayName, vtkUnstructuredGrid *input)
std::map< vtkIdType, vtkIdType > * LocalNodeIdMap
~vtkExodusIIWriter() override
void SetModelMetadata(vtkModelMetadata *)
Specify the vtkModelMetadata object which contains the Exodus file model information (metadata) absen...
int WriteVariableArrayNames()
std::map< std::string, VariableInfo > BlockVariableMap
int WriteNodeSetInformation()
vtkIdType GetNodeLocalId(vtkIdType id)
int BlockVariableTruthValue(int blockIdx, int varIdx)
int CheckParametersInternal(int numberOfProcesses, int myRank)
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 WriteBlockInformation()
vtkTypeBool WriteAllTimeSteps
std::vector< vtkStdString > NewFlattenedNames
std::vector< vtkSmartPointer< vtkUnstructuredGrid > > NewFlattenedInput
char * StrDupWithNew(const char *s)
vtkModelMetadata * ModelMetadata
int WritePointData(int timestep, vtkDataArray *buffer)
vtkIdType GetElementLocalId(vtkIdType id)
virtual void CheckBlockInfoMap()
virtual int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
std::vector< vtkIntArray * > BlockIdList
vtkSetFilePathMacro(FileName)
Name for the output file.
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
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
vtkTypeBool WriteOutGlobalNodeIdArray
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)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int ConstructBlockInfoMap()
virtual unsigned int GetMaxNameLength()
Get the maximum length name in the input data set.
int CreateDefaultMetadata()
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
int WriteCellData(int timestep, vtkDataArray *buffer)
int WriteInitializationParameters()
std::vector< vtkIdType * > GlobalNodeIdList
std::vector< vtkSmartPointer< vtkUnstructuredGrid > > FlattenedInput
void WriteData() override
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()
vtkTypeBool WriteOutBlockIdArray
vtkGetFilePathMacro(FileName)
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)
int CreateBlockIdMetadata(vtkModelMetadata *em)
vtkTypeBool WriteOutGlobalElementIdArray
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
int WriteInformationRecords()
std::vector< vtkStdString > FlattenedNames
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:155
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:181
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496
std::vector< int > EntityNodeOffsets
std::vector< int > EntityCounts
std::vector< std::string > OutNames
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332