Commit ec5dadf6 authored by pugmire's avatar pugmire

Additional options for seeding streamlines.




git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11624 18c085ea-50e0-402c-830e-de6fd14e8384
parent f4eb27ed
This diff is collapsed.
......@@ -204,6 +204,9 @@ class vtkAppendPolyData;
// Hank Childs, Tue Jun 8 09:30:45 CDT 2010
// Add method GetCommunicationPattern.
//
// Dave Pugmire, Thu Jun 10 10:44:02 EDT 2010
// New seed sources.
//
// ****************************************************************************
class AVTFILTERS_API avtStreamlineFilter : virtual public avtPICSFilter
......@@ -223,17 +226,25 @@ class AVTFILTERS_API avtStreamlineFilter : virtual public avtPICSFilter
const avtVector &p_start, int ID);
// Methods to set the filter's attributes.
void SetSourceType(int sourceType);
void SetIntersectionObject(vtkObject *obj);
void SetPointSource(double pt[3]);
void SetLineSource(double pt[3], double pt2[3]);
void SetPlaneSource(double O[3], double N[3],
double U[3], double R);
void SetSphereSource(double O[3], double R);
void SetPointSource(const double *p);
void SetLineSource(const double *p0, const double *p1,
int den, bool rand, int seed, int numPts);
void SetPlaneSource(double O[3], double N[3], double U[3],
int den1, int den2, double dist1, double dist2,
bool fill, bool rand, int seed, int numPts);
void SetCircleSource(double O[3], double N[3], double U[3], double r,
int den1, int den2,
bool fill, bool rand, int seed, int numPts);
void SetSphereSource(double O[3], double R,
int den1, int den2, int den3,
bool fill, bool rand, int seed, int numPts);
void SetBoxSource(double E[6], bool wholeBox,
int den1, int den2, int den3,
bool fill, bool rand, int seed, int numPts);
void SetPointListSource(const std::vector<double> &);
void SetBoxSource(double E[6]);
void SetUseWholeBox(bool b) { useWholeBox = b; };
void SetDisplayMethod(int d);
void SetPointDensity(int den);
......@@ -252,13 +263,18 @@ class AVTFILTERS_API avtStreamlineFilter : virtual public avtPICSFilter
std::string coloringVariable, opacityVariable;
// Various starting locations for streamlines.
std::vector<avtVector> pointList;
avtVector points[2];
avtVector vectors[2];
std::vector<double> listOfPoints;
int numSamplePoints;
int sampleDensity[3];
double sampleDistance[3];
bool randomSamples;
int randomSeed;
bool fill, useBBox;
std::string SeedInfoString() const;
double pointSource[3];
double lineStart[3], lineEnd[3];
double planeOrigin[3], planeNormal[3], planeUpAxis[3], planeRadius;
double sphereOrigin[3], sphereRadius;
double boxExtents[6];
bool useWholeBox;
vtkObject *intersectObj;
......
......@@ -84,6 +84,9 @@
// Dave Pugmire, Mon Feb 15 14:05:19 EST 2010
// Add perpendiculars method and unary - operator.
//
// Dave Pugmire, Thu Jun 10 10:44:02 EDT 2010
// Add set() methods.
//
// ****************************************************************************
class MATH_API avtVector
{
......@@ -128,6 +131,10 @@ class MATH_API avtVector
// element access
double& operator[](const size_t &i);
const double& operator[](const size_t &i) const;
void set(const double *v);
void set(const float *v);
void set(double, double, double);
void set(float, float, float);
// 2-norm
double norm() const;
......@@ -401,5 +408,33 @@ inline avtVector lerp(const double &t, const avtVector &v0, const avtVector &v1)
return result;
}
inline void avtVector::set(const double *v)
{
x=v[0];
y=v[1];
z=v[2];
}
inline void avtVector::set(const float *v)
{
x=v[0];
y=v[1];
z=v[2];
}
inline void avtVector::set(double v0, double v1, double v2)
{
x = v0;
y = v1;
z = v2;
}
inline void avtVector::set(float v0, float v1, float v2)
{
x = v0;
y = v1;
z = v2;
}
#endif
......@@ -344,6 +344,9 @@ avtPoincarePlot::EnhanceSpecification(avtContract_p in_contract)
// Hank Childs, Sun Jun 6 11:53:33 CDT 2010
// Change method name from streamline direction to integration direction.
//
// Dave Pugmire, Thu Jun 10 10:44:02 EDT 2010
// New seed sources.
//
// ****************************************************************************
void
......@@ -378,29 +381,27 @@ avtPoincarePlot::SetAtts(const AttributeGroup *a)
switch (atts.GetSourceType())
{
case PoincareAttributes::SpecifiedPoint:
poincareFilter->SetSourceType(STREAMLINE_SOURCE_POINT);
poincareFilter->SetPointSource(atts.GetPointSource());
break;
case PoincareAttributes::SpecifiedLine:
if( atts.GetPointDensity() > 1 )
{
poincareFilter->SetSourceType(STREAMLINE_SOURCE_LINE);
poincareFilter->SetLineSource(atts.GetLineStart(), atts.GetLineEnd());
poincareFilter->SetPointDensity(atts.GetPointDensity()-1);
poincareFilter->SetLineSource(atts.GetLineStart(), atts.GetLineEnd(),
atts.GetPointDensity()-1,
false, 0, 0);
}
else
{
double pt[3];
pt[0] = (atts.GetLineStart()[0] + atts.GetLineEnd()[0]) / 2;
pt[1] = (atts.GetLineStart()[1] + atts.GetLineEnd()[1]) / 2;
pt[2] = (atts.GetLineStart()[2] + atts.GetLineEnd()[2]) / 2;
double pt[3];
poincareFilter->SetSourceType(STREAMLINE_SOURCE_POINT);
poincareFilter->SetPointSource(pt);
pt[0] = (atts.GetLineStart()[0] + atts.GetLineEnd()[0]) / 2;
pt[1] = (atts.GetLineStart()[1] + atts.GetLineEnd()[1]) / 2;
pt[2] = (atts.GetLineStart()[2] + atts.GetLineEnd()[2]) / 2;
poincareFilter->SetPointSource(pt);
}
break;
}
......
This diff is collapsed.
......@@ -44,7 +44,7 @@
//
// Functions exposed to the VisIt module.
//
#define STREAMLINEATTRIBUTES_NMETH 120
#define STREAMLINEATTRIBUTES_NMETH 136
void PyStreamlineAttributes_StartUp(StreamlineAttributes *subj, void *data);
void PyStreamlineAttributes_CloseDown();
PyMethodDef * PyStreamlineAttributes_GetMethodTable(int *nMethods);
......
This diff is collapsed.
......@@ -43,6 +43,9 @@
// Forward declarations
class QLabel;
class QGroupBox;
class QListWidget;
class QListWidgetItem;
class QCheckBox;
class QComboBox;
class QLineEdit;
......@@ -52,6 +55,7 @@ class QvisColorButton;
class QvisLineWidthWidget;
class QvisVariableButton;
class QvisOpacitySlider;
class QPushButton;
class StreamlineAttributes;
// ****************************************************************************
......@@ -115,6 +119,9 @@ class StreamlineAttributes;
// Allen Sanderson, Sun Mar 7 12:49:56 PST 2010
// Change layout of window for 2.0 interface changes.
//
// Dave Pugmire, Thu Jun 10 10:44:02 EDT 2010
// New seed sources.
//
// ****************************************************************************
class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
......@@ -142,6 +149,7 @@ class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
void GetCurrentValues(int which_widget);
void Apply(bool ignore = false);
void UpdateSourceAttributes();
void TurnOffSourceAttributes();
void UpdateAlgorithmAttributes();
void UpdateIntegrationAttributes();
void UpdateTerminationType();
......@@ -162,10 +170,19 @@ class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
void planeOriginProcessText();
void planeNormalProcessText();
void planeUpAxisProcessText();
void planeRadiusProcessText();
void radiusProcessText();
void sphereOriginProcessText();
void sphereRadiusProcessText();
void pointDensityChanged(int val);
void sampleDensity0Changed(int val);
void sampleDensity1Changed(int val);
void sampleDensity2Changed(int val);
void sampleDistance0ProcessText();
void sampleDistance1ProcessText();
void sampleDistance2ProcessText();
void randomSamplesChanged(bool);
void randomSeedChanged(int);
void numberOfRandomSamplesChanged(int);
void fillInteriorChanged(bool);
void maxSLCountChanged(int val);
void maxDomainCacheChanged(int val);
void workGroupSizeChanged(int val);
......@@ -206,6 +223,12 @@ class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
void tubeDisplayDensityChanged(int);
void seedDisplayQualityChanged(int);
void headDisplayTypeChanged(int);
void pointListClicked(QListWidgetItem*);
void pointListDoubleClicked(QListWidgetItem*);
void addPoint();
void deletePoint();
void readPoints();
void textChanged(const QString &currentText);
private:
int plotType;
......@@ -224,26 +247,34 @@ class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
QLabel *lineStartLabel;
QLineEdit *lineEnd;
QLabel *lineEndLabel;
QLineEdit *pointList;
QLabel *pointListLabel;
QLabel *pointListInfo;
QListWidget *pointList;
QPushButton *pointListDelPoint, *pointListAddPoint, *pointListReadPoints;
QLineEdit *planeOrigin;
QLabel *planeOriginLabel;
QLineEdit *planeNormal;
QLabel *planeNormalLabel;
QLineEdit *planeUpAxis;
QLabel *planeUpAxisLabel;
QLineEdit *planeRadius;
QLabel *planeRadiusLabel;
QLineEdit *radius;
QLabel *radiusLabel;
QLineEdit *sphereOrigin;
QLabel *sphereOriginLabel;
QLineEdit *sphereRadius;
QLabel *sphereRadiusLabel;
QCheckBox *useWholeBox;
QLineEdit *boxExtents[3];
QLabel *boxExtentsLabel[3];
QLabel *pointDensityLabel;
QSpinBox *pointDensity;
QLabel *sampleDensityLabel[3], *sampleDistanceLabel[3];
QSpinBox *sampleDensity[3];
QLineEdit *sampleDistance[3];
QGroupBox *samplingGroup;
QCheckBox *randomSamples;
QSpinBox *numberOfRandomSamples;
QLabel *numberOfRandomSamplesLabel;
QSpinBox *randomSeed;
QLabel *randomSeedLabel;
QCheckBox *fillInterior;
QComboBox *displayMethod;
QCheckBox *showSeeds, *showHeads;
QLabel *seedRadiusLabel, *headRadiusLabel, *headHeightLabel;
......@@ -251,7 +282,7 @@ class QvisStreamlinePlotWindow : public QvisPostableWindowObserver
QLabel *headDisplayTypeLabel;
QLineEdit *seedRadius, *headRadius, *headHeight;
QLineEdit *tubeRadius, *ribbonWidth;
QLabel *radiusLabel;
QLabel *geomRadiusLabel;
QvisLineWidthWidget *lineWidth;
QLabel *lineWidthLabel;
QLabel *lineWidthDummy;
......
......@@ -17,6 +17,9 @@ Definition:
// Hank Childs, Sat Mar 3 09:00:12 PST 2007
// Disable useWholeBox if we are copying box extents.
//
// Dave Pugmire, Thu Jun 10 10:44:02 EDT 2010
// New seed sources.
//
// ****************************************************************************
bool
......@@ -58,7 +61,7 @@ StreamlineAttributes::CopyAttributes(const AttributeGroup *atts)
SetPlaneOrigin(plane->GetOrigin());
SetPlaneNormal(plane->GetNormal());
SetPlaneUpAxis(plane->GetUpAxis());
SetPlaneRadius(plane->GetRadius());
SetRadius(plane->GetRadius());
retval = true;
}
}
......@@ -68,7 +71,7 @@ StreamlineAttributes::CopyAttributes(const AttributeGroup *atts)
{
const SphereAttributes *sphere = (const SphereAttributes *)atts;
SetSphereOrigin(sphere->GetOrigin());
SetSphereRadius(sphere->GetRadius());
SetRadius(sphere->GetRadius());
retval = true;
}
}
......@@ -80,7 +83,7 @@ StreamlineAttributes::CopyAttributes(const AttributeGroup *atts)
SetPlaneOrigin(plane->GetOrigin());
SetPlaneNormal(plane->GetNormal());
SetPlaneUpAxis(plane->GetUpAxis());
SetPlaneRadius(plane->GetRadius());
SetRadius(plane->GetRadius());
retval = true;
}
}
......@@ -148,7 +151,7 @@ StreamlineAttributes::CreateCompatible(const std::string &tname) const
p->SetOrigin(GetPlaneOrigin());
p->SetNormal(GetPlaneNormal());
p->SetUpAxis(GetPlaneUpAxis());
p->SetRadius(GetPlaneRadius());
p->SetRadius(GetRadius());
p->SetHaveRadius(true);
retval = p;
}
......@@ -156,7 +159,7 @@ StreamlineAttributes::CreateCompatible(const std::string &tname) const
{
SphereAttributes *s = new SphereAttributes;
s->SetOrigin(GetSphereOrigin());
s->SetRadius(GetSphereRadius());
s->SetRadius(GetRadius());
retval = s;
}
else if(tname == "CircleAttributes")
......@@ -165,7 +168,7 @@ StreamlineAttributes::CreateCompatible(const std::string &tname) const
p->SetOrigin(GetPlaneOrigin());
p->SetNormal(GetPlaneNormal());
p->SetUpAxis(GetPlaneUpAxis());
p->SetRadius(GetPlaneRadius());
p->SetRadius(GetRadius());
p->SetHaveRadius(true);
retval = p;
}
......@@ -218,95 +221,125 @@ Definition:
bool
StreamlineAttributes::ChangesRequireRecalculation(const StreamlineAttributes &obj) const
{
// If we're in point source mode and the points differ, sourcePointsDiffer
// evaluates to true.
bool sourcePointsDiffer = ((sourceType == SpecifiedPoint) &&
POINT_DIFFERS(pointSource, obj.pointSource));
//Check the general stuff first...
if (sourceType != obj.sourceType ||
termination != obj.termination ||
terminationType != obj.terminationType ||
streamlineDirection != obj.streamlineDirection ||
integrationType != obj.integrationType ||
maxStepLength != obj.maxStepLength ||
relTol != obj.relTol ||
absTol != obj.absTol ||
pathlines != obj.pathlines ||
coloringVariable != obj.coloringVariable ||
(displayMethod != obj.displayMethod && obj.displayMethod == Ribbons) ||
(coloringMethod != obj.coloringMethod && obj.coloringMethod != Solid) ||
((opacityType == VariableRange) && (obj.opacityType != VariableRange ||
opacityVariable != obj.opacityVariable)))
{
return true;
}
//Check by source type.
if ((sourceType == SpecifiedPoint) && POINT_DIFFERS(pointSource, obj.pointSource))
{
return true;
}
if (sourceType == SpecifiedLine)
{
if (POINT_DIFFERS(lineStart, obj.lineStart) ||
POINT_DIFFERS(lineEnd, obj.lineEnd) ||
randomSamples != obj.randomSamples ||
(!randomSamples && (sampleDensity0 != obj.sampleDensity0)) ||
(randomSamples && (randomSeed != obj.randomSeed ||
numberOfRandomSamples != obj.numberOfRandomSamples)))
{
return true;
}
}
// If we're in line source mode and the line differs, sourceLineDiffers
// evaluates to true.
bool sourceLineDiffers = ((sourceType == SpecifiedLine) &&
(POINT_DIFFERS(lineStart, obj.lineStart) ||
POINT_DIFFERS(lineEnd, obj.lineEnd)));
if (sourceType == SpecifiedPlane)
{
if (POINT_DIFFERS(planeOrigin, obj.planeOrigin) ||
POINT_DIFFERS(planeNormal, obj.planeNormal) ||
POINT_DIFFERS(planeUpAxis, obj.planeUpAxis) ||
sampleDistance0 != obj.sampleDistance0 ||
sampleDistance1 != obj.sampleDistance1 ||
randomSamples != obj.randomSamples ||
fillInterior != obj.fillInterior ||
(randomSamples && (randomSeed != obj.randomSeed ||
numberOfRandomSamples != obj.numberOfRandomSamples)) ||
(!randomSamples && (sampleDensity0 != obj.sampleDensity0 ||
sampleDensity1 != obj.sampleDensity1)))
{
return true;
}
}
// If we're in plane source mode and the plane differs, sourcePlaneDiffers
// evaluates to true.
bool sourcePlaneDiffers = ((sourceType == SpecifiedPlane) &&
(POINT_DIFFERS(planeOrigin, obj.planeOrigin) ||
POINT_DIFFERS(planeNormal, obj.planeNormal) ||
POINT_DIFFERS(planeUpAxis, obj.planeUpAxis) ||
planeRadius != obj.planeRadius));
if (sourceType == SpecifiedCircle)
{
if (POINT_DIFFERS(planeOrigin, obj.planeOrigin) ||
POINT_DIFFERS(planeNormal, obj.planeNormal) ||
POINT_DIFFERS(planeUpAxis, obj.planeUpAxis) ||
radius != obj.radius ||
randomSamples != obj.randomSamples ||
fillInterior != obj.fillInterior ||
(randomSamples && (randomSeed != obj.randomSeed ||
numberOfRandomSamples != obj.numberOfRandomSamples)) ||
(!randomSamples && fillInterior && (sampleDensity0 != obj.sampleDensity0 ||
sampleDensity1 != obj.sampleDensity1)) ||
(!randomSamples && !fillInterior && (sampleDensity0 != obj.sampleDensity0)))
{
return true;
}
}
// If we're in sphere source mode and the sphere differs, sourceSphereDiffers
// evaluates to true.
bool sourceSphereDiffers = ((sourceType == SpecifiedSphere) &&
(POINT_DIFFERS(sphereOrigin, obj.sphereOrigin) ||
(sphereRadius != obj.sphereRadius)));
if (sourceType == SpecifiedSphere)
{
if (POINT_DIFFERS(sphereOrigin, obj.sphereOrigin) ||
radius != obj.radius ||
randomSamples != obj.randomSamples ||
fillInterior != obj.fillInterior ||
(randomSamples && (randomSeed != obj.randomSeed ||
numberOfRandomSamples != obj.numberOfRandomSamples)) ||
(!randomSamples && (sampleDensity0 != obj.sampleDensity0 ||
sampleDensity1 != obj.sampleDensity1 ||
sampleDensity2 != obj.sampleDensity2)))
{
return true;
}
}
bool sourcePointListDiffers = (sourceType == SpecifiedPointList);
if (sourcePointListDiffers)
if (sourceType == SpecifiedBox)
{
if (POINT_DIFFERS(boxExtents, obj.boxExtents) ||
POINT_DIFFERS(boxExtents+3, obj.boxExtents+3) ||
useWholeBox != obj.useWholeBox ||
randomSamples != obj.randomSamples ||
fillInterior != obj.fillInterior ||
(randomSamples && (randomSeed != obj.randomSeed ||
numberOfRandomSamples != obj.numberOfRandomSamples)) ||
(!randomSamples && (sampleDensity0 != obj.sampleDensity0 ||
sampleDensity1 != obj.sampleDensity1 ||
sampleDensity2 != obj.sampleDensity2)))
{
return true;
}
}
if (sourceType == SpecifiedPointList)
{
sourcePointListDiffers = false;
if (pointList.size() != obj.pointList.size())
sourcePointListDiffers = true;
return true;
else
for (int i = 0 ; i < pointList.size() ; i++)
if (pointList[i] != obj.pointList[i])
sourcePointListDiffers = true;
return true;
}
// If we're in circle source mode and the plane differs, sourcePlaneDiffers
// evaluates to true.
bool sourceCircleDiffers = ((sourceType == SpecifiedCircle) &&
(POINT_DIFFERS(planeOrigin, obj.planeOrigin) ||
POINT_DIFFERS(planeNormal, obj.planeNormal) ||
POINT_DIFFERS(planeUpAxis, obj.planeUpAxis) ||
planeRadius != obj.planeRadius));
// If we're in box source mode and the box differs, boxDiffers
// evaluates to true.
bool boxSourceDiffers = (sourceType == SpecifiedBox) &&
(POINT_DIFFERS(boxExtents, obj.boxExtents) ||
POINT_DIFFERS(boxExtents+3, obj.boxExtents+3));
if (useWholeBox != obj.useWholeBox)
boxSourceDiffers = true;
// Other things need to be true before we start paying attention to
// point density.
bool densityMatters = (sourceType == SpecifiedLine ||
sourceType == SpecifiedPlane || sourceType == SpecifiedSphere ||
sourceType == SpecifiedBox || sourceType == SpecifiedCircle) &&
(pointDensity != obj.pointDensity);
//If opacity is turned on, or the variable changes...
bool opacityMatters = (opacityType == VariableRange) &&
(obj.opacityType != VariableRange ||
opacityVariable != obj.opacityVariable);
//Ribbons requires the engine to calculate vorticity.
bool displayMatters = (displayMethod != obj.displayMethod && obj.displayMethod == Ribbons);
return (sourceType != obj.sourceType) ||
(streamlineDirection != obj.streamlineDirection) ||
displayMatters ||
(termination != obj.termination) ||
(terminationType != obj.terminationType) ||
(integrationType != obj.integrationType) ||
(maxStepLength != obj.maxStepLength) ||
(relTol != obj.relTol) ||
(absTol != obj.absTol) ||
(coloringMethod != obj.coloringMethod && obj.coloringMethod != Solid) ||
(pathlines != obj.pathlines) ||
(coloringVariable != obj.coloringVariable) ||
opacityMatters ||
sourcePointsDiffer ||
sourceLineDiffers ||
sourcePlaneDiffers ||
sourceSphereDiffers ||
sourceCircleDiffers ||
sourcePointListDiffers ||
boxSourceDiffers ||
densityMatters;
return false;
}
Function: ProcessOldVersions
......
......@@ -123,7 +123,7 @@
1.000000
0.000000
</Field>
<Field name="planeRadius" label="Plane radius" type="double" enabler="sourceType:SpecifiedPlane">
<Field name="radius" label="Radius" type="double">
1.000000
</Field>
<Field name="sphereOrigin" label="Sphere origin" type="doubleArray" length="3" enabler="sourceType:SpecifiedSphere">
......@@ -131,9 +131,6 @@
0.000000
0.000000
</Field>
<Field name="sphereRadius" label="Sphere radius" type="double" enabler="sourceType:SpecifiedSphere">
1.000000
</Field>
<Field name="boxExtents" label="Box extents" type="doubleArray" length="6" enabler="sourceType:SpecifiedBox">
0.000000
1.000000
......@@ -156,8 +153,14 @@
1.000000
0.000000
</Field>
<Field name="pointDensity" label="Point density" type="int" enabler="sourceType:SpecifiedLine,SpecifiedPlane,SpecifiedSphere,SpecifiedBox">
2
<Field name="sampleDensity0" label="sampleDensity0" type="int">
1
</Field>
<Field name="sampleDensity1" label="sampleDensity1" type="int">
1
</Field>
<Field name="sampleDensity2" label="sampleDensity2" type="int">
1
</Field>
<Field name="displayMethod" label="Display method" type="enum" subtype="DisplayMethod">
Lines
......@@ -289,6 +292,27 @@
<Field name="geomDisplayQuality" label="geomDisplayQuality" type="enum" subtype="DisplayQuality">
Medium
</Field>
<Field name="sampleDistance0" label="sampleDistance0" type="double">
1.000000
</Field>
<Field name="sampleDistance1" label="sampleDistance1" type="double">
1.000000
</Field>
<Field name="sampleDistance2" label="sampleDistance2" type="double">
1.000000
</Field>
<Field name="fillInterior" label="fillInterior" type="bool">
true