Commit ed60e07a authored by miller86's avatar miller86

adding support for derived state objects; fixing bugs with enums and python...

adding support for derived state objects; fixing bugs with enums and python methods for private members in xml code-gen tools; re-factored ReadDir method in Silo plugin; adding Plural() method to StringHelpers

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@8236 18c085ea-50e0-402c-830e-de6fd14e8384
parent 8c3cebf6
......@@ -82,6 +82,8 @@
# Dave Bremer, Wed Dec 19 12:33:29 PST 2007
# Added avtSILArray.C to the build.
#
# Mark C. Miller, Wed Aug 26 11:06:34 PDT 2009
# Removed custom SIL stuff. Added avtVarMetaData
##############################################################################
@SET_MAKE@
......@@ -100,8 +102,6 @@ MetaData_src= \
MetaData/avtMatSpeciesMetaData.C\
MetaData/avtMaterialMetaData.C\
MetaData/avtMeshMetaData.C\
MetaData/avtSILCollectionMetaData.C\
MetaData/avtSILMetaData.C\
MetaData/avtScalarMetaData.C\
MetaData/avtSimulationCommandSpecification.C\
MetaData/avtSimulationInformation.C\
......@@ -109,6 +109,7 @@ MetaData_src= \
MetaData/avtSymmetricTensorMetaData.C\
MetaData/avtTensorMetaData.C\
MetaData/avtTypes.C\
MetaData/avtVarMetaData.C\
MetaData/avtVectorMetaData.C
SIL_src= \
SIL/avtSIL.C \
......
......@@ -40,14 +40,59 @@
#include <DataNode.h>
#include <snprintf.h>
// ****************************************************************************
// Method: avtArrayMetaData::avtArrayMetaData
//
// Purpose:
// Init utility for the avtArrayMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void avtArrayMetaData::Init()
{
nVars = 0;
}
// ****************************************************************************
// Method: avtArrayMetaData::avtArrayMetaData
//
// Purpose:
// Copy utility for the avtArrayMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void avtArrayMetaData::Copy(const avtArrayMetaData &obj)
{
nVars = obj.nVars;
compNames = obj.compNames;
avtArrayMetaData::SelectAll();
}
// Type map format string
const char *avtArrayMetaData::TypeMapFormatString = "ssbsibsis*b";
const char *avtArrayMetaData::TypeMapFormatString = AVTARRAYMETADATA_TMFS;
const AttributeGroup::private_tmfs_t avtArrayMetaData::TmfsStruct = {AVTARRAYMETADATA_TMFS};
// ****************************************************************************
// Method: avtArrayMetaData::avtArrayMetaData
//
// Purpose:
// Constructor for the avtArrayMetaData class.
// Default constructor for the avtArrayMetaData class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -59,15 +104,30 @@ const char *avtArrayMetaData::TypeMapFormatString = "ssbsibsis*b";
// ****************************************************************************
avtArrayMetaData::avtArrayMetaData() :
AttributeSubject(avtArrayMetaData::TypeMapFormatString)
avtVarMetaData(avtArrayMetaData::TmfsStruct)
{
name = "array";
validVariable = true;
meshName = "mesh";
centering = AVT_UNKNOWN_CENT;
hasUnits = false;
nVars = 0;
hideFromGUI = false;
avtArrayMetaData::Init();
}
// ****************************************************************************
// Method: avtArrayMetaData::avtArrayMetaData
//
// Purpose:
// Constructor for the derived classes of avtArrayMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
avtArrayMetaData::avtArrayMetaData(private_tmfs_t tmfs) :
avtVarMetaData(tmfs)
{
avtArrayMetaData::Init();
}
// ****************************************************************************
......@@ -86,20 +146,30 @@ avtArrayMetaData::avtArrayMetaData() :
// ****************************************************************************
avtArrayMetaData::avtArrayMetaData(const avtArrayMetaData &obj) :
AttributeSubject(avtArrayMetaData::TypeMapFormatString)
avtVarMetaData(obj,avtArrayMetaData::TmfsStruct)
{
name = obj.name;
originalName = obj.originalName;
validVariable = obj.validVariable;
meshName = obj.meshName;
centering = obj.centering;
hasUnits = obj.hasUnits;
units = obj.units;
nVars = obj.nVars;
compNames = obj.compNames;
hideFromGUI = obj.hideFromGUI;
avtArrayMetaData::Copy(obj);
}
// ****************************************************************************
// Method: avtArrayMetaData::avtArrayMetaData
//
// Purpose:
// Copy constructor for derived classes of the avtArrayMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
SelectAll();
avtArrayMetaData::avtArrayMetaData(const avtArrayMetaData &obj, private_tmfs_t tmfs) :
avtVarMetaData(obj,tmfs)
{
avtArrayMetaData::Copy(obj);
}
// ****************************************************************************
......@@ -141,18 +211,15 @@ avtArrayMetaData&
avtArrayMetaData::operator = (const avtArrayMetaData &obj)
{
if (this == &obj) return *this;
name = obj.name;
originalName = obj.originalName;
validVariable = obj.validVariable;
meshName = obj.meshName;
centering = obj.centering;
hasUnits = obj.hasUnits;
units = obj.units;
// call the base class' assignment operator first
avtVarMetaData::operator=(obj);
nVars = obj.nVars;
compNames = obj.compNames;
hideFromGUI = obj.hideFromGUI;
SelectAll();
avtArrayMetaData::SelectAll();
return *this;
}
......@@ -175,16 +242,9 @@ bool
avtArrayMetaData::operator == (const avtArrayMetaData &obj) const
{
// Create the return value
return ((name == obj.name) &&
(originalName == obj.originalName) &&
(validVariable == obj.validVariable) &&
(meshName == obj.meshName) &&
(centering == obj.centering) &&
(hasUnits == obj.hasUnits) &&
(units == obj.units) &&
(nVars == obj.nVars) &&
return ((nVars == obj.nVars) &&
(compNames == obj.compNames) &&
(hideFromGUI == obj.hideFromGUI));
avtVarMetaData::operator==(obj));
}
// ****************************************************************************
......@@ -328,16 +388,10 @@ avtArrayMetaData::NewInstance(bool copy) const
void
avtArrayMetaData::SelectAll()
{
Select(ID_name, (void *)&name);
Select(ID_originalName, (void *)&originalName);
Select(ID_validVariable, (void *)&validVariable);
Select(ID_meshName, (void *)&meshName);
Select(ID_centering, (void *)&centering);
Select(ID_hasUnits, (void *)&hasUnits);
Select(ID_units, (void *)&units);
Select(ID_nVars, (void *)&nVars);
Select(ID_compNames, (void *)&compNames);
Select(ID_hideFromGUI, (void *)&hideFromGUI);
// call the base class' SelectAll() first
avtVarMetaData::SelectAll();
Select(ID_nVars, (void *)&nVars);
Select(ID_compNames, (void *)&compNames);
}
///////////////////////////////////////////////////////////////////////////////
......@@ -368,7 +422,7 @@ avtArrayMetaData::SelectAll()
avtArrayMetaData::avtArrayMetaData(std::string n, std::string mn,
avtCentering c, int nv)
: AttributeSubject(avtArrayMetaData::TypeMapFormatString)
: avtVarMetaData(avtArrayMetaData::TmfsStruct)
{
// Initialize all members
*this = avtArrayMetaData();
......@@ -405,7 +459,7 @@ avtArrayMetaData::avtArrayMetaData(std::string n, std::string mn,
avtArrayMetaData::avtArrayMetaData(std::string n, std::string mn,
avtCentering c, int nv,
const stringVector &cn)
: AttributeSubject("sssiis*bbs")
: avtVarMetaData(avtArrayMetaData::TmfsStruct)
{
// Initialize all members
*this = avtArrayMetaData();
......@@ -444,41 +498,7 @@ Indent(ostream &out, int indent)
void
avtArrayMetaData::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(hasUnits)
{
Indent(out, indent);
out << "Units are: " << units.c_str() << endl;
}
avtVarMetaData::Print(out, indent);
Indent(out, indent);
out << "Number of variables = " << nVars << endl;
......@@ -492,11 +512,5 @@ avtArrayMetaData::Print(ostream &out, int indent) const
else
out << endl;
}
if (!validVariable)
{
Indent(out, indent);
out << "THIS IS NOT A VALID VARIABLE." << endl;
}
}
......@@ -17,7 +17,7 @@ Definition:
avtArrayMetaData::avtArrayMetaData(std::string n, std::string mn,
avtCentering c, int nv)
: AttributeSubject(avtArrayMetaData::TypeMapFormatString)
: avtVarMetaData(avtArrayMetaData::TmfsStruct)
{
// Initialize all members
*this = avtArrayMetaData();
......@@ -57,7 +57,7 @@ Definition:
avtArrayMetaData::avtArrayMetaData(std::string n, std::string mn,
avtCentering c, int nv,
const stringVector &cn)
: AttributeSubject("sssiis*bbs")
: avtVarMetaData(avtArrayMetaData::TmfsStruct)
{
// Initialize all members
*this = avtArrayMetaData();
......@@ -99,41 +99,7 @@ Indent(ostream &out, int indent)
void
avtArrayMetaData::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(hasUnits)
{
Indent(out, indent);
out << "Units are: " << units.c_str() << endl;
}
avtVarMetaData::Print(out, indent);
Indent(out, indent);
out << "Number of variables = " << nVars << endl;
......@@ -147,11 +113,5 @@ avtArrayMetaData::Print(ostream &out, int indent) const
else
out << endl;
}
if (!validVariable)
{
Indent(out, indent);
out << "THIS IS NOT A VALID VARIABLE." << endl;
}
}
......@@ -40,8 +40,8 @@
#define AVTARRAYMETADATA_H
#include <dbatts_exports.h>
#include <string>
#include <avtTypes.h>
#include <AttributeSubject.h>
#include <avtVarMetaData.h>
// ****************************************************************************
// Class: avtArrayMetaData
......@@ -58,16 +58,26 @@
//
// ****************************************************************************
class DBATTS_API avtArrayMetaData : public AttributeSubject
class DBATTS_API avtArrayMetaData : public avtVarMetaData
{
public:
// These constructors are for objects of this class
avtArrayMetaData();
avtArrayMetaData(const avtArrayMetaData &obj);
protected:
// These constructors are for objects derived from this class
avtArrayMetaData(private_tmfs_t tmfs);
avtArrayMetaData(const avtArrayMetaData &obj, private_tmfs_t tmfs);
public:
virtual ~avtArrayMetaData();
virtual avtArrayMetaData& operator = (const avtArrayMetaData &obj);
virtual bool operator == (const avtArrayMetaData &obj) const;
virtual bool operator != (const avtArrayMetaData &obj) const;
private:
void Init();
void Copy(const avtArrayMetaData &obj);
public:
virtual const std::string TypeName() const;
virtual bool CopyAttributes(const AttributeGroup *);
......@@ -84,33 +94,20 @@ public:
// IDs that can be used to identify fields in case statements
enum {
ID_name = 0,
ID_originalName,
ID_validVariable,
ID_meshName,
ID_centering,
ID_hasUnits,
ID_units,
ID_nVars,
ID_nVars = avtVarMetaData::ID__LAST,
ID_compNames,
ID_hideFromGUI
ID__LAST
};
public:
std::string name;
std::string originalName;
bool validVariable;
std::string meshName;
avtCentering centering;
bool hasUnits;
std::string units;
int nVars;
stringVector compNames;
bool hideFromGUI;
private:
// Static class format string for type map.
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define AVTARRAYMETADATA_TMFS (AVTVARMETADATA_TMFS "is*")
#endif
<?xml version="1.0"?>
<Attribute name="avtArrayMetaData" purpose="Contains array metadata attributes" persistent="false" keyframe="false" exportAPI="DBATTS_API" exportInclude="dbatts_exports.h" codefile="avtArrayMetaData.code">
<Field name="name" label="Name" type="string" access="public">
array
</Field>
<Field name="originalName" label="Original name" type="string" access="public">
</Field>
<Field name="validVariable" label="Valid variable" type="bool" access="public">
true
</Field>
<Field name="meshName" label="Mesh name" type="string" access="public">
mesh
</Field>
<Field name="centering" label="Variable centering" type="avtCentering" access="public">
AVT_UNKNOWN_CENT
</Field>
<Field name="hasUnits" label="Has units" type="bool" access="public">
false
</Field>
<Field name="units" label="Units" type="string" access="public">
</Field>
<Attribute name="avtArrayMetaData" purpose="Contains array metadata attributes" persistent="false" keyframe="false" exportAPI="DBATTS_API" exportInclude="dbatts_exports.h" codefile="avtArrayMetaData.code" baseClass="avtVarMetaData">
<Field name="nVars" label="Number of variables" type="int" access="public">
0
</Field>
<Field name="compNames" label="Component names" type="stringVector" access="public">
</Field>
<Field name="hideFromGUI" label="hideFromGUI" type="bool" access="public">
false
</Field>
<Function name="avtArrayMetaData2" user="true" member="true">
</Function>
<Function name="avtArrayMetaData3" user="true" member="true">
......
......@@ -39,14 +39,11 @@
#include <avtCurveMetaData.h>
#include <DataNode.h>
// Type map format string
const char *avtCurveMetaData::TypeMapFormatString = "ssbssssbddbddbs";
// ****************************************************************************
// Method: avtCurveMetaData::avtCurveMetaData
//
// Purpose:
// Constructor for the avtCurveMetaData class.
// Init utility for the avtCurveMetaData class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -57,27 +54,20 @@ const char *avtCurveMetaData::TypeMapFormatString = "ssbssssbddbddbs";
//
// ****************************************************************************
avtCurveMetaData::avtCurveMetaData() :
AttributeSubject(avtCurveMetaData::TypeMapFormatString)
void avtCurveMetaData::Init()
{
name = "curve";
validVariable = true;
xLabel = "X-Axis";
yLabel = "Y-Axis";
hasSpatialExtents = false;
minSpatialExtents = 0;
maxSpatialExtents = 0;
hasDataExtents = false;
minDataExtents = 0;
maxDataExtents = 0;
hideFromGUI = false;
}
// ****************************************************************************
// Method: avtCurveMetaData::avtCurveMetaData
//
// Purpose:
// Copy constructor for the avtCurveMetaData class.
// Copy utility for the avtCurveMetaData class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -88,12 +78,8 @@ avtCurveMetaData::avtCurveMetaData() :
//
// ****************************************************************************
avtCurveMetaData::avtCurveMetaData(const avtCurveMetaData &obj) :
AttributeSubject(avtCurveMetaData::TypeMapFormatString)
void avtCurveMetaData::Copy(const avtCurveMetaData &obj)
{
name = obj.name;
originalName = obj.originalName;
validVariable = obj.validVariable;
xUnits = obj.xUnits;
xLabel = obj.xLabel;
yUnits = obj.yUnits;
......@@ -101,13 +87,98 @@ avtCurveMetaData::avtCurveMetaData(const avtCurveMetaData &obj) :
hasSpatialExtents = obj.hasSpatialExtents;
minSpatialExtents = obj.minSpatialExtents;
maxSpatialExtents = obj.maxSpatialExtents;
hasDataExtents = obj.hasDataExtents;
minDataExtents = obj.minDataExtents;
maxDataExtents = obj.maxDataExtents;
hideFromGUI = obj.hideFromGUI;
from1DScalarName = obj.from1DScalarName;
SelectAll();
avtCurveMetaData::SelectAll();
}
// Type map format string
const char *avtCurveMetaData::TypeMapFormatString = AVTCURVEMETADATA_TMFS;
const AttributeGroup::private_tmfs_t avtCurveMetaData::TmfsStruct = {AVTCURVEMETADATA_TMFS};
// ****************************************************************************
// Method: avtCurveMetaData::avtCurveMetaData
//
// Purpose:
// Default constructor for the avtCurveMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
avtCurveMetaData::avtCurveMetaData() :
avtVarMetaData(avtCurveMetaData::TmfsStruct)
{
avtCurveMetaData::Init();
}
// ****************************************************************************
// Method: avtCurveMetaData::avtCurveMetaData
//
// Purpose:
// Constructor for the derived classes of avtCurveMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
avtCurveMetaData::avtCurveMetaData(private_tmfs_t tmfs) :
avtVarMetaData(tmfs)
{
avtCurveMetaData::Init();
}
// ****************************************************************************
// Method: avtCurveMetaData::avtCurveMetaData
//
// Purpose:
// Copy constructor for the avtCurveMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted