Commit 03c1da60 authored by hrchilds's avatar hrchilds

Update from March 1, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@187 18c085ea-50e0-402c-830e-de6fd14e8384
parent c80be709
......@@ -71,10 +71,14 @@ void CheckPermissions(const char *);
// Hank Childs, Thu Feb 19 08:00:35 PST 2004
// Allow for exact filenames in addition to default extensions.
//
// Hank Childs, Mon Mar 1 08:56:52 PST 2004
// Allow for the time to be specified.
//
// ****************************************************************************
avtDatabase *
avtDatabaseFactory::FileList(const char * const * filelist, int filelistN)
avtDatabaseFactory::FileList(const char * const * filelist, int filelistN,
int timestep)
{
int i, j;
......@@ -184,7 +188,7 @@ avtDatabaseFactory::FileList(const char * const * filelist, int filelistN)
// ask for it in a bit anyway.
//
if (rv != NULL)
rv->GetMetaData(0);
rv->GetMetaData(timestep);
}
CATCH2(InvalidDBTypeException, e)
{
......@@ -214,7 +218,7 @@ avtDatabaseFactory::FileList(const char * const * filelist, int filelistN)
// make the same call here to be consistent.
//
if (rv != NULL)
rv->GetMetaData(0);
rv->GetMetaData(timestep);
}
else
{
......@@ -262,10 +266,13 @@ avtDatabaseFactory::FileList(const char * const * filelist, int filelistN)
// timestep files if they are relative. The engine was crashing on Windows
// because it did not know where to get the timestep files.
//
// Hank Childs, Mon Mar 1 08:56:52 PST 2004
// Allow for the time to be specified.
//
// ****************************************************************************
avtDatabase *
avtDatabaseFactory::VisitFile(const char *visitFile)
avtDatabaseFactory::VisitFile(const char *visitFile, int timestep)
{
//
// Make sure we can read the file before we proceed.
......@@ -319,7 +326,7 @@ avtDatabaseFactory::VisitFile(const char *visitFile)
//
// Create a database using the list of files.
//
avtDatabase *rv = FileList(reallist, listcount);
avtDatabase *rv = FileList(reallist, listcount, timestep);
//
// Clean up memory
......
......@@ -43,13 +43,16 @@ class avtDatabase;
// Jeremy Meredith, Tue Aug 27 15:08:29 PDT 2002
// Removed all formats and placed them in database plugins.
//
// Hank Childs, Mon Mar 1 08:48:26 PST 2004
// Added the timestep as an argument.
//
// ****************************************************************************
class DATABASE_API avtDatabaseFactory
{
public:
static avtDatabase *FileList(const char * const *, int);
static avtDatabase *VisitFile(const char *);
static avtDatabase *FileList(const char * const *, int, int);
static avtDatabase *VisitFile(const char *, int);
};
......
......@@ -511,6 +511,58 @@ avtDataAttributes::GetSpatialExtents(double *buff)
return false;
}
// ****************************************************************************
// Method: avtDataAttributes::GetAnySpatialExtents
//
// Purpose:
// Gets any spatial extents for the data object if any exists starting
// with most useful to least useful
//
// Arguments:
// buff A buffer to copy the extents into.
//
// Returns: true if it found some good extents, false otherwise.
//
// Programmer: Mark C. Miller
// Creation: February 29, 2004
//
// ****************************************************************************
bool
avtDataAttributes::GetAnySpatialExtents(double *buff)
{
if (trueSpatial->HasExtents())
{
trueSpatial->CopyTo(buff);
return true;
}
if (cumulativeTrueSpatial->HasExtents())
{
cumulativeTrueSpatial->CopyTo(buff);
return true;
}
if (currentSpatial->HasExtents())
{
currentSpatial->CopyTo(buff);
return true;
}
if (cumulativeCurrentSpatial->HasExtents())
{
cumulativeCurrentSpatial->CopyTo(buff);
return true;
}
if (effectiveSpatial->HasExtents())
{
effectiveSpatial->CopyTo(buff);
return true;
}
return false;
}
// ****************************************************************************
// Method: avtDataAttributes::GetDataExtents
......@@ -1021,11 +1073,11 @@ avtDataAttributes::Read(char *input)
memcpy(&tmp, input, sizeof(int));
input += sizeof(int); size += sizeof(int);
canUseTransform = (tmp != 0 ? true : false);
SetCanUseTransform(tmp != 0 ? true : false);
memcpy(&tmp, input, sizeof(int));
input += sizeof(int); size += sizeof(int);
canUseCummulativeAsTrueOrCurrent = (tmp != 0 ? true : false);
SetCanUseCummulativeAsTrueOrCurrent(tmp != 0 ? true : false);
memcpy(&tmp, input, sizeof(int));
input += sizeof(int); size += sizeof(int);
......
......@@ -105,6 +105,9 @@ class avtExtents;
// Mark C. Miller, Thu Jan 29 17:31:20 PST 2004
// Added bools to Merge method to control ignoring certain attributes
//
// Mark C. Miller, Sun Feb 29 18:35:00 PST 2004
// Added GetAnySpatialExtents method
//
// ****************************************************************************
class PIPELINE_API avtDataAttributes
......@@ -196,6 +199,7 @@ class PIPELINE_API avtDataAttributes
bool GetCurrentDataExtents(double *);
bool GetSpatialExtents(double *);
bool GetCurrentSpatialExtents(double *);
bool GetAnySpatialExtents(double *);
void SetLabels(const std::vector<std::string> &l);
void GetLabels(std::vector<std::string> &l);
......
......@@ -679,6 +679,9 @@ avtMapper::GetRange(float &rmin, float &rmax)
// Hank Childs, Fri Mar 15 18:11:12 PST 2002
// Account for dataset examiner.
//
// Mark C. Miller, Sun Feb 29 18:35:00 PST 2004
// Added calls to GetAnySpatialExtents before arbitrarily setting to [0,1]
//
// ****************************************************************************
void
......@@ -727,10 +730,13 @@ avtMapper::PrepareExtents(void)
{
if (!(avtDatasetExaminer::GetSpatialExtents(input, bounds)))
{
for (int i = 0 ; i < 3 ; i++)
if (!atts.GetAnySpatialExtents(bounds))
{
bounds[2*i] = 0.;
bounds[2*i+1] = 1.;
for (int i = 0 ; i < 3 ; i++)
{
bounds[2*i] = 0.;
bounds[2*i+1] = 1.;
}
}
}
}
......
......@@ -261,6 +261,9 @@ NetworkManager::ClearNetworksWithDatabase(const std::string &db)
// Hank Childs, Mon Jan 5 16:49:28 PST 2004
// Do not assume that all of the cached databases are non-NULL.
//
// Hank Childs, Mon Mar 1 08:48:26 PST 2004
// Send the time to the database factory as well.
//
// ****************************************************************************
NetnodeDB *
......@@ -314,9 +317,9 @@ NetworkManager::GetDBFromCache(const string &filename, int time)
NetnodeDB *netDB = NULL;
const char *filename_c = filename.c_str();
if (filename.substr(filename.length() - 6) == ".visit")
db = avtDatabaseFactory::VisitFile(filename_c);
db = avtDatabaseFactory::VisitFile(filename_c, time);
else
db = avtDatabaseFactory::FileList(&filename_c, 1);
db = avtDatabaseFactory::FileList(&filename_c, 1, time);
// If we want to open the file at a later timestep, get the
// SIL so that it contains the right data.
......@@ -551,6 +554,9 @@ NetworkManager::StartNetwork(const string &filename, const string &var,
// Hank Childs, Mon Jan 5 16:49:28 PST 2004
// Account for databases in the cached lists that have been cleared.
//
// Hank Childs, Mon Mar 1 08:48:26 PST 2004
// Send the time to the database factory as well.
//
// ****************************************************************************
void
NetworkManager::DefineDB(const string &dbName, const string &dbPath,
......@@ -643,7 +649,8 @@ NetworkManager::DefineDB(const string &dbName, const string &dbPath,
names = new const char *[filesWithPath.size()];
for(int i = 0; i < filesWithPath.size(); ++i)
names[i] = filesWithPath[i].c_str();
db = avtDatabaseFactory::FileList(names, filesWithPath.size());
db = avtDatabaseFactory::FileList(names, filesWithPath.size(),
time);
delete [] names;
names = 0;
......@@ -653,9 +660,9 @@ NetworkManager::DefineDB(const string &dbName, const string &dbPath,
<< "definition for " << dbName.c_str() << endl;
}
else if (dbName.substr(dbName.length() - 6) == ".visit")
db = avtDatabaseFactory::VisitFile(dbName_c);
db = avtDatabaseFactory::VisitFile(dbName_c, time);
else
db = avtDatabaseFactory::FileList(&dbName_c, 1);
db = avtDatabaseFactory::FileList(&dbName_c, 1, time);
// If we want to open the file at a later timestep, get the
// metadata and the SIL so that it contains the right data.
......
......@@ -1685,6 +1685,9 @@ MDServerConnection::GetVirtualFileDefinition(const std::string &file)
// does NOT have invariant metadata, then metadata at a different time
// step can be correctly read without having to close and re-open.
//
// Hank Childs, Mon Mar 1 08:48:26 PST 2004
// Set the time state to the database factory.
//
// ****************************************************************************
avtDatabase *
......@@ -1739,7 +1742,8 @@ MDServerConnection::GetDatabase(string file, int timeState)
TRY
{
// Try and make a database out of the filenames.
currentDatabase = avtDatabaseFactory::FileList(names, fileNames.size());
currentDatabase = avtDatabaseFactory::FileList(names,
fileNames.size(), timeState);
// Free the memory that we used.
for(i = 0; i < fileNames.size(); ++i)
......@@ -1761,11 +1765,11 @@ MDServerConnection::GetDatabase(string file, int timeState)
}
else if (strstr(fn, ".visit") != NULL)
{
currentDatabase = avtDatabaseFactory::VisitFile(fn);
currentDatabase = avtDatabaseFactory::VisitFile(fn, timeState);
}
else
{
currentDatabase = avtDatabaseFactory::FileList(&fn, 1);
currentDatabase = avtDatabaseFactory::FileList(&fn, 1, timeState);
}
visitTimer->StopTimer(timeid, timerMessage);
......
......@@ -23,7 +23,9 @@
#include <vtkUniqueFeatureEdges.h>
#include <vtkUnstructuredGrid.h>
#include <avtDataAttributes.h>
#include <avtDatasetExaminer.h>
#include <avtExtents.h>
#include <InvalidDimensionsException.h>
#include <InvalidLimitsException.h>
......@@ -44,6 +46,9 @@
// Kathleen Bonnell, Tue Oct 2 17:34:53 PDT 2001
// Intialize new members.
//
// Mark C. Miller Sun Feb 29 18:08:26 PST 2004
// Initialize zValMin and zValMax
//
// ****************************************************************************
avtSurfaceFilter::avtSurfaceFilter(const AttributeGroup *a)
......@@ -68,6 +73,8 @@ avtSurfaceFilter::avtSurfaceFilter(const AttributeGroup *a)
max = -1;
Ms = 1.;
Bs = 0.;
zValMin = 0;
zValMax = 0;
}
......@@ -204,6 +211,9 @@ avtSurfaceFilter::Equivalent(const AttributeGroup *a)
// Kathleen Bonnell, Fri Oct 10 10:48:24 PDT 2003
// Preserve original-cell information if present in input dataset.
//
// Mark C. Miller, Sun Feb 29 18:08:26 PST 2004
// Added code to compute zValMin and zValMax
//
// ****************************************************************************
vtkDataSet *
......@@ -258,6 +268,7 @@ avtSurfaceFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
int numScalars = inScalars->GetNumberOfTuples();
outScalars->SetNumberOfTuples(numScalars);
zValMin = zValMax = inScalars->GetTuple1(0);
for (int i = 0; i < numScalars; i++)
{
// calculate and store zVals
......@@ -282,6 +293,12 @@ avtSurfaceFilter::ExecuteData(vtkDataSet *inDS, int, std::string)
zVal = SkewTheValue(zVal);
}
zVal = Ms * zVal + Bs;
if (zVal > zValMax)
zValMax = zVal;
else if (zVal < zValMin)
zValMin = zVal;
outScalars->SetValue(i, zVal);
}
......@@ -516,15 +533,30 @@ avtSurfaceFilter::PreExecute(void)
//
// Modifications:
//
// Mark C. Miller, Sun Feb 29 17:52:19 PST 2004
// Added code to update output spatial extents from knowledge of input
// spatial extents and output zValMin and zValMax
//
// ****************************************************************************
void
avtSurfaceFilter::PostExecute(void)
{
avtDataAttributes& outAtts = GetOutput()->GetInfo().GetAttributes();
// Create a transform that will drop the z-coordinate created by
// this filter.
double tform[16] = {1.,0.,0.,0.,0.,1.,0.,0.,0.,0.,0.,0.,0.,0.,0.,1.};
GetOutput()->GetInfo().GetAttributes().SetTransform(tform);
outAtts.SetTransform(tform);
// get the input's spatial extents
double se[6];
GetInput()->GetInfo().GetAttributes().GetSpatialExtents(se);
// over-write z-spatial extents with our known data extents
se[4] = zValMin;
se[5] = zValMax;
outAtts.GetTrueSpatialExtents()->Set(se);
}
......
......@@ -47,6 +47,9 @@ class vtkGeometryFilter;
// Kathleen Bonnell, Fri Oct 10 10:48:24 PDT 2003
// Added PostExecute.
//
// Mark C. Miller, Sun Feb 29 18:08:26 PST 2004
// Added zValMin, zValMax data members
//
// ****************************************************************************
class avtSurfaceFilter : public avtStreamer
......@@ -75,6 +78,8 @@ class avtSurfaceFilter : public avtStreamer
double max;
double Ms;
double Bs;
double zValMin;
double zValMax;
bool stillNeedExtents;
double SkewTheValue(const double);
......
......@@ -27,6 +27,11 @@ static void UsageAndExit(const char *);
// Programmer: Hank Childs
// Creation: September 9, 2003
//
// Modifications:
//
// Hank Childs, Mon Mar 1 09:08:11 PST 2004
// Send timestep to database factory.
//
// ****************************************************************************
int main(int argc, char *argv[])
......@@ -99,9 +104,9 @@ int main(int argc, char *argv[])
//
avtDatabase *db = NULL;
if (strstr(argv[1], ".visit") != NULL)
db = avtDatabaseFactory::VisitFile(argv[1]);
db = avtDatabaseFactory::VisitFile(argv[1], 0);
else
db = avtDatabaseFactory::FileList(argv+1, 1);
db = avtDatabaseFactory::FileList(argv+1, 1, 0);
//
// Figure out which mesh to operate on.
......
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