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:
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 
256  int *GetNodeSetSize() const {return this->NodeSetSize;}
257 
259 
263  void SetNodeSetNodeIdList(int *);
264  int *GetNodeSetNodeIdList() const {return this->NodeSetNodeIdList;}
266 
268 
273  {return this->NodeSetNumberOfDistributionFactors;}
275 
277 
280  void SetNodeSetDistributionFactors(float *);
282  return this->NodeSetDistributionFactors;}
284 
286  int GetSumNodesPerNodeSet() const {return this->SumNodesPerNodeSet;}
287 
289  int GetSumDistFactPerNodeSet() const {return this->SumDistFactPerNodeSet;}
290 
292 
295  return this->NodeSetNodeIdListIndex;}
297 
299 
302  return this->NodeSetDistributionFactorIndex;}
304 
306 
308  vtkSetMacro(NumberOfSideSets, int);
309  int GetNumberOfSideSets() const {return this->NumberOfSideSets;}
311 
313 
315  void SetSideSetIds(int *);
316  int *GetSideSetIds() const {return this->SideSetIds;}
318 
320 
323  int SetSideSetSize(int *sizes);
324  int *GetSideSetSize() const {return this->SideSetSize;}
326 
328 
332  int SetSideSetNumberOfDistributionFactors(int *df);
334  return this->SideSetNumberOfDistributionFactors;}
336 
338 
342  void SetSideSetElementList(int *);
343  int *GetSideSetElementList() const {return this->SideSetElementList;}
345 
347 
352  void SetSideSetSideList(int *);
353  int *GetSideSetSideList() const {return this->SideSetSideList;}
355 
357 
361  void SetSideSetNumDFPerSide(int *numNodes);
362  int *GetSideSetNumDFPerSide() const {return this->SideSetNumDFPerSide;}
364 
366 
374  void SetSideSetDistributionFactors(float *);
376  return this->SideSetDistributionFactors;}
378 
380  int GetSumSidesPerSideSet() const {return this->SumSidesPerSideSet;}
381 
383  int GetSumDistFactPerSideSet() const {return this->SumDistFactPerSideSet;}
384 
387  int *GetSideSetListIndex() const {return this->SideSetListIndex;}
388 
390 
393  return this->SideSetDistributionFactorIndex;}
395 
397 
399  return this->NumberOfBlockProperties;}
401 
403 
404  void SetBlockPropertyNames(int numProp, char **names);
405  char **GetBlockPropertyNames() const {return this->BlockPropertyNames;}
407 
409 
411  void SetBlockPropertyValue(int *);
412  int *GetBlockPropertyValue() const {return this->BlockPropertyValue;}
414 
416 
418  return this->NumberOfNodeSetProperties;}
420 
422 
423  void SetNodeSetPropertyNames(int numProp, char **names);
424  char **GetNodeSetPropertyNames() const {return this->NodeSetPropertyNames;}
426 
428 
430  void SetNodeSetPropertyValue(int *);
431  int *GetNodeSetPropertyValue() const {return this->NodeSetPropertyValue;}
433 
435 
437  return this->NumberOfSideSetProperties;}
439 
441 
442  void SetSideSetPropertyNames(int numProp, char **names);
443  char **GetSideSetPropertyNames() const {return this->SideSetPropertyNames;}
445 
447 
449  void SetSideSetPropertyValue(int *);
450  int *GetSideSetPropertyValue() const {return this->SideSetPropertyValue;}
452 
454 
456  return this->NumberOfGlobalVariables;}
458 
460 
461  void SetGlobalVariableNames(int numVarNames, char **n);
462  char **GetGlobalVariableNames() const {return this->GlobalVariableNames;}
464 
466 
468  void SetGlobalVariableValue(float *f);
469  float *GetGlobalVariableValue() const {return this->GlobalVariableValue;}
471 
473 
482  void SetElementVariableInfo(int numOrigNames, char **origNames,
483  int numNames, char **names, int *numComp,
484  int *map);
486 
488 
497  void SetNodeVariableInfo(int numOrigNames, char **origNames,
498  int numNames, char **names, int *numComp,
499  int *map);
501 
503 
507  void SetElementVariableTruthTable(int *);
509  return this->ElementVariableTruthTable;}
511 
513 
515  vtkSetMacro(AllVariablesDefinedInAllBlocks, int);
516  vtkBooleanMacro(AllVariablesDefinedInAllBlocks, int);
518  return this->AllVariablesDefinedInAllBlocks;}
520 
522 
535  return this->OriginalNumberOfElementVariables;}
537  return this->OriginalElementVariableNames;}
539  return this->NumberOfElementVariables;}
540  char **GetElementVariableNames() const {
541  return this->ElementVariableNames;}
543  return this->ElementVariableNumberOfComponents;}
545  return this->MapToOriginalElementVariableNames;}
547 
549  return this->OriginalNumberOfNodeVariables;}
551  return this->OriginalNodeVariableNames;}
553  return this->NumberOfNodeVariables;}
554  char **GetNodeVariableNames() const {
555  return this->NodeVariableNames;}
557  return this->NodeVariableNumberOfComponents;}
559  return this->MapToOriginalNodeVariableNames;}
560 
562 
571  void FreeAllGlobalData();
572  void FreeAllLocalData();
573  void FreeBlockDependentData();
574  void FreeOriginalElementVariableNames();
575  void FreeOriginalNodeVariableNames();
576  void FreeUsedElementVariableNames();
577  void FreeUsedNodeVariableNames();
578  void FreeUsedElementVariables();
579  void FreeUsedNodeVariables();
581 
583  void Reset();
584 
585 protected:
587  ~vtkModelMetadata();
588 
589 private:
590  void InitializeAllMetadata();
591  void InitializeAllIvars();
592 
593  void FreeAllMetadata();
594  void FreeAllIvars();
595 
596  int BuildBlockElementIdListIndex();
597  int BuildBlockAttributesIndex();
598  int BuildSideSetDistributionFactorIndex();
599 
600  static char *StrDupWithNew(const char *s);
601 
602  static int FindNameOnList(char *name, char **list, int listLen);
603 
604  void ShowFloats(const char *what, int num, float *f);
605  void ShowLines(const char *what, int num, char **l);
606  void ShowIntArray(const char *what, int numx, int numy, int *id);
607  void ShowInts(const char *what, int num, int *id);
608  void ShowListsOfInts(const char *what, int *list,
609  int nlists, int *idx, int len, int verbose);
610  void ShowListsOfFloats(const char *what, float *list,
611  int nlists, int *idx, int len, int verbose);
612 
613  void SetOriginalElementVariableNames(int nvars, char **names);
614  void SetElementVariableNames(int nvars, char **names);
615  void SetElementVariableNumberOfComponents(int *comp);
616  void SetMapToOriginalElementVariableNames(int *map);
617 
618  void SetOriginalNodeVariableNames(int nvars, char **names);
619  void SetNodeVariableNames(int nvars, char **names);
620  void SetNodeVariableNumberOfComponents(int *comp);
621  void SetMapToOriginalNodeVariableNames(int *map);
622 
623  int CalculateMaximumLengths(int &maxString, int &maxLine);
624 
625  // Fields in Exodus II file and their size (defined in exodusII.h)
626  // (G - global fields, relevant to entire file or file set)
627  // (L - local fields, they differ depending on which cells and nodes are
628  // in a file of a partitioned set, or are read in from file)
629 
630  char *Title; // (G)
631 
632  int NumberOfInformationLines; // (G)
633  char **InformationLine; // (G)
634 
635  int Dimension; // (G)
636  char **CoordinateNames; // (at most 3 of these) (G)
637 
638  // Time steps
639 
640  int TimeStepIndex; // starting at 0 (Exodus file starts at 1)
641  int NumberOfTimeSteps; // (G)
642  float *TimeStepValues; // (G)
643 
644  // Block information - arrays that are input with Set*
645 
646  int NumberOfBlocks; // (G)
647 
648  int *BlockIds; // NumberOfBlocks (G) (start at 1)
649  char **BlockElementType; // NumberOfBlocks (G)
650  int *BlockNumberOfElements; // NumberOfBlocks (L)
651  int *BlockNodesPerElement; // NumberOfBlocks (G)
652  int *BlockNumberOfAttributesPerElement;// NumberOfBlocks (G)
653  int *BlockElementIdList; // SumElementsPerBlock (L)
654  float *BlockAttributes; // SizeBlockAttributeArray (L)
655 
656  // Block information - values that we calculate
657 
658  int SumElementsPerBlock;
659  int SizeBlockAttributeArray;
660 
661  int *BlockElementIdListIndex; // NumberOfBlocks
662  int *BlockAttributesIndex; // NumberOfBlocks
663 
664  vtkModelMetadataSTLCloak *BlockIdIndex; // computed map
665 
666  // Node Sets - arrays that are input to the class with Set*
667 
668  int NumberOfNodeSets; // (G)
669 
670  int *NodeSetIds; // NumberOfNodeSets (G)
671  int *NodeSetSize; // NumberOfNodeSets (L)
672  int *NodeSetNumberOfDistributionFactors; // NNS (L) (NSNDF[i] is 0 or NSS[i])
673  int *NodeSetNodeIdList; // SumNodesPerNodeSet (L)
674  float *NodeSetDistributionFactors; // SumDistFactPerNodeSet (L)
675 
676  // Node Sets - values or arrays that the class computes
677 
678  int SumNodesPerNodeSet;
679  int SumDistFactPerNodeSet;
680 
681  int *NodeSetNodeIdListIndex; // NumberOfNodeSets
682  int *NodeSetDistributionFactorIndex; // NumberOfNodeSets
683 
684  // Side Sets - input to class with Set*
685 
686  int NumberOfSideSets; // (G)
687 
688  int *SideSetIds; // NumberOfSideSets (G)
689  int *SideSetSize; // NumberOfSideSets (L)
690  int *SideSetNumberOfDistributionFactors; // NSS (L) (SSNDF[i] = 0 or NumNodesInSide)
691  int *SideSetElementList; // SumSidesPerSideSet (L)
692  int *SideSetSideList; // SumSidesPerSideSet (L)
693  int *SideSetNumDFPerSide; // SumSidesPerSideSet (L)
694  float *SideSetDistributionFactors; // SumDistFactPerSideSet (L)
695 
696  // Side Sets - calculated by class
697 
698  int SumSidesPerSideSet;
699  int SumDistFactPerSideSet;
700 
701  int *SideSetListIndex; // NumberOfSideSets
702  int *SideSetDistributionFactorIndex; // NumberOfSideSets
703 
704  // Other properties, provided as input with Set*
705 
706  int NumberOfBlockProperties; // (G)
707  char **BlockPropertyNames; // one per property (G)
708  int *BlockPropertyValue; // NumBlocks * NumBlockProperties (G)
709 
710  int NumberOfNodeSetProperties; // (G)
711  char **NodeSetPropertyNames; // one per property (G)
712  int *NodeSetPropertyValue; // NumNodeSets * NumNodeSetProperties (G)
713 
714  int NumberOfSideSetProperties; // (G)
715  char **SideSetPropertyNames; // one per property (G)
716  int *SideSetPropertyValue; // NumSideSets * NumSideSetProperties (G)
717 
718  // Global variables, 1 value per time step per variable. We store
719  // these as floats, even if they are doubles in the file. The values
720  // are global in the sense that they apply to the whole data set, but
721  // the are local in the sense that they can change with each time step.
722  // For the purpose of this object, which represents a particular
723  // time step, they are therefore considered "local". (Since they need
724  // to be updated every time another read is done from the file.)
725 
726  int NumberOfGlobalVariables; // (G)
727  char **GlobalVariableNames; // (G) NumberOfGlobalVariables
728  float *GlobalVariableValue; // (G) NumberOfGlobalVariables
729 
730  // The element and node arrays in the file were all scalar arrays.
731  // Those with similar names were combined into vectors in VTK. Here
732  // are all the original names from the Exodus file, the names given
733  // the variables in the VTK ugrid, and a mapping from the VTK names
734  // to the Exodus names.
735 
736  int OriginalNumberOfElementVariables; // (G)
737  char **OriginalElementVariableNames; // (G) OriginalNumberOfElementVariables
738  int NumberOfElementVariables; // (G)
739  int MaxNumberOfElementVariables; // (G)
740  char **ElementVariableNames; // (G) MaxNumberOfElementVariables
741  int *ElementVariableNumberOfComponents; // (G) MaxNumberOfElementVariables
742  int *MapToOriginalElementVariableNames; // (G) MaxNumberOfElementVariables
743 
744  int OriginalNumberOfNodeVariables; // (G)
745  char **OriginalNodeVariableNames; // (G) OriginalNumberOfNodeVariables
746  int NumberOfNodeVariables; // (G)
747  int MaxNumberOfNodeVariables; // (G)
748  char **NodeVariableNames; // (G) NumberOfNodeVariables
749  int *NodeVariableNumberOfComponents; // (G) NumberOfNodeVariables
750  int *MapToOriginalNodeVariableNames; // (G) NumberOfNodeVariables
751 
752  int *ElementVariableTruthTable; // (G) NumBlocks*OrigNumberOfElementVariables
753  int AllVariablesDefinedInAllBlocks;
754 
755 private:
756  vtkModelMetadata(const vtkModelMetadata&); // Not implemented
757  void operator=(const vtkModelMetadata&); // Not implemented
758 };
759 #endif
int * GetElementVariableNumberOfComponents() const
char ** GetOriginalNodeVariableNames() const
int * GetSideSetElementList() const
GLclampf f
Definition: vtkgl.h:14181
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:59
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
GLenum GLsizei len
Definition: vtkgl.h:13010
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
#define vtkSetStringMacro(name)
Definition: vtkSetGet.h:94
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:632
char ** GetGlobalVariableNames() const
int * GetNodeSetNodeIdList() const
GLuint GLuint num
Definition: vtkgl.h:16907
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:45
GLuint const GLchar * name
Definition: vtkgl.h:11983
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
GLuint GLuint * names
Definition: vtkgl.h:19215
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
GLdouble s
Definition: vtkgl.h:11594
GLclampd n
Definition: vtkgl.h:14370
#define vtkBooleanMacro(name, type)
Definition: vtkSetGet.h:234
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
#define vtkSetMacro(name, type)
Definition: vtkSetGet.h:69
int * GetBlockAttributesIndex() const
int * GetNodeVariableNumberOfComponents() const