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

#include <NodalTriEvenlySpaced.h>

Inheritance diagram for Nektar::LibUtilities::NodalTriEvenlySpaced:
Inheritance graph
[legend]
Collaboration diagram for Nektar::LibUtilities::NodalTriEvenlySpaced:
Collaboration graph
[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
 
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, const Array< OneD, const DataType > &z)
 
virtual const MatrixSharedPtrType GetGalerkinProjection (const PointsKey &pkey)
 

Static Public Member Functions

static boost::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)
 

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

Constructor & Destructor Documentation

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

Definition at line 53 of file NodalTriEvenlySpaced.h.

54  {
55 
56  }
Nektar::LibUtilities::NodalTriEvenlySpaced::NodalTriEvenlySpaced ( const PointsKey key)
inline

Definition at line 58 of file NodalTriEvenlySpaced.h.

58  : PointsBaseType(key)
59  {
60 
61  }
Points< NekDouble > PointsBaseType
Nektar::LibUtilities::NodalTriEvenlySpaced::NodalTriEvenlySpaced ( )
inlineprivate

Deafult constructor should not be called except by Create matrix.

Definition at line 93 of file NodalTriEvenlySpaced.h.

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

Member Function Documentation

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

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

Definition at line 132 of file NodalTriEvenlySpaced.cpp.

References Nektar::LibUtilities::Points< NekDouble >::CalculateDerivMatrix(), Nektar::LibUtilities::GetXDerivativeMatrix(), Nektar::LibUtilities::GetYDerivativeMatrix(), Nektar::LibUtilities::Points< NekDouble >::m_derivmatrix, and Nektar::LibUtilities::Points< NekDouble >::m_points.

133  {
134 
135  // Allocate the derivative matrix.
137 
138  NekVector<NekDouble> x( m_points[0] );
139  NekVector<NekDouble> y( m_points[1] );
140  NekVector<NekDouble> xi = x;
141  NekVector<NekDouble> yi = y;
142 
143  m_derivmatrix[0] = GetXDerivativeMatrix(x,y,xi,yi);
144  m_derivmatrix[1] = GetYDerivativeMatrix(x,y,xi,yi);
145 
146  }
Points< NekDouble >::MatrixSharedPtrType GetXDerivativeMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi)
Definition: NodalUtil.cpp:852
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:351
Points< NekDouble >::MatrixSharedPtrType GetYDerivativeMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi)
Definition: NodalUtil.cpp:1303
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 112 of file NodalTriEvenlySpaced.cpp.

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

Referenced by GetI().

115  {
116  NekVector<NekDouble> x( m_points[0] );
117  NekVector<NekDouble> y( m_points[1] );
118  NekVector<NekDouble> xi( xia );
119  NekVector<NekDouble> yi( yia );
120  NekMatrix<NekDouble> interMat = GetInterpolationMatrix(x, y, xi, yi);
121 
122  int rows = xi.GetRows(), cols = GetTotNumPoints();
123  for( int i = 0; i < rows; ++i ) {
124  for( int j = 0; j < cols; ++j ) {
125  interp[j + i*cols] = interMat(i,j);
126  }
127  }
128  }
unsigned int GetTotNumPoints() const
Definition: Points.h:251
NekMatrix< NekDouble > GetInterpolationMatrix(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y, const NekVector< NekDouble > &xi, const NekVector< NekDouble > &yi)
Definition: NodalUtil.cpp:609
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
void Nektar::LibUtilities::NodalTriEvenlySpaced::CalculatePoints ( )
privatevirtual

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

Definition at line 72 of file NodalTriEvenlySpaced.cpp.

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

73  {
74  // Allocate the storage for points
76 
77  // Populate m_points
78  unsigned int npts = GetNumPoints();
79  NekDouble delta = 2.0/(npts - 1.0);
80  for(int i=0, index=0; i<npts; ++i){ // y-direction
81  for(int j=0; j<npts-i; ++j,++index){ // x-direction
82  NekDouble x = -1.0 + j*delta;
83  NekDouble y = -1.0 + i*delta;
84  m_points[0][index] = x;
85  m_points[1][index] = y;
86  }
87  }
88 
90 
91 
92  }
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::NodalTriEvenlySpaced::CalculateWeights ( )
privatevirtual

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

