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

#include <NodalTetElec.h>

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

Public Member Functions

virtual ~NodalTetElec ()
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)
 NodalTetElec (const PointsKey &key)
- 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

 NodalTetElec ()
void CalculatePoints ()
void CalculateWeights ()
void CalculateDerivMatrix ()
void NodalPointReorder3d ()
void CalculateInterpMatrix (const Array< OneD, const NekDouble > &xia, const Array< OneD, const NekDouble > &yia, const Array< OneD, const NekDouble > &zia, 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 52 of file NodalTetElec.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file NodalTetElec.h.

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

Definition at line 88 of file NodalTetElec.h.

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

Definition at line 94 of file NodalTetElec.h.

Member Function Documentation

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

Definition at line 233 of file NodalTetElec.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::NodalTetElec::CalculateInterpMatrix ( const Array< OneD, const NekDouble > &  xia,
const Array< OneD, const NekDouble > &  yia,
const Array< OneD, const NekDouble > &  zia,
Array< OneD, NekDouble > &  interp 
)
private

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

Definition at line 51 of file NodalTetElec.cpp.

References ASSERTL1, Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::PointsKey::GetTotNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, Nektar::LibUtilities::Points< NekDouble >::m_pointsKey, NodalPointReorder3d(), Nektar::LibUtilities::NodalTetElecData, Nektar::LibUtilities::NodalTetElecNPTS, Nektar::LibUtilities::perm12A_3d, Nektar::LibUtilities::perm12B_3d, Nektar::LibUtilities::perm12C_3d, Nektar::LibUtilities::perm24_3d, Nektar::LibUtilities::perm4_3d, and Nektar::LibUtilities::perm6_3d.

{
// Allocate the storage for points
int index=0,isum=0;
const int offset = 5; //offset to match Datafile
NekDouble b,c,d;
unsigned int numPoints = GetNumPoints();
// initialize values
for(unsigned int i=0; i < numPoints-2; ++i)
{
index += NodalTetElecNPTS[i];
}
for(unsigned int i=0; i < NodalTetElecNPTS[numPoints-2]; ++i, ++index)
{
// 1 Point Symmetry: aaaa
if(int(NodalTetElecData[index][0]))
{
b = NodalTetElecData[index][6];
c = NodalTetElecData[index][7];
d = NodalTetElecData[index][8];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
m_points[2][isum] = 2.0*d - 1.0;
isum++;
continue;
}//end symmetry 1
// 4 Point symmetry: aaab or abbb
if(int(NodalTetElecData[index][1]))
{
for(unsigned int j=0; j < 4; ++j)
{
b = NodalTetElecData[index][offset + perm4_3d[j][1]];
c = NodalTetElecData[index][offset + perm4_3d[j][2]];
d = NodalTetElecData[index][offset + perm4_3d[j][3]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
m_points[2][isum] = 2.0*d - 1.0;
isum++;
}//end j
continue;
}//end symmetry 4
// 6 Point symmetry: aabb
if(int(NodalTetElecData[index][2]))
{
for(unsigned int j=0; j < 6; ++j)
{
b = NodalTetElecData[index][offset + perm6_3d[j][1]];
c = NodalTetElecData[index][offset + perm6_3d[j][2]];
d = NodalTetElecData[index][offset + perm6_3d[j][3]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
m_points[2][isum] = 2.0*d - 1.0;
isum++;
}//end j
continue;
}//end symmetry6
// 12 Point symmetry: case aabc
if(int(NodalTetElecData[index][3]) == 1)
{
for(unsigned int j=0; j < 12; ++j)
{
b = NodalTetElecData[index][offset + perm12A_3d[j][1]];
c = NodalTetElecData[index][offset + perm12A_3d[j][2]];
d = NodalTetElecData[index][offset + perm12A_3d[j][3]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
m_points[2][isum] = 2.0*d - 1.0;
isum++;
}//end j
continue;
}//end symmetry 12 aabc
// 12 Point symmetry: case abcc
if(int(NodalTetElecData[index][3]) == 2)
{
for(unsigned int j=0; j < 12; ++j)
{
b = NodalTetElecData[index][offset + perm12B_3d[j][1]];
c = NodalTetElecData[index][offset + perm12B_3d[j][2]];
d = NodalTetElecData[index][offset + perm12B_3d[j][3]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
m_points[2][isum] = 2.0*d - 1.0;
isum++;
}//end j
continue;
}//end symmetry 12 abcc
// 12 Point symmetry: case abbc
if(int(NodalTetElecData[index][3]) == 3)
{
for(unsigned int j=0; j < 12; ++j)
{
b = NodalTetElecData[index][offset + perm12C_3d[j][1]];
c = NodalTetElecData[index][offset + perm12C_3d[j][2]];
d = NodalTetElecData[index][offset + perm12C_3d[j][3]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
m_points[2][isum] = 2.0*d - 1.0;
isum++;
}//end j
continue;
}//end symmetry 12 abbc
// 24 Point symmetry: case abcd
if(int(NodalTetElecData[index][4]))
{
for(unsigned int j=0; j < 24; ++j)
{
b = NodalTetElecData[index][offset + perm24_3d[j][1]];
c = NodalTetElecData[index][offset + perm24_3d[j][2]];
d = NodalTetElecData[index][offset + perm24_3d[j][3]];
m_points[0][isum] = 2.0*b - 1.0;
m_points[1][isum] = 2.0*c - 1.0;
m_points[2][isum] = 2.0*d - 1.0;
isum++;
}//end j
continue;
}//end symmetry24abcd
}//end npts
ASSERTL1((static_cast<unsigned int>(isum)==m_pointsKey.GetTotNumPoints()),"sum not equal to npts");
}
void Nektar::LibUtilities::NodalTetElec::CalculateWeights ( )
private

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

Definition at line 252 of file NodalTetElec.cpp.

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

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

Definition at line 62 of file NodalTetElec.h.

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

{
ASSERTL0(pkey.GetPointsDim() == 3,
"NodalTetElec 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::NodalTetElec::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 72 of file NodalTetElec.h.

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

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

Definition at line 259 of file NodalTetElec.cpp.

Referenced by CalculatePoints().

{
}