/usr/include/vtk-6.3/vtkExodusIIWriter.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkExodusIIWriter.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*----------------------------------------------------------------------------
Copyright (c) Sandia Corporation
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
----------------------------------------------------------------------------*/
// .NAME vtkExodusIIWriter - Write Exodus II files
// .SECTION Description
// This is a vtkWriter that writes it's vtkUnstructuredGrid
// input out to an Exodus II file. Go to http://endo.sandia.gov/SEACAS/
// for more information about the Exodus II format.
//
// Exodus files contain much information that is not captured
// in a vtkUnstructuredGrid, such as time steps, information
// lines, node sets, and side sets. This information can be
// stored in a vtkModelMetadata object.
//
// The vtkExodusReader and vtkPExodusReader can create
// a vtkModelMetadata object and embed it in a vtkUnstructuredGrid
// in a series of field arrays. This writer searches for these
// field arrays and will use the metadata contained in them
// when creating the new Exodus II file.
//
// You can also explicitly give the vtkExodusIIWriter a
// vtkModelMetadata object to use when writing the file.
//
// In the absence of the information provided by vtkModelMetadata,
// if this writer is not part of a parallel application, we will use
// reasonable defaults for all the values in the output Exodus file.
// If you don't provide a block ID element array, we'll create a
// block for each cell type that appears in the unstructured grid.
//
// However if this writer is part of a parallel application (hence
// writing out a distributed Exodus file), then we need at the very
// least a list of all the block IDs that appear in the file. And
// we need the element array of block IDs for the input unstructured grid.
//
// In the absence of a vtkModelMetadata object, you can also provide
// time step information which we will include in the output Exodus
// file.
//
// .SECTION Caveats
// If the input floating point field arrays and point locations are all
// floats or all doubles, this class will operate more efficiently.
// Mixing floats and doubles will slow you down, because Exodus II
// requires that we write only floats or only doubles.
//
// We use the terms "point" and "node" interchangeably.
// Also, we use the terms "element" and "cell" interchangeably.
#ifndef vtkExodusIIWriter_h
#define vtkExodusIIWriter_h
#include "vtkIOExodusModule.h" // For export macro
#include "vtkWriter.h"
#include "vtkSmartPointer.h" // For vtkSmartPointer
#include <vector> // STL Header
#include <map> // STL Header
#include <string> // STL Header
class vtkModelMetadata;
class vtkDoubleArray;
class vtkIntArray;
class vtkUnstructuredGrid;
class VTKIOEXODUS_EXPORT vtkExodusIIWriter : public vtkWriter
{
public:
static vtkExodusIIWriter *New ();
vtkTypeMacro(vtkExodusIIWriter,vtkWriter);
void PrintSelf (ostream& os, vtkIndent indent);
// Description:
// Specify the vtkModelMetadata object which contains the Exodus file
// model information (metadata) absent in the vtkUnstructuredGrid. If you
// have this object, you don't need to set any other values before writing.
// (Just the FileName and the Input.)
// Note that the vtkExodusReader can create and attach a vtkModelMetadata
// object to it's output. If this has happened, the ExodusIIWriter will
// find it and use it.
void SetModelMetadata (vtkModelMetadata*);
vtkGetObjectMacro(ModelMetadata, vtkModelMetadata);
// Description:
// Name for the output file. If writing in parallel, the number
// of processes and the process rank will be appended to the name,
// so each process is writing out a separate file.
// If not set, this class will make up a file name.
vtkSetStringMacro(FileName);
vtkGetStringMacro(FileName);
// Description:
// If StoreDoubles is ON, the floating point fields in the Exodus file
// will be double precision fields. The default is determined by the
// max precision of the input. If the field data appears to be doubles,
// then StoreDoubles will be ON, otherwise StoreDoubles will be OFF.
vtkSetMacro(StoreDoubles, int);
vtkGetMacro(StoreDoubles, int);
// Description:
// We never write out ghost cells. This variable is here to satisfy
// the behavior of ParaView on invoking a parallel writer.
vtkSetMacro(GhostLevel, int);
vtkGetMacro(GhostLevel, int);
// Description:
// By default, the integer array containing the global Block Ids of the
// cells is not included when the new Exodus II file is written out. If
// you do want to include this array, set WriteOutBlockIdArray to ON.
vtkSetMacro(WriteOutBlockIdArray, int);
vtkGetMacro(WriteOutBlockIdArray, int);
vtkBooleanMacro(WriteOutBlockIdArray, int);
// Description:
// By default, the integer array containing the global Node Ids
// is not included when the new Exodus II file is written out. If
// you do want to include this array, set WriteOutGlobalNodeIdArray to ON.
vtkSetMacro(WriteOutGlobalNodeIdArray, int);
vtkGetMacro(WriteOutGlobalNodeIdArray, int);
vtkBooleanMacro(WriteOutGlobalNodeIdArray, int);
// Description:
// By default, the integer array containing the global Element Ids
// is not included when the new Exodus II file is written out. If you
// do want to include this array, set WriteOutGlobalElementIdArray to ON.
vtkSetMacro(WriteOutGlobalElementIdArray, int);
vtkGetMacro(WriteOutGlobalElementIdArray, int);
vtkBooleanMacro(WriteOutGlobalElementIdArray, int);
// Description:
// When WriteAllTimeSteps is turned ON, the writer is executed once for
// each timestep available from the reader.
vtkSetMacro(WriteAllTimeSteps, int);
vtkGetMacro(WriteAllTimeSteps, int);
vtkBooleanMacro(WriteAllTimeSteps, int);
vtkSetStringMacro(BlockIdArrayName);
vtkGetStringMacro(BlockIdArrayName);
protected:
vtkExodusIIWriter ();
~vtkExodusIIWriter ();
vtkModelMetadata* ModelMetadata;
char *BlockIdArrayName;
char *FileName;
int fid;
int NumberOfProcesses;
int MyRank;
int PassDoubles;
int StoreDoubles;
int GhostLevel;
int WriteOutBlockIdArray;
int WriteOutGlobalNodeIdArray;
int WriteOutGlobalElementIdArray;
int WriteAllTimeSteps;
int NumberOfTimeSteps;
vtkDoubleArray* TimeValues;
int CurrentTimeIndex;
int FileTimeOffset;
bool TopologyChanged;
//BTX
vtkDataObject *OriginalInput;
std::vector< vtkSmartPointer<vtkUnstructuredGrid> > FlattenedInput;
std::vector< vtkSmartPointer<vtkUnstructuredGrid> > NewFlattenedInput;
std::vector< vtkIntArray* > BlockIdList;
struct Block
{
Block ()
{
this->Type = 0;
this->NumElements = 0;
this->ElementStartIndex = -1;
this->NodesPerElement = 0;
this->EntityCounts = std::vector<int>();
this->EntityNodeOffsets = std::vector<int>();
this->GridIndex = 0;
this->OutputIndex = -1;
this->NumAttributes = 0;
this->BlockAttributes = 0;
};
int Type;
int NumElements;
int ElementStartIndex;
int NodesPerElement;
std::vector<int> EntityCounts;
std::vector<int> EntityNodeOffsets;
size_t GridIndex;
// std::vector<int> CellIndex;
int OutputIndex;
int NumAttributes;
float *BlockAttributes; // Owned by metamodel or null. Don't delete.
};
std::map<int, Block> BlockInfoMap;
int NumCells, NumPoints, MaxId;
std::vector<vtkIdType*> GlobalElementIdList;
std::vector<vtkIdType*> GlobalNodeIdList;
//ETX
int AtLeastOneGlobalElementIdList;
int AtLeastOneGlobalNodeIdList;
//BTX
struct VariableInfo
{
int NumComponents;
int InIndex;
int ScalarOutOffset;
std::vector<std::string> OutNames;
};
std::map<std::string, VariableInfo> GlobalVariableMap;
std::map<std::string, VariableInfo> BlockVariableMap;
std::map<std::string, VariableInfo> NodeVariableMap;
int NumberOfScalarGlobalArrays;
int NumberOfScalarElementArrays;
int NumberOfScalarNodeArrays;
//ETX
//BTX
std::vector< std::vector<int> > CellToElementOffset;
//ETX
// By BlockId, and within block ID by element variable, with variables
// appearing in the same order in which they appear in OutputElementArrayNames
int *BlockElementVariableTruthTable;
int AllVariablesDefinedInAllBlocks;
int BlockVariableTruthValue(int blockIdx, int varIdx);
//BTX
char *StrDupWithNew (const char *s);
void StringUppercase (std::string& str);
//ETX
int ProcessRequest (vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int RequestInformation (vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
virtual int RequestUpdateExtent (vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int FillInputPortInformation (int port, vtkInformation* info);
int RequestData (vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
void WriteData ();
int FlattenHierarchy (vtkDataObject* input, bool& changed);
int CreateNewExodusFile ();
void CloseExodusFile ();
int IsDouble ();
void RemoveGhostCells ();
int CheckParametersInternal (int NumberOfProcesses, int MyRank);
virtual int CheckParameters ();
// If writing in parallel multiple time steps exchange after each time step
// if we should continue the execution. Pass local continueExecution as a
// parameter and return the global continueExecution.
virtual int GlobalContinueExecuting(int localContinueExecution);
int CheckInputArrays ();
virtual void CheckBlockInfoMap();
int ConstructBlockInfoMap ();
int ConstructVariableInfoMaps ();
int ParseMetadata ();
int CreateDefaultMetadata ();
char *GetCellTypeName (int t);
int CreateBlockIdMetadata(vtkModelMetadata *em);
int CreateBlockVariableMetadata (vtkModelMetadata* em);
int CreateSetsMetadata (vtkModelMetadata* em);
//BTX
void ConvertVariableNames (std::map<std::string, VariableInfo>& variableMap);
char **FlattenOutVariableNames (
int nScalarArrays,
const std::map<std::string, VariableInfo>& variableMap);
std::string CreateNameForScalarArray (const char *root,
int component,
int numComponents);
std::map<vtkIdType, vtkIdType> *LocalNodeIdMap;
std::map<vtkIdType, vtkIdType> *LocalElementIdMap;
//ETX
vtkIdType GetNodeLocalId(vtkIdType id);
vtkIdType GetElementLocalId(vtkIdType id);
int GetElementType(vtkIdType id);
int WriteInitializationParameters ();
int WriteInformationRecords ();
int WritePoints ();
int WriteCoordinateNames ();
int WriteGlobalPointIds ();
int WriteBlockInformation ();
int WriteGlobalElementIds ();
int WriteVariableArrayNames ();
int WriteNodeSetInformation ();
int WriteSideSetInformation ();
int WriteProperties ();
int WriteNextTimeStep ();
vtkIntArray* GetBlockIdArray (
const char* BlockIdArrayName, vtkUnstructuredGrid* input);
static bool SameTypeOfCells (vtkIntArray* cellToBlockId,
vtkUnstructuredGrid* input);
//BTX
double ExtractGlobalData (const char *name, int comp, int ts);
int WriteGlobalData (int timestep, vtkDataArray *buffer);
void ExtractCellData (const char *name, int comp, vtkDataArray *buffer);
int WriteCellData (int timestep, vtkDataArray *buffer);
void ExtractPointData (const char *name, int comp, vtkDataArray *buffer);
int WritePointData (int timestep, vtkDataArray *buffer);
//ETX
private:
vtkExodusIIWriter (const vtkExodusIIWriter&); // Not Implemented
void operator= (const vtkExodusIIWriter&); // Not Implemented
};
#endif
|