Commit d99e994e authored by hrchilds's avatar hrchilds
Browse files

Update from April 4, 2005

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@444 18c085ea-50e0-402c-830e-de6fd14e8384
parent 469dbf79
......@@ -16,6 +16,7 @@
#define VAR_CATEGORY_CURVE 0x0040
#define VAR_CATEGORY_TENSOR 0x0080
#define VAR_CATEGORY_SYMMETRIC_TENSOR 0x0100
#define VAR_CATEGORY_LABEL 0x0200
// Forward declarations.
class AttributeSubject;
......
......@@ -1004,6 +1004,9 @@ PickVarInfo::PrintSelf(ostream &os)
// Kathleen Bonnell, Thu Jul 22 12:06:53 PDT 2004
// Cast values to char if treatAsASCII is true.
//
// Brad Whitlock, Mon Apr 4 12:12:19 PDT 2005
// Added support for printing label variables.
//
// ****************************************************************************
void
PickVarInfo::CreateOutputString(std::string &os, const std::string &type)
......@@ -1188,6 +1191,17 @@ PickVarInfo::CreateOutputString(std::string &os, const std::string &type)
int ncomps = values.size() / names.size();
PrintSymmetricTensor(os, values, i, ncomps, buf_len);
}
else if (variableType == "label")
{
int labelSize = values.size() / names.size();
os += "= ";
for (int j = labelSize*i; j < labelSize * (i+1); j++)
{
char c[2] = {(char)values[j], 0};
os += c;
}
os += "\n";
}
else
{
os += "\n";
......
......@@ -154,6 +154,9 @@ Definition:
// Kathleen Bonnell, Thu Jul 22 12:06:53 PDT 2004
// Cast values to char if treatAsASCII is true.
//
// Brad Whitlock, Mon Apr 4 12:12:19 PDT 2005
// Added support for printing label variables.
//
// ****************************************************************************
void
PickVarInfo::CreateOutputString(std::string &os, const std::string &type)
......@@ -338,6 +341,17 @@ PickVarInfo::CreateOutputString(std::string &os, const std::string &type)
int ncomps = values.size() / names.size();
PrintSymmetricTensor(os, values, i, ncomps, buf_len);
}
else if (variableType == "label")
{
int labelSize = values.size() / names.size();
os += "= ";
for (int j = labelSize*i; j < labelSize * (i+1); j++)
{
char c[2] = {(char)values[j], 0};
os += c;
}
os += "\n";
}
else
{
os += "\n";
......
......@@ -3444,6 +3444,175 @@ avtSILMetaData::Validate()
}
}
// ****************************************************************************
// Method: avtLabelMetaData::avtLabelMetaData
//
// Purpose:
// Constructor for the avtLabelMetaData class.
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 1 14:44:37 PST 2005
//
// Modifications:
//
// ****************************************************************************
avtLabelMetaData::avtLabelMetaData() : AttributeSubject("sssib")
{
name = "";
originalName = "";
meshName = "";
centering = AVT_UNKNOWN_CENT;
validVariable = true;
}
avtLabelMetaData::avtLabelMetaData(const std::string &n, const std::string &mn,
avtCentering c) : AttributeSubject("sssib")
{
name = n;
originalName = name;
meshName = mn;
centering = c;
validVariable = true;
}
avtLabelMetaData::avtLabelMetaData(const avtLabelMetaData &obj) : AttributeSubject("sssib")
{
name = obj.name;
originalName = obj.originalName;
meshName = obj.meshName;
centering = obj.centering;
validVariable = obj.validVariable;
}
// ****************************************************************************
// Method: avtLabelMetaData::~avtLabelMetaData
//
// Purpose:
// Destructor for the avtLabelMetaData class.
//
// Arguments:
//
// Returns:
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 1 14:45:08 PST 2005
//
// Modifications:
//
// ****************************************************************************
avtLabelMetaData::~avtLabelMetaData()
{
}
// ****************************************************************************
// Method: avtLabelMetaData::operator=
//
// Purpose:
// Assigment operator
//
// Arguments:
// rhs : The object to copy.
//
// Returns: A copy of the current object.
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 1 14:45:43 PST 2005
//
// Modifications:
//
// ****************************************************************************
const avtLabelMetaData &
avtLabelMetaData::operator=(const avtLabelMetaData &rhs)
{
name = rhs.name;
originalName = rhs.originalName;
meshName = rhs.meshName;
centering = rhs.centering;
validVariable = rhs.validVariable;
return *this;
}
// ****************************************************************************
// Method: avtLabelMetaData::SelectAll
//
// Purpose:
// Selects the addresses of the label fields.
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 1 14:46:38 PST 2005
//
// Modifications:
//
// ****************************************************************************
void
avtLabelMetaData::SelectAll()
{
Select(0, (void *)&name);
Select(1, (void *)&originalName);
Select(2, (void *)&meshName);
Select(3, (void *)&centering);
Select(4, (void *)&validVariable);
}
// ****************************************************************************
// Method: avtLabelMetaData::Print
//
// Purpose:
// Prints the label metadata to a stream.
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 1 14:47:07 PST 2005
//
// Modifications:
//
// ****************************************************************************
void
avtLabelMetaData::Print(ostream &out, int indent) const
{
Indent(out, indent);
out << "Name = " << name.c_str() << endl;
if (name != originalName)
{
Indent(out, indent);
out << "Original Name = " << originalName.c_str() << endl;
}
Indent(out, indent);
out << "Mesh is = " << meshName.c_str() << endl;
Indent(out, indent);
out << "Centering = ";
switch (centering)
{
case AVT_NODECENT:
out << "node centered.";
break;
case AVT_ZONECENT:
out << "zone centered.";
break;
case AVT_UNKNOWN_CENT:
default:
out << "unknowing centering.";
break;
}
out << endl;
if (!validVariable)
{
Indent(out, indent);
out << "THIS IS NOT A VALID VARIABLE." << endl;
}
}
// ****************************************************************************
// Method: avtDefaultPlotMetaData default constructor
......@@ -3665,10 +3834,13 @@ avtDefaultPlotMetaData::Print(ostream &out, int indent) const
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// Brad Whitlock, Fri Apr 1 15:36:10 PST 2005
// Changed format string to add labels.
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData()
: AttributeSubject("sssbddibss*i*i*i*d*a*a*a*a*a*a*a*a*a*aba*babbb")
: AttributeSubject("sssbddibss*i*i*i*d*a*a*a*a*a*a*a*a*a*aba*a*babbb")
{
hasTemporalExtents = false;
minTemporalExtents = 0.;
......@@ -3740,10 +3912,13 @@ avtDatabaseMetaData::avtDatabaseMetaData()
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// Brad Whitlock, Fri Apr 1 15:34:18 PST 2005
// Added labels.
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &rhs)
: AttributeSubject("sssbddibss*i*i*i*d*a*a*a*a*a*a*a*a*a*aba*babbb")
: AttributeSubject("sssbddibss*i*i*i*d*a*a*a*a*a*a*a*a*a*aba*a*babbb")
{
databaseName = rhs.databaseName;
fileFormat = rhs.fileFormat;
......@@ -3787,6 +3962,8 @@ avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &rhs)
curves.push_back(new avtCurveMetaData(*rhs.curves[i]));
for (i=0; i<rhs.sils.size(); i++)
sils.push_back(new avtSILMetaData(*rhs.sils[i]));
for (i=0; i<rhs.labels.size(); i++)
labels.push_back(new avtLabelMetaData(*rhs.labels[i]));
for (i=0; i<rhs.defaultPlots.size(); i++)
defaultPlots.push_back(new avtDefaultPlotMetaData(*rhs.defaultPlots[i]));
}
......@@ -3848,6 +4025,9 @@ avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &rhs)
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// Brad Whitlock, Fri Apr 1 15:33:57 PST 2005
// Added labels.
//
// ****************************************************************************
const avtDatabaseMetaData &
......@@ -3924,6 +4104,8 @@ avtDatabaseMetaData::operator=(const avtDatabaseMetaData &rhs)
species.push_back(new avtSpeciesMetaData(*rhs.species[i]));
for (i=0; i<rhs.curves.size(); i++)
curves.push_back(new avtCurveMetaData(*rhs.curves[i]));
for (i=0; i<rhs.labels.size(); i++)
labels.push_back(new avtLabelMetaData(*rhs.labels[i]));
for (i=0; i<rhs.sils.size(); i++)
sils.push_back(new avtSILMetaData(*rhs.sils[i]));
for (i=0; i<rhs.defaultPlots.size(); i++)
......@@ -3954,6 +4136,9 @@ avtDatabaseMetaData::operator=(const avtDatabaseMetaData &rhs)
// Kathleen Bonnell, Tue Jan 11 16:06:33 PST 2005
// Delete simInfo.
//
// Brad Whitlock, Fri Apr 1 15:33:13 PST 2005
// Added labels.
//
// ****************************************************************************
avtDatabaseMetaData::~avtDatabaseMetaData()
......@@ -4006,6 +4191,12 @@ avtDatabaseMetaData::~avtDatabaseMetaData()
delete (*cit);
}
std::vector<avtLabelMetaData *>::iterator lit;
for (lit = labels.begin() ; lit != labels.end() ; lit++)
{
delete (*lit);
}
std::vector<avtDefaultPlotMetaData *>::iterator defpltit;
for (defpltit = defaultPlots.begin() ; defpltit != defaultPlots.end() ;
defpltit++)
......@@ -4570,6 +4761,23 @@ avtDatabaseMetaData::Add(avtSILMetaData *smd)
sils.push_back(smd);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::Add
//
// Arguments:
// smd A Label meta data object.
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 1 15:26:41 PST 2005
//
// ****************************************************************************
void
avtDatabaseMetaData::Add(avtLabelMetaData *lmd)
{
labels.push_back(lmd);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::Add
//
......@@ -4737,6 +4945,9 @@ avtDatabaseMetaData::GetNDomains(std::string var) const
// Hank Childs, Sat Sep 20 08:32:38 PDT 2003
// Add support for tensors.
//
// Brad Whitlock, Fri Apr 1 15:27:41 PST 2005
// Added support for labels.
//
// ****************************************************************************
avtVarType
......@@ -4837,6 +5048,15 @@ avtDatabaseMetaData::DetermineVarType(std::string var_in) const
}
}
int nlabels = labels.size();
for (i = 0 ; i < nlabels ; i++)
{
if (labels[i]->name == var)
{
return AVT_LABEL_VAR;
}
}
EXCEPTION1(InvalidVariableException, var);
}
......@@ -4880,6 +5100,9 @@ avtDatabaseMetaData::DetermineVarType(std::string var_in) const
// refactored the best one into ParsingExprList::GetRealVariable
// and made this one point to it.
//
// Brad Whitlock, Fri Apr 1 15:28:35 PST 2005
// Added support for labels.
//
// ****************************************************************************
std::string
......@@ -5008,6 +5231,15 @@ avtDatabaseMetaData::MeshForVar(std::string var) const
}
}
// Look through the labels.
int nlabels = labels.size();
for (i = 0 ; i < nlabels ; i++)
{
if (labels[i]->name == var)
{
return labels[i]->meshName;
}
}
EXCEPTION1(InvalidVariableException, var);
}
......@@ -5259,6 +5491,9 @@ avtDatabaseMetaData::GetSpeciesOnMesh(std::string mesh) const
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// Brad Whitlock, Fri Apr 1 15:28:58 PST 2005
// Added labels.
//
// ****************************************************************************
void
......@@ -5425,6 +5660,18 @@ avtDatabaseMetaData::Print(ostream &out, int indent) const
out << endl;
}
if(labels.begin() != labels.end())
{
Indent(out, indent);
out << "Labels: " << endl;
}
std::vector< avtLabelMetaData * >::const_iterator lit;
for (lit = labels.begin() ; lit != labels.end() ; lit++)
{
(*lit)->Print(out, indent+1);
out << endl;
}
if(defaultPlots.begin() != defaultPlots.end())
{
Indent(out, indent);
......@@ -5541,6 +5788,9 @@ avtDatabaseMetaData::Print(ostream &out, int indent) const
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// Brad Whitlock, Fri Apr 1 15:31:22 PST 2005
// Added labels.
//
// *******************************************************************
void
......@@ -5574,12 +5824,13 @@ avtDatabaseMetaData::SelectAll()
Select(23, (void*)&exprList);
Select(24, (void*)&mustRepopulateOnStateChange);
Select(25, (void*)&sils);
Select(26, (void*)&labels);
Select(26, (void*)&isSimulation);
Select(27, (void*)simInfo);
Select(28, (void*)&useCatchAllMesh);
Select(29, (void*)&mustAlphabetizeVariables);
Select(30, (void*)&formatCanDoDomainDecomposition);
Select(27, (void*)&isSimulation);
Select(28, (void*)simInfo);
Select(29, (void*)&useCatchAllMesh);
Select(30, (void*)&mustAlphabetizeVariables);
Select(31, (void*)&formatCanDoDomainDecomposition);
}
// *******************************************************************
......@@ -5621,6 +5872,9 @@ avtDatabaseMetaData::SelectAll()
// Brad Whitlock, Fri Jul 23 12:40:24 PDT 2004
// updated indexing for databaseComment.
//
// Brad Whitlock, Fri Apr 1 15:31:03 PST 2005
// Added label.
//
// *******************************************************************
AttributeGroup *
......@@ -5648,6 +5902,8 @@ avtDatabaseMetaData::CreateSubAttributeGroup(int n)
return new avtDefaultPlotMetaData;
case 25:
return new avtSILMetaData;
case 26:
return new avtLabelMetaData;
default:
return NULL;
}
......@@ -6069,6 +6325,53 @@ avtDatabaseMetaData::GetSIL(const std::string &n) const
return NULL;
}
// *******************************************************************
// Method: avtDatabaseMetaData::GetLabel
//
// Purpose:
// This returns the metadata for the nth label in the file.
//
// Arguments:
// n : the index into the array
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 1 15:37:40 PST 2005
//
// Modifications:
//
// *******************************************************************
const avtLabelMetaData *
avtDatabaseMetaData::GetLabel(int n) const
{
return labels[n];
}
// *******************************************************************
// Method: avtDatabaseMetaData::GetLabel
//
// Purpose:
// This returns the metadata for the label in the file whose name is n.
//
// Arguments:
// n : the name of the label object
//
// Programmer: Brad Whitlock
// Creation: Fri Apr 1 15:37:59 PST 2005
//
// Modifications:
//
// *******************************************************************
const avtLabelMetaData *
avtDatabaseMetaData::GetLabel(const std::string &n) const
{
for (int i=0; i<labels.size(); i++)
if (labels[i]->name == n)
return labels[i];
return NULL;
}
// *******************************************************************
// Method: avtDatabaseMetaData::GetDefaultPlot
//
......@@ -6715,6 +7018,8 @@ Indent(ostream &out, int indent)
// Creation: August 24, 2004
//
// Modifications:
// Brad Whitlock, Fri Apr 1 22:53:25 PST 2005
// Added labels.
//
// ****************************************************************************
......@@ -6754,6 +7059,11 @@ avtDatabaseMetaData::GetAllVariableNames(const std::string &activeVar) const
if (GetSpecies(i)->meshName == meshName)
vars.push_back(GetSpecies(i)->name);
}
for (i = 0; i < GetNumLabels(); i++)
{
if (GetLabel(i)->meshName == meshName)
vars.push_back(GetLabel(i)->name);
}
return vars;
}
......@@ -6797,6 +7107,10 @@ avtDatabaseMetaData::GetAllMeshNames() const
// Programmer: Hank Childs
// Creation: February 14, 2005
//
// Modifications:
// Brad Whitlock, Fri Apr 1 15:40:29 PST 2005
// Added labels.
//
// ****************************************************************************
static bool IsForbidden(std::string &origName, std::string &newName,
......@@ -6967,6 +7281,23 @@ avtDatabaseMetaData::ReplaceForbiddenCharacters(std::vector<char> &badChars,
}
}
*/
for (i = 0 ; i < labels.size() ; i++)
{
if (labels[i]->originalName == "")
labels[i]->originalName = labels[i]->name;
if (IsForbidden(labels[i]->originalName, replacementName, badChars,
replacementStr))
{
char msg[1024];
SNPRINTF(msg, 1024, "The database contains an object named \"%s\""
", which contains characters not supported by "
"VisIt. VisIt is renaming it to \"%s\"",
labels[i]->originalName.c_str(),
replacementName.c_str());
IssueWarning(msg);
labels[i]->name = replacementName;
}
}
}
......
......@@ -405,6 +405,29 @@ public:
void Validate(void);
};
//----------------------------------------------------------------------------
// Class: avtLabelMetaData
//
// Modifications:
//
//----------------------------------------------------------------------------
struct DBATTS_API avtLabelMetaData : public AttributeSubject
{
std::string name;
std::string originalName;
std::string meshName;
avtCentering centering;
bool validVariable;
public:
avtLabelMetaData();
avtLabelMetaData(const std::string &, const std::string &, avtCentering);
avtLabelMetaData(const avtLabelMetaData&);
virtual ~avtLabelMetaData();
const avtLabelMetaData &operator=(const avtLabelMetaData&);
virtual void SelectAll();
void Print(ostream &, int = 0) const;
};
//----------------------------------------------------------------------------
// Class: avtDefaultPlotMetaData
//----------------------------------------------------------------------------
......@@ -448,7 +471,11 @@ public:
// Hank Childs, Mon Feb 14 14:11:29 PST 2005