Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfForcePy.h
1/*******************************************************************************
2 * This file is part of Tissue Forge.
3 * Copyright (c) 2022-2024 T.J. Sego
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program 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
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 ******************************************************************************/
19
20#ifndef _SOURCE_LANGS_PY_TFFORCEPY_H_
21#define _SOURCE_LANGS_PY_TFFORCEPY_H_
22
23
24#include "tf_py.h"
25#include <tfForce.h>
26
27
28namespace TissueForge {
29
30
31 namespace py {
32
33
34 struct CAPI_EXPORT CustomForcePy : CustomForce {
35 PyObject *callable;
36
38 CustomForcePy(const FVector3 &f, const FloatP_t &period=std::numeric_limits<FloatP_t>::max());
39
46 CustomForcePy(PyObject *f, const FloatP_t &period=std::numeric_limits<FloatP_t>::max());
47 virtual ~CustomForcePy();
48
49 void onTime(FloatP_t time);
50 FVector3 getValue();
51
52 void setValue(PyObject *_userFunc=NULL);
53
63
64 };
65
66 };
67
68
69 namespace io {
70
71
72 template <>
73 HRESULT toFile(const py::CustomForcePy &dataElement, const MetaData &metaData, IOElement &fileElement);
74
75 template <>
76 HRESULT fromFile(const IOElement &fileElement, const MetaData &metaData, py::CustomForcePy *dataElement);
77
78}};
79
80#endif // _SOURCE_LANGS_PY_TFFORCEPY_H_
HRESULT toFile(const T &dataElement, const MetaData &metaData, IOElement &fileElement)
Convert an object to an intermediate I/O object.
HRESULT fromFile(const IOElement &fileElement, const MetaData &metaData, T *dataElement)
Instantiate an object from an intermediate I/O object.
Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
Definition tfAngleConfig.h:26
A custom force function.
Definition tfForce.h:200
Force is a metatype, in that Tissue Forge has lots of different instances of force functions,...
Definition tfForce.h:69
Definition tfForcePy.h:34
CustomForcePy(PyObject *f, const FloatP_t &period=std::numeric_limits< FloatP_t >::max())
Creates an instance from an underlying custom python function.
static CustomForcePy * fromForce(Force *f)
Convert basic force to CustomForcePy.
int32_t HRESULT
Definition tf_port.h:255