Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Nektar::LibUtilities::NodalPrismEvenlySpaced Class Reference

#include <NodalPrismEvenlySpaced.h>

Inheritance diagram for Nektar::LibUtilities::NodalPrismEvenlySpaced:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LibUtilities::NodalPrismEvenlySpaced:
Collaboration graph
[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 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

 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

boost::shared_ptr< NodalUtilPrismm_util
 

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::opLess
m_InterpManager
 
NekManager< PointsKey,
NekMatrix< DataType >
, PointsKey::opLess
m_GalerkinProjectionManager
 

Detailed Description

Definition at line 53 of file NodalPrismEvenlySpaced.h.

Constructor & Destructor Documentation

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

Definition at line 56 of file NodalPrismEvenlySpaced.h.

57  {
58 
59  }
Nektar::LibUtilities::NodalPrismEvenlySpaced::NodalPrismEvenlySpaced ( const PointsKey key)
inline

Definition at line 61 of file NodalPrismEvenlySpaced.h.

61  :PointsBaseType(key)
62  {
63 
64  }
Points< NekDouble > PointsBaseType
Nektar::LibUtilities::NodalPrismEvenlySpaced::NodalPrismEvenlySpaced ( )
inlineprivate

Default constructor should not be called except by Create matrix.

Definition at line 99 of file NodalPrismEvenlySpaced.h.

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

Member Function Documentation

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

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

Definition at line 406 of file NodalPrismEvenlySpaced.cpp.

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

407  {
408  // Allocate the derivative matrix.
410 
411  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
412  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
413  m_derivmatrix[2] = m_util->GetDerivMatrix(2);
414  }
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:373
boost::shared_ptr< NodalUtilPrism > m_util
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 388 of file NodalPrismEvenlySpaced.cpp.

References m_util, and Vmath::Vcopy().

Referenced by GetI().

392  {
393  Array<OneD, Array<OneD, NekDouble> > xi(3);
394  xi[0] = xia;
395  xi[1] = yia;
396  xi[2] = zia;
397 
398  boost::shared_ptr<NekMatrix<NekDouble> > mat =
399  m_util->GetInterpolationMatrix(xi);
400  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(),
401  1, &interp[0], 1);
402  }
boost::shared_ptr< NodalUtilPrism > m_util
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
void Nektar::LibUtilities::NodalPrismEvenlySpaced::CalculatePoints ( )
privatevirtual

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

Definition at line 145 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, NodalPointReorder3d(), and npts.

146  {
147  // Allocate the storage for points
149 
150  // Populate m_points
151  unsigned int npts = GetNumPoints();
152  NekDouble delta = 2.0/(npts - 1.0);
153  for(unsigned int z=0, index=0; z<npts; ++z){
154  for(int y=0; y<npts; ++y){
155  for(int x=0; x<npts-z; ++x, ++index){
156  NekDouble xi = -1.0 + x*delta;
157  NekDouble yi = -1.0 + y*delta;
158  NekDouble zi = -1.0 + z*delta;
159 
160  m_points[0][index] = xi;
161  m_points[1][index] = yi;
162  m_points[2][index] = zi;
163  }
164  }
165  }
166 
169  npts - 1, m_points[0], m_points[1], m_points[2]);
170  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
Array< OneD, DataType > m_points[3]
Definition: Points.h:371
boost::shared_ptr< NodalUtilPrism > m_util
unsigned int GetNumPoints() const
Definition: Points.h:268
static std::string npts
Definition: InputFld.cpp:43
double NekDouble
void Nektar::LibUtilities::NodalPrismEvenlySpaced::CalculateWeights ( )
privatevirtual

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

Definition at line 372 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.

373  {
374  // Allocate the storage for points
376 
377  typedef DataType T;
378 
379  // Solve the Vandermonde system of integrals for the weight vector
380  NekVector<T> w = m_util->GetWeights();
381 
382  m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
383  }
boost::shared_ptr< NodalUtilPrism > m_util
Array< OneD, DataType > m_weights
Definition: Points.h:372
boost::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalPrismEvenlySpaced::Create ( const PointsKey key)
static

Definition at line 416 of file NodalPrismEvenlySpaced.cpp.

417  {
418  boost::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalPrismEvenlySpaced>::AllocateSharedPtr(key));
419 
420  returnval->Initialize();
421 
422  return returnval;
423  }
const MatrixSharedPtrType Nektar::LibUtilities::NodalPrismEvenlySpaced::GetI ( const PointsKey pkey)
inlinevirtual

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

Definition at line 69 of file NodalPrismEvenlySpaced.h.

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

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

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

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

Definition at line 172 of file NodalPrismEvenlySpaced.cpp.

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

Referenced by CalculatePoints().

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

Member Data Documentation

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