Nektar++
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< PointsBaseTypeCreate (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 >
 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::opLessm_InterpManager
 
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLessm_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.

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

Definition at line 88 of file NodalTetElec.h.

88  : PointsBaseType(key)
89  {
90 
91  }
Points< NekDouble > PointsBaseType
Nektar::LibUtilities::NodalTetElec::NodalTetElec ( )
inlineprivate

Definition at line 94 of file NodalTetElec.h.

95  {
96 
97  }
static const PointsKey NullPointsKey(0, eNoPointsType)
Points< NekDouble > PointsBaseType

Member Function Documentation

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

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

Definition at line 233 of file NodalTetElec.cpp.

References Nektar::LibUtilities::Points< NekDouble >::CalculateDerivMatrix(), Nektar::LibUtilities::GetTetXDerivativeMatrix(), Nektar::LibUtilities::GetTetYDerivativeMatrix(), Nektar::LibUtilities::GetTetZDerivativeMatrix(), Nektar::LibUtilities::Points< NekDouble >::m_derivmatrix, and Nektar::LibUtilities::Points< NekDouble >::m_points.

234  {
235  // Allocate the derivative matrix.
237 
238  NekVector<NekDouble> x( m_points[0] );
239  NekVector<NekDouble> y( m_points[1] );
240  NekVector<NekDouble> z( m_points[2] );
241  NekVector<NekDouble> xi = x;
242  NekVector<NekDouble> yi = y;
243  NekVector<NekDouble> zi = z;
244 
245  *m_derivmatrix[0] = *GetTetXDerivativeMatrix(x,y,z,xi,yi,zi);
246 
247  *m_derivmatrix[1] = *GetTetYDerivativeMatrix(x,y,z,xi,yi,zi);
248 
249  *m_derivmatrix[2] = *GetTetZDerivativeMatrix(x,y,z,xi,yi,zi);
250  }
Points< NekDouble >::MatrixSharedPtrType GetTetZDerivativeMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi, const NekVector< NekDouble > &zi)
Definition: NodalUtil.cpp:1195
Points< NekDouble >::MatrixSharedPtrType GetTetXDerivativeMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi, const NekVector< NekDouble > &zi)
Definition: NodalUtil.cpp:806
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:351
Points< NekDouble >::MatrixSharedPtrType GetTetYDerivativeMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi, const NekVector< NekDouble > &zi)
Definition: NodalUtil.cpp:1047
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().

216  {
217  NekVector<NekDouble> x( m_points[0] );
218  NekVector<NekDouble> y( m_points[1] );
219  NekVector<NekDouble> z( m_points[2] );
220  NekVector<NekDouble> xi( xia );
221  NekVector<NekDouble> yi( yia );
222  NekVector<NekDouble> zi( zia );
223  NekMatrix<NekDouble> interMat = GetTetInterpolationMatrix(x, y, z, xi, yi, zi);
224 
225  int rows = xi.GetRows(), cols = GetTotNumPoints();
226  for( int i = 0; i < rows; ++i ) {
227  for( int j = 0; j < cols; ++j ) {
228  interp[j + i*cols] = interMat(i,j);
229  }
230  }
231  }
unsigned int GetTotNumPoints() const
Definition: Points.h:251
NekMatrix< NekDouble > GetTetInterpolationMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi, const NekVector< NekDouble > &zi)
Definition: NodalUtil.cpp:594
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
void Nektar::LibUtilities::NodalTetElec::CalculatePoints ( )
privatevirtual

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

Definition at line 51 of file NodalTetElec.cpp.

References ASSERTL1, Nektar::LibUtilities::Points< DataT >::CalculatePoints(), 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.

52  {
53  // Allocate the storage for points
55 
56  int index=0,isum=0;
57  const int offset = 5; //offset to match Datafile
58  NekDouble b,c,d;
59  unsigned int numPoints = GetNumPoints();
60 
61  // initialize values
62  for(unsigned int i=0; i < numPoints-2; ++i)
63  {
64  index += NodalTetElecNPTS[i];
65  }
66 
67  for(unsigned int i=0; i < NodalTetElecNPTS[numPoints-2]; ++i, ++index)
68  {
69  // 1 Point Symmetry: aaaa
70  if(int(NodalTetElecData[index][0]))
71  {
72  b = NodalTetElecData[index][6];
73  c = NodalTetElecData[index][7];
74  d = NodalTetElecData[index][8];
75 
76  m_points[0][isum] = 2.0*b - 1.0;
77  m_points[1][isum] = 2.0*c - 1.0;
78  m_points[2][isum] = 2.0*d - 1.0;
79  isum++;
80  continue;
81  }//end symmetry 1
82 
83 
84  // 4 Point symmetry: aaab or abbb
85  if(int(NodalTetElecData[index][1]))
86  {
87  for(unsigned int j=0; j < 4; ++j)
88  {
89  b = NodalTetElecData[index][offset + perm4_3d[j][1]];
90  c = NodalTetElecData[index][offset + perm4_3d[j][2]];
91  d = NodalTetElecData[index][offset + perm4_3d[j][3]];
92 
93  m_points[0][isum] = 2.0*b - 1.0;
94  m_points[1][isum] = 2.0*c - 1.0;
95  m_points[2][isum] = 2.0*d - 1.0;
96  isum++;
97  }//end j
98  continue;
99  }//end symmetry 4
100 
101 
102  // 6 Point symmetry: aabb
103  if(int(NodalTetElecData[index][2]))
104  {
105  for(unsigned int j=0; j < 6; ++j)
106  {
107  b = NodalTetElecData[index][offset + perm6_3d[j][1]];
108  c = NodalTetElecData[index][offset + perm6_3d[j][2]];
109  d = NodalTetElecData[index][offset + perm6_3d[j][3]];
110 
111  m_points[0][isum] = 2.0*b - 1.0;
112  m_points[1][isum] = 2.0*c - 1.0;
113  m_points[2][isum] = 2.0*d - 1.0;
114  isum++;
115  }//end j
116  continue;
117  }//end symmetry6
118 
119 
120  // 12 Point symmetry: case aabc
121  if(int(NodalTetElecData[index][3]) == 1)
122  {
123  for(unsigned int j=0; j < 12; ++j)
124  {
125  b = NodalTetElecData[index][offset + perm12A_3d[j][1]];
126  c = NodalTetElecData[index][offset + perm12A_3d[j][2]];
127  d = NodalTetElecData[index][offset + perm12A_3d[j][3]];
128 
129  m_points[0][isum] = 2.0*b - 1.0;
130  m_points[1][isum] = 2.0*c - 1.0;
131  m_points[2][isum] = 2.0*d - 1.0;
132  isum++;
133  }//end j
134  continue;
135  }//end symmetry 12 aabc
136 
137 
138  // 12 Point symmetry: case abcc
139  if(int(NodalTetElecData[index][3]) == 2)
140  {
141  for(unsigned int j=0; j < 12; ++j)
142  {
143  b = NodalTetElecData[index][offset + perm12B_3d[j][1]];
144  c = NodalTetElecData[index][offset + perm12B_3d[j][2]];
145  d = NodalTetElecData[index][offset + perm12B_3d[j][3]];
146 
147  m_points[0][isum] = 2.0*b - 1.0;
148  m_points[1][isum] = 2.0*c - 1.0;
149  m_points[2][isum] = 2.0*d - 1.0;
150  isum++;
151  }//end j
152  continue;
153  }//end symmetry 12 abcc
154 
155 
156  // 12 Point symmetry: case abbc
157  if(int(NodalTetElecData[index][3]) == 3)
158  {
159  for(unsigned int j=0; j < 12; ++j)
160  {
161  b = NodalTetElecData[index][offset + perm12C_3d[j][1]];
162  c = NodalTetElecData[index][offset + perm12C_3d[j][2]];
163  d = NodalTetElecData[index][offset + perm12C_3d[j][3]];
164 
165  m_points[0][isum] = 2.0*b - 1.0;
166  m_points[1][isum] = 2.0*c - 1.0;
167  m_points[2][isum] = 2.0*d - 1.0;
168  isum++;
169  }//end j
170  continue;
171  }//end symmetry 12 abbc
172 
173  // 24 Point symmetry: case abcd
174  if(int(NodalTetElecData[index][4]))
175  {
176  for(unsigned int j=0; j < 24; ++j)
177  {
178  b = NodalTetElecData[index][offset + perm24_3d[j][1]];
179  c = NodalTetElecData[index][offset + perm24_3d[j][2]];
180  d = NodalTetElecData[index][offset + perm24_3d[j][3]];
181 
182  m_points[0][isum] = 2.0*b - 1.0;
183  m_points[1][isum] = 2.0*c - 1.0;
184  m_points[2][isum] = 2.0*d - 1.0;
185  isum++;
186  }//end j
187  continue;
188  }//end symmetry24abcd
189 
190 
191  }//end npts
192 
194 
195  ASSERTL1((static_cast<unsigned int>(isum)==m_pointsKey.GetTotNumPoints()),"sum not equal to npts");
196  }
virtual void CalculatePoints()
Definition: Points.h:355
static const unsigned int perm12C_3d[12][4]
static const unsigned int perm6_3d[6][4]
unsigned int GetTotNumPoints() const
Definition: Points.h:175
double NekDouble
unsigned int GetNumPoints() const
Definition: Points.h:246
static const unsigned int perm4_3d[4][4]
static const unsigned int NodalTetElecNPTS[NodalTetElecAvailable]
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
static const unsigned int perm24_3d[24][4]
static const NekDouble NodalTetElecData[][9]
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
static const unsigned int perm12A_3d[12][4]
static const unsigned int perm12B_3d[12][4]
void Nektar::LibUtilities::NodalTetElec::CalculateWeights ( )
privatevirtual

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