Definition at line 95 of file NodalTriEvenlySpaced.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::MakeQuadratureWeights().

96  {
97  // Allocate the storage for points
99 
100  typedef DataType T;
101 
102  // Solve the Vandermonde system of integrals for the weight vector
103  NekVector<T> w = MakeQuadratureWeights(NekVector<T>(m_points[0]), NekVector<T>(m_points[1]));
104 
105  m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
106 
107  }
Array< OneD, DataType > m_weights
Definition: Points.h:350
NekVector< NekDouble > MakeQuadratureWeights(const NekVector< NekDouble > &x, const NekVector< NekDouble > &y)
Definition: NodalUtil.cpp:579
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
boost::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalTriEvenlySpaced::Create ( const PointsKey key)
static

Definition at line 148 of file NodalTriEvenlySpaced.cpp.

149  {
150  boost::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalTriEvenlySpaced>::AllocateSharedPtr(key));
151 
152  returnval->Initialize();
153 
154  return returnval;
155  }
const MatrixSharedPtrType Nektar::LibUtilities::NodalTriEvenlySpaced::GetI ( const PointsKey pkey)
inlinevirtual

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

Definition at line 66 of file NodalTriEvenlySpaced.h.

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

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:161
PointsManagerT & PointsManager(void)
const MatrixSharedPtrType GetI(const PointsKey &pkey)
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 76 of file NodalTriEvenlySpaced.h.

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

79  {
80  int numpoints = x.num_elements();
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> >
88  ::AllocateSharedPtr(numpoints, np, d);
89  }
unsigned int GetTotNumPoints() const
Definition: Points.h:251
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, Array< OneD, NekDouble > &interp)
double NekDouble
void Nektar::LibUtilities::NodalTriEvenlySpaced::NodalPointReorder2d ( )
private

Definition at line 157 of file NodalTriEvenlySpaced.cpp.

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

Referenced by CalculatePoints().

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){ // y-direction
170  for(int j=0; j<npts-i; ++j,++index){ // x-direction
171 
172  if( isVertex(i,j,npts) ) {
173 
174  vertex.push_back(index);
175 
176  } else if( isEdge(i,j,npts) ) { // interior edge
177 
178  if(isEdge_1(i,j,npts)){ // bottom edge
179 
180  iEdge_1.push_back(index);
181 
182  }else if(isEdge_2(i,j,npts)){ // right edge
183 
184  iEdge_2.push_back(index);
185 
186  }else // left edge
187  {
188  // Add backwards. This is because of counter clockwise.
189  iEdge_3.insert(iEdge_3.begin(), index);
190  }
191 
192  } else { // Interior points
193 
194  interiorPoints.push_back(index);
195  }
196  }
197  }
198 
199  // Mapping the vertex, edges, and interior points using the permutation matrix,
200  // so the points are ordered anticlockwise.
201  for(unsigned int k=0; k<vertex.size(); ++k){
202 
203  map.push_back(vertex[k]);
204  }
205 
206  for(unsigned int k=0; k<iEdge_1.size(); ++k){
207 
208  map.push_back(iEdge_1[k]);
209  }
210 
211  for(unsigned int k=0; k<iEdge_2.size(); ++k){
212 
213  map.push_back(iEdge_2[k]);
214  }
215 
216  for(unsigned int k=0; k<iEdge_3.size(); ++k){
217 
218  map.push_back(iEdge_3[k]);
219  }
220 
221  for(unsigned int k=0; k<interiorPoints.size(); ++k){
222 
223  map.push_back(interiorPoints[k]);
224  }
225 
226 
227  Array<OneD,NekDouble> points[2];
228  points[0] = Array<OneD,NekDouble>(GetTotNumPoints());
229  points[1] = Array<OneD,NekDouble>(GetTotNumPoints());
230  for(unsigned int index=0; index<map.size(); ++index){
231  points[0][index] = m_points[0][index];
232  points[1][index] = m_points[1][index];
233  }
234 
235  for(unsigned int index=0; index<map.size(); ++index){
236  m_points[0][index] = points[0][map[index]];
237  m_points[1][index] = points[1][map[index]];
238  }
239 
240  }
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