Nektar++
FourierSingleModePoints.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: FourierSingleModePoints.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 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: 1D Non Evenly-Spaced Fourier Points for stability analysis
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #include <boost/core/ignore_unused.hpp>
36 
39 #include <LibUtilities/Foundations/ManagerAccess.h> // for PointsManager, etc
41 
42 namespace Nektar
43 {
44 namespace LibUtilities
45 {
49 
51 {
52  // Allocate the storage for points
54  unsigned int npts = m_pointsKey.GetNumPoints();
55 
56  if (npts == 1)
57  {
58  m_points[0][0] = 0.25;
59  }
60  else
61 
62  {
63  ASSERTL0(npts == 2,
64  "Fourier points for single mode analysis should be 2");
65 
66  m_points[0][0] = 0.0;
67  m_points[0][1] = 0.5;
68  }
69 }
70 
72 {
73  // Allocate the storage for points
75 
76  unsigned int npts = m_pointsKey.GetNumPoints();
77  // Here I need to insert the weight for the new point distribution
78  for (unsigned int i = 0; i < npts; ++i)
79  {
80  m_weights[i] = 1.0;
81  }
82 }
83 
85 {
86 
88 }
89 
90 std::shared_ptr<Points<NekDouble>> FourierSingleModePoints::Create(
91  const PointsKey &key)
92 {
93  std::shared_ptr<Points<NekDouble>> returnval(
95 
96  returnval->Initialize();
97 
98  return returnval;
99 }
100 
101 std::shared_ptr<NekMatrix<NekDouble>> FourierSingleModePoints::CreateMatrix(
102  const PointsKey &pkey)
103 {
104  int numpoints = pkey.GetNumPoints();
106 
107  PointsManager()[pkey]->GetPoints(xpoints);
108 
109  /// Delegate to function below.
110  return GetI(numpoints, xpoints);
111 }
112 
113 const std::shared_ptr<NekMatrix<NekDouble>> FourierSingleModePoints::v_GetI(
114  const PointsKey &pkey)
115 {
116  ASSERTL0(pkey.GetPointsDim() == 1,
117  "Fourier Points can only interp to other 1d point distributions");
118 
119  return m_InterpManager[pkey];
120 }
121 
122 const std::shared_ptr<NekMatrix<NekDouble>> FourierSingleModePoints::v_GetI(
124 {
125  int numpoints = 1;
126 
127  /// Delegate to function below.
128  return GetI(numpoints, x);
129 }
130 
131 const std::shared_ptr<NekMatrix<NekDouble>> FourierSingleModePoints::v_GetI(
132  unsigned int numpoints, const Array<OneD, const NekDouble> &x)
133 {
134  Array<OneD, NekDouble> interp(GetNumPoints() * numpoints);
135 
136  CalculateInterpMatrix(numpoints, x, interp);
137 
138  NekDouble *t = interp.data();
139  unsigned int np = GetNumPoints();
140  std::shared_ptr<NekMatrix<NekDouble>> returnval(
141  MemoryManager<NekMatrix<NekDouble>>::AllocateSharedPtr(numpoints, np,
142  t));
143 
144  return returnval;
145 }
146 
148  unsigned int npts, const Array<OneD, const NekDouble> &xpoints,
149  Array<OneD, NekDouble> &interp)
150 {
151  boost::ignore_unused(npts, xpoints, interp);
152 }
153 
154 } // end of namespace LibUtilities
155 } // end of namespace Nektar
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
void CalculateInterpMatrix(unsigned int npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
std::shared_ptr< NekMatrix< NekDouble > > CreateMatrix(const PointsKey &pkey)
virtual const MatrixSharedPtrType v_GetI(const PointsKey &pkey) override
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
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:375
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_InterpManager
Definition: Points.h:383
PointsKey m_pointsKey
Points type for this points distributions.
Definition: Points.h:372
unsigned int GetNumPoints() const
Definition: Points.h:273
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:377
virtual void v_CalculateDerivMatrix()
Definition: Points.h:445
const MatrixSharedPtrType GetI(const PointsKey &key)
Definition: Points.h:336
Defines a specification for a set of points.
Definition: Points.h:59
unsigned int GetPointsDim() const
Definition: Points.h:147
unsigned int GetNumPoints() const
Definition: Points.h:104
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
PointsManagerT & PointsManager(void)
@ eFourierSingleModeSpaced
1D Non Evenly-spaced points for Single Mode analysis
Definition: PointsType.h:77
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble