Commit a46e3faa authored by pugmire's avatar pugmire
Browse files

Option to force node centering.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11838 18c085ea-50e0-402c-830e-de6fd14e8384
parent 1fe7892d
......@@ -215,6 +215,9 @@
<Field name="workGroupSize" label="Work group size" type="int">
32
</Field>
<Field name="forceNodeCenteredData" label="forceNodeCenteredData" type="bool">
false
</Field>
<Function name="CopyAttributes" user="false" member="true">
</Function>
<Function name="CreateCompatible" user="false" member="true">
......
......@@ -416,6 +416,7 @@ void PoincareAttributes::Init()
maxStreamlineProcessCount = 10;
maxDomainCacheSize = 3;
workGroupSize = 32;
forceNodeCenteredData = false;
PoincareAttributes::SelectAll();
}
......@@ -497,6 +498,7 @@ void PoincareAttributes::Copy(const PoincareAttributes &obj)
maxStreamlineProcessCount = obj.maxStreamlineProcessCount;
maxDomainCacheSize = obj.maxDomainCacheSize;
workGroupSize = obj.workGroupSize;
forceNodeCenteredData = obj.forceNodeCenteredData;
PoincareAttributes::SelectAll();
}
......@@ -721,7 +723,8 @@ PoincareAttributes::operator == (const PoincareAttributes &obj) const
(streamlineAlgorithmType == obj.streamlineAlgorithmType) &&
(maxStreamlineProcessCount == obj.maxStreamlineProcessCount) &&
(maxDomainCacheSize == obj.maxDomainCacheSize) &&
(workGroupSize == obj.workGroupSize));
(workGroupSize == obj.workGroupSize) &&
(forceNodeCenteredData == obj.forceNodeCenteredData));
}
// ****************************************************************************
......@@ -941,6 +944,7 @@ PoincareAttributes::SelectAll()
Select(ID_maxStreamlineProcessCount, (void *)&maxStreamlineProcessCount);
Select(ID_maxDomainCacheSize, (void *)&maxDomainCacheSize);
Select(ID_workGroupSize, (void *)&workGroupSize);
Select(ID_forceNodeCenteredData, (void *)&forceNodeCenteredData);
}
///////////////////////////////////////////////////////////////////////////////
......@@ -1281,6 +1285,12 @@ PoincareAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool for
node->AddNode(new DataNode("workGroupSize", workGroupSize));
}
if(completeSave || !FieldsEqual(ID_forceNodeCenteredData, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("forceNodeCenteredData", forceNodeCenteredData));
}
// Add the node to the parent node.
if(addToParent || forceAdd)
......@@ -1531,6 +1541,8 @@ PoincareAttributes::SetFromNode(DataNode *parentNode)
SetMaxDomainCacheSize(node->AsInt());
if((node = searchNode->GetNode("workGroupSize")) != 0)
SetWorkGroupSize(node->AsInt());
if((node = searchNode->GetNode("forceNodeCenteredData")) != 0)
SetForceNodeCenteredData(node->AsBool());
}
///////////////////////////////////////////////////////////////////////////////
......@@ -1900,6 +1912,13 @@ PoincareAttributes::SetWorkGroupSize(int workGroupSize_)
Select(ID_workGroupSize, (void *)&workGroupSize);
}
void
PoincareAttributes::SetForceNodeCenteredData(bool forceNodeCenteredData_)
{
forceNodeCenteredData = forceNodeCenteredData_;
Select(ID_forceNodeCenteredData, (void *)&forceNodeCenteredData);
}
///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////
......@@ -2240,6 +2259,12 @@ PoincareAttributes::GetWorkGroupSize() const
return workGroupSize;
}
bool
PoincareAttributes::GetForceNodeCenteredData() const
{
return forceNodeCenteredData;
}
///////////////////////////////////////////////////////////////////////////////
// Select property methods
///////////////////////////////////////////////////////////////////////////////
......@@ -2349,6 +2374,7 @@ PoincareAttributes::GetFieldName(int index) const
case ID_maxStreamlineProcessCount: return "maxStreamlineProcessCount";
case ID_maxDomainCacheSize: return "maxDomainCacheSize";
case ID_workGroupSize: return "workGroupSize";
case ID_forceNodeCenteredData: return "forceNodeCenteredData";
default: return "invalid index";
}
}
......@@ -2424,6 +2450,7 @@ PoincareAttributes::GetFieldType(int index) const
case ID_maxStreamlineProcessCount: return FieldType_int;
case ID_maxDomainCacheSize: return FieldType_int;
case ID_workGroupSize: return FieldType_int;
case ID_forceNodeCenteredData: return FieldType_bool;
default: return FieldType_unknown;
}
}
......@@ -2499,6 +2526,7 @@ PoincareAttributes::GetFieldTypeName(int index) const
case ID_maxStreamlineProcessCount: return "int";
case ID_maxDomainCacheSize: return "int";
case ID_workGroupSize: return "int";
case ID_forceNodeCenteredData: return "bool";
default: return "invalid index";
}
}
......@@ -2795,6 +2823,11 @@ PoincareAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
retval = (workGroupSize == obj.workGroupSize);
}
break;
case ID_forceNodeCenteredData:
{ // new scope
retval = (forceNodeCenteredData == obj.forceNodeCenteredData);
}
break;
default: retval = false;
}
......
......@@ -200,6 +200,7 @@ public:
void SetMaxStreamlineProcessCount(int maxStreamlineProcessCount_);
void SetMaxDomainCacheSize(int maxDomainCacheSize_);
void SetWorkGroupSize(int workGroupSize_);
void SetForceNodeCenteredData(bool forceNodeCenteredData_);
// Property getting methods
Opacity GetOpacityType() const;
......@@ -258,6 +259,7 @@ public:
int GetMaxStreamlineProcessCount() const;
int GetMaxDomainCacheSize() const;
int GetWorkGroupSize() const;
bool GetForceNodeCenteredData() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
......@@ -369,6 +371,7 @@ public:
ID_maxStreamlineProcessCount,
ID_maxDomainCacheSize,
ID_workGroupSize,
ID_forceNodeCenteredData,
ID__LAST
};
......@@ -424,11 +427,12 @@ private:
int maxStreamlineProcessCount;
int maxDomainCacheSize;
int workGroupSize;
bool forceNodeCenteredData;
// Static class format string for type map.
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define POINCAREATTRIBUTES_TMFS "idiiiDDDiidddiiddiiiidddbbiasibibibbbbbiibdiibbiiii"
#define POINCAREATTRIBUTES_TMFS "idiiiDDDiidddiiddiiiidddbbiasibibibbbbbiibdiibbiiiib"
#endif
......@@ -60,7 +60,7 @@ import llnl.visit.ColorAttribute;
public class PoincareAttributes extends AttributeSubject implements Plugin
{
private static int PoincareAttributes_numAdditionalAtts = 51;
private static int PoincareAttributes_numAdditionalAtts = 52;
// Enum values
public final static int SOURCETYPE_SPECIFIEDPOINT = 0;
......@@ -167,6 +167,7 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
maxStreamlineProcessCount = 10;
maxDomainCacheSize = 3;
workGroupSize = 32;
forceNodeCenteredData = false;
}
public PoincareAttributes(int nMoreFields)
......@@ -233,6 +234,7 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
maxStreamlineProcessCount = 10;
maxDomainCacheSize = 3;
workGroupSize = 32;
forceNodeCenteredData = false;
}
public PoincareAttributes(PoincareAttributes obj)
......@@ -304,6 +306,7 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
maxStreamlineProcessCount = obj.maxStreamlineProcessCount;
maxDomainCacheSize = obj.maxDomainCacheSize;
workGroupSize = obj.workGroupSize;
forceNodeCenteredData = obj.forceNodeCenteredData;
SelectAll();
}
......@@ -388,7 +391,8 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
(streamlineAlgorithmType == obj.streamlineAlgorithmType) &&
(maxStreamlineProcessCount == obj.maxStreamlineProcessCount) &&
(maxDomainCacheSize == obj.maxDomainCacheSize) &&
(workGroupSize == obj.workGroupSize));
(workGroupSize == obj.workGroupSize) &&
(forceNodeCenteredData == obj.forceNodeCenteredData));
}
public String GetName() { return "Poincare"; }
......@@ -731,6 +735,12 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
Select(50);
}
public void SetForceNodeCenteredData(boolean forceNodeCenteredData_)
{
forceNodeCenteredData = forceNodeCenteredData_;
Select(51);
}
// Property getting methods
public int GetOpacityType() { return opacityType; }
public double GetOpacity() { return opacity; }
......@@ -783,6 +793,7 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
public int GetMaxStreamlineProcessCount() { return maxStreamlineProcessCount; }
public int GetMaxDomainCacheSize() { return maxDomainCacheSize; }
public int GetWorkGroupSize() { return workGroupSize; }
public boolean GetForceNodeCenteredData() { return forceNodeCenteredData; }
// Write and read methods.
public void WriteAtts(CommunicationBuffer buf)
......@@ -889,6 +900,8 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
buf.WriteInt(maxDomainCacheSize);
if(WriteSelect(50, buf))
buf.WriteInt(workGroupSize);
if(WriteSelect(51, buf))
buf.WriteBool(forceNodeCenteredData);
}
public void ReadAtts(int index, CommunicationBuffer buf)
......@@ -1049,6 +1062,9 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
case 50:
SetWorkGroupSize(buf.ReadInt());
break;
case 51:
SetForceNodeCenteredData(buf.ReadBool());
break;
}
}
......@@ -1176,6 +1192,7 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
str = str + intToString("maxStreamlineProcessCount", maxStreamlineProcessCount, indent) + "\n";
str = str + intToString("maxDomainCacheSize", maxDomainCacheSize, indent) + "\n";
str = str + intToString("workGroupSize", workGroupSize, indent) + "\n";
str = str + boolToString("forceNodeCenteredData", forceNodeCenteredData, indent) + "\n";
return str;
}
......@@ -1232,5 +1249,6 @@ public class PoincareAttributes extends AttributeSubject implements Plugin
private int maxStreamlineProcessCount;
private int maxDomainCacheSize;
private int workGroupSize;
private boolean forceNodeCenteredData;
}
......@@ -425,6 +425,11 @@ PyPoincareAttributes_ToString(const PoincareAttributes *atts, const char *prefix
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sworkGroupSize = %d\n", prefix, atts->GetWorkGroupSize());
str += tmpStr;
if(atts->GetForceNodeCenteredData())
SNPRINTF(tmpStr, 1000, "%sforceNodeCenteredData = 1\n", prefix);
else
SNPRINTF(tmpStr, 1000, "%sforceNodeCenteredData = 0\n", prefix);
str += tmpStr;
return str;
}
......@@ -1888,6 +1893,30 @@ PoincareAttributes_GetWorkGroupSize(PyObject *self, PyObject *args)
return retval;
}
/*static*/ PyObject *
PoincareAttributes_SetForceNodeCenteredData(PyObject *self, PyObject *args)
{
PoincareAttributesObject *obj = (PoincareAttributesObject *)self;
int ival;
if(!PyArg_ParseTuple(args, "i", &ival))
return NULL;
// Set the forceNodeCenteredData in the object.
obj->data->SetForceNodeCenteredData(ival != 0);
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
PoincareAttributes_GetForceNodeCenteredData(PyObject *self, PyObject *args)
{
PoincareAttributesObject *obj = (PoincareAttributesObject *)self;
PyObject *retval = PyInt_FromLong(obj->data->GetForceNodeCenteredData()?1L:0L);
return retval;
}
PyMethodDef PyPoincareAttributes_methods[POINCAREATTRIBUTES_NMETH] = {
......@@ -1994,6 +2023,8 @@ PyMethodDef PyPoincareAttributes_methods[POINCAREATTRIBUTES_NMETH] = {
{"GetMaxDomainCacheSize", PoincareAttributes_GetMaxDomainCacheSize, METH_VARARGS},
{"SetWorkGroupSize", PoincareAttributes_SetWorkGroupSize, METH_VARARGS},
{"GetWorkGroupSize", PoincareAttributes_GetWorkGroupSize, METH_VARARGS},
{"SetForceNodeCenteredData", PoincareAttributes_SetForceNodeCenteredData, METH_VARARGS},
{"GetForceNodeCenteredData", PoincareAttributes_GetForceNodeCenteredData, METH_VARARGS},
{NULL, NULL}
};
......@@ -2203,6 +2234,8 @@ PyPoincareAttributes_getattr(PyObject *self, char *name)
return PoincareAttributes_GetMaxDomainCacheSize(self, NULL);
if(strcmp(name, "workGroupSize") == 0)
return PoincareAttributes_GetWorkGroupSize(self, NULL);
if(strcmp(name, "forceNodeCenteredData") == 0)
return PoincareAttributes_GetForceNodeCenteredData(self, NULL);
return Py_FindMethod(PyPoincareAttributes_methods, self, name);
}
......@@ -2319,6 +2352,8 @@ PyPoincareAttributes_setattr(PyObject *self, char *name, PyObject *args)
obj = PoincareAttributes_SetMaxDomainCacheSize(self, tuple);
else if(strcmp(name, "workGroupSize") == 0)
obj = PoincareAttributes_SetWorkGroupSize(self, tuple);
else if(strcmp(name, "forceNodeCenteredData") == 0)
obj = PoincareAttributes_SetForceNodeCenteredData(self, tuple);
if(obj != NULL)
Py_DECREF(obj);
......
......@@ -44,7 +44,7 @@
//
// Functions exposed to the VisIt module.
//
#define POINCAREATTRIBUTES_NMETH 104
#define POINCAREATTRIBUTES_NMETH 106
void PyPoincareAttributes_StartUp(PoincareAttributes *subj, void *data);
void PyPoincareAttributes_CloseDown();
PyMethodDef * PyPoincareAttributes_GetMethodTable(int *nMethods);
......
......@@ -239,6 +239,12 @@ QvisPoincarePlotWindow::CreateWindowContents()
this, SLOT(absTolProcessText()));
integrationLayout->addWidget(absTol, 3,1);
forceNodalLabel = new QLabel(tr("Force node centering"), integrationGroup);
forceNodal = new QCheckBox(integrationGroup);
connect(forceNodal, SIGNAL(toggled(bool)), this, SLOT(forceNodalChanged(bool)));
integrationLayout->addWidget(forceNodalLabel, 4,0);
integrationLayout->addWidget(forceNodal, 4, 1);
// Create the punctures group box.
QGroupBox *puncturesGroup = new QGroupBox(firstTab);
puncturesGroup->setTitle(tr("Punctures"));
......@@ -1056,6 +1062,12 @@ QvisPoincarePlotWindow::UpdateWindow(bool doAll)
workGroupSize->setValue(atts->GetWorkGroupSize());
workGroupSize->blockSignals(false);
break;
case PoincareAttributes::ID_forceNodeCenteredData:
forceNodal->blockSignals(true);
forceNodal->setChecked(atts->GetForceNodeCenteredData());
forceNodal->blockSignals(false);
break;
}
}
}
......@@ -1888,3 +1900,9 @@ QvisPoincarePlotWindow::lineStyleChanged(int val)
Apply();
}
void
QvisPoincarePlotWindow::forceNodalChanged(bool val)
{
atts->SetForceNodeCenteredData(val);
Apply();
}
......@@ -77,6 +77,9 @@ class QvisLineStyleWidget;
// Allen Sanderson, Sun Mar 7 12:49:56 PST 2010
// Change layout of window for 2.0 interface changes.
//
// Dave Pugmire, Thu Jul 8 09:03:20 EDT 2010
// Add force node centering option.
//
// ****************************************************************************
class QvisPoincarePlotWindow : public QvisPostableWindowObserver
......@@ -151,6 +154,7 @@ class QvisPoincarePlotWindow : public QvisPostableWindowObserver
void maxSLCountChanged(int val);
void maxDomainCacheChanged(int val);
void workGroupSizeChanged(int val);
void forceNodalChanged(bool);
private:
QTabWidget *propertyTabs;
......@@ -222,6 +226,8 @@ class QvisPoincarePlotWindow : public QvisPostableWindowObserver
QLabel *maxStepLengthLabel;
QLabel *relTolLabel;
QLabel *absTolLabel;
QLabel *forceNodalLabel;
QCheckBox *forceNodal;
QLabel *maxToroidalWindingLabel;
QLabel *overrideToroidalWindingLabel;
QLabel *windingPairConfidenceLabel;
......
......@@ -189,6 +189,11 @@ avtPoincarePlot::GetMapper(void)
// Programmer: Dave Pugmire -- generated by xml2avt
// Creation: Tue Oct 7 09:02:52 PDT 2008
//
// Modifications:
//
// Dave Pugmire, Thu Jul 8 09:03:20 EDT 2010
// Add force node centering option.
//
// ****************************************************************************
avtDataObject_p
......@@ -203,12 +208,9 @@ avtPoincarePlot::ApplyOperators(avtDataObject_p input)
if (input->GetInfo().GetAttributes().ValidVariable(varname))
centering = input->GetInfo().GetAttributes().GetCentering(varname);
// If the variable centering is zonal, convert it to nodal or the
// streamline filter will not play with it.
if(centering == AVT_ZONECENT)
//Convert from zonal to nodal, if requested.
if(centering == AVT_ZONECENT && atts.GetForceNodeCenteredData())
{
avtCallback::IssueWarning("The vector field being used to generate the streamline(s) is zone (cell) centered. Streamline requires nodal data, moving data from from zones to the nodes. This change in centering may have unintended consequences." );
if(shiftCenteringFilter != NULL)
delete shiftCenteringFilter;
shiftCenteringFilter = new avtShiftCenteringFilter(AVT_NODECENT);
......@@ -216,7 +218,6 @@ avtPoincarePlot::ApplyOperators(avtDataObject_p input)
dob = shiftCenteringFilter->GetOutput();
}
// Add the Poincare filter.
poincareFilter->SetInput(input);
dob = poincareFilter->GetOutput();
......
......@@ -71,6 +71,9 @@ class avtPoincareFilter;
// Dave Pugmire, Thu Jul 1 13:55:28 EDT 2010
// Switch to variablePointGlyphMapper
//
// Dave Pugmire, Thu Jul 8 09:03:20 EDT 2010
// Add force node centering option.
//
// ****************************************************************************
class avtPoincarePlot : public avtLineDataPlot
......
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