diff --git a/Examples/GUI/Qt/GraphicsView/vtkclasses.xml b/Examples/GUI/Qt/GraphicsView/vtkclasses.xml index 05aa3af907c1133d476457493ccec41d032b3735..93df3c736bfe656ad4af6141376205902a42d4a6 100644 --- a/Examples/GUI/Qt/GraphicsView/vtkclasses.xml +++ b/Examples/GUI/Qt/GraphicsView/vtkclasses.xml @@ -2166,8 +2166,6 @@ </class> <class id="vtkExodusIICache" library="Hybrid"> </class> - <class id="vtkExodusModel" library="Hybrid"> - </class> <class id="vtkBase64Utilities" library="IO"> </class> <class id="vtkDataCompressor" library="IO"> diff --git a/Examples/GUI/Qt/GraphicsView/vtklibrary.xml b/Examples/GUI/Qt/GraphicsView/vtklibrary.xml index 85e3ce5d8713144b40124f722a6b0da80903e373..2dd50ca1ef67406241cb1bef0823397e8e43ce84 100644 --- a/Examples/GUI/Qt/GraphicsView/vtklibrary.xml +++ b/Examples/GUI/Qt/GraphicsView/vtklibrary.xml @@ -794,8 +794,6 @@ </node> <node id="vtkExodusIICache"> </node> - <node id="vtkExodusModel"> - </node> <node id="vtkRIBExporter"> </node> <node id="vtkX3DExporter"> diff --git a/Examples/Infovis/Python/vtkclasses.xml b/Examples/Infovis/Python/vtkclasses.xml index 05aa3af907c1133d476457493ccec41d032b3735..93df3c736bfe656ad4af6141376205902a42d4a6 100644 --- a/Examples/Infovis/Python/vtkclasses.xml +++ b/Examples/Infovis/Python/vtkclasses.xml @@ -2166,8 +2166,6 @@ </class> <class id="vtkExodusIICache" library="Hybrid"> </class> - <class id="vtkExodusModel" library="Hybrid"> - </class> <class id="vtkBase64Utilities" library="IO"> </class> <class id="vtkDataCompressor" library="IO"> diff --git a/Examples/Infovis/Python/vtklibrary.xml b/Examples/Infovis/Python/vtklibrary.xml index 85e3ce5d8713144b40124f722a6b0da80903e373..2dd50ca1ef67406241cb1bef0823397e8e43ce84 100644 --- a/Examples/Infovis/Python/vtklibrary.xml +++ b/Examples/Infovis/Python/vtklibrary.xml @@ -794,8 +794,6 @@ </node> <node id="vtkExodusIICache"> </node> - <node id="vtkExodusModel"> - </node> <node id="vtkRIBExporter"> </node> <node id="vtkX3DExporter"> diff --git a/IO/Exodus/CMakeLists.txt b/IO/Exodus/CMakeLists.txt index 125c87e5ca06fc9f31746108fd2f25fe70ace37e..f7ee94371a85be0223158849657d5ecbfbf06b27 100644 --- a/IO/Exodus/CMakeLists.txt +++ b/IO/Exodus/CMakeLists.txt @@ -7,7 +7,6 @@ set(Module_SRCS vtkExodusIIReader.cxx vtkExodusIIReaderParser.cxx vtkExodusIIReaderVariableCheck.cxx - vtkExodusModel.cxx vtkExodusIIWriter.cxx vtkModelMetadata.cxx ) diff --git a/IO/Exodus/Testing/Cxx/TestExodusSideSets.cxx b/IO/Exodus/Testing/Cxx/TestExodusSideSets.cxx index 519f3b5c177124f1c72308eacac85d34334370e6..f132fc635f5015f4190f1b8f8d84ef59f5483bf6 100644 --- a/IO/Exodus/Testing/Cxx/TestExodusSideSets.cxx +++ b/IO/Exodus/Testing/Cxx/TestExodusSideSets.cxx @@ -28,7 +28,6 @@ int TestExodusSideSets(int argc, char* argv[]) rdr->GenerateGlobalNodeIdArrayOn(); rdr->GenerateGlobalElementIdArrayOn(); - rdr->ExodusModelMetadataOn(); rdr->UpdateInformation(); for(int i=0;i<rdr->GetNumberOfObjects(vtkExodusIIReader::ELEM_BLOCK);i++) diff --git a/IO/Exodus/Testing/Cxx/TestMultiBlockExodusWrite.cxx b/IO/Exodus/Testing/Cxx/TestMultiBlockExodusWrite.cxx index 02d079e9d4af851424b80249ac45025c92ad1abe..3628f5439d71dd2be4bcd495666b71998fbc5c8c 100644 --- a/IO/Exodus/Testing/Cxx/TestMultiBlockExodusWrite.cxx +++ b/IO/Exodus/Testing/Cxx/TestMultiBlockExodusWrite.cxx @@ -16,6 +16,7 @@ #include "vtkRegressionTestImage.h" #include "vtkWindowToImageFilter.h" #include "vtkPNGWriter.h" +#include "vtkModelMetaData.h" #include "vtkSmartPointer.h" #define VTK_CREATE(type, name) \ @@ -90,6 +91,8 @@ int TestMultiBlockExodusWrite (int argc, char *argv[]) writer->WriteAllTimeStepsOn (); writer->Update (); + writer->GetModelMetadata()->PrintLocalInformation(); + VTK_CREATE (vtkExodusIIReader, outputReader); if (!outputReader->CanReadFile (OutputFile)) { diff --git a/IO/Exodus/vtkExodusIIReader.cxx b/IO/Exodus/vtkExodusIIReader.cxx index 64502e3422a9f2bb0c65f9bbba0e6497739ac28b..1ae60ebc12959fcaad4e41f5ccbca74822965a3e 100644 --- a/IO/Exodus/vtkExodusIIReader.cxx +++ b/IO/Exodus/vtkExodusIIReader.cxx @@ -23,7 +23,6 @@ #include "vtkCellType.h" #include "vtkCharArray.h" #include "vtkDoubleArray.h" -#include "vtkExodusModel.h" #include "vtkFloatArray.h" #include "vtkIdTypeArray.h" #include "vtkInformation.h" @@ -3369,9 +3368,6 @@ void vtkExodusIIReader::PrintSelf( ostream& os, vtkIndent indent ) os << indent << "DisplayType: " << this->DisplayType << "\n"; os << indent << "TimeStep: " << this->TimeStep << "\n"; os << indent << "TimeStepRange: [" << this->TimeStepRange[0] << ", " << this->TimeStepRange[1] << "]\n"; - os << indent << "ExodusModelMetadata: " << (this->ExodusModelMetadata ? "ON" : "OFF" ) << "\n"; - // os << indent << "PackExodusModelOntoOutput: " << (this->PackExodusModelOntoOutput ? "ON" : "OFF" ) << "\n"; - os << indent << "ExodusModel: " << this->ExodusModel << "\n"; os << indent << "SILUpdateStamp: " << this->SILUpdateStamp << "\n"; if ( this->Metadata ) { @@ -4881,7 +4877,6 @@ vtkDataArray* vtkExodusIIReaderPrivate::FindDisplacementVectors( int timeStep ) vtkStandardNewMacro(vtkExodusIIReader); vtkCxxSetObjectMacro(vtkExodusIIReader,Metadata,vtkExodusIIReaderPrivate); -vtkCxxSetObjectMacro(vtkExodusIIReader,ExodusModel,vtkExodusModel); vtkExodusIIReader::vtkExodusIIReader() { @@ -4893,9 +4888,6 @@ vtkExodusIIReader::vtkExodusIIReader() this->TimeStep = 0; this->TimeStepRange[0] = 0; this->TimeStepRange[1] = 0; - this->ExodusModelMetadata = 0; - // this->PackExodusModelOntoOutput = 1; - this->ExodusModel = 0; this->DisplayType = 0; this->SILUpdateStamp = -1; @@ -4908,7 +4900,7 @@ vtkExodusIIReader::~vtkExodusIIReader() this->SetFileName( 0 ); this->SetMetadata( 0 ); - this->SetExodusModel( 0 ); + //this->SetExodusModel( 0 ); } // Normally, vtkExodusIIReader::PrintSelf would be here. @@ -5967,22 +5959,6 @@ void vtkExodusIIReader::SetAllArrayStatus( int otyp, int status ) } } -void vtkExodusIIReader::NewExodusModel() -{ - // These arrays are required by the Exodus II writer: - this->GenerateGlobalElementIdArrayOn(); - this->GenerateGlobalNodeIdArrayOn(); - this->GenerateObjectIdCellArrayOn(); - - if ( this->ExodusModel ) - { - this->ExodusModel->Reset(); - return; - } - - this->ExodusModel = vtkExodusModel::New(); -} - void vtkExodusIIReader::Dump() { vtkIndent indent; diff --git a/IO/Exodus/vtkExodusIIReader.h b/IO/Exodus/vtkExodusIIReader.h index 81c6dd6a314cd9fb0095e8d9f8e20de621a1a54c..d7421436d5d7ca2b8b5c0b7dda0d488772b59eee 100644 --- a/IO/Exodus/vtkExodusIIReader.h +++ b/IO/Exodus/vtkExodusIIReader.h @@ -42,7 +42,6 @@ class vtkDataArray; class vtkDataSet; class vtkExodusIICache; class vtkExodusIIReaderPrivate; -class vtkExodusModel; class vtkFloatArray; class vtkGraph; class vtkIntArray; @@ -409,20 +408,6 @@ public: vtkGetMacro(DisplayType,int); virtual void SetDisplayType(int type); - // Description: - // There is a great deal of model information lost when an Exodus II - // file is read in to a vtkMultiBlockDataSet. Turn this option ON - // if you want this metadata to be read in to a vtkExodusModel object. - // The default is OFF. - - vtkBooleanMacro(ExodusModelMetadata, int); - vtkSetMacro(ExodusModelMetadata, int); - vtkGetMacro(ExodusModelMetadata, int); - - // Description: - // Returns the object which encapsulates the model metadata. - vtkGetObjectMacro(ExodusModel,vtkExodusModel); - // Descriptions: // return boolean indicating whether the type,name is a valid variable int IsValidVariable( const char *type, const char *name ); @@ -708,10 +693,6 @@ protected: vtkExodusIIReader(); ~vtkExodusIIReader(); - // Description: - // Reset or create an ExodusModel and turn on arrays that must be present for the ExodusIIWriter - virtual void NewExodusModel(); - // helper for finding IDs static int GetIDHelper ( const char *arrayName, vtkDataSet *data, int localID, int searchType ); static int GetGlobalID( const char *arrayName, vtkDataSet *data, int localID, int searchType ); @@ -737,8 +718,6 @@ protected: // Populates the TIME_STEPS and TIME_RANGE keys based on file metadata. void AdvertiseTimeSteps( vtkInformation* outputInfo ); - virtual void SetExodusModel( vtkExodusModel* em ); - int ProcessRequest( vtkInformation *, vtkInformationVector **, vtkInformationVector *); int RequestInformation( vtkInformation *, vtkInformationVector **, vtkInformationVector *); int RequestData( vtkInformation *, vtkInformationVector **, vtkInformationVector *); @@ -762,10 +741,6 @@ protected: // Metadata containing a description of the currently open file. vtkExodusIIReaderPrivate* Metadata; - vtkExodusModel *ExodusModel; - // int PackExodusModelOntoOutput; - int ExodusModelMetadata; - int SILUpdateStamp; private: vtkExodusIIReader(const vtkExodusIIReader&); // Not implemented diff --git a/IO/Exodus/vtkExodusIIWriter.cxx b/IO/Exodus/vtkExodusIIWriter.cxx index be82407afe8ff4c97bfe0cb9785cc26b6bdc8475..a509deba71864e730ad3a9005e445bbfcd4d880c 100644 --- a/IO/Exodus/vtkExodusIIWriter.cxx +++ b/IO/Exodus/vtkExodusIIWriter.cxx @@ -309,12 +309,6 @@ void vtkExodusIIWriter::WriteData () return; } - if (!this->WriteQARecords ()) - { - vtkErrorMacro("vtkExodusIIWriter::WriteData QA records"); - return; - } - if (!this->WriteInformationRecords()) { vtkErrorMacro("vtkExodusIIWriter::WriteData information records"); @@ -1465,33 +1459,6 @@ int vtkExodusIIWriter::WriteInitializationParameters() numBlocks, nnsets, nssets); return rc >= 0; } -// -//--------------------------------------------------------- -// Initialization, QA, Title, information records -//--------------------------------------------------------- -int vtkExodusIIWriter::WriteQARecords() -{ - vtkModelMetadata *em = this->GetModelMetadata(); - - int nrecs = em->GetNumberOfQARecords(); - - if (nrecs > 0) - { - typedef char *p4[4]; - - p4 *qarecs = new p4 [nrecs]; - - for (int i=0; i<nrecs; i++) - { - em->GetQARecord(i, &qarecs[i][0], &qarecs[i][1], &qarecs[i][2], &qarecs[i][3]); - } - ex_put_qa(this->fid, nrecs, qarecs); - - delete [] qarecs; - } - - return 1; -} //---------------------------------------------------------------------------- int vtkExodusIIWriter::WriteInformationRecords() diff --git a/IO/Exodus/vtkExodusIIWriter.h b/IO/Exodus/vtkExodusIIWriter.h index 3683c605fa63729f72acce7615c90cf405a42c53..ea93030d2542695f5a7300320b5329b186e96929 100644 --- a/IO/Exodus/vtkExodusIIWriter.h +++ b/IO/Exodus/vtkExodusIIWriter.h @@ -314,7 +314,6 @@ protected: vtkIdType GetElementLocalId(vtkIdType id); int WriteInitializationParameters (); - int WriteQARecords (); int WriteInformationRecords (); int WritePoints (); int WriteCoordinateNames (); diff --git a/IO/Exodus/vtkExodusModel.cxx b/IO/Exodus/vtkExodusModel.cxx deleted file mode 100644 index c1b510cb807edfb936bb7b3709739cb7d1ab10ba..0000000000000000000000000000000000000000 --- a/IO/Exodus/vtkExodusModel.cxx +++ /dev/null @@ -1,1222 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkExodusModel.cxx - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ - -/*---------------------------------------------------------------------------- - Copyright (c) Sandia Corporation - See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. -----------------------------------------------------------------------------*/ - -#include "vtkExodusModel.h" -#include "vtkUnstructuredGrid.h" -#include "vtkObjectFactory.h" -#include "vtkDataArray.h" -#include "vtkIntArray.h" -#include "vtkFloatArray.h" -#include "vtkCellData.h" -#include "vtkPointData.h" -#include <ctype.h> -#include <set> -#include <map> -#include "vtk_exodusII.h" -#include <ctype.h> - - -vtkStandardNewMacro(vtkExodusModel); - -vtkExodusModel::vtkExodusModel() -{ - this->ModelMetadata = NULL; - this->GeometryCount = -1; -} - -vtkExodusModel::~vtkExodusModel() -{ - this->SetModelMetadata(NULL); -} - -void vtkExodusModel::Reset() -{ - if (this->ModelMetadata) - { - this->ModelMetadata->Reset(); - } -} - -vtkModelMetadata *vtkExodusModel::GetModelMetadata() -{ - if (!this->ModelMetadata) - { - this->ModelMetadata = vtkModelMetadata::New(); - this->ModelMetadata->Register(this); - } - - return this->ModelMetadata; -} - -void vtkExodusModel::SetModelMetadata(vtkModelMetadata *emd) -{ - if (this->ModelMetadata == emd) return; - - if (this->ModelMetadata) - { - this->ModelMetadata->UnRegister(this); - this->ModelMetadata->Delete(); - this->ModelMetadata = NULL; - } - - if (emd) - { - this->ModelMetadata = emd; - emd->Register(this); - } -} - -//--------------------------------------------------------------- -// Set all the global fields of the Exodus Model from an open -// Exodus file. -//--------------------------------------------------------------- - -int vtkExodusModel::SetGlobalInformation(int fid, int compute_word_size) -{ - int i; - int use_floats = (compute_word_size == sizeof(float)); - - int intVal; - float floatVal; - char charVal; - - vtkModelMetadata *emd = this->GetModelMetadata(); - - ex_opts(0); // turn off all error messages - - emd->FreeAllGlobalData(); - emd->FreeAllLocalData(); - - // Title and dimension - - char *title = new char [MAX_LINE_LENGTH + 1]; - int dim; - - ex_inquire(fid, EX_INQ_TITLE, &intVal, &floatVal, title); - ex_inquire(fid, EX_INQ_DIM, &dim, &floatVal, &charVal); - - emd->SetTitle(title); - - // QA records - - int nqaRecs; - ex_inquire(fid, EX_INQ_QA, &nqaRecs, &floatVal, &charVal); - - if (nqaRecs > 0) - { - typedef char *p4[4]; - p4 *qarecs = new p4 [nqaRecs]; - - for (i=0; i<nqaRecs; i++) - { - qarecs[i][0] = new char [MAX_STR_LENGTH + 1]; - qarecs[i][1] = new char [MAX_STR_LENGTH + 1]; - qarecs[i][2] = new char [MAX_STR_LENGTH + 1]; - qarecs[i][3] = new char [MAX_STR_LENGTH + 1]; - } - - ex_get_qa(fid, qarecs); - emd->SetQARecords(nqaRecs, qarecs); - } - - // Information lines - - int ninfoLines; - ex_inquire(fid, EX_INQ_INFO, &ninfoLines, &floatVal, &charVal); - - if (ninfoLines > 0) - { - char **lines = new char * [ninfoLines]; - for (i=0; i<ninfoLines; i++) - { - lines[i] = new char [MAX_LINE_LENGTH + 1]; - } - - ex_get_info(fid, lines); - emd->SetInformationLines(ninfoLines, lines); - } - - // Coordinate names - - char **coordNames = new char * [dim]; - for (i=0; i<dim; i++) - { - coordNames[i] = new char [MAX_STR_LENGTH + 1]; - } - - ex_get_coord_names(fid, coordNames); - emd->SetCoordinateNames(dim, coordNames); - - // Time steps - // TODO - We convert time steps to float. We should fix this - // to respect the precision of the time values in the input - // file. - - int nTimeSteps; - ex_inquire(fid, EX_INQ_TIME, &nTimeSteps, &floatVal, &charVal); - - if (nTimeSteps > 0) - { - float *ts = new float [nTimeSteps]; - if (use_floats) - { - ex_get_all_times(fid, ts); - } - else - { - double *dts = new double [nTimeSteps]; - ex_get_all_times(fid, dts); - for (i=0; i<nTimeSteps; i++) - { - ts[i] = (float)dts[i]; - } - delete [] dts; - } - - emd->SetTimeSteps(nTimeSteps, ts); - } - - // Block information - - int nblocks; - int *bids = NULL; - ex_inquire(fid, EX_INQ_ELEM_BLK, &nblocks, &floatVal, &charVal); - emd->SetNumberOfBlocks(nblocks); - - if (nblocks > 0) - { - bids = new int [nblocks]; - - ex_get_elem_blk_ids(fid, bids); - - char **types = new char * [nblocks]; - int *nodesPerElement = new int [nblocks]; - int *numAtt = new int [nblocks]; - - for (i=0; i<nblocks; i++) - { - types[i] = new char [MAX_STR_LENGTH + 1]; - - ex_get_elem_block(fid, bids[i], types[i], - &intVal, &nodesPerElement[i], &numAtt[i]); - } - - emd->SetBlockIds(bids); - emd->SetBlockElementType(types); - emd->SetBlockNodesPerElement(nodesPerElement); - emd->SetBlockNumberOfAttributesPerElement(numAtt); - } - else - { - vtkWarningMacro(<< - "ExodusModel finds no blocks. We thought that couldn't happen"); - } - - // Node set and Side set global information - - int nnsets; - int *nids = NULL; - int nssets; - int *sids = NULL; - ex_inquire(fid, EX_INQ_NODE_SETS, &nnsets, &floatVal, &charVal); - ex_inquire(fid, EX_INQ_SIDE_SETS, &nssets, &floatVal, &charVal); - emd->SetNumberOfNodeSets(nnsets); - emd->SetNumberOfSideSets(nssets); - - if (nnsets > 0) - { - nids = new int [nnsets]; - ex_get_node_set_ids(fid, nids); - emd->SetNodeSetIds(nids); - } - - if (nssets > 0) - { - sids = new int [nssets]; - ex_get_side_set_ids(fid, sids); - emd->SetSideSetIds(sids); - } - - // Block, Node set and Side set properties - - int nBlockProperties; - ex_inquire(fid, EX_INQ_EB_PROP, &nBlockProperties, &floatVal, &charVal); - - if (nBlockProperties > 0) - { - char **names = new char * [nBlockProperties]; - - for (i=0; i<nBlockProperties; i++) - { - names[i] = new char [MAX_STR_LENGTH + 1]; - } - - ex_get_prop_names(fid, EX_ELEM_BLOCK, names); - - int *val = new int [nBlockProperties * nblocks]; - int *v = val; - - for (i=0; i<nBlockProperties; i++) - { - ex_get_prop_array(fid, EX_ELEM_BLOCK, names[i], v); - v += nblocks; - } - - if (nBlockProperties > 0) - { - emd->SetBlockPropertyNames(nBlockProperties, names); - emd->SetBlockPropertyValue(val); - } - else - { - delete [] names; - delete [] val; - } - } - - int nNodeSetProperties; - ex_inquire(fid, EX_INQ_NS_PROP, &nNodeSetProperties, &floatVal, &charVal); - - if (nNodeSetProperties > 0) - { - char **names = new char * [nNodeSetProperties]; - - for (i=0; i<nNodeSetProperties; i++) - { - names[i] = new char [MAX_STR_LENGTH + 1]; - } - - ex_get_prop_names(fid, EX_NODE_SET, names); - - int *val = new int [nNodeSetProperties * nnsets]; - int *v = val; - - for (i=0; i<nNodeSetProperties; i++) - { - ex_get_prop_array(fid, EX_NODE_SET, names[i], v); - v += nnsets; - } - - if (nNodeSetProperties > 0) - { - emd->SetNodeSetPropertyNames(nNodeSetProperties, names); - emd->SetNodeSetPropertyValue(val); - } - else - { - delete [] names; - delete [] val; - } - } - - int nSideSetProperties; - ex_inquire(fid, EX_INQ_SS_PROP, &nSideSetProperties, &floatVal, &charVal); - - if (nSideSetProperties > 0) - { - char **names = new char * [nSideSetProperties]; - - for (i=0; i<nSideSetProperties; i++) - { - names[i] = new char [MAX_STR_LENGTH + 1]; - } - - ex_get_prop_names(fid, EX_SIDE_SET, names); - - int *val = new int [nSideSetProperties * nssets]; - int *v = val; - - for (i=0; i<nSideSetProperties; i++) - { - ex_get_prop_array(fid, EX_SIDE_SET, names[i], v); - v += nssets; - } - - if (nSideSetProperties > 0) - { - emd->SetSideSetPropertyNames(nSideSetProperties, names); - emd->SetSideSetPropertyValue(val); - } - else - { - delete [] names; - delete [] val; - } - } - - // Element variables and node variables: - - int nEltVars; - int nNodeVars; - - ex_get_var_param(fid, "E", &nEltVars); - ex_get_var_param(fid, "N", &nNodeVars); - - if (nEltVars > 0) - { - char **names = new char * [nEltVars]; - - for (i=0; i<nEltVars; i++) - { - names[i] = new char [MAX_STR_LENGTH + 1]; - } - - ex_get_var_names(fid, "E", nEltVars, names); - - this->RemoveBeginningAndTrailingSpaces(names, nEltVars); - - emd->SetElementVariableInfo(nEltVars, names, 0, NULL, NULL, NULL); - } - - if (nNodeVars > 0) - { - char **names = new char * [nNodeVars]; - - for (i=0; i<nNodeVars; i++) - { - names[i] = new char [MAX_STR_LENGTH + 1]; - } - - ex_get_var_names(fid, "N", nNodeVars, names); - - this->RemoveBeginningAndTrailingSpaces(names, nNodeVars); - - emd->SetNodeVariableInfo(nNodeVars, names, 0, NULL, NULL, NULL); - } - - // Block/element variable truth table, by block by element variable - - if ((nEltVars > 0) && (nblocks > 0)) - { - int *tt = new int [nEltVars * nblocks]; - - ex_get_elem_var_tab(fid, nblocks, nEltVars, tt); - - emd->SetElementVariableTruthTable(tt); - } - - // Global variables - - int nvars = 0; - ex_get_var_param(fid, "G", &nvars); - - if (nvars > 0) - { - char **nms = new char * [nvars]; - for (i=0; i<nvars; i++) - { - nms[i] = new char [MAX_STR_LENGTH + 1]; - } - - ex_get_var_names(fid, "G", nvars, nms); - - emd->SetGlobalVariableNames(nvars, nms); - } - - ex_opts(EX_VERBOSE); // turn error messages back on - - return 0; -} - -void vtkExodusModel::CopyDoubleToFloat(float *f, double *d, int len) -{ - for (int i=0; i<len; i++) - { - f[i] = (float)d[i]; - } -} -// TODO - We should probably have an option to omit ghost cells -// from the metadata. - -int vtkExodusModel::SetLocalInformation(vtkUnstructuredGrid *ugrid, - int fid, int timeStep, int geoCount, int compute_word_size) -{ - vtkModelMetadata *emd = this->GetModelMetadata(); - int i; - - int newTimeStep = (timeStep != emd->GetTimeStepIndex()); - - int newGeometry = (geoCount > this->GeometryCount); - this->GeometryCount = geoCount; - - if (!newTimeStep && !newGeometry) - { - return 0; - } - - ex_opts(0); // turn off all error messages - - int use_floats = (compute_word_size == sizeof(float)); - - if (newTimeStep) - { - emd->SetGlobalVariableValue(NULL); - - // GLOBAL VARIABLE VALUES AT THIS TIMESTEP - - int numGlobalVars = emd->GetNumberOfGlobalVariables(); - int ts = timeStep + 1; - - emd->SetTimeStepIndex(timeStep); - - if (numGlobalVars > 0) - { - float *varf = new float [numGlobalVars]; - - if (use_floats) - { - ex_get_glob_vars(fid, ts, numGlobalVars, varf); - } - else - { - double *vard = new double [numGlobalVars]; - ex_get_glob_vars(fid, ts, numGlobalVars, vard); - - for (i=0; i<numGlobalVars; i++) - { - varf[i] = (float)vard[i]; - } - delete [] vard; - } - - emd->SetGlobalVariableValue(varf); - } - } - - if (ugrid->GetNumberOfCells() < 1) - { - return 0; - } - - // Big assumptions - this vtkUnstructuredGrid was created with the - // vtkExodusReader. If it contains any elements of a block, it - // contains all the elements, and they appear together and in the - // same order in the vtkUnstructuredGrid as they do in the Exodus file. - // The order of the blocks may be different in the vtkUnstructuredGrid - // than it is in the Exodus file. The vtkUnstructuredGrid - // contains cell arrays called BlockId and - // GlobalElementId and a point array called GlobalNodeId. - // - // Another assumption is that the element number map in the Exodus file - // matches the global element IDs in the vtkUnstructuredGrid, and the - // node number map in the Exodus file matches the global node IDs in - // the vtkUnstructuredGrid. (That is, we are both using the same - // global IDs to identify points and cells.) - // - // TODO - fix behavior on error - - // Check input - - int *blockIds = NULL; - int *cellIds = NULL; - int *pointIds = NULL; - - vtkDataArray *da = ugrid->GetCellData()->GetArray("BlockId"); - if (da) - { - vtkIntArray *ia = vtkIntArray::SafeDownCast(da); - if (ia) - { - blockIds = ia->GetPointer(0); - } - } - - da = ugrid->GetCellData()->GetArray("GlobalElementId"); - if (da) - { - vtkIntArray *ia = vtkIntArray::SafeDownCast(da); - if (ia) - { - cellIds = ia->GetPointer(0); - } - } - - da = ugrid->GetPointData()->GetArray("GlobalNodeId"); - if (da) - { - vtkIntArray *ia = vtkIntArray::SafeDownCast(da); - if (ia) - { - pointIds = ia->GetPointer(0); - } - } - - if (!blockIds || !cellIds || !pointIds) - { - return 1; - } - - int nblocks = emd->GetNumberOfBlocks(); - int ncells = ugrid->GetNumberOfCells(); - int npoints = ugrid->GetNumberOfPoints(); - if ((nblocks < 1) || (ncells < 1)) return 1; - - if (newGeometry) - { - // BLOCK, NODE SET, AND SIDE SET LISTS - - emd->FreeBlockDependentData(); - - this->SetLocalBlockInformation(fid, use_floats, blockIds, - cellIds, ncells); - - if (emd->GetNumberOfNodeSets() > 0) - { - this->SetLocalNodeSetInformation(fid, use_floats, pointIds, npoints); - } - - if (emd->GetNumberOfSideSets() > 0) - { - this->SetLocalSideSetInformation(fid, use_floats, cellIds, ncells); - } - } - - ex_opts(EX_VERBOSE); // turn error messages back on - - return 0; -} -int vtkExodusModel::SetLocalBlockInformation( - int fid, int use_floats, int *blockIds , int *cellIds, int ncells) -{ - int i; - - vtkModelMetadata *emd = this->GetModelMetadata(); - - int nblocks = emd->GetNumberOfBlocks(); - - if (nblocks < 1) - { - return 0; // maybe this is really an error, I'm not sure - } - - int *count = new int [nblocks]; - memset(count, 0, sizeof(int) * nblocks); - int lastId = -1; - int idx = 0; - - std::map<int,int> blockIdStart; - std::map<int,int>::iterator it; - - for (i=0; i<ncells; i++) - { - int id = blockIds[i]; - - if (id != lastId) - { - idx = emd->GetBlockLocalIndex(id); - - if ((idx < 0) || (count[idx] > 0)) - { - // Bad block ID or elements are not in order by block - - delete [] count; - return 1; - } - - blockIdStart.insert(std::map<int,int>::value_type(idx, i)); - lastId = id; - } - - count[idx]++; - } - - int *GlobalBlockIds = emd->GetBlockIds(); - - for (idx=0; idx<nblocks; idx++) - { - if (count[idx] == 0) continue; - - char type[MAX_STR_LENGTH+1]; - int numElem, numNodes, numAttr; - - ex_get_elem_block(fid, GlobalBlockIds[idx], type, - &numElem, &numNodes, &numAttr); - - if (numElem != count[idx]) - { - // Ugrid does not contain all the elements for this block - delete [] count; - return 1; - } - } - - emd->SetBlockNumberOfElements(count); - - int *idList = new int [ncells]; - float *attsF = NULL; - double *attsD = NULL; - - int natts = emd->GetSizeBlockAttributeArray(); - - if (natts > 0) - { - attsF = new float [natts]; - - if (!use_floats) - { - attsD = new double [natts]; - } - } - - int *eltIdIdx = emd->GetBlockElementIdListIndex(); - int *attIdx = emd->GetBlockAttributesIndex(); - int *numAttsPerElement = emd->GetBlockNumberOfAttributesPerElement(); - - for (idx=0; idx<nblocks; idx++) - { - if (count[idx] == 0) continue; - - int to = eltIdIdx[idx]; - - it = blockIdStart.find(idx); - int from = it->second; - - memcpy(idList + to, cellIds + from, sizeof(int) * count[idx]); - - if (attsF == NULL) continue; - - if (numAttsPerElement[idx] == 0) continue; - - to = attIdx[idx]; - - if (use_floats) - { - ex_get_elem_attr(fid, GlobalBlockIds[idx], attsF + to); - } - else - { - ex_get_elem_attr(fid, GlobalBlockIds[idx], attsD + to); - } - } - - blockIdStart.erase(blockIdStart.begin(), blockIdStart.end()); - - emd->SetBlockElementIdList(idList); - - if (attsF) - { - if (!use_floats) - { - this->CopyDoubleToFloat(attsF, attsD, natts); - delete [] attsD; - } - emd->SetBlockAttributes(attsF); - } - - return 0; -} -int vtkExodusModel::SetLocalNodeSetInformation( - int fid, int use_floats, int *pointIds, int npoints) -{ - int i, j; - float dummyFloat; - char dummyChar; - - vtkModelMetadata *emd = this->GetModelMetadata(); - - // external node IDs in file - - int numNodesInFile = 0; - ex_inquire(fid, EX_INQ_NODES, &numNodesInFile, &dummyFloat, &dummyChar); - int *nodeMap = new int [numNodesInFile]; - - ex_get_node_num_map(fid, nodeMap); -cerr << "node num map : "; -for (i = 0; i < numNodesInFile; i ++) -{ - cerr << nodeMap[i] << " "; -} -cerr << endl; - - // external node IDs in vtkUnstructuredGrid - - std::map<int, int> localNodeIdMap; - std::map<int, int>::iterator it; - - for (i=0; i<npoints; i++) - { - localNodeIdMap.insert(std::map<int,int>::value_type(pointIds[i], i)); - } - - int nns = emd->GetNumberOfNodeSets(); - int *numDF = new int [nns]; - - int *nssize = new int [nns]; - memset(nssize, 0, sizeof(int) * nns); - - vtkIntArray *nsNodeIds = vtkIntArray::New(); - nsNodeIds->SetNumberOfComponents(1); - - vtkFloatArray *nsDF = vtkFloatArray::New(); - nsDF->SetNumberOfComponents(1); - - int total = 0; - - int *nodeSetIds = emd->GetNodeSetIds(); - - for (i=0; i<nns; i++) - { - int nnodes = 0; - ex_get_node_set_param(fid, nodeSetIds[i], &nnodes, numDF+i); - - if (nnodes == 0) continue; - - int *nodes = new int [nnodes]; - - ex_get_node_set(fid, nodeSetIds[i], nodes); - - float *dfF = NULL; - double *dfD = NULL; - - if (numDF[i]) - { - dfF = new float [nnodes]; - - if (use_floats) - { - ex_get_node_set_dist_fact(fid, nodeSetIds[i], dfF); - } - else - { - dfD = new double [nnodes]; - ex_get_node_set_dist_fact(fid, nodeSetIds[i], dfD); - this->CopyDoubleToFloat(dfF, dfD, nnodes); - delete [] dfD; - } - } - - // find which of my points are in this node set - - for (j=0; j<nnodes; j++) - { - int lid = nodes[j] - 1; - int gid = nodeMap[lid]; - - it = localNodeIdMap.find(gid); - - if (it == localNodeIdMap.end()) continue; // I don't have that one - - nsNodeIds->InsertNextValue(gid); - - if (dfF) - { - nsDF->InsertNextValue(dfF[j]); - } - - nssize[i]++; - total++; - } - - delete [] nodes; - if (dfF) delete [] dfF; - } - - delete [] nodeMap; - - localNodeIdMap.erase(localNodeIdMap.begin(), localNodeIdMap.end()); - - emd->SetNodeSetSize(nssize); - - if (total > 0) - { - int *nsndf = new int [nns]; - - for (i=0; i<nns; i++) - { - if (numDF[i] > 0) - { - nsndf[i] = nssize[i]; - } - else - { - nsndf[i] = 0; - } - } - - delete [] numDF; - - emd->SetNodeSetNumberOfDistributionFactors(nsndf); - - int *ids = new int [total]; - memcpy(ids, nsNodeIds->GetPointer(0), sizeof(int) * total); - - nsNodeIds->Delete(); - - emd->SetNodeSetNodeIdList(ids); - - int sizeDF = nsDF->GetNumberOfTuples(); - - if (sizeDF > 0) - { - float *df = new float [sizeDF]; - memcpy(df, nsDF->GetPointer(0), sizeof(float) * sizeDF); - emd->SetNodeSetDistributionFactors(df); - } - nsDF->Delete(); - } - else - { - delete [] numDF; - nsNodeIds->Delete(); - nsDF->Delete(); - } - - return 0; -} -int vtkExodusModel::SetLocalSideSetInformation( - int fid, int use_floats, int *cellIds, int ncells) -{ - // TODO - go over this and check it - - int i, j, k; - float dummyFloat; - char dummyChar; - - vtkModelMetadata *emd = this->GetModelMetadata(); - - // external cell IDs in file - - int numCellsInFile = 0; - ex_inquire(fid, EX_INQ_ELEM, &numCellsInFile, &dummyFloat, &dummyChar); - int *cellMap = new int [numCellsInFile]; - - ex_get_elem_num_map(fid, cellMap); - - // external cell IDs in vtkUnstructuredGrid - - std::map<int, int> localCellIdMap; - std::map<int, int>::iterator it; - - for (i=0; i<ncells; i++) - { - localCellIdMap.insert(std::map<int,int>::value_type(cellIds[i], i)); - } - - int nss = emd->GetNumberOfSideSets(); - int *numDF = new int [nss]; - - int *sssize = new int [nss]; - memset(sssize, 0, sizeof(int) * nss); - - vtkIntArray *ssCellIds = vtkIntArray::New(); - ssCellIds->SetNumberOfComponents(1); - - vtkIntArray *ssSideIds = vtkIntArray::New(); - ssSideIds->SetNumberOfComponents(1); - - vtkIntArray *ssDFPerSide = vtkIntArray::New(); - ssDFPerSide->SetNumberOfComponents(1); - - vtkFloatArray *ssDF = vtkFloatArray::New(); - ssDF->SetNumberOfComponents(1); - - int total = 0; - - int *sideSetIds = emd->GetSideSetIds(); - - for (i=0; i<nss; i++) - { - int nsides = 0; - ex_get_side_set_param(fid, sideSetIds[i], &nsides, numDF+i); - - if (nsides == 0) continue; - - int *elts = new int [nsides]; - int *sides = new int [nsides]; - - ex_get_side_set(fid, sideSetIds[i], elts, sides); - - // find which of my cells have sides in this side set - - for (j=0; j<nsides; j++) - { - int lid = elts[j] - 1; - int gid = cellMap[lid]; - - it = localCellIdMap.find(gid); - - if (it == localCellIdMap.end()) - { - elts[j] = -1; // flag this one, I don't have it - continue; - } - - ssCellIds->InsertNextValue(gid); - - ssSideIds->InsertNextValue(sides[j]); - - sssize[i]++; - total++; - } - - delete [] sides; - - if (sssize[i] > 0) - { - if (numDF[i] > 0) - { - int *nodeCount = new int [nsides]; - int *nodeList = new int [numDF[i]]; - - ex_get_side_set_node_list(fid, sideSetIds[i], nodeCount, nodeList); - - delete [] nodeList; - - float *dfF = NULL; - double *dfD = NULL; - int nextdf = 0; - - dfF = new float [numDF[i]]; - - if (use_floats) - { - ex_get_side_set_dist_fact(fid, sideSetIds[i], dfF); - } - else - { - dfD = new double [numDF[i]]; - ex_get_side_set_dist_fact(fid, sideSetIds[i], dfD); - this->CopyDoubleToFloat(dfF, dfD, numDF[i]); - delete [] dfD; - } - - for (j=0; j<nsides; j++) - { - if (elts[j] >= 0) - { - ssDFPerSide->InsertNextValue(nodeCount[j]); - - for (k=0; k < nodeCount[j]; k++) - { - ssDF->InsertNextValue(dfF[nextdf++]); - } - } - else - { - nextdf += nodeCount[j]; - } - } - } - else - { - for (j=0; j<sssize[i]; j++) - { - ssDFPerSide->InsertNextValue(0); - } - } - } - - delete [] elts; - } - - delete [] cellMap; - - localCellIdMap.erase(localCellIdMap.begin(), localCellIdMap.end()); - - emd->SetSideSetSize(sssize); - - if (total == 0) - { - delete [] numDF; - delete [] sssize; - ssCellIds->Delete(); - ssSideIds->Delete(); - ssDFPerSide->Delete(); - ssDF->Delete(); - return 0; - } - - int n = ssCellIds->GetNumberOfTuples(); - - int *buf = new int [n]; - memcpy(buf, ssCellIds->GetPointer(0), sizeof(int) * n); - ssCellIds->Delete(); - - emd->SetSideSetElementList(buf); - - buf = new int [n]; - memcpy(buf, ssSideIds->GetPointer(0), sizeof(int) * n); - ssSideIds->Delete(); - - emd->SetSideSetSideList(buf); - - buf = new int [n]; - memcpy(buf, ssDFPerSide->GetPointer(0), sizeof(int) * n); - ssDFPerSide->Delete(); - - emd->SetSideSetNumDFPerSide(buf); - - int *nssdf = new int [nss]; - - int *ndf = emd->GetSideSetNumDFPerSide(); - - int totaldf = 0; - - for (i=0; i<nss; i++) - { - if ((numDF[i] > 0) && (sssize[i] > 0)) - { - nssdf[i] = 0; - - for (j=0; j<sssize[i]; j++) - { - nssdf[i] += *ndf++; - } - - totaldf += nssdf[i]; - } - else - { - nssdf[i] = 0; - - ndf += sssize[i]; - } - } - - delete [] numDF; - - emd->SetSideSetNumberOfDistributionFactors(nssdf); - - if (totaldf > 0) - { - float *df = new float [totaldf]; - memcpy(df, ssDF->GetPointer(0), sizeof(float) * totaldf); - emd->SetSideSetDistributionFactors(df); - } - - ssDF->Delete(); - - return 0; -} - -//------------------------------------------------- -// Element variables -//------------------------------------------------- -int vtkExodusModel::AddUGridElementVariable(char *ugridVarName, - char *origName, int numComponents) -{ - vtkModelMetadata *emd = this->GetModelMetadata(); - - int rc = emd->AddUGridElementVariable(ugridVarName, - origName, numComponents); - - return rc; -} -int vtkExodusModel::RemoveUGridElementVariable(char *ugridVarName) -{ - vtkModelMetadata *emd = this->GetModelMetadata(); - - int rc = emd->RemoveUGridElementVariable(ugridVarName); - - return rc; -} -void vtkExodusModel::SetElementVariableInfo(int numOrigNames, char **origNames, - int numNames, char **names, int *numComp, int *map) -{ - vtkModelMetadata *emd = this->GetModelMetadata(); - - emd->SetElementVariableInfo(numOrigNames, origNames, - numNames, names, numComp, map); -} - -//------------------------------------------------- -// Node variables -//------------------------------------------------- -int vtkExodusModel::AddUGridNodeVariable(char *ugridVarName, - char *origName, int numComponents) -{ - vtkModelMetadata *emd = this->GetModelMetadata(); - - int rc = emd->AddUGridNodeVariable(ugridVarName, - origName, numComponents); - - return rc; -} -int vtkExodusModel::RemoveUGridNodeVariable(char *ugridVarName) -{ - vtkModelMetadata *emd = this->GetModelMetadata(); - - int rc = emd->RemoveUGridNodeVariable(ugridVarName); - - return rc; -} -void vtkExodusModel::SetNodeVariableInfo(int numOrigNames, char **origNames, - int numNames, char **names, int *numComp, int *map) -{ - vtkModelMetadata *emd = this->GetModelMetadata(); - - emd->SetNodeVariableInfo(numOrigNames, origNames, - numNames, names, numComp, map); -} -void vtkExodusModel::RemoveBeginningAndTrailingSpaces(char **names, int len) -{ - size_t i, j; - - for (i=0; i<static_cast<size_t>(len); i++) - { - char *c = names[i]; - size_t nmlen = strlen(c); - - char *cbegin = c; - char *cend = c + nmlen - 1; - - // remove spaces or non-printing character from start and end - - for (j=0; j<nmlen; j++) - { - if (!isgraph(*cbegin)) cbegin++; - else break; - } - - for (j=0; j<nmlen; j++) - { - if (!isgraph(*cend)) cend--; - else break; - } - - if (cend < cbegin) - { - sprintf(names[i], "null_%u", static_cast<unsigned int>(i)); - continue; - } - - size_t newlen = cend - cbegin + 1; - - if (newlen < nmlen) - { - for (j=0; j<newlen; j++) - { - *c++ = *cbegin++; - } - *c = '\0'; - } - } -} - -//------------------------------------------------- -//------------------------------------------------- - -void vtkExodusModel::PrintSelf(ostream& os, vtkIndent indent) -{ - this->Superclass::PrintSelf(os,indent); - - os << indent << "ModelMetadata: " << this->ModelMetadata << endl; - os << indent << "GeometryCount: " << this->GeometryCount << endl; -} diff --git a/IO/Exodus/vtkExodusModel.h b/IO/Exodus/vtkExodusModel.h deleted file mode 100644 index 2c24ab91900f6e6875ca4edcb0837971dd22e671..0000000000000000000000000000000000000000 --- a/IO/Exodus/vtkExodusModel.h +++ /dev/null @@ -1,170 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkExodusModel.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -/*---------------------------------------------------------------------------- - Copyright (c) Sandia Corporation - See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details. -----------------------------------------------------------------------------*/ - -// .NAME vtkExodusModel - Exodus Model -// -// .SECTION Description -// -// A vtkUnstructuredGrid output by vtkExodusReader or vtkPExodusReader -// is missing a great deal of initialization and static model data -// that is in an Exodus II file. (Global variables, properties, -// node sets, side sets, and so on.) This data can be stored in a -// vtkModelMetadata object, which can be initialized using -// this vtkExodusModel class. -// -// This class can be initialized with a file handle for an open Exodus -// file, and the vtkUnstructuredGrid derived from that file. The methods -// used would be SetGlobalInformation, SetLocalInformation, -// AddUGridElementVariable and AddUGridNodeVariable. The vtkExodusReader -// does this. -// -// It can also be initialized (using UnpackExodusModel) from a -// vtkUnstructuredGrid that has had metadata packed into it's field -// arrays with PackExodusModel. The vtkExodusIIWriter does this. -// -// If you plan to write out the Exodus file (with vtkExodusIIWriter), -// you should direct the Exodus reader to create a vtkExodusModel object. -// This will be used by the Exodus writer to create a correct Exodus II -// file on output. In addition, the vtkDistributedDataFilter is -// cognizant of the ExodusModel object and will unpack, extract, merge, -// and pack these objects associated with the grids it is partitioning. -// -// .SECTION See also -// vtkExodusReader vtkPExodusReader vtkExodusIIWriter vtkModelMetadata -// vtkDistributedDataFilter - -#ifndef __vtkExodusModel_h -#define __vtkExodusModel_h - -#include "vtkIOExodusModule.h" // For export macro -#include "vtkObject.h" - -#include "vtkModelMetadata.h" // So those who include vtkExodusModel don't - // need to know anything about ModelMetadata - -class vtkIdTypeArray; -class vtkUnstructuredGrid; - -class VTKIOEXODUS_EXPORT vtkExodusModel : public vtkObject -{ -public: - vtkTypeMacro(vtkExodusModel, vtkObject); - virtual void PrintSelf(ostream &os, vtkIndent indent); - - static vtkExodusModel *New(); - - // Description: - // In order to write a correct Exodus file from a - // vtkUnstructuredGrid, we need to know the global data - // which does not get represented in the UGrid. - // Initialize, with an open Exodus file, all the global - // fields of the ExodusModel object. fid is the file handle - // of the opened Exodus file. compute_word_size is the - // size of floating point values exchanged with the - // the Exodus library. (It's set in ex_open or ex_create.) - // The global fields are those which don't depend on - // which cells or field arrays are being read from the - // file. - - int SetGlobalInformation(int fid, int compute_word_size); - - // Description: - // In order to write Exodus files from vtkUnstructuredGrid - // objects that were read from Exodus files, we need to know - // the mapping from variable names in the UGrid to variable - // names in the Exodus file. (The Exodus reader combines - // scalar variables with similar names into vectors in the - // UGrid.) When building the UGrid to which this - // ExodusModel refers, add each element and node variable - // name with this call, including the name of original variable - // that yielded it's first component, and the number of components. - // If a variable is removed from the UGrid, remove it from - // the ExodusModel. (If this information is missing or - // incomplete, the ExodusIIWriter can still do something - // sensible in creating names for variables.) - - int AddUGridElementVariable(char *ugridVarName, char *origName, int numComponents); - int RemoveUGridElementVariable(char *ugridVarName); - - int AddUGridNodeVariable(char *ugridVarName, char *origName, int numComponents); - int RemoveUGridNodeVariable(char *ugridVarName); - - void SetElementVariableInfo(int numOrigNames, char **origNames, - int numNames, char **names, int *numComp, int *map); - void SetNodeVariableInfo(int numOrigNames, char **origNames, - int numNames, char **names, int *numComp, int *map); - - // Description: - // Set the local information in the ExodusModel. This is - // information which depends on which blocks were read in, - // and which time step was read in. - // (Example - count of cells in each block, values of global - // variables, node IDs for nodes in each node set.) - // Provide the ugrid, the time step (the first time step is 0), - // the handle of an open Exodus file, and the - // size of floating point values exchanged with the Exodus library. - // Also indicate with a 1 if the geometry has changed (new blocks - // or blocks removed) since the last call. (When in doubt set to 1.) - // Please call SetGlobalInformation once before calling - // SetLocalInformation. SetLocalInformation may be called many - // times if different subsets of an Exodus file are read. Each - // call replaces the previous local values. - - int SetLocalInformation(vtkUnstructuredGrid *ugrid, - int fid, int timeStep, int newGeometry, int compute_word_size); - - // Description: - // Set or get the underlying vtkModelMetadata object. - - vtkModelMetadata *GetModelMetadata(); - void SetModelMetadata(vtkModelMetadata *emData); - - // Description:: - // Reset all fields to their initial value. - - void Reset(); - -protected: - - vtkExodusModel(); - ~vtkExodusModel(); - -private: - - vtkModelMetadata *CheckSetModelMetadata(); - - static void CopyDoubleToFloat(float *f, double *d, int len); - - int SetLocalBlockInformation( - int fid, int use_floats, int *blockIds , int *cellIds, int ncells); - int SetLocalNodeSetInformation( - int fid, int use_floats, int *pointIds, int npoints); - int SetLocalSideSetInformation( - int fid, int use_floats, int *cellIds, int ncells); - - void RemoveBeginningAndTrailingSpaces(char **names, int len); - - vtkModelMetadata *ModelMetadata; - - int GeometryCount; - - vtkExodusModel(const vtkExodusModel&); // Not implemented - void operator=(const vtkExodusModel&); // Not implemented -}; -#endif diff --git a/IO/Exodus/vtkModelMetadata.cxx b/IO/Exodus/vtkModelMetadata.cxx index 24c5dbd0bd3a1d475c6b9ba1af71c5b3d896e7ed..df6e1357c7c1b8ffa24c56c2b6c907745b88e3b9 100644 --- a/IO/Exodus/vtkModelMetadata.cxx +++ b/IO/Exodus/vtkModelMetadata.cxx @@ -71,9 +71,6 @@ void vtkModelMetadata::InitializeAllMetadata() { this->Title = NULL; - this->NumberOfQARecords = 0; - this->QARecord = NULL; - this->NumberOfInformationLines = 0; this->InformationLine = NULL; @@ -185,7 +182,6 @@ void vtkModelMetadata::FreeAllGlobalData() // or which variables are read in. this->SetTitle(NULL); - this->FreeQARecords(); this->SetInformationLines(0, NULL); this->SetCoordinateNames(0, NULL); @@ -239,8 +235,6 @@ void vtkModelMetadata::FreeBlockDependentData() this->SetBlockElementIdList(NULL); this->SetBlockAttributes(NULL); - this->SetNodeSetSize(NULL); - this->SetNodeSetNumberOfDistributionFactors(NULL); this->SetNodeSetNodeIdList(NULL); this->SetNodeSetDistributionFactors(NULL); @@ -344,50 +338,6 @@ int vtkModelMetadata::GetInformationLines(char ***lines) const return this->NumberOfInformationLines; } -void vtkModelMetadata::FreeQARecords() -{ - if ((this->NumberOfQARecords > 0) && this->QARecord) - { - for (int i=0; i<this->NumberOfQARecords; i++) - { - if (this->QARecord[i]) - { - delete [] this->QARecord[i][0]; - delete [] this->QARecord[i][1]; - delete [] this->QARecord[i][2]; - delete [] this->QARecord[i][3]; - } - } - delete [] this->QARecord; - } - this->QARecord = NULL; - this->NumberOfQARecords = 0; -} -void vtkModelMetadata::SetQARecords(int nrecords, char *rec[][4]) -{ - this->FreeQARecords(); - - if (nrecords > 0) - { - this->QARecord = rec; - this->NumberOfQARecords = nrecords; - } -} - -void vtkModelMetadata::GetQARecord(int which, - char **name, char **ver, char **date, char **time) const -{ - if ( which >= this->NumberOfQARecords) - { - return; - } - - *name = this->QARecord[which][0]; - *ver = this->QARecord[which][1]; - *date = this->QARecord[which][2]; - *time = this->QARecord[which][3]; -} - void vtkModelMetadata::SetTimeSteps(int num, float *steps) { FREE(this->TimeStepValues); @@ -408,40 +358,6 @@ void vtkModelMetadata::SetCoordinateNames(int dimension, char **n) this->Dimension = dimension; } -//------------------------------------------------- -// Blocks -//------------------------------------------------- -int vtkModelMetadata::GetBlockLocalIndex(int id) -{ - if (this->BlockIdIndex == NULL) - { - this->BlockIdIndex = new vtkModelMetadataSTLCloak; - } - - std::map<int, int> blockIdIndex = this->BlockIdIndex->IntMap; - - if (blockIdIndex.size() == 0) - { - for (int i=0; i<this->NumberOfBlocks; i++) - { - int gid = this->BlockIds[i]; - - blockIdIndex.insert(std::map<int,int>::value_type(gid, i)); - } - } - - std::map<int,int>::iterator mapit = blockIdIndex.find(id); - - int retVal = -1; - - if (mapit != blockIdIndex.end()) - { - retVal = mapit->second; - } - - return retVal; -} - void vtkModelMetadata::SetBlockIds(int *b) { FREE(this->BlockIds); @@ -580,87 +496,6 @@ void vtkModelMetadata::SetNodeSetDistributionFactors(float *d) this->NodeSetDistributionFactors = d; } -int vtkModelMetadata::BuildNodeSetNodeIdListIndex() -{ - int nsets = this->NumberOfNodeSets; - int *size = this->NodeSetSize; - - if ((nsets < 1) || !size) - { - return 1; - } - - if (this->NodeSetNodeIdListIndex) - { - delete [] this->NodeSetNodeIdListIndex; - } - this->NodeSetNodeIdListIndex = new int [ nsets ]; - - int idx = 0; - for (int i=0; i<nsets; i++) - { - this->NodeSetNodeIdListIndex[i] = idx; - idx += size[i]; - } - - this->SumNodesPerNodeSet = idx; - return 0; -} -int vtkModelMetadata::BuildNodeSetDistributionFactorIndex() -{ - int nsets = this->NumberOfNodeSets; - int *numFactors = this->NodeSetNumberOfDistributionFactors; - - if ((nsets < 1) || !numFactors) - { - return 1; - } - - if (this->NodeSetDistributionFactorIndex) - { - delete [] this->NodeSetDistributionFactorIndex; - } - this->NodeSetDistributionFactorIndex = new int [ nsets ]; - - int idx = 0; - - for (int i=0; i<nsets; i++) - { - this->NodeSetDistributionFactorIndex[i] = idx; - - idx += numFactors[i]; - } - - this->SumDistFactPerNodeSet = idx; - - return 0; -} -int vtkModelMetadata::SetNodeSetSize(int *size) -{ - FREE(this->NodeSetSize); - - if (size) - { - this->NodeSetSize = size; - - this->BuildNodeSetNodeIdListIndex(); - } - - return 0; -} -int vtkModelMetadata::SetNodeSetNumberOfDistributionFactors(int *df) -{ - FREE(this->NodeSetNumberOfDistributionFactors); - - if (df) - { - this->NodeSetNumberOfDistributionFactors = df; - - this->BuildNodeSetDistributionFactorIndex(); - } - - return 0; -} //------------------------------------------------- // side set calculations @@ -690,19 +525,6 @@ void vtkModelMetadata::SetSideSetNumDFPerSide(int *s) this->SideSetNumDFPerSide= s; } -int vtkModelMetadata::SetSideSetSize(int *size) -{ - FREE(this->SideSetSize); - - if (size) - { - this->SideSetSize = size; - - this->BuildSideSetListIndex(); - } - - return 0; -} int vtkModelMetadata::SetSideSetNumberOfDistributionFactors(int *df) { FREE(this->SideSetNumberOfDistributionFactors) @@ -723,32 +545,18 @@ void vtkModelMetadata::SetSideSetDistributionFactors(float *d) this->SideSetDistributionFactors = d; } -int vtkModelMetadata::BuildSideSetListIndex() +int vtkModelMetadata::SetSideSetSize(int *size) { - int nsets = this->NumberOfSideSets; - int *size = this->SideSetSize; - - if ((nsets < 1) || !size) - { - return 1; - } - - if (this->SideSetListIndex) - { - delete [] this->SideSetListIndex; - } - this->SideSetListIndex = new int [ nsets ]; + FREE(this->SideSetSize); - int idx = 0; - for (int i=0; i<nsets; i++) + if (size) { - this->SideSetListIndex[i] = idx; - idx += size[i]; + this->SideSetSize = size; } - this->SumSidesPerSideSet = idx; return 0; } + int vtkModelMetadata::BuildSideSetDistributionFactorIndex() { int nsets = this->NumberOfSideSets; @@ -892,114 +700,6 @@ void vtkModelMetadata::SetMapToOriginalElementVariableNames(int *map) this->MapToOriginalElementVariableNames = map; } -int vtkModelMetadata::AddUGridElementVariable(char *ugridVarName, - char *origName, int numComponents) -{ - int i; - - int maxVarNames = this->OriginalNumberOfElementVariables; - - if (maxVarNames < 1) - { - vtkErrorMacro(<< "Can't have grid variables if there are no file variables"); - return 1; - } - - if (this->ElementVariableNames == NULL) - { - this->FreeUsedElementVariables(); - - this->ElementVariableNames = new char * [maxVarNames]; // upper bound - - memset(this->ElementVariableNames, 0, sizeof (char *) * maxVarNames); - - this->NumberOfElementVariables = 0; - this->MaxNumberOfElementVariables = maxVarNames; - - this->MapToOriginalElementVariableNames = new int [maxVarNames]; - this->ElementVariableNumberOfComponents = new int [maxVarNames]; - } - else if (vtkModelMetadata::FindNameOnList(ugridVarName, - this->ElementVariableNames, this->NumberOfElementVariables) >= 0) - { - return 0; // already got it - } - - int next = this->NumberOfElementVariables; - - if (next >= this->MaxNumberOfElementVariables) - { - int newSize = this->MaxNumberOfElementVariables + maxVarNames; - - char **names = new char * [newSize]; - memset(names, 0, sizeof(char *) * newSize); - int *comp = new int [newSize]; - int *map = new int [newSize]; - - memcpy(names, this->ElementVariableNames, sizeof(char *) * next); - memcpy(comp, this->ElementVariableNumberOfComponents, sizeof(int) * next); - memcpy(map, this->MapToOriginalElementVariableNames, sizeof(int) * next); - - this->FreeUsedElementVariables(); - - this->ElementVariableNames = names; - this->ElementVariableNumberOfComponents = comp; - this->MapToOriginalElementVariableNames = map; - - this->MaxNumberOfElementVariables = newSize; - } - - this->ElementVariableNames[next] = ugridVarName; - this->ElementVariableNumberOfComponents[next] = numComponents; - - int idx = -1; - - for (i=0; i<this->OriginalNumberOfElementVariables; i++) - { - if (!strcmp(this->OriginalElementVariableNames[i], origName)) - { - idx = i; - break; - } - } - - this->MapToOriginalElementVariableNames[next] = idx; - - this->NumberOfElementVariables++; - - delete [] origName; - - return 0; -} -int vtkModelMetadata::RemoveUGridElementVariable(char *ugridVarName) -{ - int i; - int maxVarNames = this->NumberOfElementVariables; - - int idx = vtkModelMetadata::FindNameOnList(ugridVarName, - this->ElementVariableNames, maxVarNames); - - if (idx == -1) return 1; - - delete [] this->ElementVariableNames[idx]; - - for (i=idx+1; i<maxVarNames; i++) - { - int prev = i-1; - - this->ElementVariableNames[prev] = this->ElementVariableNames[i]; - this->ElementVariableNumberOfComponents[prev] = - this->ElementVariableNumberOfComponents[i]; - this->MapToOriginalElementVariableNames[prev] = - this->MapToOriginalElementVariableNames[i]; - } - - this->ElementVariableNames[maxVarNames-1] = NULL; - - this->NumberOfElementVariables--; - - return 0; -} void vtkModelMetadata::SetElementVariableInfo(int numOrigNames, char **origNames, int numNames, char **names, int *numComp, int *map) { @@ -1064,114 +764,6 @@ void vtkModelMetadata::SetMapToOriginalNodeVariableNames(int *map) this->MapToOriginalNodeVariableNames = map; } -int vtkModelMetadata::AddUGridNodeVariable(char *ugridVarName, - char *origName, int numComponents) -{ - int i; - - int maxVarNames = this->OriginalNumberOfNodeVariables; - - if (maxVarNames < 1) - { - vtkErrorMacro(<< "Can't have grid variables if there are no file variables"); - return 1; - } - - if (this->NodeVariableNames == NULL) - { - this->FreeUsedNodeVariableNames(); - - this->NodeVariableNames = new char * [maxVarNames]; // upper bound - - memset(this->NodeVariableNames, 0, sizeof (char *) * maxVarNames); - - this->NumberOfNodeVariables = 0; - this->MaxNumberOfNodeVariables = maxVarNames; - - this->MapToOriginalNodeVariableNames = new int [maxVarNames]; - this->NodeVariableNumberOfComponents = new int [maxVarNames]; - } - else if (vtkModelMetadata::FindNameOnList(ugridVarName, - this->NodeVariableNames, this->NumberOfNodeVariables) >= 0) - { - return 0; // already got it - } - - int next = this->NumberOfNodeVariables; - - if (next >= this->MaxNumberOfNodeVariables) - { - int newSize = this->MaxNumberOfNodeVariables + maxVarNames; - - char **names = new char * [newSize]; - memset(names, 0, sizeof(char *) * newSize); - int *comp = new int [newSize]; - int *map = new int [newSize]; - - memcpy(names, this->NodeVariableNames, sizeof(char *) * next); - memcpy(comp, this->NodeVariableNumberOfComponents, sizeof(int) * next); - memcpy(map, this->MapToOriginalNodeVariableNames, sizeof(int) * next); - - this->FreeUsedNodeVariableNames(); - - this->NodeVariableNames = names; - this->NodeVariableNumberOfComponents = comp; - this->MapToOriginalNodeVariableNames = map; - - this->MaxNumberOfNodeVariables = newSize; - } - - this->NodeVariableNames[next] = ugridVarName; - this->NodeVariableNumberOfComponents[next] = numComponents; - - int idx = -1; - - for (i=0; i<this->OriginalNumberOfNodeVariables; i++) - { - if (!strcmp(this->OriginalNodeVariableNames[i], origName)) - { - idx = i; - break; - } - } - - this->MapToOriginalNodeVariableNames[next] = idx; - - this->NumberOfNodeVariables++; - - delete [] origName; - - return 0; -} -int vtkModelMetadata::RemoveUGridNodeVariable(char *ugridVarName) -{ - int i; - int maxVarNames = this->NumberOfNodeVariables; - - int idx = vtkModelMetadata::FindNameOnList(ugridVarName, - this->NodeVariableNames, maxVarNames); - - if (idx == -1) return 1; - - delete [] this->NodeVariableNames[idx]; - - for (i=idx+1; i<maxVarNames; i++) - { - int prev = i-1; - - this->NodeVariableNames[prev] = this->NodeVariableNames[i]; - this->NodeVariableNumberOfComponents[prev] = - this->NodeVariableNumberOfComponents[i]; - this->MapToOriginalNodeVariableNames[prev] = - this->MapToOriginalNodeVariableNames[i]; - } - - this->NodeVariableNames[maxVarNames-1] = NULL; - - this->NumberOfNodeVariables--; - - return 0; -} void vtkModelMetadata::SetNodeVariableInfo(int numOrigNames, char **origNames, int numNames, char **names, int *numComp, int *map) { @@ -1181,408 +773,6 @@ void vtkModelMetadata::SetNodeVariableInfo(int numOrigNames, char **origNames, this->SetMapToOriginalNodeVariableNames(map); } -//--------------------------------------------------------------- -// Merge and subset vtkModelMetadata objects. Because grids get -// merged and subsetted on their journey through the VTK reader and filters. -//--------------------------------------------------------------- - -int vtkModelMetadata::AppendFloatLists( - int numSubLists, - float *id1, int *id1Idx, int id1Len, - float *id2, int *id2Idx, int id2Len, - float **idNew, int **idNewIdx, int *idNewLen) -{ - if ((id1Len == 0) && (id2Len == 0)) - { - if (idNew) - { - *idNew = NULL; - } - if (idNewIdx) - { - *idNewIdx = NULL; - } - if (idNewLen) - { - *idNewLen = 0; - } - return 0; - } - - int i; - - int newIdListLength = id1Len + id2Len; - - float *newIdList = new float [newIdListLength]; - int *newIdListIndex = new int [numSubLists]; - - if (id1Len == 0) - { - memcpy(newIdList, id2, id2Len * sizeof(float)); - memcpy(newIdListIndex, id2Idx, numSubLists * sizeof(int)); - } - else if (id2Len == 0) - { - memcpy(newIdList, id1, id1Len * sizeof(float)); - memcpy(newIdListIndex, id1Idx, numSubLists * sizeof(int)); - } - else - { - newIdListIndex[0] = 0; - - int nextid = 0; - - for (i=0; i<numSubLists; i++) - { - int lastList = (i == numSubLists-1); - - float *ids = id1 + id1Idx[i]; - int numids = (lastList ? id1Len : id1Idx[i+1]) - id1Idx[i]; - if (numids > 0) - { - memcpy(newIdList + nextid, ids, numids * sizeof(float)); - nextid += numids; - } - - ids = id2 + id2Idx[i]; - numids = (lastList ? id2Len : id2Idx[i+1]) - id2Idx[i]; - - if (numids > 0) - { - memcpy(newIdList + nextid, ids, numids * sizeof(float)); - nextid += numids; - } - - if (!lastList) - { - newIdListIndex[i+1] = nextid; - } - else - { - newIdListLength = nextid; - } - } - } - - if (idNew) - { - *idNew = newIdList; - } - else - { - delete [] newIdList; - } - if (idNewIdx) - { - *idNewIdx = newIdListIndex; - } - else - { - delete [] newIdListIndex; - } - if (idNewLen) - { - *idNewLen = newIdListLength; - } - - return 0; -} -int vtkModelMetadata::AppendIntegerLists( - int numSubLists, - int *id1, int *id1Idx, int id1Len, - int *id2, int *id2Idx, int id2Len, - int **idNew, int **idNewIdx, int *idNewLen) -{ - if ((id1Len == 0) && (id2Len == 0)) - { - return 1; - } - - int i; - - int newIdListLength = id1Len + id2Len; - - int *newIdList = new int [newIdListLength]; - int *newIdListIndex = new int [numSubLists]; - - if (id1Len == 0) - { - memcpy(newIdList, id2, id2Len * sizeof(int)); - memcpy(newIdListIndex, id2Idx, numSubLists * sizeof(int)); - } - else if (id2Len == 0) - { - memcpy(newIdList, id1, id1Len * sizeof(int)); - memcpy(newIdListIndex, id1Idx, numSubLists * sizeof(int)); - } - else - { - newIdListIndex[0] = 0; - - int nextid = 0; - - for (i=0; i<numSubLists; i++) - { - int lastList = (i == numSubLists-1); - - int *ids = id1 + id1Idx[i]; - int numids = (lastList ? id1Len : id1Idx[i+1]) - id1Idx[i]; - if (numids > 0) - { - memcpy(newIdList + nextid, ids, numids * sizeof(int)); - nextid += numids; - } - - ids = id2 + id2Idx[i]; - numids = (lastList ? id2Len : id2Idx[i+1]) - id2Idx[i]; - - if (numids > 0) - { - memcpy(newIdList + nextid, ids, numids * sizeof(int)); - nextid += numids; - } - - if (!lastList) - { - newIdListIndex[i+1] = nextid; - } - else - { - newIdListLength = nextid; - } - } - } - - if (idNew) - { - *idNew = newIdList; - } - else - { - delete [] newIdList; - } - if (idNewIdx) - { - *idNewIdx = newIdListIndex; - } - else - { - delete [] newIdListIndex; - } - if (idNewLen) - { - *idNewLen = newIdListLength; - } - - return 0; -} - -int vtkModelMetadata::MergeIdLists(int numSubLists, - int *id1, int *id1Idx, int id1Len, - float *dist1, int *dist1Idx, int dist1Len, - int *id2, int *id2Idx, int id2Len, - float *dist2, int *dist2Idx, int dist2Len, - int **idNew, int **idNewIdx, int *idNewLen, - float **distNew, int **distNewIdx, int *distNewLen) -{ - if ((id1Len == 0) && (id2Len == 0)) - { - return 1; - } - - // Here we take two lists of IDs, and their associated lists of - // floating point factors. Some of the IDs in the second list may - // be duplicates of IDs in the first list, and we need to filter - // these out when we build the lists combining both. - - int i, id; - - int *newIdList=NULL; - int *newIdListIndex = NULL; - int newIdListLength = 0; - - float *newDistFact=NULL; - int *newDistFactIndex=NULL; - int newDistFactLength = 0; - - int maxIdListLength = id1Len + id2Len; - int maxDistFactLength = dist1Len + dist2Len; - - newIdList = new int [maxIdListLength]; - newIdListIndex = new int [numSubLists]; - newIdListIndex[0] = 0; - - int distFact = (maxDistFactLength > 0); - - if (distFact) - { - newDistFact = new float [maxDistFactLength]; - newDistFactIndex = new int [numSubLists]; - newDistFactIndex[0] = 0; - } - - if (id1Len == 0) - { - memcpy(newIdList, id2, sizeof(int) * id2Len); - memcpy(newIdListIndex, id2Idx, sizeof(int) * numSubLists); - newIdListLength = id2Len; - - if (newDistFact) - { - memcpy(newDistFact, dist2, sizeof(float) * dist2Len); - memcpy(newDistFactIndex, dist2Idx, sizeof(int) * numSubLists); - } - - newDistFactLength = dist2Len; - } - else if (id2Len == 0) - { - memcpy(newIdList, id1, sizeof(int) * id1Len); - memcpy(newIdListIndex, id1Idx, sizeof(int) * numSubLists); - newIdListLength = id1Len; - - if (newDistFact) - { - memcpy(newDistFact, dist1, sizeof(float) * dist1Len); - memcpy(newDistFactIndex, dist1Idx, sizeof(int) * numSubLists); - } - - newDistFactLength = dist1Len; - } - else - { - int nextid = 0; - int nextdf = 0; - - float *dist = NULL; - int numdf = 0; - - for (i=0; i<numSubLists; i++) - { - int lastList = (i == numSubLists-1); - - int *ids = id1 + id1Idx[i]; - int numids = (lastList ? id1Len : id1Idx[i+1]) - id1Idx[i]; - if (numids > 0) - { - memcpy(newIdList + nextid, ids, numids * sizeof(int)); - } - - nextid += numids; - - if (distFact) - { - dist = dist1 + dist1Idx[i]; - numdf = (lastList ? dist1Len : dist1Idx[i+1]) - dist1Idx[i]; - if (numdf > 0) - { - memcpy(newDistFact + nextdf, dist, numdf * sizeof(float)); - nextdf += numdf; - } - } - - // Make a set of the ids we've just written. We only want to add - // ids from list 2 if they did not exist in list 1. - - std::set<int> idSet; - - for (id=0; id < numids; id++) - { - idSet.insert(ids[id]); - } - - ids = id2 + id2Idx[i]; - numids = (lastList ? id2Len : id2Idx[i+1]) - id2Idx[i]; - - if (distFact) - { - dist = dist2 + dist2Idx[i]; - numdf = (lastList ? dist2Len : dist2Idx[i+1]) - dist2Idx[i]; - } - else - { - numdf = 0; - } - - for (id=0; id < numids; id++) - { - std::pair<std::set<int>::iterator, bool> inserted = - - idSet.insert(ids[id]); - - if (inserted.second) // here's a new ID - { - newIdList[nextid++] = ids[id]; - - if (numdf > 0) - { - // There is either 1 or 0 distribution factors - - newDistFact[nextdf++] = dist[id]; - } - } - } - - if (!lastList) - { - newIdListIndex[i+1] = nextid; - if (distFact) - { - newDistFactIndex[i+1] = nextdf; - } - } - else - { - newIdListLength = nextid; - newDistFactLength = nextdf; - } - } - } - - if (idNew) - { - *idNew = newIdList; - } - else - { - delete [] newIdList; - } - if (idNewIdx) - { - *idNewIdx = newIdListIndex; - } - else - { - delete [] newIdListIndex; - } - if (idNewLen) - { - *idNewLen = newIdListLength; - } - - if (distNew) - { - *distNew = newDistFact; - } - else if (newDistFact) - { - delete [] newDistFact; - } - if (distNewIdx) - { - *distNewIdx = newDistFactIndex; - } - else if (newDistFactIndex) - { - delete [] newDistFactIndex; - } - if (distNewLen) - { - *distNewLen = newDistFactLength; - } - - return 0; -} //------------------------------------- // Display contents for debugging @@ -1799,22 +989,6 @@ void vtkModelMetadata::PrintGlobalInformation() if (this->Title) cout << "Title: " << this->Title << endl; - if (this->NumberOfQARecords) - { - cout << "QA Records:" << endl; - - char *name = 0; - char *ver = 0; - char *date = 0; - char *time = 0; - - for (i=0; i<this->NumberOfQARecords; i++) - { - this->GetQARecord(i, &name, &ver, &date, &time); - cout << " " << name << " " << ver << " " << date << " " << time << endl; - } - } - this->ShowLines("InformationLines", this->NumberOfInformationLines, this->InformationLine); @@ -1903,25 +1077,6 @@ int vtkModelMetadata::CalculateMaximumLengths(int &maxString, int &maxLine) maxLine = ((sizeLine > maxLine) ? sizeLine : maxLine); } - for (i=0; i<this->NumberOfQARecords; i++) - { - sizeLine = (this->QARecord[i][0] ? - static_cast<int>(strlen(this->QARecord[i][0])) : 0); - maxString = (sizeLine > maxString) ? sizeLine : maxString; - - sizeLine = (this->QARecord[i][1] ? - static_cast<int>(strlen(this->QARecord[i][1])) : 0); - maxString = (sizeLine > maxString) ? sizeLine : maxString; - - sizeLine = (this->QARecord[i][2] ? - static_cast<int>(strlen(this->QARecord[i][2])) : 0); - maxString = (sizeLine > maxString) ? sizeLine : maxString; - - sizeLine = (this->QARecord[i][3] ? - static_cast<int>(strlen(this->QARecord[i][3])) : 0); - maxString = (sizeLine > maxString) ? sizeLine : maxString; - } - for (i=0; i<this->Dimension; i++) { sizeLine = (this->CoordinateNames[i] ? @@ -1992,8 +1147,6 @@ void vtkModelMetadata::PrintSelf(ostream& os, vtkIndent indent) this->Superclass::PrintSelf(os,indent); os << indent << "Title: " << (this->Title?this->Title:"(none)") << endl; - os << indent << "NumberOfQARecords: " << - this->NumberOfQARecords << endl; os << indent << "NumberOfInformationLines: " << this->NumberOfInformationLines << endl; os << indent << "Dimension: " << diff --git a/IO/Exodus/vtkModelMetadata.h b/IO/Exodus/vtkModelMetadata.h index 12d693938934751a9b19d8e885b7449ac3b57e2b..3884adaffde65d3ddf2d2f209c095afc162b0b1f 100644 --- a/IO/Exodus/vtkModelMetadata.h +++ b/IO/Exodus/vtkModelMetadata.h @@ -128,21 +128,6 @@ public: int GetNumberOfInformationLines() const { return this->NumberOfInformationLines;} - // Description: - // Set the list of QA records. If there was already a - // a list, it will be replaced with this one. We use your - // pointer and delete the records when done. - void SetQARecords(int numberOfRecords, char *QARecords[][4]); - - // Description: - // Get a pointer to the 4 fields of a QA record - void GetQARecord(int which, char **name, char **version, - char **date, char **time) const; - - // Description: - // Get the number of QA records - int GetNumberOfQARecords() const {return this->NumberOfQARecords;} - // Description: // Set the index of the time step represented by the results // data in the file attached to this ModelMetadata object. Time @@ -262,7 +247,6 @@ public: // Description: // Set or get a pointer to a list of the number of nodes in each node set. // We use your pointer, and free the memory when the object is freed. - int SetNodeSetSize(int *); int *GetNodeSetSize() const {return this->NodeSetSize;} // Description: @@ -279,7 +263,6 @@ public: // nodes in the node set. // Length of list is number of node sets. // We use your pointer, and free the memory when the object is freed. - int SetNodeSetNumberOfDistributionFactors(int *); int *GetNodeSetNumberOfDistributionFactors() const {return this->NodeSetNumberOfDistributionFactors;} @@ -554,26 +537,6 @@ public: int *GetMapToOriginalNodeVariableNames() const { return this->MapToOriginalNodeVariableNames;} - // Description: - // In order to write Exodus files from vtkUnstructuredGrid - // objects that were read from Exodus files, we need to know - // the mapping from variable names in the UGrid to variable - // names in the Exodus file. (The Exodus reader combines - // scalar variables with similar names into vectors in the - // UGrid.) When building the UGrid to which this - // ModelMetadata refers, add each element and node variable - // name with this call, including the name of original variable - // that yielded it's first component, and the number of components. - // If a variable is removed from the UGrid, remove it from - // the ModelMetadata. (If this information is missing or - // incomplete, the ExodusIIWriter can still do something - // sensible in creating names for variables.) - int AddUGridElementVariable(char *ugridVarName, char *origName, int numComponents); - int RemoveUGridElementVariable(char *ugridVarName); - - int AddUGridNodeVariable(char *ugridVarName, char *origName, int numComponents); - int RemoveUGridNodeVariable(char *ugridVarName); - // Description: // Free selected portions of the metadata when updating values // in the vtkModelMetadata object. Resetting a particular field, @@ -601,11 +564,6 @@ public: // Set the object back to it's initial state void Reset(); - // Description: - // Block information is stored in arrays. This method returns - // the array index for a given block ID. - int GetBlockLocalIndex(int id); - protected: vtkModelMetadata(); ~vtkModelMetadata(); @@ -617,37 +575,14 @@ private: void FreeAllMetadata(); void FreeAllIvars(); - void FreeQARecords(); - int BuildBlockElementIdListIndex(); int BuildBlockAttributesIndex(); - int BuildNodeSetNodeIdListIndex(); - int BuildNodeSetDistributionFactorIndex(); - int BuildSideSetListIndex(); int BuildSideSetDistributionFactorIndex(); static char *StrDupWithNew(const char *s); static int FindNameOnList(char *name, char **list, int listLen); - int MergeIdLists(int numSubLists, - int *id1, int *id1Idx, int id1Len, - float *dist1, int *dist1Idx, int dist1Len, - int *id2, int *id2Idx, int id2Len, - float *dist2, int *dist2Idx, int dist2Len, - int **idNew, int **idNewIdx, int *idNewLen, - float **distNew, int **distNewIdx, int *distNewLen); - - int AppendFloatLists(int numSubLists, - float *id1, int *id1Idx, int id1Len, - float *id2, int *id2Idx, int id2Len, - float **idNew, int **idNewIdx, int *idNewLen); - - int AppendIntegerLists(int numSubLists, - int *id1, int *id1Idx, int id1Len, - int *id2, int *id2Idx, int id2Len, - int **idNew, int **idNewIdx, int *idNewLen); - void ShowFloats(const char *what, int num, float *f); void ShowLines(const char *what, int num, char **l); void ShowIntArray(const char *what, int numx, int numy, int *id); @@ -676,11 +611,6 @@ private: char *Title; // (G) - int NumberOfQARecords; // (G) -//BTX - char *(*QARecord)[4]; // NumberOfQARecords * 4 (G) -//ETX - int NumberOfInformationLines; // (G) char **InformationLine; // (G) diff --git a/IO/ParallelExodus/vtkPExodusIIReader.cxx b/IO/ParallelExodus/vtkPExodusIIReader.cxx index 6a4d83c2723ffaab2bd3c592ec8eb1a2413ff2c4..4bd810e47b237220fc01f0b37f68637e5d877246 100644 --- a/IO/ParallelExodus/vtkPExodusIIReader.cxx +++ b/IO/ParallelExodus/vtkPExodusIIReader.cxx @@ -30,7 +30,6 @@ #include "vtkInformationVector.h" #include "vtkIntArray.h" #include "vtkPointData.h" -#include "vtkExodusModel.h" #include "vtkMultiBlockDataSet.h" #include "vtkMultiProcessController.h" #include "vtkObjectFactory.h" @@ -303,8 +302,8 @@ int vtkPExodusIIReader::RequestInformation( } } - int mmd = this->ExodusModelMetadata; - this->ExodusModelMetadata = 0; + // int mmd = this->ExodusModelMetadata; + // this->ExodusModelMetadata = 0; //this->SetExodusModelMetadata( 0 ); // turn off for now // XXX Bad set /* @@ -326,7 +325,7 @@ int vtkPExodusIIReader::RequestInformation( } //this->SetExodusModelMetadata( mmd ); // turn it back, will compute in RequestData // XXX Bad set - this->ExodusModelMetadata = mmd; + // this->ExodusModelMetadata = mmd; } if ( this->ProcSize > 1 ) { @@ -462,10 +461,12 @@ int vtkPExodusIIReader::RequestData( vtkSmartPointer<vtkAppendCompositeDataLeaves>::New(); append->AppendFieldDataOn(); + /* if ( this->ExodusModelMetadata ) { this->NewExodusModel(); } + */ if ( ReaderList.size() < numMyFiles ) { @@ -602,7 +603,7 @@ int vtkPExodusIIReader::RequestData( this->ReaderList[reader_idx]->SetHasModeShapes( this->GetHasModeShapes() ); this->ReaderList[reader_idx]->SetAnimateModeShapes( this->GetAnimateModeShapes() ); - this->ReaderList[reader_idx]->SetExodusModelMetadata( this->ExodusModelMetadata ); + //this->ReaderList[reader_idx]->SetExodusModelMetadata( this->ExodusModelMetadata ); // For now, this *must* come last before the UpdateInformation() call because its MTime is compared to the metadata's MTime, // which is modified by the calls above. this->ReaderList[reader_idx]->SetFileName( this->MultiFileName );