Commit 714d1889 authored by mdurant's avatar mdurant
Browse files

Improving support for older-style vizschema files by explicitly supporting...

Improving support for older-style vizschema files by explicitly supporting deprecated attribute names.  Also fixed a potential bug where the names of lowerBounds and upperBounds attributes were switched.  Finally, improved several debug messages.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12620 18c085ea-50e0-402c-830e-de6fd14e8384
parent 10ad8872
......@@ -87,7 +87,7 @@ std::string VsMDMesh::getMeshKind() {
}
bool VsMDMesh::isUniformMesh() {
return ((kind == VsSchema::Uniform::key) || (kind == VsSchema::Uniform::deprecated_key));
return ((kind == VsSchema::Uniform::key) || (kind == VsSchema::Uniform::key_deprecated));
}
bool VsMDMesh::isRectilinearMesh() {
......
......@@ -151,7 +151,7 @@ VsMesh* VsMesh::buildObject(VsH5Group* group) {
kindAtt->getStringValue(&kind);
VsLog::debugLog() <<"VsMesh::buildObject() - mesh group has kind: " <<kind <<std::endl;
if ((kind == VsSchema::Uniform::deprecated_key) || (kind == VsSchema::Uniform::key)) {
if ((kind == VsSchema::Uniform::key_deprecated) || (kind == VsSchema::Uniform::key)) {
return VsUniformMesh::buildUniformMesh(group);
} else if (kind == VsSchema::Unstructured::key) {
return VsUnstructuredMesh::buildUnstructuredMesh(group);
......
......@@ -278,16 +278,29 @@ void VsRegistry::buildDatasetObjects() {
it != allDatasets.end(); it++) {
VsH5Dataset* dataset = it->second;
VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - looking at dataset " <<dataset->getFullName() <<std::endl;
//Try to determine the type of the object
std::string type;
VsH5Attribute* typeAtt = dataset->getAttribute(VsSchema::typeAtt);
if (!typeAtt) {
VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - unable to find attribute " <<VsSchema::typeAtt
<<". Skipping object " <<dataset->getFullName() <<std::endl;
continue;
VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - unable to find attribute " <<VsSchema::typeAtt <<std::endl;
//If the object contains the "vsMesh" attribute, then it is probably intended to be a variable
//So continue with that assumption
VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - Second chance - looking for attribute " <<VsSchema::meshAtt <<std::endl;
VsH5Attribute* meshAtt = dataset->getAttribute(VsSchema::meshAtt);
if (meshAtt) {
VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - Found attribute " <<VsSchema::meshAtt <<" assuming that this is a variable." <<std::endl;
type = VsSchema::varKey;
} else {
VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - Did not find attribute " <<VsSchema::meshAtt
<<", second chance option has failed. Skipping object: " <<dataset->getFullName() <<std::endl;
continue;
}
} else {
typeAtt->getStringValue(&type);
}
std::string type;
typeAtt->getStringValue(&type);
VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - object is of type " <<type <<std::endl;
if (type == VsSchema::meshKey) {
VsMesh::buildObject(dataset);
......
......@@ -23,6 +23,7 @@ std::string VsSchema::meshAtt = "vsMesh";
std::string VsSchema::centeringAtt ="vsCentering";
std::string VsSchema::indexOrderAtt = "vsIndexOrder";
std::string VsSchema::numSpatialDimsAtt = "vsNumSpatialDims";
std::string VsSchema::numSpatialDimsAtt_deprecated = "numSpatialDims";
std::string VsSchema::spatialIndicesAtt = "vsSpatialIndices";
std::string VsSchema::labelsAtt = "vsLabels";
std::string VsSchema::axisLabelsAtt = "vsAxisLabels";
......@@ -53,11 +54,15 @@ std::string VsSchema::Rectilinear::axis2DefaultName = "axis2";
std::string VsSchema::Rectilinear::transformKey = "vsTransform";
std::string VsSchema::Uniform::key = "uniform";
std::string VsSchema::Uniform::deprecated_key = "uniformCartesian";
std::string VsSchema::Uniform::key_deprecated = "uniformCartesian";
std::string VsSchema::Uniform::lowerBounds = "vsLowerBounds";
std::string VsSchema::Uniform::lowerBounds_deprecated = "lowerBounds";
std::string VsSchema::Uniform::startCell = "vsStartCell";
std::string VsSchema::Uniform::startCell_deprecated = "startCell";
std::string VsSchema::Uniform::numCells = "vsNumCells";
std::string VsSchema::Uniform::numCells_deprecated = "numPhysCells";
std::string VsSchema::Uniform::upperBounds = "vsUpperBounds";
std::string VsSchema::Uniform::upperBounds_deprecated = "upperBounds";
std::string VsSchema::Unstructured::key = "unstructured";
......
......@@ -28,6 +28,7 @@ struct VsSchema {
static std::string cellOffsetAtt; // Instead of offsetAtt
static std::string indexOrderAtt; //component major/minor, index C/Fortran; compMinorC is default
static std::string numSpatialDimsAtt;
static std::string numSpatialDimsAtt_deprecated;
static std::string spatialIndicesAtt;
static std::string labelsAtt;
static std::string axisLabelsAtt;
......@@ -46,11 +47,15 @@ struct VsSchema {
struct Uniform {
static std::string key;
static std::string deprecated_key;
static std::string key_deprecated;
static std::string lowerBounds;
static std::string lowerBounds_deprecated;
static std::string startCell;
static std::string startCell_deprecated;
static std::string numCells;
static std::string numCells_deprecated;
static std::string upperBounds;
static std::string upperBounds_deprecated;
};
struct Rectilinear {
......
......@@ -43,16 +43,22 @@ bool VsUniformMesh::initialize() {
//For a uniform mesh, spatial dimensionality is the length of the numCells array
numCellsAtt = getAttribute(VsSchema::Uniform::numCells);
if (!numCellsAtt) {
VsLog::errorLog() <<"VsUniformMesh::initialize() - Uniform mesh is missing attribute: " <<VsSchema::Uniform::numCells;
VsLog::errorLog() <<"VsUniformMesh::initialize() - Uniform mesh is missing attribute: " <<VsSchema::Uniform::numCells <<std::endl;
VsLog::debugLog() <<"VsUniformMesh::initialize() - Looking for deprecated attribute: " <<VsSchema::Uniform::numCells_deprecated <<std::endl;
numCellsAtt = getAttribute(VsSchema::Uniform::numCells_deprecated);
}
if (!numCellsAtt) {
VsLog::errorLog() <<"VsUniformMesh::initialize() - Uniform mesh is also missing deprecated attribute: " <<VsSchema::Uniform::numCells_deprecated <<std::endl;
VsLog::debugLog() <<"VsUniformMesh::initialize() - Unable to initialize mesh, returning failure." <<std::endl;
return false;
}
std::vector<int> dims;
herr_t err = numCellsAtt->getIntVectorValue(&dims);
if (!err) {
numSpatialDims = dims.size();
} else {
VsLog::errorLog() <<"VsUniformMesh::initialize() - Unable to get dimensionality from attribute: " <<VsSchema::Uniform::numCells;
VsLog::errorLog() <<"VsUniformMesh::initialize() - Unable to get dimensionality from attribute: " <<numCellsAtt->getShortName() <<std::endl;
VsLog::errorLog() <<"VsUniformMesh::initialize() - Unable to initialize mesh, returning failure." <<std::endl;
numSpatialDims = -1;
return false;
......@@ -62,14 +68,24 @@ bool VsUniformMesh::initialize() {
lowerBoundsAtt = getAttribute(VsSchema::Uniform::lowerBounds);
if (!lowerBoundsAtt) {
VsLog::errorLog() <<"VsUniformMesh::initialize() - Uniform mesh is missing attribute: " <<VsSchema::Uniform::lowerBounds <<std::endl;
VsLog::errorLog() <<"VsUniformMesh::initialize() - Looking for deprecated attribute: " <<VsSchema::Uniform::lowerBounds_deprecated <<std::endl;
lowerBoundsAtt = getAttribute(VsSchema::Uniform::lowerBounds_deprecated);
}
if (!lowerBoundsAtt) {
VsLog::errorLog() <<"VsUniformMesh::initialize() - Uniform mesh is also missing deprecated attribute: " <<VsSchema::Uniform::lowerBounds_deprecated <<std::endl;
VsLog::errorLog() <<"VsUniformMesh::initialize() - Unable to initialize mesh, returning failure." <<std::endl;
return false;
}
// Upperbounds is required
upperBoundsAtt = getAttribute(VsSchema::Uniform::upperBounds);
if (!lowerBoundsAtt) {
if (!upperBoundsAtt) {
VsLog::errorLog() <<"VsUniformMesh::initialize() - Uniform mesh is missing attribute: " <<VsSchema::Uniform::upperBounds <<std::endl;
VsLog::errorLog() <<"VsUniformMesh::initialize() - Looking for deprecated attribute: " <<VsSchema::Uniform::upperBounds_deprecated <<std::endl;
upperBoundsAtt = getAttribute(VsSchema::Uniform::upperBounds_deprecated);
}
if (!upperBoundsAtt) {
VsLog::errorLog() <<"VsUniformMesh::initialize() - Uniform mesh is also missing deprecated attribute: " <<VsSchema::Uniform::upperBounds_deprecated <<std::endl;
VsLog::errorLog() <<"VsUniformMesh::initialize() - Unable to initialize mesh, returning failure." <<std::endl;
return false;
}
......@@ -78,6 +94,12 @@ bool VsUniformMesh::initialize() {
startCellAtt = getAttribute(VsSchema::Uniform::startCell);
if (!startCellAtt) {
VsLog::debugLog() <<"VsUniformMesh::initialize() - Uniform mesh does not have optional attribute: " <<VsSchema::Uniform::startCell <<std::endl;
VsLog::debugLog() <<"VsUniformMesh::initialize() - Looking for deprecated attribute: " <<VsSchema::Uniform::startCell_deprecated <<std::endl;
startCellAtt = getAttribute(VsSchema::Uniform::startCell_deprecated);
}
if (!startCellAtt) {
VsLog::debugLog() <<"VsUniformMesh::initialize() - Uniform mesh also does not have deprecated attribute: " <<VsSchema::Uniform::startCell_deprecated <<std::endl;
VsLog::debugLog() <<"VsUniformMesh::initialize() - Using default start cell of 0." <<std::endl;
}
return initializeRoot();
......@@ -109,7 +131,7 @@ herr_t VsUniformMesh::getLowerBounds(std::vector<float>* fVals) {
if (err < 0) {
VsLog::debugLog() << "VsUniformMesh::getLowerBounds(): error " << err <<
" in reading attribute '" << VsSchema::Uniform::lowerBounds << "'." << std::endl;
" in reading attribute '" <<lowerBoundsAtt->getShortName() << "'." << std::endl;
}
VsLog::debugLog() << "VsUniformMesh::getLowerBounds() - Returning " <<err <<"." << std::endl;
......@@ -133,7 +155,7 @@ herr_t VsUniformMesh::getUpperBounds(std::vector<float>* fVals) {
if (err < 0) {
VsLog::debugLog() << "VsUniformMesh::getUpperBounds(): error " << err <<
" in reading attribute '" << VsSchema::Uniform::upperBounds << "'." << std::endl;
" in reading attribute '" << upperBoundsAtt->getShortName() << "'." << std::endl;
}
VsLog::debugLog() << "VsUniformMesh::getUpperBounds() - Returning " <<err <<"." << std::endl;
......@@ -149,7 +171,7 @@ herr_t VsUniformMesh::getStartCell(std::vector<int>* startCell) {
herr_t err = startCellAtt->getIntVectorValue(startCell);
if (err < 0) {
VsLog::debugLog() << "VsUniformMesh::getStartCell(): error " << err <<
" in reading attribute '" << VsSchema::Uniform::startCell << "'." << std::endl;
" in reading attribute '" << startCellAtt->getShortName() << "'." << std::endl;
}
VsLog::debugLog() << "VsUniformMesh::getStartCell() - Returning " <<err <<"." << std::endl;
......@@ -160,13 +182,7 @@ size_t VsUniformMesh::getMeshDims(std::vector<int>* dims, bool useStride, std::v
VsLog::debugLog() << "VsUniformMesh::getMeshDims(): Entering." << std::endl;
// Read dims of totalNumCells attribute
VsH5Attribute* numCellsAttribute = getAttribute(VsSchema::Uniform::numCells);
if (numCellsAttribute) {
numCellsAttribute->getIntVectorValue(dims);
} else {
VsLog::errorLog() <<"VsUniformMesh::getMeshDims() - unable to get numcells attribute for mesh " <<getFullName() <<std::endl;
return 0;
}
numCellsAtt->getIntVectorValue(dims);
if (useStride) {
VsLog::debugLog() <<"VsUniformMesh::getMeshDims() - Adjusting size of mesh using stride." <<std::endl;
......
......@@ -158,7 +158,13 @@ bool VsVariableWithMesh::initialize() {
//So for a 3-d mesh we have [0, 1, 2]
if (!numDimsSet) {
VsLog::debugLog() <<"VsVariableWithMesh::buildVariable(): did not find spatialIndices, trying regular style." <<std::endl;
VsLog::debugLog() <<"VsVariableWithMesh::buildVariable(): Looking for attribute: " <<VsSchema::numSpatialDimsAtt <<std::endl;
VsH5Attribute* numDimsAtt = getAttribute(VsSchema::numSpatialDimsAtt);
if (!numDimsAtt) {
VsLog::warningLog() <<"VsVariableWithMesh::buildVariable(): Did not find attribute: " <<VsSchema::numSpatialDimsAtt <<std::endl;
VsLog::warningLog() <<"VsVariableWithMesh::buildVariable(): Looking for deprecated attribute: " <<VsSchema::numSpatialDimsAtt_deprecated <<std::endl;
numDimsAtt = getAttribute(VsSchema::numSpatialDimsAtt_deprecated);
}
if (numDimsAtt) {
std::vector<int> in;
herr_t err = numDimsAtt->getIntVectorValue(&in);
......@@ -177,6 +183,8 @@ bool VsVariableWithMesh::initialize() {
numDimsSet = true;
VsLog::debugLog() << "VsVariableWithMesh::buildVariable(): numSpatialDims = " << this->getNumSpatialDims() << "." << std::endl;
} else {
VsLog::warningLog() <<"VsVariableWithMesh::buildVariable(): Did not find deprecated attribute either: " <<VsSchema::numSpatialDimsAtt_deprecated <<std::endl;
}
}
......
......@@ -79,7 +79,7 @@ avtVsFileFormat::avtVsFileFormat(const char* dfnm, std::vector<int> settings) :
VsLog::initialize(DebugStream::Stream3(), DebugStream::Stream4(), DebugStream::Stream5());
VsLog::debugLog() <<"avtVsFileFormat::constructor() - entering" <<std::endl;
VsLog::debugLog() <<"avtVsFileFormat::constructor() - VizSchema Revision #738" <<std::endl;
VsLog::debugLog() <<"avtVsFileFormat::constructor() - VizSchema Revision #742" <<std::endl;
//reader starts off empty
reader = NULL;
......@@ -1251,7 +1251,7 @@ avtVsFileFormat::avtVsFileFormat(const char* dfnm, std::vector<int> settings) :
std::vector<int> startCell;
herr_t err = uniformMesh->getStartCell(&startCell);
if (err < 0) {
VsLog::warningLog() <<methodSig <<"Uniform mesh does not have optional startCell attribute." <<std::endl;
VsLog::warningLog() <<methodSig <<"Uniform mesh does not have information about starting cell position." <<std::endl;
} else {
// Adjust the box by startCell
VsLog::debugLog() <<methodSig <<"Adjusting numCells by startCells." << endl;
......@@ -2285,7 +2285,7 @@ avtVsFileFormat::avtVsFileFormat(const char* dfnm, std::vector<int> settings) :
} else {
//When there is only one component, we don't create a component name
//Instead, we just use the straight-up name
avtCurveMetaData* cmd = new avtCurveMetaData((*it).c_str());
avtCurveMetaData* cmd = new avtCurveMetaData(*it);
cmd->hasDataExtents = false;
md->Add(cmd);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment