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

#include <NodalTriEvenlySpaced.h>

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

Public Member Functions

virtual ~NodalTriEvenlySpaced ()
 
 NodalTriEvenlySpaced (const PointsKey &key)
 
const MatrixSharedPtrType GetI (const PointsKey &pkey)
 
const MatrixSharedPtrType GetI (const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y)
 
- 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
 
const Array< OneD, const NekDouble > & GetBaryWeights () 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, const Array< OneD, const DataType > &z)
 
virtual const MatrixSharedPtrType GetGalerkinProjection (const PointsKey &pkey)
 

Static Public Member Functions

static std::shared_ptr< PointsBaseTypeCreate (const PointsKey &key)
 

Private Member Functions

 NodalTriEvenlySpaced ()
 Deafult constructor should not be called except by Create matrix. More...
 
void CalculatePoints ()
 
void CalculateWeights ()
 
void CalculateDerivMatrix ()
 
void NodalPointReorder2d ()
 
void CalculateInterpMatrix (const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, Array< OneD, NekDouble > &interp)
 

Private Attributes

std::shared_ptr< NodalUtilTrianglem_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 >
virtual void CalculateBaryWeights ()
 This function calculates the barycentric weights used for enhanced interpolation speed. More...
 
 Points (const PointsKey &key)
 
- Protected Attributes inherited from Nektar::LibUtilities::Points< NekDouble >
PointsKey m_pointsKey
 Points type for this points distributions. More...
 
Array< OneD, DataTypem_points [3]
 Storage for the point locations, allowing for up to a 3D points storage. More...
 
Array< OneD, DataTypem_weights
 Quadrature weights for the weights. More...
 
Array< OneD, DataTypem_bcweights
 Barycentric weights. More...
 
MatrixSharedPtrType m_derivmatrix [3]
 Derivative matrices. More...
 
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLessm_InterpManager
 
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLessm_GalerkinProjectionManager
 

Detailed Description

Definition at line 51 of file NodalTriEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalTriEvenlySpaced()

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

Definition at line 54 of file NodalTriEvenlySpaced.h.

55  {
56  }

◆ NodalTriEvenlySpaced() [1/2]

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

Definition at line 58 of file NodalTriEvenlySpaced.h.

58  : PointsBaseType(key)
59  {
60  }
Points< NekDouble > PointsBaseType

◆ NodalTriEvenlySpaced() [2/2]

Nektar::LibUtilities::NodalTriEvenlySpaced::NodalTriEvenlySpaced ( )
inlineprivate

Deafult constructor should not be called except by Create matrix.

Definition at line 95 of file NodalTriEvenlySpaced.h.

96  {
97  }
static const PointsKey NullPointsKey(0, eNoPointsType)

Member Function Documentation

◆ CalculateDerivMatrix()

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

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

Definition at line 136 of file NodalTriEvenlySpaced.cpp.

137 {
138 
139  // Allocate the derivative matrix.
141 
142  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
143  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
144 }
std::shared_ptr< NodalUtilTriangle > m_util
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition: Points.h:409

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

◆ CalculateInterpMatrix()

void Nektar::LibUtilities::NodalTriEvenlySpaced::CalculateInterpMatrix ( const Array< OneD, const NekDouble > &  xi,
const Array< OneD, const NekDouble > &  yi,
Array< OneD, NekDouble > &  interp 
)
private

Definition at line 120 of file NodalTriEvenlySpaced.cpp.

123 {
124  Array<OneD, Array<OneD, NekDouble>> xi(2);
125  xi[0] = xia;
126  xi[1] = yia;
127 
128  std::shared_ptr<NekMatrix<NekDouble>> mat =
129  m_util->GetInterpolationMatrix(xi);
130  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
131  &interp[0], 1);
132 }
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255

References m_util, and Vmath::Vcopy().

Referenced by GetI().

◆ CalculatePoints()

void Nektar::LibUtilities::NodalTriEvenlySpaced::CalculatePoints ( )
privatevirtual

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

Definition at line 80 of file NodalTriEvenlySpaced.cpp.

81 {
82  // Allocate the storage for points
84 
85  // Populate m_points
86  unsigned int npts = GetNumPoints();
87  NekDouble delta = 2.0 / (npts - 1.0);
88  for (int i = 0, index = 0; i < npts; ++i)
89  { // y-direction
90  for (int j = 0; j < npts - i; ++j, ++index)
91  { // x-direction
92  NekDouble x = -1.0 + j * delta;
93  NekDouble y = -1.0 + i * delta;
94  m_points[0][index] = x;
95  m_points[1][index] = y;
96  }
97  }
98 
100 
102  npts - 1, m_points[0], m_points[1]);
103 }
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:403
unsigned int GetNumPoints() const
Definition: Points.h:276
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
double NekDouble

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::Points< NekDouble >::CalculatePoints(), Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, m_util, and NodalPointReorder2d().

◆ CalculateWeights()

void Nektar::LibUtilities::NodalTriEvenlySpaced::CalculateWeights ( )
privatevirtual

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

Definition at line 105 of file NodalTriEvenlySpaced.cpp.

106 {
107  // Allocate the storage for points
109 
110  typedef DataType T;
111 
112  // Solve the Vandermonde system of integrals for the weight vector
113  NekVector<T> w = m_util->GetWeights();
114 
115  m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
116 }
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:405

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

◆ Create()

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

