OOFEM  2.4 OOFEM.org - Object Oriented Finite Element Solver
constantfunction.h
Go to the documentation of this file.
1 /*
2  *
3  * ##### ##### ###### ###### ### ###
4  * ## ## ## ## ## ## ## ### ##
5  * ## ## ## ## #### #### ## # ##
6  * ## ## ## ## ## ## ## ##
7  * ## ## ## ## ## ## ## ##
8  * ##### ##### ## ###### ## ##
9  *
10  *
11  * OOFEM : Object Oriented Finite Element Code
12  *
13  * Copyright (C) 1993 - 2013 Borek Patzak
14  *
15  *
16  *
17  * Czech Technical University, Faculty of Civil Engineering,
18  * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19  *
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
23  * version 2.1 of the License, or (at your option) any later version.
24  *
25  * This program is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34
35 #ifndef constantfunction_h
36 #define constantfunction_h
37
38 #include "function.h"
39
40 #define _IFT_ConstantFunction_Name "constantfunction"
41 #define _IFT_ConstantFunction_f "f(t)"
42
43 namespace oofem {
47 class OOFEM_EXPORT ConstantFunction : public Function
48 {
49 private:
51  double value;
52
53 public:
59  ConstantFunction(int i, Domain * d) : Function(i, d) {
60  value = 0;
61  }
63  virtual ~ConstantFunction() { }
64
66  double giveValue() { return value; }
67
68  virtual void evaluate(FloatArray &answer, const std :: map< std :: string, FunctionArgument > &valDict, GaussPoint *gp=NULL, double param=0.) { answer = FloatArray{this->giveValue()}; }
69  virtual double evaluateAtTime(double t) { return this->giveValue(); }
70  virtual double evaluateVelocityAtTime(double t) { return 0.; }
71  virtual double evaluateAccelerationAtTime(double t) { return 0.; }
72
73  virtual IRResultType initializeFrom(InputRecord *ir);
74  virtual void giveInputRecord(DynamicInputRecord &input);
75
76  virtual const char *giveClassName() const { return "ConstantFunction"; }
77  virtual const char *giveInputRecordName() const { return _IFT_ConstantFunction_Name; }
78 };
79 } // end namespace oofem
80 #endif // constantfunction_h
Class and object Domain.
Definition: domain.h:115
virtual void evaluate(FloatArray &answer, const std::map< std::string, FunctionArgument > &valDict, GaussPoint *gp=NULL, double param=0.)
Returns the value of the function for given input.
#define _IFT_ConstantFunction_Name
virtual const char * giveInputRecordName() const
virtual const char * giveClassName() const
virtual double evaluateAtTime(double t)
Returns the value of the function at given time.
virtual double evaluateAccelerationAtTime(double t)
Returns the second time derivative of the function at given time.
virtual ~ConstantFunction()
Destructor.
Class representing vector of real numbers.
Definition: floatarray.h:82
Abstract base class representing a function with vector input and output.
Definition: function.h:88
IRResultType
Type defining the return values of InputRecord reading operations.
Definition: irresulttype.h:47
Class representing the general Input Record.
Definition: inputrecord.h:101
virtual double evaluateVelocityAtTime(double t)
Returns the first time derivative of the function at given time.
ConstantFunction(int i, Domain *d)
Constructor.
Class representing the a dynamic Input Record.
double value