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

#include <NodalTetEvenlySpaced.h>

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

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::opLessm_InterpManager
 
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLessm_GalerkinProjectionManager
 

Detailed Description

Definition at line 51 of file NodalTetEvenlySpaced.h.

Constructor & Destructor Documentation

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

Definition at line 55 of file NodalTetEvenlySpaced.h.

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

Definition at line 60 of file NodalTetEvenlySpaced.h.

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

Default constructor should not be called except by Create matrix.

Definition at line 96 of file NodalTetEvenlySpaced.h.

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

Member Function Documentation

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

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

Definition at line 346 of file NodalTetEvenlySpaced.cpp.

References Nektar::LibUtilities::Points< NekDouble >::CalculateDerivMatrix(), Nektar::LibUtilities::GetTetXDerivativeMatrix(), Nektar::LibUtilities::GetTetYDerivativeMatrix(), Nektar::LibUtilities::GetTetZDerivativeMatrix(), Nektar::LibUtilities::Points< NekDouble >::m_derivmatrix, and Nektar::LibUtilities::Points< NekDouble >::m_points.

347  {
348 
349  // Allocate the derivative matrix.
351 
352  NekVector<NekDouble> x( m_points[0] );
353  NekVector<NekDouble> y( m_points[1] );
354  NekVector<NekDouble> z( m_points[2] );
355  NekVector<NekDouble> xi = x;
356  NekVector<NekDouble> yi = y;
357  NekVector<NekDouble> zi = z;
358 
359  *m_derivmatrix[0] = *GetTetXDerivativeMatrix(x,y,z,xi,yi,zi);
360 
361  *m_derivmatrix[1] = *GetTetYDerivativeMatrix(x,y,z,xi,yi,zi);
362 
363  *m_derivmatrix[2] = *GetTetZDerivativeMatrix(x,y,z,xi,yi,zi);
364 
365  }
Points< NekDouble >::MatrixSharedPtrType GetTetZDerivativeMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi, const NekVector< NekDouble > &zi)
Definition: NodalUtil.cpp:1195
Points< NekDouble >::MatrixSharedPtrType GetTetXDerivativeMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi, const NekVector< NekDouble > &zi)
Definition: NodalUtil.cpp:806
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:351
Points< NekDouble >::MatrixSharedPtrType GetTetYDerivativeMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi, const NekVector< NekDouble > &zi)
Definition: NodalUtil.cpp:1047
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 322 of file NodalTetEvenlySpaced.cpp.

References Nektar::NekVector< DataType >::GetRows(), Nektar::LibUtilities::GetTetInterpolationMatrix(), Nektar::LibUtilities::Points< NekDouble >::GetTotNumPoints(), and Nektar::LibUtilities::Points< NekDouble >::m_points.

Referenced by GetI().

326  {
327  NekVector<NekDouble> x( m_points[0] );
328  NekVector<NekDouble> y( m_points[1] );
329  NekVector<NekDouble> z( m_points[2] );
330  NekVector<NekDouble> xi( xia );
331  NekVector<NekDouble> yi( yia );
332  NekVector<NekDouble> zi( zia );
333  NekMatrix<NekDouble> interMat = GetTetInterpolationMatrix(x, y, z, xi, yi, zi);
334 
335  int rows = xi.GetRows(), cols = GetTotNumPoints();
336  for( int i = 0; i < rows; ++i ) {
337  for( int j = 0; j < cols; ++j ) {
338  interp[j + i*cols] = interMat(i,j);
339  }
340  }
341 
342  }
unsigned int GetTotNumPoints() const
Definition: Points.h:251
NekMatrix< NekDouble > GetTetInterpolationMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi, const NekVector< NekDouble > &zi)
Definition: NodalUtil.cpp:594
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
void Nektar::LibUtilities::NodalTetEvenlySpaced::CalculatePoints ( )
privatevirtual

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

Definition at line 111 of file NodalTetEvenlySpaced.cpp.

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

112  {
113  // Allocate the storage for points
115 
116  // Populate m_points
117  unsigned int npts = GetNumPoints();
118  NekDouble delta = 2.0/(npts - 1.0);
119  for(unsigned int z=0, index=0; z<npts; ++z){
120  for(int y=0; y<npts-z; ++y){
121  for(int x=0; x<npts-z-y; ++x, ++index){
122  NekDouble xi = -1.0 + x*delta;
123  NekDouble yi = -1.0 + y*delta;
124  NekDouble zi = -1.0 + z*delta;
125 
126  m_points[0][index] = xi;
127  m_points[1][index] = yi;
128  m_points[2][index] = zi;
129  }
130  }
131  }
132 
134  }
static std::string npts
Definition: InputFld.cpp:43
double NekDouble
unsigned int GetNumPoints() const
Definition: Points.h:246
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
void Nektar::LibUtilities::NodalTetEvenlySpaced::CalculateWeights ( )
privatevirtual

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

Definition at line 305 of file NodalTetEvenlySpaced.cpp.

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

306  {
307  // Allocate storage for points
309 
310  typedef DataType T;
311 
312  // Solve the Vandermonde system of integrals for the weight vector
313  NekVector<T> w = MakeTetWeights(NekVector<T>(m_points[0]), NekVector<T>(m_points[1]), NekVector<T>(m_points[2]));
314 
315  m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
316 
317  }
Array< OneD, DataType > m_weights
Definition: Points.h:350
NekVector< NekDouble > MakeTetWeights(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &z)
Definition: NodalUtil.cpp:562
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
boost::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalTetEvenlySpaced::Create ( const PointsKey key)
static

Definition at line 367 of file NodalTetEvenlySpaced.cpp.

368  {
369  boost::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalTetEvenlySpaced>::AllocateSharedPtr(key));
370 
371  returnval->Initialize();
372 
373  return returnval;
374  }
const MatrixSharedPtrType Nektar::LibUtilities::NodalTetEvenlySpaced::GetI ( const PointsKey pkey)
inlinevirtual

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

Definition at line 68 of file NodalTetEvenlySpaced.h.

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

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

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

82  {
83  int 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  }
unsigned int GetTotNumPoints() const
Definition: Points.h:251
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
void Nektar::LibUtilities::NodalTetEvenlySpaced::NodalPointReorder3d ( )
private

Definition at line 136 of file NodalTetEvenlySpaced.cpp.

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

Referenced by CalculatePoints().

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