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  {
48  };
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, "Fourier points for single mode analysis should be 2");
64 
65  m_points[0][0] = 0.0;
66  m_points[0][1] = 0.5;
67  }
68  }
69 
71  {
72  // Allocate the storage for points
74 
75  unsigned int npts = m_pointsKey.GetNumPoints();
76  //Here I need to insert the weight for the new point distribution
77  for(unsigned int i=0; i<npts; ++i)
78  {
79  m_weights[i] = 1.0;
80  }
81  }
82 
84  {
85 
87 
88  }
89 
90  std::shared_ptr<Points<NekDouble> > FourierSingleModePoints::Create(const PointsKey &key)
91  {
92  std::shared_ptr<Points<NekDouble> > returnval(MemoryManager<FourierSingleModePoints>::AllocateSharedPtr(key));
93 
94  returnval->Initialize();
95 
96  return returnval;
97  }
98 
99 
100  std::shared_ptr< NekMatrix<NekDouble> > FourierSingleModePoints::CreateMatrix(const PointsKey &pkey)
101  {
102  int numpoints = pkey.GetNumPoints();
104 
105  PointsManager()[pkey]->GetPoints(xpoints);
106 
107  /// Delegate to function below.
108  return GetI(numpoints, xpoints);
109  }
110 
111  const std::shared_ptr<NekMatrix<NekDouble> > FourierSingleModePoints::GetI(const PointsKey& pkey)
112  {
113  ASSERTL0(pkey.GetPointsDim()==1, "Fourier Points can only interp to other 1d point distributions");
114 
115  return m_InterpManager[pkey];
116 
117  }
118 
119  const std::shared_ptr<NekMatrix<NekDouble> > FourierSingleModePoints::GetI(const Array<OneD, const NekDouble>& x)
120  {
121  int numpoints = 1;
122 
123  /// Delegate to function below.
124  return GetI(numpoints, x);
125  }
126 
127  const std::shared_ptr<NekMatrix<NekDouble> > FourierSingleModePoints::GetI(unsigned int numpoints, const Array<OneD, const NekDouble>& x)
128  {
129  Array<OneD, NekDouble> interp(GetNumPoints()*numpoints);
130 
131  CalculateInterpMatrix(numpoints, x, interp);
132 
133  NekDouble* t = interp.data();
134  unsigned int np = GetNumPoints();
135  std::shared_ptr< NekMatrix<NekDouble> > returnval(MemoryManager<NekMatrix<NekDouble> >::AllocateSharedPtr(numpoints,np,t));
136 
137  return returnval;
138  }
139 
141  {
142  boost::ignore_unused(npts, xpoints, interp);
143  }
144 
145 
146 
147  } // end of namespace LibUtilities
148 } // end of namespace Nektar
149 
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:216
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
void CalculateInterpMatrix(unsigned int npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
const MatrixSharedPtrType GetI(const PointsKey &pkey)
std::shared_ptr< NekMatrix< NekDouble > > CreateMatrix(const PointsKey &pkey)
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:166
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:390
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_InterpManager
Definition: Points.h:397
virtual void CalculateDerivMatrix()
Definition: Points.h:450
PointsKey m_pointsKey
Points type for this points distributions.
Definition: Points.h:387
unsigned int GetNumPoints() const
Definition: Points.h:273
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:392
Defines a specification for a set of points.
Definition: Points.h:60
unsigned int GetPointsDim() const
Definition: Points.h:150
unsigned int GetNumPoints() const
Definition: Points.h:107
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:66
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
double NekDouble