Definition at line 198 of file NodalTetElec.cpp.

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

199  {
200  // Allocate the storage for points
202 
203  typedef DataType T;
204 
205  // Solve the Vandermonde system of integrals for the weight vector
206  NekVector<T> w = MakeTetWeights(NekVector<T>(m_points[0]), NekVector<T>(m_points[1]), NekVector<T>(m_points[2]));
207 
208  m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
209  }
Array< OneD, DataType > m_weights
Definition: Points.h:350
NekVector< NekDouble > MakeTetWeights(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z)
Definition: NodalUtil.cpp:562
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
boost::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalTetElec::Create ( const PointsKey key)
static

Definition at line 252 of file NodalTetElec.cpp.

253  {
254  boost::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalTetElec>::AllocateSharedPtr(key));
255  returnval->Initialize();
256  return returnval;
257  }
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().

63  {
64  ASSERTL0(pkey.GetPointsDim() == 3,
65  "NodalTetElec Points can only interp to other 3d "
66  "point distributions");
67  Array<OneD, const NekDouble> x, y, z;
68  PointsManager()[pkey]->GetPoints(x, y, z);
69  return GetI(x, y, z);
70  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
const MatrixSharedPtrType GetI(const PointsKey &pkey)
Definition: NodalTetElec.h:62
PointsManagerT & PointsManager(void)
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().

76  {
77  int numpoints = x.num_elements();
78  unsigned int np = GetTotNumPoints();
79 
80  Array<OneD, NekDouble> interp(np*numpoints);
81  CalculateInterpMatrix(x, y, z, interp);
82 
83  NekDouble* d = interp.data();
84  return MemoryManager<NekMatrix<NekDouble> >
85  ::AllocateSharedPtr(numpoints, np, d);
86  }
unsigned int GetTotNumPoints() const
Definition: Points.h:251
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xia, const Array< OneD, const NekDouble > &yia, const Array< OneD, const NekDouble > &zia, Array< OneD, NekDouble > &interp)
double NekDouble
void Nektar::LibUtilities::NodalTetElec::NodalPointReorder3d ( )
private

Definition at line 259 of file NodalTetElec.cpp.

Referenced by CalculatePoints().

260  {
261  }