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::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
< PointsBaseType
Create (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

boost::shared_ptr
< NodalUtilTetrahedron
m_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 52 of file NodalTetEvenlySpaced.h.

Constructor & Destructor Documentation

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

Definition at line 56 of file NodalTetEvenlySpaced.h.

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

Definition at line 61 of file NodalTetEvenlySpaced.h.

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

Default constructor should not be called except by Create matrix.

Definition at line 99 of file NodalTetEvenlySpaced.h.

100  {
101  }
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 340 of file NodalTetEvenlySpaced.cpp.

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

341  {
342  // Allocate the derivative matrix.
344 
345  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
346  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
347  m_derivmatrix[2] = m_util->GetDerivMatrix(2);
348  }
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:373
boost::shared_ptr< NodalUtilTetrahedron > m_util
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 m_util, and Vmath::Vcopy().

Referenced by GetI().

326  {
327  Array<OneD, Array<OneD, NekDouble> > xi(3);
328  xi[0] = xia;
329  xi[1] = yia;
330  xi[2] = zia;
331 
332  boost::shared_ptr<NekMatrix<NekDouble> > mat =
333  m_util->GetInterpolationMatrix(xi);
334  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(),
335  1, &interp[0], 1);
336  }
boost::shared_ptr< NodalUtilTetrahedron > m_util
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1061
void Nektar::LibUtilities::NodalTetEvenlySpaced::CalculatePoints ( )
privatevirtual

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

Definition at line 111 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, 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 
135  npts - 1, m_points[0], m_points[1], m_points[2]);
136  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
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
boost::shared_ptr< NodalUtilTetrahedron > m_util
double NekDouble
void Nektar::LibUtilities::NodalTetEvenlySpaced::CalculateWeights ( )
privatevirtual

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

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

308  {
309  // Allocate storage for points
311 
312  typedef DataType T;
313 
314  // Solve the Vandermonde system of integrals for the weight vector
315  NekVector<T> w = m_util->GetWeights();
316  m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
317  }
boost::shared_ptr< NodalUtilTetrahedron > m_util
Array< OneD, DataType > m_weights
Definition: Points.h:372
boost::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalTetEvenlySpaced::Create ( const PointsKey key)
static

Definition at line 350 of file NodalTetEvenlySpaced.cpp.

351  {
352  boost::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalTetEvenlySpaced>::AllocateSharedPtr(key));
353 
354  returnval->Initialize();
355 
356  return returnval;
357  }
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:198
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 79 of file NodalTetEvenlySpaced.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::NodalTetEvenlySpaced::NodalPointReorder3d ( )
private

Definition at line 138 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().

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