Commit 61d97f06 authored by miller86's avatar miller86
Browse files

making transform manager operate on domains as they are read instead of after all domains are read

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@8906 18c085ea-50e0-402c-830e-de6fd14e8384
parent 4660ebd2
......@@ -468,6 +468,12 @@ avtGenericDatabase::SetCycleTimeInDatabaseMetaData(avtDatabaseMetaData *md, int
// in the contract. Also, disable the collective test if we are doing
// on demand streaming.
//
// Mark C. Miller, Mon Nov 9 09:38:49 PST 2009
// Pushed transform manager work down one level from here, where it
// operates on a dataset collection (and means for example that all
// domains could be read in double precision before any one domain is
// converted to float) to inside ReadDataset. Doh! Why didn't I think
// of that before.
// ****************************************************************************
avtDataTree_p
......@@ -521,19 +527,6 @@ avtGenericDatabase::GetOutput(avtDataRequest_p spec,
//
ReadDataset(datasetCollection, domains, spec, src, selectionsApplied);
//
// Do any transformations necessary to convert data from a form VisIt
// cannot, in general, handle to a form that it can. Typically, this
// is a no-op. The kind of transformations here include
// such things as precision conversion, making the mesh a "conforming"
// mesh (e.g. removing hanging nodes), converting arbitrary polyhdra
// to zoo-type, discretizing a csg mesh, etc.
//
int t0 = visitTimer->StartTimer();
xformManager->TransformDataset(datasetCollection, domains, spec, src,
selectionsApplied, md);
visitTimer->StopTimer(t0, "Transform manager");
//
// Now that we have read things in from disk, verify that the dataset
// is valid, since routines like the MIR downstream will assume they are.
......@@ -4813,6 +4806,12 @@ avtGenericDatabase::ActivateTimestep(int stateIndex)
// Add support for file formats that do their own domain decomposition
// in a parallel setting when using data selections.
//
// Mark C. Miller, Mon Nov 9 09:40:52 PST 2009
// Moved transform manager work here from ::GetOutput, so transforms can
// be applied as each domain is read rather than after all domains are
// read. This is important for transformations such us changes from
// double to single precision that reduce the memory footprint of a
// dataset.
// ****************************************************************************
void
......@@ -5111,6 +5110,28 @@ avtGenericDatabase::ReadDataset(avtDatasetCollection &ds, intVector &domains,
}
}
//
// Do any transformations necessary to convert data
// from a form VisIt cannot, in general, handle to a
// form that it can. Typically, this is a no-op. The
// kind of transformations here include such things
// as precision conversion, making the mesh a "conforming"
// mesh (e.g. removing hanging nodes), converting arbitrary
// polyhdra to zoo-type, discretizing a csg mesh, etc.
//
for (int j = 0 ; j < (ds.needsMatSelect[i]?nmats:1); j++)
{
vtkDataSet *dsOrig, *dstmp;
dsOrig = dstmp = ds.GetDataset(i, j);
dstmp = xformManager->TransformSingleDataset(dstmp,
domains[i], spec, src, selectionsApplied, md);
if (dstmp != dsOrig)
{
ds.SetDataset(i, j, dstmp);
dstmp->Delete();
}
}
src->DatabaseProgress(i, nDomains, progressString);
}
......
......@@ -480,7 +480,7 @@ ConvertDataSetToFloat(vtkDataSet *oldds)
}
// ****************************************************************************
// Template: ConvertDataSetToFloat
// Template: BuildMappedArray
//
// Purpose: Build a mapping array to handle changes in zone/node numbering
// and order when dealing with variables
......@@ -507,7 +507,7 @@ BuildMappedArray(const iT *const ibuf, int ncomps, const vector<int> &valsToMap)
}
// ****************************************************************************
// Template: ConvertDataSetToFloat
// Template: BuildMappedArray
//
// Purpose: Build a mapping array to handle changes in zone/node numbering
// and order when dealing with variables
......@@ -1581,57 +1581,43 @@ vtkDataSet *ds, int dom)
// Mark C. Miller, Thu Feb 12 02:18:45 PST 2009
// Convert datasets that are intended to be curves but served up as
// non-rectilinear-grid, 1D datasets to correct type.
//
// Mark C. Miller, Mon Nov 9 10:34:15 PST 2009
// Changed name and interface to routine to reflect the fact that it is
// operating on only a single dataset and not a dataset collection as it
// was previously designed. This allows it to be integrated with generic db
// as each dataset is read from a plugin instead of after all datasets have
// been read.
// ****************************************************************************
bool
avtTransformManager::TransformDataset(avtDatasetCollection &dsc,
intVector &domains, avtDataRequest_p &d_spec,
vtkDataSet *
avtTransformManager::TransformSingleDataset(vtkDataSet *ds,
int domain, avtDataRequest_p &d_spec,
avtSourceFromDatabase *src, boolVector &selectionsApplied,
avtDatabaseMetaData *md)
{
const char progressString[256] = "Transforming input data";
bool transformsApplied = false;
src->DatabaseProgress(0, 0, progressString);
for (int i = 0; i < dsc.GetNDomains(); i++)
{
vtkDataSet *dsOrig, *ds;
dsOrig = ds = dsc.GetDataset(i, 0);
src->DatabaseProgress(i, dsc.GetNDomains(), progressString);
if (!ds) continue;
if (!ds) return 0;
TRY
{
ds = CSGToDiscrete(md, d_spec, ds, domains[i]);
// Handle vtkPoints datasets that have points but no cells
ds = AddVertexCellsToPointsOnlyDataset(md, ds, domains[i]);
// Handle 1D datasets as curves (rect grids)
ds = ConvertCurvesToRectGrids(md, ds, domains[i]);
TRY
{
ds = CSGToDiscrete(md, d_spec, ds, domain);
//ds = HangingToConforming(md, d_spec, ds);
// Handle vtkPoints datasets that have points but no cells
ds = AddVertexCellsToPointsOnlyDataset(md, ds, domain);
// old way of "dealing" with polyhedral was to eliminate it
//ds = ElminatePolyhedral(md, d_spec, ds);
// Handle 1D datasets as curves (rect grids)
ds = ConvertCurvesToRectGrids(md, ds, domain);
//ds = PolyhedralToZoo(md, d_spec, ds);
//ds = HangingToConforming(md, d_spec, ds);
ds = NativeToFloat(md, d_spec, ds, domains[i]);
//ds = PolyhedralToZoo(md, d_spec, ds);
if (ds != dsOrig)
{
transformsApplied = true;
dsc.SetDataset(i, 0, ds);
ds->Delete();
}
}
CATCH(PointerNotInCacheException)
{
; // do nothing
}
ENDTRY
ds = NativeToFloat(md, d_spec, ds, domain);
}
CATCH(PointerNotInCacheException)
{
; // do nothing
}
ENDTRY
src->DatabaseProgress(1, 0, progressString);
return transformsApplied;
return ds;
}
......@@ -92,6 +92,10 @@ class avtSourceFromDatabase;
//
// Mark C. Miller, Wed May 6 13:51:05 PDT 2009
// Pass md and dom to AddVertexCellsToPointsOnlyDataset.
//
// Mark C. Miller, Mon Nov 9 10:40:34 PST 2009
// Changed interface to main transform method to operate on a single
// dataset instead of a dataset collection.
// ****************************************************************************
class DATABASE_API avtTransformManager
......@@ -102,8 +106,8 @@ class DATABASE_API avtTransformManager
void FreeUpResources(int lastts);
bool TransformDataset(avtDatasetCollection &ds,
intVector &domains, avtDataRequest_p &spec,
vtkDataSet *TransformSingleDataset(vtkDataSet *ds,
int domain, avtDataRequest_p &spec,
avtSourceFromDatabase *src,
boolVector &selectionsApplied,
avtDatabaseMetaData *md);
......
......@@ -149,9 +149,10 @@ static void AddAle3drlxstatEnumerationInfo(avtScalarMetaData *smd);
static void HandleMrgtreeForMultimesh(DBfile *dbfile, DBmultimesh *mm,
const char *multimesh_name, avtMeshType *mt, int *num_groups,
vector<int> *group_ids, vector<string> *block_names);
vector<int> *group_ids, vector<string> *block_names, int dontForceSingle);
static void BuildDomainAuxiliaryInfoForAMRMeshes(DBfile *dbfile, DBmultimesh *mm,
const char *meshName, int timestate, int type, avtVariableCache *cache);
const char *meshName, int timestate, int type, avtVariableCache *cache,
int dontForceSingle);
static int MultiMatHasAllMatInfo(const DBmultimat *const mm);
......@@ -1470,6 +1471,8 @@ avtSiloFileFormat::ReadTopDirStuff(DBfile *dbfile, const char *dirname,
// Construct avtMeshMetaData object after mrgtree processing b/c this
// may change the mesh type to indicate an AMR mesh.
//
// Mark C. Miller, Mon Nov 9 10:41:48 PST 2009
// Added 'dontForceSingle' to call to HandleMrgtree
// ****************************************************************************
void
avtSiloFileFormat::ReadMultimeshes(DBfile *dbfile,
......@@ -1737,7 +1740,8 @@ avtSiloFileFormat::ReadMultimeshes(DBfile *dbfile,
{
// So far, we've coded only for MRG trees representing AMR hierarchies
HandleMrgtreeForMultimesh(dbfile, mm, multimesh_names[i],
&mt, &num_amr_groups, &amr_group_ids, &amr_block_names);
&mt, &num_amr_groups, &amr_group_ids, &amr_block_names,
dontForceSingle);
}
#endif
#endif
......@@ -7030,6 +7034,9 @@ avtSiloFileFormat::GetMeshHelper(int *_domain, const char *m, DBmultimesh **_mm,
// Mark C. Miller, Tue Nov 18 18:11:56 PST 2008
// Added support for mesh region grouping trees being used to spedify
// AMR representation in Silo.
//
// Mark C. Miller, Mon Nov 9 10:42:13 PST 2009
// Added dontForceSingle to call to BuildDomainAux... for AMR cases.
// ****************************************************************************
vtkDataSet *
......@@ -7057,7 +7064,8 @@ avtSiloFileFormat::GetMesh(int domain, const char *m)
else if (type==DB_QUADMESH || type==DB_QUAD_RECT || type==DB_QUAD_CURV)
{
if (metadata->GetMesh(m)->meshType == AVT_AMR_MESH)
BuildDomainAuxiliaryInfoForAMRMeshes(dbfile, mm, m, timestep, type, cache);
BuildDomainAuxiliaryInfoForAMRMeshes(dbfile, mm, m, timestep, type,
cache, dontForceSingle);
rv = GetQuadMesh(domain_file, directory_mesh, domain);
}
else if (type == DB_POINTMESH)
......@@ -13524,19 +13532,23 @@ avtSiloFileFormat::AddAnnotIntNodelistEnumerations(DBfile *dbfile, avtDatabaseMe
// Hank Childs, Mon May 25 11:26:25 PDT 2009
// Fix macro compilation problem with old versions of Silo.
//
// Mark C. Miller, Mon Nov 9 08:54:28 PST 2009
// Protected calls to DBForceSingle with check for whether plugin is
// actually forcing single precision.
// ****************************************************************************
#ifdef SILO_VERSION_GE
#if SILO_VERSION_GE(4,6,3)
static DBgroupelmap *
GetCondensedGroupelMap(DBfile *dbfile, DBmrgtnode *rootNode)
GetCondensedGroupelMap(DBfile *dbfile, DBmrgtnode *rootNode, int dontForceSingle)
{
int i,j,k,q,pass;
DBgroupelmap *retval = 0;
// We do this to prevent Silo for re-interpreting integer data in
// groupel maps
DBForceSingle(0);
if (dontForceSingle != 0)
DBForceSingle(0);
if (rootNode->num_children == 1 && rootNode->children[0]->narray == 0)
{
......@@ -13638,7 +13650,8 @@ GetCondensedGroupelMap(DBfile *dbfile, DBmrgtnode *rootNode)
}
}
DBForceSingle(1);
if (dontForceSingle == 0)
DBForceSingle(1);
return retval;
}
#endif
......@@ -13662,11 +13675,14 @@ GetCondensedGroupelMap(DBfile *dbfile, DBmrgtnode *rootNode)
// Hank Childs, Mon May 25 11:26:25 PDT 2009
// Fix macro compilation problem with old versions of Silo.
//
// Mark C. Miller, Mon Nov 9 10:43:05 PST 2009
// Added dontForceSingle arg.
// ****************************************************************************
static void
HandleMrgtreeForMultimesh(DBfile *dbfile, DBmultimesh *mm, const char *multimesh_name,
avtMeshType *mt, int *num_groups, vector<int> *group_ids, vector<string> *block_names)
avtMeshType *mt, int *num_groups, vector<int> *group_ids, vector<string> *block_names,
int dontForceSingle)
{
#ifdef SILO_VERSION_GE
#if SILO_VERSION_GE(4,6,3)
......@@ -13723,7 +13739,7 @@ HandleMrgtreeForMultimesh(DBfile *dbfile, DBmultimesh *mm, const char *multimesh
//
// Get level grouping information from the levels subtree
//
DBgroupelmap *lvlgm = GetCondensedGroupelMap(dbfile, levelsNode);
DBgroupelmap *lvlgm = GetCondensedGroupelMap(dbfile, levelsNode, dontForceSingle);
*num_groups = lvlgm->num_segments;
group_ids->resize(mm->nblocks,-1);
for (i = 0; i < lvlgm->num_segments; i++)
......@@ -13864,11 +13880,14 @@ HandleMrgtreeForMultimesh(DBfile *dbfile, DBmultimesh *mm, const char *multimesh
// Hank Childs, Mon May 25 11:26:25 PDT 2009
// Add support for old versions of Silo.
//
// Mark C. Miller, Mon Nov 9 08:54:59 PST 2009
// Protecting calls to DBForceSingle with check to see if plugin is
// really forcing single.
// ****************************************************************************
static void
BuildDomainAuxiliaryInfoForAMRMeshes(DBfile *dbfile, DBmultimesh *mm,
const char *meshName, int timestate, int db_mesh_type,
avtVariableCache *cache)
avtVariableCache *cache, int dontForceSingle)
{
#ifdef MDSERVER
......@@ -13974,7 +13993,7 @@ BuildDomainAuxiliaryInfoForAMRMeshes(DBfile *dbfile, DBmultimesh *mm,
//
// Get level grouping information from tree
//
DBgroupelmap *lvlgm = GetCondensedGroupelMap(dbfile, levelsNode);
DBgroupelmap *lvlgm = GetCondensedGroupelMap(dbfile, levelsNode, dontForceSingle);
num_levels = lvlgm->num_segments;
debug5 << "num_levels = " << num_levels << endl;
vector<int> levelId;
......@@ -14006,16 +14025,18 @@ BuildDomainAuxiliaryInfoForAMRMeshes(DBfile *dbfile, DBmultimesh *mm,
//
// Get Parent/Child maps
//
DBgroupelmap *chldgm = GetCondensedGroupelMap(dbfile, childsNode);
DBgroupelmap *chldgm = GetCondensedGroupelMap(dbfile, childsNode, dontForceSingle);
//
// Read the ratios variable (on the levels) and the parent/child
// map.
//
DBForceSingle(0);
if (dontForceSingle != 0)
DBForceSingle(0);
DBmrgvar *ratvar = DBGetMrgvar(dbfile, ratioVarName.c_str());
DBmrgvar *ijkvar = DBGetMrgvar(dbfile, ijkExtsVarName.c_str());
DBForceSingle(1);
if (dontForceSingle == 0)
DBForceSingle(1);
//
// The number of patches can be inferred from the size of the child groupel map.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment