VTK
vtkModelMetadata.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkModelMetadata.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 
73 #ifndef vtkModelMetadata_h
74 #define vtkModelMetadata_h
75 
76 #include "vtkIOExodusModule.h" // For export macro
77 #include "vtkObject.h"
78 #include "vtkSmartPointer.h" // for vtkSmartPointer
79 #include "vtkStringArray.h" // for vtkStringArray
80 class vtkDataSet;
81 class vtkCharArray;
82 class vtkIdTypeArray;
83 class vtkIntArray;
84 class vtkFloatArray;
85 class vtkIntArray;
86 class vtkStringArray;
87 class vtkModelMetadataSTLCloak;
88 
89 class VTKIOEXODUS_EXPORT vtkModelMetadata : public vtkObject
90 {
91 public:
92  vtkTypeMacro(vtkModelMetadata, vtkObject);
93  void PrintSelf(ostream &os, vtkIndent indent) override;
94  static vtkModelMetadata *New();
95 
103  virtual void PrintGlobalInformation();
104 
118  virtual void PrintLocalInformation();
119 
121 
124  vtkSetStringMacro(Title);
125  const char *GetTitle() const {return this->Title;}
127 
131  void SetInformationLines(int numLines, char **lines);
132 
137  int GetInformationLines(char ***lines) const;
138 
143  return this->NumberOfInformationLines;}
144 
146 
152  vtkSetMacro(TimeStepIndex, int);
153  int GetTimeStepIndex() const {return this->TimeStepIndex;}
155 
161  void SetTimeSteps(int numberOfTimeSteps, float *timeStepValues);
162  int GetNumberOfTimeSteps() const {return this->NumberOfTimeSteps;}
163 
167  float *GetTimeStepValues() const {return this->TimeStepValues;}
168 
172  void SetCoordinateNames(int dimension, char **);
173  char **GetCoordinateNames() const {return this->CoordinateNames;}
174 
179  int GetDimension() const {return this->Dimension;}
180 
182 
186  vtkSetMacro(NumberOfBlocks, int);
187  int GetNumberOfBlocks() const {return this->NumberOfBlocks;}
189 
194  void SetBlockIds(int *);
195  int *GetBlockIds() const {return this->BlockIds;}
196 
202  void SetBlockElementType(char **);
203  char **GetBlockElementType() const {return this->BlockElementType;}
204 
210  int SetBlockNumberOfElements(int *nelts);
211  int *GetBlockNumberOfElements()const{return this->BlockNumberOfElements;}
212 
218  void SetBlockNodesPerElement(int *);
219  int *GetBlockNodesPerElement()const{return this->BlockNodesPerElement;}
220 
226  void SetBlockElementIdList(int *);
227  int *GetBlockElementIdList() const {return this->BlockElementIdList;}
228 
232  int GetSumElementsPerBlock() const {return this->SumElementsPerBlock;}
233 
238  int *GetBlockElementIdListIndex()const {return this->BlockElementIdListIndex;}
239 
245  int SetBlockNumberOfAttributesPerElement(int *natts);
246  int *GetBlockNumberOfAttributesPerElement()const {return this->BlockNumberOfAttributesPerElement;}
247 
254  void SetBlockAttributes(float *);
255  float *GetBlockAttributes()const {return this->BlockAttributes;}
256 
261  return this->SizeBlockAttributeArray;}
262 
267  int *GetBlockAttributesIndex() const {return this->BlockAttributesIndex;}
268 
270 
274  vtkSetMacro(NumberOfNodeSets, int);
275  int GetNumberOfNodeSets() const {return this->NumberOfNodeSets;}
277 
278  void SetNodeSetNames (vtkStringArray *names) { this->NodeSetNames = names; }
279  vtkStringArray* GetNodeSetNames() const { return this->NodeSetNames; }
280 
286  void SetNodeSetIds(int *);
287  int *GetNodeSetIds() const {return this->NodeSetIds;}
288 
293  void SetNodeSetSize(int *);
294  int *GetNodeSetSize() const {return this->NodeSetSize;}
295 
302  void SetNodeSetNodeIdList(int *);
303  int *GetNodeSetNodeIdList() const {return this->NodeSetNodeIdList;}
304 
312  void SetNodeSetNumberOfDistributionFactors(int *);
314  {return this->NodeSetNumberOfDistributionFactors;}
315 
321  void SetNodeSetDistributionFactors(float *);
323  return this->NodeSetDistributionFactors;}
324 
326 
329  vtkSetMacro(SumNodesPerNodeSet, int);
330  int GetSumNodesPerNodeSet() const {return this->SumNodesPerNodeSet;}
332 
336  int GetSumDistFactPerNodeSet() const {return this->SumDistFactPerNodeSet;}
337 
343  return this->NodeSetNodeIdListIndex;}
344 
350  return this->NodeSetDistributionFactorIndex;}
351 
353 
357  vtkSetMacro(NumberOfSideSets, int);
358  int GetNumberOfSideSets() const {return this->NumberOfSideSets;}
360 
361  void SetSideSetNames (vtkStringArray *names) { this->SideSetNames = names; }
362  vtkStringArray* GetSideSetNames() const { return this->SideSetNames; }
363 
368  void SetSideSetIds(int *);
369  int *GetSideSetIds() const {return this->SideSetIds;}
370 
375  int SetSideSetSize(int *sizes);
376  int *GetSideSetSize() const {return this->SideSetSize;}
377 
384  int SetSideSetNumberOfDistributionFactors(int *df);
386  return this->SideSetNumberOfDistributionFactors;}
387 
394  void SetSideSetElementList(int *);
395  int *GetSideSetElementList() const {return this->SideSetElementList;}
396 
404  void SetSideSetSideList(int *);
405  int *GetSideSetSideList() const {return this->SideSetSideList;}
406 
413  void SetSideSetNumDFPerSide(int *numNodes);
414  int *GetSideSetNumDFPerSide() const {return this->SideSetNumDFPerSide;}
415 
427  void SetSideSetDistributionFactors(float *);
429  return this->SideSetDistributionFactors;}
430 
432 
435  vtkSetMacro(SumSidesPerSideSet, int);
436  int GetSumSidesPerSideSet() const {return this->SumSidesPerSideSet;}
438 
442  int GetSumDistFactPerSideSet() const {return this->SumDistFactPerSideSet;}
443 
448  int *GetSideSetListIndex() const {return this->SideSetListIndex;}
449 
455  return this->SideSetDistributionFactorIndex;}
456 
461  return this->NumberOfBlockProperties;}
462 
466  void SetBlockPropertyNames(int numProp, char **names);
467  char **GetBlockPropertyNames() const {return this->BlockPropertyNames;}
468 
474  void SetBlockPropertyValue(int *);
475  int *GetBlockPropertyValue() const {return this->BlockPropertyValue;}
476 
481  return this->NumberOfNodeSetProperties;}
482 
486  void SetNodeSetPropertyNames(int numProp, char **names);
487  char **GetNodeSetPropertyNames() const {return this->NodeSetPropertyNames;}
488 
494  void SetNodeSetPropertyValue(int *);
495  int *GetNodeSetPropertyValue() const {return this->NodeSetPropertyValue;}
496 
501  return this->NumberOfSideSetProperties;}
502 
506  void SetSideSetPropertyNames(int numProp, char **names);
507  char **GetSideSetPropertyNames() const {return this->SideSetPropertyNames;}
508 
514  void SetSideSetPropertyValue(int *);
515  int *GetSideSetPropertyValue() const {return this->SideSetPropertyValue;}
516 
521  return this->NumberOfGlobalVariables;}
522 
526  void SetGlobalVariableNames(int numVarNames, char **n);
527  char **GetGlobalVariableNames() const {return this->GlobalVariableNames;}
528 
533  void SetGlobalVariableValue(float *f);
534  float *GetGlobalVariableValue() const {return this->GlobalVariableValue;}
535 
548  void SetElementVariableInfo(int numOrigNames, char **origNames,
549  int numNames, char **names, int *numComp,
550  int *map);
551 
564  void SetNodeVariableInfo(int numOrigNames, char **origNames,
565  int numNames, char **names, int *numComp,
566  int *map);
567 
574  void SetElementVariableTruthTable(int *);
576  return this->ElementVariableTruthTable;}
577 
579 
584  vtkSetMacro(AllVariablesDefinedInAllBlocks, vtkTypeBool);
585  vtkBooleanMacro(AllVariablesDefinedInAllBlocks, vtkTypeBool);
587  return this->AllVariablesDefinedInAllBlocks;}
589 
609  return this->OriginalNumberOfElementVariables;}
611  return this->OriginalElementVariableNames;}
613  return this->NumberOfElementVariables;}
614  char **GetElementVariableNames() const {
615  return this->ElementVariableNames;}
617  return this->ElementVariableNumberOfComponents;}
619  return this->MapToOriginalElementVariableNames;}
620 
622  return this->OriginalNumberOfNodeVariables;}
624  return this->OriginalNodeVariableNames;}
626  return this->NumberOfNodeVariables;}
627  char **GetNodeVariableNames() const {
628  return this->NodeVariableNames;}
630  return this->NodeVariableNumberOfComponents;}
632  return this->MapToOriginalNodeVariableNames;}
633 
635 
649  void FreeAllGlobalData();
650  void FreeAllLocalData();
651  void FreeBlockDependentData();
652  void FreeOriginalElementVariableNames();
653  void FreeOriginalNodeVariableNames();
654  void FreeUsedElementVariableNames();
655  void FreeUsedNodeVariableNames();
656  void FreeUsedElementVariables();
657  void FreeUsedNodeVariables();
659 
663  void Reset();
664 
665 protected:
667  ~vtkModelMetadata() override;
668 
669 private:
670  void InitializeAllMetadata();
671  void InitializeAllIvars();
672 
673  void FreeAllMetadata();
674  void FreeAllIvars();
675 
676  int BuildBlockElementIdListIndex();
677  int BuildBlockAttributesIndex();
678  int BuildSideSetDistributionFactorIndex();
679 
680  static char *StrDupWithNew(const char *s);
681 
682  static int FindNameOnList(char *name, char **list, int listLen);
683 
684  void ShowFloats(const char *what, int num, float *f);
685  void ShowLines(const char *what, int num, char **l);
686  void ShowIntArray(const char *what, int numx, int numy, int *id);
687  void ShowInts(const char *what, int num, int *id);
688  void ShowListsOfInts(const char *what, int *list,
689  int nlists, int *idx, int len, int verbose);
690  void ShowListsOfFloats(const char *what, float *list,
691  int nlists, int *idx, int len, int verbose);
692 
693  void SetOriginalElementVariableNames(int nvars, char **names);
694  void SetElementVariableNames(int nvars, char **names);
695  void SetElementVariableNumberOfComponents(int *comp);
696  void SetMapToOriginalElementVariableNames(int *map);
697 
698  void SetOriginalNodeVariableNames(int nvars, char **names);
699  void SetNodeVariableNames(int nvars, char **names);
700  void SetNodeVariableNumberOfComponents(int *comp);
701  void SetMapToOriginalNodeVariableNames(int *map);
702 
703  int CalculateMaximumLengths(int &maxString, int &maxLine);
704 
705  // Fields in Exodus II file and their size (defined in exodusII.h)
706  // (G - global fields, relevant to entire file or file set)
707  // (L - local fields, they differ depending on which cells and nodes are
708  // in a file of a partitioned set, or are read in from file)
709 
710  char *Title; // (G)
711 
712  int NumberOfInformationLines; // (G)
713  char **InformationLine; // (G)
714 
715  int Dimension; // (G)
716  char **CoordinateNames; // (at most 3 of these) (G)
717 
718  // Time steps
719 
720  int TimeStepIndex; // starting at 0 (Exodus file starts at 1)
721  int NumberOfTimeSteps; // (G)
722  float *TimeStepValues; // (G)
723 
724  // Block information - arrays that are input with Set*
725 
726  int NumberOfBlocks; // (G)
727 
728  int *BlockIds; // NumberOfBlocks (G) (start at 1)
729  char **BlockElementType; // NumberOfBlocks (G)
730  int *BlockNumberOfElements; // NumberOfBlocks (L)
731  int *BlockNodesPerElement; // NumberOfBlocks (G)
732  int *BlockNumberOfAttributesPerElement;// NumberOfBlocks (G)
733  int *BlockElementIdList; // SumElementsPerBlock (L)
734  float *BlockAttributes; // SizeBlockAttributeArray (L)
735 
736  // Block information - values that we calculate
737 
738  int SumElementsPerBlock;
739  int SizeBlockAttributeArray;
740 
741  int *BlockElementIdListIndex; // NumberOfBlocks
742  int *BlockAttributesIndex; // NumberOfBlocks
743 
744  vtkModelMetadataSTLCloak *BlockIdIndex; // computed map
745 
746  // Node Sets - arrays that are input to the class with Set*
747 
748  int NumberOfNodeSets; // (G)
749 
750  vtkSmartPointer<vtkStringArray> NodeSetNames;
751 
752  int *NodeSetIds; // NumberOfNodeSets (G)
753  int *NodeSetSize; // NumberOfNodeSets (L)
754  int *NodeSetNumberOfDistributionFactors; // NNS (L) (NSNDF[i] is 0 or NSS[i])
755  int *NodeSetNodeIdList; // SumNodesPerNodeSet (L)
756  float *NodeSetDistributionFactors; // SumDistFactPerNodeSet (L)
757 
758  // Node Sets - values or arrays that the class computes
759 
760  int SumNodesPerNodeSet;
761  int SumDistFactPerNodeSet;
762 
763  int *NodeSetNodeIdListIndex; // NumberOfNodeSets
764  int *NodeSetDistributionFactorIndex; // NumberOfNodeSets
765 
766  // Side Sets - input to class with Set*
767 
768  int NumberOfSideSets; // (G)
769 
770  vtkSmartPointer<vtkStringArray> SideSetNames;
771 
772  int *SideSetIds; // NumberOfSideSets (G)
773  int *SideSetSize; // NumberOfSideSets (L)
774  int *SideSetNumberOfDistributionFactors; // NSS (L) (SSNDF[i] = 0 or NumNodesInSide)
775  int *SideSetElementList; // SumSidesPerSideSet (L)
776  int *SideSetSideList; // SumSidesPerSideSet (L)
777  int *SideSetNumDFPerSide; // SumSidesPerSideSet (L)
778  float *SideSetDistributionFactors; // SumDistFactPerSideSet (L)
779 
780  // Side Sets - calculated by class
781 
782  int SumSidesPerSideSet;
783  int SumDistFactPerSideSet;
784 
785  int *SideSetListIndex; // NumberOfSideSets
786  int *SideSetDistributionFactorIndex; // NumberOfSideSets
787 
788  // Other properties, provided as input with Set*
789 
790  int NumberOfBlockProperties; // (G)
791  char **BlockPropertyNames; // one per property (G)
792  int *BlockPropertyValue; // NumBlocks * NumBlockProperties (G)
793 
794  int NumberOfNodeSetProperties; // (G)
795  char **NodeSetPropertyNames; // one per property (G)
796  int *NodeSetPropertyValue; // NumNodeSets * NumNodeSetProperties (G)
797 
798  int NumberOfSideSetProperties; // (G)
799  char **SideSetPropertyNames; // one per property (G)
800  int *SideSetPropertyValue; // NumSideSets * NumSideSetProperties (G)
801 
802  // Global variables, 1 value per time step per variable. We store
803  // these as floats, even if they are doubles in the file. The values
804  // are global in the sense that they apply to the whole data set, but
805  // the are local in the sense that they can change with each time step.
806  // For the purpose of this object, which represents a particular
807  // time step, they are therefore considered "local". (Since they need
808  // to be updated every time another read is done from the file.)
809 
810  int NumberOfGlobalVariables; // (G)
811  char **GlobalVariableNames; // (G) NumberOfGlobalVariables
812  float *GlobalVariableValue; // (G) NumberOfGlobalVariables
813 
814  // The element and node arrays in the file were all scalar arrays.
815  // Those with similar names were combined into vectors in VTK. Here
816  // are all the original names from the Exodus file, the names given
817  // the variables in the VTK ugrid, and a mapping from the VTK names
818  // to the Exodus names.
819 
820  int OriginalNumberOfElementVariables; // (G)
821  char **OriginalElementVariableNames; // (G) OriginalNumberOfElementVariables
822  int NumberOfElementVariables; // (G)
823  int MaxNumberOfElementVariables; // (G)
824  char **ElementVariableNames; // (G) MaxNumberOfElementVariables
825  int *ElementVariableNumberOfComponents; // (G) MaxNumberOfElementVariables
826  int *MapToOriginalElementVariableNames; // (G) MaxNumberOfElementVariables
827 
828  int OriginalNumberOfNodeVariables; // (G)
829  char **OriginalNodeVariableNames; // (G) OriginalNumberOfNodeVariables
830  int NumberOfNodeVariables; // (G)
831  int MaxNumberOfNodeVariables; // (G)
832  char **NodeVariableNames; // (G) NumberOfNodeVariables
833  int *NodeVariableNumberOfComponents; // (G) NumberOfNodeVariables
834  int *MapToOriginalNodeVariableNames; // (G) NumberOfNodeVariables
835 
836  int *ElementVariableTruthTable; // (G) NumBlocks*OrigNumberOfElementVariables
837  vtkTypeBool AllVariablesDefinedInAllBlocks;
838 
839 private:
840  vtkModelMetadata(const vtkModelMetadata&) = delete;
841  void operator=(const vtkModelMetadata&) = delete;
842 };
843 #endif
int * GetElementVariableNumberOfComponents() const
char ** GetOriginalNodeVariableNames() const
int * GetSideSetElementList() const
int * GetBlockElementIdList() const
int GetNumberOfTimeSteps() const
int GetNumberOfBlocks() const
The number of blocks in the file.
int GetSumDistFactPerNodeSet() const
Get the total number of distribution factors stored for all node sets.
int * GetNodeSetPropertyValue() const
abstract base class for most VTK objects
Definition: vtkObject.h:59
char ** GetElementVariableNames() const
int * GetSideSetDistributionFactorIndex() const
Get a list of the index of the starting entry for each side set in the list of side set distribution ...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetSizeBlockAttributeArray() const
Get the length of the list of floating point block attributes.
int * GetSideSetSize() const
int GetDimension() const
Get the dimension of the model.
int GetSumDistFactPerSideSet() const
Get the total number of distribution factors stored for all side sets.
char ** GetBlockElementType() const
float * GetBlockAttributes() const
float * GetNodeSetDistributionFactors() const
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
int GetOriginalNumberOfElementVariables() const
The ModelMetadata object may contain these lists: o the variables in the original data file o the var...
char ** GetOriginalElementVariableNames() const
int * GetBlockNodesPerElement() const
const char * GetTitle() const
The title of the dataset.
int GetNumberOfSideSets() const
Set or get the number of side sets.
int GetOriginalNumberOfNodeVariables() const
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
char ** GetCoordinateNames() const
int * GetNodeSetNumberOfDistributionFactors() const
int GetNumberOfBlockProperties() const
The number of block properties (global variables)
int GetNumberOfGlobalVariables() const
Get the number of global variables per time step.
a vtkAbstractArray subclass for strings
int GetSumSidesPerSideSet() const
Get the total number of sides in all side sets.
float * GetSideSetDistributionFactors() const
dynamic, self-adjusting array of vtkIdType
char ** GetNodeVariableNames() const
int GetSumNodesPerNodeSet() const
Get the total number of nodes in all node sets.
vtkTypeBool GetAllVariablesDefinedInAllBlocks() const
Instead of a truth table of all "1"s, you can set this instance variable to indicate that all variabl...
char ** GetGlobalVariableNames() const
int * GetNodeSetNodeIdList() const
int * GetBlockElementIdListIndex() const
Get a list of the index into the BlockElementIdList of the start of each block&#39;s elements.
int vtkTypeBool
Definition: vtkABI.h:69
int GetNumberOfNodeVariables() const
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:38
int * GetBlockIds() const
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
int * GetBlockPropertyValue() const
void SetSideSetNames(vtkStringArray *names)
char ** GetSideSetPropertyNames() const
a simple class to control print indentation
Definition: vtkIndent.h:39
int * GetSideSetNumDFPerSide() const
int * GetNodeSetIds() const
int GetNumberOfNodeSetProperties() const
The number of node set properties (global variables)
int * GetMapToOriginalElementVariableNames() const
int * GetNodeSetNodeIdListIndex() const
Get a list of the index of the starting entry for each node set in the list of node set node IDs...
float * GetTimeStepValues() const
Get the time step values.
int * GetNodeSetDistributionFactorIndex() const
Get a list of the index of the starting entry for each node set in the list of node set distribution ...
int * GetElementVariableTruthTable() const
int * GetBlockNumberOfAttributesPerElement() const
int * GetNodeSetSize() const
vtkStringArray * GetNodeSetNames() const
int GetNumberOfInformationLines() const
Get the number of information lines.
This class encapsulates the metadata that appear in mesh-based file formats but do not appear in vtkU...
char ** GetBlockPropertyNames() const
int * GetMapToOriginalNodeVariableNames() const
float * GetGlobalVariableValue() const
int GetTimeStepIndex() const
Set the index of the time step represented by the results data in the file attached to this ModelMeta...
int * GetSideSetPropertyValue() const
char ** GetNodeSetPropertyNames() const
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
int * GetSideSetSideList() const
int GetSumElementsPerBlock() const
Get the length of the list of elements in every block.
int GetNumberOfSideSetProperties() const
The number of side set properties (global variables)
int * GetBlockNumberOfElements() const
int * GetSideSetIds() const
int * GetSideSetListIndex() const
Get a list of the index of the starting entry for each side set in the list of side set side IDs...
int GetNumberOfNodeSets() const
The number of node sets in the file.
vtkStringArray * GetSideSetNames() const
int * GetSideSetNumberOfDistributionFactors() const
int GetNumberOfElementVariables() const
void SetNodeSetNames(vtkStringArray *names)
int * GetBlockAttributesIndex() const
Get a list of the index into the BlockAttributes of the start of each block&#39;s element attribute list...
int * GetNodeVariableNumberOfComponents() const