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 
72 #ifndef vtkModelMetadata_h
73 #define vtkModelMetadata_h
74 
75 #include "vtkIOExodusModule.h" // For export macro
76 #include "vtkObject.h"
77 
78 class vtkDataSet;
79 class vtkCharArray;
80 class vtkIdTypeArray;
81 class vtkIntArray;
82 class vtkFloatArray;
83 class vtkIntArray;
84 class vtkModelMetadataSTLCloak;
85 
87 {
88 public:
89  vtkTypeMacro(vtkModelMetadata, vtkObject);
90  virtual void PrintSelf(ostream &os, vtkIndent indent);
91  static vtkModelMetadata *New();
92 
97  virtual void PrintGlobalInformation();
98 
109  virtual void PrintLocalInformation();
110 
112 
113  vtkSetStringMacro(Title);
114  const char *GetTitle() const {return this->Title;}
116 
118  void SetInformationLines(int numLines, char **lines);
119 
122  int GetInformationLines(char ***lines) const;
123 
125 
127  return this->NumberOfInformationLines;}
129 
131 
134  vtkSetMacro(TimeStepIndex, int);
135  int GetTimeStepIndex() const {return this->TimeStepIndex;}
137 
139 
142  void SetTimeSteps(int numberOfTimeSteps, float *timeStepValues);
143  int GetNumberOfTimeSteps() const {return this->NumberOfTimeSteps;}
145 
147  float *GetTimeStepValues() const {return this->TimeStepValues;}
148 
150 
151  void SetCoordinateNames(int dimension, char **);
152  char **GetCoordinateNames() const {return this->CoordinateNames;}
154 
157  int GetDimension() const {return this->Dimension;}
158 
160 
162  vtkSetMacro(NumberOfBlocks, int);
163  int GetNumberOfBlocks() const {return this->NumberOfBlocks;}
165 
167 
169  void SetBlockIds(int *);
170  int *GetBlockIds() const {return this->BlockIds;}
172 
174 
177  void SetBlockElementType(char **);
178  char **GetBlockElementType() const {return this->BlockElementType;}
180 
182 
185  int SetBlockNumberOfElements(int *nelts);
186  int *GetBlockNumberOfElements()const{return this->BlockNumberOfElements;}
188 
190 
193  void SetBlockNodesPerElement(int *);
194  int *GetBlockNodesPerElement()const{return this->BlockNodesPerElement;}
196 
198 
201  void SetBlockElementIdList(int *);
202  int *GetBlockElementIdList() const {return this->BlockElementIdList;}
204 
206  int GetSumElementsPerBlock() const {return this->SumElementsPerBlock;}
207 
210  int *GetBlockElementIdListIndex()const {return this->BlockElementIdListIndex;}
211 
213 
216  int SetBlockNumberOfAttributesPerElement(int *natts);
217  int *GetBlockNumberOfAttributesPerElement()const {return this->BlockNumberOfAttributesPerElement;}
219 
221 
224  void SetBlockAttributes(float *);
225  float *GetBlockAttributes()const {return this->BlockAttributes;}
227 
229 
231  return this->SizeBlockAttributeArray;}
233 
236  int *GetBlockAttributesIndex() const {return this->BlockAttributesIndex;}
237 
239 
241  vtkSetMacro(NumberOfNodeSets, int);
242  int GetNumberOfNodeSets() const {return this->NumberOfNodeSets;}
244 
246 
249  void SetNodeSetIds(int *);
250  int *GetNodeSetIds() const {return this->NodeSetIds;}
252 
254 
257  void SetNodeSetSize(int *);
258  int *GetNodeSetSize() const {return this->NodeSetSize;}
260 
262 
266  void SetNodeSetNodeIdList(int *);
267  int *GetNodeSetNodeIdList() const {return this->NodeSetNodeIdList;}
269 
271 
275  void SetNodeSetNumberOfDistributionFactors(int *);
277  {return this->NodeSetNumberOfDistributionFactors;}
279 
281 
284  void SetNodeSetDistributionFactors(float *);
286  return this->NodeSetDistributionFactors;}
288 
290 
291  vtkSetMacro(SumNodesPerNodeSet, int);
292  int GetSumNodesPerNodeSet() const {return this->SumNodesPerNodeSet;}
294 
296  int GetSumDistFactPerNodeSet() const {return this->SumDistFactPerNodeSet;}
297 
299 
302  return this->NodeSetNodeIdListIndex;}
304 
306 
309  return this->NodeSetDistributionFactorIndex;}
311 
313 
315  vtkSetMacro(NumberOfSideSets, int);
316  int GetNumberOfSideSets() const {return this->NumberOfSideSets;}
318 
320 
322  void SetSideSetIds(int *);
323  int *GetSideSetIds() const {return this->SideSetIds;}
325 
327 
330  int SetSideSetSize(int *sizes);
331  int *GetSideSetSize() const {return this->SideSetSize;}
333 
335 
339  int SetSideSetNumberOfDistributionFactors(int *df);
341  return this->SideSetNumberOfDistributionFactors;}
343 
345 
349  void SetSideSetElementList(int *);
350  int *GetSideSetElementList() const {return this->SideSetElementList;}
352 
354 
359  void SetSideSetSideList(int *);
360  int *GetSideSetSideList() const {return this->SideSetSideList;}
362 
364 
368  void SetSideSetNumDFPerSide(int *numNodes);
369  int *GetSideSetNumDFPerSide() const {return this->SideSetNumDFPerSide;}
371 
373 
381  void SetSideSetDistributionFactors(float *);
383  return this->SideSetDistributionFactors;}
385 
387 
388  vtkSetMacro(SumSidesPerSideSet, int);
389  int GetSumSidesPerSideSet() const {return this->SumSidesPerSideSet;}
391 
393  int GetSumDistFactPerSideSet() const {return this->SumDistFactPerSideSet;}
394 
397  int *GetSideSetListIndex() const {return this->SideSetListIndex;}
398 
400 
403  return this->SideSetDistributionFactorIndex;}
405 
407 
409  return this->NumberOfBlockProperties;}
411 
413 
414  void SetBlockPropertyNames(int numProp, char **names);
415  char **GetBlockPropertyNames() const {return this->BlockPropertyNames;}
417 
419 
421  void SetBlockPropertyValue(int *);
422  int *GetBlockPropertyValue() const {return this->BlockPropertyValue;}
424 
426 
428  return this->NumberOfNodeSetProperties;}
430 
432 
433  void SetNodeSetPropertyNames(int numProp, char **names);
434  char **GetNodeSetPropertyNames() const {return this->NodeSetPropertyNames;}
436 
438 
440  void SetNodeSetPropertyValue(int *);
441  int *GetNodeSetPropertyValue() const {return this->NodeSetPropertyValue;}
443 
445 
447  return this->NumberOfSideSetProperties;}
449 
451 
452  void SetSideSetPropertyNames(int numProp, char **names);
453  char **GetSideSetPropertyNames() const {return this->SideSetPropertyNames;}
455 
457 
459  void SetSideSetPropertyValue(int *);
460  int *GetSideSetPropertyValue() const {return this->SideSetPropertyValue;}
462 
464 
466  return this->NumberOfGlobalVariables;}
468 
470 
471  void SetGlobalVariableNames(int numVarNames, char **n);
472  char **GetGlobalVariableNames() const {return this->GlobalVariableNames;}
474 
476 
478  void SetGlobalVariableValue(float *f);
479  float *GetGlobalVariableValue() const {return this->GlobalVariableValue;}
481 
483 
492  void SetElementVariableInfo(int numOrigNames, char **origNames,
493  int numNames, char **names, int *numComp,
494  int *map);
496 
498 
507  void SetNodeVariableInfo(int numOrigNames, char **origNames,
508  int numNames, char **names, int *numComp,
509  int *map);
511 
513 
517  void SetElementVariableTruthTable(int *);
519  return this->ElementVariableTruthTable;}
521 
523 
525  vtkSetMacro(AllVariablesDefinedInAllBlocks, int);
526  vtkBooleanMacro(AllVariablesDefinedInAllBlocks, int);
528  return this->AllVariablesDefinedInAllBlocks;}
530 
532 
545  return this->OriginalNumberOfElementVariables;}
547  return this->OriginalElementVariableNames;}
549  return this->NumberOfElementVariables;}
550  char **GetElementVariableNames() const {
551  return this->ElementVariableNames;}
553  return this->ElementVariableNumberOfComponents;}
555  return this->MapToOriginalElementVariableNames;}
557 
559  return this->OriginalNumberOfNodeVariables;}
561  return this->OriginalNodeVariableNames;}
563  return this->NumberOfNodeVariables;}
564  char **GetNodeVariableNames() const {
565  return this->NodeVariableNames;}
567  return this->NodeVariableNumberOfComponents;}
569  return this->MapToOriginalNodeVariableNames;}
570 
572 
581  void FreeAllGlobalData();
582  void FreeAllLocalData();
583  void FreeBlockDependentData();
584  void FreeOriginalElementVariableNames();
585  void FreeOriginalNodeVariableNames();
586  void FreeUsedElementVariableNames();
587  void FreeUsedNodeVariableNames();
588  void FreeUsedElementVariables();
589  void FreeUsedNodeVariables();
591 
593  void Reset();
594 
595 protected:
597  ~vtkModelMetadata();
598 
599 private:
600  void InitializeAllMetadata();
601  void InitializeAllIvars();
602 
603  void FreeAllMetadata();
604  void FreeAllIvars();
605 
606  int BuildBlockElementIdListIndex();
607  int BuildBlockAttributesIndex();
608  int BuildSideSetDistributionFactorIndex();
609 
610  static char *StrDupWithNew(const char *s);
611 
612  static int FindNameOnList(char *name, char **list, int listLen);
613 
614  void ShowFloats(const char *what, int num, float *f);
615  void ShowLines(const char *what, int num, char **l);
616  void ShowIntArray(const char *what, int numx, int numy, int *id);
617  void ShowInts(const char *what, int num, int *id);
618  void ShowListsOfInts(const char *what, int *list,
619  int nlists, int *idx, int len, int verbose);
620  void ShowListsOfFloats(const char *what, float *list,
621  int nlists, int *idx, int len, int verbose);
622 
623  void SetOriginalElementVariableNames(int nvars, char **names);
624  void SetElementVariableNames(int nvars, char **names);
625  void SetElementVariableNumberOfComponents(int *comp);
626  void SetMapToOriginalElementVariableNames(int *map);
627 
628  void SetOriginalNodeVariableNames(int nvars, char **names);
629  void SetNodeVariableNames(int nvars, char **names);
630  void SetNodeVariableNumberOfComponents(int *comp);
631  void SetMapToOriginalNodeVariableNames(int *map);
632 
633  int CalculateMaximumLengths(int &maxString, int &maxLine);
634 
635  // Fields in Exodus II file and their size (defined in exodusII.h)
636  // (G - global fields, relevant to entire file or file set)
637  // (L - local fields, they differ depending on which cells and nodes are
638  // in a file of a partitioned set, or are read in from file)
639 
640  char *Title; // (G)
641 
642  int NumberOfInformationLines; // (G)
643  char **InformationLine; // (G)
644 
645  int Dimension; // (G)
646  char **CoordinateNames; // (at most 3 of these) (G)
647 
648  // Time steps
649 
650  int TimeStepIndex; // starting at 0 (Exodus file starts at 1)
651  int NumberOfTimeSteps; // (G)
652  float *TimeStepValues; // (G)
653 
654  // Block information - arrays that are input with Set*
655 
656  int NumberOfBlocks; // (G)
657 
658  int *BlockIds; // NumberOfBlocks (G) (start at 1)
659  char **BlockElementType; // NumberOfBlocks (G)
660  int *BlockNumberOfElements; // NumberOfBlocks (L)
661  int *BlockNodesPerElement; // NumberOfBlocks (G)
662  int *BlockNumberOfAttributesPerElement;// NumberOfBlocks (G)
663  int *BlockElementIdList; // SumElementsPerBlock (L)
664  float *BlockAttributes; // SizeBlockAttributeArray (L)
665 
666  // Block information - values that we calculate
667 
668  int SumElementsPerBlock;
669  int SizeBlockAttributeArray;
670 
671  int *BlockElementIdListIndex; // NumberOfBlocks
672  int *BlockAttributesIndex; // NumberOfBlocks
673 
674  vtkModelMetadataSTLCloak *BlockIdIndex; // computed map
675 
676  // Node Sets - arrays that are input to the class with Set*
677 
678  int NumberOfNodeSets; // (G)
679 
680  int *NodeSetIds; // NumberOfNodeSets (G)
681  int *NodeSetSize; // NumberOfNodeSets (L)
682  int *NodeSetNumberOfDistributionFactors; // NNS (L) (NSNDF[i] is 0 or NSS[i])
683  int *NodeSetNodeIdList; // SumNodesPerNodeSet (L)
684  float *NodeSetDistributionFactors; // SumDistFactPerNodeSet (L)
685 
686  // Node Sets - values or arrays that the class computes
687 
688  int SumNodesPerNodeSet;
689  int SumDistFactPerNodeSet;
690 
691  int *NodeSetNodeIdListIndex; // NumberOfNodeSets
692  int *NodeSetDistributionFactorIndex; // NumberOfNodeSets
693 
694  // Side Sets - input to class with Set*
695 
696  int NumberOfSideSets; // (G)
697 
698  int *SideSetIds; // NumberOfSideSets (G)
699  int *SideSetSize; // NumberOfSideSets (L)
700  int *SideSetNumberOfDistributionFactors; // NSS (L) (SSNDF[i] = 0 or NumNodesInSide)
701  int *SideSetElementList; // SumSidesPerSideSet (L)
702  int *SideSetSideList; // SumSidesPerSideSet (L)
703  int *SideSetNumDFPerSide; // SumSidesPerSideSet (L)
704  float *SideSetDistributionFactors; // SumDistFactPerSideSet (L)
705 
706  // Side Sets - calculated by class
707 
708  int SumSidesPerSideSet;
709  int SumDistFactPerSideSet;
710 
711  int *SideSetListIndex; // NumberOfSideSets
712  int *SideSetDistributionFactorIndex; // NumberOfSideSets
713 
714  // Other properties, provided as input with Set*
715 
716  int NumberOfBlockProperties; // (G)
717  char **BlockPropertyNames; // one per property (G)
718  int *BlockPropertyValue; // NumBlocks * NumBlockProperties (G)
719 
720  int NumberOfNodeSetProperties; // (G)
721  char **NodeSetPropertyNames; // one per property (G)
722  int *NodeSetPropertyValue; // NumNodeSets * NumNodeSetProperties (G)
723 
724  int NumberOfSideSetProperties; // (G)
725  char **SideSetPropertyNames; // one per property (G)
726  int *SideSetPropertyValue; // NumSideSets * NumSideSetProperties (G)
727 
728  // Global variables, 1 value per time step per variable. We store
729  // these as floats, even if they are doubles in the file. The values
730  // are global in the sense that they apply to the whole data set, but
731  // the are local in the sense that they can change with each time step.
732  // For the purpose of this object, which represents a particular
733  // time step, they are therefore considered "local". (Since they need
734  // to be updated every time another read is done from the file.)
735 
736  int NumberOfGlobalVariables; // (G)
737  char **GlobalVariableNames; // (G) NumberOfGlobalVariables
738  float *GlobalVariableValue; // (G) NumberOfGlobalVariables
739 
740  // The element and node arrays in the file were all scalar arrays.
741  // Those with similar names were combined into vectors in VTK. Here
742  // are all the original names from the Exodus file, the names given
743  // the variables in the VTK ugrid, and a mapping from the VTK names
744  // to the Exodus names.
745 
746  int OriginalNumberOfElementVariables; // (G)
747  char **OriginalElementVariableNames; // (G) OriginalNumberOfElementVariables
748  int NumberOfElementVariables; // (G)
749  int MaxNumberOfElementVariables; // (G)
750  char **ElementVariableNames; // (G) MaxNumberOfElementVariables
751  int *ElementVariableNumberOfComponents; // (G) MaxNumberOfElementVariables
752  int *MapToOriginalElementVariableNames; // (G) MaxNumberOfElementVariables
753 
754  int OriginalNumberOfNodeVariables; // (G)
755  char **OriginalNodeVariableNames; // (G) OriginalNumberOfNodeVariables
756  int NumberOfNodeVariables; // (G)
757  int MaxNumberOfNodeVariables; // (G)
758  char **NodeVariableNames; // (G) NumberOfNodeVariables
759  int *NodeVariableNumberOfComponents; // (G) NumberOfNodeVariables
760  int *MapToOriginalNodeVariableNames; // (G) NumberOfNodeVariables
761 
762  int *ElementVariableTruthTable; // (G) NumBlocks*OrigNumberOfElementVariables
763  int AllVariablesDefinedInAllBlocks;
764 
765 private:
766  vtkModelMetadata(const vtkModelMetadata&); // Not implemented
767  void operator=(const vtkModelMetadata&); // Not implemented
768 };
769 #endif
int * GetElementVariableNumberOfComponents() const
char ** GetOriginalNodeVariableNames() const
int * GetSideSetElementList() const
int * GetBlockElementIdList() const
int GetNumberOfTimeSteps() const
int GetNumberOfBlocks() const
int GetSumDistFactPerNodeSet() const
int * GetNodeSetPropertyValue() const
abstract base class for most VTK objects
Definition: vtkObject.h:61
char ** GetElementVariableNames() const
int * GetSideSetDistributionFactorIndex() const
int GetSizeBlockAttributeArray() const
int * GetSideSetSize() const
int GetDimension() const
int GetSumDistFactPerSideSet() const
char ** GetBlockElementType() const
float * GetBlockAttributes() const
float * GetNodeSetDistributionFactors() const
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
int GetOriginalNumberOfElementVariables() const
char ** GetOriginalElementVariableNames() const
int * GetBlockNodesPerElement() const
const char * GetTitle() const
int GetNumberOfSideSets() const
int GetOriginalNumberOfNodeVariables() const
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
char ** GetCoordinateNames() const
int * GetNodeSetNumberOfDistributionFactors() const
int GetNumberOfBlockProperties() const
int GetNumberOfGlobalVariables() const
int GetSumSidesPerSideSet() const
float * GetSideSetDistributionFactors() const
dynamic, self-adjusting array of vtkIdType
char ** GetNodeVariableNames() const
int GetSumNodesPerNodeSet() const
char ** GetGlobalVariableNames() const
int * GetNodeSetNodeIdList() const
int * GetBlockElementIdListIndex() const
int GetNumberOfNodeVariables() const
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:42
int * GetBlockIds() const
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:49
virtual void PrintSelf(ostream &os, vtkIndent indent)
int * GetBlockPropertyValue() const
char ** GetSideSetPropertyNames() const
a simple class to control print indentation
Definition: vtkIndent.h:38
int * GetSideSetNumDFPerSide() const
int * GetNodeSetIds() const
int GetNumberOfNodeSetProperties() const
int * GetMapToOriginalElementVariableNames() const
int * GetNodeSetNodeIdListIndex() const
#define VTKIOEXODUS_EXPORT
int GetAllVariablesDefinedInAllBlocks() const
float * GetTimeStepValues() const
int * GetNodeSetDistributionFactorIndex() const
int * GetElementVariableTruthTable() const
int * GetBlockNumberOfAttributesPerElement() const
int * GetNodeSetSize() const
int GetNumberOfInformationLines() const
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
int * GetSideSetPropertyValue() const
char ** GetNodeSetPropertyNames() const
static vtkObject * New()
int * GetSideSetSideList() const
int GetSumElementsPerBlock() const
int GetNumberOfSideSetProperties() const
int * GetBlockNumberOfElements() const
int * GetSideSetIds() const
int * GetSideSetListIndex() const
int GetNumberOfNodeSets() const
int * GetSideSetNumberOfDistributionFactors() const
int GetNumberOfElementVariables() const
int * GetBlockAttributesIndex() const
int * GetNodeVariableNumberOfComponents() const