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
avtIVPM3DC1Field.C
avtIVPM3DC1Integrator.C
avtIVPNIMRODField.C
avtIVPNIMRODIntegrator.C
avtIVPVTKField.C
avtIVPVTKTimeVaryingField.C
avtPoincareIC.C
......
......@@ -95,7 +95,6 @@ avtIVPAdamsBashforth::avtIVPAdamsBashforth()
initialized = 0;
degenerate_iterations = 0;
stiffness_eps = tol / 1000.0;
convertToCartesian = false;
}
// ****************************************************************************
......@@ -507,8 +506,8 @@ avtIVPAdamsBashforth::Step(avtIVPField* field, double t_max,
if( convertToCartesian )
{
(*ivpstep)[0] = CylindricalToCartesian( yCur );
(*ivpstep)[1] = CylindricalToCartesian( yNew );
(*ivpstep)[0] = field->ConvertToCartesian( yCur );
(*ivpstep)[1] = field->ConvertToCartesian( yNew );
}
else
{
......
......@@ -104,8 +104,6 @@ avtIVPDopri5::avtIVPDopri5()
h_max = 0.0;
nonsti = 0;
convertToCartesian = false;
}
......@@ -689,15 +687,15 @@ avtIVPDopri5::Step(avtIVPField* field, double t_max,
if( convertToCartesian )
{
(*ivpstep)[0] = CylindricalToCartesian( y );
(*ivpstep)[1] = CylindricalToCartesian( y + (h*k1/4.) );
(*ivpstep)[2] = CylindricalToCartesian( (y + y_new)/2 +
(*ivpstep)[0] = field->ConvertToCartesian( y );
(*ivpstep)[1] = field->ConvertToCartesian( y + (h*k1/4.) );
(*ivpstep)[2] = field->ConvertToCartesian( (y + y_new)/2 +
h*( (d1+1)*k1 +
d3*k3 + d4*k4 +
d5*k5 + d6*k6 +
(d7-1)*k7 )/6. );
(*ivpstep)[3] = CylindricalToCartesian( y_new - h*k7/4 );
(*ivpstep)[4] = CylindricalToCartesian( y_new );
(*ivpstep)[3] = field->ConvertToCartesian( y_new - h*k7/4 );
(*ivpstep)[4] = field->ConvertToCartesian( y_new );
}
else
{
......@@ -783,5 +781,3 @@ avtIVPDopri5::AcceptStateVisitor(avtIVPStateHelper& aiss)
.Accept(y)
.Accept(k1);
}
......@@ -103,6 +103,10 @@ class IVP_API avtIVPField
virtual avtVector operator()(const double& t,
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,
const avtVector& x ) const = 0;
virtual double ComputeScalarVariable(unsigned char index,
......
......@@ -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
//
......
......@@ -99,6 +99,9 @@ class IVP_API avtIVPM3DC1Field: public avtIVPVTKField
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;
float interp(float *var, int el, double *lcoords) const;
......
This diff is collapsed.
......@@ -44,12 +44,15 @@
#define AVT_IVP_NIMROD_FIELD_H
#include "avtIVPVTKField.h"
#include <avtMatrix.h>
#include <vtkDataSet.h>
#include <vtkPointData.h>
#include <ivp_exports.h>
typedef avtVector vec3;
typedef avtMatrix mat3;
// ****************************************************************************
// Class: avtIVPNIMRODField
......@@ -67,85 +70,49 @@
class IVP_API avtIVPNIMRODField: public avtIVPVTKField
{
protected:
/* Local typedefs */
typedef struct {
double x,y;
} v_entry;
double lagrange_nodes[6][6];
typedef struct {
int el0, v, side;
} d_edge;
typedef struct{
d_edge o[8];
int n;
} edge;
public:
public:
avtIVPNIMRODField( vtkDataSet* ds, avtCellLocator* loc );
avtIVPNIMRODField( float *elementsPtr, int nelements );
~avtIVPNIMRODField();
avtIVPNIMRODField( unsigned int nRad,
unsigned int nTheta,
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();
void register_vert(v_entry *vlist, int *len,
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;
avtVector ConvertToCartesian(const avtVector& pt) const;
avtVector ConvertToCylindrical(const avtVector& pt) const;
protected:
template< class type >
type* SetDataPointer( vtkDataSet *ds,
const type var,
const char* varname,
const int ntuples,
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 */
template< class type >
type* SetDataPointer( vtkDataSet *ds,
const type var,
const char* varname,
const int ncomponents );
public:
// variables on the mesh
float *psi0, *f0; /* Equilibrium field */
float *psinr, *psini, *fnr, *fni; /* Complex perturbed field */
void lagrange_weights( unsigned int DEG, const double s,
double* w = NULL, double *d = NULL ) const;
// variable based on attributes (bzero and rzero)
double F0; /* Strength of vacuum toroidal field */
// Variables calculated in findElementNeighbors
double Rmin, Rmax, zmin, zmax; /* Mesh bounds */
void fourier_weights( unsigned int N, const double t,
double* w, double* d = NULL ) const;
// unused variables read from header attributes
// (xlim, zlim) or explicitly set (psilim).
// double xlim, zlim, psilim; /* Information about limiting surface */
void interpolate( double rad, double theta, double phi,
vec3* P, mat3* DRV ) const;
// unused variables read from header attributes (ntime == nframes)
// int nframes;
public:
// Variables read as part of the mesh.
float *grid_fourier_series;
float *data_fourier_series;
// variables read from header attributes (linear == linflag,
// ntor == tmode) or part of the mesh (nelms).
int linflag, nelms, tmode;
unsigned int Nrad, Ntheta, Nphi;
// variables read from header attributes.
double bzero, rzero;
// variables read from header attributes.
unsigned int Drad; // = 2;
unsigned int Dtheta; // = 2;
};
#endif
......@@ -55,33 +55,31 @@
//
// ****************************************************************************
void
avtIVPSolver::GetState( avtIVPState& state )
avtIVPSolver::avtIVPSolver() : convertToCartesian(0), convertToCylindrical(0)
{
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:
// Sets the state of the IVP solver.
// Gets the state of the IVP solver.
//
// Programmer: Christoph Garth
// Creation: February 25, 2008
//
// ****************************************************************************
void
avtIVPSolver::PutState(const avtIVPState& state)
void
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);
}
......@@ -96,8 +94,9 @@ avtIVPSolver::PutState(const avtIVPState& state)
//
// ****************************************************************************
avtVector
avtIVPSolver::CylindricalToCartesian(const avtVector& pt) const
void
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
STIFFNESS_DETECTED,
UNSPECIFIED_ERROR,
};
avtIVPSolver();
virtual ~avtIVPSolver() {};
virtual void Reset(const double& t_start, const avtVector& y_start) = 0;
......@@ -446,7 +449,7 @@ class avtIVPSolver
virtual avtIVPSolver* Clone() const = 0;
bool convertToCartesian;
avtVector CylindricalToCartesian(const avtVector& pt) const;
bool convertToCylindrical;
protected:
virtual void AcceptStateVisitor(avtIVPStateHelper& sv) = 0;
......
......@@ -256,6 +256,40 @@ avtIVPVTKField::operator()( const double &t, const avtVector &p ) const
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
//
......
......@@ -97,6 +97,10 @@ class IVP_API avtIVPVTKField: public avtIVPField
// avtIVPField interface
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 ComputeScalarVariable(unsigned char index,
......
......@@ -290,6 +290,40 @@ avtIVPVTKTimeVaryingField::operator()( const double &t, const avtVector &p ) con
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
//
......
......@@ -98,6 +98,10 @@ class IVP_API avtIVPVTKTimeVaryingField : public avtIVPField
// avtIVPField interface
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 ComputeScalarVariable(unsigned char index,
......
......@@ -215,7 +215,7 @@ QvisPoincarePlotWindow::CreateWindowContents()
integrationTypeCombo->addItem(tr("Adams-Bashforth (Multi-step)"));
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("NIMROD Integrator (NIMROD data only)"));
// integrationTypeCombo->addItem(tr("NIMROD Integrator (NIMROD data only)"));
connect(integrationTypeCombo, SIGNAL(activated(int)),
this, SLOT(integrationTypeChanged(int)));
integrationLayout->addWidget(integrationTypeCombo, 0, 1);
......@@ -958,7 +958,7 @@ QvisPoincarePlotWindow::UpdateWindow(bool doAll)
break;
case PoincareAttributes::ID_rationalTemplateSeedParm:
rationalTemplateSeedParm->setText(DoubleToQString(atts->GetWindingPairConfidence()));
rationalTemplateSeedParm->setText(DoubleToQString(atts->GetRationalTemplateSeedParm()));
break;
case PoincareAttributes::ID_adjustPlane:
adjustPlane->blockSignals(true);
......
......@@ -433,7 +433,8 @@ avtPoincarePlot::SetAtts(const AttributeGroup *a)
atts.GetWorkGroupSize());
if (atts.GetIntegrationType() == PoincareAttributes::M3DC13DIntegrator ||
atts.GetIntegrationType() == PoincareAttributes::NIMRODIntegrator )
// atts.GetIntegrationType() == PoincareAttributes::NIMRODIntegrator ||
0 )
poincareFilter->ConvertToCartesian( true );
else
poincareFilter->ConvertToCartesian( false );
......
......@@ -528,7 +528,7 @@ QvisStreamlinePlotWindow::CreateWindowContents()
integrationType->addItem(tr("Adams-Bashforth (Multi-step)"));
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("NIMROD Integrator (NIMROD data only)"));
// integrationType->addItem(tr("NIMROD Integrator (NIMROD data only)"));
connect(integrationType, SIGNAL(activated(int)),
this, SLOT(integrationTypeChanged(int)));
integrationLayout->addWidget(integrationType, 0,1);
......
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