Commit d2db1157 authored by allens's avatar allens

added a flip option for the toroidal angle

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@16607 18c085ea-50e0-402c-830e-de6fd14e8384
parent 59b611be
......@@ -135,6 +135,9 @@
<Field name="toroidalAngle" label="Toroidal angle" type="double">
0.000000
</Field>
<Field name="flipToroidalAngle" label="Flip toroidal angle" type="bool">
false
</Field>
<Field name="viewGeometry" label="View geometry" type="enum" subtype="ViewGeometry">
Surfaces
</Field>
......
......@@ -640,6 +640,7 @@ void LineSamplerAttributes::Init()
poloialRTilt = 0;
poloialZTilt = 0;
toroidalAngle = 0;
flipToroidalAngle = false;
viewGeometry = Surfaces;
viewDimension = Three;
heightPlotScale = 1;
......@@ -717,6 +718,7 @@ void LineSamplerAttributes::Copy(const LineSamplerAttributes &obj)
poloialRTilt = obj.poloialRTilt;
poloialZTilt = obj.poloialZTilt;
toroidalAngle = obj.toroidalAngle;
flipToroidalAngle = obj.flipToroidalAngle;
viewGeometry = obj.viewGeometry;
viewDimension = obj.viewDimension;
heightPlotScale = obj.heightPlotScale;
......@@ -928,6 +930,7 @@ LineSamplerAttributes::operator == (const LineSamplerAttributes &obj) const
(poloialRTilt == obj.poloialRTilt) &&
(poloialZTilt == obj.poloialZTilt) &&
(toroidalAngle == obj.toroidalAngle) &&
(flipToroidalAngle == obj.flipToroidalAngle) &&
(viewGeometry == obj.viewGeometry) &&
(viewDimension == obj.viewDimension) &&
(heightPlotScale == obj.heightPlotScale) &&
......@@ -1120,6 +1123,7 @@ LineSamplerAttributes::SelectAll()
Select(ID_poloialRTilt, (void *)&poloialRTilt);
Select(ID_poloialZTilt, (void *)&poloialZTilt);
Select(ID_toroidalAngle, (void *)&toroidalAngle);
Select(ID_flipToroidalAngle, (void *)&flipToroidalAngle);
Select(ID_viewGeometry, (void *)&viewGeometry);
Select(ID_viewDimension, (void *)&viewDimension);
Select(ID_heightPlotScale, (void *)&heightPlotScale);
......@@ -1301,6 +1305,12 @@ LineSamplerAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool
node->AddNode(new DataNode("toroidalAngle", toroidalAngle));
}
if(completeSave || !FieldsEqual(ID_flipToroidalAngle, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("flipToroidalAngle", flipToroidalAngle));
}
if(completeSave || !FieldsEqual(ID_viewGeometry, &defaultObject))
{
addToParent = true;
......@@ -1635,6 +1645,8 @@ LineSamplerAttributes::SetFromNode(DataNode *parentNode)
SetPoloialZTilt(node->AsDouble());
if((node = searchNode->GetNode("toroidalAngle")) != 0)
SetToroidalAngle(node->AsDouble());
if((node = searchNode->GetNode("flipToroidalAngle")) != 0)
SetFlipToroidalAngle(node->AsBool());
if((node = searchNode->GetNode("viewGeometry")) != 0)
{
// Allow enums to be int or string in the config file
......@@ -1967,6 +1979,13 @@ LineSamplerAttributes::SetToroidalAngle(double toroidalAngle_)
Select(ID_toroidalAngle, (void *)&toroidalAngle);
}
void
LineSamplerAttributes::SetFlipToroidalAngle(bool flipToroidalAngle_)
{
flipToroidalAngle = flipToroidalAngle_;
Select(ID_flipToroidalAngle, (void *)&flipToroidalAngle);
}
void
LineSamplerAttributes::SetViewGeometry(LineSamplerAttributes::ViewGeometry viewGeometry_)
{
......@@ -2300,6 +2319,12 @@ LineSamplerAttributes::GetToroidalAngle() const
return toroidalAngle;
}
bool
LineSamplerAttributes::GetFlipToroidalAngle() const
{
return flipToroidalAngle;
}
LineSamplerAttributes::ViewGeometry
LineSamplerAttributes::GetViewGeometry() const
{
......@@ -2552,6 +2577,7 @@ LineSamplerAttributes::GetFieldName(int index) const
case ID_poloialRTilt: return "poloialRTilt";
case ID_poloialZTilt: return "poloialZTilt";
case ID_toroidalAngle: return "toroidalAngle";
case ID_flipToroidalAngle: return "flipToroidalAngle";
case ID_viewGeometry: return "viewGeometry";
case ID_viewDimension: return "viewDimension";
case ID_heightPlotScale: return "heightPlotScale";
......@@ -2625,6 +2651,7 @@ LineSamplerAttributes::GetFieldType(int index) const
case ID_poloialRTilt: return FieldType_double;
case ID_poloialZTilt: return FieldType_double;
case ID_toroidalAngle: return FieldType_double;
case ID_flipToroidalAngle: return FieldType_bool;
case ID_viewGeometry: return FieldType_enum;
case ID_viewDimension: return FieldType_enum;
case ID_heightPlotScale: return FieldType_double;
......@@ -2698,6 +2725,7 @@ LineSamplerAttributes::GetFieldTypeName(int index) const
case ID_poloialRTilt: return "double";
case ID_poloialZTilt: return "double";
case ID_toroidalAngle: return "double";
case ID_flipToroidalAngle: return "bool";
case ID_viewGeometry: return "enum";
case ID_viewDimension: return "enum";
case ID_heightPlotScale: return "double";
......@@ -2858,6 +2886,11 @@ LineSamplerAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
retval = (toroidalAngle == obj.toroidalAngle);
}
break;
case ID_flipToroidalAngle:
{ // new scope
retval = (flipToroidalAngle == obj.flipToroidalAngle);
}
break;
case ID_viewGeometry:
{ // new scope
retval = (viewGeometry == obj.viewGeometry);
......
......@@ -194,6 +194,7 @@ public:
void SetPoloialRTilt(double poloialRTilt_);
void SetPoloialZTilt(double poloialZTilt_);
void SetToroidalAngle(double toroidalAngle_);
void SetFlipToroidalAngle(bool flipToroidalAngle_);
void SetViewGeometry(ViewGeometry viewGeometry_);
void SetViewDimension(ViewDimension viewDimension_);
void SetHeightPlotScale(double heightPlotScale_);
......@@ -246,6 +247,7 @@ public:
double GetPoloialRTilt() const;
double GetPoloialZTilt() const;
double GetToroidalAngle() const;
bool GetFlipToroidalAngle() const;
ViewGeometry GetViewGeometry() const;
ViewDimension GetViewDimension() const;
double GetHeightPlotScale() const;
......@@ -388,6 +390,7 @@ public:
ID_poloialRTilt,
ID_poloialZTilt,
ID_toroidalAngle,
ID_flipToroidalAngle,
ID_viewGeometry,
ID_viewDimension,
ID_heightPlotScale,
......@@ -441,6 +444,7 @@ private:
double poloialRTilt;
double poloialZTilt;
double toroidalAngle;
bool flipToroidalAngle;
int viewGeometry;
int viewDimension;
double heightPlotScale;
......@@ -475,6 +479,6 @@ private:
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define LINESAMPLERATTRIBUTES_TMFS "iiiidiiiddidDiddddddiidddiiddiddddiiidddiiiid*d*idd"
#define LINESAMPLERATTRIBUTES_TMFS "iiiidiiiddidDiddddddbiidddiiddiddddiiidddiiiid*d*idd"
#endif
......@@ -216,6 +216,11 @@ PyLineSamplerAttributes_ToString(const LineSamplerAttributes *atts, const char *
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%storoidalAngle = %g\n", prefix, atts->GetToroidalAngle());
str += tmpStr;
if(atts->GetFlipToroidalAngle())
SNPRINTF(tmpStr, 1000, "%sflipToroidalAngle = 1\n", prefix);
else
SNPRINTF(tmpStr, 1000, "%sflipToroidalAngle = 0\n", prefix);
str += tmpStr;
const char *viewGeometry_names = "Points, Lines, Surfaces";
switch (atts->GetViewGeometry())
{
......@@ -1019,6 +1024,30 @@ LineSamplerAttributes_GetToroidalAngle(PyObject *self, PyObject *args)
return retval;
}
/*static*/ PyObject *
LineSamplerAttributes_SetFlipToroidalAngle(PyObject *self, PyObject *args)
{
LineSamplerAttributesObject *obj = (LineSamplerAttributesObject *)self;
int ival;
if(!PyArg_ParseTuple(args, "i", &ival))
return NULL;
// Set the flipToroidalAngle in the object.
obj->data->SetFlipToroidalAngle(ival != 0);
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
LineSamplerAttributes_GetFlipToroidalAngle(PyObject *self, PyObject *args)
{
LineSamplerAttributesObject *obj = (LineSamplerAttributesObject *)self;
PyObject *retval = PyInt_FromLong(obj->data->GetFlipToroidalAngle()?1L:0L);
return retval;
}
/*static*/ PyObject *
LineSamplerAttributes_SetViewGeometry(PyObject *self, PyObject *args)
{
......@@ -1918,6 +1947,8 @@ PyMethodDef PyLineSamplerAttributes_methods[LINESAMPLERATTRIBUTES_NMETH] = {
{"GetPoloialZTilt", LineSamplerAttributes_GetPoloialZTilt, METH_VARARGS},
{"SetToroidalAngle", LineSamplerAttributes_SetToroidalAngle, METH_VARARGS},
{"GetToroidalAngle", LineSamplerAttributes_GetToroidalAngle, METH_VARARGS},
{"SetFlipToroidalAngle", LineSamplerAttributes_SetFlipToroidalAngle, METH_VARARGS},
{"GetFlipToroidalAngle", LineSamplerAttributes_GetFlipToroidalAngle, METH_VARARGS},
{"SetViewGeometry", LineSamplerAttributes_SetViewGeometry, METH_VARARGS},
{"GetViewGeometry", LineSamplerAttributes_GetViewGeometry, METH_VARARGS},
{"SetViewDimension", LineSamplerAttributes_SetViewDimension, METH_VARARGS},
......@@ -2078,6 +2109,8 @@ PyLineSamplerAttributes_getattr(PyObject *self, char *name)
return LineSamplerAttributes_GetPoloialZTilt(self, NULL);
if(strcmp(name, "toroidalAngle") == 0)
return LineSamplerAttributes_GetToroidalAngle(self, NULL);
if(strcmp(name, "flipToroidalAngle") == 0)
return LineSamplerAttributes_GetFlipToroidalAngle(self, NULL);
if(strcmp(name, "viewGeometry") == 0)
return LineSamplerAttributes_GetViewGeometry(self, NULL);
if(strcmp(name, "Points") == 0)
......@@ -2247,6 +2280,8 @@ PyLineSamplerAttributes_setattr(PyObject *self, char *name, PyObject *args)
obj = LineSamplerAttributes_SetPoloialZTilt(self, tuple);
else if(strcmp(name, "toroidalAngle") == 0)
obj = LineSamplerAttributes_SetToroidalAngle(self, tuple);
else if(strcmp(name, "flipToroidalAngle") == 0)
obj = LineSamplerAttributes_SetFlipToroidalAngle(self, tuple);
else if(strcmp(name, "viewGeometry") == 0)
obj = LineSamplerAttributes_SetViewGeometry(self, tuple);
else if(strcmp(name, "viewDimension") == 0)
......
......@@ -44,7 +44,7 @@
//
// Functions exposed to the VisIt module.
//
#define LINESAMPLERATTRIBUTES_NMETH 100
#define LINESAMPLERATTRIBUTES_NMETH 102
void PyLineSamplerAttributes_StartUp(LineSamplerAttributes *subj, void *data);
void PyLineSamplerAttributes_CloseDown();
PyMethodDef * PyLineSamplerAttributes_GetMethodTable(int *nMethods);
......
......@@ -460,6 +460,11 @@ QvisLineSamplerWindow::CreateWindowContents()
this, SLOT(toroidalAngleProcessText()));
mainLayout->addWidget(toroidalAngle, 14,1);
flipToroidalAngle = new QCheckBox(tr("Flip toroidal angle"), central);
connect(flipToroidalAngle, SIGNAL(toggled(bool)),
this, SLOT(flipToroidalAngleChanged(bool)));
mainLayout->addWidget(flipToroidalAngle, 14,3);
// ----------------------------------------------------------------------
// List tab
// ----------------------------------------------------------------------
......@@ -532,6 +537,11 @@ QvisLineSamplerWindow::CreateWindowContents()
this, SLOT(channelListToroidalAngleProcessText()));
mainLayout->addWidget(channelListToroidalAngle, 7,1);
channelListFlipToroidalAngle = new QCheckBox(tr("Flip toroidal angle"), central);
connect(channelListFlipToroidalAngle, SIGNAL(toggled(bool)),
this, SLOT(channelListFlipToroidalAngleChanged(bool)));
mainLayout->addWidget(channelListFlipToroidalAngle, 7,3);
// ----------------------------------------------------------------------
// Sampling tab
// ----------------------------------------------------------------------
......@@ -1073,6 +1083,15 @@ QvisLineSamplerWindow::UpdateWindow(bool doAll)
case LineSamplerAttributes::ID_toroidalAngle:
toroidalAngle->setText(DoubleToQString(atts->GetToroidalAngle()));
break;
case LineSamplerAttributes::ID_flipToroidalAngle:
flipToroidalAngle->blockSignals(true);
flipToroidalAngle->setChecked(atts->GetFlipToroidalAngle());
flipToroidalAngle->blockSignals(false);
channelListFlipToroidalAngle->blockSignals(true);
channelListFlipToroidalAngle->setChecked(atts->GetFlipToroidalAngle());
channelListFlipToroidalAngle->blockSignals(false);
break; break;
case LineSamplerAttributes::ID_viewGeometry:
viewGeometryButtonGroup->blockSignals(true);
if(viewGeometryButtonGroup->button((int)atts->GetViewGeometry()) != 0)
......@@ -1935,6 +1954,22 @@ QvisLineSamplerWindow::toroidalAngleProcessText()
}
void
QvisLineSamplerWindow::flipToroidalAngleChanged(bool val)
{
atts->SetFlipToroidalAngle(val);
Apply();
}
void
QvisLineSamplerWindow::channelListFlipToroidalAngleChanged(bool val)
{
atts->SetFlipToroidalAngle(val);
Apply();
}
void
QvisLineSamplerWindow::viewGeometryChanged(int val)
{
......@@ -2479,8 +2514,10 @@ QvisLineSamplerWindow::EnableGeometry(bool flag)
toroidalAngleLabel->setEnabled( flag );
toroidalAngle->setEnabled( flag );
flipToroidalAngle->setEnabled( flag );
}
void
QvisLineSamplerWindow::EnableList(bool flag)
{
......@@ -2496,6 +2533,7 @@ QvisLineSamplerWindow::EnableList(bool flag)
channelListDeleteAllChannels->setEnabled( flag );
channelListToroidalAngleLabel->setEnabled( flag );
channelListToroidalAngle->setEnabled( flag );
channelListFlipToroidalAngle->setEnabled( flag );
}
......@@ -2513,10 +2551,12 @@ QvisLineSamplerWindow::UpdateMeshGeometry()
poloialRTiltLabel->setText(tr("Y plane X-tilt"));
poloialZTiltLabel->setText(tr("Y plane Z-tilt"));
toroidalAngleLabel->setText(tr("Y axis offset"));
flipToroidalAngle->setVisible(false);
channelListToroidalArrayAngleLabel->setText(tr("Y distance between arrays"));
confFileCoordinateLabel->setText(tr(" X, Y, Z, and Y Rotation"));
channelListToroidalAngleLabel->setText(tr("Y axis offset"));
channelListFlipToroidalAngle->setVisible(false);
toroidalIntegrationLabel->setText(tr("Y axis"));
toroidalIntegrationTime->setText(tr("Sample Y axis as time"));
......@@ -2534,10 +2574,12 @@ QvisLineSamplerWindow::UpdateMeshGeometry()
poloialRTiltLabel->setText(tr("Poloidal plane R-tilt"));
poloialZTiltLabel->setText(tr("Poloidal plane Z-tilt"));
toroidalAngleLabel->setText(tr("Toroidal angle"));
flipToroidalAngle->setVisible(true);
channelListToroidalArrayAngleLabel->setText(tr("Toroidal angle between arrays"));
confFileCoordinateLabel->setText(tr(" R, Z, Phi, and Poloidal Angle"));
channelListToroidalAngleLabel->setText(tr("Toroidal offset angle"));
channelListFlipToroidalAngle->setVisible(true);
toroidalIntegrationLabel->setText(tr("Toroidal"));
toroidalIntegrationTime->setText(tr("Sample toroidally as time"));
......
......@@ -108,6 +108,7 @@ class QvisLineSamplerWindow : public QvisOperatorWindow
void poloialRTiltProcessText();
void poloialZTiltProcessText();
void toroidalAngleProcessText();
void flipToroidalAngleChanged(bool val);
void viewGeometryChanged(int val);
void displayTimeChanged(int val);
void viewDimensionChanged(int val);
......@@ -144,6 +145,7 @@ class QvisLineSamplerWindow : public QvisOperatorWindow
void nChannelListArraysProcessText();
void channelListToroidalArrayAngleProcessText();
void channelListToroidalAngleProcessText();
void channelListFlipToroidalAngleChanged(bool val);
void EnableGeometry(bool flag);
void EnableList(bool flag);
......@@ -204,6 +206,7 @@ class QvisLineSamplerWindow : public QvisOperatorWindow
QLineEdit *poloialRTilt;
QLineEdit *poloialZTilt;
QLineEdit *toroidalAngle;
QCheckBox *flipToroidalAngle;
QWidget *viewDimension;
QButtonGroup *viewDimensionButtonGroup;
QWidget *viewGeometry;
......@@ -247,6 +250,7 @@ class QvisLineSamplerWindow : public QvisOperatorWindow
QLineEdit *nChannelListArrays;
QLineEdit *channelListToroidalArrayAngle;
QLineEdit *channelListToroidalAngle;
QCheckBox *channelListFlipToroidalAngle;
QLabel *meshGeometryLabel;
QLabel *arrayConfigurationLabel;
QLabel *boundaryLabel;
......
......@@ -913,6 +913,9 @@ avtLineSamplerFilter::ExecuteChannelData(vtkDataSet *in_ds, int, std::string)
toroidalAngle = 2.0 * M_PI * toroidalAngle/360.0;
}
if( atts.GetFlipToroidalAngle() )
toroidalAngle = -toroidalAngle;
// Initial translation based on the user origin for the
// central channel.
avtVector translate( r, 0, z );
......
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