Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HomogeneousRSScalar.hpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Advection3DHomogeneous1D.h
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: Wrapper for Riemann solver scalar.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
38 
39 namespace Nektar
40 {
41  namespace SolverUtils
42  {
43  /**
44  * @brief Wrapper class for Riemann solver scalars.
45  */
47  {
48  public:
50  int nPlanes)
51  : m_func (func),
52  m_planeNumber(0),
53  m_numPlanes (nPlanes),
54  m_tmp ()
55  {
56  }
57 
59  {
60  if (m_planeNumber == 0)
61  {
62  m_tmp = m_func();
63  }
64 
65  const int nPts = m_tmp.num_elements() / m_numPlanes;
66  const int offset = m_planeNumber * nPts;
67 
68  m_tmp2 = Array<OneD, NekDouble>(nPts, m_tmp + offset);
69  m_planeNumber = (m_planeNumber + 1) % m_numPlanes;
70 
71  return m_tmp2;
72  }
73 
74  private:
80  };
81 
82  /**
83  * @brief Wrapper class for Riemann solver scalars.
84  */
86  {
87  public:
89  int nPlanes,
90  string desc = "")
91  : m_func (func),
92  m_planeNumber(0),
93  m_numPlanes (nPlanes),
94  m_tmp (),
95  m_desc (desc)
96  {
97  }
98 
100  {
101  if (m_planeNumber == 0)
102  {
103  m_tmp = m_func();
104  }
105 
106  const int nDim = m_tmp.num_elements();
107  const int nPts = m_tmp[0].num_elements() / m_numPlanes;
108  const int offset = m_planeNumber * nPts;
110 
111  for (int i = 0; i < m_tmp.num_elements(); ++i)
112  {
113  m_tmp2[i] = Array<OneD, NekDouble>(nPts, m_tmp[i] + offset);
114  }
115 
117 
118  return m_tmp2;
119  }
120 
121  private:
127  string m_desc;
128  };
129  }
130 }
Array< OneD, Array< OneD, NekDouble > > m_tmp2
boost::function< const Array< OneD, const NekDouble > &()> RSScalarFuncType
Definition: RiemannSolver.h:56
Wrapper class for Riemann solver scalars.
const Array< OneD, const NekDouble > & Exec()
Array< OneD, Array< OneD, NekDouble > > m_tmp
boost::function< const Array< OneD, const Array< OneD, NekDouble > > &()> RSVecFuncType
Definition: RiemannSolver.h:58
HomoRSVector(RSVecFuncType func, int nPlanes, string desc="")
Array< OneD, const NekDouble > m_tmp
HomoRSScalar(RSScalarFuncType func, int nPlanes)
const Array< OneD, const Array< OneD, NekDouble > > & Exec()
Wrapper class for Riemann solver scalars.
Array< OneD, const NekDouble > m_tmp2