Commit a0484d78 authored by hrchilds's avatar hrchilds
Browse files

Update from April 21, 2005

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@453 18c085ea-50e0-402c-830e-de6fd14e8384
parent deb51b99
......@@ -3610,6 +3610,9 @@ avtGenericDatabase::AddOriginalNodesArray(vtkDataSet *ds, const int domain)
// Hank Childs, Thu Mar 10 16:48:19 PST 2005
// Fix memory leak with boundary plots.
//
// Mark C. Miller, Thu Apr 21 09:37:41 PDT 2005
// Made error message a little clearer
//
// ****************************************************************************
avtDataTree_p
......@@ -3636,8 +3639,11 @@ avtGenericDatabase::MaterialSelect(vtkDataSet *ds, avtMaterial *mat,
if (mat == NULL || ds == NULL || mat->GetNZones() !=ds->GetNumberOfCells())
{
EXCEPTION1(InvalidDBTypeException, "The material object and dataset "
"object are different sizes.");
char msg[128];
SNPRINTF(msg,sizeof(msg),"The material object with nzones=%d and dataset "
"object with ncells=%d do not agree.", mat->GetNZones(),
ds->GetNumberOfCells());
EXCEPTION1(InvalidDBTypeException, msg);
}
//
......@@ -5836,6 +5842,8 @@ avtGenericDatabase::CommunicateGhostNodesFromDomainBoundariesFromFile(
// Hank Childs, Mon Apr 4 13:21:09 PDT 2005
// Fix problem where curDisp was being deleted twice in parallel.
//
// Mark C. Miller, Thu Apr 21 09:37:41 PDT 2005
// Fixed leak for 'ln' object
// ****************************************************************************
bool
......@@ -5895,6 +5903,7 @@ avtGenericDatabase::CommunicateGhostZonesFromGlobalNodeIds(
ptr[j] = j;
ln->SetName("avtOriginalNodeId");
copy->GetPointData()->AddArray(ln);
ln->Delete();
vtkUnstructuredGridFacelistFilter *ff =
vtkUnstructuredGridFacelistFilter::New();
ff->SetInput(copy);
......
......@@ -2337,6 +2337,9 @@ avtCurvilinearDomainBoundaries::ExchangeMesh(vector<int> domainNum,
// Mark C. Miller, Mon Jan 12 19:21:22 PST 2004
// Added check and exception for wrong VTK grid type
//
// Mark C. Miller, Thu Apr 21 09:37:41 PDT 2005
// Fixed leak for coord arrays
//
// ****************************************************************************
vector<vtkDataSet*>
......@@ -2415,6 +2418,8 @@ avtRectilinearDomainBoundaries::ExchangeMesh(vector<int> domainNum,
out[d] = outm;
}
bhf_float->FreeBoundaryData(coord);
return out;
}
......
......@@ -109,6 +109,9 @@ avtMatvfFilter::PreExecute(void)
// Kathleen Bonnell, Mon Jun 28 07:48:55 PDT 2004
// Send currentTimeState to GetMaterial.
//
// Mark C. Miller, Thu Apr 21 09:37:41 PDT 2005
// Fixed memory leak caused by cut-n-paste error
//
// ****************************************************************************
vtkDataArray *
......@@ -145,7 +148,6 @@ avtMatvfFilter::DeriveVariable(vtkDataSet *in_ds)
// of cells in the input, depending on whether or not we did MIR.
//
vtkFloatArray *vf_for_orig_cells = vtkFloatArray::New();
vf_for_orig_cells = vtkFloatArray::New();
int norigcells = mat->GetNZones();
vf_for_orig_cells->SetNumberOfTuples(norigcells);
......
......@@ -87,5 +87,5 @@ MILI_DIR=/usr/gapps/visit/mili/current/linux_rhel3_gcc_3.2.3
##
## Silo
##
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/lib
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/lib
......@@ -87,5 +87,5 @@ MILI_DIR=/usr/gapps/visit/mili/current/linux_rhel3_gcc_3.2.3
##
## Silo
##
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/lib
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/lib
......@@ -87,5 +87,5 @@ MILI_DIR=/usr/gapps/visit/mili/current/linux_rhel3_gcc_3.2.3
##
## Silo
##
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/lib
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/lib
......@@ -87,5 +87,5 @@ MILI_DIR=/usr/gapps/visit/mili/current/linux_rhel3_gcc_3.2.3
##
## Silo
##
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/lib
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/lib
......@@ -87,5 +87,5 @@ MILI_DIR=/usr/gapps/visit/mili/current/linux_rhel3_gcc_3.2.3
##
## Silo
##
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.2/linux_rhel3_gcc_3.2.3/lib
DEFAULT_SILO_INCLUDES=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/include
DEFAULT_SILO_LIBRARY=/usr/gapps/silo/4.4.3-pre1/linux_rhel3_gcc_3.2.3/lib
......@@ -1320,6 +1320,13 @@ vtkDataArray *vtkExodusReader::ReadPointDataVector(int exoid, int startIdx,
//----------------------------------------------------------------------------
// Read the first three vectors and put in vectors as displacement.
//
// Modifications:
//
// Mark C. Miller, Thu Apr 21 09:37:41 PDT 2005
// Fixed off-by-one error in indexing the truth table
//
//----------------------------------------------------------------------------
vtkDataArray *vtkExodusReader::ReadCellDataArray(int exoid, int varIndex)
{
int error, idx, blockIdx, num;
......@@ -1351,7 +1358,7 @@ vtkDataArray *vtkExodusReader::ReadCellDataArray(int exoid, int varIndex)
continue;
}
int index = blockIdx*this->CellDataArrayLength + varIndex;
if (this->CellVarTruthTable->GetValue(index) == 0)
if (this->CellVarTruthTable->GetValue(index-1) == 0)
{
for (idx = 0; idx < num; ++idx)
{
......
......@@ -6420,6 +6420,9 @@ avtSiloFileFormat::CalcSpecies(DBfile *dbfile, char *specname)
// Hank Childs, Mon Dec 9 13:21:13 PST 2002
// Use the facelist's origin rather than the unstructured meshes.
//
// Mark C. Miller, Thu Apr 21 09:37:41 PDT 2005
// Freed ucdmesh prior to early return for null facelist
//
// ****************************************************************************
avtFacelist *
......@@ -6444,6 +6447,7 @@ avtSiloFileFormat::CalcExternalFacelist(DBfile *dbfile, char *mesh)
//
// There is no facelist object, this may be an interior block.
//
DBFreeUcdmesh(um);
return NULL;
}
......
......@@ -65,6 +65,10 @@ typedef struct VisIt_MeshMetaData
int *groupIds;
const char *units;
const char *xLabel;
const char *yLabel;
const char *zLabel;
} VisIt_MeshMetaData;
typedef struct VisIt_ScalarMetaData
......@@ -78,10 +82,10 @@ typedef struct VisIt_ScalarMetaData
typedef struct VisIt_MaterialMetaData
{
const char *name;
const char *meshName;
int numMaterials;
const char *materialNames[];
const char *name;
const char *meshName;
int numMaterials;
const char **materialNames;
} VisIt_MaterialMetaData;
typedef struct VisIt_CurveMetaData
......@@ -90,6 +94,9 @@ typedef struct VisIt_CurveMetaData
const char *xUnits;
const char *yUnits;
const char *xLabel;
const char *yLabel;
} VisIt_CurveMetaData;
typedef struct VisIt_ExpressionMetaData
......@@ -175,7 +182,18 @@ typedef struct VisIt_MixedScalarData
typedef struct VisIt_MaterialData
{
/* FILL IN */
int nMaterials;
int *materialNumbers;
const char **materialNames;
int nzones;
int *matlist;
int mixlen;
int *mix_mat;
int *mix_zone;
int *mix_next;
float *mix_vf;
} VisIt_MaterialData;
typedef struct VisIt_CurveData
......
......@@ -19,6 +19,8 @@
#include <vtkRectilinearGrid.h>
#include <vtkStructuredGrid.h>
#include <vtkUnstructuredGrid.h>
#include <vtkCellArray.h>
#include <vtkPolyData.h>
using std::string;
using std::vector;
......@@ -130,6 +132,10 @@ avtSimV1FileFormat::FreeUpResources(void)
// Programmer: Jeremy Meredith
// Creation: March 14, 2005
//
// Modifications:
// Jeremy Meredith, Thu Apr 14 16:48:04 PDT 2005
// Fixed groups. Added curves and materials.
//
// ****************************************************************************
void
......@@ -190,10 +196,22 @@ avtSimV1FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
if (mesh->numGroups > 0 && mmd->groupPieceName)
mesh->groupPieceName = mmd->groupPieceName;
// FILL IN GROUP NAME STUFF
vector<int> groupIds(mesh->numGroups);
mesh->groupIds.resize(mesh->numGroups);
for (int g = 0; g<mesh->numGroups; g++)
{
mesh->groupIds[g] = mmd->groupIds[g];
}
mesh->xLabel = mmd->xLabel ? mmd->xLabel : "";
mesh->yLabel = mmd->yLabel ? mmd->yLabel : "";
mesh->zLabel = mmd->zLabel ? mmd->zLabel : "";
// OH, and units too; in fact, double check everything
if (mmd->units)
{
mesh->xUnits = mmd->units;
mesh->yUnits = mmd->units;
mesh->zUnits = mmd->units;
}
md->Add(mesh);
}
......@@ -225,8 +243,6 @@ avtSimV1FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
//md->Add(scalar);
}
md->Print(cout);
for (int c=0; c<vsmd->numCommands; c++)
{
VisIt_SimulationControlCommand *scc = &vsmd->commands[c];
......@@ -258,7 +274,46 @@ avtSimV1FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
md->SetSimInfo(simInfo);
}
// DO THE MATERIALS, EXPRESSIONS, CURVES, ETC.
for (int mat=0; mat<vsmd->numMaterials; mat++)
{
VisIt_MaterialMetaData *mmd = &vsmd->materials[mat];
avtMaterialMetaData *material = new avtMaterialMetaData;
material->name = mmd->name;
material->originalName = mmd->name;
material->meshName = mmd->meshName;
material->numMaterials = mmd->numMaterials;
material->materialNames.clear();
for (int m = 0; m < material->numMaterials; m++)
{
material->materialNames.push_back(mmd->materialNames[m]);
}
md->Add(material);
}
for (int cc=0; cc<vsmd->numCurves; cc++)
{
VisIt_CurveMetaData *cmd = &vsmd->curves[cc];
avtCurveMetaData *curve = new avtCurveMetaData;
curve->name = cmd->name;
curve->originalName = cmd->name;
if (cmd->xUnits)
curve->xUnits = cmd->xUnits;
if (cmd->yUnits)
curve->yUnits = cmd->yUnits;
if (cmd->xLabel)
curve->xLabel = cmd->xLabel;
if (cmd->yLabel)
curve->yLabel = cmd->yLabel;
curveMeshes.insert(curve->name);
md->Add(curve);
}
md->Print(cout);
// DO THE EXPRESSIONS, ETC.
#endif
}
......@@ -280,6 +335,10 @@ avtSimV1FileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
// Programmer: Jeremy Meredith
// Creation: March 14, 2005
//
// Modifications:
// Jeremy Meredith, Thu Apr 21 09:26:12 PDT 2005
// Added rectilinear and fixed curvilinear support.
//
// ****************************************************************************
vtkDataSet *
avtSimV1FileFormat::GetMesh(int domain, const char *meshname)
......@@ -287,6 +346,12 @@ avtSimV1FileFormat::GetMesh(int domain, const char *meshname)
#ifdef MDSERVER
return NULL;
#else
if (curveMeshes.count(meshname))
{
return GetCurve(meshname);
}
if (!cb.GetMesh)
return NULL;
......@@ -327,9 +392,9 @@ avtSimV1FileFormat::GetMesh(int domain, const char *meshname)
{
for (int k=0; k<nk; k++)
{
pts[npts*3 + 0] = cmesh->xcoords[i];
pts[npts*3 + 1] = cmesh->ycoords[j];
pts[npts*3 + 2] = cmesh->zcoords[k];
pts[npts*3 + 0] = cmesh->xcoords[npts];
pts[npts*3 + 1] = cmesh->ycoords[npts];
pts[npts*3 + 2] = cmesh->zcoords[npts];
npts++;
}
}
......@@ -338,6 +403,63 @@ avtSimV1FileFormat::GetMesh(int domain, const char *meshname)
return sgrid;
}
break;
case VISIT_MESHTYPE_RECTILINEAR:
{
VisIt_RectilinearMesh *rmesh = vmesh->rmesh;
//
// Create the VTK objects and connect them up.
//
vtkRectilinearGrid *rgrid = vtkRectilinearGrid::New();
//
// Tell the grid what its dimensions are and populate the points array.
//
rgrid->SetDimensions(rmesh->dims);
//
// Populate the coordinates.
//
int ni = rmesh->dims[0];
int nj = rmesh->dims[1];
int nk = rmesh->dims[2];
// USE THE BASEINDEX AND REAL/GHOST ZONE STUFF!
vtkFloatArray *xcoords;
vtkFloatArray *ycoords;
vtkFloatArray *zcoords;
xcoords = vtkFloatArray::New();
xcoords->SetNumberOfTuples(ni);
for (int i=0; i<ni; i++)
{
xcoords->SetComponent(i, 0, rmesh->xcoords[i]);
}
ycoords = vtkFloatArray::New();
ycoords->SetNumberOfTuples(nj);
for (int j=0; j<nj; j++)
{
ycoords->SetComponent(j, 0, rmesh->ycoords[j]);
}
zcoords = vtkFloatArray::New();
zcoords->SetNumberOfTuples(nk);
for (int k=0; k<nk; k++)
{
zcoords->SetComponent(k, 0, rmesh->zcoords[k]);
}
rgrid->SetXCoordinates(xcoords);
xcoords->Delete();
rgrid->SetYCoordinates(ycoords);
ycoords->Delete();
rgrid->SetZCoordinates(zcoords);
zcoords->Delete();
return rgrid;
}
break;
default:
EXCEPTION1(ImproperUseException,
"Only curvilinear meshes are currently supported.\n");
......@@ -415,3 +537,136 @@ avtSimV1FileFormat::GetVectorVar(int domain, const char *varname)
{
return NULL;
}
// ****************************************************************************
// Method: avtSimV1FileFormat::GetAuxiliaryData
//
// Purpose:
// Get auxiliary data. E.g. material, species.
//
// Arguments:
// var variable name
// domain the domain
// type the type of auxiliary data
// df (out) the destructor
//
// Programmer: Jeremy Meredith
// Creation: April 11, 2005
//
// ****************************************************************************
void *
avtSimV1FileFormat::GetAuxiliaryData(const char *var, int domain,
const char *type, void *, DestructorFunction &df)
{
void *rv = NULL;
if (strcmp(type, AUXILIARY_DATA_MATERIAL) == 0)
{
rv = (void *) GetMaterial(domain, var);
df = avtMaterial::Destruct;
}
/*
else if (strcmp(type, AUXILIARY_DATA_SPECIES) == 0)
{
rv = (void *) GetSpecies(domain, var);
df = avtSpecies::Destruct;
}
*/
//
// Note -- may want to do mixed variables here
//
return rv;
}
// ****************************************************************************
// Method: avtSimV1FileFormat::GetMaterial
//
// Purpose:
// Return a material for a domain.
//
// Arguments:
// domain The index of the domain. If there are NDomains, this
// value is guaranteed to be between 0 and NDomains-1,
// regardless of block origin.
// varname The name of the material variable requested.
//
// Programmer: Jeremy Meredith
// Creation: April 11, 2005
//
// ****************************************************************************
avtMaterial *
avtSimV1FileFormat::GetMaterial(int domain, const char *varname)
{
if (!cb.GetMaterial)
return NULL;
VisIt_MaterialData *md = cb.GetMaterial(domain,varname);
if (!md)
return NULL;
vector<string> matNames(md->nMaterials);
for (int m=0; m<md->nMaterials; m++)
matNames[m] = md->materialNames[m];
avtMaterial *mat = new avtMaterial(md->nMaterials,
matNames,
md->nzones,
md->matlist,
md->mixlen,
md->mix_mat,
md->mix_next,
md->mix_zone,
md->mix_vf);
return mat;
}
// ****************************************************************************
// Method: avtSimV1FileFormat::GetMaterial
//
// Purpose:
// Return a curve by name.
//
// Arguments:
// varname The name of the curve requested.
//
// Programmer: Jeremy Meredith
// Creation: April 14, 2005
//
// ****************************************************************************
vtkDataSet *
avtSimV1FileFormat::GetCurve(const char *name)
{
if (!cb.GetCurve)
return NULL;
VisIt_CurveData *cd = cb.GetCurve(name);
if (!cd)
return NULL;
vtkPolyData *pd = vtkPolyData::New();
vtkPoints *pts = vtkPoints::New();
pd->SetPoints(pts);
int npts = cd->len;
pts->SetNumberOfPoints(npts);
for (int j=0; j<npts; j++)
{
pts->SetPoint(j, cd->x[j], cd->y[j], 0);
}
vtkCellArray *line = vtkCellArray::New();
pd->SetLines(line);
for (int k = 1 ; k < npts ; k++)
{
line->InsertNextCell(2);
line->InsertCellPoint(k-1);
line->InsertCellPoint(k);
}
pts->Delete();
line->Delete();
return pd;
}
......@@ -10,9 +10,11 @@
#include <avtSTMDFileFormat.h>
#include <VisItDataInterface_V1.h>
#include <avtSimulationInformation.h>
#include <avtMaterial.h>
#include <vector>
#include <set>
#include <string>
// ****************************************************************************
// Class: avtSimV1FileFormat
......@@ -24,6 +26,10 @@
// Programmer: Jeremy Meredith
// Creation: March 10, 2005
//
// Modifications:
// Jeremy Meredith, Thu Apr 14 16:47:07 PDT 2005
// Added Curve and Material support.
//
// ****************************************************************************
class avtSimV1FileFormat : public avtSTMDFileFormat
......@@ -39,10 +45,17 @@ class avtSimV1FileFormat : public avtSTMDFileFormat
virtual vtkDataSet *GetMesh(int, const char *);
virtual vtkDataArray *GetVar(int, const char *);
virtual vtkDataArray *GetVectorVar(int, const char *);
virtual avtMaterial *GetMaterial(int, const char *);
virtual vtkDataSet *GetCurve(const char *);
virtual void *GetAuxiliaryData(const char *var, int domain,
const char *type, void *,
DestructorFunction &df);
protected:
avtSimulationInformation simInfo;
VisIt_SimulationCallback cb;
std::set<std::string> curveMeshes;
virtual void PopulateDatabaseMetaData(avtDatabaseMetaData *);
};
......
......@@ -427,6 +427,11 @@ avtTecplotFileFormat::ParseElements(int numElements, const string &elemType)
// Programmer: Jeremy Meredith
// Creation: December 10, 2004
//
// Modifications:
//
// Mark C. Miller, Thu Apr 21 09:37:41 PDT 2005
// Fixed leak for 1D case
//
// ****************************************************************************