Commit f5f0c3da authored by allens's avatar allens
Browse files

moved coordinate conversion to the fields and inital implementation for NIMROD interpolation

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@14788 18c085ea-50e0-402c-830e-de6fd14e8384
parent f6dd1395
...@@ -56,7 +56,6 @@ avtIVPSolver.C ...@@ -56,7 +56,6 @@ avtIVPSolver.C
avtIVPM3DC1Field.C avtIVPM3DC1Field.C
avtIVPM3DC1Integrator.C avtIVPM3DC1Integrator.C
avtIVPNIMRODField.C avtIVPNIMRODField.C
avtIVPNIMRODIntegrator.C
avtIVPVTKField.C avtIVPVTKField.C
avtIVPVTKTimeVaryingField.C avtIVPVTKTimeVaryingField.C
avtPoincareIC.C avtPoincareIC.C
......
...@@ -95,7 +95,6 @@ avtIVPAdamsBashforth::avtIVPAdamsBashforth() ...@@ -95,7 +95,6 @@ avtIVPAdamsBashforth::avtIVPAdamsBashforth()
initialized = 0; initialized = 0;
degenerate_iterations = 0; degenerate_iterations = 0;
stiffness_eps = tol / 1000.0; stiffness_eps = tol / 1000.0;
convertToCartesian = false;
} }
// **************************************************************************** // ****************************************************************************
...@@ -507,8 +506,8 @@ avtIVPAdamsBashforth::Step(avtIVPField* field, double t_max, ...@@ -507,8 +506,8 @@ avtIVPAdamsBashforth::Step(avtIVPField* field, double t_max,
if( convertToCartesian ) if( convertToCartesian )
{ {
(*ivpstep)[0] = CylindricalToCartesian( yCur ); (*ivpstep)[0] = field->ConvertToCartesian( yCur );
(*ivpstep)[1] = CylindricalToCartesian( yNew ); (*ivpstep)[1] = field->ConvertToCartesian( yNew );
} }
else else
{ {
......
...@@ -104,8 +104,6 @@ avtIVPDopri5::avtIVPDopri5() ...@@ -104,8 +104,6 @@ avtIVPDopri5::avtIVPDopri5()
h_max = 0.0; h_max = 0.0;
nonsti = 0; nonsti = 0;
convertToCartesian = false;
} }
...@@ -689,15 +687,15 @@ avtIVPDopri5::Step(avtIVPField* field, double t_max, ...@@ -689,15 +687,15 @@ avtIVPDopri5::Step(avtIVPField* field, double t_max,
if( convertToCartesian ) if( convertToCartesian )
{ {
(*ivpstep)[0] = CylindricalToCartesian( y ); (*ivpstep)[0] = field->ConvertToCartesian( y );
(*ivpstep)[1] = CylindricalToCartesian( y + (h*k1/4.) ); (*ivpstep)[1] = field->ConvertToCartesian( y + (h*k1/4.) );
(*ivpstep)[2] = CylindricalToCartesian( (y + y_new)/2 + (*ivpstep)[2] = field->ConvertToCartesian( (y + y_new)/2 +
h*( (d1+1)*k1 + h*( (d1+1)*k1 +
d3*k3 + d4*k4 + d3*k3 + d4*k4 +
d5*k5 + d6*k6 + d5*k5 + d6*k6 +
(d7-1)*k7 )/6. ); (d7-1)*k7 )/6. );
(*ivpstep)[3] = CylindricalToCartesian( y_new - h*k7/4 ); (*ivpstep)[3] = field->ConvertToCartesian( y_new - h*k7/4 );
(*ivpstep)[4] = CylindricalToCartesian( y_new ); (*ivpstep)[4] = field->ConvertToCartesian( y_new );
} }
else else
{ {
...@@ -783,5 +781,3 @@ avtIVPDopri5::AcceptStateVisitor(avtIVPStateHelper& aiss) ...@@ -783,5 +781,3 @@ avtIVPDopri5::AcceptStateVisitor(avtIVPStateHelper& aiss)
.Accept(y) .Accept(y)
.Accept(k1); .Accept(k1);
} }
...@@ -103,6 +103,10 @@ class IVP_API avtIVPField ...@@ -103,6 +103,10 @@ class IVP_API avtIVPField
virtual avtVector operator()(const double& t, virtual avtVector operator()(const double& t,
const avtVector& x) const = 0; const avtVector& x) const = 0;
virtual avtVector ConvertToCartesian(const avtVector& pt) const = 0;
virtual avtVector ConvertToCylindrical(const avtVector& pt) const = 0;
virtual double ComputeVorticity(const double& t, virtual double ComputeVorticity(const double& t,
const avtVector& x ) const = 0; const avtVector& x ) const = 0;
virtual double ComputeScalarVariable(unsigned char index, virtual double ComputeScalarVariable(unsigned char index,
......
...@@ -782,6 +782,41 @@ avtIVPM3DC1Field::operator()( const double &t, const avtVector &p ) const ...@@ -782,6 +782,41 @@ avtIVPM3DC1Field::operator()( const double &t, const avtVector &p ) const
} }
// ****************************************************************************
// Method: avtIVPM3DC1Field::ConvertToCartesian
//
// Purpose: Converts the coordinates from local cylindrical to
// cartesian coordinates
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
avtVector
avtIVPM3DC1Field::ConvertToCartesian(const avtVector& pt) const
{
return avtVector(pt[0]*cos(pt[1]), pt[0]*sin(pt[1]), pt[2] );
}
// ****************************************************************************
// Method: avtIVPM3DC1Field::ConvertToCylindrical
//
// Purpose: Converts the coordinates from local cylindrical to
// cartesian coordinates
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
avtVector
avtIVPM3DC1Field::ConvertToCylindrical(const avtVector& pt) const
{
return pt;
}
// **************************************************************************** // ****************************************************************************
// Method: interpBcomps // Method: interpBcomps
// //
......
...@@ -99,6 +99,9 @@ class IVP_API avtIVPM3DC1Field: public avtIVPVTKField ...@@ -99,6 +99,9 @@ class IVP_API avtIVPM3DC1Field: public avtIVPVTKField
avtVector operator()( const double &t, const avtVector &v ) const; avtVector operator()( const double &t, const avtVector &v ) const;
avtVector ConvertToCartesian(const avtVector& pt) const;
avtVector ConvertToCylindrical(const avtVector& pt) const;
void interpBcomps(float *B, double *x, int element, double *xieta) const; void interpBcomps(float *B, double *x, int element, double *xieta) const;
float interp(float *var, int el, double *lcoords) const; float interp(float *var, int el, double *lcoords) const;
......
This diff is collapsed.
...@@ -44,12 +44,15 @@ ...@@ -44,12 +44,15 @@
#define AVT_IVP_NIMROD_FIELD_H #define AVT_IVP_NIMROD_FIELD_H
#include "avtIVPVTKField.h" #include "avtIVPVTKField.h"
#include <avtMatrix.h>
#include <vtkDataSet.h> #include <vtkDataSet.h>
#include <vtkPointData.h> #include <vtkPointData.h>
#include <ivp_exports.h> #include <ivp_exports.h>
typedef avtVector vec3;
typedef avtMatrix mat3;
// **************************************************************************** // ****************************************************************************
// Class: avtIVPNIMRODField // Class: avtIVPNIMRODField
...@@ -67,85 +70,49 @@ ...@@ -67,85 +70,49 @@
class IVP_API avtIVPNIMRODField: public avtIVPVTKField class IVP_API avtIVPNIMRODField: public avtIVPVTKField
{ {
protected: protected:
/* Local typedefs */ double lagrange_nodes[6][6];
typedef struct {
double x,y;
} v_entry;
typedef struct { public:
int el0, v, side;
} d_edge;
typedef struct{
d_edge o[8];
int n;
} edge;
public:
avtIVPNIMRODField( vtkDataSet* ds, avtCellLocator* loc ); avtIVPNIMRODField( vtkDataSet* ds, avtCellLocator* loc );
avtIVPNIMRODField( float *elementsPtr, int nelements ); avtIVPNIMRODField( unsigned int nRad,
unsigned int nTheta,
~avtIVPNIMRODField(); unsigned int nPhi,
float *grid_fourier_series,
float *data_fourier_series );
avtVector operator()( const double &t, const avtVector &p ) const; ~avtIVPNIMRODField();
virtual bool IsInside(const double& t, const avtVector& x) const; avtVector operator()( const double &t, const avtVector &p ) const;
void findElementNeighbors(); avtVector ConvertToCartesian(const avtVector& pt) const;
void register_vert(v_entry *vlist, int *len, avtVector ConvertToCylindrical(const avtVector& pt) const;
double x, double y, int *index);
void add_edge(edge *list, int *tri, int side, int el, int *nlist);
int get_tri_coords2D(double *x, double *xout) const;
int get_tri_coords2D(double *x, int el, double *xout) const;
float interp (float *var, int el, double *lcoords) const;
float interpdR (float *var, int el, double *lcoords) const;
float interpdz (float *var, int el, double *lcoords) const;
float interpdR2 (float *var, int el, double *lcoords) const;
float interpdz2 (float *var, int el, double *lcoords) const;
float interpdRdz(float *var, int el, double *lcoords) const;
void interpBcomps(float *B, double *x, int element, double *xieta) const;
protected: protected:
template< class type > template< class type >
type* SetDataPointer( vtkDataSet *ds, type* SetDataPointer( vtkDataSet *ds,
const type var, const type var,
const char* varname, const char* varname,
const int ntuples, const int ncomponents );
const int ncomponents );
// Variables calculated in findElementNeighbors (trigtable,
// neighbors) or read as part of the mesh (elements).
float *elements;
double *trigtable; /* Geometry of each triangle */
int *neighbors; /* Element neighbor table for efficient searches */
public: void lagrange_weights( unsigned int DEG, const double s,
// variables on the mesh double* w = NULL, double *d = NULL ) const;
float *psi0, *f0; /* Equilibrium field */
float *psinr, *psini, *fnr, *fni; /* Complex perturbed field */
// variable based on attributes (bzero and rzero) void fourier_weights( unsigned int N, const double t,
double F0; /* Strength of vacuum toroidal field */ double* w, double* d = NULL ) const;
// Variables calculated in findElementNeighbors
double Rmin, Rmax, zmin, zmax; /* Mesh bounds */
// unused variables read from header attributes void interpolate( double rad, double theta, double phi,
// (xlim, zlim) or explicitly set (psilim). vec3* P, mat3* DRV ) const;
// double xlim, zlim, psilim; /* Information about limiting surface */
// unused variables read from header attributes (ntime == nframes) public:
// int nframes; // Variables read as part of the mesh.
float *grid_fourier_series;
float *data_fourier_series;
// variables read from header attributes (linear == linflag, unsigned int Nrad, Ntheta, Nphi;
// ntor == tmode) or part of the mesh (nelms).
int linflag, nelms, tmode;
// variables read from header attributes. // variables read from header attributes.
double bzero, rzero; unsigned int Drad; // = 2;
unsigned int Dtheta; // = 2;
}; };
#endif #endif
...@@ -55,33 +55,31 @@ ...@@ -55,33 +55,31 @@
// //
// **************************************************************************** // ****************************************************************************
void avtIVPSolver::avtIVPSolver() : convertToCartesian(0), convertToCylindrical(0)
avtIVPSolver::GetState( avtIVPState& state )
{ {
avtIVPStateHelper aiss(avtIVPStateHelper::GET, 0);
this->AcceptStateVisitor(aiss);
state.allocate(aiss.size());
aiss.Reset(avtIVPStateHelper::GET, state._data);
this->AcceptStateVisitor(aiss);
} }
// **************************************************************************** // ****************************************************************************
// Method: avtIVPSolver::PutState // Method: avtIVPSolver::GetState
// //
// Purpose: // Purpose:
// Sets the state of the IVP solver. // Gets the state of the IVP solver.
// //
// Programmer: Christoph Garth // Programmer: Christoph Garth
// Creation: February 25, 2008 // Creation: February 25, 2008
// //
// **************************************************************************** // ****************************************************************************
void void
avtIVPSolver::PutState(const avtIVPState& state) avtIVPSolver::GetState( avtIVPState& state )
{ {
avtIVPStateHelper aiss(avtIVPStateHelper::PUT, state._data); avtIVPStateHelper aiss(avtIVPStateHelper::GET, 0);
this->AcceptStateVisitor(aiss);
state.allocate(aiss.size());
aiss.Reset(avtIVPStateHelper::GET, state._data);
this->AcceptStateVisitor(aiss); this->AcceptStateVisitor(aiss);
} }
...@@ -96,8 +94,9 @@ avtIVPSolver::PutState(const avtIVPState& state) ...@@ -96,8 +94,9 @@ avtIVPSolver::PutState(const avtIVPState& state)
// //
// **************************************************************************** // ****************************************************************************
avtVector void
avtIVPSolver::CylindricalToCartesian(const avtVector& pt) const avtIVPSolver::PutState(const avtIVPState& state)
{ {
return avtVector(pt[0]*cos(pt[1]), pt[0]*sin(pt[1]), pt[2] ); avtIVPStateHelper aiss(avtIVPStateHelper::PUT, state._data);
this->AcceptStateVisitor(aiss);
} }
...@@ -419,6 +419,9 @@ class avtIVPSolver ...@@ -419,6 +419,9 @@ class avtIVPSolver
STIFFNESS_DETECTED, STIFFNESS_DETECTED,
UNSPECIFIED_ERROR, UNSPECIFIED_ERROR,
}; };
avtIVPSolver();
virtual ~avtIVPSolver() {};
virtual void Reset(const double& t_start, const avtVector& y_start) = 0; virtual void Reset(const double& t_start, const avtVector& y_start) = 0;
...@@ -446,7 +449,7 @@ class avtIVPSolver ...@@ -446,7 +449,7 @@ class avtIVPSolver
virtual avtIVPSolver* Clone() const = 0; virtual avtIVPSolver* Clone() const = 0;
bool convertToCartesian; bool convertToCartesian;
avtVector CylindricalToCartesian(const avtVector& pt) const; bool convertToCylindrical;
protected: protected:
virtual void AcceptStateVisitor(avtIVPStateHelper& sv) = 0; virtual void AcceptStateVisitor(avtIVPStateHelper& sv) = 0;
......
...@@ -256,6 +256,40 @@ avtIVPVTKField::operator()( const double &t, const avtVector &p ) const ...@@ -256,6 +256,40 @@ avtIVPVTKField::operator()( const double &t, const avtVector &p ) const
return vel; return vel;
} }
// ****************************************************************************
// Method: avtIVPVTKField::ConvertToCartesian
//
// Purpose: Does nothing because the original coordinate system is
// unknown.
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
avtVector
avtIVPVTKField::ConvertToCartesian(const avtVector& pt) const
{
return pt;
}
// ****************************************************************************
// Method: avtIVPVTKField::ConvertToCylindrical
//
// Purpose: Does nothing because the original coordinate system is
// unknown.
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
avtVector
avtIVPVTKField::ConvertToCylindrical(const avtVector& pt) const
{
return pt;
}
// **************************************************************************** // ****************************************************************************
// Method: avtIVPVTKField::ComputeVorticity // Method: avtIVPVTKField::ComputeVorticity
// //
......
...@@ -97,6 +97,10 @@ class IVP_API avtIVPVTKField: public avtIVPField ...@@ -97,6 +97,10 @@ class IVP_API avtIVPVTKField: public avtIVPField
// avtIVPField interface // avtIVPField interface
virtual avtVector operator()(const double& t, const avtVector &pt) const; virtual avtVector operator()(const double& t, const avtVector &pt) const;
virtual avtVector ConvertToCartesian(const avtVector& pt) const;
virtual avtVector ConvertToCylindrical(const avtVector& pt) const;
virtual double ComputeVorticity(const double& t, const avtVector &pt) const; virtual double ComputeVorticity(const double& t, const avtVector &pt) const;
virtual double ComputeScalarVariable(unsigned char index, virtual double ComputeScalarVariable(unsigned char index,
......
...@@ -290,6 +290,40 @@ avtIVPVTKTimeVaryingField::operator()( const double &t, const avtVector &p ) con ...@@ -290,6 +290,40 @@ avtIVPVTKTimeVaryingField::operator()( const double &t, const avtVector &p ) con
return vel; return vel;
} }
// ****************************************************************************
// Method: avtIVPVTKTimeVaryingField::ConvertToCartesian
//
// Purpose: Does nothing because the original coordinate system is
// unknown.
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
avtVector
avtIVPVTKTimeVaryingField::ConvertToCartesian(const avtVector& pt) const
{
return pt;
}
// ****************************************************************************
// Method: avtIVPVTKTimeVaryingField::ConvertToCylindrical
//
// Purpose: Does nothing because the original coordinate system is
// unknown.
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
avtVector
avtIVPVTKTimeVaryingField::ConvertToCylindrical(const avtVector& pt) const
{
return pt;
}
// **************************************************************************** // ****************************************************************************
// Method: avtIVPVTKTimeVaryingField::ComputeVorticity // Method: avtIVPVTKTimeVaryingField::ComputeVorticity
// //
......
...@@ -98,6 +98,10 @@ class IVP_API avtIVPVTKTimeVaryingField : public avtIVPField ...@@ -98,6 +98,10 @@ class IVP_API avtIVPVTKTimeVaryingField : public avtIVPField
// avtIVPField interface // avtIVPField interface
virtual avtVector operator()(const double& t, const avtVector &pt) const; virtual avtVector operator()(const double& t, const avtVector &pt) const;
virtual avtVector ConvertToCartesian(const avtVector& pt) const;
virtual avtVector ConvertToCylindrical(const avtVector& pt) const;
virtual double ComputeVorticity(const double& t, const avtVector &pt) const; virtual double ComputeVorticity(const double& t, const avtVector &pt) const;
virtual double ComputeScalarVariable(unsigned char index, virtual double ComputeScalarVariable(unsigned char index,
......
...@@ -215,7 +215,7 @@ QvisPoincarePlotWindow::CreateWindowContents() ...@@ -215,7 +215,7 @@ QvisPoincarePlotWindow::CreateWindowContents()
integrationTypeCombo->addItem(tr("Adams-Bashforth (Multi-step)")); integrationTypeCombo->addItem(tr("Adams-Bashforth (Multi-step)"));
integrationTypeCombo->addItem(tr("M3D-C1 2D Integrator (M3D-C1 2D data only)")); integrationTypeCombo->addItem(tr("M3D-C1 2D Integrator (M3D-C1 2D data only)"));
integrationTypeCombo->addItem(tr("M3D-C1 3D Integrator (M3D-C1 3D data only)")); integrationTypeCombo->addItem(tr("M3D-C1 3D Integrator (M3D-C1 3D data only)"));
integrationTypeCombo->addItem(tr("NIMROD Integrator (NIMROD data only)")); // integrationTypeCombo->addItem(tr("NIMROD Integrator (NIMROD data only)"));
connect(integrationTypeCombo, SIGNAL(activated(int)), connect(integrationTypeCombo, SIGNAL(activated(int)),
this, SLOT(integrationTypeChanged(int))); this, SLOT(integrationTypeChanged(int)));
integrationLayout->addWidget(integrationTypeCombo, 0, 1); integrationLayout->addWidget(integrationTypeCombo, 0, 1);
...@@ -958,7 +958,7 @@ QvisPoincarePlotWindow::UpdateWindow(bool doAll) ...@@ -958,7 +958,7 @@ QvisPoincarePlotWindow::UpdateWindow(bool doAll)
break; break;
case PoincareAttributes::ID_rationalTemplateSeedParm: case PoincareAttributes::ID_rationalTemplateSeedParm:
rationalTemplateSeedParm->setText(DoubleToQString(atts->GetWindingPairConfidence())); rationalTemplateSeedParm->setText(DoubleToQString(atts->GetRationalTemplateSeedParm()));
break; break;
case PoincareAttributes::ID_adjustPlane: case PoincareAttributes::ID_adjustPlane:
adjustPlane->blockSignals(true); adjustPlane->blockSignals(true);
......
...@@ -433,7 +433,8 @@ avtPoincarePlot::SetAtts(const AttributeGroup *a) ...@@ -433,7 +433,8 @@ avtPoincarePlot::SetAtts(const AttributeGroup *a)
atts.GetWorkGroupSize()); atts.GetWorkGroupSize());
if (atts.GetIntegrationType() == PoincareAttributes::M3DC13DIntegrator || if (atts.GetIntegrationType() == PoincareAttributes::M3DC13DIntegrator ||
atts.GetIntegrationType() == PoincareAttributes::NIMRODIntegrator ) // atts.GetIntegrationType() == PoincareAttributes::NIMRODIntegrator ||
0 )
poincareFilter->ConvertToCartesian( true ); poincareFilter->ConvertToCartesian( true );
else else
poincareFilter->ConvertToCartesian( false ); poincareFilter->ConvertToCartesian( false );
......
...@@ -528,7 +528,7 @@ QvisStreamlinePlotWindow::CreateWindowContents() ...@@ -528,7 +528,7 @@ QvisStreamlinePlotWindow::CreateWindowContents()
integrationType->addItem(tr("Adams-Bashforth (Multi-step)")); integrationType->addItem(tr("Adams-Bashforth (Multi-step)"));
integrationType->addItem(tr("M3D-C1 2D Integrator (M3D-C1 2D data only)")); integrationType->addItem(tr("M3D-C1 2D Integrator (M3D-C1 2D data only)"));
integrationType->addItem(tr("M3D-C1 3D Integrator (M3D-C1 3D data only)")); integrationType->addItem(tr("M3D-C1 3D Integrator (M3D-C1 3D data only)"));
integrationType->addItem(tr("NIMROD Integrator (NIMROD data only)")); // integrationType->addItem(tr("NIMROD Integrator (NIMROD data only)"));