Commit b305278d authored by hrchilds's avatar hrchilds
Browse files

Add support for streamline+reflect.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12436 18c085ea-50e0-402c-830e-de6fd14e8384
parent cdfeea7c
......@@ -876,6 +876,9 @@ avtPICSFilter::Execute(void)
// Dave Pugmire, Mon Jun 14 14:16:57 EDT 2010
// Allow serial algorithm to be run in parallel on single domain datasets.
//
// Hank Childs, Thu Sep 2 10:50:05 PDT 2010
// Deal with case where domain IDs are not unique.
//
// ****************************************************************************
void
......@@ -937,7 +940,10 @@ avtPICSFilter::Initialize()
}
}
else
{
GetTypedInput()->RenumberDomainIDs();
intervalTree = GetTypedInput()->CalculateSpatialIntervalTree();
}
}
else
{
......@@ -2111,6 +2117,10 @@ avtPICSFilter::CreateIntegralCurvesFromSeeds(std::vector<avtVector> &pts,
// Dave Pugmire, Mon Jun 14 14:16:57 EDT 2010
// Allow serial algorithm to be run in parallel on single domain datasets.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Make sure that we tell upstream filters that we want continuous velocity
// fields ... this is important for the Reflect operator.
//
// ****************************************************************************
avtContract_p
......@@ -2131,15 +2141,11 @@ avtPICSFilter::ModifyContract(avtContract_p in_contract)
lastContract = in_contract;
avtDataRequest_p in_dr = in_contract->GetDataRequest();
avtDataRequest_p out_dr = NULL;
if (integrationType == STREAMLINE_INTEGRATE_M3D_C1_INTEGRATOR ||
doPathlines)
{
// The avtPICSPlot requested "colorVar", so remove that from the
// contract now.
out_dr = new avtDataRequest(in_dr,in_dr->GetOriginalVariable());
}
// If we are part of a plot, the avtPICSPlot requested "colorVar", so remove that from the
// contract now.
avtDataRequest_p out_dr = new avtDataRequest(in_dr,in_dr->GetOriginalVariable());
out_dr->SetVelocityFieldMustBeContinuous(true);
if ( integrationType == STREAMLINE_INTEGRATE_M3D_C1_INTEGRATOR )
{
......
......@@ -56,6 +56,8 @@
#include <avtSourceFromAVTDataset.h>
#include <avtWebpage.h>
#include <DebugStream.h>
// ****************************************************************************
// Method: avtDataset constructor
......@@ -619,3 +621,61 @@ avtDataset::CalculateSpatialIntervalTree(void)
}
// ****************************************************************************
// Method: avtDataset::RenumberDomainIDs
//
// Purpose:
// Renumbers the domain IDs. If a domain has ID 10 and then the reflect
// operator comes along, then each of the reflected data sets will also
// have ID 10. This is a nightmare for streamline calculations.
// This routine will through away the original IDs and create a new
// numbering space.
//
// Programmer: Hank Childs
// Creation: September 2, 2010
//
// ****************************************************************************
void
avtDataset::RenumberDomainIDs(void)
{
int i;
if (*dataTree == NULL)
return;
int numLeaves = 0;
vtkDataSet **leaves = dataTree->GetAllLeaves(numLeaves);
vector<string> labels;
dataTree->GetAllLabels(labels);
// This should never execute, but better safe than sorry
while (labels.size() < numLeaves)
{
debug1 << "Unexpected: less labels than leaves" << endl;
labels.push_back("");
}
int numProcs = PAR_Rank();
int *numPer = new int[numProcs];
for (i = 0 ; i < numProcs ; i++)
numPer[i] = 0;
numPer[PAR_Rank()] = numLeaves;
int *numPer2 = new int[numProcs];
SumIntArrayAcrossAllProcessors(numPer, numPer2, numProcs);
delete [] numPer;
numPer = numPer2;
int myOffset = 0;
for (i = 0 ; i < PAR_Rank() ; i++)
myOffset += numPer[i];
avtDataTree_p *newTrees = new avtDataTree_p[numLeaves];
for (i = 0 ; i < numLeaves ; i++)
newTrees[i] = new avtDataTree(leaves[i], myOffset++, labels[i]);
dataTree = new avtDataTree(numLeaves, newTrees);
delete [] newTrees; // new array allocated by avtDataTree constructor
delete [] numPer;
}
......@@ -135,6 +135,9 @@ class avtWebpage;
// Dave Pugmire, Fri Jul 2 14:22:34 EDT 2010
// Add friend status for avtResampleExpression.
//
// Hank Childs, Thu Sep 2 07:54:12 PDT 2010
// Add method RenumberDomainIDs.
//
// ****************************************************************************
class PIPELINE_API avtDataset : public avtDataObject
......@@ -178,6 +181,7 @@ class PIPELINE_API avtDataset : public avtDataObject
void Compact(void);
avtIntervalTree *CalculateSpatialIntervalTree(void);
void RenumberDomainIDs(void);
virtual void DebugDump(avtWebpage *, const char *);
protected:
......
......@@ -179,6 +179,10 @@ using std::map;
// Mark C. Miller, Wed Mar 3 07:59:15 PST 2010
// Changed form of conditional compilation check for HAVE_BILIB from
// numeric test to existence test.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Added support for "velocityMustBeContinuous".
//
// ****************************************************************************
avtDataRequest::avtDataRequest(const char *var, int ts,
......@@ -191,6 +195,7 @@ avtDataRequest::avtDataRequest(const char *var, int ts,
needGlobalZones = false;
needGlobalNodes = false;
needInternalSurfaces = false;
velocityMustBeContinuous = false;
mustDoMIR = false;
getBoundarySurfaceRep = false;
getSimplifiedNestingRep = false;
......@@ -343,6 +348,9 @@ avtDataRequest::avtDataRequest(const char *var, int ts,
// Jeremy Meredith, Tue Aug 4 10:48:26 EDT 2009
// Added comment for Youngs algorithm.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Added support for "velocityMustBeContinuous".
//
// ****************************************************************************
avtDataRequest::avtDataRequest(const char *var, int ts, int ch)
......@@ -354,6 +362,7 @@ avtDataRequest::avtDataRequest(const char *var, int ts, int ch)
needGlobalZones = false;
needGlobalNodes = false;
mustDoMIR = false;
velocityMustBeContinuous = false;
needInternalSurfaces = false;
getBoundarySurfaceRep = false;
getSimplifiedNestingRep = false;
......@@ -643,6 +652,9 @@ avtDataRequest::avtDataRequest(avtDataRequest_p spec)
// Jeremy Meredith, Fri Feb 13 11:22:39 EST 2009
// Added MIR iteration capability.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Added support for "velocityMustBeContinuous".
//
// ****************************************************************************
avtDataRequest &
......@@ -683,6 +695,7 @@ avtDataRequest::operator=(const avtDataRequest &spec)
needGlobalZones = spec.needGlobalZones;
needGlobalNodes = spec.needGlobalNodes;
needInternalSurfaces = spec.needInternalSurfaces;
velocityMustBeContinuous = spec.velocityMustBeContinuous;
getBoundarySurfaceRep = spec.getBoundarySurfaceRep;
getSimplifiedNestingRep = spec.getSimplifiedNestingRep;
needValidFaceConnectivity = spec.needValidFaceConnectivity;
......@@ -827,6 +840,9 @@ avtDataRequest::operator=(const avtDataRequest &spec)
// Jeremy Meredith, Fri Feb 13 11:22:39 EST 2009
// Added MIR iteration capability.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Added support for "velocityMustBeContinuous".
//
// ****************************************************************************
bool
......@@ -894,6 +910,11 @@ avtDataRequest::operator==(const avtDataRequest &ds)
return false;
}
if (velocityMustBeContinuous != ds.velocityMustBeContinuous)
{
return false;
}
if (getBoundarySurfaceRep != ds.getBoundarySurfaceRep)
{
return false;
......@@ -1799,6 +1820,9 @@ avtSILSpecification::operator==(const avtSILSpecification &s)
// Jeremy Meredith, Tue Aug 4 10:49:32 EDT 2009
// Added MIR algorithm enumeration values to page.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Added support for "velocityMustBeContinuous".
//
// ****************************************************************************
static const char *
......@@ -1842,6 +1866,7 @@ avtDataRequest::DebugDump(avtWebpage *webpage)
webpage->AddTableEntry2("mayRequireZones", YesOrNo(mayRequireZones));
webpage->AddTableEntry2("mustDoMIR", YesOrNo(mustDoMIR));
webpage->AddTableEntry2("needInternalSurfaces", YesOrNo(needInternalSurfaces));
webpage->AddTableEntry2("velocityMustBeContinuous", YesOrNo(velocityMustBeContinuous));
webpage->AddTableEntry2("Get data set as only material boundaries", YesOrNo(getBoundarySurfaceRep));
webpage->AddTableEntry2("Get data set in a simplified form for showing domain nesting",
YesOrNo(getSimplifiedNestingRep));
......
......@@ -205,6 +205,9 @@ typedef ref_ptr<avtDataRequest> avtDataRequest_p;
// Jeremy Meredith, Fri Feb 13 11:22:39 EST 2009
// Added MIR iteration capability.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Added Boolean for whether the velocity field must be continuous.
//
// ****************************************************************************
class PIPELINE_API avtDataRequest
......@@ -281,6 +284,11 @@ class PIPELINE_API avtDataRequest
void SetNeedStructuredIndices(bool v)
{ needStructuredIndices = v; };
bool VelocityFieldMustBeContinuous(void)
{ return velocityMustBeContinuous; };
void SetVelocityFieldMustBeContinuous(bool v)
{ velocityMustBeContinuous = v; };
int NeedAMRIndices(void)
{ return needAMRIndices; };
void SetNeedAMRIndices(int v)
......@@ -480,6 +488,7 @@ class PIPELINE_API avtDataRequest
bool needMixedVariableReconstruction;
bool needSmoothMaterialInterfaces;
bool needCleanZonesOnly;
bool velocityMustBeContinuous;
int mirAlgorithm;
int mirNumIterations;
float mirIterationDamping;
......
......@@ -44,7 +44,9 @@
#include <float.h>
#include <vtkCell.h>
#include <vtkCellData.h>
#include <vtkIdList.h>
#include <vtkPointData.h>
#include <vtkPointSet.h>
#include <vtkRectilinearGrid.h>
......@@ -59,7 +61,7 @@
using std::string;
static void ReflectVectorData(vtkDataSet *in_ds, int dim);
static void ReflectVectorData(vtkDataSet *in_ds, int dim, bool);
// ****************************************************************************
......@@ -118,6 +120,11 @@ Equal(float t1, double t2)
// Programmer: childs -- generated by xml2info
// Creation: Thu Mar 7 10:35:24 PDT 2002
//
// Modifications:
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Add Boolean for zero-ing velocities on the boundary.
//
// ****************************************************************************
avtReflectFilter::avtReflectFilter()
......@@ -125,6 +132,7 @@ avtReflectFilter::avtReflectFilter()
xReflect = 0.;
yReflect = 0.;
zReflect = 0.;
zeroOutVelocitiesOnBoundary = false;
}
......@@ -384,6 +392,9 @@ avtReflectFilter::PostExecute(void)
// are streaming, not about whether we are doing dynamic load balancing.
// And the two are no longer synonymous.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Set Boolean for zero-ing velocities on the boundary.
//
// ****************************************************************************
avtContract_p
......@@ -411,9 +422,12 @@ avtReflectFilter::ModifyContract(avtContract_p spec)
ns->GetDataRequest()->TurnNodeNumbersOn();
}
zeroOutVelocitiesOnBoundary = ns->GetDataRequest()->VelocityFieldMustBeContinuous();
return ns;
}
// ****************************************************************************
// Method: avtReflectFilter::UpdateDataObjectInfo
//
......@@ -533,6 +547,9 @@ avtReflectFilter::ExecuteDataTree(vtkDataSet *in_ds, int dom, string str)
// Hank Childs, Thu Jun 24 12:53:47 PDT 2004
// Reflect vector data as well.
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Pass Boolean along to ReflectVectorData function.
//
// ****************************************************************************
vtkDataSet *
......@@ -557,7 +574,7 @@ avtReflectFilter::Reflect(vtkDataSet *ds, int dim)
break;
}
ReflectVectorData(rv, dim);
ReflectVectorData(rv, dim, zeroOutVelocitiesOnBoundary);
return rv;
}
......@@ -925,10 +942,17 @@ avtReflectFilter::ReflectPointSet(vtkPointSet *ds, int dim)
// Programmer: Hank Childs
// Creation: June 24, 2004
//
// Modifications:
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Add support for zero-ing out velocity field along the boundary.
// This will make it be a continuous field (and one that particles
// won't advect through!).
//
// ****************************************************************************
static void
ReflectVectorData(vtkDataSet *ds, int dim)
ReflectVectorData(vtkDataSet *ds, int dim, bool zeroOutVelocitiesOnBoundary)
{
if (dim == 0)
{
......@@ -977,6 +1001,25 @@ ReflectVectorData(vtkDataSet *ds, int dim)
new_pt_vectors.push_back(da);
}
//
// If we want a continuous velocity field (probably for streamlines), then zero out
// the velocities on the boundary.
//
if (zeroOutVelocitiesOnBoundary && (new_pt_vectors.size() > 0))
{
vtkUnsignedCharArray *gn = (vtkUnsignedCharArray *) pd->GetArray("avtGhostNodes");
double zeroVel[3] = { 0,0,0 };
int npts = ds->GetNumberOfPoints();
for (i = 0 ; i < npts ; i++)
{
if (gn->GetValue(i) != 0)
{
for (j = 0 ; j < new_pt_vectors.size() ; j++)
new_pt_vectors[j]->SetTuple(i, zeroVel);
}
}
}
// Now replace all of the original vectors with our new ones.
for (i = 0 ; i < new_pt_vectors.size() ; i++)
{
......@@ -1032,6 +1075,38 @@ ReflectVectorData(vtkDataSet *ds, int dim)
new_cell_vectors.push_back(da);
}
//
// If we want a continuous velocity field (probably for streamlines), then zero out
// the velocities on the boundary.
//
if (zeroOutVelocitiesOnBoundary && (cell_vectors.size() > 0))
{
debug1 << "Zero-ing out vectors along the boundary for cell-centered "
<< "vectors. We have a slow implementation. If you are looking "
<< "for performance issues, this is the place to look." << endl;
vtkUnsignedCharArray *gn = (vtkUnsignedCharArray *) pd->GetArray("avtGhostNodes");
double zeroVel[3] = { 0,0,0 };
int ncells = ds->GetNumberOfCells();
for (i = 0 ; i < ncells ; i++)
{
vtkCell *cell = ds->GetCell(i);
vtkIdList *ids = cell->GetPointIds();
int nids = ids->GetNumberOfIds();
bool touchesBoundary = false;
for (j = 0 ; j < nids ; j++)
{
if (gn->GetValue(ids->GetId(j)) != 0)
touchesBoundary = true;
}
// inefficient
if (touchesBoundary)
{
for (j = 0 ; j < new_cell_vectors.size() ; j++)
new_cell_vectors[j]->SetTuple(i, zeroVel);
}
}
}
// Now replace all of the original vectors with our new ones.
for (i = 0 ; i < new_cell_vectors.size() ; i++)
{
......
......@@ -64,6 +64,11 @@ class vtkRectilinearGrid;
// Programmer: childs -- generated by xml2info
// Creation: Thu Mar 7 10:35:24 PDT 2002
//
// Modifications:
//
// Hank Childs, Fri Sep 3 12:10:47 PDT 2010
// Add Boolean to zero out velocities on the boundary.
//
// ****************************************************************************
class avtReflectFilter : public virtual avtSIMODataTreeIterator,
......@@ -87,6 +92,7 @@ class avtReflectFilter : public virtual avtSIMODataTreeIterator,
double xReflect;
double yReflect;
double zReflect;
bool zeroOutVelocitiesOnBoundary;
virtual void PreExecute(void);
virtual void PostExecute(void);
......
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