Commit 4ded10b9 authored by hrchilds's avatar hrchilds

Update from September 29, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@332 18c085ea-50e0-402c-830e-de6fd14e8384
parent d93a5ae8
......@@ -3427,21 +3427,25 @@ avtDefaultPlotMetaData::Print(ostream &out, int indent) const
// Brad Whitlock, Thu Aug 5 13:51:24 PST 2004
// Added mustAlphabetizeVariables.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData()
: AttributeSubject("sssbddibss*i*i*i*d*a*a*a*a*a*a*a*a*a*aba*babb")
: AttributeSubject("sssbddibss*i*i*i*d*a*a*a*a*a*a*a*a*a*aba*babbb")
{
hasTemporalExtents = false;
minTemporalExtents = 0.;
maxTemporalExtents = 0.;
numStates = 0;
isVirtualDatabase = false;
mustRepopulateOnStateChange = false;
mustAlphabetizeVariables = true;
isSimulation = false;
simInfo = new avtSimulationInformation();
useCatchAllMesh = false;
hasTemporalExtents = false;
minTemporalExtents = 0.;
maxTemporalExtents = 0.;
numStates = 0;
isVirtualDatabase = false;
mustRepopulateOnStateChange = false;
mustAlphabetizeVariables = true;
isSimulation = false;
simInfo = new avtSimulationInformation();
useCatchAllMesh = false;
formatCanDoDomainDecomposition = false;
}
......@@ -3498,10 +3502,13 @@ avtDatabaseMetaData::avtDatabaseMetaData()
// Brad Whitlock, Thu Aug 5 13:52:20 PST 2004
// Added mustAlphabetizeVariables.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// ****************************************************************************
avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &rhs)
: AttributeSubject("sssbddibss*i*i*i*d*a*a*a*a*a*a*a*a*a*aba*babb")
: AttributeSubject("sssbddibss*i*i*i*d*a*a*a*a*a*a*a*a*a*aba*babbb")
{
databaseName = rhs.databaseName;
fileFormat = rhs.fileFormat;
......@@ -3523,6 +3530,7 @@ avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &rhs)
exprList = rhs.exprList;
isSimulation = rhs.isSimulation;
simInfo = new avtSimulationInformation(*rhs.simInfo);
formatCanDoDomainDecomposition = rhs.formatCanDoDomainDecomposition;
int i;
for (i=0; i<rhs.meshes.size(); i++)
......@@ -3602,6 +3610,9 @@ avtDatabaseMetaData::avtDatabaseMetaData(const avtDatabaseMetaData &rhs)
// Brad Whitlock, Thu Aug 5 13:52:20 PST 2004
// Added mustAlphabetizeVariables.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// ****************************************************************************
const avtDatabaseMetaData &
......@@ -3627,6 +3638,7 @@ avtDatabaseMetaData::operator=(const avtDatabaseMetaData &rhs)
exprList = rhs.exprList;
isSimulation = rhs.isSimulation;
*simInfo = *rhs.simInfo;
formatCanDoDomainDecomposition = rhs.formatCanDoDomainDecomposition;
int i;
for (i=0; i<meshes.size(); i++)
......@@ -4099,6 +4111,50 @@ avtDatabaseMetaData::SetTime(int ts, double t)
}
// ****************************************************************************
// Method: avtDatabaseMetaData::SetFormatCanDoDomainDecomposition
//
// Purpose:
// Sets flag indicating that format can do domain decomposition. This
// means all meshes should have numBlocks set to 1. Upon each attempt to
// get data from the database, the format can decide how to decompose
// the data across processors. This also means that when VisIt
// "load-balances" blocks (i.e. domains) across processors, it will do so
// by assigning the one and only block to each and every processor. It
// is up to the plugin to decide which portion of the whole it will
// actually return in a request to GetMesh(), GetVar(), ...
//
// Programmer: Mark C. Miller
// Creation: September 20, 2004
// ****************************************************************************
void
avtDatabaseMetaData::SetFormatCanDoDomainDecomposition(bool can)
{
if (can)
{
// see if there are any meshes with other than a single block
bool someMeshesHaveOtherThanOneBlock = false;
for (int i = 0; i < meshes.size(); i++)
{
if (meshes[i]->numBlocks != 1)
{
someMeshesHaveOtherThanOneBlock = true;
break;
}
}
if (someMeshesHaveOtherThanOneBlock)
{
EXCEPTION1(ImproperUseException, "Format cannot do domain "
"decomposition with meshes having other than a single block");
}
}
formatCanDoDomainDecomposition = can;
}
// ****************************************************************************
// Method: avtDatabaseMetaData::Add
//
......@@ -4108,11 +4164,25 @@ avtDatabaseMetaData::SetTime(int ts, double t)
// Programmer: Hank Childs
// Creation: August 28, 2000
//
// Modifications:
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added code to make sure num blocks is 1 if
// formatCanDoDomainDecomposition is true
//
//
// ****************************************************************************
void
avtDatabaseMetaData::Add(avtMeshMetaData *mmd)
{
if (formatCanDoDomainDecomposition && mmd->numBlocks != 1)
{
EXCEPTION1(ImproperUseException, "Cannot deal with meshes having "
"other than a single block in formats that do their own domain "
"decomposition.");
}
meshes.push_back(mmd);
}
......@@ -4946,6 +5016,9 @@ avtDatabaseMetaData::GetSpeciesOnMesh(std::string mesh) const
// Jeremy Meredith, Thu Aug 12 13:23:25 PDT 2004
// Added simulation fields.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// ****************************************************************************
void
......@@ -4973,6 +5046,10 @@ avtDatabaseMetaData::Print(ostream &out, int indent) const
Indent(out, indent);
out << "useCatchAllMesh: " << useCatchAllMesh << endl;
Indent(out, indent);
out << "Format " << (formatCanDoDomainDecomposition ? " can " : " cannot ") <<
"do its own domain decomposition" << endl;
Indent(out, indent);
if (hasTemporalExtents)
{
......@@ -5221,6 +5298,9 @@ avtDatabaseMetaData::Print(ostream &out, int indent) const
// Brad Whitlock, Thu Aug 5 13:53:53 PST 2004
// Added mustAlphabetizeVariables.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition
//
// *******************************************************************
void
......@@ -5259,6 +5339,7 @@ avtDatabaseMetaData::SelectAll()
Select(27, (void*)simInfo);
Select(28, (void*)&useCatchAllMesh);
Select(29, (void*)&mustAlphabetizeVariables);
Select(30, (void*)&formatCanDoDomainDecomposition);
}
// *******************************************************************
......
......@@ -385,6 +385,8 @@ public:
// Jeremy Meredith, Thu Aug 12 11:39:38 PDT 2004
// changed simulation information to be a separate class.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added formatCanDoDomainDecomposition and Set/Get methods
//----------------------------------------------------------------------------
class DBATTS_API avtDatabaseMetaData : public AttributeSubject
{
......@@ -395,6 +397,7 @@ class DBATTS_API avtDatabaseMetaData : public AttributeSubject
bool isVirtualDatabase;
bool mustRepopulateOnStateChange;
bool mustAlphabetizeVariables;
bool formatCanDoDomainDecomposition;
bool useCatchAllMesh;
......@@ -450,6 +453,10 @@ public:
void SetUseCatchAllMesh(bool useIt)
{ useCatchAllMesh = useIt; };
bool GetFormatCanDoDomainDecomposition(void) const
{ return formatCanDoDomainDecomposition; };
void SetFormatCanDoDomainDecomposition(bool can);
void SetIsVirtualDatabase(bool val) { isVirtualDatabase = val; };
bool GetIsVirtualDatabase() const { return isVirtualDatabase; };
......
......@@ -142,6 +142,8 @@ avtDatabase::~avtDatabase()
// Hank Childs, Fri Aug 17 16:03:44 PDT 2001
// Removed dependencies on avtDataset.
//
// Mark C. Miller, Tue Sep 28 19:32:50 PDT 2004
// Added dummy argument for c all to PopulateDataObjectInformation
// ****************************************************************************
avtDataObject_p
......@@ -163,7 +165,8 @@ avtDatabase::GetOutput(const char *var, int ts)
avtDataObjectSource *src = CreateSource(var, ts);
avtDataObject_p dob = src->GetOutput();
PopulateDataObjectInformation(dob, var, ts);
vector<bool> dummy;
PopulateDataObjectInformation(dob, var, ts, dummy);
sourcelist.push_back(src);
......@@ -264,12 +267,16 @@ avtDatabase::GetOutput(const char *var, int ts)
// Hank Childs, Fri Aug 20 15:42:34 PDT 2004
// Correct cut-and-paste bug for checking units for symmetric tensors.
//
// Mark C. Miller, Tue Sep 28 19:32:50 PDT 2004
// Added argument for data selections that have been applied as well
// as code to populate data attributes
// ****************************************************************************
void
avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
const char *var,
int ts,
const vector<bool> &selectionsApplied,
avtDataSpecification *spec)
{
int i;
......@@ -296,6 +303,8 @@ avtDatabase::PopulateDataObjectInformation(avtDataObject_p &dob,
atts.SetContainsGhostZones(mmd->containsGhostZones);
atts.SetContainsOriginalCells(mmd->containsOriginalCells);
atts.SetContainsOriginalNodes(mmd->containsOriginalNodes);
vector<bool> tmp = selectionsApplied;
atts.SetSelectionsApplied(tmp);
validity.SetDisjointElements(mmd->disjointElements);
//
......
......@@ -182,6 +182,9 @@ typedef struct {
// Added args to QueryZones and QueryNodes, to support ghost-element
// indication.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added argument for selections applied to PopulateDataObjectInformation
//
// ****************************************************************************
class DATABASE_API avtDatabase
......@@ -269,6 +272,7 @@ class DATABASE_API avtDatabase
void PopulateDataObjectInformation(avtDataObject_p&,
const char *,
int,
const vector<bool> &selsApplied,
avtDataSpecification* =NULL);
virtual bool QueryScalars(const std::string &, const int,
const int, const int,
......
......@@ -259,6 +259,9 @@ avtGenericDatabase::SetDatabaseMetaData(avtDatabaseMetaData *md, int timeState)
// Hank Childs, Thu Sep 23 09:28:58 PDT 2004
// Add support for getting global ids.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added vector of bools for data selections that plugins apply
//
// ****************************************************************************
avtDataTree_p
......@@ -287,12 +290,13 @@ avtGenericDatabase::GetOutput(avtDataSpecification_p spec,
bool shouldDoMatSelect = false;
bool hadError = false;
vector<bool> selectionsApplied;
TRY
{
//
// This is the primary routine that reads things in from disk.
//
ReadDataset(datasetCollection, domains, spec, src);
ReadDataset(datasetCollection, domains, spec, src, selectionsApplied);
//
// Now that we have read things in from disk, verify that the dataset
......@@ -481,7 +485,8 @@ avtGenericDatabase::GetOutput(avtDataSpecification_p spec,
avtDataObject_p dob = src->GetOutput();
if (nDomains == 0)
dob->GetInfo().GetValidity().SetHasEverOwnedAnyDomain(false);
PopulateDataObjectInformation(dob, spec->GetVariable(), timeStep, *spec);
PopulateDataObjectInformation(dob, spec->GetVariable(), timeStep,
selectionsApplied, *spec);
return rv;
}
......@@ -3179,12 +3184,16 @@ avtGenericDatabase::ActivateTimestep(int stateIndex)
// Hank Childs, Wed Aug 11 08:14:16 PDT 2004
// Do not simply remove the vtkGhostLevels array so we can pretend we don't
// have ghost zones.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added call to RegisterDataSelections with the plugins
//
// ****************************************************************************
void
avtGenericDatabase::ReadDataset(avtDatasetCollection &ds, vector<int> &domains,
avtDataSpecification_p &spec, avtSourceFromDatabase *src)
avtDataSpecification_p &spec, avtSourceFromDatabase *src,
vector<bool> &selectionsApplied)
{
int timerHandle = visitTimer->StartTimer();
int ts = spec->GetTimestep();
......@@ -3230,6 +3239,14 @@ avtGenericDatabase::ReadDataset(avtDatasetCollection &ds, vector<int> &domains,
//
Interface->RegisterVariableList(var, vars2nd);
//
// Some file formats are interested in knowing about data selections
//
vector<avtDataSelection_p> selList = spec->GetAllDataSelections();
for (int i = 0; i < selList.size(); i++)
selectionsApplied.push_back(false);
Interface->RegisterDataSelections(selList, &selectionsApplied);
//
// Some file formats may need to engage in global communication when
// changing time-steps. Provide that opportunity here
......
......@@ -201,6 +201,9 @@ class PickVarInfo;
// Added args to QueryZones and QueryNodes, to support ghost-element
// indication.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added vector of bools for data selections to ReadDataset
//
// ****************************************************************************
class DATABASE_API avtGenericDatabase : public avtDatasetDatabase
......@@ -300,7 +303,8 @@ class DATABASE_API avtGenericDatabase : public avtDatasetDatabase
void ReadDataset(avtDatasetCollection &,
std::vector<int> &, avtDataSpecification_p &,
avtSourceFromDatabase *);
avtSourceFromDatabase *,
std::vector<bool> &);
avtDomainBoundaries *GetDomainBoundaryInformation(
avtDatasetCollection &,
......
......@@ -14,6 +14,7 @@
#include <array_ref_ptr.h>
#include <avtDataSelection.h>
#include <avtTypes.h>
......@@ -50,6 +51,9 @@ class avtVariableCache;
// Mark C. Miller, Mon Feb 9 16:10:16 PST 2004
// Added method, ActivateTimestep
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added method, RegisterDataSelections
//
// ****************************************************************************
class DATABASE_API avtFileFormat
......@@ -85,6 +89,10 @@ class DATABASE_API avtFileFormat
virtual void RegisterVariableList(const char *,
const std::vector<CharStrRef> &) {;};
virtual void RegisterDataSelections(
const std::vector<avtDataSelection_p>&,
std::vector<bool> *wasApplied) {;};
protected:
avtVariableCache *cache;
avtDatabaseMetaData *metadata;
......
......@@ -75,6 +75,34 @@ avtFileFormatInterface::RegisterVariableList(const char *var,
}
// ****************************************************************************
// Method: avtFileFormatInterface::RegisterDataSelections
//
// Purpose:
// Registers data selections with each file format and a vector of bools
// in which format can indicate whether a given selection was indeed
// applied. This is typically used
// just prior to avtGenericDatabase' attempt to get data from a format
// to give the format an opportunity to handle the selection on read.
//
// Programmer: Mark C. Miller
// Creation: September 22, 2004
//
// ****************************************************************************
void
avtFileFormatInterface::RegisterDataSelections(
const vector<avtDataSelection_p> &selList,
vector<bool> *wasApplied)
{
int nFormats = GetNumberOfFileFormats();
for (int i = 0 ; i < nFormats ; i++)
{
avtFileFormat *ff = GetFormat(i);
ff->RegisterDataSelections(selList, wasApplied);
}
}
// ****************************************************************************
// Method: avtFileFormatInterface::GetType
//
......
......@@ -11,6 +11,7 @@
#include <void_ref_ptr.h>
#include <array_ref_ptr.h>
#include <avtDataSelection.h>
class vtkDataSet;
class vtkDataArray;
......@@ -157,6 +158,9 @@ class avtVariableCache;
// Mark C. Miller, Tue Mar 16 14:09:43 PST 2004
// Added time step argument to PopulateIOInformation. Made it pure virtual
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added method, RegisterDataSelections
//
// ****************************************************************************
class DATABASE_API avtFileFormatInterface
......@@ -193,6 +197,10 @@ class DATABASE_API avtFileFormatInterface
void TurnMaterialSelectionOff(void);
void TurnMaterialSelectionOn(const char *);
void RegisterDataSelections(
const std::vector<avtDataSelection_p>& selList,
std::vector<bool> *wasApplied);
protected:
virtual int GetNumberOfFileFormats(void) = 0;
virtual avtFileFormat *GetFormat(int) const = 0;
......
......@@ -251,6 +251,9 @@ avtDataAttributes::DestructSelf(void)
// Brad Whitlock, Wed Jul 21 15:25:11 PST 2004
// Added variable units.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added vector of bools for which data selections were applied
//
// ****************************************************************************
void
......@@ -425,6 +428,12 @@ avtDataAttributes::Print(ostream &out)
}
}
out << "Selections Applied: ";
for (int i = 0; i < selectionsApplied.size(); i++)
out << (selectionsApplied[i] ? "T " : "F ");
out << endl;
}
......@@ -490,6 +499,8 @@ avtDataAttributes::Print(ostream &out)
// Brad Whitlock, Tue Jul 20 14:02:32 PST 2004
// Copied variable units.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added selectionsApplied
// ****************************************************************************
void
......@@ -561,6 +572,7 @@ avtDataAttributes::Copy(const avtDataAttributes &di)
CopyTransform(di.transform);
canUseTransform = di.canUseTransform;
windowMode = di.windowMode;
selectionsApplied = di.selectionsApplied;
}
......@@ -629,6 +641,9 @@ avtDataAttributes::Copy(const avtDataAttributes &di)
// Kathleen Bonnell, Thu Jul 22 12:10:19 PDT 2004
// Test for equivalent treatAsASCII values.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added selectionsApplied
//
// ****************************************************************************
void
......@@ -723,6 +738,23 @@ avtDataAttributes::Merge(const avtDataAttributes &da,
EXCEPTION2(InvalidMergeException, windowMode, da.windowMode);
}
if (selectionsApplied.size() != da.selectionsApplied.size())
{
EXCEPTION2(InvalidMergeException, selectionsApplied.size(),
da.selectionsApplied.size());
}
else
{
for (int i = 0; i < selectionsApplied.size(); i++)
{
if (selectionsApplied[i] != da.selectionsApplied[i])
{
EXCEPTION2(InvalidMergeException, selectionsApplied[i],
da.selectionsApplied[i]);
}
}
}
if (GetContainsGhostZones() == AVT_MAYBE_GHOSTS)
{
if (da.GetContainsGhostZones() == AVT_HAS_GHOSTS)
......@@ -1547,6 +1579,9 @@ avtDataAttributes::SetTime(double d)
// Brad Whitlock, Tue Jul 20 14:13:37 PST 2004
// Added units.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added selectionsApplied
//
// ****************************************************************************
void
......@@ -1637,6 +1672,10 @@ avtDataAttributes::Write(avtDataObjectString &str,
str.Append((char *) zLabel.c_str(), zLabel.size(),
avtDataObjectString::DATA_OBJECT_STRING_SHOULD_MAKE_COPY);
wrtr->WriteInt(str, selectionsApplied.size());
for (i = 0; i < selectionsApplied.size(); i++)
wrtr->WriteInt(str, selectionsApplied[i] ? 1 : 0);
WriteLabels(str, wrtr);
WriteInvTransform(str, wrtr);
WriteTransform(str, wrtr);
......@@ -1703,6 +1742,9 @@ avtDataAttributes::Write(avtDataObjectString &str,
// Brad Whitlock, Tue Jul 20 14:03:19 PST 2004
// Added units.
//
// Mark C. Miller, Tue Sep 28 19:57:42 PDT 2004
// Added selectionsApplied
//
// ****************************************************************************
int
......@@ -1906,6 +1948,17 @@ avtDataAttributes::Read(char *input)
size += labelSize;
input += labelSize;
int selectionsSize;
memcpy(&selectionsSize, input, sizeof(int));
input += sizeof(int); size += sizeof(int);
for (i = 0; i < selectionsSize; i++)
{
int tmp;
memcpy(&tmp, input, sizeof(int));
input += sizeof(int); size += sizeof(int);
selectionsApplied.push_back(tmp);
}
s = ReadLabels(input);
input += s; size += s;
......@@ -2978,3 +3031,58 @@ avtDataAttributes::GetTreatAsASCII(const char *varname) const
return variables[index].treatAsASCII;
}
// ****************************************************************************
// Method: avtDataAttributes::SetSelectionsApplied
//
// Purpose: Sets the vector of bools indicating which selections have been
// applied.
//
// Programmer: Mark C. Miller
// Creation: September 28, 2004
//
// ****************************************************************************
void
avtDataAttributes::SetSelectionsApplied(std::vector<bool> &selsApplied)
{
selectionsApplied = selsApplied;
}
// ****************************************************************************
// Method: avtDataAttributes::GetSelectionApplied
//
// Purpose: Given the id of a data selection, returns the flag indicating
// if it was applied.