VTK
|
00001 /*========================================================================= 00002 00003 Program: ParaView 00004 Module: vtkModelMetadata.h 00005 00006 Copyright (c) Kitware, Inc. 00007 All rights reserved. 00008 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*---------------------------------------------------------------------------- 00016 Copyright (c) Sandia Corporation 00017 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. 00018 ----------------------------------------------------------------------------*/ 00019 00072 #ifndef vtkModelMetadata_h 00073 #define vtkModelMetadata_h 00074 00075 #include "vtkIOExodusModule.h" // For export macro 00076 #include "vtkObject.h" 00077 00078 class vtkDataSet; 00079 class vtkCharArray; 00080 class vtkIdTypeArray; 00081 class vtkIntArray; 00082 class vtkFloatArray; 00083 class vtkIntArray; 00084 class vtkModelMetadataSTLCloak; 00085 00086 class VTKIOEXODUS_EXPORT vtkModelMetadata : public vtkObject 00087 { 00088 public: 00089 vtkTypeMacro(vtkModelMetadata, vtkObject); 00090 virtual void PrintSelf(ostream &os, vtkIndent indent); 00091 static vtkModelMetadata *New(); 00092 00097 virtual void PrintGlobalInformation(); 00098 00109 virtual void PrintLocalInformation(); 00110 00112 00113 vtkSetStringMacro(Title); 00114 const char *GetTitle() const {return this->Title;} 00116 00118 void SetInformationLines(int numLines, char **lines); 00119 00122 int GetInformationLines(char ***lines) const; 00123 00125 00126 int GetNumberOfInformationLines() const { 00127 return this->NumberOfInformationLines;} 00129 00131 00134 vtkSetMacro(TimeStepIndex, int); 00135 int GetTimeStepIndex() const {return this->TimeStepIndex;} 00137 00139 00142 void SetTimeSteps(int numberOfTimeSteps, float *timeStepValues); 00143 int GetNumberOfTimeSteps() const {return this->NumberOfTimeSteps;} 00145 00147 float *GetTimeStepValues() const {return this->TimeStepValues;} 00148 00150 00151 void SetCoordinateNames(int dimension, char **); 00152 char **GetCoordinateNames() const {return this->CoordinateNames;} 00154 00157 int GetDimension() const {return this->Dimension;} 00158 00160 00162 vtkSetMacro(NumberOfBlocks, int); 00163 int GetNumberOfBlocks() const {return this->NumberOfBlocks;} 00165 00167 00169 void SetBlockIds(int *); 00170 int *GetBlockIds() const {return this->BlockIds;} 00172 00174 00177 void SetBlockElementType(char **); 00178 char **GetBlockElementType() const {return this->BlockElementType;} 00180 00182 00185 int SetBlockNumberOfElements(int *nelts); 00186 int *GetBlockNumberOfElements()const{return this->BlockNumberOfElements;} 00188 00190 00193 void SetBlockNodesPerElement(int *); 00194 int *GetBlockNodesPerElement()const{return this->BlockNodesPerElement;} 00196 00198 00201 void SetBlockElementIdList(int *); 00202 int *GetBlockElementIdList() const {return this->BlockElementIdList;} 00204 00206 int GetSumElementsPerBlock() const {return this->SumElementsPerBlock;} 00207 00210 int *GetBlockElementIdListIndex()const {return this->BlockElementIdListIndex;} 00211 00213 00216 int SetBlockNumberOfAttributesPerElement(int *natts); 00217 int *GetBlockNumberOfAttributesPerElement()const {return this->BlockNumberOfAttributesPerElement;} 00219 00221 00224 void SetBlockAttributes(float *); 00225 float *GetBlockAttributes()const {return this->BlockAttributes;} 00227 00229 00230 int GetSizeBlockAttributeArray() const { 00231 return this->SizeBlockAttributeArray;} 00233 00236 int *GetBlockAttributesIndex() const {return this->BlockAttributesIndex;} 00237 00239 00241 vtkSetMacro(NumberOfNodeSets, int); 00242 int GetNumberOfNodeSets() const {return this->NumberOfNodeSets;} 00244 00246 00249 void SetNodeSetIds(int *); 00250 int *GetNodeSetIds() const {return this->NodeSetIds;} 00252 00256 int *GetNodeSetSize() const {return this->NodeSetSize;} 00257 00259 00263 void SetNodeSetNodeIdList(int *); 00264 int *GetNodeSetNodeIdList() const {return this->NodeSetNodeIdList;} 00266 00268 00272 int *GetNodeSetNumberOfDistributionFactors() const 00273 {return this->NodeSetNumberOfDistributionFactors;} 00275 00277 00280 void SetNodeSetDistributionFactors(float *); 00281 float *GetNodeSetDistributionFactors() const { 00282 return this->NodeSetDistributionFactors;} 00284 00286 int GetSumNodesPerNodeSet() const {return this->SumNodesPerNodeSet;} 00287 00289 int GetSumDistFactPerNodeSet() const {return this->SumDistFactPerNodeSet;} 00290 00292 00294 int *GetNodeSetNodeIdListIndex() const { 00295 return this->NodeSetNodeIdListIndex;} 00297 00299 00301 int *GetNodeSetDistributionFactorIndex() const { 00302 return this->NodeSetDistributionFactorIndex;} 00304 00306 00308 vtkSetMacro(NumberOfSideSets, int); 00309 int GetNumberOfSideSets() const {return this->NumberOfSideSets;} 00311 00313 00315 void SetSideSetIds(int *); 00316 int *GetSideSetIds() const {return this->SideSetIds;} 00318 00320 00323 int SetSideSetSize(int *sizes); 00324 int *GetSideSetSize() const {return this->SideSetSize;} 00326 00328 00332 int SetSideSetNumberOfDistributionFactors(int *df); 00333 int *GetSideSetNumberOfDistributionFactors() const { 00334 return this->SideSetNumberOfDistributionFactors;} 00336 00338 00342 void SetSideSetElementList(int *); 00343 int *GetSideSetElementList() const {return this->SideSetElementList;} 00345 00347 00352 void SetSideSetSideList(int *); 00353 int *GetSideSetSideList() const {return this->SideSetSideList;} 00355 00357 00361 void SetSideSetNumDFPerSide(int *numNodes); 00362 int *GetSideSetNumDFPerSide() const {return this->SideSetNumDFPerSide;} 00364 00366 00374 void SetSideSetDistributionFactors(float *); 00375 float *GetSideSetDistributionFactors() const { 00376 return this->SideSetDistributionFactors;} 00378 00380 int GetSumSidesPerSideSet() const {return this->SumSidesPerSideSet;} 00381 00383 int GetSumDistFactPerSideSet() const {return this->SumDistFactPerSideSet;} 00384 00387 int *GetSideSetListIndex() const {return this->SideSetListIndex;} 00388 00390 00392 int *GetSideSetDistributionFactorIndex() const { 00393 return this->SideSetDistributionFactorIndex;} 00395 00397 00398 int GetNumberOfBlockProperties() const { 00399 return this->NumberOfBlockProperties;} 00401 00403 00404 void SetBlockPropertyNames(int numProp, char **names); 00405 char **GetBlockPropertyNames() const {return this->BlockPropertyNames;} 00407 00409 00411 void SetBlockPropertyValue(int *); 00412 int *GetBlockPropertyValue() const {return this->BlockPropertyValue;} 00414 00416 00417 int GetNumberOfNodeSetProperties() const { 00418 return this->NumberOfNodeSetProperties;} 00420 00422 00423 void SetNodeSetPropertyNames(int numProp, char **names); 00424 char **GetNodeSetPropertyNames() const {return this->NodeSetPropertyNames;} 00426 00428 00430 void SetNodeSetPropertyValue(int *); 00431 int *GetNodeSetPropertyValue() const {return this->NodeSetPropertyValue;} 00433 00435 00436 int GetNumberOfSideSetProperties() const { 00437 return this->NumberOfSideSetProperties;} 00439 00441 00442 void SetSideSetPropertyNames(int numProp, char **names); 00443 char **GetSideSetPropertyNames() const {return this->SideSetPropertyNames;} 00445 00447 00449 void SetSideSetPropertyValue(int *); 00450 int *GetSideSetPropertyValue() const {return this->SideSetPropertyValue;} 00452 00454 00455 int GetNumberOfGlobalVariables() const { 00456 return this->NumberOfGlobalVariables;} 00458 00460 00461 void SetGlobalVariableNames(int numVarNames, char **n); 00462 char **GetGlobalVariableNames() const {return this->GlobalVariableNames;} 00464 00466 00468 void SetGlobalVariableValue(float *f); 00469 float *GetGlobalVariableValue() const {return this->GlobalVariableValue;} 00471 00473 00482 void SetElementVariableInfo(int numOrigNames, char **origNames, 00483 int numNames, char **names, int *numComp, 00484 int *map); 00486 00488 00497 void SetNodeVariableInfo(int numOrigNames, char **origNames, 00498 int numNames, char **names, int *numComp, 00499 int *map); 00501 00503 00507 void SetElementVariableTruthTable(int *); 00508 int *GetElementVariableTruthTable() const { 00509 return this->ElementVariableTruthTable;} 00511 00513 00515 vtkSetMacro(AllVariablesDefinedInAllBlocks, int); 00516 vtkBooleanMacro(AllVariablesDefinedInAllBlocks, int); 00517 int GetAllVariablesDefinedInAllBlocks() const { 00518 return this->AllVariablesDefinedInAllBlocks;} 00520 00522 00534 int GetOriginalNumberOfElementVariables() const { 00535 return this->OriginalNumberOfElementVariables;} 00536 char **GetOriginalElementVariableNames() const { 00537 return this->OriginalElementVariableNames;} 00538 int GetNumberOfElementVariables() const { 00539 return this->NumberOfElementVariables;} 00540 char **GetElementVariableNames() const { 00541 return this->ElementVariableNames;} 00542 int *GetElementVariableNumberOfComponents() const { 00543 return this->ElementVariableNumberOfComponents;} 00544 int *GetMapToOriginalElementVariableNames() const { 00545 return this->MapToOriginalElementVariableNames;} 00547 00548 int GetOriginalNumberOfNodeVariables() const { 00549 return this->OriginalNumberOfNodeVariables;} 00550 char **GetOriginalNodeVariableNames() const { 00551 return this->OriginalNodeVariableNames;} 00552 int GetNumberOfNodeVariables() const { 00553 return this->NumberOfNodeVariables;} 00554 char **GetNodeVariableNames() const { 00555 return this->NodeVariableNames;} 00556 int *GetNodeVariableNumberOfComponents() const { 00557 return this->NodeVariableNumberOfComponents;} 00558 int *GetMapToOriginalNodeVariableNames() const { 00559 return this->MapToOriginalNodeVariableNames;} 00560 00562 00571 void FreeAllGlobalData(); 00572 void FreeAllLocalData(); 00573 void FreeBlockDependentData(); 00574 void FreeOriginalElementVariableNames(); 00575 void FreeOriginalNodeVariableNames(); 00576 void FreeUsedElementVariableNames(); 00577 void FreeUsedNodeVariableNames(); 00578 void FreeUsedElementVariables(); 00579 void FreeUsedNodeVariables(); 00581 00583 void Reset(); 00584 00585 protected: 00586 vtkModelMetadata(); 00587 ~vtkModelMetadata(); 00588 00589 private: 00590 void InitializeAllMetadata(); 00591 void InitializeAllIvars(); 00592 00593 void FreeAllMetadata(); 00594 void FreeAllIvars(); 00595 00596 int BuildBlockElementIdListIndex(); 00597 int BuildBlockAttributesIndex(); 00598 int BuildSideSetDistributionFactorIndex(); 00599 00600 static char *StrDupWithNew(const char *s); 00601 00602 static int FindNameOnList(char *name, char **list, int listLen); 00603 00604 void ShowFloats(const char *what, int num, float *f); 00605 void ShowLines(const char *what, int num, char **l); 00606 void ShowIntArray(const char *what, int numx, int numy, int *id); 00607 void ShowInts(const char *what, int num, int *id); 00608 void ShowListsOfInts(const char *what, int *list, 00609 int nlists, int *idx, int len, int verbose); 00610 void ShowListsOfFloats(const char *what, float *list, 00611 int nlists, int *idx, int len, int verbose); 00612 00613 void SetOriginalElementVariableNames(int nvars, char **names); 00614 void SetElementVariableNames(int nvars, char **names); 00615 void SetElementVariableNumberOfComponents(int *comp); 00616 void SetMapToOriginalElementVariableNames(int *map); 00617 00618 void SetOriginalNodeVariableNames(int nvars, char **names); 00619 void SetNodeVariableNames(int nvars, char **names); 00620 void SetNodeVariableNumberOfComponents(int *comp); 00621 void SetMapToOriginalNodeVariableNames(int *map); 00622 00623 int CalculateMaximumLengths(int &maxString, int &maxLine); 00624 00625 // Fields in Exodus II file and their size (defined in exodusII.h) 00626 // (G - global fields, relevant to entire file or file set) 00627 // (L - local fields, they differ depending on which cells and nodes are 00628 // in a file of a partitioned set, or are read in from file) 00629 00630 char *Title; // (G) 00631 00632 int NumberOfInformationLines; // (G) 00633 char **InformationLine; // (G) 00634 00635 int Dimension; // (G) 00636 char **CoordinateNames; // (at most 3 of these) (G) 00637 00638 // Time steps 00639 00640 int TimeStepIndex; // starting at 0 (Exodus file starts at 1) 00641 int NumberOfTimeSteps; // (G) 00642 float *TimeStepValues; // (G) 00643 00644 // Block information - arrays that are input with Set* 00645 00646 int NumberOfBlocks; // (G) 00647 00648 int *BlockIds; // NumberOfBlocks (G) (start at 1) 00649 char **BlockElementType; // NumberOfBlocks (G) 00650 int *BlockNumberOfElements; // NumberOfBlocks (L) 00651 int *BlockNodesPerElement; // NumberOfBlocks (G) 00652 int *BlockNumberOfAttributesPerElement;// NumberOfBlocks (G) 00653 int *BlockElementIdList; // SumElementsPerBlock (L) 00654 float *BlockAttributes; // SizeBlockAttributeArray (L) 00655 00656 // Block information - values that we calculate 00657 00658 int SumElementsPerBlock; 00659 int SizeBlockAttributeArray; 00660 00661 int *BlockElementIdListIndex; // NumberOfBlocks 00662 int *BlockAttributesIndex; // NumberOfBlocks 00663 00664 vtkModelMetadataSTLCloak *BlockIdIndex; // computed map 00665 00666 // Node Sets - arrays that are input to the class with Set* 00667 00668 int NumberOfNodeSets; // (G) 00669 00670 int *NodeSetIds; // NumberOfNodeSets (G) 00671 int *NodeSetSize; // NumberOfNodeSets (L) 00672 int *NodeSetNumberOfDistributionFactors; // NNS (L) (NSNDF[i] is 0 or NSS[i]) 00673 int *NodeSetNodeIdList; // SumNodesPerNodeSet (L) 00674 float *NodeSetDistributionFactors; // SumDistFactPerNodeSet (L) 00675 00676 // Node Sets - values or arrays that the class computes 00677 00678 int SumNodesPerNodeSet; 00679 int SumDistFactPerNodeSet; 00680 00681 int *NodeSetNodeIdListIndex; // NumberOfNodeSets 00682 int *NodeSetDistributionFactorIndex; // NumberOfNodeSets 00683 00684 // Side Sets - input to class with Set* 00685 00686 int NumberOfSideSets; // (G) 00687 00688 int *SideSetIds; // NumberOfSideSets (G) 00689 int *SideSetSize; // NumberOfSideSets (L) 00690 int *SideSetNumberOfDistributionFactors; // NSS (L) (SSNDF[i] = 0 or NumNodesInSide) 00691 int *SideSetElementList; // SumSidesPerSideSet (L) 00692 int *SideSetSideList; // SumSidesPerSideSet (L) 00693 int *SideSetNumDFPerSide; // SumSidesPerSideSet (L) 00694 float *SideSetDistributionFactors; // SumDistFactPerSideSet (L) 00695 00696 // Side Sets - calculated by class 00697 00698 int SumSidesPerSideSet; 00699 int SumDistFactPerSideSet; 00700 00701 int *SideSetListIndex; // NumberOfSideSets 00702 int *SideSetDistributionFactorIndex; // NumberOfSideSets 00703 00704 // Other properties, provided as input with Set* 00705 00706 int NumberOfBlockProperties; // (G) 00707 char **BlockPropertyNames; // one per property (G) 00708 int *BlockPropertyValue; // NumBlocks * NumBlockProperties (G) 00709 00710 int NumberOfNodeSetProperties; // (G) 00711 char **NodeSetPropertyNames; // one per property (G) 00712 int *NodeSetPropertyValue; // NumNodeSets * NumNodeSetProperties (G) 00713 00714 int NumberOfSideSetProperties; // (G) 00715 char **SideSetPropertyNames; // one per property (G) 00716 int *SideSetPropertyValue; // NumSideSets * NumSideSetProperties (G) 00717 00718 // Global variables, 1 value per time step per variable. We store 00719 // these as floats, even if they are doubles in the file. The values 00720 // are global in the sense that they apply to the whole data set, but 00721 // the are local in the sense that they can change with each time step. 00722 // For the purpose of this object, which represents a particular 00723 // time step, they are therefore considered "local". (Since they need 00724 // to be updated every time another read is done from the file.) 00725 00726 int NumberOfGlobalVariables; // (G) 00727 char **GlobalVariableNames; // (G) NumberOfGlobalVariables 00728 float *GlobalVariableValue; // (G) NumberOfGlobalVariables 00729 00730 // The element and node arrays in the file were all scalar arrays. 00731 // Those with similar names were combined into vectors in VTK. Here 00732 // are all the original names from the Exodus file, the names given 00733 // the variables in the VTK ugrid, and a mapping from the VTK names 00734 // to the Exodus names. 00735 00736 int OriginalNumberOfElementVariables; // (G) 00737 char **OriginalElementVariableNames; // (G) OriginalNumberOfElementVariables 00738 int NumberOfElementVariables; // (G) 00739 int MaxNumberOfElementVariables; // (G) 00740 char **ElementVariableNames; // (G) MaxNumberOfElementVariables 00741 int *ElementVariableNumberOfComponents; // (G) MaxNumberOfElementVariables 00742 int *MapToOriginalElementVariableNames; // (G) MaxNumberOfElementVariables 00743 00744 int OriginalNumberOfNodeVariables; // (G) 00745 char **OriginalNodeVariableNames; // (G) OriginalNumberOfNodeVariables 00746 int NumberOfNodeVariables; // (G) 00747 int MaxNumberOfNodeVariables; // (G) 00748 char **NodeVariableNames; // (G) NumberOfNodeVariables 00749 int *NodeVariableNumberOfComponents; // (G) NumberOfNodeVariables 00750 int *MapToOriginalNodeVariableNames; // (G) NumberOfNodeVariables 00751 00752 int *ElementVariableTruthTable; // (G) NumBlocks*OrigNumberOfElementVariables 00753 int AllVariablesDefinedInAllBlocks; 00754 00755 private: 00756 vtkModelMetadata(const vtkModelMetadata&); // Not implemented 00757 void operator=(const vtkModelMetadata&); // Not implemented 00758 }; 00759 #endif