Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
Nektar::LibUtilities::NodalTriFekete Class Reference

#include <NodalTriFekete.h>

Inheritance diagram for Nektar::LibUtilities::NodalTriFekete:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LibUtilities::NodalTriFekete:
Collaboration graph
[legend]

Public Member Functions

virtual ~NodalTriFekete ()
 NodalTriFekete (const PointsKey &key)
const MatrixSharedPtrType GetI (const PointsKey &pkey)
const MatrixSharedPtrType GetI (const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y)
- Public Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual ~Points ()
virtual void Initialize (void)
unsigned int GetPointsDim () const
unsigned int GetNumPoints () const
unsigned int GetTotNumPoints () const
PointsType GetPointsType () const
const Array< OneD, const
DataType > & 
GetZ () const
const Array< OneD, const
DataType > & 
GetW () const
void GetZW (Array< OneD, const DataType > &z, Array< OneD, const DataType > &w) const
void GetPoints (Array< OneD, const DataType > &x) const
void GetPoints (Array< OneD, const DataType > &x, Array< OneD, const DataType > &y) const
void GetPoints (Array< OneD, const DataType > &x, Array< OneD, const DataType > &y, Array< OneD, const DataType > &z) const
const MatrixSharedPtrTypeGetD (Direction dir=xDir) const
virtual const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x)
virtual const MatrixSharedPtrType GetI (unsigned int numpoints, const Array< OneD, const DataType > &x)
virtual const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x, const Array< OneD, const DataType > &y, const Array< OneD, const DataType > &z)
virtual const MatrixSharedPtrType GetGalerkinProjection (const PointsKey &pkey)

Static Public Member Functions

static boost::shared_ptr
< PointsBaseType
Create (const PointsKey &key)

Private Member Functions

 NodalTriFekete ()
void CalculatePoints ()
void CalculateWeights ()
void CalculateDerivMatrix ()
void NodalPointReorder2d ()
void CalculateInterpMatrix (const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, Array< OneD, NekDouble > &interp)

Additional Inherited Members

- Public Types inherited from Nektar::LibUtilities::Points< NekDouble >
typedef NekDouble DataType
typedef boost::shared_ptr
< NekMatrix< DataType > > 
MatrixSharedPtrType
- Protected Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual void CalculatePoints ()
virtual void CalculateWeights ()
virtual void CalculateDerivMatrix ()
 Points (const PointsKey &key)
- Protected Attributes inherited from Nektar::LibUtilities::Points< NekDouble >
PointsKey m_pointsKey
Array< OneD, DataTypem_points [3]
Array< OneD, DataTypem_weights
MatrixSharedPtrType m_derivmatrix [3]
NekManager< PointsKey,
NekMatrix< DataType >
, PointsKey::opLess
m_InterpManager
NekManager< PointsKey,
NekMatrix< DataType >
, PointsKey::opLess
m_GalerkinProjectionManager

Detailed Description

Definition at line 53 of file NodalTriFekete.h.

Constructor & Destructor Documentation

virtual Nektar::LibUtilities::NodalTriFekete::~NodalTriFekete ( )
inlinevirtual

Definition at line 56 of file NodalTriFekete.h.

{
std::cout << "******* ~NodalTriFekete() destructor called!"
<< endl;
}
Nektar::LibUtilities::NodalTriFekete::NodalTriFekete ( const PointsKey key)
inline

Definition at line 62 of file NodalTriFekete.h.

{
}
Nektar::LibUtilities::NodalTriFekete::NodalTriFekete ( )
inlineprivate

Definition at line 95 of file NodalTriFekete.h.

{
std::cout << "******* NodalTriFekete() constructor called!"
<< endl;
}

Member Function Documentation

void Nektar::LibUtilities::NodalTriFekete::CalculateDerivMatrix ( )
private

Definition at line 166 of file NodalTriFekete.cpp.

References Nektar::LibUtilities::GetXDerivativeMatrix(), Nektar::LibUtilities::GetYDerivativeMatrix(), Nektar::LibUtilities::Points< NekDouble >::m_derivmatrix, and Nektar::LibUtilities::Points< NekDouble >::m_points.

{
// Allocate the derivative matrix.
NekVector<NekDouble> x( m_points[0] );
NekVector<NekDouble> y( m_points[1] );
NekVector<NekDouble> xi = x;
NekVector<NekDouble> yi = y;
}
void Nektar::LibUtilities::NodalTriFekete::CalculateInterpMatrix ( const Array< OneD, const NekDouble > &  xi,
const Array< OneD, const NekDouble > &  yi,
Array< OneD, NekDouble > &  interp 
)
private

