Tissue Forge C++ 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfTimeEventPy.h
Go to the documentation of this file.
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
25#ifndef _SOURCE_LANGS_PY_TFTIMEEVENTPY_H_
26#define _SOURCE_LANGS_PY_TFTIMEEVENTPY_H_
27
28#include "tf_py.h"
29
30#include "tfEventPyExecutor.h"
31
32#include <event/tfTimeEvent.h>
33
34
35namespace TissueForge {
36
37
38 namespace py {
39
40
41 struct TimeEventPy;
42
44 HRESULT _result = 0;
45 };
46
48 HRESULT _result = 0;
49 };
50
51 struct CAPI_EXPORT TimeEventPy : event::EventBase {
55 FloatP_t next_time;
56
60 FloatP_t period;
61
65 FloatP_t start_time;
66
70 FloatP_t end_time;
71
73 const FloatP_t &period,
74 TimeEventPyInvokePyExecutor *invokeExecutor,
75 TimeEventPyPredicatePyExecutor *predicateExecutor=NULL,
76 event::TimeEventNextTimeSetter *nextTimeSetter=NULL,
77 const FloatP_t &start_time=0,
78 const FloatP_t &end_time=-1
79 ) :
80 event::EventBase(),
81 period(period),
82 invokeExecutor(invokeExecutor),
83 predicateExecutor(predicateExecutor),
84 nextTimeSetter(nextTimeSetter),
85 next_time(start_time),
86 start_time(start_time),
87 end_time(end_time > 0 ? end_time : std::numeric_limits<FloatP_t>::max())
88 {}
90
93 HRESULT eval(const FloatP_t &time);
94
95 protected:
96
97 FloatP_t getNextTime(const FloatP_t &current_time);
98
99 private:
100 TimeEventPyInvokePyExecutor *invokeExecutor;
101 TimeEventPyPredicatePyExecutor *predicateExecutor;
102 event::TimeEventNextTimeSetter *nextTimeSetter;
103 };
104
106
119 const FloatP_t &period,
120 TimeEventPyInvokePyExecutor *invokeExecutor,
121 TimeEventPyPredicatePyExecutor *predicateExecutor=NULL,
122 const std::string &distribution="default",
123 const FloatP_t &start_time=0,
124 const FloatP_t &end_time=-1
125 );
126
127}};
128
129#endif // _SOURCE_LANGS_PY_TFTIMEEVENTPY_H_
TimeEventPy * onTimeEvent(const FloatP_t &period, TimeEventPyInvokePyExecutor *invokeExecutor, TimeEventPyPredicatePyExecutor *predicateExecutor=NULL, const std::string &distribution="default", const FloatP_t &start_time=0, const FloatP_t &end_time=-1)
Creates a time-dependent event using prescribed invoke and predicate python function executors.
Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
Definition tfAngleConfig.h:26
Definition tfEvent.h:45
Definition tfEventList.h:59
Definition tfEventPyExecutor.h:33
Definition tfTimeEventPy.h:51
FloatP_t period
Period of evaluation.
Definition tfTimeEventPy.h:60
FloatP_t end_time
End time of evaluations.
Definition tfTimeEventPy.h:70
FloatP_t start_time
Start time of evaluations.
Definition tfTimeEventPy.h:65
FloatP_t next_time
Next time of evaluation.
Definition tfTimeEventPy.h:55
int32_t HRESULT
Definition tf_port.h:255