OOFEM  2.4
OOFEM.org - Object Oriented Finite Element Solver
pythonexpression.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
22  * License as published by the Free Software Foundation; either
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 pythonexpression_h
36 #define pythonexpression_h
37 
38 #include "function.h"
39 
40 #ifndef PyObject_HEAD
41 struct _object;
42 typedef _object PyObject;
43 #endif
44 
46 
47 #define _IFT_PythonExpression_Name "pythonexpression"
48 #define _IFT_PythonExpression_f "f"
49 #define _IFT_PythonExpression_dfdt "dfdt"
50 #define _IFT_PythonExpression_d2fdt2 "d2fdt2"
51 
52 
53 
54 namespace oofem {
58 class OOFEM_EXPORT PythonExpression : public Function
59 {
60 private:
62  std :: string fExpression;
64  std :: string dfdtExpression;
66  std :: string d2fdt2Expression;
67 
71 
73 
75  PyObject *getDict(std :: map< std :: string, FunctionArgument > &valDict);
77  void getArray(FloatArray &answer, PyObject *func, std :: map< std :: string, FunctionArgument > &valDict);
79  double getScalar(PyObject *func, double time);
80 
81 public:
87  PythonExpression(int n, Domain * d);
89  virtual ~PythonExpression();
90 
97  virtual IRResultType initializeFrom(InputRecord *ir);
98  virtual void giveInputRecord(DynamicInputRecord &ir);
99 
100  virtual void evaluate(FloatArray &answer, std :: map< std :: string, FunctionArgument > &valDict);
101  virtual void evaluateVelocity(FloatArray &answer, std :: map< std :: string, FunctionArgument > &valDict);
102  virtual void evaluateAcceleration(FloatArray &answer, std :: map< std :: string, FunctionArgument > &valDict);
103  virtual double evaluateAtTime(double t);
104  virtual double evaluateVelocityAtTime(double t);
105  virtual double evaluateAccelerationAtTime(double t);
106 
107  virtual const char *giveClassName() const { return "PythonExpression"; }
108  virtual const char *giveInputRecordName() const { return _IFT_PythonExpression_Name; }
109 };
110 } // end namespace oofem
111 #endif // pythonexpression_h
Class and object Domain.
Definition: domain.h:115
virtual const char * giveInputRecordName() const
_object PyObject
std::string dfdtExpression
Expression for first time derivative.
#define _IFT_PythonExpression_Name
std::string fExpression
Expression for the function value.
std::string d2fdt2Expression
Expression for second time derivative.
virtual const char * giveClassName() const
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 user defined functions as Python expressions.
Class representing the general Input Record.
Definition: inputrecord.h:101
Class representing the a dynamic Input Record.
the oofem namespace is to define a context or scope in which all oofem names are defined.

This page is part of the OOFEM documentation. Copyright (c) 2011 Borek Patzak
Project e-mail: info@oofem.org
Generated at Tue Jan 2 2018 20:07:30 for OOFEM by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2011