21 #ifndef vtkPEnSightReader_h 22 #define vtkPEnSightReader_h 42 class vtkPEnSightReaderCellIdsType;
44 #define NEXTMODULO3(x) (x == 0) ? 1 : ((x == 1) ? 2 : 0) 67 , cellLocalNumberOfIds(-1)
69 , ImplicitDimensions(nullptr)
70 , ImplicitLocalDimensions(nullptr)
71 , ImplicitSplitDimension(-1)
72 , ImplicitSplitDimensionBeginIndex(-1)
73 , ImplicitSplitDimensionEndIndex(-1)
81 , cellLocalNumberOfIds(-1)
83 , ImplicitDimensions(nullptr)
84 , ImplicitLocalDimensions(nullptr)
85 , ImplicitSplitDimension(-1)
86 , ImplicitSplitDimensionBeginIndex(-1)
87 , ImplicitSplitDimensionEndIndex(-1)
92 this->cellMap =
new IntIntMap;
93 this->cellNumberOfIds = 0;
94 this->cellVector =
nullptr;
98 this->ImplicitDimensions =
new int[3];
99 this->ImplicitSplitDimension = -1;
100 this->ImplicitSplitDimensionBeginIndex = -1;
101 this->ImplicitSplitDimensionEndIndex = -1;
105 this->cellMap =
nullptr;
106 this->cellVector =
new IntVector;
107 this->cellNumberOfIds = -1;
108 this->cellLocalNumberOfIds = -1;
114 delete this->cellMap;
115 delete this->cellVector;
116 delete[] this->ImplicitDimensions;
124 this->cellMap =
new IntIntMap;
125 this->cellNumberOfIds = 0;
126 this->cellVector =
nullptr;
130 this->ImplicitDimensions =
new int[3];
131 this->ImplicitSplitDimension = -1;
132 this->ImplicitSplitDimensionBeginIndex = -1;
133 this->ImplicitSplitDimensionEndIndex = -1;
137 this->cellMap =
nullptr;
138 this->cellVector =
new IntVector;
139 this->cellNumberOfIds = -1;
140 this->cellLocalNumberOfIds = -1;
146 this->ImplicitDimensions[0] = dim1;
147 this->ImplicitDimensions[1] = dim2;
148 this->ImplicitDimensions[2] = dim3;
155 this->ImplicitSplitDimensionBeginIndex = begin;
173 if (this->ImplicitSplitDimension == -1)
179 index[2] =
id / (this->ImplicitDimensions[0] * this->ImplicitDimensions[1]);
180 index[1] = (
id - (index[2] * this->ImplicitDimensions[0] * this->ImplicitDimensions[1])) /
181 this->ImplicitDimensions[0];
182 index[0] =
id - index[1] * this->ImplicitDimensions[0] -
183 index[2] * this->ImplicitDimensions[1] * this->ImplicitDimensions[0];
184 if ((index[this->ImplicitSplitDimension] < this->ImplicitSplitDimensionBeginIndex) ||
185 (index[this->ImplicitSplitDimension] >= this->ImplicitSplitDimensionEndIndex))
195 int dim = this->ImplicitSplitDimension;
196 localIndex[dim] = index[dim] - this->ImplicitSplitDimensionBeginIndex;
198 this->ImplicitSplitDimensionEndIndex - this->ImplicitSplitDimensionBeginIndex;
200 localIndex[dim] = index[dim];
201 localDim[dim] = this->ImplicitDimensions[dim];
203 localDim[dim] = this->ImplicitDimensions[dim];
204 localIndex[dim] = index[dim];
205 return localIndex[0] + localDim[0] * localIndex[1] +
206 localDim[0] * localDim[1] * localIndex[2];
211 std::map<int, int>::iterator it = this->cellMap->find(
id);
212 if (it == this->cellMap->end())
215 return (*this->cellMap)[id];
220 if (this->cellVector->size() > (
unsigned int)(
id))
221 return (*this->cellVector)[id];
241 std::map<int, int>::iterator it = this->cellMap->find(
id);
242 if (it == this->cellMap->end())
243 this->cellNumberOfIds++;
245 (*this->cellMap)[
id] = value;
250 if (this->cellVector->size() < (
unsigned int)(
id + 1))
253 int currentSize =
static_cast<int>(this->cellVector->size());
254 this->cellVector->resize(
id + 1);
255 for (k = currentSize; k < id; k++)
257 (*this->cellVector)[k] = -1;
259 (*this->cellVector)[
id] = value;
263 (*this->cellVector)[
id] = value;
286 (*this->cellMap)[this->cellNumberOfIds] =
id;
289 this->cellNumberOfIds++;
290 return this->cellNumberOfIds - 1;
295 this->cellVector->push_back(
id);
296 return static_cast<int>(this->cellVector->size() - 1);
300 return static_cast<int>(this->cellVector->size() - 1);
310 return this->cellNumberOfIds;
315 return this->cellNumberOfIds;
319 return this->cellNumberOfIds;
333 if (this->cellNumberOfIds >= 0)
335 return this->cellNumberOfIds;
338 return static_cast<int>(this->cellVector->size());
351 this->cellNumberOfIds = n;
365 this->cellLocalNumberOfIds = n;
373 this->cellMap->clear();
374 this->cellNumberOfIds = 0;
379 this->cellVector->clear();
380 if (this->cellNumberOfIds >= 0)
381 this->cellNumberOfIds = -1;
382 if (this->cellLocalNumberOfIds >= 0)
383 this->cellLocalNumberOfIds = -1;
394 return this->cellNumberOfIds;
399 return this->cellLocalNumberOfIds;
403 return static_cast<int>(this->cellMap->size());
413 if (this->cellLocalNumberOfIds >= 0)
415 return this->cellLocalNumberOfIds;
420 for (
unsigned int i = 0; i < this->cellVector->size(); i++)
422 if ((*this->cellVector)[i] != -1)
466 NUMBER_OF_ELEMENT_TYPES = 17
473 TENSOR_SYMM_PER_NODE = 2,
474 SCALAR_PER_ELEMENT = 3,
475 VECTOR_PER_ELEMENT = 4,
476 TENSOR_SYMM_PER_ELEMENT = 5,
477 SCALAR_PER_MEASURED_NODE = 6,
478 VECTOR_PER_MEASURED_NODE = 7,
479 COMPLEX_SCALAR_PER_NODE = 8,
480 COMPLEX_VECTOR_PER_NODE = 9,
481 COMPLEX_SCALAR_PER_ELEMENT = 10,
482 COMPLEX_VECTOR_PER_ELEMENT = 11
497 vtkGetStringMacro(MeasuredFileName);
505 vtkGetStringMacro(MatchFileName);
525 vtkSetStringMacro(MeasuredFileName);
532 vtkSetStringMacro(MatchFileName);
540 int ReadCaseFileGeometry(
char* line);
541 int ReadCaseFileVariable(
char* line);
542 int ReadCaseFileTime(
char* line);
543 int ReadCaseFileFile(
char* line);
552 virtual int ReadGeometryFile(
559 virtual int ReadMeasuredGeometryFile(
571 virtual int ReadScalarsPerNode(
const char* fileName,
const char* description,
int timeStep,
573 int component = 0) = 0;
579 virtual int ReadVectorsPerNode(
const char* fileName,
const char* description,
int timeStep,
586 virtual int ReadTensorsPerNode(
593 virtual int ReadScalarsPerElement(
const char* fileName,
const char* description,
int timeStep,
600 virtual int ReadVectorsPerElement(
607 virtual int ReadTensorsPerElement(
614 virtual int CreateUnstructuredGridOutput(
621 virtual int CreateStructuredGridOutput(
627 void AddVariableFileName(
const char* fileName1,
const char* fileName2 =
nullptr);
632 void AddVariableDescription(
const char* description);
637 void AddVariableType();
643 int GetElementType(
const char* line);
649 int GetSectionType(
const char* line);
654 void ReplaceWildcards(
char* filename,
int num);
659 void RemoveLeadingBlanks(
char* line);
671 vtkIdType GetTotalNumberOfCellIds(
int index);
672 vtkIdType GetLocalTotalNumberOfCellIds(
int index);
707 void InsertVariableComponent(
vtkFloatArray* array,
int i,
int component,
float* content,
708 int partId,
int ensightCellType,
int insertionType);
723 void PrepareStructuredDimensionsForDistribution(
int partId,
int* oldDimensions,
724 int* newDimensions,
int* splitDimension,
int* splitDimensionBeginIndex,
int ghostLevel,
784 vtkSetMacro(UseTimeSets,
int);
785 vtkGetMacro(UseTimeSets,
int);
786 vtkBooleanMacro(UseTimeSets,
int);
789 vtkSetMacro(UseFileSets,
int);
790 vtkGetMacro(UseFileSets,
int);
791 vtkBooleanMacro(UseFileSets,
int);
801 int CheckOutputConsistency();
void SetMode(EnsightReaderCellIdMode amode)
std::vector< int > IntVector
vtkPEnSightReaderCellIds(EnsightReaderCellIdMode amode)
void SetImplicitSplitDimensionEndIndex(int end)
vtkIdList * VariableTimeSetIds
EnsightReaderCellIdMode mode
Superclass for EnSight file parallel readers.
vtkIdList * TimeSetsWithFilenameNumbers
vtkIdList * ComplexVariableFileSetIds
int NumberOfGeometryParts
std::map< int, int > IntIntMap
int ImplicitSplitDimensionBeginIndex
void SetImplicitSplitDimensionBeginIndex(int begin)
char ** ComplexVariableFileNames
vtkIdList * UnstructuredPartIds
class to read any type of EnSight files
vtkPEnSightReaderCellIdsType * CellIds
void PrintSelf(ostream &os, vtkIndent indent) override
void SetImplicitSplitDimension(int dim)
void SetLocalNumberOfIds(int n)
vtkIdList * VariableFileSetIds
int GetLocalNumberOfIds()
int * ImplicitLocalDimensions
bool InjectGlobalElementIds
vtkPEnSightReaderCellIds()
vtkIdListCollection * FileSetFileNameNumbers
int ImplicitSplitDimensionEndIndex
void SetImplicitDimensions(int dim1, int dim2, int dim3)
~vtkPEnSightReaderCellIds()
char ** VariableFileNames
void SetId(int id, int value)
vtkIdListCollection * TimeSetFileNameNumbers
vtkIdList * ComplexVariableTimeSetIds
int ImplicitSplitDimension
void SetNumberOfIds(int n)
vtkIdListCollection * FileSetNumberOfSteps
#define VTKPVVTKEXTENSIONSIOENSIGHT_EXPORT
vtkIdList * StructuredPartIds
std::map< std::string, std::map< int, long > > FileOffsets
int NumberOfMeasuredPoints
vtkPEnSightReaderCellIdsType * PointIds
vtkIdList * FileSetsWithFilenameNumbers