Updates will be applied April 15th at 12pm EDT (UTC-0400). GitLab could be a little slow between 12 - 12:45pm EDT.

Commit c2febb1b authored by hrchilds's avatar hrchilds

Update from October 8, 2003

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@94 18c085ea-50e0-402c-830e-de6fd14e8384
parent b9cb2817
......@@ -781,14 +781,30 @@ avtSIL::MakeSILAttributes(void) const
// Hank Childs, Thu Nov 14 16:46:58 PST 2002
// Print out the SIL matrices as well.
//
// Mark C. Miller, 23Sep03, Added additional perXXXInfo options
//
// ****************************************************************************
void
avtSIL::Print(ostream &out) const
{
std::vector< std::string > dummyInfo;
Print(out, dummyInfo, dummyInfo, dummyInfo);
}
void
avtSIL::Print(ostream &out,
std::vector< std::string > perSetInfo,
std::vector< std::string > perCollInfo,
std::vector< std::string > perMatInfo) const
{
int i;
bool useInfo;
int nSets = sets.size();
if (perSetInfo.size() == nSets)
useInfo = true;
else
useInfo = false;
for (i = 0 ; i < nSets ; i++)
{
if (isWhole[i])
......@@ -799,23 +815,31 @@ avtSIL::Print(ostream &out) const
{
out << "Subset ";
}
out << i << endl;
out << i << " " << (useInfo?perSetInfo[i]:"") << endl;
avtSILSet_p s = sets[i];
s->Print(out);
}
int nColls = collections.size();
if (perCollInfo.size() == nColls)
useInfo = true;
else
useInfo = false;
for (i = 0 ; i < nColls ; i++)
{
out << "Collection " << i << endl;
out << "Collection " << i << " " << (useInfo?perCollInfo[i]:"") << endl;
avtSILCollection_p c = collections[i];
c->Print(out);
}
int nMats = matrices.size();
if (perMatInfo.size() == nMats)
useInfo = true;
else
useInfo = false;
for (i = 0 ; i < nMats ; i++)
{
out << "Matrix " << i << endl;
out << "Matrix " << i << " " << (useInfo?perMatInfo[i]:"") << endl;
avtSILMatrix_p m = matrices[i];
m->Print(out);
}
......
......@@ -86,6 +86,10 @@ class DBATTS_API avtSIL
int GetCollectionIndex(std::string) const;
void Print(ostream &) const;
void Print(ostream &,
std::vector< std::string > perSetInfo,
std::vector< std::string > perCollInfo,
std::vector< std::string > perMatrixInfo) const;
SILAttributes *MakeSILAttributes(void) const;
......
......@@ -1041,12 +1041,22 @@ avtSILRestriction::MakeCompactAttributes(void) const
// Dramatically reduced the sets being printed out, because of new matrix
// format.
//
// Mark C. Miller, 23Sep03, added per-set info for state of each set's
// selection
//
// ****************************************************************************
void
avtSILRestriction::Print(ostream &out) const
{
avtSIL::Print(out);
// make labels for state of each set
static const char *stateNames[3] = {"NoneUsed", "SomeUsed", "AllUsed"};
std::vector< std::string > perSetInfo, dummyInfo;
for (int i = 0 ; i < useSet.size() ; i++)
perSetInfo.push_back(stateNames[STATE_INDEX(useSet[i])]);
avtSIL::Print(out, perSetInfo, dummyInfo, dummyInfo);
out << "Top Set = " << topSet << endl;
}
......@@ -1193,9 +1203,9 @@ avtSILRestriction::GetLeafSets(int ind, vector<int> &leaves)
//
// Returns: Whether or not the sets were compatible.
//
// Note: This code assumes the SIL restrictions are compatible if they
// have the same number of leaf sets under their respective top
// sets and that the names of all leaf sets are the same.
// Note: This code assumes the SIL restrictions are compatible if amoung
// the minimum number of leaf sets under their respective top
// sets, the names of all leaf sets are the same.
//
// Programmer: Brad Whitlock
// Creation: Thu Mar 7 14:12:09 PST 2002
......@@ -1205,6 +1215,9 @@ avtSILRestriction::GetLeafSets(int ind, vector<int> &leaves)
// Hank Childs, Thu Nov 14 10:30:56 PST 2002
// Remove access to 'sets' data member to enable SIL matrices.
//
// Mark C. Miller - 24Sep03, Modified to support differing number of leaf
// Sets
//
// ****************************************************************************
bool
......@@ -1223,15 +1236,16 @@ avtSILRestriction::SetFromCompatibleRestriction(avtSILRestriction_p silr)
//
// If the sizes are not equal then return.
//
if(leaves.size() != otherLeaves.size())
return false;
int minNumLeaves = leaves.size() < otherLeaves.size() ?
leaves.size() :
otherLeaves.size();
//
// Compare the names of each set. If at the end, they are all the
// same then we have a compatible SIL restriction.
//
bool compatible = true;
for(i = 0; i < leaves.size(); ++i)
for(i = 0; i < minNumLeaves; ++i)
{
avtSILSet_p set1 = GetSILSet(i);
avtSILSet_p set2 = silr->GetSILSet(i);
......@@ -1249,7 +1263,7 @@ avtSILRestriction::SetFromCompatibleRestriction(avtSILRestriction_p silr)
if(compatible)
{
SuspendCorrectnessChecking();
for(i = 0; i < leaves.size(); ++i)
for(i = 0; i < minNumLeaves; ++i)
{
useSet[leaves[i]] = silr->useSet[otherLeaves[i]];
}
......
......@@ -141,7 +141,7 @@ avtSILSet::AddMatrixColumn(int mat, int column, int coll)
void
avtSILSet::Print(ostream &out) const
{
out << "\tSet name = " << name.c_str() << endl;
out << "\tSet name = " << name.c_str() << ", identifier = " << id << endl;
std::vector<int>::const_iterator it;
if (mapsIn.size() > 0)
{
......
......@@ -19,11 +19,16 @@
#include <InvalidVariableException.h>
#include <InvalidFilesException.h>
#include <ImproperUseException.h>
#include <PickAttributes.h>
#include <PickVarInfo.h>
#include <TimingsManager.h>
#include <Utility.h>
// size of MD/SIL caches
int avtDatabase::mdCacheSize = 20;
int avtDatabase::silCacheSize = 20;
bool avtDatabase::onlyServeUpMetaData = false;
......@@ -55,9 +60,9 @@ bool avtDatabase::onlyServeUpMetaData = false;
avtDatabase::avtDatabase()
{
metadata = NULL;
sil = NULL;
gotIOInfo = false;
gotIOInfo = false;
invariantMetaData = NULL;
invariantSIL = NULL;
}
......@@ -78,26 +83,27 @@ avtDatabase::avtDatabase()
// Hank Childs, Thu Mar 1 13:42:43 PST 2001
// Split class so functionality went in derived type, avtGenericDatabase.
//
// Mark C. Miller, 30Sep03 Added support to time-varying SIL/MD
// ****************************************************************************
avtDatabase::~avtDatabase()
{
if (metadata != NULL)
{
delete metadata;
metadata = NULL;
}
std::vector<avtDataObjectSource *>::iterator it;
for (it = sourcelist.begin() ; it != sourcelist.end() ; it++)
{
delete *it;
}
if (sil != NULL)
if (invariantMetaData != NULL)
{
delete invariantMetaData;
invariantMetaData = NULL;
}
if (invariantSIL != NULL)
{
delete sil;
sil = NULL;
delete invariantSIL;
invariantSIL = NULL;
}
}
......@@ -137,7 +143,7 @@ avtDatabase::GetOutput(const char *var, int ts)
//
// Figure out how many domains there are for the current variable.
//
int nDomains = GetMetaData()->GetNDomains(var);
int nDomains = GetMetaData(ts)->GetNDomains(var);
if (nDomains <= 0)
{
......@@ -150,7 +156,7 @@ avtDatabase::GetOutput(const char *var, int ts)
avtDataObjectSource *src = CreateSource(var, ts);
avtDataObject_p dob = src->GetOutput();
PopulateDataObjectInformation(dob, var);
PopulateDataObjectInformation(dob, var, ts);
sourcelist.push_back(src);
......@@ -228,11 +234,14 @@ avtDatabase::GetOutput(const char *var, int ts)
// Hank Childs, Tue Sep 23 23:03:07 PDT 2003
// Add support for tensors.
//
// Mark C. Miller, 30Sep03, added timeStep argument
//
// ****************************************************************************
void
avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
const char *var,
int ts,
avtDataSpecification *spec)
{
int timerHandle = visitTimer->StartTimer();
......@@ -240,8 +249,8 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
avtDataAttributes &atts = dob->GetInfo().GetAttributes();
avtDataValidity &validity = dob->GetInfo().GetValidity();
string mesh = GetMetaData()->MeshForVar(var);
const avtMeshMetaData *mmd = GetMetaData()->GetMesh(mesh);
string mesh = GetMetaData(ts)->MeshForVar(var);
const avtMeshMetaData *mmd = GetMetaData(ts)->GetMesh(mesh);
if (mmd != NULL)
{
atts.SetCellOrigin(mmd->cellOrigin);
......@@ -272,7 +281,7 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
}
}
const avtScalarMetaData *smd = GetMetaData()->GetScalar(var);
const avtScalarMetaData *smd = GetMetaData(ts)->GetScalar(var);
if (smd != NULL)
{
atts.SetVariableDimension(1);
......@@ -294,7 +303,7 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
}
}
const avtVectorMetaData *vmd = GetMetaData()->GetVector(var);
const avtVectorMetaData *vmd = GetMetaData(ts)->GetVector(var);
if (vmd != NULL)
{
atts.SetVariableDimension(vmd->varDim);
......@@ -321,7 +330,7 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
}
}
const avtTensorMetaData *tmd = GetMetaData()->GetTensor(var);
const avtTensorMetaData *tmd = GetMetaData(ts)->GetTensor(var);
if (tmd != NULL)
{
atts.SetVariableDimension(9);
......@@ -329,7 +338,7 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
atts.SetCentering(tmd->centering);
}
const avtSymmetricTensorMetaData *stmd = GetMetaData()->GetSymmTensor(var);
const avtSymmetricTensorMetaData *stmd = GetMetaData(ts)->GetSymmTensor(var);
if (stmd != NULL)
{
atts.SetVariableDimension(9);
......@@ -337,7 +346,7 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
atts.SetCentering(stmd->centering);
}
const avtSpeciesMetaData *spmd = GetMetaData()->GetSpecies(var);
const avtSpeciesMetaData *spmd = GetMetaData(ts)->GetSpecies(var);
if (spmd != NULL)
{
atts.SetVariableDimension(1);
......@@ -349,7 +358,7 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
atts.GetEffectiveDataExtents()->Set(extents);
}
const avtCurveMetaData *cmd = GetMetaData()->GetCurve(var);
const avtCurveMetaData *cmd = GetMetaData(ts)->GetCurve(var);
if (cmd != NULL)
{
atts.SetTopologicalDimension(1);
......@@ -374,7 +383,89 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
// ****************************************************************************
// Method: avtDatabase::GetMetaData
// Method: avtDatabase::MetaDataIsInvariant
//
// Purpose: Return whether or not database meta data is invariant.
//
// We use a bool* to implement this so that we can know whether or not the
// bool has been set and once it is set, never call down to the plugins to
// re-acquire this knowledge
//
// Programmer: Mark C. Miller, 30Sep03
// ****************************************************************************
bool
avtDatabase::MetaDataIsInvariant(void)
{
if (invariantMetaData == NULL)
{
invariantMetaData = new bool;
*invariantMetaData = HasInvariantMetaData();
}
return *invariantMetaData;
}
// ****************************************************************************
// Method: avtDatabase::SILIsInvariant
//
// Purpose: Return whether or not SIL is invariant.
//
// We use a bool* to implement this so that we can know whether or not the
// bool has been set and once it is set, never call down to the plugins to
// re-acquire this knowledge
//
// Programmer: Mark C. Miller, 30Sep03
// ****************************************************************************
bool
avtDatabase::SILIsInvariant(void)
{
if (invariantSIL == NULL)
{
invariantSIL = new bool;
*invariantSIL = HasInvariantSIL();
}
return *invariantSIL;
}
// ****************************************************************************
// Method: avtDatabase::GetMostRecentTimestepQueried
//
// Purpose:
// Provide convenience method for caller's that don't have a reasonable
// 'current' time to pass to GetMetaData and GetSIL which now both
// require the caller to specify the time. This function simply returns
// the time of the most recent request for either SIL or MetaData. The
// idea is that a reasonable time to use when one is not available is
// the time of the most recent query for metadata or SIL.
//
// ****************************************************************************
int
avtDatabase::GetMostRecentTimestep(void) const
{
if (sil.size() == 0)
{
if (metadata.size() == 0)
return 0;
else
return metadata.front().ts;
}
else
{
if (metadata.size() == 0)
return sil.front().ts;
else
{
if (sil.front().ts > metadata.front().ts)
return sil.front().ts;
else
return metadata.front().ts;
}
}
}
// ****************************************************************************
// Method: avtDatabase::GetNewMetaData
//
// Purpose:
// Provide mechanism for clients to get information about the file
......@@ -396,27 +487,98 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
// Hank Childs, Thu Aug 14 08:45:39 PDT 2003
// Set the database's name with the meta-data.
//
// Mark C. Miller, 22Sep03, changed name to Get'New'MetaData. Put result
// in MRU cache
//
// ****************************************************************************
void
avtDatabase::GetNewMetaData(int timeState)
{
// sanity check: since SIL info is currently embedded in MetaData,
// we cannot have MD invariant but SIL NOT invariant
if (MetaDataIsInvariant() && !SILIsInvariant())
{
EXCEPTION1(ImproperUseException, "invalid MD/SIL invariants condition");
}
// acquire new metadata for the given timestep
avtDatabaseMetaData *md = new avtDatabaseMetaData;
const char *filename = GetFilename(timeState);
string fname;
if (filename == NULL)
fname = "";
else
fname = filename;
SetDatabaseMetaData(md, timeState);
md->SetDatabaseName(fname);
md->SetMustRepopulateOnStateChange(!MetaDataIsInvariant() ||
!SILIsInvariant());
PopulateIOInformation(ioInfo);
gotIOInfo = true;
// put the metadata at the front of the MRU cache
CachedMDEntry tmp = {md, timeState};
metadata.push_front(tmp);
}
// ****************************************************************************
// Method: avtDatabase::GetMetaData
//
// Purpose:
// Get and manage metadata from multiple timesteps in an MRU cache
//
// Arguments:
// timeState : The time state that we're interested in.
//
// Programmer: Mark C. Miller
// Creation: September 30, 2003
//
// ****************************************************************************
avtDatabaseMetaData *
avtDatabase::GetMetaData(int timeState)
{
if (metadata == NULL)
if (MetaDataIsInvariant())
{
metadata = new avtDatabaseMetaData;
const char *filename = GetFilename(timeState);
string fname;
if (filename == NULL)
fname = "";
else
fname = filename;
metadata->SetDatabaseName(fname);
SetDatabaseMetaData(metadata, timeState);
PopulateIOInformation(ioInfo);
gotIOInfo = true;
// since its invariant, get it at time 0
if (metadata.size() == 0)
GetNewMetaData(0);
}
else
{
// see if we've already cached metadata for this timestep
std::list<CachedMDEntry>::iterator i;
for (i = metadata.begin(); i != metadata.end(); i++)
{
if (timeState == i->ts)
{
// move the found entry to front of list
CachedMDEntry tmp = *i;
metadata.erase(i);
metadata.push_front(tmp);
break;
}
}
// if we didn't find it in the cache, remove the oldest (last) entry
// and read new metadata
if (i == metadata.end())
{
if (metadata.size() >= mdCacheSize)
{
CachedMDEntry tmp = metadata.back();
metadata.pop_back();
delete tmp.md;
}
GetNewMetaData(timeState);
}
}
return metadata;
return metadata.front().md;
}
......@@ -438,21 +600,82 @@ avtDatabase::GetMetaData(int timeState)
// Brad Whitlock, Wed May 14 09:10:23 PDT 2003
// Added timeState argument.
//
// Mark C. Miller, 22Sep03, changed name to Get'New'SIL. Put result
// in MRU cache
//
// ****************************************************************************
void
avtDatabase::GetNewSIL(int timeState)
{
// build a new sil for the given timestep
avtSIL *newsil = new avtSIL;
PopulateSIL(newsil, timeState);
// put result in front of MRU cache
CachedSILEntry tmp = {newsil, timeState};
sil.push_front(tmp);
}
// ****************************************************************************
// Method: avtDatabase::GetSIL
//
// Purpose:
// Get and manage SILs from multiple timesteps in an MRU cache
//
// Arguments:
// timeState : The time state that we're interested in.
//
// Programmer: Mark C. Miller
// Creation: September 30, 2003
//
// ****************************************************************************
avtSIL *
avtDatabase::GetSIL(int timeState)
{
if (sil == NULL)
if (SILIsInvariant())
{
// since its invariant, get it at time 0
if (sil.size() == 0)
GetNewSIL(0);
}
else
{
sil = new avtSIL;
PopulateSIL(sil, timeState);
// see if we've already cached sil for this timestep
std::list<CachedSILEntry>::iterator i;
for (i = sil.begin(); i != sil.end(); i++)
{
if (timeState == i->ts)
{
// move the found entry to front of list
CachedSILEntry tmp = *i;
sil.erase(i);
sil.push_front(tmp);
break;
}
}
// if we didn't find it in the cache, remove the oldest (last) entry
// and read new sil
if (i == sil.end())
{
if (sil.size() >= silCacheSize)
{
CachedSILEntry tmp = sil.back();
sil.pop_back();
delete tmp.sil;
}
GetNewSIL(timeState);
}
}