Nektar++
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Nektar::LibUtilities::NodalPrismElec Class Reference

#include <NodalPrismElec.h>

Inheritance diagram for Nektar::LibUtilities::NodalPrismElec:
[legend]

Public Member Functions

virtual ~NodalPrismElec ()
 
 NodalPrismElec (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, 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 std::shared_ptr< PointsBaseTypeCreate (const PointsKey &key)
 

Private Member Functions

 NodalPrismElec ()
 Default constructor should not be called except by Create matrix. More...
 
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)
 

Private Attributes

std::shared_ptr< NodalUtilPrismm_util
 

Static Private Attributes

static bool initPointsManager []
 

Additional Inherited Members

- Public Types inherited from Nektar::LibUtilities::Points< NekDouble >
typedef NekDouble DataType
 
typedef std::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 51 of file NodalPrismElec.h.

Constructor & Destructor Documentation

◆ ~NodalPrismElec()

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

Definition at line 54 of file NodalPrismElec.h.

55  {
56  }

◆ NodalPrismElec() [1/2]

Nektar::LibUtilities::NodalPrismElec::NodalPrismElec ( const PointsKey key)
inline

Definition at line 58 of file NodalPrismElec.h.

References Create(), and LIB_UTILITIES_EXPORT.

58  : PointsBaseType(key)
59  {
60  }
Points< NekDouble > PointsBaseType

◆ NodalPrismElec() [2/2]

Nektar::LibUtilities::NodalPrismElec::NodalPrismElec ( )
inlineprivate

Default constructor should not be called except by Create matrix.

Definition at line 96 of file NodalPrismElec.h.

References CalculateDerivMatrix(), CalculateInterpMatrix(), CalculatePoints(), CalculateWeights(), and NodalPointReorder3d().

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

Member Function Documentation

◆ CalculateDerivMatrix()

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

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

Definition at line 451 of file NodalPrismElec.cpp.

References Nektar::LibUtilities::Points< NekDouble >::CalculateDerivMatrix(), Nektar::LibUtilities::Points< NekDouble >::m_derivmatrix, and m_util.

Referenced by NodalPrismElec().

452 {
453  // Allocate the derivative matrix.
455 
456  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
457  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
458  m_derivmatrix[2] = m_util->GetDerivMatrix(2);
459 }
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:383
std::shared_ptr< NodalUtilPrism > m_util

◆ CalculateInterpMatrix()

void Nektar::LibUtilities::NodalPrismElec::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 433 of file NodalPrismElec.cpp.

References m_util, and Vmath::Vcopy().

Referenced by GetI(), and NodalPrismElec().

437 {
438  Array<OneD, Array<OneD, NekDouble> > xi(3);
439  xi[0] = xia;
440  xi[1] = yia;
441  xi[1] = zia;
442 
443  std::shared_ptr<NekMatrix<NekDouble> > mat =
444  m_util->GetInterpolationMatrix(xi);
445  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
446  &interp[0], 1);
447 }
std::shared_ptr< NodalUtilPrism > m_util
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064

◆ CalculatePoints()

void Nektar::LibUtilities::NodalPrismElec::CalculatePoints ( )
privatevirtual

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

Definition at line 157 of file NodalPrismElec.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::Points< NekDouble >::CalculatePoints(), Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eNodalTriElec, Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, m_util, NodalPointReorder3d(), and Nektar::LibUtilities::PointsManager().

Referenced by NodalPrismElec().

158 {
159  // Allocate the storage for points
161 
162  // Populate m_points
163  unsigned int npts = GetNumPoints();
164 
165  LibUtilities::PointsKey pkey1(npts, LibUtilities::eNodalTriElec);
166  Array<OneD, NekDouble> u1, v1;
167  LibUtilities::PointsManager()[pkey1]->GetPoints(u1, v1);
168  LibUtilities::PointsKey pkey2(npts, LibUtilities::eGaussLobattoLegendre);
169  Array<OneD, NekDouble> u;
170  LibUtilities::PointsManager()[pkey2]->GetPoints(u);
171 
172  for (unsigned int y = 0, index = 0; y < npts; y++)
173  {
174  for (size_t t = 0; t < u1.num_elements(); t++, index++)
175  {
176  m_points[0][index] = u1[t];
177  m_points[1][index] = u[y];
178  m_points[2][index] = v1[t];
179  }
180  }
181 
184  npts - 1, m_points[0], m_points[1], m_points[2]);
185 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
PointsManagerT & PointsManager(void)
Array< OneD, DataType > m_points[3]
Definition: Points.h:381
std::shared_ptr< NodalUtilPrism > m_util
unsigned int GetNumPoints() const
Definition: Points.h:272
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51
2D Nodal Electrostatic Points on a Triangle
Definition: PointsType.h:69

◆ CalculateWeights()

void Nektar::LibUtilities::NodalPrismElec::CalculateWeights ( )
privatevirtual

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

Definition at line 418 of file NodalPrismElec.cpp.

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

Referenced by NodalPrismElec().

