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

boost::shared_ptr
< NodalUtilTriangle
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 51 of file NodalTriEvenlySpaced.h.

Constructor & Destructor Documentation

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

Definition at line 54 of file NodalTriEvenlySpaced.h.

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

Definition at line 59 of file NodalTriEvenlySpaced.h.

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

Deafult constructor should not be called except by Create matrix.

Definition at line 96 of file NodalTriEvenlySpaced.h.

97  {
98  }
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 129 of file NodalTriEvenlySpaced.cpp.

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

130  {
131 
132  // Allocate the derivative matrix.
134 
135  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
136  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
137  }
boost::shared_ptr< NodalUtilTriangle > m_util
MatrixSharedPtrType m_derivmatrix[3]
Definition: Points.h:373
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 113 of file NodalTriEvenlySpaced.cpp.

References m_util, and Vmath::Vcopy().

Referenced by GetI().

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

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

Definition at line 72 of file NodalTriEvenlySpaced.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::Points< NekDouble >::CalculatePoints(), Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, m_util, 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 
92  npts - 1, m_points[0], m_points[1]);
93  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< NodalUtilTriangle > m_util
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
double NekDouble
void Nektar::LibUtilities::NodalTriEvenlySpaced::CalculateWeights ( )
privatevirtual

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

Definition at line 96 of file NodalTriEvenlySpaced.cpp.

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

97  {
98  // Allocate the storage for points
100 
101  typedef DataType T;
102 
103  // Solve the Vandermonde system of integrals for the weight vector
104  NekVector<T> w = m_util->GetWeights();
105 
106  m_weights = Array<OneD,T>( w.GetRows(), w.GetPtr() );
107 
108  }
boost::shared_ptr< NodalUtilTriangle > m_util
Array< OneD, DataType > m_weights
Definition: Points.h:372
boost::shared_ptr< PointsBaseType > Nektar::LibUtilities::NodalTriEvenlySpaced::Create ( const PointsKey key)
static

Definition at line 139 of file NodalTriEvenlySpaced.cpp.

140  {
141  boost::shared_ptr<PointsBaseType> returnval(MemoryManager<NodalTriEvenlySpaced>::AllocateSharedPtr(key));
142 
143  returnval->Initialize();
144 
145  return returnval;
146  }
const MatrixSharedPtrType Nektar::LibUtilities::NodalTriEvenlySpaced::GetI ( const PointsKey pkey)
inlinevirtual

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

Definition at line 67 of file NodalTriEvenlySpaced.h.

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

68  {
69  ASSERTL0(pkey.GetPointsDim() == 2,
70  "NodalTriEvenlySpaced Points can only interp to other "
71  "2d point distributions");
72  Array<OneD, const NekDouble> x, y;
73  PointsManager()[pkey]->GetPoints(x, y);
74  return GetI(x, y);
75  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
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 77 of file NodalTriEvenlySpaced.h.

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

80  {
81  int numpoints = x.num_elements();
82  unsigned int np = GetTotNumPoints();
83 
84  Array<OneD, NekDouble> interp(GetTotNumPoints()*numpoints);
85  CalculateInterpMatrix(x, y, interp);
86 
87  NekDouble* d = interp.data();
88  return MemoryManager<NekMatrix<NekDouble> >
89  ::AllocateSharedPtr(numpoints, np, d);
90  }
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, Array< OneD, NekDouble > &interp)
double NekDouble
unsigned int GetTotNumPoints() const
Definition: Points.h:273
void Nektar::LibUtilities::NodalTriEvenlySpaced::NodalPointReorder2d ( )
private

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

149  {
150  unsigned int npts = GetNumPoints();
151  using std::vector;
152  vector<int> vertex;
153  vector<int> iEdge_1; // interior edge points on the bottom triangle edge
154  vector<int> iEdge_2; // interior edge points on the right triangle edge
155  vector<int> iEdge_3; // interior edge points on the left triangle edge
156  vector<int> interiorPoints;
157  vector<int> map;
158 
159  // Build the lattice triangle left to right - bottom to top
160  for(int i=0, index=0; i<npts; ++i){ // y-direction
161  for(int j=0; j<npts-i; ++j,++index){ // x-direction
162 
163  if( isVertex(i,j,npts) ) {
164 
165  vertex.push_back(index);
166 
167  } else if( isEdge(i,j,npts) ) { // interior edge
168 
169  if(isEdge_1(i,j,npts)){ // bottom edge
170 
171  iEdge_1.push_back(index);
172 
173  }else if(isEdge_2(i,j,npts)){ // right edge
174 
175  iEdge_2.push_back(index);
176 
177  }else // left edge
178  {
179  // Add backwards. This is because of counter clockwise.
180  iEdge_3.insert(iEdge_3.begin(), index);
181  }
182 
183  } else { // Interior points
184 
185  interiorPoints.push_back(index);
186  }
187  }
188  }
189 
190  // Mapping the vertex, edges, and interior points using the permutation matrix,
191  // so the points are ordered anticlockwise.
192  for(unsigned int k=0; k<vertex.size(); ++k){
193 
194  map.push_back(vertex[k]);
195  }
196 
197  for(unsigned int k=0; k<iEdge_1.size(); ++k){
198 
199  map.push_back(iEdge_1[k]);
200  }
201 
202  for(unsigned int k=0; k<iEdge_2.size(); ++k){
203 
204  map.push_back(iEdge_2[k]);
205  }
206 
207  for(unsigned int k=0; k<iEdge_3.size(); ++k){
208 
209  map.push_back(iEdge_3[k]);
210  }
211 
212  for(unsigned int k=0; k<interiorPoints.size(); ++k){
213 
214  map.push_back(interiorPoints[k]);
215  }
216 
217 
218  Array<OneD,NekDouble> points[2];
219  points[0] = Array<OneD,NekDouble>(GetTotNumPoints());
220  points[1] = Array<OneD,NekDouble>(GetTotNumPoints());
221  for(unsigned int index=0; index<map.size(); ++index){
222  points[0][index] = m_points[0][index];
223  points[1][index] = m_points[1][index];
224  }
225 
226  for(unsigned int index=0; index<map.size(); ++index){
227  m_points[0][index] = points[0][map[index]];
228  m_points[1][index] = points[1][map[index]];
229  }
230 
231  }
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<NodalUtilTriangle> Nektar::LibUtilities::NodalTriEvenlySpaced::m_util
private