Commit c7042e2e authored by hrchilds's avatar hrchilds
Browse files

Update from January 31, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@165 18c085ea-50e0-402c-830e-de6fd14e8384
parent 4bb9c454
......@@ -389,6 +389,8 @@ avtGenericDatabase::GetOutput(avtDataSpecification_p spec,
// for example), so call this again.
//
avtDataObject_p dob = src->GetOutput();
if (nDomains == 0)
dob->GetInfo().GetValidity().SetHasEverOwnedAnyDomain(false);
PopulateDataObjectInformation(dob, spec->GetVariable(), timeStep, *spec);
return rv;
......@@ -1337,16 +1339,18 @@ avtGenericDatabase::GetScalarVariable(const char *varname, int ts, int domain,
if (var != NULL)
{
if (Interface->CanCacheVariable(varname))
{
cache.CacheVTKObject(varname, avtVariableCache::SCALARS_NAME, ts,
domain, material, var);
//
// We need to decrement the reference count of the variable
// returned from FetchVar, but we could not do it previously
// because it would knock the count down to 0 and delete it. Since
// we have cached it, we can do it now.
//
var->Delete();
//
// We need to decrement the reference count of the variable
// returned from FetchVar, but we could not do it previously
// because it would knock the count down to 0 and delete it. Since
// we have cached it, we can do it now.
//
var->Delete();
}
}
}
......@@ -1412,16 +1416,18 @@ avtGenericDatabase::GetVectorVariable(const char *varname, int ts, int domain,
if (var != NULL)
{
if (Interface->CanCacheVariable(varname))
{
cache.CacheVTKObject(varname, avtVariableCache::VECTORS_NAME, ts,
domain, material, var);
//
// We need to decrement the reference count of the variable
// returned from FetchVar, but we could not do it previously
// because it would knock the count down to 0 and delete it. Since
// we have cached it, we can do it now.
//
var->Delete();
//
// We need to decrement the reference count of the variable
// returned from FetchVar, but we could not do it previously
// because it would knock the count down to 0 and delete it. Since
// we have cached it, we can do it now.
//
var->Delete();
}
}
}
......@@ -1477,16 +1483,18 @@ avtGenericDatabase::GetTensorVariable(const char *varname, int ts, int domain,
if (var != NULL)
{
if (Interface->CanCacheVariable(varname))
{
cache.CacheVTKObject(varname, avtVariableCache::TENSORS_NAME, ts,
domain, material, var);
//
// We need to decrement the reference count of the variable
// returned from FetchVar, but we could not do it previously
// because it would knock the count down to 0 and delete it. Since
// we have cached it, we can do it now.
//
var->Delete();
//
// We need to decrement the reference count of the variable
// returned from FetchVar, but we could not do it previously
// because it would knock the count down to 0 and delete it. Since
// we have cached it, we can do it now.
//
var->Delete();
}
}
}
......@@ -1543,16 +1551,18 @@ avtGenericDatabase::GetSymmetricTensorVariable(const char *varname, int ts,
if (var != NULL)
{
if (Interface->CanCacheVariable(varname))
{
cache.CacheVTKObject(varname, avtVariableCache::TENSORS_NAME, ts,
domain, material, var);
//
// We need to decrement the reference count of the variable
// returned from FetchVar, but we could not do it previously
// because it would knock the count down to 0 and delete it. Since
// we have cached it, we can do it now.
//
var->Delete();
//
// We need to decrement the reference count of the variable
// returned from FetchVar, but we could not do it previously
// because it would knock the count down to 0 and delete it. Since
// we have cached it, we can do it now.
//
var->Delete();
}
}
}
......@@ -1656,16 +1666,18 @@ avtGenericDatabase::GetMesh(const char *meshname, int ts, int domain,
ScaleMesh(mesh);
if (Interface->CanCacheVariable(meshname))
{
cache.CacheVTKObject(meshname, avtVariableCache::DATASET_NAME, ts,
domain, material, mesh);
//
// We need to decrement the reference count of the variable returned
// from FetchMesh, but we could not do it previously because it would
// knock the count down to 0 and delete it. Since we have cached it,
// we can do it now.
//
mesh->Delete();
//
// We need to decrement the reference count of the variable returned
// from FetchMesh, but we could not do it previously because it would
// knock the count down to 0 and delete it. Since we have cached it,
// we can do it now.
//
mesh->Delete();
}
}
//
......
......@@ -8,7 +8,6 @@
#include <vtkStructuredGrid.h>
#define MAX_GHOST_LAYERS 2
#define NESTING_GHOST_MASK 0x01
// ****************************************************************************
// Destructor: avtStructuredDomainNesting::Destruct
......@@ -37,9 +36,9 @@ avtStructuredDomainNesting::Destruct(void *p)
// dimension and the pre-existing vtkGhostLevels data
//
// To perform the detection, basically we try all reasonable combinations
// of ghost layers and probe the ghostData array around the extreme high
// and low ijk corners of the patch to see if we get something thats
// consistent. The loop looks daunting but it completes very quickly.
// of ghost numbers of layers and probe the ghostData array around the
// extreme high and low ijk corners of the patch to see if we get something
// thats consistent. The loop looks daunting but it completes very quickly.
//
// Programmer: Mark C. Miller
// Creation: January 8, 2004
......@@ -79,9 +78,17 @@ DetectBoundaryGhostLayers(int numDims, unsigned char *ghostData, int numCells,
int Mj = Nj + 2 * gj;
int Mi = Ni + 2 * gi;
// can ignore this case immediately if it doesn't equate the
// the number of cells we know the ghost data has
if (Mk * Mj * Mi != numCells)
// can ignore this case immediately if the number of
// cells it presumes doesn't equate to the number of
// cells we know we have
int ncells = 0;
switch (numDims)
{
case 3: ncells = Mk * Mj * Mi; break;
case 2: ncells = Mj * Mi; break;
case 1: ncells = Mi; break;
}
if (ncells != numCells)
continue;
// probe ghost data array round 2 extreme corners
......@@ -91,7 +98,9 @@ DetectBoundaryGhostLayers(int numDims, unsigned char *ghostData, int numCells,
{
int i0, j0, k0;
// set which corner to look at
// set which corner to examine ghost values around
// -1 --> Lower, Left, Front
// +1 --> Upper, Right, Back
if (mult == -1)
{
// the extreme lowest corner
......@@ -124,8 +133,20 @@ DetectBoundaryGhostLayers(int numDims, unsigned char *ghostData, int numCells,
int a = i0 + i * mult;
int b = j0 + j * mult;
int c = k0 + k * mult;
int idx = c*Mi*Mj + b*Mi + a;
int idx;
// compute offset into ghost array assuming
// a zone really exists at the logical index [a,b,c]
switch (numDims)
{
case 3: idx = c*Mi*Mj + b*Mi + a; break;
case 2: idx = b*Mi + a; break;
case 1: idx = a; break;
}
// if the computed index is either out of
// range or the ghost value indicates it
// is NOT really a ghost, its invalid
if ((idx < 0) || (idx >= numCells) ||
(ghostData[idx] == 0))
{
......@@ -182,6 +203,14 @@ DetectBoundaryGhostLayers(int numDims, unsigned char *ghostData, int numCells,
// be easily modified to set the right bit. I also replaced cerr statements
// with bonified exceptions.
//
// Mark C. Miller, Thu Jan 29 10:49:35 PST 2004
// I added code to set ghost values whether a child is present or not. If
// a child is NOT present, ghost values are set to 0 indicating that
// the parent should not be ghosted. I also removed tests for index out
// of range from inner loops. Finally, I changed to the code to use straight
// assignment rather than bit operators for to avoid possible generation of
// non-0/1 values.
//
// ****************************************************************************
bool
avtStructuredDomainNesting::ApplyGhost(vector<int> domainList,
......@@ -200,10 +229,11 @@ avtStructuredDomainNesting::ApplyGhost(vector<int> domainList,
int parentDom = domainList[i];
int numCells = meshes[i]->GetNumberOfCells();
bool parentHasBoundaryGhosts = (ghostArray != 0);
bool parentAlreadyHasGhosts = (ghostArray != 0);
// assume there are no boundary ghost layers
int ghostLayers[3] = {0, 0, 0};
if (parentHasBoundaryGhosts)
if (parentAlreadyHasGhosts)
{
ghostData = (unsigned char *) ghostArray->GetVoidPointer(0);
......@@ -216,12 +246,16 @@ avtStructuredDomainNesting::ApplyGhost(vector<int> domainList,
//
DetectBoundaryGhostLayers(numDimensions, ghostData, numCells,
domainNesting[parentDom].logicalExtents, ghostLayers);
}
else
{
ghostArray = vtkUnsignedCharArray::New();
ghostArray->SetNumberOfTuples(numCells);
ghostData = (unsigned char *) ghostArray->GetVoidPointer(0);
ghostArray->SetName("vtkGhostLevels");
meshes[i]->GetCellData()->AddArray(ghostArray);
ghostArray->Delete();
memset(ghostData, 0x0, numCells);
}
......@@ -242,7 +276,16 @@ avtStructuredDomainNesting::ApplyGhost(vector<int> domainList,
}
}
//
// whether the child is on or not, we need to go through and set the ghosts of
// the parent accordingly. If the child is on, we need to set the ghost array
// in the parent to 1 where appropriate. Otherwise, we need to set it to 0
// We use the exclusive or operator below to achieve this
//
unsigned char ghostVal = 0x0;
if (thisChildIsOn)
ghostVal = 0x1;
{
int ratio[3];
int childDom = domainNesting[parentDom].childDomains[j];
......@@ -295,14 +338,7 @@ avtStructuredDomainNesting::ApplyGhost(vector<int> domainList,
int b = jj - J0 + ghostLayers[1];
int c = kk - K0 + ghostLayers[2];
int idx = c*Ni*Nj + b*Ni + a;
if ((idx >= numCells) || (idx < 0))
{
EXCEPTION2(BadIndexException,idx,numCells);
}
else
{
ghostData[idx] |= NESTING_GHOST_MASK;
}
ghostData[idx] = ghostVal;
}
}
else if (numDimensions == 2)
......@@ -313,14 +349,7 @@ avtStructuredDomainNesting::ApplyGhost(vector<int> domainList,
int a = ii - I0 + ghostLayers[0];
int b = jj - J0 + ghostLayers[1];
int idx = b*Ni + a;
if ((idx >= numCells) || (idx < 0))
{
EXCEPTION2(BadIndexException,idx,numCells);
}
else
{
ghostData[idx] |= NESTING_GHOST_MASK;
}
ghostData[idx] = ghostVal;
}
}
else
......@@ -328,26 +357,11 @@ avtStructuredDomainNesting::ApplyGhost(vector<int> domainList,
for (int ii = i0; ii < i1; ii++)
{
int a = ii - I0 + ghostLayers[0];
if ((a >= numCells) ||
(a < 0))
{
EXCEPTION2(BadIndexException,a,numCells);
}
else
{
ghostData[a] |= NESTING_GHOST_MASK;
}
ghostData[a] = ghostVal;
}
}
}
}
if (!parentHasBoundaryGhosts)
{
ghostArray->SetName("vtkGhostLevels");
meshes[i]->GetCellData()->AddArray(ghostArray);
ghostArray->Delete();
}
}
return didGhost;
......
......@@ -337,19 +337,42 @@ avtDataAttributes::Copy(const avtDataAttributes &di)
//
// Eric Brugger, Wed Aug 20 09:28:48 PDT 2003
// Merge windowMode.
//
// Mark C. Miller, Thu Jan 29 19:40:25 PST 2004
// Added bools to ignore this or that. We might need to ignore this or that
// if in parallel, we can't guarentee that one of the two operands to the
// Merge operator has valid data members for ALL of them. Right now, the
// only attribute that is 'ignored' is variable dimension. If we discover
// that other circumstances arise other attribute data members can't be
// guraenteed to be valid, we can add more logic here. Added the
// support macro, CHECK_OR_IGNOR()
//
// ****************************************************************************
#define CHECK_OR_IGNORE(THIS,THAT) \
if (THIS != THAT) \
{ \
if ( ignoreThis && ignoreThat) \
; \
else if ( ignoreThis && !ignoreThat) \
THIS = THAT; \
else if (!ignoreThis && ignoreThat) \
; \
else if (!ignoreThis && !ignoreThat) \
{ \
EXCEPTION2(InvalidMergeException, THIS, THAT); \
} \
}
void
avtDataAttributes::Merge(const avtDataAttributes &da)
avtDataAttributes::Merge(const avtDataAttributes &da,
bool ignoreThis, bool ignoreThat)
{
//
// Make sure that it will make sense to merge the data.
//
if (centering != da.centering)
{
EXCEPTION2(InvalidMergeException, centering, da.centering);
}
CHECK_OR_IGNORE(centering, da.centering);
if (cellOrigin != da.cellOrigin)
{
EXCEPTION2(InvalidMergeException, cellOrigin, da.cellOrigin);
......@@ -358,11 +381,9 @@ avtDataAttributes::Merge(const avtDataAttributes &da)
{
EXCEPTION2(InvalidMergeException, blockOrigin, da.blockOrigin);
}
if (variableDimension != da.variableDimension)
{
EXCEPTION2(InvalidMergeException, variableDimension,
da.variableDimension);
}
CHECK_OR_IGNORE(variableDimension, da.variableDimension);
if (spatialDimension != da.spatialDimension)
{
EXCEPTION2(InvalidMergeException, spatialDimension,
......@@ -407,18 +428,41 @@ avtDataAttributes::Merge(const avtDataAttributes &da)
SetContainsOriginalCells(da.GetContainsOriginalCells());
}
trueSpatial->Merge(*(da.trueSpatial));
cumulativeTrueSpatial->Merge(*(da.cumulativeTrueSpatial));
effectiveSpatial->Merge(*(da.effectiveSpatial));
currentSpatial->Merge(*(da.currentSpatial));
cumulativeCurrentSpatial->Merge(*(da.cumulativeCurrentSpatial));
trueData->Merge(*(da.trueData));
cumulativeTrueData->Merge(*(da.cumulativeTrueData));
effectiveData->Merge(*(da.effectiveData));
currentData->Merge(*(da.currentData));
cumulativeCurrentData->Merge(*(da.cumulativeCurrentData));
canUseCummulativeAsTrueOrCurrent &= da.canUseCummulativeAsTrueOrCurrent;
if (ignoreThis && ignoreThat)
; // no-op because we care about neither
else if (ignoreThis && !ignoreThat)
{
trueSpatial = da.trueSpatial;
cumulativeTrueSpatial = da.cumulativeTrueSpatial;
effectiveSpatial = da.effectiveSpatial;
currentSpatial = da.currentSpatial;
cumulativeCurrentSpatial = da.cumulativeCurrentSpatial;
trueData = da.trueData;
cumulativeTrueData = da.cumulativeTrueData;
effectiveData = da.effectiveData;
currentData = da.currentData;
cumulativeCurrentData = da.cumulativeCurrentData;
canUseCummulativeAsTrueOrCurrent = da.canUseCummulativeAsTrueOrCurrent;
}
else if (!ignoreThis && ignoreThat)
; // no-op because we care only about this
else if (!ignoreThis && !ignoreThat)
{
trueSpatial->Merge(*(da.trueSpatial));
cumulativeTrueSpatial->Merge(*(da.cumulativeTrueSpatial));
effectiveSpatial->Merge(*(da.effectiveSpatial));
currentSpatial->Merge(*(da.currentSpatial));
cumulativeCurrentSpatial->Merge(*(da.cumulativeCurrentSpatial));
trueData->Merge(*(da.trueData));
cumulativeTrueData->Merge(*(da.cumulativeTrueData));
effectiveData->Merge(*(da.effectiveData));
currentData->Merge(*(da.currentData));
cumulativeCurrentData->Merge(*(da.cumulativeCurrentData));
canUseCummulativeAsTrueOrCurrent &= da.canUseCummulativeAsTrueOrCurrent;
}
MergeLabels(da.labels);
MergeTransform(da.transform);
......
......@@ -102,6 +102,9 @@ class avtExtents;
// Eric Brugger, Wed Aug 20 09:27:54 PDT 2003
// Added GetWindowMode and SetWindowMode.
//
// Mark C. Miller, Thu Jan 29 17:31:20 PST 2004
// Added bools to Merge method to control ignoring certain attributes
//
// ****************************************************************************
class PIPELINE_API avtDataAttributes
......@@ -111,7 +114,9 @@ class PIPELINE_API avtDataAttributes
virtual ~avtDataAttributes();
void Copy(const avtDataAttributes &);
void Merge(const avtDataAttributes &);
void Merge(const avtDataAttributes &,
bool ignoreThisOk = false,
bool ignoreThatOk = false);
void Write(avtDataObjectString &,
const avtDataObjectWriter *);
......
......@@ -49,12 +49,23 @@ avtDataObjectInformation::Copy(const avtDataObjectInformation &di)
// Programmer: Hank Childs
// Creation: March 24, 2001
//
// Modifications:
//
// Mark C. Miller, Thu Jan 29 17:31:20 PST 2004
// Added passage of bools from data validity regarding whether any domain
// was owned to the merge of the attributes
//
// ****************************************************************************
void
avtDataObjectInformation::Merge(const avtDataObjectInformation &di)
{
atts.Merge(di.atts);
// see if either operand has ever been left unset due to processor
// not having read any domain
bool ignoreThis = validity.GetHasEverOwnedAnyDomain() ? false : true;
bool ignoreThat = di.validity.GetHasEverOwnedAnyDomain() ? false : true;
atts.Merge(di.atts, ignoreThis, ignoreThat);
validity.Merge(di.validity);
}
......@@ -205,6 +216,10 @@ avtDataObjectInformation::SwapAndMerge(const avtDataObjectWriter_p dobw,
// message size as merges are performed. For example, the list of material
// labels may get longer and longer.
//
// Mark C. Miller, Wed Jan 21 13:36:01 PST 2004
// Moved call to CanUseCummulativeAsTrueOrCurrent to outside the
// #ifdef PARALLE block
//
// ****************************************************************************
void
......@@ -271,10 +286,11 @@ avtDataObjectInformation::ParallelMerge(const avtDataObjectWriter_p dobw)
groupSize >>= 1;
}
#endif
// indicate that it is ok to use cummulative true extents as true extents;
GetAttributes().SetCanUseCummulativeAsTrueOrCurrent(true);
#endif
}
// ****************************************************************************
......
......@@ -37,6 +37,11 @@ avtDataValidity::avtDataValidity()
// Programmer: Hank Childs
// Creation: September 30, 2003
//
// Modifications:
//
// Mark C. Miller, Thu Jan 29 16:40:25 PST 2004
// Added hasEverOwnedAnyDomain
//
// ****************************************************************************
void
......@@ -56,6 +61,7 @@ avtDataValidity::Reset(void)
notAllCellsSubdivided = false;
disjointElements = false;
queryable = true;
hasEverOwnedAnyDomain = true;
errorOccurred = false;
errorString = "";
}
......@@ -102,6 +108,9 @@ avtDataValidity::Reset(void)
// Hank Childs, Fri May 16 10:18:12 PDT 2003
// Copy over errorOccurred, errorString.
//
// Mark C. Miller, Thu Jan 29 16:40:25 PST 2004
// Added hasEverOwnedAnyDomain
//
// ****************************************************************************
void
......@@ -121,6 +130,7 @@ avtDataValidity::Copy(const avtDataValidity &di)
notAllCellsSubdivided = di.notAllCellsSubdivided;
disjointElements = di.disjointElements;
queryable = di.queryable;
hasEverOwnedAnyDomain = di.hasEverOwnedAnyDomain;
errorOccurred = di.errorOccurred;
errorString = di.errorString;
}
......@@ -167,6 +177,9 @@ avtDataValidity::Copy(const avtDataValidity &di)
// Hank Childs, Fri May 16 10:18:12 PDT 2003
// Account for errorOccurred, errorString.
//
// Mark C. Miller, Thu Jan 29 16:40:25 PST 2004
// Added hasEverOwnedAnyDomain
//
// ****************************************************************************
void
......@@ -187,6 +200,7 @@ avtDataValidity::Merge(const avtDataValidity &di)
di.normalsAreInappropriate;
disjointElements = disjointElements && di.disjointElements;
queryable = queryable && di.queryable;
hasEverOwnedAnyDomain = hasEverOwnedAnyDomain || hasEverOwnedAnyDomain;
// If not all cells were subdivided in either dataset, or if all were
// in one but not both, then not all of our cells were subdivided
......@@ -263,13 +277,16 @@ avtDataValidity::Merge(const avtDataValidity &di)
// Hank Childs, Fri May 16 10:18:12 PDT 2003
// Write errorOccrred, errorString.
//
// Mark C. Miller, Thu Jan 29 16:40:25 PST 2004
// Added hasEverOwnedAnyDomain
//
// ****************************************************************************
void
avtDataValidity::Write(avtDataObjectString &str,
const avtDataObjectWriter *wrtr)
{
const int numVals = 16;
const int numVals = 17;
int vals[numVals];
vals[0] = (zonesPreserved ? 1 : 0);
......@@ -286,8 +303,9 @@ avtDataValidity::Write(avtDataObjectString &str,
vals[11]= (notAllCellsSubdivided ? 1 : 0);
vals[12]= (disjointElements ? 1 : 0);
vals[13]= (queryable ? 1 : 0);
vals[14]= (errorOccurred ? 1 : 0);
vals[15]= errorString.size();
vals[14]= (hasEverOwnedAnyDomain ? 1 : 0);
vals[15]= (errorOccurred ? 1 : 0);
vals[16]= errorString.size();
wrtr->WriteInt(str, vals, numVals);
str.Append((char *) errorString.c_str(), errorString.size(),
......@@ -338,6 +356,9 @@ avtDataValidity::Write(avtDataObjectString &str,
// Hank Childs, Fri May 16 10:18:12 PDT 2003
// Read errorOccrred, errorString.
//
// Mark C. Miller, Thu Jan 29 16:40:25 PST 2004
// Added hasEverOwnedAnyDomain, careful to put in right order in sequence
//
// ****************************************************************************
int
......@@ -441,6 +462,12 @@ avtDataValidity::Read(char *input)
input