Commit 748d98a8 authored by mdurant's avatar mdurant

Implementing automatic cylindrical->cartesian transformations

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@17174 18c085ea-50e0-402c-830e-de6fd14e8384
parent 12d4c2f6
......@@ -148,7 +148,7 @@ bool VsRectilinearMesh::initialize() {
VsLog::debugLog() << __CLASS__ << __FUNCTION__ << " " << __LINE__ << " "
<< "Mesh has num spatial dims = "
<< numSpatialDims << std::endl;
return initializeRoot();
}
......@@ -216,6 +216,54 @@ std::string VsRectilinearMesh::getKind() {
return VsSchema::Rectilinear::key;
}
bool VsRectilinearMesh::hasTransform() {
return (!getTransformName().empty());
}
std::string VsRectilinearMesh::getTransformName() {
//Look for the vsTransform attribute
//and either retrieve the value or leave the name empty
std::string transformName;
VsH5Attribute* transformNameAtt = getAttribute(VsSchema::Rectilinear::transformKey);
if (transformNameAtt) {
transformNameAtt->getStringValue(&transformName);
}
//Make sure this is a recognized value
//All other methods use the return value of this method as a go/no-go test
//So this is the best place to catch bad values
if (transformName != VsSchema::Rectilinear::zrphiTransformKey) {
VsLog::errorLog() <<"VsRectilinearMesh::getTransformName() - Unrecognized value for key "
<< VsSchema::Rectilinear::transformKey << " - " <<transformName <<std::endl;
transformName = "";
}
return transformName;
}
std::string VsRectilinearMesh::getTransformedMeshName() {
//Look for the vsTransformName key
std::string transformedMeshName;
VsH5Attribute* transformedMeshNameAtt = getAttribute(VsSchema::Rectilinear::transformedMeshKey);
if (transformedMeshNameAtt) {
transformedMeshNameAtt->getStringValue(&transformedMeshName);
if (!transformedMeshName.empty()) {
//We want to make the tranformed mesh appear at the same file level
//as the original mesh.
//So, when we calculate the canonical name, use the PATH, not the FULL NAME
transformedMeshName = makeCanonicalName(getPath(), transformedMeshName);
}
}
// if we didn't find a user supplied name, create a name
if (transformedMeshName.empty()) {
transformedMeshName = getFullName() + "_transform";
transformedMeshName = makeCanonicalName(transformedMeshName);
}
return transformedMeshName;
}
void VsRectilinearMesh::getMeshDataDims(std::vector<int>& dims)
{
......
......@@ -24,6 +24,12 @@ public:
hid_t getDataType();
std::string getAxisDatasetName(int axisNumber);
VsH5Dataset* getAxisDataset(int axisNumber);
// Roopa: These two methods are used to access the vsTransform and
// vsTransformedMesh fields
bool hasTransform();
std::string getTransformName();
std::string getTransformedMeshName();
virtual bool isRectilinearMesh() { return true; }
static VsRectilinearMesh* buildRectilinearMesh(VsH5Group* group);
......
......@@ -835,6 +835,70 @@ void VsRegistry::getAllVariableWithMeshNames(std::vector<std::string>& names) {
names.push_back(it->first);
}
/********************* TRANSFORMED MESH NAMES ************************/
bool VsRegistry::registerTransformedMeshName(std::string transformedName, std::string origName) {
//first, look for a match and report failure if the name is already registered
std::string oName = getOriginalMeshName(transformedName);
if (!oName.empty()) {
if (origName != oName) {
VsLog::debugLog() << "ERROR VsRegistry::registerTransformedMeshName() - "
<< transformedName << " is already registered to "
<< oName << std::endl;
return false;
} else {
VsLog::debugLog() << "VsRegistry::registerTransformedMeshName() - recieved duplicate registration for "
<< origName << std::endl;
VsLog::debugLog() << "VsRegistry::registerTransformedMeshName() - but all info matches, so it should be ok"
<< std::endl;
return true;
}
}
// Ok, register the new name mapping
transformedMeshNames[transformedName] = origName;
VsLog::debugLog() << "VsRegistry::registerTransformedMeshName("
<< transformedName << ", " << transformedMeshNames[transformedName]
<< ") - registration succeeded." << std::endl;
return true;
}
std::string VsRegistry::getOriginalMeshName(std::string transformedMeshName) {
// return the value if the name is registered
return transformedMeshNames[transformedMeshName];
}
/******************* TRANSFORMED VARS *******************/
bool VsRegistry::registerTransformedVarName(std::string transformedName, std::string origName) {
//first, look for a match and report failure if the name is already registered
std::string oName = getOriginalVarName(transformedName);
if (!oName.empty()) {
if (origName != oName) {
VsLog::debugLog() << "ERROR VsRegistry::registerTransformedVarName() - "
<< transformedName << " is already registered to "
<< oName << std::endl;
return false;
} else {
VsLog::debugLog() << "VsRegistry::registerTransformedVarName() - received duplicate registration for "
<< origName << std::endl;
VsLog::debugLog() << "VsRegistry::registerTransformedVarName() - but all info matches, so it should be ok"
<< std::endl;
return true;
}
}
// Ok, register the new name mapping
transformedVarNames[transformedName] = origName;
VsLog::debugLog() << "VsRegistry::registerTransformedVarName("
<< transformedName << ", " << transformedVarNames[transformedName]
<< ") - registration succeeded." << std::endl;
return true;
}
std::string VsRegistry::getOriginalVarName(std::string transformedVarName) {
// return the value if the name is registered
return transformedVarNames[transformedVarName];
}
/******************* EXPRESSIONS ************************/
void VsRegistry::addExpression(const std::string& name,
const std::string& value) {
......
......@@ -94,7 +94,15 @@ public:
void deleteAllVariablesWithMesh();
void writeAllVariablesWithMesh();
int numVariablesWithMesh();
// TRANSFORMED MESH NAMES
bool registerTransformedMeshName(std::string transformedMeshName, std::string origMeshName);
std::string getOriginalMeshName(std::string transformedMeshName);
// TRANSFORMED VAR NAMES
bool registerTransformedVarName(std::string transformedVarName, std::string origVarName);
std::string getOriginalVarName(std::string transformedVarName);
//MD VARIABLES
void add(VsMDVariable* var);
void remove(VsMDVariable* var);
......@@ -159,6 +167,9 @@ private:
std::map<std::string, std::string> allExpressions;
std::map<std::string, std::string> transformedMeshNames;
std::map<std::string, std::string> transformedVarNames;
//tracks whether time data has been read for this database
// a value of -1 indicates no time data is available
//Named timeValue because "time" is a typedef
......
......@@ -54,6 +54,8 @@ std::string VsSchema::Rectilinear::axis1DefaultName = "axis1";
std::string VsSchema::Rectilinear::axis2Key = "vsAxis2";
std::string VsSchema::Rectilinear::axis2DefaultName = "axis2";
std::string VsSchema::Rectilinear::transformKey = "vsTransform";
std::string VsSchema::Rectilinear::transformedMeshKey = "vsTransformedMesh";
std::string VsSchema::Rectilinear::zrphiTransformKey = "cylindricalZRPhi";
std::string VsSchema::Uniform::key = "uniform";
std::string VsSchema::Uniform::key_deprecated = "uniformCartesian";
......
......@@ -73,6 +73,9 @@ struct VsSchema {
static std::string axis2DefaultName;
static std::string transformKey;
static std::string transformedMeshKey;
static std::string zrphiTransformKey;
};
struct Unstructured {
......
This diff is collapsed.
......@@ -206,7 +206,7 @@ class avtVsFileFormat: public avtSTMDFileFormat {
* Create various meshes.
*/
vtkDataSet* getUniformMesh(VsUniformMesh*, bool, int*, int*, int*);
vtkDataSet* getRectilinearMesh(VsRectilinearMesh*, bool, int*, int*, int*);
vtkDataSet* getRectilinearMesh(VsRectilinearMesh*, bool, int*, int*, int*, bool);
vtkDataSet* getStructuredMesh(VsStructuredMesh*, bool, int*, int*, int*,
const std::vector<double>&);
vtkDataSet* getUnstructuredMesh(VsUnstructuredMesh*, bool, int*, int*, int*);
......
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