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

#include <NodalTetEvenlySpaced.h>

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

Public Member Functions

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

 NodalTetEvenlySpaced ()
 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< NodalUtilTetrahedronm_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 NodalTetEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalTetEvenlySpaced()

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

Definition at line 56 of file NodalTetEvenlySpaced.h.

57  {
58 
59  }

◆ NodalTetEvenlySpaced() [1/2]

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

Definition at line 61 of file NodalTetEvenlySpaced.h.

References Create(), and LIB_UTILITIES_EXPORT.

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

◆ NodalTetEvenlySpaced() [2/2]

Nektar::LibUtilities::NodalTetEvenlySpaced::NodalTetEvenlySpaced ( )
inlineprivate

Default constructor should not be called except by Create matrix.

Definition at line 101 of file NodalTetEvenlySpaced.h.

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

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

Member Function Documentation

◆ CalculateDerivMatrix()

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

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

Definition at line 350 of file NodalTetEvenlySpaced.cpp.

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

Referenced by NodalTetEvenlySpaced().

351  {
352  // Allocate the derivative matrix.
354 
355  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
356  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
357  m_derivmatrix[2] = m_util->GetDerivMatrix(2);
358  }
std::shared_ptr< NodalUtilTetrahedron > m_util
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:383

◆ CalculateInterpMatrix()

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

References m_util, and Vmath::Vcopy().

Referenced by GetI(), and NodalTetEvenlySpaced().

336  {
337  Array<OneD, Array<OneD, NekDouble> > xi(3);
338  xi[0] = xia;
339  xi[1] = yia;
340  xi[2] = zia;
341 
342  std::shared_ptr<NekMatrix<NekDouble> > mat =
343  m_util->GetInterpolationMatrix(xi);
344  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(),
345  1, &interp[0], 1);
346  }
std::shared_ptr< NodalUtilTetrahedron > 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::NodalTetEvenlySpaced::CalculatePoints ( )
privatevirtual

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

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

122  {
123  // Allocate the storage for points
125 
126  // Populate m_points
127  unsigned int npts = GetNumPoints();
128  NekDouble delta = 2.0/(npts - 1.0);
129  for(unsigned int z=0, index=0; z<npts; ++z){
130  for(unsigned int y=0; y<npts-z; ++y){
131  for(unsigned int x=0; x<npts-z-y; ++x, ++index){
132  NekDouble xi = -1.0 + x*delta;
133  NekDouble yi = -1.0 + y*delta;
134  NekDouble zi = -1.0 + z*delta;
135 
136  m_points[0][index] = xi;
137  m_points[1][index] = yi;
138  m_points[2][index] = zi;
139  }
140  }
141  }
142 
145  npts - 1, m_points[0], m_points[1], m_points[2]);
146  }
std::shared_ptr< NodalUtilTetrahedron > m_util
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::NodalTetEvenlySpaced::CalculateWeights ( )
privatevirtual

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

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

318  {
319  // Allocate storage for points
321 
322  typedef DataType T;
323 
324  // Solve the Vandermonde system of integrals for the weight vector
325  NekVector<T> w = m_util->GetWeights();
326  m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
327  }
Array< OneD, DataType > m_weights
Definition: Points.h:382
std::shared_ptr< NodalUtilTetrahedron > m_util

◆ Create()

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

Definition at line 360 of file NodalTetEvenlySpaced.cpp.

Referenced by NodalTetEvenlySpaced().

361  {
362  std::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalTetEvenlySpaced>::AllocateSharedPtr(key));
363 
364  returnval->Initialize();
365 
366  return returnval;
367  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ GetI() [1/2]

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

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

Definition at line 69 of file NodalTetEvenlySpaced.h.

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

