MAST
constant_field_function.cpp
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2019 Manav Bhatia
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 // MAST includes
22 #include "base/parameter.h"
23 
24 
25 
27 ConstantFieldFunction(const std::string& nm,
28  const MAST::Parameter& p):
29 MAST::FieldFunction<Real>(nm),
30 _p(p) {
31 
32  _functions.insert(&p);
33 }
34 
35 
37 
38 }
39 
40 
41 
42 
43 void
45 
46  v = _p();
47 }
48 
49 
50 
51 
52 void
54  Real& v) const {
55 
56  v = _p.depends_on(f)?1:0;
57 }
58 
59 
60 
61 
62 void
64  const Real t,
65  Real& v) const {
66  v = _p();
67 }
68 
69 
70 
71 
72 void
74  const libMesh::Point& p,
75  const Real t,
76  Real& v) const {
77 
78  v = _p.depends_on(f)?1:0;
79 }
80 
virtual void derivative(const MAST::FunctionBase &f, Real &v) const
calculates the value of the function at the specified point, p, and time, t, and returns it in v...
This is a scalar function whose value can be changed and one that can be used as a design variable in...
Definition: parameter.h:35
std::set< const MAST::FunctionBase * > _functions
set of functions that this function depends on
libMesh::Real Real
virtual void operator()(Real &v) const
calculates the value of the function at the specified point, p, and time, t, and returns it in v...
virtual bool depends_on(const MAST::FunctionBase &f) const
Definition: parameter.h:86
const MAST::Parameter & _p
parameter which defines this field function
This creates the base class for functions that have a saptial and temporal dependence, and provide sensitivity operations with respect to the functions and parameters.
ConstantFieldFunction(const std::string &nm, const MAST::Parameter &p)