Commit c9ef7268 authored by Joe Frazier's avatar Joe Frazier
Browse files

Cleanup. Define Null key types so default ctors can be called with valid types.


git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@291 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent 7e8e8f68
......@@ -56,11 +56,6 @@ namespace Nektar
bool operator()(const BasisKey &lhs, const BasisKey &rhs);
};
BasisKey()
{
NEKERROR(ErrorUtil::efatal,"Default Constructor BasisKey should never be called");
}
BasisKey(const BasisType btype, const int nummodes, const PointsKey pkey):
m_basistype(btype),
m_nummodes(nummodes),
......@@ -101,7 +96,6 @@ namespace Nektar
return m_pointsKey;
}
/** \brief return type of quadrature */
inline PointsType GetPointsType() const
{
......@@ -148,18 +142,19 @@ namespace Nektar
PointsKey m_pointsKey;
private:
BasisKey():m_pointsKey(NullPointsKey)
{
NEKERROR(ErrorUtil::efatal,"Default Constructor BasisKey should never be called");
}
};
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey);
/////////////////////////////////////////////////////////////////////////
class Basis
{
public:
Basis()
{
NEKERROR(ErrorUtil::efatal,"Default Constructor for Basis should not be called");
}
Basis(const BasisKey &bkey): m_basisKey(bkey)
{
......@@ -167,7 +162,7 @@ namespace Nektar
//Copy Constructor
Basis(const Basis &B)
Basis(const Basis &B):m_basisKey(B.m_basisKey)
{
//m_basistype = B.m_basistype;
//m_nummodes = B.m_nummodes;
......@@ -276,6 +271,11 @@ namespace Nektar
double *m_bdata; /**< Basis definition */
double *m_dbdata; /**< Derivative Basis definition */
private:
Basis():m_basisKey(NullBasisKey)
{
NEKERROR(ErrorUtil::efatal,"Default Constructor for Basis should not be called");
}
};
bool operator<(const BasisKey &lhs, const BasisKey &rhs);
......
......@@ -42,6 +42,7 @@ namespace Nektar
{
enum BasisType
{
eNoBasisType,
eOrtho_A, //!< Principle Orthogonal Functions \f$\widetilde{\psi}^a_p(z_i)\f$
eOrtho_B, //!< Principle Orthogonal Functions \f$\widetilde{\psi}^b_{pq}(z_i)\f$
eOrtho_C, //!< Principle Orthogonal Functions \f$\widetilde{\psi}^c_{pqr}(z_i)\f$
......@@ -57,6 +58,7 @@ namespace Nektar
const char* const BasisTypeMap[] =
{
"NoBasisType",
"Ortho_A",
"Ortho_B",
"Ortho_C",
......@@ -71,6 +73,7 @@ namespace Nektar
enum PointsType
{
eNoPointsType,
eGaussGaussLegendre, //!< 1D Gauss-Gauss-Legendre quadrature points
eGaussRadauMLegendre, //!< 1D Gauss-Radau-Legendre quadrature points, pinned at x=-1
eGaussRadauPLegendre, //!< 1D Gauss-Radau-Legendre quadrature points, pinned at x=1
......@@ -91,6 +94,7 @@ namespace Nektar
const char* const PointsTypeMap[] =
{
"NoPointsType",
"GaussGaussLegendre",
"GaussRadauMLegendre",
"GaussRadauPLegendre",
......
......@@ -48,57 +48,56 @@ namespace Nektar
void GaussPoints::CalculatePoints()
{
// Allocate the storage for points and weights
Points<double>::CalculatePoints();
Points<double>::CalculateWeights();
int numpoints = m_pointsKey.GetNumPoints();
switch(m_pointsKey.GetPointsType())
{
case eGaussGaussLegendre:
Polylib::zwgj(m_points[0],m_weights,numpoints,0.0,0.0);
break;
case eGaussRadauMLegendre:
Polylib::zwgrjm(m_points[0],m_weights,numpoints,0.0,0.0);
break;
case eGaussRadauPLegendre:
Polylib::zwgrjp(m_points[0],m_weights,numpoints,0.0,0.0);
break;
case eGaussLobattoLegendre:
Polylib::zwglj(m_points[0],m_weights,numpoints,0.0,0.0);
break;
case eGaussGaussChebyshev:
Polylib::zwgj(m_points[0],m_weights,numpoints,-0.5,-0.5);
break;
case eGaussRadauMChebyshev:
Polylib::zwgrjm(m_points[0],m_weights,numpoints,-0.5,-0.5);
break;
case eGaussRadauPChebyshev:
Polylib::zwgrjp(m_points[0],m_weights,numpoints,-0.5,-0.5);
break;
case eGaussLobattoChebyshev:
Polylib::zwglj(m_points[0],m_weights,numpoints,-0.5,-0.5);
break;
case eGaussRadauMAlpha0Beta1:
Polylib::zwgrjm(m_points[0],m_weights,numpoints,0.0,1.0);
break;
case eGaussRadauMAlpha0Beta2:
Polylib::zwgrjm(m_points[0],m_weights,numpoints,0.0,2.0);
break;
default:
ASSERTL0(false, "Unknown Gauss quadrature point distribution requested");
}
}
PointsBaseType::CalculatePoints();
PointsBaseType::CalculateWeights();
int numpoints = m_pointsKey.GetNumPoints();
switch(m_pointsKey.GetPointsType())
{
case eGaussGaussLegendre:
Polylib::zwgj(m_points[0],m_weights,numpoints,0.0,0.0);
break;
case eGaussRadauMLegendre:
Polylib::zwgrjm(m_points[0],m_weights,numpoints,0.0,0.0);
break;
case eGaussRadauPLegendre:
Polylib::zwgrjp(m_points[0],m_weights,numpoints,0.0,0.0);
break;
case eGaussLobattoLegendre:
Polylib::zwglj(m_points[0],m_weights,numpoints,0.0,0.0);
break;
case eGaussGaussChebyshev:
Polylib::zwgj(m_points[0],m_weights,numpoints,-0.5,-0.5);
break;
case eGaussRadauMChebyshev:
Polylib::zwgrjm(m_points[0],m_weights,numpoints,-0.5,-0.5);
break;
case eGaussRadauPChebyshev:
Polylib::zwgrjp(m_points[0],m_weights,numpoints,-0.5,-0.5);
break;
case eGaussLobattoChebyshev:
Polylib::zwglj(m_points[0],m_weights,numpoints,-0.5,-0.5);
break;
case eGaussRadauMAlpha0Beta1:
Polylib::zwgrjm(m_points[0],m_weights,numpoints,0.0,1.0);
break;
case eGaussRadauMAlpha0Beta2:
Polylib::zwgrjm(m_points[0],m_weights,numpoints,0.0,2.0);
break;
default:
ASSERTL0(false, "Unknown Gauss quadrature point distribution requested");
}
}
void GaussPoints::CalculateWeights()
......@@ -112,21 +111,17 @@ namespace Nektar
Points<double>::CalculateDerivMatrix();
}
GaussPoints::GaussPoints(const PointsKey &key) : Points<double>(key)
{
}
boost::shared_ptr< Points<double> > GaussPoints::Create(const PointsKey &key)
boost::shared_ptr< PointsBaseType > GaussPoints::Create(const PointsKey &key)
{
boost::shared_ptr< Points<double> > returnval(new GaussPoints(key);
boost::shared_ptr< PointsBaseType > returnval(new GaussPoints(key));
returnval->Initialize();
return returnval;
}
} // end of namespace stdregion
} // end of namespace stdregion
} // end of namespace LibUtilities
} // end of namespace Nektar
......
......@@ -46,10 +46,12 @@ namespace Nektar
{
namespace LibUtilities
{
class GaussPoints: public Points<double>
typedef Points<double> PointsBaseType;
class GaussPoints: public PointsBaseType
{
public:
GaussPoints(const PointsKey &key)
GaussPoints(const PointsKey &key):PointsBaseType(key)
{
}
......@@ -57,7 +59,7 @@ namespace Nektar
{
}
static boost::shared_ptr< Points<double> > Create(const PointsKey &key);
static boost::shared_ptr< PointsBaseType > Create(const PointsKey &key);
protected:
......
......@@ -115,9 +115,10 @@ namespace Nektar
}
// If new points are added, this function must be modified
inline unsigned int GetPointsDim()
inline unsigned int GetPointsDim() const
{
int dimpoints;
int dimpoints = 1;
switch(m_pointstype)
{
case eNodalTriElec:
......@@ -128,32 +129,31 @@ namespace Nektar
case eNodalTetElec:
dimpoints = 3;
break;
default:
dimpoints = 1;
}
return dimpoints;
}
// If new points are added, this function must be modified
inline unsigned int GetTotNumPoints()
inline unsigned int GetTotNumPoints() const
{
int totpoints;
int totpoints = m_numpoints;
switch(m_pointstype)
{
case eNodalTriElec:
totpoints = m_numpoints*(m_numpoints+1)/2;
break;
case eNodalTriFekete:
totpoints = m_numpoints*(m_numpoints+1)/2;
break;
case eNodalTetElec:
totpoints = m_numpoints*(m_numpoints+1)*(m_numpoints+2)/6;
break;
default:
totpoints = m_numpoints;
}
return totpoints;
}
......@@ -175,6 +175,8 @@ namespace Nektar
};
static const PointsKey NullPointsKey(0, eNoPointsType);
bool operator==(const PointsKey &lhs, const PointsKey &rhs);
bool operator<(const PointsKey &lhs, const PointsKey &rhs);
std::ostream& operator<<(std::ostream& os, const PointsKey& rhs);
......
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