MAST
field_function_base.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 
21 #ifndef __mast__field_function_base__
22 #define __mast__field_function_base__
23 
24 // C++ includes
25 #include <memory>
26 
27 // MAST includes
28 #include "base/function_base.h"
29 
30 // libMesh includes
31 #include "libmesh/point.h"
32 #include "libmesh/function_base.h"
33 
34 
35 namespace MAST {
36 
46  template <typename ValType>
47  class FieldFunction:
48  public MAST::FunctionBase {
49 
50  public:
51  FieldFunction(const std::string& nm):
52  MAST::FunctionBase(nm, true)
53  { }
54 
55 
59  virtual void operator() (ValType& v) const {
60 
61  libmesh_error(); // must be implemented in derived class
62  }
63 
64 
68  virtual void perturbation (ValType& v) const {
69 
70  libmesh_error(); // must be implemented in derived class
71  }
72 
73 
78  virtual void derivative (const MAST::FunctionBase& f,
79  ValType& v) const {
80 
81  libmesh_error(); // must be implemented in derived class
82  }
83 
84 
89  virtual void operator() (const libMesh::Point& p,
90  const Real t,
91  ValType& v) const {
92 
93  libmesh_error(); // must be implemented in derived class
94  }
95 
96 
102  virtual void perturbation (const libMesh::Point& p,
103  const Real t,
104  ValType& v) const {
105 
106  libmesh_error(); // must be implemented in derived class
107  }
108 
109 
115  virtual void derivative (const MAST::FunctionBase& f,
116  const libMesh::Point& p,
117  const Real t,
118  ValType& v) const {
119 
120  libmesh_error(); // must be implemented in derived class
121  }
122 
123  protected:
124 
125  };
126 }
127 
128 #endif // __mast__field_function_base__
virtual void perturbation(const libMesh::Point &p, const Real t, ValType &v) const
calculates the value of a perturbation in function at the specified point, p, and time...
virtual void operator()(ValType &v) const
calculates the value of the function and returns it in v.
libMesh::Real Real
FieldFunction(const std::string &nm)
virtual void perturbation(ValType &v) const
calculates the perturbation and returns it in v.
virtual void derivative(const MAST::FunctionBase &f, ValType &v) const
calculates the value of the function derivative and returns it in v.
virtual void derivative(const MAST::FunctionBase &f, const libMesh::Point &p, const Real t, ValType &v) const
calculates the value of the derivative of function with respect to the function f at the specified po...