Commit c2521e62 authored by hrchilds's avatar hrchilds
Browse files

Update from August 9, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@297 18c085ea-50e0-402c-830e-de6fd14e8384
parent 7470d333
......@@ -50,10 +50,13 @@ inline void Indent(ostream &, int);
// Brad Whitlock, Fri Jul 23 12:24:38 PDT 2004
// Added xLabel, yLabel, zLabel.
//
// Mark C. Miller, August 9, 2004
// Added containsGlobalZoneIds data member
//
// ****************************************************************************
avtMeshMetaData::avtMeshMetaData()
: AttributeSubject("sssiiiiiibFFs*ii*ssbssssssibbbb")
: AttributeSubject("sssiiiiiibFFs*ii*ssbssssssibbbbb")
{
blockTitle = "domains";
blockPieceName = "domain";
......@@ -72,6 +75,7 @@ avtMeshMetaData::avtMeshMetaData()
containsOriginalCells = false;
containsOriginalNodes = false;
containsGlobalNodeIds = false;
containsGlobalZoneIds = false;
validVariable = true;
xLabel = "X-Axis";
yLabel = "Y-Axis";
......@@ -125,11 +129,14 @@ avtMeshMetaData::avtMeshMetaData()
// Brad Whitlock, Fri Jul 23 12:25:03 PDT 2004
// Added xLabel, yLabel, zLabel.
//
// Mark C. Miller, August 9, 2004
// Added containsGlobalZoneIds data member
//
// ****************************************************************************
avtMeshMetaData::avtMeshMetaData(const float *extents, std::string s, int nb,
int bo, int co,int sd, int td, avtMeshType mt)
: AttributeSubject("sssiiiiiibFFs*ii*ssbssssssibbbb")
: AttributeSubject("sssiiiiiibFFs*ii*ssbssssssibbbbb")
{
name = s;
numBlocks = nb;
......@@ -149,6 +156,7 @@ avtMeshMetaData::avtMeshMetaData(const float *extents, std::string s, int nb,
containsOriginalCells = false;
containsOriginalNodes = false;
containsGlobalNodeIds = false;
containsGlobalZoneIds = false;
validVariable = true;
xLabel = "X-Axis";
yLabel = "Y-Axis";
......@@ -202,11 +210,14 @@ avtMeshMetaData::avtMeshMetaData(const float *extents, std::string s, int nb,
// Brad Whitlock, Fri Jul 23 12:25:22 PDT 2004
// Added xLabel, yLabel, zLabel.
//
// Mark C. Miller, August 9, 2004
// Added containsGlobalZoneIds data member
//
// ****************************************************************************
avtMeshMetaData::avtMeshMetaData(std::string s, int nb, int bo, int co, int sd,
int td, avtMeshType mt)
: AttributeSubject("sssiiiiiibFFs*ii*ssbssssssibbbb")
: AttributeSubject("sssiiiiiibFFs*ii*ssbssssssibbbbb")
{
name = s;
numBlocks = nb;
......@@ -227,6 +238,7 @@ avtMeshMetaData::avtMeshMetaData(std::string s, int nb, int bo, int co, int sd,
containsOriginalCells = false;
containsOriginalNodes = false;
containsGlobalNodeIds = false;
containsGlobalZoneIds = false;
validVariable = true;
xLabel = "X-Axis";
......@@ -282,10 +294,13 @@ avtMeshMetaData::avtMeshMetaData(std::string s, int nb, int bo, int co, int sd,
// Brad Whitlock, Fri Jul 23 12:27:29 PDT 2004
// Added xLabel, yLabel, and zLabel.
//
// Mark C. Miller, August 9, 2004
// Added containsGlobalZoneIds data member
//
// ****************************************************************************
avtMeshMetaData::avtMeshMetaData(const avtMeshMetaData &rhs)
: AttributeSubject("sssiiiiiibFFs*ii*ssbssssssibbbb")
: AttributeSubject("sssiiiiiibFFs*ii*ssbssssssibbbbb")
{
name = rhs.name;
numBlocks = rhs.numBlocks;
......@@ -312,6 +327,7 @@ avtMeshMetaData::avtMeshMetaData(const avtMeshMetaData &rhs)
containsOriginalCells = rhs.containsOriginalCells;
containsOriginalNodes = rhs.containsOriginalNodes;
containsGlobalNodeIds = rhs.containsGlobalNodeIds;
containsGlobalZoneIds = rhs.containsGlobalZoneIds;
xUnits = rhs.xUnits;
yUnits = rhs.yUnits;
zUnits = rhs.zUnits;
......@@ -383,6 +399,9 @@ avtMeshMetaData::~avtMeshMetaData()
// Brad Whitlock, Fri Jul 23 12:28:00 PDT 2004
// Added xLabel, yLabel, and zLabel.
//
// Mark C. Miller, August 9, 2004
// Added containsGlobalZoneIds data member
//
// ****************************************************************************
const avtMeshMetaData &
......@@ -413,6 +432,7 @@ avtMeshMetaData::operator=(const avtMeshMetaData &rhs)
containsOriginalCells = rhs.containsOriginalCells;
containsOriginalNodes = rhs.containsOriginalNodes;
containsGlobalNodeIds = rhs.containsGlobalNodeIds;
containsGlobalZoneIds = rhs.containsGlobalZoneIds;
xUnits = rhs.xUnits;
yUnits = rhs.yUnits;
zUnits = rhs.zUnits;
......@@ -466,6 +486,9 @@ avtMeshMetaData::operator=(const avtMeshMetaData &rhs)
// Brad Whitlock, Fri Jul 23 12:23:53 PDT 2004
// Added xLabel, yLabel, zLabel.
//
// Mark C. Miller, August 9, 2004
// Added containsGlobalZoneIds data member
//
// ****************************************************************************
void
......@@ -500,6 +523,7 @@ avtMeshMetaData::SelectAll()
Select(26, (void*)&containsOriginalNodes);
Select(27, (void*)&containsGlobalNodeIds);
Select(28, (void*)&validVariable);
Select(29, (void*)&containsGlobalZoneIds);
}
......@@ -5871,6 +5895,56 @@ avtDatabaseMetaData::SetContainsOriginalNodes(std::string name, bool val)
}
// ****************************************************************************
// Method: avtDatabaseMetaData::SetContainsGlobalNodeIds
//
// Purpose:
// Sets whether a particular mesh has global node ids array.
//
// Programmer: Mark C. Miller
// Creation: August 9, 2004
//
// ****************************************************************************
void
avtDatabaseMetaData::SetContainsGlobalNodeIds(std::string name, bool val)
{
for (int i = 0 ; i < GetNumMeshes() ; i++)
{
if (meshes[i]->name == name)
{
meshes[i]->containsGlobalNodeIds = val;
return;
}
}
}
// ****************************************************************************
// Method: avtDatabaseMetaData::SetContainsGlobalZoneIds
//
// Purpose:
// Sets whether a particular mesh has global zone ids array.
//
// Programmer: Mark C. Miller
// Creation: August 9, 2004
//
// ****************************************************************************
void
avtDatabaseMetaData::SetContainsGlobalZoneIds(std::string name, bool val)
{
for (int i = 0 ; i < GetNumMeshes() ; i++)
{
if (meshes[i]->name == name)
{
meshes[i]->containsGlobalZoneIds = val;
return;
}
}
}
// ****************************************************************************
// Method: avtDatabaseMetaData::AddGroupInformation
//
......
......@@ -16,6 +16,11 @@
//----------------------------------------------------------------------------
// Class: avtMeshMetaData
//
// Modifications:
//
// Mark C. Miller, August 9, 2004
// Added containsGlobalZoneIds data member
//----------------------------------------------------------------------------
struct DBATTS_API avtMeshMetaData : public AttributeSubject
{
......@@ -40,6 +45,7 @@ struct DBATTS_API avtMeshMetaData : public AttributeSubject
bool containsOriginalCells;
bool containsOriginalNodes;
bool containsGlobalNodeIds;
bool containsGlobalZoneIds;
bool hasSpatialExtents;
float minSpatialExtents[3];
......@@ -518,6 +524,8 @@ public:
void SetContainsGhostZones(std::string name, avtGhostType);
void SetContainsOriginalCells(std::string name, bool);
void SetContainsOriginalNodes(std::string name, bool);
void SetContainsGlobalNodeIds(std::string name, bool);
void SetContainsGlobalZoneIds(std::string name, bool);
void AddGroupInformation(int nGroups, int nBlocks,
intVector &blockIds);
void UnsetExtents();
......
......@@ -15,6 +15,8 @@ const char *AUXILIARY_DATA_DOMAIN_BOUNDARY_INFORMATION
= "DOMAIN_BOUNDARY_INFORMATION";
const char *AUXILIARY_DATA_DOMAIN_NESTING_INFORMATION
= "DOMAIN_NESTING_INFORMATION";
const char * AUXILIARY_DATA_GLOBAL_NODE_IDS = "GLOBAL_NODE_IDS";
const char * AUXILIARY_DATA_GLOBAL_ZONE_IDS = "GLOBAL_ZONE_IDS";
static const char *avtExtentType_strings[] = { "AVT_ORIGINAL_EXTENTS",
"AVT_ACTUAL_EXTENTS", "AVT_SPECIFIED_EXTENTS", "AVT_UNKNOWN_EXTENT_TYPE"};
......
......@@ -79,10 +79,8 @@ enum SetState
AllUsedOtherProc /* 3 */
};
typedef std::vector<std::string> MaterialList;
DBATTS_API extern const char * AUXILIARY_DATA_DATA_EXTENTS;
DBATTS_API extern const char * AUXILIARY_DATA_EXTERNAL_FACELIST;
DBATTS_API extern const char * AUXILIARY_DATA_MATERIAL;
......@@ -91,6 +89,8 @@ DBATTS_API extern const char * AUXILIARY_DATA_SPATIAL_EXTENTS;
DBATTS_API extern const char * AUXILIARY_DATA_MIXED_VARIABLE;
DBATTS_API extern const char * AUXILIARY_DATA_DOMAIN_BOUNDARY_INFORMATION;
DBATTS_API extern const char * AUXILIARY_DATA_DOMAIN_NESTING_INFORMATION;
DBATTS_API extern const char * AUXILIARY_DATA_GLOBAL_NODE_IDS;
DBATTS_API extern const char * AUXILIARY_DATA_GLOBAL_ZONE_IDS;
DBATTS_API std::string avtExtentType_ToString(avtExtentType);
DBATTS_API std::string avtExtentType_ToString(int);
......@@ -98,7 +98,6 @@ DBATTS_API bool avtExtentType_FromString(const std::string &, avtExtentType &);
DBATTS_API avtVarType GuessVarTypeFromNumDimsAndComps(int numSpatialDims,
int componentCount);
#endif
......@@ -1690,6 +1690,11 @@ avtGenericDatabase::GetSymmetricTensorVariable(const char *varname, int ts,
// No longer scale the mesh, since the camera and lighting now both handle
// large and small problems better.
//
// Mark C. Miller, Mon Aug 9 19:12:24 PDT 2004
// Removed code to pass along 'avtGlobalNodeIds' and 'ElementGlobalIds'
// point and cell data arrays. That information is now obtained through
// the GetAuxiliaryData interface.
//
// ****************************************************************************
vtkDataSet *
......@@ -1772,16 +1777,6 @@ avtGenericDatabase::GetMesh(const char *meshname, int ts, int domain,
mesh->GetPointData()->GetArray("vtkGhostNodes"));
GetMetaData(ts)->SetContainsGhostZones(meshname, AVT_HAS_GHOSTS);
}
if (mesh->GetCellData()->GetArray("avtGlobalZoneId"))
{
rv->GetCellData()->AddArray(
mesh->GetCellData()->GetArray("avtGlobalZoneId"));
}
if (mesh->GetPointData()->GetArray("avtGlobalNodeId"))
{
rv->GetPointData()->AddArray(
mesh->GetPointData()->GetArray("avtGlobalNodeId"));
}
rv->GetFieldData()->ShallowCopy(mesh->GetFieldData());
return rv;
......@@ -2571,6 +2566,99 @@ avtGenericDatabase::GetSpecies(int dom, const char *var, int ts)
return rv;
}
// ****************************************************************************
// Method: avtGenericDatabase::GetGlobalNodeIds
//
// Purpose:
// Gets a global node numbers for a specific domain and a variable.
// This handles going through the auxiliary data mechanism and caching
// issues.
//
// Arguments:
// dom The domain we want the species for.
// var A variable (could be vector, scalar, mesh, mat, or species).
// ts The timestep of interest.
//
// Programmer: Mark C. Miller
// Creation: August 5, 2004
//
// ****************************************************************************
vtkDataArray *
avtGenericDatabase::GetGlobalNodeIds(int dom, const char *var, int ts)
{
avtDatabaseMetaData *md = GetMetaData(ts);
//
// Identify the mesh we want global node ids for
//
string meshname = md->MeshForVar(var);
avtDataSpecification_p dspec = new avtDataSpecification(meshname.c_str(),
ts, dom);
VoidRefList gnodeIds;
GetAuxiliaryData(dspec, gnodeIds, AUXILIARY_DATA_GLOBAL_NODE_IDS, NULL);
if (gnodeIds.nList > 1)
{
EXCEPTION0(ImproperUseException);
}
else if (gnodeIds.nList == 1)
{
return (vtkDataArray *) *(gnodeIds.list[0]);
md->SetContainsGlobalNodeIds(var, true);
}
else
{
return NULL;
}
}
// ****************************************************************************
// Method: avtGenericDatabase::GetGlobalZoneIds
//
// Purpose:
// Gets a global zone numbers for a specific domain and a variable.
// This handles going through the auxiliary data mechanism and caching
// issues.
//
// Arguments:
// dom The domain we want the species for.
// var A variable (could be vector, scalar, mesh, mat, or species).
// ts The timestep of interest.
//
// Programmer: Mark C. Miller
// Creation: August 5, 2004
//
// ****************************************************************************
vtkDataArray *
avtGenericDatabase::GetGlobalZoneIds(int dom, const char *var, int ts)
{
avtDatabaseMetaData *md = GetMetaData(ts);
//
// Identify the mesh we want global node ids for
//
string meshname = md->MeshForVar(var);
avtDataSpecification_p dspec = new avtDataSpecification(meshname.c_str(),
ts, dom);
VoidRefList gzoneIds;
GetAuxiliaryData(dspec, gzoneIds, AUXILIARY_DATA_GLOBAL_ZONE_IDS, NULL);
if (gzoneIds.nList > 1)
{
EXCEPTION0(ImproperUseException);
}
else if (gzoneIds.nList == 1)
{
md->SetContainsGlobalZoneIds(var, true);
return (vtkDataArray *) *(gzoneIds.list[0]);
}
else
{
return NULL;
}
}
// ****************************************************************************
// Method: avtGenericDatabase::SpeciesSelect
......@@ -3345,6 +3433,11 @@ avtGenericDatabase::ReadDataset(avtDatasetCollection &ds, vector<int> &domains,
// method to get the secondary variable list without duplicating either the
// primary variable or other secondary variables, and made use of it here.
//
// Mark C. Miller, Mon Aug 9 19:12:24 PDT 2004
// Removed avtMeshMetadata local variable.
// Changed logic for testing existence of global node ids to attempt to
// Get global node ids and if they exist, use them.
//
// ****************************************************************************
bool
......@@ -3361,7 +3454,6 @@ avtGenericDatabase::CommunicateGhosts(avtDatasetCollection &ds,
avtDatabaseMetaData *md = GetMetaData(ts);
avtVarType type = md->DetermineVarType(varname);
std::string meshname = md->MeshForVar(varname);
const avtMeshMetaData *mmd = md->GetMesh(meshname);
void_ref_ptr vr = cache.GetVoidRef("any_mesh",
AUXILIARY_DATA_DOMAIN_BOUNDARY_INFORMATION,
......@@ -3836,19 +3928,19 @@ avtGenericDatabase::CommunicateGhosts(avtDatasetCollection &ds,
visitTimer->StopTimer(timerHandle, "Creating ghost zones");
}
if ((mmd != NULL) && mmd->containsGlobalNodeIds)
//
// Make sure that we actually have the node ids.
//
bool haveGlobalNodeIds = true;
for (i = 0 ; i < doms.size() ; i++)
{
if (GetGlobalNodeIds(doms[i], meshname.c_str(), ts) == NULL)
haveGlobalNodeIds = false;
}
int shouldStop = (haveGlobalNodeIds ? 0 : 1);
if (haveGlobalNodeIds)
{
//
// Make sure that we actually have the node ids.
//
bool haveGlobalNodeIds = true;
for (i = 0 ; i < doms.size() ; i++)
{
vtkDataSet *d = ds.GetDataset(i, 0);
if (d->GetPointData()->GetArray("avtGlobalNodeId") == NULL)
haveGlobalNodeIds = false;
}
int shouldStop = (haveGlobalNodeIds ? 0 : 1);
#ifdef PARALLEL
int parallelShouldStop;
......@@ -3872,8 +3964,7 @@ avtGenericDatabase::CommunicateGhosts(avtDatasetCollection &ds,
int maxId = -1;
for (i = 0 ; i < doms.size() ; i++)
{
vtkDataSet *d = ds.GetDataset(i, 0);
vtkDataArray *gni = d->GetPointData()->GetArray("avtGlobalNodeId");
vtkDataArray *gni = GetGlobalNodeIds(doms[i], meshname.c_str(), ts);
vtkIntArray *int_gni = (vtkIntArray *) gni;
int *ptr = int_gni->GetPointer(0);
int nvals = int_gni->GetNumberOfTuples();
......@@ -3916,8 +4007,7 @@ avtGenericDatabase::CommunicateGhosts(avtDatasetCollection &ds,
vector< vector <int> > ids_for_proc(num_procs);
for (i = 0 ; i < doms.size() ; i++)
{
vtkDataSet *d = ds.GetDataset(i, 0);
vtkDataArray *gni = d->GetPointData()->GetArray("avtGlobalNodeId");
vtkDataArray *gni = GetGlobalNodeIds(doms[i], meshname.c_str(), ts);
vtkIntArray *int_gni = (vtkIntArray *) gni;
int *ptr = int_gni->GetPointer(0);
int nvals = int_gni->GetNumberOfTuples();
......@@ -4035,7 +4125,7 @@ avtGenericDatabase::CommunicateGhosts(avtDatasetCollection &ds,
for (i = 0 ; i < doms.size() ; i++)
{
vtkDataSet *d = ds.GetDataset(i, 0);
vtkDataArray *gni = d->GetPointData()->GetArray("avtGlobalNodeId");
vtkDataArray *gni = GetGlobalNodeIds(doms[i], meshname.c_str(), ts);
vtkIntArray *int_gni = (vtkIntArray *) gni;
int *ptr = int_gni->GetPointer(0);
int nvals = int_gni->GetNumberOfTuples();
......
......@@ -187,6 +187,9 @@ class PickVarInfo;
// Kathleen Bonnell, Thu Jun 10 18:15:11 PDT 2004
// Rename QueryZoneCenter to QueryCoords, added bool arg.
//
// Mark C. Miller, Mon Aug 9 19:12:24 PDT 2004
// Added methods to get global node and zone ids
//
// ****************************************************************************
class DATABASE_API avtGenericDatabase : public avtDatasetDatabase
......@@ -254,6 +257,8 @@ class DATABASE_API avtGenericDatabase : public avtDatasetDatabase
const char *);
vtkDataArray *GetSpeciesVariable(const char *, int, int,
const char *, int);
vtkDataArray *GetGlobalNodeIds(int, const char *, int);
vtkDataArray *GetGlobalZoneIds(int, const char *, int);
void AddSecondaryVariables(vtkDataSet *, int, int,
const char *,
const std::vector<CharStrRef> &);
......
......@@ -24,6 +24,24 @@ const char *avtVariableCache::SYMMETRIC_TENSORS_NAME
const char *avtVariableCache::DATASET_NAME = "DATASET";
// ****************************************************************************
// Method: avtVariableCache::DestructVTKObject
//
// Purpose:
// Defines a destructor function meeting the requirements of
// DestructorFunction for VTK objects.
//
// Programmer: Mark C. Miller
// Creation: August 4, 2004
//
// ****************************************************************************
void
avtVariableCache::DestructVTKObject(void *vtkObj)
{
((vtkObject*)vtkObj)->Delete();
}
// ****************************************************************************
// Method: avtVariableCache constructor
//
......
......@@ -76,6 +76,11 @@ class DATABASE_API avtVariableCache
void Print(ostream &);
// Special destructor function to permit us to spoof VTK objects
// in the VoidRef cache so that the Auxiliary data interface can
// return vtkDataArrays (e.g. global node/zone ids)
static void DestructVTKObject(void *vtkObj);
protected:
class OneDomain
......
......@@ -212,6 +212,9 @@ avtExodusFileFormat::FreeUpResources(void)
// Hank Childs, Thu Jul 22 10:43:36 PDT 2004
// Tell the reader to generate block ids.
//
// Mark C. Miller, Mon Aug 9 19:12:24 PDT 2004
// Tell the reader to generate global zone ids
//
// ****************************************************************************
vtkExodusReader *
......@@ -225,6 +228,7 @@ avtExodusFileFormat::GetReader(void)
reader = vtkExodusReader::New();
reader->SetFileName(filenames[0]);
reader->SetGenerateNodeGlobalIdArray(1);
reader->SetGenerateElementGlobalIdArray(1);
reader->SetGenerateBlockIdCellArray(1);
//
......@@ -355,6 +359,9 @@ avtExodusFileFormat::GetNTimesteps(void)
// Hank Childs, Thu Jul 22 14:41:51 PDT 2004
// Use the real filenames when creating the SIL.
//
// Mark C. Miller, Mon Aug 9 19:12:24 PDT 2004
// Removed setting of avtMeshMetadata->containsGlobalNodeIds
//
// ****************************************************************************
void
......@@ -389,7 +396,6 @@ avtExodusFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
mesh->blockNames = (*globalFileLists)[fileList];
}
mesh->blockPieceName = "File";
mesh->containsGlobalNodeIds = true;
md->Add(mesh);
//
......@@ -480,10 +486,49 @@ avtExodusFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
// Hank Childs, Tue Apr 8 10:58:18 PDT 2003
// Make sure the file is read in before proceeding.
//
// Mark C. Miller, Thu Aug 5 14:17:36 PDT 2004
// Moved whole of implementation to ReadMesh
//
// ****************************************************************************
vtkDataSet *
avtExodusFileFormat::GetMesh(int ts, const char *mesh)
{
bool okToRemoveAndCacheGlobalIds = true;
return ReadMesh(ts, mesh, okToRemoveAndCacheGlobalIds);
}
// ****************************************************************************
// Method: avtExodusFileFormat::ReadMesh
//
// Purpose:
// Returns the mesh for a specific timestep and, optionally, can remove
// and cache global node and zone ids in AVT's VoidRefCache
//
// Arguments:
// ts The timestep of interest.
// mesh The name of the mesh of interest.
// ok... Boolean indicating if remove and caching of global id
// information is permitted.
//
// Returns: The mesh. Note that the "material" can be set beforehand and
// that will alter how the mesh is read in.
//
// Programmer: Hank Childs
// Creation: October 9, 2001
//
// Modifications:
//
// Mark C. Miller,
// Renamed from GetMesh
// Added bool argument for okToRemoveAndCacheGlobalIds
// Added code to remove and cache global node and zone ids
//
// ****************************************************************************
vtkDataSet *
avtExodusFileFormat::ReadMesh(int ts, const char *mesh,
bool okToRemoveAndCacheGlobalIds)
{
if (!readInFile)
{
......@@ -519,6 +564,33 @@ avtExodusFileFormat::GetMesh(int ts, const char *mesh)
if (ds != NULL)
{
if (okToRemoveAndCacheGlobalIds)
{
//
// We've decided that global node and zone ids are AVT_AUXILIARY
// data and have a life of their own apart from any mesh they are
// associated with. So, if the VTK dataset we've obtained has
// them, here, we remove them and cache them in AVT separately.
//
vtkDataArray *gnodeIds = ds->GetPointData()->GetArray("avtGlobalNodeId");