Commit d5d32638 authored by allens's avatar allens

added cleaning option

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@28265 18c085ea-50e0-402c-830e-de6fd14e8384
parent 8c31ca4d
......@@ -39,6 +39,12 @@
Difference
Variable
</Enum>
<Enum name="CleanupValue">
None
Merge
Before
After
</Enum>
<Enum name="CropValue">
Distance
Time
......@@ -250,6 +256,12 @@
<Field name="displayGeometry" label="Display geometry" type="enum" subtype="DisplayGeometry">
Lines
</Field>
<Field name="cleanupValue" label="Clean up value" type="enum" subtype="CleanupValue">
None
</Field>
<Field name="velThreshold" label="Velocity Threshold" type="double">
0.001000
</Field>
<Field name="cropBeginFlag" label="Crop from" type="bool">
false
</Field>
......
......@@ -126,6 +126,44 @@ IntegralCurveAttributes::DataValue_FromString(const std::string &s, IntegralCurv
return false;
}
//
// Enum conversion methods for IntegralCurveAttributes::CleanupValue
//
static const char *CleanupValue_strings[] = {
"None", "Merge", "Before",
"After"};
std::string
IntegralCurveAttributes::CleanupValue_ToString(IntegralCurveAttributes::CleanupValue t)
{
int index = int(t);
if(index < 0 || index >= 4) index = 0;
return CleanupValue_strings[index];
}
std::string
IntegralCurveAttributes::CleanupValue_ToString(int t)
{
int index = (t < 0 || t >= 4) ? 0 : t;
return CleanupValue_strings[index];
}
bool
IntegralCurveAttributes::CleanupValue_FromString(const std::string &s, IntegralCurveAttributes::CleanupValue &val)
{
val = IntegralCurveAttributes::None;
for(int i = 0; i < 4; ++i)
{
if(s == CleanupValue_strings[i])
{
val = (CleanupValue)i;
return true;
}
}
return false;
}
//
// Enum conversion methods for IntegralCurveAttributes::CropValue
//
......@@ -520,6 +558,8 @@ void IntegralCurveAttributes::Init()
pathlinesPeriod = 0;
pathlinesCMFE = POS_CMFE;
displayGeometry = Lines;
cleanupValue = None;
velThreshold = 0.001;
cropBeginFlag = false;
cropBegin = 0;
cropEndFlag = false;
......@@ -636,6 +676,8 @@ void IntegralCurveAttributes::Copy(const IntegralCurveAttributes &obj)
pathlinesPeriod = obj.pathlinesPeriod;
pathlinesCMFE = obj.pathlinesCMFE;
displayGeometry = obj.displayGeometry;
cleanupValue = obj.cleanupValue;
velThreshold = obj.velThreshold;
cropBeginFlag = obj.cropBeginFlag;
cropBegin = obj.cropBegin;
cropEndFlag = obj.cropEndFlag;
......@@ -907,6 +949,8 @@ IntegralCurveAttributes::operator == (const IntegralCurveAttributes &obj) const
(pathlinesPeriod == obj.pathlinesPeriod) &&
(pathlinesCMFE == obj.pathlinesCMFE) &&
(displayGeometry == obj.displayGeometry) &&
(cleanupValue == obj.cleanupValue) &&
(velThreshold == obj.velThreshold) &&
(cropBeginFlag == obj.cropBeginFlag) &&
(cropBegin == obj.cropBegin) &&
(cropEndFlag == obj.cropEndFlag) &&
......@@ -1232,6 +1276,8 @@ IntegralCurveAttributes::SelectAll()
Select(ID_pathlinesPeriod, (void *)&pathlinesPeriod);
Select(ID_pathlinesCMFE, (void *)&pathlinesCMFE);
Select(ID_displayGeometry, (void *)&displayGeometry);
Select(ID_cleanupValue, (void *)&cleanupValue);
Select(ID_velThreshold, (void *)&velThreshold);
Select(ID_cropBeginFlag, (void *)&cropBeginFlag);
Select(ID_cropBegin, (void *)&cropBegin);
Select(ID_cropEndFlag, (void *)&cropEndFlag);
......@@ -1558,6 +1604,18 @@ IntegralCurveAttributes::CreateNode(DataNode *parentNode, bool completeSave, boo
node->AddNode(new DataNode("displayGeometry", DisplayGeometry_ToString(displayGeometry)));
}
if(completeSave || !FieldsEqual(ID_cleanupValue, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("cleanupValue", CleanupValue_ToString(cleanupValue)));
}
if(completeSave || !FieldsEqual(ID_velThreshold, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("velThreshold", velThreshold));
}
if(completeSave || !FieldsEqual(ID_cropBeginFlag, &defaultObject))
{
addToParent = true;
......@@ -1954,6 +2012,24 @@ IntegralCurveAttributes::SetFromNode(DataNode *parentNode)
SetDisplayGeometry(value);
}
}
if((node = searchNode->GetNode("cleanupValue")) != 0)
{
// Allow enums to be int or string in the config file
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 4)
SetCleanupValue(CleanupValue(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
CleanupValue value;
if(CleanupValue_FromString(node->AsString(), value))
SetCleanupValue(value);
}
}
if((node = searchNode->GetNode("velThreshold")) != 0)
SetVelThreshold(node->AsDouble());
if((node = searchNode->GetNode("cropBeginFlag")) != 0)
SetCropBeginFlag(node->AsBool());
if((node = searchNode->GetNode("cropBegin")) != 0)
......@@ -2368,6 +2444,20 @@ IntegralCurveAttributes::SetDisplayGeometry(IntegralCurveAttributes::DisplayGeom
Select(ID_displayGeometry, (void *)&displayGeometry);
}
void
IntegralCurveAttributes::SetCleanupValue(IntegralCurveAttributes::CleanupValue cleanupValue_)
{
cleanupValue = cleanupValue_;
Select(ID_cleanupValue, (void *)&cleanupValue);
}
void
IntegralCurveAttributes::SetVelThreshold(double velThreshold_)
{
velThreshold = velThreshold_;
Select(ID_velThreshold, (void *)&velThreshold);
}
void
IntegralCurveAttributes::SetCropBeginFlag(bool cropBeginFlag_)
{
......@@ -2882,6 +2972,18 @@ IntegralCurveAttributes::GetDisplayGeometry() const
return DisplayGeometry(displayGeometry);
}
IntegralCurveAttributes::CleanupValue
IntegralCurveAttributes::GetCleanupValue() const
{
return CleanupValue(cleanupValue);
}
double
IntegralCurveAttributes::GetVelThreshold() const
{
return velThreshold;
}
bool
IntegralCurveAttributes::GetCropBeginFlag() const
{
......@@ -3183,6 +3285,8 @@ IntegralCurveAttributes::GetFieldName(int index) const
case ID_pathlinesPeriod: return "pathlinesPeriod";
case ID_pathlinesCMFE: return "pathlinesCMFE";
case ID_displayGeometry: return "displayGeometry";
case ID_cleanupValue: return "cleanupValue";
case ID_velThreshold: return "velThreshold";
case ID_cropBeginFlag: return "cropBeginFlag";
case ID_cropBegin: return "cropBegin";
case ID_cropEndFlag: return "cropEndFlag";
......@@ -3276,6 +3380,8 @@ IntegralCurveAttributes::GetFieldType(int index) const
case ID_pathlinesPeriod: return FieldType_double;
case ID_pathlinesCMFE: return FieldType_enum;
case ID_displayGeometry: return FieldType_enum;
case ID_cleanupValue: return FieldType_enum;
case ID_velThreshold: return FieldType_double;
case ID_cropBeginFlag: return FieldType_bool;
case ID_cropBegin: return FieldType_double;
case ID_cropEndFlag: return FieldType_bool;
......@@ -3369,6 +3475,8 @@ IntegralCurveAttributes::GetFieldTypeName(int index) const
case ID_pathlinesPeriod: return "double";
case ID_pathlinesCMFE: return "enum";
case ID_displayGeometry: return "enum";
case ID_cleanupValue: return "enum";
case ID_velThreshold: return "double";
case ID_cropBeginFlag: return "bool";
case ID_cropBegin: return "double";
case ID_cropEndFlag: return "bool";
......@@ -3689,6 +3797,16 @@ IntegralCurveAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) cons
retval = (displayGeometry == obj.displayGeometry);
}
break;
case ID_cleanupValue:
{ // new scope
retval = (cleanupValue == obj.cleanupValue);
}
break;
case ID_velThreshold:
{ // new scope
retval = (velThreshold == obj.velThreshold);
}
break;
case ID_cropBeginFlag:
{ // new scope
retval = (cropBeginFlag == obj.cropBeginFlag);
......
......@@ -86,6 +86,13 @@ public:
Difference,
Variable
};
enum CleanupValue
{
None,
Merge,
Before,
After
};
enum CropValue
{
Distance,
......@@ -229,6 +236,8 @@ public:
void SetPathlinesPeriod(double pathlinesPeriod_);
void SetPathlinesCMFE(PathlinesCMFE pathlinesCMFE_);
void SetDisplayGeometry(DisplayGeometry displayGeometry_);
void SetCleanupValue(CleanupValue cleanupValue_);
void SetVelThreshold(double velThreshold_);
void SetCropBeginFlag(bool cropBeginFlag_);
void SetCropBegin(double cropBegin_);
void SetCropEndFlag(bool cropEndFlag_);
......@@ -312,6 +321,8 @@ public:
double GetPathlinesPeriod() const;
PathlinesCMFE GetPathlinesCMFE() const;
DisplayGeometry GetDisplayGeometry() const;
CleanupValue GetCleanupValue() const;
double GetVelThreshold() const;
bool GetCropBeginFlag() const;
double GetCropBegin() const;
bool GetCropEndFlag() const;
......@@ -352,6 +363,11 @@ public:
static bool DataValue_FromString(const std::string &, DataValue &);
protected:
static std::string DataValue_ToString(int);
public:
static std::string CleanupValue_ToString(CleanupValue);
static bool CleanupValue_FromString(const std::string &, CleanupValue &);
protected:
static std::string CleanupValue_ToString(int);
public:
static std::string CropValue_ToString(CropValue);
static bool CropValue_FromString(const std::string &, CropValue &);
......@@ -451,6 +467,8 @@ public:
ID_pathlinesPeriod,
ID_pathlinesCMFE,
ID_displayGeometry,
ID_cleanupValue,
ID_velThreshold,
ID_cropBeginFlag,
ID_cropBegin,
ID_cropEndFlag,
......@@ -524,6 +542,8 @@ private:
double pathlinesPeriod;
int pathlinesCMFE;
int displayGeometry;
int cleanupValue;
double velThreshold;
bool cropBeginFlag;
double cropBegin;
bool cropEndFlag;
......@@ -553,6 +573,6 @@ private:
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define INTEGRALCURVEATTRIBUTES_TMFS "iDDDDDDdDDbd*d*iiiisiibdbddbddiddidDiiiiibbddiibdbdidddbbiibbbbbbddddis"
#define INTEGRALCURVEATTRIBUTES_TMFS "iDDDDDDdDDbd*d*iiiisiibdbddbddiddidDiiiiibbddiiidbdbdidddbbiibbbbbbddddis"
#endif
......@@ -589,6 +589,31 @@ PyIntegralCurveAttributes_ToString(const IntegralCurveAttributes *atts, const ch
break;
}
const char *cleanupValue_names = "None, Merge, Before, After";
switch (atts->GetCleanupValue())
{
case IntegralCurveAttributes::None:
SNPRINTF(tmpStr, 1000, "%scleanupValue = %sNone # %s\n", prefix, prefix, cleanupValue_names);
str += tmpStr;
break;
case IntegralCurveAttributes::Merge:
SNPRINTF(tmpStr, 1000, "%scleanupValue = %sMerge # %s\n", prefix, prefix, cleanupValue_names);
str += tmpStr;
break;
case IntegralCurveAttributes::Before:
SNPRINTF(tmpStr, 1000, "%scleanupValue = %sBefore # %s\n", prefix, prefix, cleanupValue_names);
str += tmpStr;
break;
case IntegralCurveAttributes::After:
SNPRINTF(tmpStr, 1000, "%scleanupValue = %sAfter # %s\n", prefix, prefix, cleanupValue_names);
str += tmpStr;
break;
default:
break;
}
SNPRINTF(tmpStr, 1000, "%svelThreshold = %g\n", prefix, atts->GetVelThreshold());
str += tmpStr;
if(atts->GetCropBeginFlag())
SNPRINTF(tmpStr, 1000, "%scropBeginFlag = 1\n", prefix);
else
......@@ -2225,6 +2250,63 @@ IntegralCurveAttributes_GetDisplayGeometry(PyObject *self, PyObject *args)
return retval;
}
/*static*/ PyObject *
IntegralCurveAttributes_SetCleanupValue(PyObject *self, PyObject *args)
{
IntegralCurveAttributesObject *obj = (IntegralCurveAttributesObject *)self;
int ival;
if(!PyArg_ParseTuple(args, "i", &ival))
return NULL;
// Set the cleanupValue in the object.
if(ival >= 0 && ival < 4)
obj->data->SetCleanupValue(IntegralCurveAttributes::CleanupValue(ival));
else
{
fprintf(stderr, "An invalid cleanupValue value was given. "
"Valid values are in the range of [0,3]. "
"You can also use the following names: "
"None, Merge, Before, After.");
return NULL;
}
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
IntegralCurveAttributes_GetCleanupValue(PyObject *self, PyObject *args)
{
IntegralCurveAttributesObject *obj = (IntegralCurveAttributesObject *)self;
PyObject *retval = PyInt_FromLong(long(obj->data->GetCleanupValue()));
return retval;
}
/*static*/ PyObject *
IntegralCurveAttributes_SetVelThreshold(PyObject *self, PyObject *args)
{
IntegralCurveAttributesObject *obj = (IntegralCurveAttributesObject *)self;
double dval;
if(!PyArg_ParseTuple(args, "d", &dval))
return NULL;
// Set the velThreshold in the object.
obj->data->SetVelThreshold(dval);
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
IntegralCurveAttributes_GetVelThreshold(PyObject *self, PyObject *args)
{
IntegralCurveAttributesObject *obj = (IntegralCurveAttributesObject *)self;
PyObject *retval = PyFloat_FromDouble(obj->data->GetVelThreshold());
return retval;
}
/*static*/ PyObject *
IntegralCurveAttributes_SetCropBeginFlag(PyObject *self, PyObject *args)
{
......@@ -2913,6 +2995,10 @@ PyMethodDef PyIntegralCurveAttributes_methods[INTEGRALCURVEATTRIBUTES_NMETH] = {
{"GetPathlinesCMFE", IntegralCurveAttributes_GetPathlinesCMFE, METH_VARARGS},
{"SetDisplayGeometry", IntegralCurveAttributes_SetDisplayGeometry, METH_VARARGS},
{"GetDisplayGeometry", IntegralCurveAttributes_GetDisplayGeometry, METH_VARARGS},
{"SetCleanupValue", IntegralCurveAttributes_SetCleanupValue, METH_VARARGS},
{"GetCleanupValue", IntegralCurveAttributes_GetCleanupValue, METH_VARARGS},
{"SetVelThreshold", IntegralCurveAttributes_SetVelThreshold, METH_VARARGS},
{"GetVelThreshold", IntegralCurveAttributes_GetVelThreshold, METH_VARARGS},
{"SetCropBeginFlag", IntegralCurveAttributes_SetCropBeginFlag, METH_VARARGS},
{"GetCropBeginFlag", IntegralCurveAttributes_GetCropBeginFlag, METH_VARARGS},
{"SetCropBegin", IntegralCurveAttributes_SetCropBegin, METH_VARARGS},
......@@ -3188,6 +3274,19 @@ PyIntegralCurveAttributes_getattr(PyObject *self, char *name)
if(strcmp(name, "Ribbons") == 0)
return PyInt_FromLong(long(IntegralCurveAttributes::Ribbons));
if(strcmp(name, "cleanupValue") == 0)
return IntegralCurveAttributes_GetCleanupValue(self, NULL);
if(strcmp(name, "None") == 0)
return PyInt_FromLong(long(IntegralCurveAttributes::None));
if(strcmp(name, "Merge") == 0)
return PyInt_FromLong(long(IntegralCurveAttributes::Merge));
if(strcmp(name, "Before") == 0)
return PyInt_FromLong(long(IntegralCurveAttributes::Before));
if(strcmp(name, "After") == 0)
return PyInt_FromLong(long(IntegralCurveAttributes::After));
if(strcmp(name, "velThreshold") == 0)
return IntegralCurveAttributes_GetVelThreshold(self, NULL);
if(strcmp(name, "cropBeginFlag") == 0)
return IntegralCurveAttributes_GetCropBeginFlag(self, NULL);
if(strcmp(name, "cropBegin") == 0)
......@@ -3352,6 +3451,10 @@ PyIntegralCurveAttributes_setattr(PyObject *self, char *name, PyObject *args)
obj = IntegralCurveAttributes_SetPathlinesCMFE(self, tuple);
else if(strcmp(name, "displayGeometry") == 0)
obj = IntegralCurveAttributes_SetDisplayGeometry(self, tuple);
else if(strcmp(name, "cleanupValue") == 0)
obj = IntegralCurveAttributes_SetCleanupValue(self, tuple);
else if(strcmp(name, "velThreshold") == 0)
obj = IntegralCurveAttributes_SetVelThreshold(self, tuple);
else if(strcmp(name, "cropBeginFlag") == 0)
obj = IntegralCurveAttributes_SetCropBeginFlag(self, tuple);
else if(strcmp(name, "cropBegin") == 0)
......
......@@ -44,7 +44,7 @@
//
// Functions exposed to the VisIt module.
//
#define INTEGRALCURVEATTRIBUTES_NMETH 140
#define INTEGRALCURVEATTRIBUTES_NMETH 144
void PyIntegralCurveAttributes_StartUp(IntegralCurveAttributes *subj, void *data);
void PyIntegralCurveAttributes_CloseDown();
PyMethodDef * PyIntegralCurveAttributes_GetMethodTable(int *nMethods);
......
......@@ -808,10 +808,37 @@ QvisIntegralCurveWindow::CreateAppearanceTab(QWidget *pageAppearance)
connect(correlationDistanceMinDistEdit, SIGNAL(returnPressed()),
this, SLOT(processCorrelationDistanceMinDistEditText()));
// Create the cleanup group
QGroupBox *cleanupGrp = new QGroupBox(pageAppearance);
cleanupGrp->setTitle(tr("Cleanup the integral curve"));
mainLayout->addWidget(cleanupGrp, 3, 0);
QGridLayout *cleanupLayout = new QGridLayout(cleanupGrp);
cleanupLayout->setMargin(5);
cleanupLayout->setSpacing(10);
// Create the cleanup value.
cleanupLayout->addWidget(new QLabel(tr("Point cleanup"), cleanupGrp), 0, 0);
cleanupValueComboBox = new QComboBox(cleanupGrp);
cleanupValueComboBox->addItem(tr("Keep all points"));
cleanupValueComboBox->addItem(tr("Merge"));
cleanupValueComboBox->addItem(tr("Delete points before"));
cleanupValueComboBox->addItem(tr("Delete points after "));
connect(cleanupValueComboBox, SIGNAL(activated(int)), this, SLOT(cleanupValueChanged(int)));
cleanupLayout->addWidget(cleanupValueComboBox, 0, 1);
velThresholdLabel = new QLabel(tr("Velocity threshold"), cleanupGrp);
cleanupLayout->addWidget(velThresholdLabel, 0, 2);
velThreshold = new QLineEdit(cleanupGrp);
connect(velThreshold, SIGNAL(returnPressed()), this, SLOT(velThresholdnProcessText()));
cleanupLayout->addWidget(velThreshold, 0, 3);
// Create the crop group
QGroupBox *cropGrp = new QGroupBox(pageAppearance);
cropGrp->setTitle(tr("Crop the integral curve (for animations)"));
mainLayout->addWidget(cropGrp, 3, 0);
mainLayout->addWidget(cropGrp, 4, 0);
QGridLayout *cropLayout = new QGridLayout(cropGrp);
cropLayout->setMargin(5);
......@@ -848,7 +875,7 @@ QvisIntegralCurveWindow::CreateAppearanceTab(QWidget *pageAppearance)
// Streamlines/Pathline Group.
QGroupBox *icGrp = new QGroupBox(pageAppearance);
icGrp->setTitle(tr("Streamlines vs Pathlines"));
mainLayout->addWidget(icGrp, 4, 0);
mainLayout->addWidget(icGrp, 5, 0);
QGridLayout *icGrpLayout = new QGridLayout(icGrp);
icGrpLayout->setSpacing(10);
......@@ -1401,6 +1428,20 @@ QvisIntegralCurveWindow::UpdateWindow(bool doAll)
}
break;
case IntegralCurveAttributes::ID_cleanupValue:
cleanupValueComboBox->blockSignals(true);
cleanupValueComboBox->setCurrentIndex(int(atts->GetCleanupValue()));
cleanupValueComboBox->blockSignals(false);
velThresholdLabel->setEnabled(atts->GetCleanupValue()>1);
velThreshold->setEnabled(atts->GetCleanupValue()>1);
break;
case IntegralCurveAttributes::ID_velThreshold:
velThreshold->setText(DoubleToQString(atts->GetVelThreshold()));
break;
case IntegralCurveAttributes::ID_cropBeginFlag:
cropBeginFlag->blockSignals(true);
cropBeginFlag->setChecked(atts->GetCropBeginFlag());
......@@ -2280,6 +2321,20 @@ QvisIntegralCurveWindow::GetCurrentValues(int which_widget)
atts->SetTermDistance(atts->GetTermDistance());
}
}
// Do velocity threshold
if(which_widget == IntegralCurveAttributes::ID_velThreshold || doAll)
{
double val;
if(LineEditGetDouble(velThreshold, val))
atts->SetVelThreshold(val);
else
{
ResettingError(tr("velocity threshold"),
DoubleToQString(atts->GetVelThreshold()));
atts->SetVelThreshold(atts->GetVelThreshold());
}
}
// Do crop begin
if(which_widget == IntegralCurveAttributes::ID_cropBegin || doAll)
{
......@@ -2940,6 +2995,20 @@ QvisIntegralCurveWindow::workGroupSizeChanged(int val)
Apply();
}
void
QvisIntegralCurveWindow::cleanupValueChanged(int val)
{
atts->SetCleanupValue((IntegralCurveAttributes::CleanupValue)val);
Apply();
}
void
QvisIntegralCurveWindow::velThresholdProcessText()
{
GetCurrentValues(IntegralCurveAttributes::ID_velThreshold);
Apply();
}
void
QvisIntegralCurveWindow::cropBeginFlagChanged(bool val)
{
......
......@@ -250,6 +250,9 @@ class QvisIntegralCurveWindow : public QvisOperatorWindow
void processCorrelationDistanceAngTolEditText();
void processCorrelationDistanceMinDistEditText();
void cleanupValueChanged(int val);
void velThresholdProcessText();
void cropBeginFlagChanged(bool val);
void cropBeginProcessText();
void cropEndFlagChanged(bool val);
......@@ -357,7 +360,11 @@ class QvisIntegralCurveWindow : public QvisOperatorWindow
QLineEdit *correlationDistanceAngTolEdit, *correlationDistanceMinDistEdit;
QComboBox *correlationDistanceMinDistType;
QCheckBox *cropBeginFlag;
QLabel *velThresholdLabel;
QLineEdit *velThreshold;
QComboBox *cleanupValueComboBox;
QCheckBox *cropBeginFlag;
QLineEdit *cropBegin;
QCheckBox *cropEndFlag;
QLineEdit *cropEnd;
......
......@@ -213,6 +213,8 @@ avtIntegralCurveFilter::avtIntegralCurveFilter() : seedVelocity(0,0,0),
{
dataValue = IntegralCurveAttributes::TimeAbsolute;
displayGeometry = IntegralCurveAttributes::Lines;
cleanupValue = IntegralCurveAttributes::None;
velThreshold = 1e-3;
cropValue = IntegralCurveAttributes::Time;
//
......@@ -686,6 +688,8 @@ avtIntegralCurveFilter::SetAtts(const AttributeGroup *a)
atts.GetCriticalPointThreshold());
SetDataValue(int(atts.GetDataValue()), atts.GetDataVariable());
SetCleanupValue(int(atts.GetCleanupValue()),
double(atts.GetVelThreshold()));
SetCropValue(int(atts.GetCropValue()));
if (atts.GetDataValue() == IntegralCurveAttributes::CorrelationDistance)
......@@ -1040,6 +1044,29 @@ avtIntegralCurveFilter::SetDataValue(int m, const std::string &var)
dataVariable = var;
}
// ****************************************************************************
// Method: avtIntegralCurveFilter::SetCleanupValue
//
// Purpose:
// Sets clean up value to use
//
// Arguments:
// m : The crop value.
//
// Programmer: Brad Whitlock
// Creation: Wed Dec 22 12:41:08 PDT 2004
//
// Modifications:
//
// ****************************************************************************
void
avtIntegralCurveFilter::SetCleanupValue(int m, double v)
{
cleanupValue = m;
velThreshold = v;
}
// ****************************************************************************
// Method: avtIntegralCurveFilter::SetCropValue
//
......@@ -2841,15 +2868,21 @@ avtIntegralCurveFilter::CreateIntegralCurveOutput(std::vector<avtIntegralCurve *
// Remove all of the points that are below the critical point
// threshold except for the first point. The first point is
// kept so the critical point location is known.
for (int j=beginIndex; j<=endIndex; ++j)
if( displayGeometry == IntegralCurveAttributes::Tubes ||
displayGeometry == IntegralCurveAttributes::Ribbons ||
cleanupValue == IntegralCurveAttributes::Before ||
cleanupValue == IntegralCurveAttributes::After )
{
for (int j=beginIndex; j<=endIndex; ++j)
{
s = ic->GetSample(j);
if (s.velocity.length() < criticalPointThreshold)
if (s.velocity.length() < velThreshold)
{
totalSamples -= (endIndex-j);
break;
}
}
}
if( totalSamples < 2 )
......@@ -2888,25 +2921,37 @@ avtIntegralCurveFilter::CreateIntegralCurveOutput(std::vector<avtIntegralCurve *
distance /= nSamples;
}
for (int j=beginIndex; j<=endIndex; ++j)
for (int j=beginIndex, k=0; j<=endIndex; ++j, ++k)
{
if( cropBeginInterpolate && j == beginIndex )
cropBeginIndex = pIdx;
s = ic->GetSample(j);
if( cropEndInterpolate && j == endIndex )
cropEndIndex = pIdx;
double speed = s.velocity.length();
s = ic->GetSample(j);
// Reached a critical point so stop.
if( cleanupValue == IntegralCurveAttributes::Before )
{
if (speed < velThreshold)
{
j = endIndex;
s = ic->GetSample(j);
speed = s.velocity.length();
}
}
if( cropBeginInterpolate && j == beginIndex )
cropBeginIndex = pIdx;
if( cropEndInterpolate && j == endIndex )
cropEndIndex = pIdx;
line->GetPointIds()->SetId(j-beginIndex, pIdx);
line->GetPointIds()->SetId(k, pIdx);
// Points
points->InsertPoint(pIdx,
s.position.x, s.position.y, s.position.z);
points->InsertPoint(pIdx, s.position.x, s.position.y, s.position.z);
// Normalize the spped.
double speed = s.velocity.length();
if (speed > 0)
s.velocity *= 1.0f/speed;
......@@ -2971,14 +3016,19 @@ avtIntegralCurveFilter::CreateIntegralCurveOutput(std::vector<avtIntegralCurve *
}
// secondary scalars
for( unsigned int i=0; i<secondaryVariables.size(); ++i )
secondarys[i]->InsertTuple1(pIdx, s.secondarys[i]);
for( unsigned int l=0; l<secondaryVariables.size(); ++l )
secondarys[l]->