MAST
parameter.h
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 #ifndef __mast__parameter__
21 #define __mast__parameter__
22 
23 
24 // MAST includes
25 #include "base/function_base.h"
26 
27 
28 namespace MAST {
29 
35  class Parameter:
36  public MAST::FunctionBase {
37 
38  public:
39 
40  Parameter(const std::string& nm,
41  const Real& val):
42  MAST::FunctionBase(nm, false),
43  _val(new Real)
44  { *_val = val;}
45 
46 
48  MAST::FunctionBase(f),
49  _val(f._val)
50  { }
51 
52 
53  virtual ~Parameter() {
54 
55  delete _val;
56  }
57 
58 
63  return *_val;
64  }
65 
66 
70  Real operator() () const {
71  return *_val;
72  }
73 
74 
78  Real* ptr()
79  { return _val; }
80 
81 
82 
86  virtual bool depends_on(const MAST::FunctionBase& f) const {
87  if (&f == this)
88  return true;
89  else
90  return false;
91  }
92 
93 
94 
98  void operator =(const Real& val)
99  { *_val = val; }
100 
101 
102  protected:
103 
108  };
109 }
110 
111 #endif // __mast__parameter__
Real * _val
Pointer to the value of the parameter.
Definition: parameter.h:107
Real & operator()()
Definition: parameter.h:62
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
Parameter(const MAST::Parameter &f)
Definition: parameter.h:47
libMesh::Real Real
void operator=(const Real &val)
sets the value of this function
Definition: parameter.h:98
virtual ~Parameter()
Definition: parameter.h:53
virtual bool depends_on(const MAST::FunctionBase &f) const
Definition: parameter.h:86
Real * ptr()
Definition: parameter.h:78
Parameter(const std::string &nm, const Real &val)
Definition: parameter.h:40