GRINS-0.8.0
parsed_function_traits.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // GRINS - General Reacting Incompressible Navier-Stokes
5 //
6 // Copyright (C) 2014-2017 Paul T. Bauman, Roy H. Stogner
7 // Copyright (C) 2010-2013 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef GRINS_PARSED_FUNCTION_TRAITS_H
26 #define GRINS_PARSED_FUNCTION_TRAITS_H
27 
28 // libMesh
29 #include "libmesh/composite_fem_function.h"
30 #include "libmesh/composite_function.h"
31 #include "libmesh/const_fem_function.h"
32 #include "libmesh/fem_function_base.h"
33 #include "libmesh/function_base.h"
34 #include "libmesh/parsed_fem_function.h"
35 #include "libmesh/parsed_function.h"
36 #include "libmesh/zero_function.h"
37 
38 namespace GRINS
39 {
40  template<typename FunctionType>
42 
43  template<typename FEShape>
44  struct ParsedFunctionTraits<libMesh::FunctionBase<FEShape> >
45  {
46  static bool const is_fem_function = false;
47  };
48 
49  template<typename FEShape>
50  struct ParsedFunctionTraits<libMesh::FEMFunctionBase<FEShape> >
51  {
52  static bool const is_fem_function = true;
53  };
54 
55 
56  // Helper metafunctions
57  template <typename FunctionType,
58  bool is_fem_function =
60  struct TypeFrom {
62 
64  to_parsed(const libMesh::System & /* system */,
65  const std::string & expression) {
67  }
68 
69  static libMesh::ZeroFunction<libMesh::Number>
70  to_zero() {
71  return libMesh::ZeroFunction<libMesh::Number>();
72  }
73  };
74 
75  template <typename FunctionType>
76  struct TypeFrom<FunctionType, true> {
77  typedef libMesh::CompositeFEMFunction<libMesh::Number> to_composite;
78 
80  to_parsed(const libMesh::System & system,
81  const std::string & expression) {
82  return libMesh::ParsedFEMFunction<libMesh::Number>(system, expression);
83  }
84 
85  static libMesh::ConstFEMFunction<libMesh::Number>
86  to_zero() {
87  return libMesh::ConstFEMFunction<libMesh::Number>(0);
88  }
89  };
90 
91 } // end namespace GRINS
92 
93 #endif // GRINS_PARSED_FUNCTION_TRAITS_H
libMesh::CompositeFunction< libMesh::Number > to_composite
static libMesh::ConstFEMFunction< libMesh::Number > to_zero()
GRINS namespace.
static libMesh::ParsedFunction< libMesh::Number > to_parsed(const libMesh::System &, const std::string &expression)
static libMesh::ZeroFunction< libMesh::Number > to_zero()
static libMesh::ParsedFEMFunction< libMesh::Number > to_parsed(const libMesh::System &system, const std::string &expression)
libMesh::CompositeFEMFunction< libMesh::Number > to_composite

Generated on Tue Dec 19 2017 12:47:27 for GRINS-0.8.0 by  doxygen 1.8.9.1