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::NodalTriEvenlySpaced Class Reference

#include <NodalTriEvenlySpaced.h>

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

Public Member Functions

virtual ~NodalTriEvenlySpaced ()
 NodalTriEvenlySpaced (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

 NodalTriEvenlySpaced ()
 Deafult constructor should not be called except by Create matrix.
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 50 of file NodalTriEvenlySpaced.h.

Constructor & Destructor Documentation

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

Definition at line 53 of file NodalTriEvenlySpaced.h.

{
}
Nektar::LibUtilities::NodalTriEvenlySpaced::NodalTriEvenlySpaced ( const PointsKey key)
inline

Definition at line 58 of file NodalTriEvenlySpaced.h.

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

Deafult constructor should not be called except by Create matrix.

Definition at line 93 of file NodalTriEvenlySpaced.h.

Member Function Documentation

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

Definition at line 132 of file NodalTriEvenlySpaced.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::NodalTriEvenlySpaced::CalculateInterpMatrix ( const Array< OneD, const NekDouble > &  xi,
const Array< OneD, const NekDouble > &  yi,
Array< OneD, NekDouble > &  interp 
)
private

Definition at line 112 of file NodalTriEvenlySpaced.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::NodalTriEvenlySpaced::CalculatePoints ( )
private

Definition at line 72 of file NodalTriEvenlySpaced.cpp.

References Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, NodalPointReorder2d(), and npts.

{
// Allocate the storage for points
// Populate m_points
unsigned int npts = GetNumPoints();
NekDouble delta = 2.0/(npts - 1.0);
for(int i=0, index=0; i<npts; ++i){ // y-direction
for(int j=0; j<npts-i; ++j,++index){ // x-direction
NekDouble x = -1.0 + j*delta;
NekDouble y = -1.0 + i*delta;
m_points[0][index] = x;
m_points[1][index] = y;
}
}
}
void Nektar::LibUtilities::NodalTriEvenlySpaced::CalculateWeights ( )
private

Definition at line 95 of file NodalTriEvenlySpaced.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::NodalTriEvenlySpaced::Create ( const PointsKey key)
static

Definition at line 148 of file NodalTriEvenlySpaced.cpp.

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

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

Definition at line 66 of file NodalTriEvenlySpaced.h.

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

{
ASSERTL0(pkey.GetPointsDim() == 2,
"NodalTriEvenlySpaced 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::NodalTriEvenlySpaced::GetI ( const Array< OneD, const NekDouble > &  x,
const Array< OneD, const NekDouble > &  y 
)
inlinevirtual

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

Definition at line 76 of file NodalTriEvenlySpaced.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::NodalTriEvenlySpaced::NodalPointReorder2d ( )
private

Definition at line 157 of file NodalTriEvenlySpaced.cpp.

References Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::Points< NekDouble >::GetTotNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, and npts.

Referenced by CalculatePoints().

{
unsigned int npts = GetNumPoints();
using std::vector;
vector<int> vertex;
vector<int> iEdge_1; // interior edge points on the bottom triangle edge
vector<int> iEdge_2; // interior edge points on the right triangle edge
vector<int> iEdge_3; // interior edge points on the left triangle edge
vector<int> interiorPoints;
vector<int> map;
// Build the lattice triangle left to right - bottom to top
for(int i=0, index=0; i<npts; ++i){ // y-direction
for(int j=0; j<npts-i; ++j,++index){ // x-direction
if( isVertex(i,j,npts) ) {
vertex.push_back(index);
} else if( isEdge(i,j,npts) ) { // interior edge
if(isEdge_1(i,j,npts)){ // bottom edge
iEdge_1.push_back(index);
}else if(isEdge_2(i,j,npts)){ // right edge
iEdge_2.push_back(index);
}else // left edge
{
// Add backwards. This is because of counter clockwise.
iEdge_3.insert(iEdge_3.begin(), index);
}
} else { // Interior points
interiorPoints.push_back(index);
}
}
}
// Mapping the vertex, edges, and interior points using the permutation matrix,
// so the points are ordered anticlockwise.
for(unsigned int k=0; k<vertex.size(); ++k){
map.push_back(vertex[k]);
}
for(unsigned int k=0; k<iEdge_1.size(); ++k){
map.push_back(iEdge_1[k]);
}
for(unsigned int k=0; k<iEdge_2.size(); ++k){
map.push_back(iEdge_2[k]);
}
for(unsigned int k=0; k<iEdge_3.size(); ++k){
map.push_back(iEdge_3[k]);
}
for(unsigned int k=0; k<interiorPoints.size(); ++k){
map.push_back(interiorPoints[k]);
}
Array<OneD,NekDouble> points[2];
points[0] = Array<OneD,NekDouble>(GetTotNumPoints());
points[1] = Array<OneD,NekDouble>(GetTotNumPoints());
for(unsigned int index=0; index<map.size(); ++index){
points[0][index] = m_points[0][index];
points[1][index] = m_points[1][index];
}
for(unsigned int index=0; index<map.size(); ++index){
m_points[0][index] = points[0][map[index]];
m_points[1][index] = points[1][map[index]];
}
}