Definition at line 147 of file NodalTriFekete.cpp.

References Nektar::LibUtilities::GetInterpolationMatrix(), Nektar::NekVector< DataType >::GetRows(), Nektar::LibUtilities::Points< NekDouble >::GetTotNumPoints(), and Nektar::LibUtilities::Points< NekDouble >::m_points.

Referenced by GetI().

{
NekVector<NekDouble> x( m_points[0] );
NekVector<NekDouble> y( m_points[1] );
NekVector<NekDouble> xi( xia );
NekVector<NekDouble> yi( yia );
NekMatrix<NekDouble> interMat = GetInterpolationMatrix(x, y, xi, yi);
int rows = xi.GetRows(), cols = GetTotNumPoints();
for( int i = 0; i < rows; ++i ) {
for( int j = 0; j < cols; ++j ) {
interp[j + i*cols] = interMat(i,j);
}
}
}
void Nektar::LibUtilities::NodalTriFekete::CalculatePoints ( )
private

Definition at line 55 of file NodalTriFekete.cpp.

References ASSERTL1, Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::PointsKey::GetTotNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, Nektar::LibUtilities::Points< NekDouble >::m_pointsKey, NodalPointReorder2d(), Nektar::LibUtilities::NodalTriFeketeData, Nektar::LibUtilities::NodalTriFeketeNPTS, Nektar::LibUtilities::perm3A_2d, Nektar::LibUtilities::perm3B_2d, and Nektar::LibUtilities::perm6_2d.

