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> >&,
59 
60  typedef boost::function<void (
65 
66  typedef boost::function<void (
70 
71  class Diffusion
72  {
73  public:
77 
79  const int nConvectiveFields,
81  const Array<OneD, Array<OneD, NekDouble> > &inarray,
82  Array<OneD, Array<OneD, NekDouble> > &outarray);
83 
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 
94  void SetFluxVectorVec(DiffusionFluxVecCB fluxVector)
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 
122  {
123  v_SetHomoDerivs(deriv);
124  }
125 
127  {
128  return v_GetFluxTensor();
129  }
130 
131  protected:
132  DiffusionFluxVecCB m_fluxVector;
136 
137  virtual void v_InitObject(
140  {
141 
142  };
143 
144  virtual void v_Diffuse(
145  const int nConvectiveFields,
147  const Array<OneD, Array<OneD, NekDouble> > &inarray,
148  Array<OneD, Array<OneD, NekDouble> > &outarray)=0;
149 
150  virtual void v_SetHomoDerivs(
152  {
153 
154  }
155 
157  {
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.
169  SOLVER_UTILS_EXPORT DiffusionFactory& GetDiffusionFactory();
170  }
171 }
172 
173 #endif
void SetRiemannSolver(RiemannSolverSharedPtr riemann)
Definition: Diffusion.h:116
virtual Array< OneD, Array< OneD, Array< OneD, NekDouble > > > & GetFluxTensor()
Definition: Diffusion.h:126
void SetHomoDerivs(Array< OneD, Array< OneD, NekDouble > > &deriv)
Definition: Diffusion.h:121
DiffusionArtificialDiffusion m_ArtificialDiffusionVector
Definition: Diffusion.h:135
SOLVER_UTILS_EXPORT void InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Definition: Diffusion.cpp:51
virtual void v_Diffuse(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)=0
SOLVER_UTILS_EXPORT void FluxVec(Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &fluxvector)
DiffusionFactory & GetDiffusionFactory()
Definition: Diffusion.cpp:42
DiffusionFluxVecCBNS m_fluxVectorNS
Definition: Diffusion.h:133
boost::shared_ptr< RiemannSolver > RiemannSolverSharedPtr
A shared pointer to an EquationSystem object.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
void SetFluxVectorVec(DiffusionFluxVecCB fluxVector)
Definition: Diffusion.h:94
RiemannSolverSharedPtr m_riemann
Definition: Diffusion.h:134
void SetFluxVector(FuncPointerT func, ObjectPointerT obj)
Definition: Diffusion.h:89
boost::shared_ptr< Diffusion > DiffusionSharedPtr
A shared pointer to an EquationSystem object.
Definition: Diffusion.h:164
SOLVER_UTILS_EXPORT void Diffuse(const int nConvectiveFields, const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
Definition: Diffusion.cpp:58
boost::function< void(const Array< OneD, Array< OneD, NekDouble > > &, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > &)> DiffusionFluxVecCBNS
Definition: Diffusion.h:64
void SetFluxVectorNS(DiffusionFluxVecCBNS fluxVector)
Definition: Diffusion.h:111
boost::function< void(const Array< OneD, Array< OneD, NekDouble > > &, Array< OneD, NekDouble > &)> DiffusionArtificialDiffusion
Definition: Diffusion.h:69
#define SOLVER_UTILS_EXPORT
DiffusionFluxVecCB m_fluxVector
Definition: Diffusion.h:132
LibUtilities::NekFactory< std::string, Diffusion, std::string > DiffusionFactory
Datatype of the NekFactory used to instantiate classes derived from the Diffusion class...
Definition: Diffusion.h:168
void SetFluxVectorNS(FuncPointerT func, ObjectPointerT obj)
Definition: Diffusion.h:100
void SetArtificialDiffusionVector(FuncPointerT func, ObjectPointerT obj)
Definition: Diffusion.h:106
boost::function< void(const int, const int, const Array< OneD, Array< OneD, NekDouble > > &, Array< OneD, Array< OneD, NekDouble > > &, Array< OneD, Array< OneD, NekDouble > > &)> DiffusionFluxVecCB
Definition: Diffusion.h:58
virtual void v_InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Definition: Diffusion.h:137
virtual Array< OneD, Array< OneD, Array< OneD, NekDouble > > > & v_GetFluxTensor()
Definition: Diffusion.h:156
Provides a generic Factory class.
Definition: NekFactory.hpp:116
virtual void v_SetHomoDerivs(Array< OneD, Array< OneD, NekDouble > > &deriv)
Definition: Diffusion.h:150