Definition at line 146 of file NodalTriEvenlySpaced.cpp.

148 {
149  std::shared_ptr<PointsBaseType> returnval(
151 
152  returnval->Initialize();
153 
154  return returnval;
155 }

◆ GetI() [1/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalTriEvenlySpaced::GetI ( const Array< OneD, const NekDouble > &  x,
const Array< OneD, const NekDouble > &  y 
)
inlinevirtual

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

Definition at line 75 of file NodalTriEvenlySpaced.h.

77  {
78  size_t numpoints = x.size();
79  unsigned int np = GetTotNumPoints();
80 
81  Array<OneD, NekDouble> interp(GetTotNumPoints() * numpoints);
82  CalculateInterpMatrix(x, y, interp);
83 
84  NekDouble *d = interp.data();
85  return MemoryManager<NekMatrix<NekDouble>>::AllocateSharedPtr(numpoints,
86  np, d);
87  }
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, Array< OneD, NekDouble > &interp)
unsigned int GetTotNumPoints() const
Definition: Points.h:281

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

◆ GetI() [2/2]

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

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

Definition at line 65 of file NodalTriEvenlySpaced.h.

66  {
67  ASSERTL0(pkey.GetPointsDim() == 2,
68  "NodalTriEvenlySpaced Points can only interp to other "
69  "2d point distributions");
70  Array<OneD, const NekDouble> x, y;
71  PointsManager()[pkey]->GetPoints(x, y);
72  return GetI(x, y);
73  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
const MatrixSharedPtrType GetI(const PointsKey &pkey)
PointsManagerT & PointsManager(void)

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

◆ NodalPointReorder2d()

void Nektar::LibUtilities::NodalTriEvenlySpaced::NodalPointReorder2d ( )
private

Definition at line 157 of file NodalTriEvenlySpaced.cpp.

158 {
159  unsigned int npts = GetNumPoints();
160  using std::vector;
161  vector<int> vertex;
162  vector<int> iEdge_1; // interior edge points on the bottom triangle edge
163  vector<int> iEdge_2; // interior edge points on the right triangle edge
164  vector<int> iEdge_3; // interior edge points on the left triangle edge
165  vector<int> interiorPoints;
166  vector<int> map;
167 
168  // Build the lattice triangle left to right - bottom to top
169  for (int i = 0, index = 0; i < npts; ++i)
170  { // y-direction
171  for (int j = 0; j < npts - i; ++j, ++index)
172  { // x-direction
173 
174  if (isVertex(i, j, npts))
175  {
176 
177  vertex.push_back(index);
178  }
179  else if (isEdge(i, j, npts))
180  { // interior edge
181 
182  if (isEdge_1(i, j, npts))
183  { // bottom edge
184 
185  iEdge_1.push_back(index);
186  }
187  else if (isEdge_2(i, j, npts))
188  { // right edge
189 
190  iEdge_2.push_back(index);
191  }
192  else // left edge
193  {
194  // Add backwards. This is because of counter clockwise.
195  iEdge_3.insert(iEdge_3.begin(), index);
196  }
197  }
198  else
199  { // Interior points
200 
201  interiorPoints.push_back(index);
202  }
203  }
204  }
205 
206  // Mapping the vertex, edges, and interior points using the permutation
207  // matrix, so the points are ordered anticlockwise.
208  for (unsigned int k = 0; k < vertex.size(); ++k)
209  {
210 
211  map.push_back(vertex[k]);
212  }
213 
214  for (unsigned int k = 0; k < iEdge_1.size(); ++k)
215  {
216 
217  map.push_back(iEdge_1[k]);
218  }
219 
220  for (unsigned int k = 0; k < iEdge_2.size(); ++k)
221  {
222 
223  map.push_back(iEdge_2[k]);
224  }
225 
226  for (unsigned int k = 0; k < iEdge_3.size(); ++k)
227  {
228 
229  map.push_back(iEdge_3[k]);
230  }
231 
232  for (unsigned int k = 0; k < interiorPoints.size(); ++k)
233  {
234 
235  map.push_back(interiorPoints[k]);
236  }
237 
238  Array<OneD, NekDouble> points[2];
239  points[0] = Array<OneD, NekDouble>(GetTotNumPoints());
240  points[1] = Array<OneD, NekDouble>(GetTotNumPoints());
241  for (unsigned int index = 0; index < map.size(); ++index)
242  {
243  points[0][index] = m_points[0][index];
244  points[1][index] = m_points[1][index];
245  }
246 
247  for (unsigned int index = 0; index < map.size(); ++index)
248  {
249  m_points[0][index] = points[0][map[index]];
250  m_points[1][index] = points[1][map[index]];
251  }
252 }

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

Referenced by CalculatePoints().

Member Data Documentation

◆ initPointsManager

bool Nektar::LibUtilities::NodalTriEvenlySpaced::initPointsManager
staticprivate
Initial value:
= {
bool RegisterCreator(const KeyType &key, const CreateFuncType &createFunc)
Register the given function and associate it with the key. The return value is just to facilitate cal...
Definition: NekManager.hpp:170
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
@ eNodalTriEvenlySpaced
2D Evenly-spaced points on a Triangle
Definition: PointsType.h:85

Definition at line 90 of file NodalTriEvenlySpaced.h.

◆ m_util

std::shared_ptr<NodalUtilTriangle> Nektar::LibUtilities::NodalTriEvenlySpaced::m_util
private