Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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,
85 
88  &fluxvector);
89 
90  template<typename FuncPointerT, typename ObjectPointerT>
91  void SetFluxVector(FuncPointerT func, ObjectPointerT obj)
92  {
93  m_fluxVector = boost::bind(func, obj, _1, _2, _3, _4, _5);
94  }
95 
96  void SetFluxVectorVec(DiffusionFluxVecCB fluxVector)
97  {
98  m_fluxVector = fluxVector;
99  }
100 
101  template<typename FuncPointerT, typename ObjectPointerT>
102  void SetFluxVectorNS(FuncPointerT func, ObjectPointerT obj)
103  {
104  m_fluxVectorNS = boost::bind(func, obj, _1, _2, _3);
105  }
106 
107  template<typename FuncPointerT, typename ObjectPointerT>
108  void SetArtificialDiffusionVector(FuncPointerT func, ObjectPointerT obj)
109  {
110  m_ArtificialDiffusionVector = boost::bind(func, obj, _1, _2);
111  }
112 
114  {
115  m_fluxVectorNS = fluxVector;
116  }
117 
119  {
120  v_SetHomoDerivs(deriv);
121  }
122 
124  {
125  return v_GetFluxTensor();
126  }
127 
128  protected:
129  DiffusionFluxVecCB m_fluxVector;
132 
133  virtual void v_InitObject(
136  {
137 
138  };
139 
140  virtual void v_Diffuse(
141  const int nConvectiveFields,
143  const Array<OneD, Array<OneD, NekDouble> > &inarray,
144  Array<OneD, Array<OneD, NekDouble> > &outarray,
147 
148  virtual void v_SetHomoDerivs(
150  {
151 
152  }
153 
155  {
157  return tmp;
158  }
159  };
160 
161  /// A shared pointer to an EquationSystem object
162  typedef boost::shared_ptr<Diffusion> DiffusionSharedPtr;
163 
164  /// Datatype of the NekFactory used to instantiate classes derived
165  /// from the Diffusion class.
167  SOLVER_UTILS_EXPORT DiffusionFactory& GetDiffusionFactory();
168  }
169 }
170 
171 #endif
virtual Array< OneD, Array< OneD, Array< OneD, NekDouble > > > & GetFluxTensor()
Definition: Diffusion.h:123
void SetHomoDerivs(Array< OneD, Array< OneD, NekDouble > > &deriv)
Definition: Diffusion.h:118
DiffusionArtificialDiffusion m_ArtificialDiffusionVector
Definition: Diffusion.h:131
SOLVER_UTILS_EXPORT void InitObject(LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields)
Definition: Diffusion.cpp:51
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, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)
Definition: Diffusion.cpp:58
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:130
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
void SetFluxVectorVec(DiffusionFluxVecCB fluxVector)
Definition: Diffusion.h:96
void SetFluxVector(FuncPointerT func, ObjectPointerT obj)
Definition: Diffusion.h:91
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, const Array< OneD, Array< OneD, NekDouble > > &pFwd=NullNekDoubleArrayofArray, const Array< OneD, Array< OneD, NekDouble > > &pBwd=NullNekDoubleArrayofArray)=0
boost::shared_ptr< Diffusion > DiffusionSharedPtr
A shared pointer to an EquationSystem object.
Definition: Diffusion.h:162
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:113
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:129
LibUtilities::NekFactory< std::string, Diffusion, std::string > DiffusionFactory
Datatype of the NekFactory used to instantiate classes derived from the Diffusion class...
Definition: Diffusion.h:166
void SetFluxVectorNS(FuncPointerT func, ObjectPointerT obj)
Definition: Diffusion.h:102
void SetArtificialDiffusionVector(FuncPointerT func, ObjectPointerT obj)
Definition: Diffusion.h:108
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayofArray
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:133
virtual Array< OneD, Array< OneD, Array< OneD, NekDouble > > > & v_GetFluxTensor()
Definition: Diffusion.h:154
Provides a generic Factory class.
Definition: NekFactory.hpp:116
virtual void v_SetHomoDerivs(Array< OneD, Array< OneD, NekDouble > > &deriv)
Definition: Diffusion.h:148