70  {
71  ASSERTL0(pkey.GetPointsDim() == 3,
72  "NodalTetEvenlySpaced Points can only interp to other "
73  "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:216
const MatrixSharedPtrType GetI(const PointsKey &pkey)
PointsManagerT & PointsManager(void)

◆ GetI() [2/2]

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

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

83  {
84  size_t 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:277

◆ NodalPointReorder3d()

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

Definition at line 148 of file NodalTetEvenlySpaced.cpp.

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

Referenced by CalculatePoints(), and NodalTetEvenlySpaced().

149  {
150  unsigned int npts = GetNumPoints();
151  using std::vector;
152  vector<int> vertex;
153  vector<int> iEdge_01; // interior edge 0
154  vector<int> iEdge_12; // interior edge 1
155  vector<int> iEdge_20; // interior edge 2
156  vector<int> iEdge_03; // interior edge 3
157  vector<int> iEdge_13; // interior edge 4
158  vector<int> iEdge_23; // interior edge 5
159  vector<int> iFace_012; // interior face 0
160  vector<int> iFace_013; // interior face 1
161  vector<int> iFace_123; // interior face 2
162  vector<int> iFace_203; // interior face 3
163  vector<int> interiorVolumePoints; // interior volume points
164  vector<int> map;
165 
166  // Build the lattice tetrahedron left to right - bottom to top
167  for(int z=0, index=0; z<npts; ++z){
168  for(int y=0; y<npts-z; ++y){
169  for(int x=0; x<npts-z-y; ++x, ++index){
170 
171  if( isVertex(x,y,z,npts) ){ // vertex
172 
173  vertex.push_back(index);
174 
175  } else if( isEdge(x,y,z,npts) ){ // interior edge
176 
177  if( isEdge_01(x,y,z,npts) ){ // interior edge 0
178 
179  iEdge_01.push_back(index);
180 
181  } else if( isEdge_12(x,y,z,npts) ){ // interior edge 1
182 
183  iEdge_12.push_back(index);
184 
185  } else if( isEdge_20(x,y,z,npts) ){ // interior edge 2
186 
187  iEdge_20.insert(iEdge_20.begin(), index);
188 
189  } else if( isEdge_03(x,y,z,npts) ){ // interior edge 3
190 
191  iEdge_03.push_back(index);
192 
193  } else if( isEdge_13(x,y,z,npts) ){ // interior edge 4
194 
195  iEdge_13.push_back(index);
196 
197  } else if( isEdge_23(x,y,z,npts) ){ // interior edge 5
198 
199  iEdge_23.push_back(index);
200 
201  }
202 
203  } else if( isFace(x,y,z,npts) ) { // interior face
204 
205  if( isFace_012(x,y,z,npts) ){ // interior face 0
206 
207  iFace_012.push_back(index);
208 
209  } else if( isFace_013(x,y,z,npts) ){ // interior face 1
210 
211  iFace_013.push_back(index);
212 
213  } else if( isFace_123(x,y,z,npts) ){ // interior face 2
214 
215  iFace_123.push_back(index);
216 
217  } else if( isFace_203(x,y,z,npts) ){ // interior face 3
218 
219  iFace_203.push_back(index);
220 
221  }
222  } else { // interior volume points
223 
224  interiorVolumePoints.push_back(index);
225  }
226  }
227  }
228  }
229 
230  // Mapping the vertex, edges, faces, interior volume points using the permutation matrix,
231  // so the points are ordered anticlockwise.
232  for(unsigned int n=0; n<vertex.size(); ++n){
233 
234  map.push_back(vertex[n]);
235  }
236 
237  for(unsigned int n=0; n<iEdge_01.size(); ++n){
238 
239  map.push_back(iEdge_01[n]);
240  }
241 
242  for(unsigned int n=0; n<iEdge_12.size(); ++n){
243 
244  map.push_back(iEdge_12[n]);
245  }
246 
247  for(unsigned int n=0; n<iEdge_20.size(); ++n){
248 
249  map.push_back(iEdge_20[n]);
250  }
251 
252  for(unsigned int n=0; n<iEdge_03.size(); ++n){
253 
254  map.push_back(iEdge_03[n]);
255  }
256 
257  for(unsigned int n=0; n<iEdge_13.size(); ++n){
258 
259  map.push_back(iEdge_13[n]);
260  }
261 
262  for(unsigned int n=0; n<iEdge_23.size(); ++n){
263 
264  map.push_back(iEdge_23[n]);
265  }
266 
267  for(unsigned int n=0; n<iFace_012.size(); ++n){
268 
269  map.push_back(iFace_012[n]);
270  }
271 
272  for(unsigned int n=0; n<iFace_013.size(); ++n){
273 
274  map.push_back(iFace_013[n]);
275  }
276 
277  for(unsigned int n=0; n<iFace_123.size(); ++n){
278 
279  map.push_back(iFace_123[n]);
280  }
281 
282  for(unsigned int n=0; n<iFace_203.size(); ++n){
283 
284  map.push_back(iFace_203[n]);
285  }
286 
287  for(unsigned int n=0; n<interiorVolumePoints.size(); ++n){
288 
289  map.push_back(interiorVolumePoints[n]);
290  }
291 
292 
293  Array<OneD, NekDouble> points[3];
294  points[0] = Array<OneD, NekDouble>(GetTotNumPoints());
295  points[1] = Array<OneD, NekDouble>(GetTotNumPoints());
296  points[2] = Array<OneD, NekDouble>(GetTotNumPoints());
297  for(unsigned int index=0; index<map.size(); ++index){
298 
299  points[0][index] = m_points[0][index];
300  points[1][index] = m_points[1][index];
301  points[2][index] = m_points[2][index];
302 
303  }
304 
305  for(unsigned int index=0; index<map.size(); ++index){
306 
307  m_points[0][index] = points[0][map[index]];
308  m_points[1][index] = points[1][map[index]];
309  m_points[2][index] = points[2][map[index]];
310 
311  }
312 
313  }
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::NodalTetEvenlySpaced::initPointsManager
staticprivate
Initial value:

Definition at line 96 of file NodalTetEvenlySpaced.h.

◆ m_util

std::shared_ptr<NodalUtilTetrahedron> Nektar::LibUtilities::NodalTetEvenlySpaced::m_util
private