Commit c19c00f2 authored by hrchilds's avatar hrchilds

Update from August 14, 2003

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@58 18c085ea-50e0-402c-830e-de6fd14e8384
parent 2b75a941
// ************************************************************************* //
// ExprGrammarNode.C //
// ************************************************************************* //
#include <ExprGrammarNode.h>
// ****************************************************************************
// Method: ExprGrammarNode::Print
//
// Purpose:
// The print method for an expression grammar node.
//
// Programmer: Sean Ahern
// Creation: April 18, 2002
//
// Modifications:
//
// Hank Childs, Thu Aug 14 08:25:29 PDT 2003
// Moved this routine from the header, to prevent problems with inline
// functions and statics.
//
// ****************************************************************************
void
ExprGrammarNode::Print(ostream &o, std::string s="")
{
static int indent = 0;
for (int i=0; i<indent; i++)
o << " ";
o << s.c_str();
indent++;
PrintNode(o);
indent--;
}
// ************************************************************************* //
// ExprGrammarNode.h //
// ************************************************************************* //
#ifndef EXPRGRAMMARNODE_H
#define EXPRGRAMMARNODE_H
#include <parser_exports.h>
#include <vector>
#include <Pos.h>
#include <set>
class Identifier;
class Token;
......@@ -19,6 +25,9 @@ class Token;
//
// Modifications:
//
// Hank Childs, Thu Aug 14 08:21:14 PDT 2003
// Un-inlined Print method, since it contained statics.
//
// ****************************************************************************
class PARSER_API ExprGrammarNode
{
......@@ -28,16 +37,9 @@ class PARSER_API ExprGrammarNode
const Pos &GetPos() const {return pos;}
Pos &GetPos() {return pos;}
virtual const std::string GetTypeName() {return "ExprGrammarNode";}
virtual std::set<std::string> GetVarLeaves() {return std::set<std::string>();}
virtual void Print(ostream &o, std::string s="")
{
static int indent = 0;
for (int i=0; i<indent; i++) o << " ";
o << s.c_str();
indent++;
PrintNode(o);
indent--;
}
virtual std::set<std::string> GetVarLeaves()
{return std::set<std::string>();}
virtual void Print(ostream &o, std::string s="");
virtual void PrintNode(ostream &o) = 0;
protected:
Pos pos;
......
......@@ -68,12 +68,24 @@ VectorExpr::PrintNode(ostream &o)
if (z) z->Print(o);
}
// ****************************************************************************
// Method: VectorExpr::GetVarLeaves
//
// Programmer: Sean Ahern
//
// Modifications:
// Jeremy Meredith, Thu Aug 14 10:24:14 PDT 2003
// Allow 2D vectors.
//
// ****************************************************************************
std::set<std::string>
VectorExpr::GetVarLeaves()
{
std::set<std::string> xset = x->GetVarLeaves();
std::set<std::string> yset = y->GetVarLeaves();
std::set<std::string> zset = z->GetVarLeaves();
std::set<std::string> zset;
if (z)
zset = z->GetVarLeaves();
while (!yset.empty())
{
......
......@@ -34,6 +34,9 @@
#
# Modifications:
#
# Hank Childs, Thu Aug 14 08:21:14 PDT 2003
# Added ExprGrammarNode.
#
##############################################################################
##
......@@ -55,6 +58,7 @@ COMMONSRC = \
ConfiguratingItem.C \
ConfiguratingSet.C \
ExprGrammar.C \
ExprGrammarNode.C \
ExprNode.C \
ExprParser.C \
Grammar.C \
......
......@@ -49,18 +49,20 @@ Expression::ExprType_FromString(const std::string &s, Expression::ExprType &val)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
// ****************************************************************************
Expression::Expression() : AttributeSubject("ssbi")
Expression::Expression() : AttributeSubject("ssbibs")
{
name = "notset";
definition = "notset";
hidden = false;
type = ScalarMeshVar;
fromDB = false;
dbName = "__none__";
}
// ****************************************************************************
......@@ -72,18 +74,20 @@ Expression::Expression() : AttributeSubject("ssbi")
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
// ****************************************************************************
Expression::Expression(const Expression &obj) : AttributeSubject("ssbi")
Expression::Expression(const Expression &obj) : AttributeSubject("ssbibs")
{
name = obj.name;
definition = obj.definition;
hidden = obj.hidden;
type = obj.type;
fromDB = obj.fromDB;
dbName = obj.dbName;
SelectAll();
}
......@@ -97,7 +101,7 @@ Expression::Expression(const Expression &obj) : AttributeSubject("ssbi")
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -117,7 +121,7 @@ Expression::~Expression()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -130,6 +134,8 @@ Expression::operator = (const Expression &obj)
definition = obj.definition;
hidden = obj.hidden;
type = obj.type;
fromDB = obj.fromDB;
dbName = obj.dbName;
SelectAll();
}
......@@ -143,7 +149,7 @@ Expression::operator = (const Expression &obj)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -156,7 +162,9 @@ Expression::operator == (const Expression &obj) const
return ((name == obj.name) &&
(definition == obj.definition) &&
(hidden == obj.hidden) &&
(type == obj.type));
(type == obj.type) &&
(fromDB == obj.fromDB) &&
(dbName == obj.dbName));
}
// ****************************************************************************
......@@ -168,7 +176,7 @@ Expression::operator == (const Expression &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -189,7 +197,7 @@ Expression::operator != (const Expression &obj) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -210,7 +218,7 @@ Expression::TypeName() const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -238,7 +246,7 @@ Expression::CopyAttributes(const AttributeGroup *atts)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -264,7 +272,7 @@ Expression::CreateCompatible(const std::string &tname) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -291,7 +299,7 @@ Expression::NewInstance(bool copy) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -304,6 +312,8 @@ Expression::SelectAll()
Select(1, (void *)&definition);
Select(2, (void *)&hidden);
Select(3, (void *)&type);
Select(4, (void *)&fromDB);
Select(5, (void *)&dbName);
}
///////////////////////////////////////////////////////////////////////////////
......@@ -319,7 +329,7 @@ Expression::SelectAll()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -360,6 +370,18 @@ Expression::CreateNode(DataNode *parentNode, bool forceAdd)
node->AddNode(new DataNode("type", ExprType_ToString(type)));
}
if(!FieldsEqual(4, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("fromDB", fromDB));
}
if(!FieldsEqual(5, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("dbName", dbName));
}
// Add the node to the parent node.
if(addToParent || forceAdd)
......@@ -379,7 +401,7 @@ Expression::CreateNode(DataNode *parentNode, bool forceAdd)
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -418,6 +440,10 @@ Expression::SetFromNode(DataNode *parentNode)
SetType(value);
}
}
if((node = searchNode->GetNode("fromDB")) != 0)
SetFromDB(node->AsBool());
if((node = searchNode->GetNode("dbName")) != 0)
SetDbName(node->AsString());
}
///////////////////////////////////////////////////////////////////////////////
......@@ -452,6 +478,20 @@ Expression::SetType(Expression::ExprType type_)
Select(3, (void *)&type);
}
void
Expression::SetFromDB(bool fromDB_)
{
fromDB = fromDB_;
Select(4, (void *)&fromDB);
}
void
Expression::SetDbName(const std::string &dbName_)
{
dbName = dbName_;
Select(5, (void *)&dbName);
}
///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////
......@@ -492,6 +532,24 @@ Expression::GetType() const
return ExprType(type);
}
bool
Expression::GetFromDB() const
{
return fromDB;
}
const std::string &
Expression::GetDbName() const
{
return dbName;
}
std::string &
Expression::GetDbName()
{
return dbName;
}
///////////////////////////////////////////////////////////////////////////////
// Select property methods
///////////////////////////////////////////////////////////////////////////////
......@@ -508,6 +566,12 @@ Expression::SelectDefinition()
Select(1, (void *)&definition);
}
void
Expression::SelectDbName()
{
Select(5, (void *)&dbName);
}
///////////////////////////////////////////////////////////////////////////////
// Keyframing methods
///////////////////////////////////////////////////////////////////////////////
......@@ -521,7 +585,7 @@ Expression::SelectDefinition()
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -536,6 +600,8 @@ Expression::GetFieldName(int index) const
case 1: return "definition";
case 2: return "hidden";
case 3: return "type";
case 4: return "fromDB";
case 5: return "dbName";
default: return "invalid index";
}
}
......@@ -549,7 +615,7 @@ Expression::GetFieldName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -564,6 +630,8 @@ Expression::GetFieldType(int index) const
case 1: return FieldType_string;
case 2: return FieldType_bool;
case 3: return FieldType_enum;
case 4: return FieldType_bool;
case 5: return FieldType_string;
default: return FieldType_unknown;
}
}
......@@ -577,7 +645,7 @@ Expression::GetFieldType(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -592,6 +660,8 @@ Expression::GetFieldTypeName(int index) const
case 1: return "string";
case 2: return "bool";
case 3: return "enum";
case 4: return "bool";
case 5: return "string";
default: return "invalid index";
}
}
......@@ -605,7 +675,7 @@ Expression::GetFieldTypeName(int index) const
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -638,6 +708,16 @@ Expression::FieldsEqual(int index_, const AttributeGroup *rhs) const
retval = (type == obj.type);
}
break;
case 4:
{ // new scope
retval = (fromDB == obj.fromDB);
}
break;
case 5:
{ // new scope
retval = (dbName == obj.dbName);
}
break;
default: retval = false;
}
......
......@@ -13,7 +13,7 @@
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Jul 24 11:03:22 PDT 2003
// Creation: Thu Aug 14 08:00:20 PDT 2003
//
// Modifications:
//
......@@ -51,12 +51,15 @@ public:
virtual void SelectAll();
void SelectName();
void SelectDefinition();
void SelectDbName();
// Property setting methods
void SetName(const std::string &name_);
void SetDefinition(const std::string &definition_);
void SetHidden(bool hidden_);
void SetType(ExprType type_);
void SetFromDB(bool fromDB_);
void SetDbName(const std::string &dbName_);
// Property getting methods
const std::string &GetName() const;
......@@ -65,6 +68,9 @@ public:
std::string &GetDefinition();
bool GetHidden() const;
ExprType GetType() const;
bool GetFromDB() const;
const std::string &GetDbName() const;
std::string &GetDbName();
// Persistence methods
virtual bool CreateNode(DataNode *node, bool forceAdd);
......@@ -92,6 +98,8 @@ private:
std::string definition;
bool hidden;
int type;
bool fromDB;
std::string dbName;
};
#endif
......@@ -22,6 +22,12 @@
<Field name="type" label="type" type="enum" subtype="ExprType">
ScalarMeshVar
</Field>
<Field name="fromDB" label="fromDB" type="bool">
false
</Field>
<Field name="dbName" label="dbName" type="string">
"__none__"
</Field>
<Function name="GetNumTypes" user="true" member="true">
</Function>
<Function name="GetTypeString" user="true" member="true">
......
......@@ -1966,7 +1966,7 @@ avtCurveMetaData::Print(ostream &out, int indent) const
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData()
: AttributeSubject("bddibss*i*i*i*d*a*a*a*a*a*a*a")
: AttributeSubject("sbddibss*i*i*i*d*a*a*a*a*a*a*a")
{
hasTemporalExtents = false;
minTemporalExtents = 0.;
......@@ -2005,11 +2005,15 @@ avtDatabaseMetaData::avtDatabaseMetaData()
// Hank Childs, Fri Aug 1 11:08:21 PDT 2003
// Add support for curves.
//
// Hank Childs, Thu Aug 14 08:16:07 PDT 2003
// Copy over the database name.
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &rhs)
: AttributeSubject("bddibss*i*i*i*d*a*a*a*a*a*a*a")
: AttributeSubject("sbddibss*i*i*i*d*a*a*a*a*a*a*a")
{
databaseName = rhs.databaseName;
hasTemporalExtents = rhs.hasTemporalExtents;
minTemporalExtents = rhs.minTemporalExtents;
maxTemporalExtents = rhs.maxTemporalExtents;
......@@ -2068,10 +2072,15 @@ avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &rhs)
// Hank Childs, Fri Aug 1 11:08:21 PDT 2003
// Add support for curves.
//
// Hank Childs, Thu Aug 14 08:16:07 PDT 2003
// Copy over the database name.
//
// ****************************************************************************
const avtDatabaseMetaData &
avtDatabaseMetaData::operator=(const avtDatabaseMetaData &rhs)
{
databaseName = rhs.databaseName;
hasTemporalExtents = rhs.hasTemporalExtents;
minTemporalExtents = rhs.minTemporalExtents;
maxTemporalExtents = rhs.maxTemporalExtents;
......@@ -2737,11 +2746,11 @@ avtDatabaseMetaData::GetNDomains(std::string var)
// Hank Childs, Fri Aug 1 11:08:21 PDT 2003
// Add support for curves.
//
//
// Sean Ahern, Wed Feb 5 16:30:36 PST 2003
// Added support for expressions.
//
// ****************************************************************************
avtVarType
avtDatabaseMetaData::DetermineVarType(std::string var_in)
{
......@@ -2847,6 +2856,7 @@ avtDatabaseMetaData::DetermineVarType(std::string var_in)
// Added expression support.
//
// ****************************************************************************
std::string
avtDatabaseMetaData::MeshForVar(std::string var)
{
......@@ -3066,8 +3076,8 @@ avtDatabaseMetaData::GetMaterialOnMesh(std::string mesh)
if (rv != NULL)
{
debug1 << "WARNING: screwy file. There are multiple materials"
<< " (" << rv << " and " << (*mait)->name.c_str() << ") defined"
<< " on the same mesh." << endl;
<< " (" << rv << " and " << (*mait)->name.c_str()
<< ") defined on the same mesh." << endl;
debug1 << "There are assumptions in the VisIt code that this "
<< "will never happen." << endl;
}
......@@ -3156,6 +3166,9 @@ avtDatabaseMetaData::GetSpeciesOnMesh(std::string mesh)
void
avtDatabaseMetaData::Print(ostream &out, int indent) const
{
Indent(out, indent);
out << "Database: " << databaseName << endl;
Indent(out, indent);
out << "Num Time States: " << numStates << endl;
......@@ -3301,6 +3314,9 @@ avtDatabaseMetaData::Print(ostream &out, int indent) const
case Expression::Species:
vartype = "species";
break;
case Expression::Unknown:
vartype = "unknown!";
break;
}
out << exprList[i].GetName() << " (" << vartype << "): \t"
<< exprList[i].GetDefinition() << endl;
......@@ -3339,32 +3355,36 @@ avtDatabaseMetaData::Print(ostream &out, int indent) const
// Hank Childs, Fri Aug 1 11:08:21 PDT 2003
// Add support for curves.
//
// Hank Childs, Thu Aug 14 08:16:07 PDT 2003
// Added database name.
//
// *******************************************************************
void
avtDatabaseMetaData::SelectAll()
{
Select(0, (void*)&hasTemporalExtents);
Select(1, (void*)&minTemporalExtents);
Select(2, (void*)&maxTemporalExtents);
Select(3, (void*)&numStates);
Select(4, (void*)&isVirtualDatabase);
Select(5, (void*)&timeStepPath);
Select(6, (void*)&timeStepNames);
Select(7, (void*)&cyclesAreAccurate);
Select(8, (void*)&cycles);
Select(9, (void*)&timesAreAccurate);
Select(10, (void*)&times);
Select(11, (void*)&meshes);
Select(12, (void*)&scalars);
Select(13, (void*)&vectors);
Select(14, (void*)&materials);
Select(15, (void*)&species);
Select(16, (void*)&curves);
Select(17, (void*)&exprList);
Select(0, (void*)&databaseName);
Select(1, (void*)&hasTemporalExtents);
Select(2, (void*)&minTemporalExtents);
Select(3, (void*)&maxTemporalExtents);
Select(4, (void*)&numStates);
Select(5, (void*)&isVirtualDatabase);
Select(6, (void*)&timeStepPath);
Select(7, (void*)&timeStepNames);
Select(8, (void*)&cyclesAreAccurate);
Select(9, (void*)&cycles);
Select(10, (void*)&timesAreAccurate);
Select(11, (void*)&times);
Select(12, (void*)&meshes);
Select(13, (void*)&scalars);
Select(14, (void*)&vectors);
Select(15, (void*)&materials);
Select(16, (void*)&species);
Select(17, (void*)&curves);
Select(18, (void*)&exprList);
}
// *******************************************************************
......@@ -3394,6 +3414,9 @@ avtDatabaseMetaData::SelectAll()
// Hank Childs, Fri Aug 1 11:08:21 PDT 2003
// Add support for curves.
//
// Hank Childs, Thu Aug 14 08:16:07 PDT 2003
// Account for database name being added to front of list.
//
// *******************************************************************
AttributeGroup *
......@@ -3401,17 +3424,17 @@ avtDatabaseMetaData::CreateSubAttributeGroup(int n)
{
switch (n)
{
case 11:
return new avtMeshMetaData;
case 12:
return new avtScalarMetaData;
return new avtMeshMetaData;
case 13:
return new avtVectorMetaData;
return new avtScalarMetaData;
case 14:
return new avtMaterialMetaData;
return new avtVectorMetaData;
case 15:
return new avtSpeciesMetaData;
return new avtMaterialMetaData;
case 16:
return new avtSpeciesMetaData;
case 17:
return new avtCurveMetaData;
default:
return NULL;
......@@ -3880,6 +3903,8 @@ avtDatabaseMetaData::UnsetExtents(void)
void
avtDatabaseMetaData::AddExpression(Expression *expr)
{
expr->SetFromDB(true);
expr->SetDbName(databaseName);
exprList.AddExpression(*expr);
}
......@@ -3895,8 +3920,8 @@ avtDatabaseMetaData::AddExpression(Expression *expr)
//
// ****************************************************************************
Expression *
avtDatabaseMetaData::GetExpression(int expr)
const Expression *
avtDatabaseMetaData::GetExpression(int expr) const
{
return &(exprList[expr]);
}
......@@ -3914,7 +3939,7 @@ avtDatabaseMetaData::GetExpression(int expr)