Commit 1bf53ede authored by hrchilds's avatar hrchilds

Update from May 6, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@236 18c085ea-50e0-402c-830e-de6fd14e8384
parent 86767b05
......@@ -6,11 +6,11 @@
<Field name="cloneWindowOnFirstRef" type="bool">true</Field>
</Object>
<Object name="PluginManagerAttributes" childObjects="0">
<Field name="name" type="stringVector">Streamline InverseGhostZone </Field>
<Field name="type" type="stringVector">plot operator </Field>
<Field name="version" type="stringVector">1.0 1.0 </Field>
<Field name="id" type="stringVector">Streamline_1.0 InverseGhostZone_1.0 </Field>
<Field name="enabled" type="intVector">0 0 </Field>
<Field name="name" type="stringVector">Streamline Displace InverseGhostZone </Field>
<Field name="type" type="stringVector">plot operator operator </Field>
<Field name="version" type="stringVector">1.0 1.0 1.0 </Field>
<Field name="id" type="stringVector">Streamline_1.0 Displace_1.0 InverseGhostZone_1.0 </Field>
<Field name="enabled" type="intVector">0 0 0 </Field>
</Object>
<Object name="HostProfileList" childObjects="31">
<Object name="HostProfile" childObjects="0">
......
......@@ -6,11 +6,11 @@
<Field name="cloneWindowOnFirstRef" type="bool">true</Field>
</Object>
<Object name="PluginManagerAttributes" childObjects="0">
<Field name="name" type="stringVector">Streamline InverseGhostZone </Field>
<Field name="type" type="stringVector">plot operator </Field>
<Field name="version" type="stringVector">1.0 1.0 </Field>
<Field name="id" type="stringVector">Streamline_1.0 InverseGhostZone_1.0 </Field>
<Field name="enabled" type="intVector">0 0 </Field>
<Field name="name" type="stringVector">Streamline Displace InverseGhostZone </Field>
<Field name="type" type="stringVector">plot operator operator </Field>
<Field name="version" type="stringVector">1.0 1.0 1.0 </Field>
<Field name="id" type="stringVector">Streamline_1.0 Displace_1.0 InverseGhostZone_1.0 </Field>
<Field name="enabled" type="intVector">0 0 0 </Field>
</Object>
<Object name="HostProfileList" childObjects="21">
<Object name="HostProfile" childObjects="0">
......
......@@ -65,6 +65,9 @@ avtVectorComposeFilter::~avtVectorComposeFilter()
// Hank Childs, Thu Feb 26 09:00:06 PST 2004
// Account for multiple variables.
//
// Hank Childs, Thu May 6 10:49:32 PDT 2004
// Make sure that we are getting the dimension for the active variable.
//
// ****************************************************************************
int
......@@ -77,7 +80,7 @@ avtVectorComposeFilter::GetVariableDimension(void)
if (!atts.ValidVariable(activeVariable))
return 3;
int inDim = atts.GetVariableDimension();
int inDim = atts.GetVariableDimension(activeVariable);
if (inDim == 1)
return 3;
else if (inDim == 3)
......
......@@ -64,6 +64,9 @@ avtVectorDecomposeFilter::~avtVectorDecomposeFilter()
// Hank Childs, Thu Feb 26 09:00:06 PST 2004
// Account for multiple variables.
//
// Hank Childs, Thu May 6 10:49:32 PDT 2004
// Make sure that we are getting the dimension for the active variable.
//
// ****************************************************************************
int
......@@ -76,7 +79,7 @@ avtVectorDecomposeFilter::GetVariableDimension(void)
if (!atts.ValidVariable(activeVariable))
return 1;
int inDim = atts.GetVariableDimension();
int inDim = atts.GetVariableDimension(activeVariable);
if (inDim == 9)
return 3;
else if (inDim == 3)
......
This diff is collapsed.
......@@ -35,6 +35,28 @@ struct CellMatInfo
: name(n), matno(mn), vf(v), mix_index(mi) { }
};
// ****************************************************************************
// Class: MatZoneMap
//
// Purpose:
// For a given material, holds list of clean zones, a list of mixed zones
// and for the list of mixed zones, the volume fractions
//
// Programmer: Mark C. Miller
// Creation: April 28, 2004
//
// ****************************************************************************
struct MatZoneMap
{
std::string name; // the material name
int matno; // the material number
int numClean; // length of cleanZones
int *cleanZones; // 0-origin array of clean zone numbers
int numMixed; // length of mixedZones
int *mixedZones; // 0-origin array of mixed zone numbers
float *volFracs; // volume fractions for each mixed zone
};
// ****************************************************************************
// Class: avtMaterial
//
......@@ -67,6 +89,11 @@ struct CellMatInfo
// Hank Childs, Wed Feb 18 09:30:12 PST 2004
// Keep around the original material names.
//
// Mark C. Miller, Thu Apr 29 12:14:37 PDT 2004
// Added new constructors for constucting from...
// a) lists of elements containing each material
// b) sparse volume fractions arrays
//
// ****************************************************************************
class PIPELINE_API avtMaterial
......@@ -89,6 +116,21 @@ class PIPELINE_API avtMaterial
const int *, const int *,
const int *,
const float *);
avtMaterial(int nTotMats,
const int *mats,
const char **names,
const std::vector<MatZoneMap>
&matMap,
int ndims, const int *dims,
int major_order,
const char *domain = NULL);
avtMaterial(int nTotMats,
const int *mats,
char **names,
int ndims, const int *dims,
int major_order,
const float *const *vfracs,
const char *domain);
avtMaterial *CreatePackedMaterial() const;
......
......@@ -58,11 +58,20 @@ avtStreamer::~avtStreamer()
// Programmer: Hank Childs
// Creation: February 1, 2002
//
// Modifications:
// Jeremy Meredith, Thu May 6 11:35:15 PDT 2004
// Made sure not to delete the last reference to something if it was the
// thing we were about to add a reference to. In other words, if the
// new dataset is the same as the old one, noop.
//
// ****************************************************************************
void
avtStreamer::ManageMemory(vtkDataSet *ds)
{
if (ds == lastDataset)
return;
if (lastDataset != NULL)
{
lastDataset->Delete();
......
......@@ -14,6 +14,7 @@
#include <vtkDataSet.h>
#include <vtkDataSetMapper.h>
#include <vtkDepthSortPolyData.h>
#include <vtkFloatArray.h>
#include <vtkGeometryFilter.h>
#include <vtkMatrix4x4.h>
#include <vtkPointData.h>
......@@ -734,6 +735,10 @@ avtTransparencyActor::SetUpActor(void)
// Re-order setting of normals. They were getting removed by subsequent
// calls.
//
// Hank Childs, Thu May 6 08:37:25 PDT 2004
// Do a better job of handling normals for cell-based normals. This is more
// important because the poly data mapper no longer calculates them for us.
//
// ****************************************************************************
void
......@@ -853,6 +858,11 @@ avtTransparencyActor::PrepareDataset(int input, int subinput)
}
prepDS->GetPointData()->AddArray(colors);
colors->Delete();
if (pd->GetPointData()->GetNormals() != NULL)
{
prepDS->GetPointData()->SetNormals(
pd->GetPointData()->GetNormals());
}
}
else
{
......@@ -886,6 +896,11 @@ avtTransparencyActor::PrepareDataset(int input, int subinput)
}
prepDS->GetPointData()->AddArray(colors);
colors->Delete();
if (pd->GetPointData()->GetNormals() != NULL)
{
prepDS->GetPointData()->SetNormals(
pd->GetPointData()->GetNormals());
}
}
else if (pd->GetCellData()->GetScalars() != NULL)
{
......@@ -964,18 +979,28 @@ avtTransparencyActor::PrepareDataset(int input, int subinput)
}
prepDS->GetPointData()->AddArray(colors);
colors->Delete();
vtkDataArray *cell_normals = pd->GetCellData()->GetNormals();
if (cell_normals != NULL)
{
const float *cn = (float *) cell_normals->GetVoidPointer(0);
vtkFloatArray *newNormals;
newNormals = vtkFloatArray::New();
newNormals->SetNumberOfComponents(3);
newNormals->SetNumberOfTuples(count);
newNormals->SetName("Normals");
float *newNormalPtr = (float*)newNormals->GetVoidPointer(0);
for (i = 0 ; i < count ; i++)
{
newNormalPtr[i*3+0] = cn[cellIds[i]*3];
newNormalPtr[i*3+1] = cn[cellIds[i]*3+1];
newNormalPtr[i*3+2] = cn[cellIds[i]*3+2];
}
prepDS->GetPointData()->SetNormals(newNormals);
newNormals->Delete();
}
}
}
if (pd->GetPointData()->GetNormals() != NULL)
{
prepDS->GetPointData()->SetNormals(pd->GetPointData()->GetNormals());
}
else if (pd->GetCellData()->GetNormals() != NULL)
{
prepDS->GetCellData()->SetNormals(pd->GetCellData()->GetNormals());
}
//
// Now that we are done preparing the dataset, let's store it off so we
// can save the results.
......
......@@ -317,6 +317,9 @@ avtDatasetQuery::GetResultValue(const int i)
// Kathleen Bonnell, Fri Apr 2 08:51:17 PST 2004
// Changed args.
//
// Kathleen Bonnell, Thu May 6 13:43:01 PDT 2004
// Ensure that last time step doesn't get repreated.
//
// ****************************************************************************
void
......@@ -325,8 +328,7 @@ avtDatasetQuery::PerformQueryInTime(QueryAttributes *qA, const int startT ,
const int timeType, doubleVector &times)
{
queryAtts = *qA;
int nFrames = (int) ceil((endT -startT)/stride) + 1;
int nFrames = (int) ceil((((float)endT -startT))/(float)stride) + 1;
//
// Ensure that the specified endTime is included,
......@@ -351,9 +353,9 @@ avtDatasetQuery::PerformQueryInTime(QueryAttributes *qA, const int startT ,
avtDataObject_p origInput;
avtDataObject_p input = GetInput();
CopyTo(origInput, input);
for (i = startT; i <= actualEnd; i+=stride)
for (i = startT; i < actualEnd; i+=stride)
{
if (i <= endT)
if (i < endT)
queryAtts.SetTimeStep(i);
else
queryAtts.SetTimeStep(endT);
......
......@@ -79,6 +79,9 @@ avtActualDataMinMaxQuery::~avtActualDataMinMaxQuery()
// Kathleen Bonnell, Tue May 4 14:25:07 PDT 2004
// Set SILRestriction via member restriction, instead of SILUseSet.
//
// Kathleen Bonnell, Thu May 6 17:36:43 PDT 2004
// Request OriginalCellsArray if zones have not been preserved.
//
// ****************************************************************************
avtDataObject_p
......@@ -86,7 +89,8 @@ avtActualDataMinMaxQuery::ApplyFilters(avtDataObject_p inData)
{
Preparation(inData);
if (!timeVarying)
bool zonesPreserved = GetInput()->GetInfo().GetValidity().GetZonesPreserved();
if (!timeVarying && zonesPreserved)
{
avtPipelineSpecification_p pspec =
inData->GetTerminatingSource()->GetGeneralPipelineSpecification();
......@@ -109,6 +113,9 @@ avtActualDataMinMaxQuery::ApplyFilters(avtDataObject_p inData)
avtDataSpecification(oldSpec->GetVariable(), queryAtts.GetTimeStep(),
querySILR);
if (!zonesPreserved)
newDS->TurnZoneNumbersOn();
avtPipelineSpecification_p pspec =
new avtPipelineSpecification(newDS, queryAtts.GetPipeIndex());
......
......@@ -171,6 +171,10 @@ avtLocateCellQuery::PostExecute(void)
// Kathleen Bonnell, Tue Nov 4 08:18:54 PST 2003
// Use pickAtts instead of queryAtts.
//
// Kathleen Bonnell, Thu May 6 14:28:00 PDT 2004
// Set foundZone (used to set pickAtts.ElementNumber) to the foundCell
// if the zones have not been invalidated (ZonesPreserved).
//
// ****************************************************************************
void
......@@ -205,7 +209,7 @@ avtLocateCellQuery::Execute(vtkDataSet *ds, const int dom)
vtkDataArray *origCells =
ds->GetCellData()->GetArray("avtOriginalCellNumbers");
if (origCells)
{
int comp = origCells->GetNumberOfComponents() -1;
......@@ -218,6 +222,11 @@ avtLocateCellQuery::Execute(vtkDataSet *ds, const int dom)
<< " cells but the array was not found in the dataset."
<< endl;
}
else if (GetInput()->GetInfo().GetValidity().GetZonesPreserved() &&
GetInput()->GetInfo().GetAttributes().GetContainsGhostZones()
!= AVT_CREATED_GHOSTS)
foundZone = foundCell;
//
// There is no need to 'fudge' the intersection point unless
// avtLocateCellQuery will be using it to find the Zone number and
......
......@@ -125,6 +125,10 @@ avtMinMaxQuery::VerifyInput()
// Kathleen Bonnell, Wed Mar 31 16:13:07 PST 2004
// Only check min/or max if they are set to be done.
//
// Kathleen Bonnell, Thu May 6 17:36:43 PDT 2004
// If working with OriginalData, or zones have been preserved, use the
// zone number found here, rather than querying the database for it.
//
// ****************************************************************************
void
......@@ -181,6 +185,7 @@ avtMinMaxQuery::Execute(vtkDataSet *ds, const int dom)
float *x;
bool haveMin = false;
bool haveMax = false;
bool zonesPreserved = GetInput()->GetInfo().GetValidity().GetZonesPreserved();
for (int elNum = 0; elNum < data->GetNumberOfTuples(); elNum++)
{
switch(varType)
......@@ -235,7 +240,7 @@ avtMinMaxQuery::Execute(vtkDataSet *ds, const int dom)
// Indicate that the db needs to supply the correct
// node number.
//
if (!scalarCurve)
if (!scalarCurve && !OriginalData())
minElementNum = -1;
}
else
......@@ -255,7 +260,7 @@ avtMinMaxQuery::Execute(vtkDataSet *ds, const int dom)
// Indicate that the db needs to supply the correct
// cell number.
//
if (!scalarCurve)
if (!scalarCurve && !OriginalData() && !zonesPreserved)
minElementNum = -1;
}
}
......@@ -265,7 +270,7 @@ avtMinMaxQuery::Execute(vtkDataSet *ds, const int dom)
if (nodeCentered)
{
GetNodeCoord(ds, maxElementNum, maxCoord);
if (!scalarCurve)
if (!scalarCurve && !OriginalData())
maxElementNum = -1;
}
else
......@@ -285,7 +290,7 @@ avtMinMaxQuery::Execute(vtkDataSet *ds, const int dom)
// Indicate that the db needs to supply the correct
// cell number.
//
if (!scalarCurve)
if (!scalarCurve && !OriginalData() && !zonesPreserved)
maxElementNum = -1;
}
}
......@@ -338,8 +343,10 @@ avtMinMaxQuery::PostExecute(void)
minCoord[2] = v1.z;
}
if (minElementNum == -1)
{
src->FindElementForPoint(var.c_str(), ts, minDomain,
elementName.c_str(), minCoord, minElementNum);
}
CreateMinMessage();
}
if (hasMax)
......@@ -454,12 +461,12 @@ avtMinMaxQuery::PreExecute()
maxElementNum = -1;
minDomain = -1;
maxDomain = -1;
minCoord[0] = 0; // x
minCoord[1] = 0; // y
minCoord[2] = 0; // z
maxCoord[0] = 0; // x
maxCoord[1] = 0; // y
maxCoord[2] = 0; // z
minCoord[0] = 0.; // x
minCoord[1] = 0.; // y
minCoord[2] = 0.; // z
maxCoord[0] = 0.; // x
maxCoord[1] = 0.; // y
maxCoord[2] = 0.; // z
minMsg = "No Information Found";
maxMsg = "No Information Found";
elementName = "";
......
......@@ -380,6 +380,8 @@ avtVariableQuery::ApplyFilters(avtDataObject_p inData)
// Creation: March 31, 2004
//
// Modifications:
// Kathleen Bonnell, Thu May 6 17:46:59 PDT 2004
// Allow species and scalar vars to be looked at again if previously set.
//
// ****************************************************************************
......@@ -410,8 +412,11 @@ avtVariableQuery::RetrieveVarInfo(vtkDataSet* ds)
PickVarInfo::Centering centering;
if (pickAtts.GetFulfilled())
{
if (pickAtts.GetPickVarInfo(varNum).HasInfo())
if (pickAtts.GetPickVarInfo(varNum).HasInfo() &&
pickAtts.GetPickVarInfo(varNum).GetVariableType() != "species" &&
pickAtts.GetPickVarInfo(varNum).GetVariableType() != "scalar")
continue;
vName = pickAtts.GetPickVarInfo(varNum).GetVariableName();
}
else
......@@ -493,12 +498,15 @@ avtVariableQuery::RetrieveVarInfo(vtkDataSet* ds)
pickAtts.GetPickVarInfo(varNum).SetNames(names);
pickAtts.GetPickVarInfo(varNum).SetValues(vals);
pickAtts.GetPickVarInfo(varNum).SetCentering(centering);
if (nComponents == 1)
pickAtts.GetPickVarInfo(varNum).SetVariableType("scalar");
else if (nComponents == 3)
pickAtts.GetPickVarInfo(varNum).SetVariableType("vector");
else if (nComponents == 9)
pickAtts.GetPickVarInfo(varNum).SetVariableType("tensor");
if (pickAtts.GetPickVarInfo(varNum).GetVariableType() != "species")
{
if (nComponents == 1)
pickAtts.GetPickVarInfo(varNum).SetVariableType("scalar");
else if (nComponents == 3)
pickAtts.GetPickVarInfo(varNum).SetVariableType("vector");
else if (nComponents == 9)
pickAtts.GetPickVarInfo(varNum).SetVariableType("tensor");
}
delete [] temp;
}
}
......
......@@ -47,6 +47,8 @@
#include <Utility.h>
#include <DataNode.h>
#include <snprintf.h>
using std::vector;
using std::string;
......@@ -996,6 +998,9 @@ avtSAMRAIFileFormat::ReadMatSpecFractions(int patch, string mat_name,
// Mark C. Miller, Wed Jan 7 11:35:37 PST 2004
// Added stuff to compute compression achieved
//
// Mark C. Miller, Thu May 6 22:07:32 PDT 2004
// Used new material constructors
//
// ****************************************************************************
avtMaterial *
......@@ -1123,11 +1128,16 @@ avtSAMRAIFileFormat::GetMaterial(int patch, const char *matObjName)
}
else
{
// for some reason, the initialization to zero in the 'new' call
// doesn't take effect...
float **vfracs = new (float*)[num_mats](0);
for (i = 0; i < num_mats; i++)
vfracs[i] = 0;
// read the volume fractions for each material
float **vfracs = new float*[matList.size()==1?2:matList.size()];
for (i = 0; i < matList.size(); i++)
{
vfracs[i] = ReadMatSpecFractions(patch, mat_names[matList[i]]);
vfracs[matList[i]] = ReadMatSpecFractions(patch, mat_names[matList[i]]);
bytesInFile += (ncells * sizeof(float));
}
......@@ -1141,32 +1151,24 @@ avtSAMRAIFileFormat::GetMaterial(int patch, const char *matObjName)
}
// infer the void's volume fractions
vfracs[1] = new float[ncells];
vfracs[num_mats-1] = new float[ncells];
for (i = 0; i < ncells; i++)
vfracs[1][i] = 1.0 - vfracs[0][i];
// tack on the material number for the inferred void material
matList.push_back(num_mats-1);
vfracs[num_mats-1][i] = 1.0 - vfracs[matList[0]][i];
}
int *matfield;
int mixlen;
int *mix_mat;
int *mix_next;
int *mix_zone;
float *mix_vf;
//
// Construct the object we came here for
//
char domName[256];
SNPRINTF(domName, sizeof(domName),"%d", patch);
mat = new avtMaterial(num_mats, matnos, matnames, dim, dims, 0,
vfracs, domName);
ConvertVolumeFractionFields(matList, vfracs, ncells, matfield, mixlen,
mix_mat, mix_next, mix_zone, mix_vf);
mat = new avtMaterial(num_mats, matnos, matnames, dim, dims, 0, matfield,
mixlen, mix_mat, mix_next, mix_zone, mix_vf);
for (i = 0; i < matList.size(); i++)
for (i = 0; i < num_mats; i++)
SAFE_DELETE(vfracs[i]);
SAFE_DELETE(vfracs);
bytesInMem = (ncells * sizeof(int) + mixlen * (3*sizeof(int)+sizeof(float)));
bytesInMem = (ncells * sizeof(int) + mat->GetMixlen() * (3*sizeof(int)+sizeof(float)));
}
......
#include <StringHelpers.h>
#include <sys/types.h>
#include <regex.h>
#include <stdlib.h>
#include <string>
#include <vector>
......@@ -7,7 +9,7 @@
using std::string;
using std::vector;
static string IGNORE_CHARS = "`~!@#$%^&*()-_=+{[}]|\\:;\"'<,>.?/0123456789";
static string IGNORE_CHARS = StringHelpers::NON_RELEVANT_CHARS;
string RelevantString(string inStr)
{
......@@ -34,12 +36,17 @@ static int CompareRelevantStrings(const void *arg1, const void *arg2)
void
StringHelpers::GroupStrings(vector<string> stringList,
vector<vector<string> > &stringGroups,
vector<string> &groupNames)
vector<string> &groupNames,
int numLeadingVals,
string nonRelevantChars)
{
int i;
int nStrings = stringList.size();
// prime the input to the compare functions
IGNORE_CHARS = nonRelevantChars;
// first, we need to sort the strings. Well, we don't really sort the
// strings. Instead we sort an array of pointers to the strings. We
// build that array here.
......@@ -51,22 +58,23 @@ StringHelpers::GroupStrings(vector<string> stringList,
qsort(stringPtrs, nStrings, sizeof(char *), CompareRelevantStrings);
// now, scan the sorted list of strings for value transitions
// in first three chars. Each such transition indicates the end of
// in first N (default 3) chars. Each such transition indicates the end of
// one group and the beginning of the next. The 'first 3' criterion
// is arbitrary but seems to work well.
if (numLeadingVals > stringList[0].size()-1)
numLeadingVals = stringList[0].size()-1;
string lastVal;
lastVal += stringPtrs[0][0];
lastVal += stringPtrs[0][1];
lastVal += stringPtrs[0][2];
for (i = 0; i < numLeadingVals; i++)
lastVal += stringPtrs[0][i];
groupNames.push_back(RelevantString(stringPtrs[0]));
vector<string> curGroup;
curGroup.push_back(stringPtrs[0]);
for (i = 1; i < nStrings; i++)
{
string thisVal;
thisVal += stringPtrs[i][0];
thisVal += stringPtrs[i][1];
thisVal += stringPtrs[i][2];
int j;
for (j = 0; j < numLeadingVals