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

#include <NodalPrismEvenlySpaced.h>

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

Public Member Functions

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

 NodalPrismEvenlySpaced ()
 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 52 of file NodalPrismEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalPrismEvenlySpaced()

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

Definition at line 55 of file NodalPrismEvenlySpaced.h.

56  {
57 
58  }

◆ NodalPrismEvenlySpaced() [1/2]

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

Definition at line 60 of file NodalPrismEvenlySpaced.h.

References Create(), and LIB_UTILITIES_EXPORT.

60  :PointsBaseType(key)
61  {
62 
63  }
Points< NekDouble > PointsBaseType

◆ NodalPrismEvenlySpaced() [2/2]

Nektar::LibUtilities::NodalPrismEvenlySpaced::NodalPrismEvenlySpaced ( )
inlineprivate

Default constructor should not be called except by Create matrix.

Definition at line 100 of file NodalPrismEvenlySpaced.h.

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

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

Member Function Documentation

◆ CalculateDerivMatrix()

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

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

Definition at line 422 of file NodalPrismEvenlySpaced.cpp.

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

Referenced by NodalPrismEvenlySpaced().

423  {
424  // Allocate the derivative matrix.
426 
427  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
428  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
429  m_derivmatrix[2] = m_util->GetDerivMatrix(2);
430  }
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:383

◆ CalculateInterpMatrix()

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

References m_util, and Vmath::Vcopy().

Referenced by GetI(), and NodalPrismEvenlySpaced().

408  {
409  Array<OneD, Array<OneD, NekDouble> > xi(3);
410  xi[0] = xia;
411  xi[1] = yia;
412  xi[2] = zia;
413 
414  std::shared_ptr<NekMatrix<NekDouble> > mat =
415  m_util->GetInterpolationMatrix(xi);
416  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(),
417  1, &interp[0], 1);
418  }
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1064

◆ CalculatePoints()

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

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

Definition at line 161 of file NodalPrismEvenlySpaced.cpp.

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

Referenced by NodalPrismEvenlySpaced().

162  {
163  // Allocate the storage for points
165 
166  // Populate m_points
167  unsigned int npts = GetNumPoints();
168  NekDouble delta = 2.0/(npts - 1.0);
169  for(unsigned int z=0, index=0; z<npts; ++z){
170  for(unsigned int y=0; y<npts; ++y){
171  for(unsigned int x=0; x<npts-z; ++x, ++index){
172  NekDouble xi = -1.0 + x*delta;
173  NekDouble yi = -1.0 + y*delta;
174  NekDouble zi = -1.0 + z*delta;
175 
176  m_points[0][index] = xi;
177  m_points[1][index] = yi;
178  m_points[2][index] = zi;
179  }
180  }
181  }
182 
185  npts - 1, m_points[0], m_points[1], m_points[2]);
186  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
double NekDouble
Array< OneD, DataType > m_points[3]
Definition: Points.h:381
unsigned int GetNumPoints() const
Definition: Points.h:272

◆ CalculateWeights()

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

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

Definition at line 388 of file NodalPrismEvenlySpaced.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 NodalPrismEvenlySpaced().

389  {
390  // Allocate the storage for points
392 
393  typedef DataType T;
394 
395  // Solve the Vandermonde system of integrals for the weight vector
396  NekVector<T> w = m_util->GetWeights();
397 
398  m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
399  }
Array< OneD, DataType > m_weights
Definition: Points.h:382

◆ Create()

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

Definition at line 432 of file NodalPrismEvenlySpaced.cpp.

Referenced by NodalPrismEvenlySpaced().

433  {
434  std::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalPrismEvenlySpaced>::AllocateSharedPtr(key));
435 
436  returnval->Initialize();
437 
438  return returnval;
439  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ GetI() [1/2]

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

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

Definition at line 68 of file NodalPrismEvenlySpaced.h.

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

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

◆ GetI() [2/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalPrismEvenlySpaced::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 NodalPrismEvenlySpaced.h.

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

82  {
83  size_t numpoints = x.num_elements();
84  unsigned int np = GetTotNumPoints();
85 
86  Array<OneD, NekDouble> interp(GetTotNumPoints()*numpoints);
87  CalculateInterpMatrix(x, y, z, interp);
88 
89  NekDouble* d = interp.data();
90  return MemoryManager<NekMatrix<NekDouble> >
91  ::AllocateSharedPtr(numpoints, np, d);
92  }
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::NodalPrismEvenlySpaced::NodalPointReorder3d ( )
private

Definition at line 188 of file NodalPrismEvenlySpaced.cpp.

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

Referenced by CalculatePoints(), and NodalPrismEvenlySpaced().

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

Definition at line 95 of file NodalPrismEvenlySpaced.h.

◆ m_util

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