{
// Allocate the storage for points
int index=0,isum=0;
const int offset = 3; //offset to match Datafile
NekDouble b,c;
unsigned int numPoints = GetNumPoints();
// initialize values
for(unsigned int i=0; i < numPoints-2; ++i)
{
index += NodalTriFeketeNPTS[i];
}
for(unsigned int i=0; i < NodalTriFeketeNPTS[numPoints-2]; ++i, ++index)
{
if(int(NodalTriFeketeData[index][0]))
{
b = NodalTriFeketeData[index][4];
c = NodalTriFeketeData[index][5];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
isum++;
continue;
}//end symmetry1
if(int(NodalTriFeketeData[index][1]) == 1)
{
for(unsigned int j=0; j < 3; ++j)
{
b = NodalTriFeketeData[index][offset+perm3A_2d[j][1]];
c = NodalTriFeketeData[index][offset+perm3A_2d[j][2]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
isum++;
}//end j
continue;
}//end symmetry3a
if(int(NodalTriFeketeData[index][1]) == 2)
{
for(unsigned int j=0; j < 3; ++j)
{
b = NodalTriFeketeData[index][offset+perm3B_2d[j][1]];
c = NodalTriFeketeData[index][offset+perm3B_2d[j][2]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
isum++;
}//end j
continue;
}//end symmetry3b
if(int(NodalTriFeketeData[index][2]))
{
for(unsigned int j=0; j < 6; ++j)
{
b = NodalTriFeketeData[index][offset+perm6_2d[j][1]];
c = NodalTriFeketeData[index][offset+perm6_2d[j][2]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
isum++;
}//end j
continue;
}//end symmetry6
}//end npts
ASSERTL1((static_cast<unsigned int>(isum)==m_pointsKey.GetTotNumPoints()),"sum not equal to npts");
}
void Nektar::LibUtilities::NodalTriFekete::CalculateWeights ( )
private

Definition at line 131 of file NodalTriFekete.cpp.

References Nektar::NekVector< DataType >::GetPtr(), Nektar::NekVector< DataType >::GetRows(), Nektar::LibUtilities::Points< NekDouble >::m_points, Nektar::LibUtilities::Points< NekDouble >::m_weights, and Nektar::LibUtilities::MakeQuadratureWeights().

{
// Allocate the storage for points
typedef DataType T;
// Solve the Vandermonde system of integrals for the weight vector
NekVector<T> w = MakeQuadratureWeights(NekVector<T>(m_points[0]), NekVector<T>(m_points[1]));
m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
}
boost::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalTriFekete::Create ( const PointsKey key)
static

Definition at line 181 of file NodalTriFekete.cpp.

{
boost::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalTriFekete>::AllocateSharedPtr(key));
returnval->Initialize();
return returnval;
}
const MatrixSharedPtrType Nektar::LibUtilities::NodalTriFekete::GetI ( const PointsKey pkey)
inlinevirtual

Reimplemented from Nektar::LibUtilities::Points< NekDouble >.

Definition at line 69 of file NodalTriFekete.h.

References ASSERTL0, Nektar::LibUtilities::PointsKey::GetPointsDim(), and Nektar::LibUtilities::PointsManager().

{
ASSERTL0(pkey.GetPointsDim() == 2,
"Fekete Points can only interp to other 2d "
"point distributions");
Array<OneD, const NekDouble> x, y;
PointsManager()[pkey]->GetPoints(x, y);
return GetI(x, y);
}
const MatrixSharedPtrType Nektar::LibUtilities::NodalTriFekete::GetI ( const Array< OneD, const NekDouble > &  x,
const Array< OneD, const NekDouble > &  y 
)
inlinevirtual

Reimplemented from Nektar::LibUtilities::Points< NekDouble >.

Definition at line 79 of file NodalTriFekete.h.

References CalculateInterpMatrix(), and Nektar::LibUtilities::Points< NekDouble >::GetTotNumPoints().

{
int numpoints = x.num_elements();
unsigned int np = GetTotNumPoints();
Array<OneD, NekDouble> interp(GetTotNumPoints()*numpoints);
CalculateInterpMatrix(x, y, interp);
NekDouble* d = interp.data();
return MemoryManager<NekMatrix<NekDouble> >
::AllocateSharedPtr(numpoints, np, d);
}
void Nektar::LibUtilities::NodalTriFekete::NodalPointReorder2d ( )
private

Definition at line 188 of file NodalTriFekete.cpp.

References Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::NekConstants::kNekZeroTol, and Nektar::LibUtilities::Points< NekDouble >::m_points.

Referenced by CalculatePoints().

{
int i,j;
int cnt;
int istart,iend;
const int nVerts = 3;
const int nEdgeInteriorPoints = GetNumPoints()-2;
const int nBoundaryPoints = 3*nEdgeInteriorPoints + 3;
if(nEdgeInteriorPoints==0)
{
return;
}
// group the points of edge 1 together;
istart = nVerts;
for(i = cnt = istart; i < nBoundaryPoints; i++)
{
if( fabs(m_points[1][i] + 1.0) < NekConstants::kNekZeroTol)
{
std::swap(m_points[0][cnt], m_points[0][i]);
std::swap(m_points[1][cnt], m_points[1][i]);
cnt++;
}
}
// bubble sort edge 1 (counterclockwise numbering)
iend = istart + nEdgeInteriorPoints;
for(i = istart; i < iend; i++)
{
for(j = istart+1; j < iend; j++)
{
if(m_points[0][j] < m_points[0][j-1])
{
std::swap(m_points[0][j], m_points[0][j-1]);
std::swap(m_points[1][j], m_points[1][j-1]);
}
}
}
// group the points of edge 2 together;
istart = iend;
for(i = cnt = istart; i < nBoundaryPoints; i++)
{
if( fabs(m_points[1][i]+m_points[0][i]) < NekConstants::kNekZeroTol)
{
std::swap(m_points[0][cnt], m_points[0][i]);
std::swap(m_points[1][cnt], m_points[1][i]);
cnt++;
}
}
// bubble sort edge 2 (counterclockwise numbering)
iend = istart + nEdgeInteriorPoints;
for(i = istart; i < iend; i++)
{
for(j = istart+1; j < iend; j++)
{
if(m_points[1][j] < m_points[1][j-1])
{
std::swap(m_points[0][j], m_points[0][j-1]);
std::swap(m_points[1][j], m_points[1][j-1]);
}
}
}
// group the points of edge 3 together;
istart = iend;
for(i = cnt = istart; i < nBoundaryPoints; i++)
{
if( fabs(m_points[0][i]+1.0) < NekConstants::kNekZeroTol)
{
std::swap(m_points[0][cnt], m_points[0][i]);
std::swap(m_points[1][cnt], m_points[1][i]);
cnt++;
}
}
// bubble sort edge 3 (counterclockwise numbering)
iend = istart + nEdgeInteriorPoints;
for(i = istart; i < iend; i++)
{
for(j = istart+1; j < iend; j++)
{
if(m_points[1][j] > m_points[1][j-1])
{
std::swap(m_points[0][j], m_points[0][j-1]);
std::swap(m_points[1][j], m_points[1][j-1]);
}
}
}
return;
}