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)
 
size_t GetPointsDim () const
 
size_t GetNumPoints () const
 
size_t 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 (size_t 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_CalculatePoints ()
 
virtual void v_CalculateWeights ()
 

Private Member Functions

 NodalTriEvenlySpaced ()=delete
 
 NodalTriEvenlySpaced (const NodalTriEvenlySpaced &points)=delete
 
void NodalPointReorder2d ()
 
virtual void v_CalculatePoints () override final
 
virtual void v_CalculateWeights () override final
 
virtual void v_CalculateDerivMatrix () override final
 
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 46 of file NodalTriEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalTriEvenlySpaced()

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

Definition at line 49 of file NodalTriEvenlySpaced.h.

50 {
51 }

◆ NodalTriEvenlySpaced() [1/3]

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

Definition at line 53 of file NodalTriEvenlySpaced.h.

53 : PointsBaseType(key)
54 {
55 }
Points< NekDouble > PointsBaseType

◆ NodalTriEvenlySpaced() [2/3]

Nektar::LibUtilities::NodalTriEvenlySpaced::NodalTriEvenlySpaced ( )
privatedelete

◆ NodalTriEvenlySpaced() [3/3]

Nektar::LibUtilities::NodalTriEvenlySpaced::NodalTriEvenlySpaced ( const NodalTriEvenlySpaced points)
privatedelete

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 115 of file NodalTriEvenlySpaced.cpp.

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

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 141 of file NodalTriEvenlySpaced.cpp.

143{
144 std::shared_ptr<PointsBaseType> returnval(
146
147 returnval->Initialize();
148
149 return returnval;
150}
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 152 of file NodalTriEvenlySpaced.cpp.

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

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 ( )
finaloverrideprivatevirtual

Definition at line 131 of file NodalTriEvenlySpaced.cpp.

132{
133
134 // Allocate the derivative matrix.
135 PointsBaseType::v_CalculateDerivMatrix();
136
137 m_derivmatrix[0] = m_util->GetDerivMatrix(0);
138 m_derivmatrix[1] = m_util->GetDerivMatrix(1);
139}
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition: Points.h:367

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

◆ v_CalculatePoints()

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

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

Definition at line 75 of file NodalTriEvenlySpaced.cpp.

76{
77 // Allocate the storage for points
79
80 // Populate m_points
81 size_t npts = GetNumPoints();
82 NekDouble delta = 2.0 / (npts - 1.0);
83 for (size_t i = 0, index = 0; i < npts; ++i)
84 { // y-direction
85 for (size_t j = 0; j < npts - i; ++j, ++index)
86 { // x-direction
87 NekDouble x = -1.0 + j * delta;
88 NekDouble y = -1.0 + i * delta;
89 m_points[0][index] = x;
90 m_points[1][index] = y;
91 }
92 }
93
95
97 npts - 1, m_points[0], m_points[1]);
98}
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 ( )
finaloverrideprivatevirtual

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

Definition at line 100 of file NodalTriEvenlySpaced.cpp.

101{
102 // Allocate the storage for points
104
105 typedef DataType T;
106
107 // Solve the Vandermonde system of integrals for the weight vector
108 NekVector<T> w = m_util->GetWeights();
109
110 m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
111}
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:363
std::vector< double > w(NPUPPER)

References m_util, Nektar::LibUtilities::Points< NekDouble >::m_weights, Nektar::LibUtilities::Points< NekDouble >::v_CalculateWeights(), and Nektar::UnitTests::w().

◆ 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

Definition at line 71 of file NodalTriEvenlySpaced.h.

74 {
75 size_t numpoints = x.size();
76 size_t np = GetTotNumPoints();
77
78 Array<OneD, NekDouble> interp(GetTotNumPoints() * numpoints);
79 CalculateInterpMatrix(x, y, interp);
80
81 NekDouble *d = interp.data();
82 return MemoryManager<NekMatrix<NekDouble>>::AllocateSharedPtr(numpoints,
83 np, d);
84 }
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, Array< OneD, NekDouble > &interp)
std::vector< double > d(NPUPPER *NPUPPER)

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

◆ v_GetI() [2/2]

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

Definition at line 61 of file NodalTriEvenlySpaced.h.

62 {
63 ASSERTL0(pkey.GetPointsDim() == 2,
64 "NodalTriEvenlySpaced Points can only interp to other "
65 "2d point distributions");
66 Array<OneD, const NekDouble> x, y;
67 PointsManager()[pkey]->GetPoints(x, y);
68 return GetI(x, y);
69 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
const MatrixSharedPtrType GetI(const PointsKey &key)
Definition: Points.h:322
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:169
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
@ eNodalTriEvenlySpaced
2D Evenly-spaced points on a Triangle
Definition: PointsType.h:85

Definition at line 87 of file NodalTriEvenlySpaced.h.

◆ m_util

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