Commit 4293ee0e authored by allens's avatar allens

added the ability to conver from cartesian to cylindrical coordinates with semi-infinite domain

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23702 18c085ea-50e0-402c-830e-de6fd14e8384
parent 5b9c8b55
......@@ -225,6 +225,11 @@ PyTransformAttributes_ToString(const TransformAttributes *atts, const char *pref
break;
}
if(atts->GetContinuousPhi())
SNPRINTF(tmpStr, 1000, "%scontinuousPhi = 1\n", prefix);
else
SNPRINTF(tmpStr, 1000, "%scontinuousPhi = 0\n", prefix);
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sm00 = %g\n", prefix, atts->GetM00());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sm01 = %g\n", prefix, atts->GetM01());
......@@ -836,6 +841,30 @@ TransformAttributes_GetOutputCoordSys(PyObject *self, PyObject *args)
return retval;
}
/*static*/ PyObject *
TransformAttributes_SetContinuousPhi(PyObject *self, PyObject *args)
{
TransformAttributesObject *obj = (TransformAttributesObject *)self;
int ival;
if(!PyArg_ParseTuple(args, "i", &ival))
return NULL;
// Set the continuousPhi in the object.
obj->data->SetContinuousPhi(ival != 0);
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
TransformAttributes_GetContinuousPhi(PyObject *self, PyObject *args)
{
TransformAttributesObject *obj = (TransformAttributesObject *)self;
PyObject *retval = PyInt_FromLong(obj->data->GetContinuousPhi()?1L:0L);
return retval;
}
/*static*/ PyObject *
TransformAttributes_SetM00(PyObject *self, PyObject *args)
{
......@@ -1339,6 +1368,8 @@ PyMethodDef PyTransformAttributes_methods[TRANSFORMATTRIBUTES_NMETH] = {
{"GetInputCoordSys", TransformAttributes_GetInputCoordSys, METH_VARARGS},
{"SetOutputCoordSys", TransformAttributes_SetOutputCoordSys, METH_VARARGS},
{"GetOutputCoordSys", TransformAttributes_GetOutputCoordSys, METH_VARARGS},
{"SetContinuousPhi", TransformAttributes_SetContinuousPhi, METH_VARARGS},
{"GetContinuousPhi", TransformAttributes_GetContinuousPhi, METH_VARARGS},
{"SetM00", TransformAttributes_SetM00, METH_VARARGS},
{"GetM00", TransformAttributes_GetM00, METH_VARARGS},
{"SetM01", TransformAttributes_SetM01, METH_VARARGS},
......@@ -1465,6 +1496,8 @@ PyTransformAttributes_getattr(PyObject *self, char *name)
if(strcmp(name, "Spherical") == 0)
return PyInt_FromLong(long(TransformAttributes::Spherical));
if(strcmp(name, "continuousPhi") == 0)
return TransformAttributes_GetContinuousPhi(self, NULL);
if(strcmp(name, "m00") == 0)
return TransformAttributes_GetM00(self, NULL);
if(strcmp(name, "m01") == 0)
......@@ -1560,6 +1593,8 @@ PyTransformAttributes_setattr(PyObject *self, char *name, PyObject *args)
obj = TransformAttributes_SetInputCoordSys(self, tuple);
else if(strcmp(name, "outputCoordSys") == 0)
obj = TransformAttributes_SetOutputCoordSys(self, tuple);
else if(strcmp(name, "continuousPhi") == 0)
obj = TransformAttributes_SetContinuousPhi(self, tuple);
else if(strcmp(name, "m00") == 0)
obj = TransformAttributes_SetM00(self, tuple);
else if(strcmp(name, "m01") == 0)
......
......@@ -44,7 +44,7 @@
//
// Functions exposed to the VisIt module.
//
#define TRANSFORMATTRIBUTES_NMETH 74
#define TRANSFORMATTRIBUTES_NMETH 76
void PyTransformAttributes_StartUp(TransformAttributes *subj, void *data);
void PyTransformAttributes_CloseDown();
PyMethodDef * PyTransformAttributes_GetMethodTable(int *nMethods);
......
......@@ -298,17 +298,26 @@ QvisTransformWindow::CreateWindowContents()
secondPageLayout->addWidget(outputFrame);
outputCoord = new QButtonGroup(outputFrame);
QVBoxLayout *outputCoordLayout = new QVBoxLayout(outputFrame);
QGridLayout *outputCoordLayout = new QGridLayout(outputFrame);
outputCoordLayout->setSpacing(10);
QRadioButton *oCart = new QRadioButton(tr("Cartesian (x,y,z)"), outputFrame);
outputCoord->addButton(oCart, 0);
outputCoordLayout->addWidget(oCart);
outputCoordLayout->addWidget(oCart, 0, 0);
QRadioButton *oCyl = new QRadioButton(tr("Cylindrical (r,phi,z)"), outputFrame);
outputCoord->addButton(oCyl, 1);
outputCoordLayout->addWidget(oCyl);
outputCoordLayout->addWidget(oCyl, 1, 0);
QRadioButton *oSph = new QRadioButton(tr("Spherical (r,theta,phi)"), outputFrame);
outputCoord->addButton(oSph, 2);
outputCoordLayout->addWidget(oSph);
outputCoordLayout->addWidget(oSph, 2, 0);
continuousPhi = new QCheckBox(tr("phi on a semi-infinite domain"), outputFrame);
connect(continuousPhi, SIGNAL(toggled(bool)),
this, SLOT(continuousPhiChanged(bool)));
outputCoordLayout->addWidget(continuousPhi, 1, 1);
continuousPhiLabel = new QLabel(tr(" (lines only)"), secondPage);
outputCoordLayout->addWidget(continuousPhiLabel, 2, 1);
QFrame *vectorMethodFrame = new QFrame(secondPage);
secondPageLayout->addWidget(vectorMethodFrame);
......@@ -594,13 +603,38 @@ QvisTransformWindow::UpdateWindow(bool doAll)
inputCoord->blockSignals(true);
inputCoord->button(atts->GetInputCoordSys())->setChecked(true);
inputCoord->blockSignals(false);
continuousPhi->blockSignals(true);
continuousPhi->setEnabled( (atts->GetInputCoordSys() ==
TransformAttributes::Cartesian &&
atts->GetOutputCoordSys() ==
TransformAttributes::Cylindrical) );
continuousPhi->blockSignals(false);
continuousPhiLabel->setEnabled( (atts->GetInputCoordSys() ==
TransformAttributes::Cartesian &&
atts->GetOutputCoordSys() ==
TransformAttributes::Cylindrical) );
break;
case TransformAttributes::ID_outputCoordSys:
outputCoord->blockSignals(true);
outputCoord->button(atts->GetOutputCoordSys())->setChecked(true);
outputCoord->blockSignals(false);
break;
continuousPhi->blockSignals(true);
continuousPhi->setEnabled( (atts->GetInputCoordSys() ==
TransformAttributes::Cartesian &&
atts->GetOutputCoordSys() ==
TransformAttributes::Cylindrical) );
continuousPhi->blockSignals(false);
continuousPhiLabel->setEnabled( (atts->GetInputCoordSys() ==
TransformAttributes::Cartesian &&
atts->GetOutputCoordSys() ==
TransformAttributes::Cylindrical) );
break;
case TransformAttributes::ID_continuousPhi:
continuousPhi->blockSignals(true);
continuousPhi->setChecked(atts->GetContinuousPhi());
continuousPhi->blockSignals(false);
case TransformAttributes::ID_m00:
temp.setNum(atts->GetM00());
m00->setText(temp);
......@@ -1035,13 +1069,23 @@ QvisTransformWindow::pageTurned(int page)
void QvisTransformWindow::inputCoordChanged(int v)
{
atts->SetInputCoordSys(TransformAttributes::CoordinateSystem(v));
Apply();
}
void QvisTransformWindow::outputCoordChanged(int v)
{
atts->SetOutputCoordSys(TransformAttributes::CoordinateSystem(v));
Apply();
}
void
QvisTransformWindow::continuousPhiChanged(bool val)
{
atts->SetContinuousPhi(val);
Apply();
}
void
QvisTransformWindow::ltElementtChanged()
{
......
......@@ -149,6 +149,7 @@ class QvisTransformWindow : public QvisOperatorWindow
void pageTurned(int);
void inputCoordChanged(int);
void outputCoordChanged(int);
void continuousPhiChanged(bool val);
void ltElementtChanged();
void linearInvertChanged(bool val);
void transformVectorsChanged(bool val);
......@@ -205,6 +206,8 @@ class QvisTransformWindow : public QvisOperatorWindow
QButtonGroup *inputCoord;
QButtonGroup *outputCoord;
QCheckBox *continuousPhi;
QLabel *continuousPhiLabel;
QComboBox *vectorMethodCombo;
TransformAttributes *atts;
......
......@@ -78,6 +78,9 @@
<Field name="outputCoordSys" label="Desired Coordinate System" type="enum" subtype="CoordinateSystem">
Spherical
</Field>
<Field name="continuousPhi" label="Continuous Phi" type="bool">
false
</Field>
<Field name="m00" label="m00" type="double">
1.000000
</Field>
......
......@@ -231,6 +231,7 @@ void TransformAttributes::Init()
transformType = Similarity;
inputCoordSys = Cartesian;
outputCoordSys = Spherical;
continuousPhi = false;
m00 = 1;
m01 = 0;
m02 = 0;
......@@ -297,6 +298,7 @@ void TransformAttributes::Copy(const TransformAttributes &obj)
transformType = obj.transformType;
inputCoordSys = obj.inputCoordSys;
outputCoordSys = obj.outputCoordSys;
continuousPhi = obj.continuousPhi;
m00 = obj.m00;
m01 = obj.m01;
m02 = obj.m02;
......@@ -505,6 +507,7 @@ TransformAttributes::operator == (const TransformAttributes &obj) const
(transformType == obj.transformType) &&
(inputCoordSys == obj.inputCoordSys) &&
(outputCoordSys == obj.outputCoordSys) &&
(continuousPhi == obj.continuousPhi) &&
(m00 == obj.m00) &&
(m01 == obj.m01) &&
(m02 == obj.m02) &&
......@@ -719,6 +722,7 @@ TransformAttributes::SelectAll()
Select(ID_transformType, (void *)&transformType);
Select(ID_inputCoordSys, (void *)&inputCoordSys);
Select(ID_outputCoordSys, (void *)&outputCoordSys);
Select(ID_continuousPhi, (void *)&continuousPhi);
Select(ID_m00, (void *)&m00);
Select(ID_m01, (void *)&m01);
Select(ID_m02, (void *)&m02);
......@@ -872,6 +876,12 @@ TransformAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool fo
node->AddNode(new DataNode("outputCoordSys", CoordinateSystem_ToString(outputCoordSys)));
}
if(completeSave || !FieldsEqual(ID_continuousPhi, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("continuousPhi", continuousPhi));
}
if(completeSave || !FieldsEqual(ID_m00, &defaultObject))
{
addToParent = true;
......@@ -1362,6 +1372,13 @@ TransformAttributes::SetOutputCoordSys(TransformAttributes::CoordinateSystem out
Select(ID_outputCoordSys, (void *)&outputCoordSys);
}
void
TransformAttributes::SetContinuousPhi(bool continuousPhi_)
{
continuousPhi = continuousPhi_;
Select(ID_continuousPhi, (void *)&continuousPhi);
}
void
TransformAttributes::SetM00(double m00_)
{
......@@ -1619,6 +1636,12 @@ TransformAttributes::GetOutputCoordSys() const
return CoordinateSystem(outputCoordSys);
}
bool
TransformAttributes::GetContinuousPhi() const
{
return continuousPhi;
}
double
TransformAttributes::GetM00() const
{
......@@ -1796,6 +1819,7 @@ TransformAttributes::GetFieldName(int index) const
case ID_transformType: return "transformType";
case ID_inputCoordSys: return "inputCoordSys";
case ID_outputCoordSys: return "outputCoordSys";
case ID_continuousPhi: return "continuousPhi";
case ID_m00: return "m00";
case ID_m01: return "m01";
case ID_m02: return "m02";
......@@ -1856,6 +1880,7 @@ TransformAttributes::GetFieldType(int index) const
case ID_transformType: return FieldType_enum;
case ID_inputCoordSys: return FieldType_enum;
case ID_outputCoordSys: return FieldType_enum;
case ID_continuousPhi: return FieldType_bool;
case ID_m00: return FieldType_double;
case ID_m01: return FieldType_double;
case ID_m02: return FieldType_double;
......@@ -1916,6 +1941,7 @@ TransformAttributes::GetFieldTypeName(int index) const
case ID_transformType: return "enum";
case ID_inputCoordSys: return "enum";
case ID_outputCoordSys: return "enum";
case ID_continuousPhi: return "bool";
case ID_m00: return "double";
case ID_m01: return "double";
case ID_m02: return "double";
......@@ -2061,6 +2087,11 @@ TransformAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
retval = (outputCoordSys == obj.outputCoordSys);
}
break;
case ID_continuousPhi:
{ // new scope
retval = (continuousPhi == obj.continuousPhi);
}
break;
case ID_m00:
{ // new scope
retval = (m00 == obj.m00);
......
......@@ -132,6 +132,7 @@ public:
void SetTransformType(TransformType transformType_);
void SetInputCoordSys(CoordinateSystem inputCoordSys_);
void SetOutputCoordSys(CoordinateSystem outputCoordSys_);
void SetContinuousPhi(bool continuousPhi_);
void SetM00(double m00_);
void SetM01(double m01_);
void SetM02(double m02_);
......@@ -173,6 +174,7 @@ public:
TransformType GetTransformType() const;
CoordinateSystem GetInputCoordSys() const;
CoordinateSystem GetOutputCoordSys() const;
bool GetContinuousPhi() const;
double GetM00() const;
double GetM01() const;
double GetM02() const;
......@@ -245,6 +247,7 @@ public:
ID_transformType,
ID_inputCoordSys,
ID_outputCoordSys,
ID_continuousPhi,
ID_m00,
ID_m01,
ID_m02,
......@@ -285,6 +288,7 @@ private:
int transformType;
int inputCoordSys;
int outputCoordSys;
bool continuousPhi;
double m00;
double m01;
double m02;
......@@ -309,6 +313,6 @@ private:
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define TRANSFORMATTRIBUTES_TMFS "bDDdibDdddbdddiiiddddddddddddddddbib"
#define TRANSFORMATTRIBUTES_TMFS "bDDdibDdddbdddiiibddddddddddddddddbib"
#endif
......@@ -236,6 +236,12 @@ avtTransformFilter::SetAtts(const AttributeGroup *a)
csc->SetOutputCoordSys(avtCoordSystemConvert::SPHERICAL);
break;
}
if( atts.GetInputCoordSys() == TransformAttributes::Cartesian &&
atts.GetOutputCoordSys() == TransformAttributes::Cylindrical )
csc->SetContinuousPhi(atts.GetContinuousPhi());
switch (atts.GetVectorTransformMethod())
{
case TransformAttributes::None:
......
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