Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BLPoints.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File BLPoints.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: 1D boundary layer points
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
40 
41 namespace Nektar
42 {
43  namespace LibUtilities
44  {
46  {
47  // Allocate the storage for points.
49  unsigned int npts = m_pointsKey.GetNumPoints();
50 
51  // Derived power coefficient.
54  "Must set factor in BLPoints key");
55 
56  if (fabs(r-1.0) < 1e-6)
57  {
58  NekDouble tmp = 2.0/(npts-1.0);
59  for (unsigned int i = 0; i < npts; ++i)
60  {
61  m_points[0][i] = -1.0 + i * tmp;
62  }
63  }
64  else
65  {
66  NekDouble a = 2.0 * (1.0-r) / (1.0 - pow(r,(double)npts));
67  m_points[0][0] = -1.0;
68 
69  for (unsigned int i = 1; i < npts; ++i)
70  {
71  m_points[0][i] = m_points[0][i-1] + a*pow(r,(double)i);
72  }
73 
74  m_points[0][npts-1] = 1.0;
75  }
76 
78  {
79  vector<NekDouble> tmp(npts);
80  for (unsigned int i = 0; i < npts; ++i)
81  {
82  tmp[i] = - m_points[0][npts-1-i];
83  }
84 
85  for (unsigned int i = 0; i < npts; ++i)
86  {
87  m_points[0][i] = tmp[i];
88  }
89  }
90  }
91 
93  {
94 
95  }
96 
98  {
99  //// Allocate the derivative matrix.
101  }
102 
103  boost::shared_ptr<Points<NekDouble> > BLPoints::Create(const PointsKey &key)
104  {
105  boost::shared_ptr<Points<NekDouble> > returnval(MemoryManager<BLPoints>::AllocateSharedPtr(key));
106 
107  returnval->Initialize();
108 
109  return returnval;
110  }
111 
112 
113  boost::shared_ptr< NekMatrix<NekDouble> > BLPoints::CreateMatrix(const PointsKey &pkey)
114  {
115  int numpoints = pkey.GetNumPoints();
117 
118  PointsManager()[pkey]->GetPoints(xpoints);
119 
120  /// Delegate to function below.
121  return GetI(numpoints, xpoints);
122  }
123 
124  const boost::shared_ptr<NekMatrix<NekDouble> > BLPoints::GetI(const PointsKey& pkey)
125  {
126  ASSERTL0(pkey.GetPointsDim()==1, "Fourier Points can only interp to other 1d point distributions");
127 
128  return m_InterpManager[pkey];
129  }
130 
131  const boost::shared_ptr<NekMatrix<NekDouble> > BLPoints::GetI(const Array<OneD, const NekDouble>& x)
132  {
133  int numpoints = 1;
134 
135  /// Delegate to function below.
136  return GetI(numpoints, x);
137  }
138 
139  const boost::shared_ptr<NekMatrix<NekDouble> > BLPoints::GetI(unsigned int numpoints, const Array<OneD, const NekDouble>& x)
140  {
141  Array<OneD, NekDouble> interp(GetNumPoints()*numpoints);
142 
143  CalculateInterpMatrix(numpoints, x, interp);
144 
145  NekDouble* t = interp.data();
146  unsigned int np = GetNumPoints();
147  boost::shared_ptr< NekMatrix<NekDouble> > returnval(MemoryManager<NekMatrix<NekDouble> >::AllocateSharedPtr(numpoints,np,t));
148 
149  return returnval;
150  }
151 
153  {
154 
155  }
156  } // end of namespace LibUtilities
157 } // end of namespace Nektar
158 
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:161
NekDouble GetFactor() const
Definition: Points.h:116
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
Array< OneD, DataType > m_points[3]
Definition: Points.h:349
boost::shared_ptr< NekMatrix< NekDouble > > CreateMatrix(const PointsKey &pkey)
Definition: BLPoints.cpp:113
unsigned int GetNumPoints() const
Definition: Points.h:246
static std::string npts
Definition: InputFld.cpp:43
unsigned int GetPointsDim() const
Definition: Points.h:149
PointsManagerT & PointsManager(void)
Defines a specification for a set of points.
Definition: Points.h:58
double NekDouble
virtual void CalculateDerivMatrix()
Definition: Points.h:371
static const NekDouble kNekUnsetDouble
1D power law distribution for boundary layer points
Definition: PointsType.h:67
static boost::shared_ptr< PointsBaseType > Create(const PointsKey &key)
Definition: BLPoints.cpp:103
unsigned int GetNumPoints() const
Definition: Points.h:106
void CalculateInterpMatrix(unsigned int npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
Definition: BLPoints.cpp:152
const MatrixSharedPtrType GetI(const PointsKey &pkey)
Definition: BLPoints.cpp:124
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_InterpManager
Definition: Points.h:352
PointsType GetPointsType() const
Definition: Points.h:111