Nektar++
Public Member Functions | Static Public Member Functions | Protected 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)
 
- Public Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual ~Points ()
 
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
 
const MatrixSharedPtrType GetI (const PointsKey &key)
 
const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x)
 
const MatrixSharedPtrType GetI (unsigned int uint, const Array< OneD, const DataType > &x)
 
const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x, const Array< OneD, const DataType > &y)
 
const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x, const Array< OneD, const DataType > &y, const Array< OneD, const DataType > &z)
 
const MatrixSharedPtrType GetGalerkinProjection (const PointsKey &pkey)
 

Static Public Member Functions

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

Protected Member Functions

virtual const MatrixSharedPtrType v_GetI (const PointsKey &pkey) override
 
virtual const MatrixSharedPtrType v_GetI (const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y) override
 
- Protected Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual void v_Initialize (void)
 
virtual void v_CalculateBaryWeights ()
 This function calculates the barycentric weights used for enhanced interpolation speed. More...
 
 Points (const PointsKey &key)
 
virtual const MatrixSharedPtrType v_GetI (const Array< OneD, const DataType > &x)
 
virtual const MatrixSharedPtrType v_GetI (unsigned int, const Array< OneD, const DataType > &x)
 
virtual const MatrixSharedPtrType v_GetI (const Array< OneD, const DataType > &x, const Array< OneD, const DataType > &y, const Array< OneD, const DataType > &z)
 
virtual const MatrixSharedPtrType v_GetGalerkinProjection (const PointsKey &pkey)
 

Private Member Functions

 NodalTriEvenlySpaced ()
 Deafult constructor should not be called except by Create matrix. More...
 
void NodalPointReorder2d ()
 
virtual void v_CalculatePoints () override
 
virtual void v_CalculateWeights () override
 
virtual void v_CalculateDerivMatrix () override
 
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 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 97 of file NodalTriEvenlySpaced.h.

98  {
99  }
static const PointsKey NullPointsKey(0, eNoPointsType)

Member Function Documentation

◆ 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 }
std::shared_ptr< NodalUtilTriangle > m_util
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 v_GetI().

◆ 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 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ 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 }
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:375
unsigned int GetNumPoints() const
Definition: Points.h:273
unsigned int GetTotNumPoints() const
Definition: Points.h:278

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

Referenced by v_CalculatePoints().

◆ v_CalculateDerivMatrix()

void Nektar::LibUtilities::NodalTriEvenlySpaced::v_CalculateDerivMatrix ( )
overrideprivatevirtual

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 }
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition: Points.h:381

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

◆ v_CalculatePoints()

void Nektar::LibUtilities::NodalTriEvenlySpaced::v_CalculatePoints ( )
overrideprivatevirtual

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 }
double NekDouble

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

◆ v_CalculateWeights()

void Nektar::LibUtilities::NodalTriEvenlySpaced::v_CalculateWeights ( )
overrideprivatevirtual

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:377

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

◆ v_GetI() [1/2]

virtual const MatrixSharedPtrType Nektar::LibUtilities::NodalTriEvenlySpaced::v_GetI ( const Array< OneD, const NekDouble > &  x,
const Array< OneD, const NekDouble > &  y 
)
inlineoverrideprotectedvirtual

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

Definition at line 76 of file NodalTriEvenlySpaced.h.

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

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

◆ v_GetI() [2/2]

virtual const MatrixSharedPtrType Nektar::LibUtilities::NodalTriEvenlySpaced::v_GetI ( const PointsKey pkey)
inlineoverrideprotectedvirtual

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

Definition at line 66 of file NodalTriEvenlySpaced.h.

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

References ASSERTL0, Nektar::LibUtilities::Points< NekDouble >::GetI(), Nektar::LibUtilities::PointsKey::GetPointsDim(), and Nektar::LibUtilities::PointsManager().

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 92 of file NodalTriEvenlySpaced.h.

◆ m_util

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