Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Diffusion.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Diffusion.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: Abstract base class for diffusion.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERUTILS_DIFFUSION
37 #define NEKTAR_SOLVERUTILS_DIFFUSION
38 
39 #include <string>
40 #include <boost/function.hpp>
41 
45 #include <MultiRegions/ExpList.h>
48 
49 namespace Nektar
50 {
51  namespace SolverUtils
52  {
53  typedef boost::function<void (
54  const int,
55  const int,
56  const Array<OneD, Array<OneD, NekDouble> >&,
57  Array<OneD, Array<OneD, NekDouble> >&,
58  Array<OneD, Array<OneD, NekDouble> >&)> DiffusionFluxVecCB;
59 
60  typedef boost::function<void (
61  const Array<OneD, Array<OneD, NekDouble> >&,
62  Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&,
63  Array<OneD, Array<OneD, Array<OneD, NekDouble> > >&)>
65 
66  typedef boost::function<void (
67  const Array<OneD, Array<OneD, NekDouble> >&,
68  Array<OneD, NekDouble >&)>
70 
71  class Diffusion
72  {
73  public:
76  Array<OneD, MultiRegions::ExpListSharedPtr> pFields);
77 
79  const int nConvectiveFields,
80  const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
81  const Array<OneD, Array<OneD, NekDouble> > &inarray,
82  Array<OneD, Array<OneD, NekDouble> > &outarray);
83 
85  Array<OneD, Array<OneD, Array<OneD, NekDouble> > >
86  &fluxvector);
87 
88  template<typename FuncPointerT, typename ObjectPointerT>
89  void SetFluxVector(FuncPointerT func, ObjectPointerT obj)
90  {
91  m_fluxVector = boost::bind(func, obj, _1, _2, _3, _4, _5);
92  }
93 
95  {
96  m_fluxVector = fluxVector;
97  }
98 
99  template<typename FuncPointerT, typename ObjectPointerT>
100  void SetFluxVectorNS(FuncPointerT func, ObjectPointerT obj)
101  {
102  m_fluxVectorNS = boost::bind(func, obj, _1, _2, _3);
103  }
104 
105  template<typename FuncPointerT, typename ObjectPointerT>
106  void SetArtificialDiffusionVector(FuncPointerT func, ObjectPointerT obj)
107  {
108  m_ArtificialDiffusionVector = boost::bind(func, obj, _1, _2);
109  }
110 
112  {
113  m_fluxVectorNS = fluxVector;
114  }
115 
117  {
118  m_riemann = riemann;
119  }
120 
121  inline void SetHomoDerivs(Array<OneD, Array<OneD, NekDouble> > &deriv)
122  {
123  v_SetHomoDerivs(deriv);
124  }
125 
126  virtual Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &GetFluxTensor()
127  {
128  return v_GetFluxTensor();
129  }
130 
131  protected:
136 
137  virtual void v_InitObject(
139  Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
140  {
141 
142  };
143 
144  virtual void v_Diffuse(
145  const int nConvectiveFields,
146  const Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
147  const Array<OneD, Array<OneD, NekDouble> > &inarray,
148  Array<OneD, Array<OneD, NekDouble> > &outarray)=0;
149 
150  virtual void v_SetHomoDerivs(
151  Array<OneD, Array<OneD, NekDouble> > &deriv)
152  {
153 
154  }
155 
156  virtual Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &v_GetFluxTensor()
157  {
158  static Array<OneD, Array<OneD, Array<OneD, NekDouble> > > tmp;
159  return tmp;
160  }
161  };
162 
163  /// A shared pointer to an EquationSystem object
164  typedef boost::shared_ptr<Diffusion> DiffusionSharedPtr;
165 
166  /// Datatype of the NekFactory used to instantiate classes derived
167  /// from the Diffusion class.
170  }
171 }
172 
173 #endif