MAST3
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
material_conductance.hpp
Go to the documentation of this file.
1 /*
2 * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3 * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19 
20 #ifndef __mast_isotropic_material_conductance_h__
21 #define __mast_isotropic_material_conductance_h__
22 
23 // MAST includes
25 #include <mast/base/exceptions.hpp>
26 
27 namespace MAST {
28 namespace Physics {
29 namespace Conduction {
30 
31 
32 template <typename ScalarType, typename ConductanceType, typename ContextType>
34 public:
35 
36  using scalar_t = typename ConductanceType::scalar_t;
37  using value_t = scalar_t;
38  using is_isotropic = std::true_type;
39  using is_linear = std::true_type;
40 
42  _k (nullptr) { }
43 
45 
46  inline void set_conductance(const ConductanceType& k) {
47 
48  _k = &k;
49  }
50 
51 
52  inline const ConductanceType& get_k() const {return *_k;}
53 
54  inline void value(ContextType& c, value_t& m) const {
55 
56  Assert0(_k, "Material values not provided");
57 
58  m = _k->value(c);
59  }
60 
61 
62  template <typename ScalarFieldType>
63  inline void derivative(ContextType& c,
64  const ScalarFieldType& f,
65  value_t& m) const {
66 
67  Assert0(_k, "Material values not provided");
68 
69  m = _k->derivative(c, f);
70  }
71 
72 private:
73 
74  const ConductanceType* _k;
75 };
76 
77 
78 
79 
80 } // namespace Conductance
81 } // namespace Physics
82 } // namespace MAST
83 
84 
85 #endif // __mast_isotropic_material_conductance_h__
#define Assert0(cond, msg)
Definition: exceptions.hpp:134
void derivative(ContextType &c, const ScalarFieldType &f, value_t &m) const