Commit 65141752 authored by miller86's avatar miller86
Browse files

adding subsets metadata object for neams subsetting; adding Namescheme utility...

adding subsets metadata object for neams subsetting; adding Namescheme utility and NameschemeAttributes state object; improved xml generation tools a bit; const qualified StringHelpers interface

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@8278 18c085ea-50e0-402c-830e-de6fd14e8384
parent 26657389
......@@ -106,6 +106,7 @@ MetaData_src= \
MetaData/avtSimulationCommandSpecification.C\
MetaData/avtSimulationInformation.C\
MetaData/avtSpeciesMetaData.C\
MetaData/avtSubsetsMetaData.C\
MetaData/avtSymmetricTensorMetaData.C\
MetaData/avtTensorMetaData.C\
MetaData/avtTypes.C\
......
......@@ -46,6 +46,7 @@
#include <ExprNode.h>
#include <snprintf.h>
#include <avtMeshMetaData.h>
#include <avtSubsetsMetaData.h>
#include <avtScalarMetaData.h>
#include <avtVectorMetaData.h>
#include <avtTensorMetaData.h>
......@@ -57,14 +58,11 @@
#include <avtLabelMetaData.h>
#include <avtDefaultPlotMetaData.h>
// Type map format string
const char *avtDatabaseMetaData::TypeMapFormatString = "bddibbbbbss*i*i*d*i*sssaa*a*a*a*a*a*a*a*a*a*a*bas*";
// ****************************************************************************
// Method: avtDatabaseMetaData::avtDatabaseMetaData
//
// Purpose:
// Constructor for the avtDatabaseMetaData class.
// Init utility for the avtDatabaseMetaData class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -75,8 +73,7 @@ const char *avtDatabaseMetaData::TypeMapFormatString = "bddibbbbbss*i*i*d*i*sssa
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData() :
AttributeSubject(avtDatabaseMetaData::TypeMapFormatString)
void avtDatabaseMetaData::Init()
{
hasTemporalExtents = false;
minTemporalExtents = 0;
......@@ -94,7 +91,7 @@ avtDatabaseMetaData::avtDatabaseMetaData() :
// Method: avtDatabaseMetaData::avtDatabaseMetaData
//
// Purpose:
// Copy constructor for the avtDatabaseMetaData class.
// Copy utility for the avtDatabaseMetaData class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -105,8 +102,7 @@ avtDatabaseMetaData::avtDatabaseMetaData() :
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &obj) :
AttributeSubject(avtDatabaseMetaData::TypeMapFormatString)
void avtDatabaseMetaData::Copy(const avtDatabaseMetaData &obj)
{
AttributeGroupVector::const_iterator pos;
......@@ -144,6 +140,21 @@ avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &obj) :
meshes.push_back(newavtMeshMetaData);
}
// *** Copy the subsets field ***
// Delete the AttributeGroup objects and clear the vector.
for(pos = subsets.begin(); pos != subsets.end(); ++pos)
delete *pos;
subsets.clear();
if(obj.subsets.size() > 0)
subsets.reserve(obj.subsets.size());
// Duplicate the subsets from obj.
for(pos = obj.subsets.begin(); pos != obj.subsets.end(); ++pos)
{
avtSubsetsMetaData *oldavtSubsetsMetaData = (avtSubsetsMetaData *)(*pos);
avtSubsetsMetaData *newavtSubsetsMetaData = new avtSubsetsMetaData(*oldavtSubsetsMetaData);
subsets.push_back(newavtSubsetsMetaData);
}
// *** Copy the scalars field ***
// Delete the AttributeGroup objects and clear the vector.
for(pos = scalars.begin(); pos != scalars.end(); ++pos)
......@@ -298,7 +309,96 @@ avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &obj) :
simInfo = obj.simInfo;
suggestedDefaultSILRestriction = obj.suggestedDefaultSILRestriction;
SelectAll();
avtDatabaseMetaData::SelectAll();
}
// Type map format string
const char *avtDatabaseMetaData::TypeMapFormatString = AVTDATABASEMETADATA_TMFS;
const AttributeGroup::private_tmfs_t avtDatabaseMetaData::TmfsStruct = {AVTDATABASEMETADATA_TMFS};
// ****************************************************************************
// Method: avtDatabaseMetaData::avtDatabaseMetaData
//
// Purpose:
// Default constructor for the avtDatabaseMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData() :
AttributeSubject(avtDatabaseMetaData::TypeMapFormatString)
{
avtDatabaseMetaData::Init();
}
// ****************************************************************************
// Method: avtDatabaseMetaData::avtDatabaseMetaData
//
// Purpose:
// Constructor for the derived classes of avtDatabaseMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData(private_tmfs_t tmfs) :
AttributeSubject(tmfs.tmfs)
{
avtDatabaseMetaData::Init();
}
// ****************************************************************************
// Method: avtDatabaseMetaData::avtDatabaseMetaData
//
// Purpose:
// Copy constructor for the avtDatabaseMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &obj) :
AttributeSubject(avtDatabaseMetaData::TypeMapFormatString)
{
avtDatabaseMetaData::Copy(obj);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::avtDatabaseMetaData
//
// Purpose:
// Copy constructor for derived classes of the avtDatabaseMetaData class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &obj, private_tmfs_t tmfs) :
AttributeSubject(tmfs.tmfs)
{
avtDatabaseMetaData::Copy(obj);
}
// ****************************************************************************
......@@ -323,6 +423,9 @@ avtDatabaseMetaData::~avtDatabaseMetaData()
// Destroy the meshes field.
for(pos = meshes.begin(); pos != meshes.end(); ++pos)
delete *pos;
// Destroy the subsets field.
for(pos = subsets.begin(); pos != subsets.end(); ++pos)
delete *pos;
// Destroy the scalars field.
for(pos = scalars.begin(); pos != scalars.end(); ++pos)
delete *pos;
......@@ -374,6 +477,7 @@ avtDatabaseMetaData&
avtDatabaseMetaData::operator = (const avtDatabaseMetaData &obj)
{
if (this == &obj) return *this;
AttributeGroupVector::const_iterator pos;
hasTemporalExtents = obj.hasTemporalExtents;
......@@ -410,6 +514,21 @@ avtDatabaseMetaData::operator = (const avtDatabaseMetaData &obj)
meshes.push_back(newavtMeshMetaData);
}
// *** Copy the subsets field ***
// Delete the AttributeGroup objects and clear the vector.
for(pos = subsets.begin(); pos != subsets.end(); ++pos)
delete *pos;
subsets.clear();
if(obj.subsets.size() > 0)
subsets.reserve(obj.subsets.size());
// Duplicate the subsets from obj.
for(pos = obj.subsets.begin(); pos != obj.subsets.end(); ++pos)
{
avtSubsetsMetaData *oldavtSubsetsMetaData = (avtSubsetsMetaData *)(*pos);
avtSubsetsMetaData *newavtSubsetsMetaData = new avtSubsetsMetaData(*oldavtSubsetsMetaData);
subsets.push_back(newavtSubsetsMetaData);
}
// *** Copy the scalars field ***
// Delete the AttributeGroup objects and clear the vector.
for(pos = scalars.begin(); pos != scalars.end(); ++pos)
......@@ -564,7 +683,8 @@ avtDatabaseMetaData::operator = (const avtDatabaseMetaData &obj)
simInfo = obj.simInfo;
suggestedDefaultSILRestriction = obj.suggestedDefaultSILRestriction;
SelectAll();
avtDatabaseMetaData::SelectAll();
return *this;
}
......@@ -595,6 +715,15 @@ avtDatabaseMetaData::operator == (const avtDatabaseMetaData &obj) const
meshes_equal = (meshes1 == meshes2);
}
bool subsets_equal = (obj.subsets.size() == subsets.size());
for(size_t i = 0; (i < subsets.size()) && subsets_equal; ++i)
{
// Make references to avtSubsetsMetaData from AttributeGroup *.
const avtSubsetsMetaData &subsets1 = *((const avtSubsetsMetaData *)(subsets[i]));
const avtSubsetsMetaData &subsets2 = *((const avtSubsetsMetaData *)(obj.subsets[i]));
subsets_equal = (subsets1 == subsets2);
}
bool scalars_equal = (obj.scalars.size() == scalars.size());
for(size_t i = 0; (i < scalars.size()) && scalars_equal; ++i)
{
......@@ -706,6 +835,7 @@ avtDatabaseMetaData::operator == (const avtDatabaseMetaData &obj) const
(databaseComment == obj.databaseComment) &&
(exprList == obj.exprList) &&
meshes_equal &&
subsets_equal &&
scalars_equal &&
vectors_equal &&
tensors_equal &&
......@@ -882,6 +1012,7 @@ avtDatabaseMetaData::SelectAll()
Select(ID_databaseComment, (void *)&databaseComment);
Select(ID_exprList, (void *)&exprList);
Select(ID_meshes, (void *)&meshes);
Select(ID_subsets, (void *)&subsets);
Select(ID_scalars, (void *)&scalars);
Select(ID_vectors, (void *)&vectors);
Select(ID_tensors, (void *)&tensors);
......@@ -921,6 +1052,9 @@ avtDatabaseMetaData::CreateSubAttributeGroup(int attr_id)
case ID_meshes:
retval = new avtMeshMetaData;
break;
case ID_subsets:
retval = new avtSubsetsMetaData;
break;
case ID_scalars:
retval = new avtScalarMetaData;
break;
......@@ -1370,6 +1504,18 @@ avtDatabaseMetaData::GetMeshes()
return meshes;
}
const AttributeGroupVector &
avtDatabaseMetaData::GetSubsets() const
{
return subsets;
}
AttributeGroupVector &
avtDatabaseMetaData::GetSubsets()
{
return subsets;
}
const AttributeGroupVector &
avtDatabaseMetaData::GetScalars() const
{
......@@ -1590,6 +1736,12 @@ avtDatabaseMetaData::SelectMeshes()
Select(ID_meshes, (void *)&meshes);
}
void
avtDatabaseMetaData::SelectSubsets()
{
Select(ID_subsets, (void *)&subsets);
}
void
avtDatabaseMetaData::SelectScalars()
{
......@@ -1817,6 +1969,157 @@ avtDatabaseMetaData::GetMeshes(int i) const
return *((avtMeshMetaData *)meshes[i]);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::AddSubsets
//
// Purpose:
// Contains database metadata attributes
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void
avtDatabaseMetaData::AddSubsets(const avtSubsetsMetaData &obj)
{
avtSubsetsMetaData *newavtSubsetsMetaData = new avtSubsetsMetaData(obj);
subsets.push_back(newavtSubsetsMetaData);
// Indicate that things have changed by selecting it.
Select(ID_subsets, (void *)&subsets);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::ClearSubsets
//
// Purpose:
// Contains database metadata attributes
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void
avtDatabaseMetaData::ClearSubsets()
{
AttributeGroupVector::iterator pos;
for(pos = subsets.begin(); pos != subsets.end(); ++pos)
delete *pos;
subsets.clear();
// Indicate that things have changed by selecting the list.
Select(ID_subsets, (void *)&subsets);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::RemoveSubsets
//
// Purpose:
// Contains database metadata attributes
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
void
avtDatabaseMetaData::RemoveSubsets(int index)
{
AttributeGroupVector::iterator pos = subsets.begin();
// Iterate through the vector "index" times.
for(int i = 0; i < index; ++i)
if(pos != subsets.end()) ++pos;
// If pos is still a valid iterator, remove that element.
if(pos != subsets.end())
{
delete *pos;
subsets.erase(pos);
}
// Indicate that things have changed by selecting the list.
Select(ID_subsets, (void *)&subsets);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::GetNumSubsets
//
// Purpose:
// Contains database metadata attributes
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
int
avtDatabaseMetaData::GetNumSubsets() const
{
return subsets.size();
}
// ****************************************************************************
// Method: avtDatabaseMetaData::GetSubsets
//
// Purpose:
// Contains database metadata attributes
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
avtSubsetsMetaData &
avtDatabaseMetaData::GetSubsets(int i)
{
return *((avtSubsetsMetaData *)subsets[i]);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::GetSubsets
//
// Purpose:
// Contains database metadata attributes
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
const avtSubsetsMetaData &
avtDatabaseMetaData::GetSubsets(int i) const
{
return *((avtSubsetsMetaData *)subsets[i]);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::AddScalars
//
......@@ -6055,6 +6358,16 @@ avtDatabaseMetaData::Print(ostream &out, int indent) const
GetMeshes(i).Print(out, indent+1);
out << endl;
}
if (GetNumSubsets() > 0)
{
Indent(out, indent);
out << "Subsets: " << endl;
}
for (i = 0; i < GetNumSubsets(); i++)
{
GetSubsets(i).Print(out, indent+1);
out << endl;
}
if(GetNumScalars() > 0)
{
......@@ -6532,3 +6845,20 @@ avtDatabaseMetaData::AddDefaultSILRestrictionDescription(const std::string& setN
Select(ID_suggestedDefaultSILRestriction, (void *)&suggestedDefaultSILRestriction);
}
// ****************************************************************************
// Method: avtDatabaseMetaData::Add
//
// Arguments:
// smd A subsets meta data object.
//
// Programmer: Mark C. Miller
// Creation: August 18, 2009
//
// ****************************************************************************
void
avtDatabaseMetaData::Add(avtSubsetsMetaData *smd)
{
subsets.push_back(smd);
}
......@@ -3012,6 +3012,16 @@ avtDatabaseMetaData::Print(ostream &out, int indent) const
GetMeshes(i).Print(out, indent+1);
out << endl;
}
if (GetNumSubsets() > 0)
{
Indent(out, indent);
out << "Subsets: " << endl;
}
for (i = 0; i < GetNumSubsets(); i++)
{
GetSubsets(i).Print(out, indent+1);
out << endl;
}
if(GetNumScalars() > 0)
{
......@@ -3528,3 +3538,23 @@ avtDatabaseMetaData::AddDefaultSILRestrictionDescription(const std::string& setN
Select(ID_suggestedDefaultSILRestriction, (void *)&suggestedDefaultSILRestriction);
}
Function: Add10
Declaration: void Add(avtSubsetsMetaData *);
Definition:
// ****************************************************************************
// Method: avtDatabaseMetaData::Add
//
// Arguments:
// smd A subsets meta data object.
//
// Programmer: Mark C. Miller
// Creation: August 18, 2009
//
// ****************************************************************************
void
avtDatabaseMetaData::Add(avtSubsetsMetaData *smd)
{
subsets.push_back(smd);
}
......@@ -41,7 +41,9 @@
#include <dbatts_exports.h>
#include <string>
#include <AttributeSubject.h>
class avtMeshMetaData;
class avtSubsetsMetaData;
class avtScalarMetaData;
class avtVectorMetaData;
class avtTensorMetaData;
......@@ -65,6 +67,7 @@ class avtDefaultPlotMetaData;
#include <avtMeshMetaData.h>
#include <avtScalarMetaData.h>
#include <avtSpeciesMetaData.h>
#include <avtSubsetsMetaData.h>
#include <avtSymmetricTensorMetaData.h>
#include <avtTensorMetaData.h>
#include <avtVectorMetaData.h>
......@@ -87,13 +90,21 @@ class avtDefaultPlotMetaData;
class DBATTS_API avtDatabaseMetaData : public AttributeSubject
{
public:
// These constructors are for objects of this class
avtDatabaseMetaData();
avtDatabaseMetaData(const avtDatabaseMetaData &obj);
protected:
// These constructors are for objects derived from this class
avtDatabaseMetaData(private_tmfs_t tmfs);
avtDatabaseMetaData(const avtDatabaseMetaData &obj, private_tmfs_t tmfs);
public:
virtual ~avtDatabaseMetaData();
virtual avtDatabaseMetaData& operator = (const avtDatabaseMetaData &obj);
virtual bool operator == (const avtDatabaseMetaData &obj) const;
virtual bool operator != (const avtDatabaseMetaData &obj) const;
void Init();
void Copy(const avtDatabaseMetaData &obj);
virtual const std::string TypeName() const;
virtual bool CopyAttributes(const AttributeGroup *);
......@@ -113,6 +124,7 @@ public:
void SelectDatabaseComment();
void SelectExprList();
void SelectMeshes();
void SelectSubsets();
void SelectScalars();
void SelectVectors();
void SelectTensors();
......@@ -182,6 +194,8 @@ public:
ExpressionList &GetExprList();
const AttributeGroupVector &GetMeshes() const;
AttributeGroupVector &GetMeshes();
const AttributeGroupVector &GetSubsets() const;
AttributeGroupVector &GetSubsets();
const AttributeGroupVector &GetScalars() const;
AttributeGroupVector &GetScalars();
const AttributeGroupVector &GetVectors() const;
......@@ -217,6 +231,13 @@ public:
avtMeshMetaData &GetMeshes(int i);
const avtMeshMetaData &GetMeshes(int i) const;
void AddSubsets(const avtSubsetsMetaData &);
void ClearSubsets();
void RemoveSubsets(int i);
int GetNumSubsets() const;
avtSubsetsMetaData &GetSubsets(int i);
const avtSubsetsMetaData &GetSubsets(int i) const;
void AddScalars(const avtScalarMetaData &);
void ClearScalars();
void RemoveScalars(int i);
......@@ -369,6 +390,7 @@ public:
static void SetCycleFromFilenameRegex(const char *re);
static std::string GetCycleFromFilenameRegex();
void AddDefaultSILRestrictionDescription(const std::string&);
void Add(avtSubsetsMetaData *);
// IDs that can be used to identify fields in case statements
enum {
......@@ -392,6 +414,7 @@ public:
ID_databaseComment,
ID_exprList,
ID_meshes,
ID_subsets,
ID_scalars,
ID_vectors,
ID_tensors,
......@@ -404,7 +427,8 @@ public: