Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // 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 Non Evenly-Spaced Fourier Points for stability analysis
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
38 #include <LibUtilities/Foundations/ManagerAccess.h> // for PointsManager, etc
40 
41 namespace Nektar
42 {
43  namespace LibUtilities
44  {
45 
47  {
48  // Allocate the storage for points
50  unsigned int npts = m_pointsKey.GetNumPoints();
51 
52  if(npts==1)
53  {
54  m_points[0][0] = 0.25;
55  }
56  else
57 
58  {
59  ASSERTL0(npts==2, "Fourier points for single mode analysis should be 2");
60 
61  m_points[0][0] = 0.0;
62  m_points[0][1] = 0.5;
63  }
64  }
65 
67  {
68  // Allocate the storage for points
70 
71  unsigned int npts = m_pointsKey.GetNumPoints();
72  //Here I need to insert the weight for the new point distribution
73  for(unsigned int i=0; i<npts; ++i)
74  {
75  m_weights[i] = 1.0;
76  }
77  }
78 
80  {
81 
83 
84  }
85 
86  boost::shared_ptr<Points<NekDouble> > FourierSingleModePoints::Create(const PointsKey &key)
87  {
88  boost::shared_ptr<Points<NekDouble> > returnval(MemoryManager<FourierSingleModePoints>::AllocateSharedPtr(key));
89 
90  returnval->Initialize();
91 
92  return returnval;
93  }
94 
95 
96  boost::shared_ptr< NekMatrix<NekDouble> > FourierSingleModePoints::CreateMatrix(const PointsKey &pkey)
97  {
98  int numpoints = pkey.GetNumPoints();
100 
101  PointsManager()[pkey]->GetPoints(xpoints);
102 
103  /// Delegate to function below.
104  return GetI(numpoints, xpoints);
105  }
106 
107  const boost::shared_ptr<NekMatrix<NekDouble> > FourierSingleModePoints::GetI(const PointsKey& pkey)
108  {
109  ASSERTL0(pkey.GetPointsDim()==1, "Fourier Points can only interp to other 1d point distributions");
110 
111  return m_InterpManager[pkey];
112 
113  }
114 
115  const boost::shared_ptr<NekMatrix<NekDouble> > FourierSingleModePoints::GetI(const Array<OneD, const NekDouble>& x)
116  {
117  int numpoints = 1;
118 
119  /// Delegate to function below.
120  return GetI(numpoints, x);
121  }
122 
123  const boost::shared_ptr<NekMatrix<NekDouble> > FourierSingleModePoints::GetI(unsigned int numpoints, const Array<OneD, const NekDouble>& x)
124  {
125  Array<OneD, NekDouble> interp(GetNumPoints()*numpoints);
126 
127  CalculateInterpMatrix(numpoints, x, interp);
128 
129  NekDouble* t = interp.data();
130  unsigned int np = GetNumPoints();
131  boost::shared_ptr< NekMatrix<NekDouble> > returnval(MemoryManager<NekMatrix<NekDouble> >::AllocateSharedPtr(numpoints,np,t));
132 
133  return returnval;
134  }
135 
137  {
138 
139 
140  }
141 
142 
143 
144  } // end of namespace LibUtilities
145 } // end of namespace Nektar
146 
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:198
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
Array< OneD, DataType > m_points[3]
Definition: Points.h:371
static boost::shared_ptr< PointsBaseType > Create(const PointsKey &key)
void CalculateInterpMatrix(unsigned int npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
boost::shared_ptr< NekMatrix< NekDouble > > CreateMatrix(const PointsKey &pkey)
unsigned int GetNumPoints() const
Definition: Points.h:268
static std::string npts
Definition: InputFld.cpp:43
const MatrixSharedPtrType GetI(const PointsKey &pkey)
unsigned int GetPointsDim() const
Definition: Points.h:149
PointsManagerT & PointsManager(void)
Array< OneD, DataType > m_weights
Definition: Points.h:372
Defines a specification for a set of points.
Definition: Points.h:58
double NekDouble
virtual void CalculateDerivMatrix()
Definition: Points.h:393
unsigned int GetNumPoints() const
Definition: Points.h:106
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_InterpManager
Definition: Points.h:374