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

#include <NodalPrismElec.h>

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

 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

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 NodalPrismElec.h.

Constructor & Destructor Documentation

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

Definition at line 56 of file NodalPrismElec.h.

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

Definition at line 60 of file NodalPrismElec.h.

60  : PointsBaseType(key)
61  {
62  }
Points< NekDouble > PointsBaseType
Nektar::LibUtilities::NodalPrismElec::NodalPrismElec ( )
inlineprivate

Default constructor should not be called except by Create matrix.

Definition at line 96 of file NodalPrismElec.h.

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

Member Function Documentation

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

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

Definition at line 437 of file NodalPrismElec.cpp.

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

438 {
439  // Allocate the derivative matrix.
441 
442  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
443  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
444  m_derivmatrix[2] = m_util->GetDerivMatrix(2);
445 }
boost::shared_ptr< NodalUtilPrism > m_util
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:373
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 419 of file NodalPrismElec.cpp.

References m_util, and Vmath::Vcopy().

Referenced by GetI().

423 {
424  Array<OneD, Array<OneD, NekDouble> > xi(3);
425  xi[0] = xia;
426  xi[1] = yia;
427  xi[1] = zia;
428 
429  boost::shared_ptr<NekMatrix<NekDouble> > mat =
430  m_util->GetInterpolationMatrix(xi);
431  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
432  &interp[0], 1);
433 }
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::NodalPrismElec::CalculatePoints ( )
privatevirtual

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

Definition at line 143 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(), npts, and Nektar::LibUtilities::PointsManager().

144 {
145  // Allocate the storage for points
147 
148  // Populate m_points
149  unsigned int npts = GetNumPoints();
150 
151  LibUtilities::PointsKey pkey1(npts, LibUtilities::eNodalTriElec);
152  Array<OneD, NekDouble> u1, v1;
153  LibUtilities::PointsManager()[pkey1]->GetPoints(u1, v1);
154  LibUtilities::PointsKey pkey2(npts, LibUtilities::eGaussLobattoLegendre);
155  Array<OneD, NekDouble> u;
156  LibUtilities::PointsManager()[pkey2]->GetPoints(u);
157 
158  for (int y = 0, index = 0; y < npts; y++)
159  {
160  for (int t = 0; t < u1.num_elements(); t++, index++)
161  {
162  m_points[0][index] = u1[t];
163  m_points[1][index] = u[y];
164  m_points[2][index] = v1[t];
165  }
166  }
167 
170  npts - 1, m_points[0], m_points[1], m_points[2]);
171 }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< NodalUtilPrism > m_util
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
PointsManagerT & PointsManager(void)
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:52
2D Nodal Electrostatic Points on a Triangle
Definition: PointsType.h:70
void Nektar::LibUtilities::NodalPrismElec::CalculateWeights ( )
privatevirtual

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

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

405 {
406  // Allocate the storage for points
408 
409  typedef DataType T;
410 
411  // Solve the Vandermonde system of integrals for the weight vector
412  NekVector<T> w = m_util->GetWeights();
413 
414  m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
415 }
boost::shared_ptr< NodalUtilPrism > m_util
Array< OneD, DataType > m_weights
Definition: Points.h:372
boost::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalPrismElec::Create ( const PointsKey key)
static

Definition at line 447 of file NodalPrismElec.cpp.

448 {
449  boost::shared_ptr<PointsBaseType> returnval(
450  MemoryManager<NodalPrismElec>::AllocateSharedPtr(key));
451 
452  returnval->Initialize();
453 
454  return returnval;
455 }
const MatrixSharedPtrType Nektar::LibUtilities::NodalPrismElec::GetI ( const PointsKey pkey)
inlinevirtual

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

Definition at line 67 of file NodalPrismElec.h.

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

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

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

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

Definition at line 173 of file NodalPrismElec.cpp.

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

Referenced by CalculatePoints().

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