419 {
420  // Allocate the storage for points
422 
423  typedef DataType T;
424 
425  // Solve the Vandermonde system of integrals for the weight vector
426  NekVector<T> w = m_util->GetWeights();
427 
428  m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
429 }
Array< OneD, DataType > m_weights
Definition: Points.h:382
std::shared_ptr< NodalUtilPrism > m_util

◆ Create()

std::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalPrismElec::Create ( const PointsKey key)
static

Definition at line 461 of file NodalPrismElec.cpp.

Referenced by NodalPrismElec().

462 {
463  std::shared_ptr<PointsBaseType> returnval(
465 
466  returnval->Initialize();
467 
468  return returnval;
469 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ GetI() [1/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalPrismElec::GetI ( const PointsKey pkey)
inlinevirtual

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

Definition at line 65 of file NodalPrismElec.h.

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

66  {
67  ASSERTL0(pkey.GetPointsDim() == 3,
68  "NodalPrismElec Points can only interp to "
69  "other 3d point distributions");
70  Array<OneD, const NekDouble> x, y, z;
71  PointsManager()[pkey]->GetPoints(x, y, z);
72  return GetI(x, y, z);
73  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
const MatrixSharedPtrType GetI(const PointsKey &pkey)
PointsManagerT & PointsManager(void)

◆ GetI() [2/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalPrismElec::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 75 of file NodalPrismElec.h.

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

78  {
79  size_t numpoints = x.num_elements();
80  unsigned int np = GetTotNumPoints();
81 
82  Array<OneD, NekDouble> interp(GetTotNumPoints() * numpoints);
83  CalculateInterpMatrix(x, y, z, interp);
84 
85  NekDouble *d = interp.data();
86  return MemoryManager<NekMatrix<NekDouble> >::AllocateSharedPtr(
87  numpoints, np, d);
88  }
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, const Array< OneD, const NekDouble > &zi, Array< OneD, NekDouble > &interp)
double NekDouble
unsigned int GetTotNumPoints() const
Definition: Points.h:277

◆ NodalPointReorder3d()

void Nektar::LibUtilities::NodalPrismElec::NodalPointReorder3d ( )
private

Definition at line 187 of file NodalPrismElec.cpp.

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

Referenced by CalculatePoints(), and NodalPrismElec().

188 {
189  unsigned int npts = GetNumPoints();
190  using std::vector;
191  vector<int> vertex;
192  vector<int> iEdge_01; // interior edge 0
193  vector<int> iEdge_12; // interior edge 1
194  vector<int> iEdge_23; // interior edge 2
195  vector<int> iEdge_30; // interior edge 3
196  vector<int> iEdge_04; // interior edge 4
197  vector<int> iEdge_14; // interior edge 5
198  vector<int> iEdge_25; // interior edge 6
199  vector<int> iEdge_35; // interior edge 7
200  vector<int> iEdge_45; // interior edge 8
201  vector<int> iFace_0123; // interior face 0
202  vector<int> iFace_014; // interior face 1
203  vector<int> iFace_1254; // interior face 2
204  vector<int> iFace_325; // interior face 3
205  vector<int> iFace_0354; // interior face 4
206  vector<int> interiorVolumePoints; // interior volume points
207  vector<int> map;
208 
209  // Build the lattice prism left to right - bottom to top
210  for (unsigned int y = 0, index = 0; y < npts; y++)
211  {
212  for (unsigned int t = 0; t < npts * (npts + 1) / 2; t++, index++)
213  {
214  if (isVertex(t, y, npts))
215  {
216  vertex.push_back(index);
217  }
218  else if (isEdge(t, y, npts))
219  {
220  if (isEdge_01(t, y, npts))
221  {
222  iEdge_01.push_back(index);
223  }
224  else if (isEdge_12(t, y, npts))
225  {
226  iEdge_12.push_back(index);
227  }
228  else if (isEdge_23(t, y, npts))
229  {
230  iEdge_23.push_back(index);
231  }
232  else if (isEdge_30(t, y, npts))
233  {
234  iEdge_30.push_back(index);
235  }
236  else if (isEdge_04(t, y, npts))
237  {
238  iEdge_04.push_back(index);
239  }
240  else if (isEdge_14(t, y, npts))
241  {
242  iEdge_14.push_back(index);
243  }
244  else if (isEdge_25(t, y, npts))
245  {
246  iEdge_25.push_back(index);
247  }
248  else if (isEdge_35(t, y, npts))
249  {
250  iEdge_35.push_back(index);
251  }
252  else if (isEdge_45(t, y, npts))
253  {
254  iEdge_45.push_back(index);
255  }
256  }
257  else if (isFace(t, y, npts))
258  {
259  if (isFace_0123(t, y, npts))
260  {
261  iFace_0123.push_back(index);
262  }
263  else if (isFace_014(t, y, npts))
264  {
265  iFace_014.push_back(index);
266  }
267  else if (isFace_1254(t, y, npts))
268  {
269  iFace_1254.push_back(index);
270  }
271  else if (isFace_325(t, y, npts))
272  {
273  iFace_325.push_back(index);
274  }
275  else if (isFace_0354(t, y, npts))
276  {
277  iFace_0354.push_back(index);
278  }
279  }
280  else
281  {
282  interiorVolumePoints.push_back(index);
283  }
284  }
285  }
286 
287  // sort vertices
288  std::swap(vertex[2], vertex[4]);
289  // sort edges
290  std::reverse(iEdge_23.begin(), iEdge_23.end());
291  std::reverse(iEdge_30.begin(), iEdge_30.end());
292  std::reverse(iEdge_04.begin(), iEdge_04.end());
293  std::reverse(iEdge_35.begin(), iEdge_35.end());
294 
295  // faces
296  for (unsigned int i = 0; i < npts - 2; i++)
297  {
298  for (unsigned int j = i + 1; j < npts - 2; j++)
299  {
300  std::swap(iFace_1254[i * (npts - 2) + j],
301  iFace_1254[j * (npts - 2) + i]);
302  }
303  }
304  for (int i = 0; i < npts - 2; i++)
305  {
306  std::reverse(iFace_0354.begin() + (i * (npts - 2)),
307  iFace_0354.begin() + (i * (npts - 2) + npts - 2));
308  }
309  for (unsigned int i = 0; i < npts - 2; i++)
310  {
311  for (unsigned int j = i + 1; j < npts - 2; j++)
312  {
313  std::swap(iFace_0354[i * (npts - 2) + j],
314  iFace_0354[j * (npts - 2) + i]);
315  }
316  }
317 
318  for (unsigned int n = 0; n < vertex.size(); ++n)
319  {
320  map.push_back(vertex[n]);
321  }
322 
323  for (unsigned int n = 0; n < iEdge_01.size(); ++n)
324  {
325  map.push_back(iEdge_01[n]);
326  }
327 
328  for (unsigned int n = 0; n < iEdge_12.size(); ++n)
329  {
330  map.push_back(iEdge_12[n]);
331  }
332 
333  for (unsigned int n = 0; n < iEdge_23.size(); ++n)
334  {
335  map.push_back(iEdge_23[n]);
336  }
337 
338  for (unsigned int n = 0; n < iEdge_30.size(); ++n)
339  {
340  map.push_back(iEdge_30[n]);
341  }
342 
343  for (unsigned int n = 0; n < iEdge_04.size(); ++n)
344  {
345  map.push_back(iEdge_04[n]);
346  }
347 
348  for (unsigned int n = 0; n < iEdge_14.size(); ++n)
349  {
350  map.push_back(iEdge_14[n]);
351  }
352 
353  for (unsigned int n = 0; n < iEdge_25.size(); ++n)
354  {
355  map.push_back(iEdge_25[n]);
356  }
357 
358  for (unsigned int n = 0; n < iEdge_35.size(); ++n)
359  {
360  map.push_back(iEdge_35[n]);
361  }
362 
363  for (unsigned int n = 0; n < iEdge_45.size(); ++n)
364  {
365  map.push_back(iEdge_45[n]);
366  }
367 
368  for (unsigned int n = 0; n < iFace_0123.size(); ++n)
369  {
370  map.push_back(iFace_0123[n]);
371  }
372 
373  for (unsigned int n = 0; n < iFace_014.size(); ++n)
374  {
375  map.push_back(iFace_014[n]);
376  }
377 
378  for (unsigned int n = 0; n < iFace_1254.size(); ++n)
379  {
380  map.push_back(iFace_1254[n]);
381  }
382 
383  for (unsigned int n = 0; n < iFace_325.size(); ++n)
384  {
385  map.push_back(iFace_325[n]);
386  }
387 
388  for (unsigned int n = 0; n < iFace_0354.size(); ++n)
389  {
390  map.push_back(iFace_0354[n]);
391  }
392 
393  for (unsigned int n = 0; n < interiorVolumePoints.size(); ++n)
394  {
395  map.push_back(interiorVolumePoints[n]);
396  }
397 
398  Array<OneD, NekDouble> points[3];
399  points[0] = Array<OneD, NekDouble>(GetTotNumPoints());
400  points[1] = Array<OneD, NekDouble>(GetTotNumPoints());
401  points[2] = Array<OneD, NekDouble>(GetTotNumPoints());
402 
403  for (unsigned int index = 0; index < map.size(); ++index)
404  {
405  points[0][index] = m_points[0][index];
406  points[1][index] = m_points[1][index];
407  points[2][index] = m_points[2][index];
408  }
409 
410  for (unsigned int index = 0; index < map.size(); ++index)
411  {
412  m_points[0][index] = points[0][map[index]];
413  m_points[1][index] = points[1][map[index]];
414  m_points[2][index] = points[2][map[index]];
415  }
416 }
unsigned int GetTotNumPoints() const
Definition: Points.h:277
Array< OneD, DataType > m_points[3]
Definition: Points.h:381
unsigned int GetNumPoints() const
Definition: Points.h:272

Member Data Documentation

◆ initPointsManager

bool Nektar::LibUtilities::NodalPrismElec::initPointsManager
staticprivate
Initial value:

Definition at line 91 of file NodalPrismElec.h.

◆ m_util

std::shared_ptr<NodalUtilPrism> Nektar::LibUtilities::NodalPrismElec::m_util
private