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

#include <NodalTetEvenlySpaced.h>

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

Public Member Functions

virtual ~NodalTetEvenlySpaced ()
 NodalTetEvenlySpaced (const PointsKey &key)
const MatrixSharedPtrType GetI (const PointsKey &pkey)
const MatrixSharedPtrType GetI (const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z)
- 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)
virtual const MatrixSharedPtrType GetGalerkinProjection (const PointsKey &pkey)

Static Public Member Functions

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

Private Member Functions

 NodalTetEvenlySpaced ()
 Default constructor should not be called except by Create matrix.
void CalculatePoints ()
void CalculateWeights ()
void CalculateDerivMatrix ()
void NodalPointReorder3d ()
void CalculateInterpMatrix (const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, const Array< OneD, const NekDouble > &zi, 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 51 of file NodalTetEvenlySpaced.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file NodalTetEvenlySpaced.h.

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

Definition at line 60 of file NodalTetEvenlySpaced.h.

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

Default constructor should not be called except by Create matrix.

Definition at line 96 of file NodalTetEvenlySpaced.h.

Member Function Documentation

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

Definition at line 346 of file NodalTetEvenlySpaced.cpp.

References Nektar::LibUtilities::GetTetXDerivativeMatrix(), Nektar::LibUtilities::GetTetYDerivativeMatrix(), Nektar::LibUtilities::GetTetZDerivativeMatrix(), 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> z( m_points[2] );
NekVector<NekDouble> xi = x;
NekVector<NekDouble> yi = y;
NekVector<NekDouble> zi = z;
*m_derivmatrix[0] = *GetTetXDerivativeMatrix(x,y,z,xi,yi,zi);
*m_derivmatrix[1] = *GetTetYDerivativeMatrix(x,y,z,xi,yi,zi);
*m_derivmatrix[2] = *GetTetZDerivativeMatrix(x,y,z,xi,yi,zi);
}
void Nektar::LibUtilities::NodalTetEvenlySpaced::CalculateInterpMatrix ( const Array< OneD, const NekDouble > &  xi,
const Array< OneD, const NekDouble > &  yi,
const Array< OneD, const NekDouble > &  zi,
Array< OneD, NekDouble > &  interp 
)
private

Definition at line 322 of file NodalTetEvenlySpaced.cpp.

References Nektar::NekVector< DataType >::GetRows(), Nektar::LibUtilities::GetTetInterpolationMatrix(), 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> z( m_points[2] );
NekVector<NekDouble> xi( xia );
NekVector<NekDouble> yi( yia );
NekVector<NekDouble> zi( zia );
NekMatrix<NekDouble> interMat = GetTetInterpolationMatrix(x, y, z, xi, yi, zi);
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::NodalTetEvenlySpaced::CalculatePoints ( )
private

Definition at line 111 of file NodalTetEvenlySpaced.cpp.

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

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

Definition at line 305 of file NodalTetEvenlySpaced.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::MakeTetWeights().

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

Definition at line 367 of file NodalTetEvenlySpaced.cpp.

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

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

Definition at line 68 of file NodalTetEvenlySpaced.h.

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

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

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

Definition at line 78 of file NodalTetEvenlySpaced.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, z, interp);
NekDouble* d = interp.data();
return MemoryManager<NekMatrix<NekDouble> >
::AllocateSharedPtr(numpoints, np, d);
}
void Nektar::LibUtilities::NodalTetEvenlySpaced::NodalPointReorder3d ( )
private

Definition at line 136 of file NodalTetEvenlySpaced.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_01; // interior edge 0
vector<int> iEdge_12; // interior edge 1
vector<int> iEdge_20; // interior edge 2
vector<int> iEdge_03; // interior edge 3
vector<int> iEdge_13; // interior edge 4
vector<int> iEdge_23; // interior edge 5
vector<int> iFace_012; // interior face 0
vector<int> iFace_013; // interior face 1
vector<int> iFace_123; // interior face 2
vector<int> iFace_203; // interior face 3
vector<int> interiorVolumePoints; // interior volume points
vector<int> map;
// Build the lattice tetrahedron left to right - bottom to top
for(int z=0, index=0; z<npts; ++z){
for(int y=0; y<npts-z; ++y){
for(int x=0; x<npts-z-y; ++x, ++index){
if( isVertex(x,y,z,npts) ){ // vertex
vertex.push_back(index);
} else if( isEdge(x,y,z,npts) ){ // interior edge
if( isEdge_01(x,y,z,npts) ){ // interior edge 0
iEdge_01.push_back(index);
} else if( isEdge_12(x,y,z,npts) ){ // interior edge 1
iEdge_12.push_back(index);
} else if( isEdge_20(x,y,z,npts) ){ // interior edge 2
iEdge_20.insert(iEdge_20.begin(), index);
} else if( isEdge_03(x,y,z,npts) ){ // interior edge 3
iEdge_03.push_back(index);
} else if( isEdge_13(x,y,z,npts) ){ // interior edge 4
iEdge_13.push_back(index);
} else if( isEdge_23(x,y,z,npts) ){ // interior edge 5
iEdge_23.push_back(index);
}
} else if( isFace(x,y,z,npts) ) { // interior face
if( isFace_012(x,y,z,npts) ){ // interior face 0
iFace_012.push_back(index);
} else if( isFace_013(x,y,z,npts) ){ // interior face 1
iFace_013.push_back(index);
} else if( isFace_123(x,y,z,npts) ){ // interior face 2
iFace_123.push_back(index);
} else if( isFace_203(x,y,z,npts) ){ // interior face 3
iFace_203.push_back(index);
}
} else { // interior volume points
interiorVolumePoints.push_back(index);
}
}
}
}
// Mapping the vertex, edges, faces, interior volume points using the permutation matrix,
// so the points are ordered anticlockwise.
for(unsigned int n=0; n<vertex.size(); ++n){
map.push_back(vertex[n]);
}
for(unsigned int n=0; n<iEdge_01.size(); ++n){
map.push_back(iEdge_01[n]);
}
for(unsigned int n=0; n<iEdge_12.size(); ++n){
map.push_back(iEdge_12[n]);
}
for(unsigned int n=0; n<iEdge_20.size(); ++n){
map.push_back(iEdge_20[n]);
}
for(unsigned int n=0; n<iEdge_03.size(); ++n){
map.push_back(iEdge_03[n]);
}
for(unsigned int n=0; n<iEdge_13.size(); ++n){
map.push_back(iEdge_13[n]);
}
for(unsigned int n=0; n<iEdge_23.size(); ++n){
map.push_back(iEdge_23[n]);
}
for(unsigned int n=0; n<iFace_012.size(); ++n){
map.push_back(iFace_012[n]);
}
for(unsigned int n=0; n<iFace_013.size(); ++n){
map.push_back(iFace_013[n]);
}
for(unsigned int n=0; n<iFace_123.size(); ++n){
map.push_back(iFace_123[n]);
}
for(unsigned int n=0; n<iFace_203.size(); ++n){
map.push_back(iFace_203[n]);
}
for(unsigned int n=0; n<interiorVolumePoints.size(); ++n){
map.push_back(interiorVolumePoints[n]);
}
Array<OneD, NekDouble> points[3];
points[0] = Array<OneD, NekDouble>(GetTotNumPoints());
points[1] = Array<OneD, NekDouble>(GetTotNumPoints());
points[2] = 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];
points[2][index] = m_points[2][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]];
m_points[2][index] = points[2][map[index]];
}
}