Tissue Forge C 0.2.1
Interactive, particle-based physics, chemistry and biology modeling and simulation environment
Loading...
Searching...
No Matches
tfCForce.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 _WRAPS_C_TFCFORCE_H_
26#define _WRAPS_C_TFCFORCE_H_
27
28#include "tf_port_c.h"
29
30typedef void (*tfUserForceFuncTypeHandleFcn)(struct tfCustomForceHandle*, tfFloatP_t*);
31
32// Handles
33
38struct CAPI_EXPORT tfFORCE_TYPEHandle {
39 unsigned int FORCE_FORCE;
40 unsigned int FORCE_BERENDSEN;
41 unsigned int FORCE_GAUSSIAN;
42 unsigned int FORCE_FRICTION;
43 unsigned int FORCE_SUM;
44 unsigned int FORCE_CUSTOM;
45};
46
51struct CAPI_EXPORT tfUserForceFuncTypeHandle {
52 void *tfObj;
53};
54
59struct CAPI_EXPORT tfForceHandle {
60 void *tfObj;
61};
62
67struct CAPI_EXPORT tfForceSumHandle {
68 void *tfObj;
69};
70
75struct CAPI_EXPORT tfCustomForceHandle {
76 void *tfObj;
77};
78
83struct CAPI_EXPORT tfBerendsenHandle {
84 void *tfObj;
85};
86
91struct CAPI_EXPORT tfGaussianHandle {
92 void *tfObj;
93};
94
99struct CAPI_EXPORT tfFrictionHandle {
100 void *tfObj;
101};
102
103
105// FORCE_TYPE //
107
108
115CAPI_FUNC(HRESULT) tfFORCE_TYPE_init(struct tfFORCE_TYPEHandle *handle);
116
117
119// UserForceFuncType //
121
122
130CAPI_FUNC(HRESULT) tfForce_EvalFcn_init(struct tfUserForceFuncTypeHandle *handle, tfUserForceFuncTypeHandleFcn *fcn);
131
138CAPI_FUNC(HRESULT) tfForce_EvalFcn_destroy(struct tfUserForceFuncTypeHandle *handle);
139
140
142// Force //
144
152CAPI_FUNC(HRESULT) tfForce_getType(struct tfForceHandle *handle, unsigned int *te);
153
164CAPI_FUNC(HRESULT) tfForce_bind_species(struct tfForceHandle *handle, struct tfParticleTypeHandle *a_type, const char *coupling_symbol);
165
174CAPI_FUNC(HRESULT) tfForce_toString(struct tfForceHandle *handle, char **str, unsigned int *numChars);
175
183CAPI_FUNC(HRESULT) tfForce_fromString(struct tfForceHandle *handle, const char *str);
184
191CAPI_FUNC(HRESULT) tfForce_destroy(struct tfForceHandle *handle);
192
193
195// ForceSum //
197
198
206CAPI_FUNC(HRESULT) tfForceSum_checkType(struct tfForceHandle *handle, bool *isType);
207
215CAPI_FUNC(HRESULT) tfForceSum_toBase(struct tfForceSumHandle *handle, struct tfForceHandle *baseHandle);
216
224CAPI_FUNC(HRESULT) tfForceSum_fromBase(struct tfForceHandle *baseHandle, struct tfForceSumHandle *handle);
225
234CAPI_FUNC(HRESULT) tfForceSum_getConstituents(struct tfForceSumHandle *handle, struct tfForceHandle *f1, struct tfForceHandle *f2);
235
236
238// CustomForce //
240
241
250CAPI_FUNC(HRESULT) tfCustomForce_init(struct tfCustomForceHandle *handle, struct tfUserForceFuncTypeHandle *func, tfFloatP_t period);
251
259CAPI_FUNC(HRESULT) tfCustomForce_checkType(struct tfForceHandle *handle, bool *isType);
260
268CAPI_FUNC(HRESULT) tfCustomForce_toBase(struct tfCustomForceHandle *handle, struct tfForceHandle *baseHandle);
269
277CAPI_FUNC(HRESULT) tfCustomForce_fromBase(struct tfForceHandle *baseHandle, struct tfCustomForceHandle *handle);
278
286CAPI_FUNC(HRESULT) tfCustomForce_getPeriod(struct tfCustomForceHandle *handle, tfFloatP_t *period);
287
295CAPI_FUNC(HRESULT) tfCustomForce_setPeriod(struct tfCustomForceHandle *handle, tfFloatP_t period);
296
304CAPI_FUNC(HRESULT) tfCustomForce_setFunction(struct tfCustomForceHandle *handle, struct tfUserForceFuncTypeHandle *fcn);
305
313CAPI_FUNC(HRESULT) tfCustomForce_getValue(struct tfCustomForceHandle *handle, tfFloatP_t **force);
314
322CAPI_FUNC(HRESULT) tfCustomForce_setValue(struct tfCustomForceHandle *handle, tfFloatP_t *force);
323
331CAPI_FUNC(HRESULT) tfCustomForce_getLastUpdate(struct tfCustomForceHandle *handle, tfFloatP_t *lastUpdate);
332
333
335// Berendsen //
337
367CAPI_FUNC(HRESULT) tfBerendsen_init(struct tfBerendsenHandle *handle, tfFloatP_t tau);
368
376CAPI_FUNC(HRESULT) tfBerendsen_checkType(struct tfForceHandle *handle, bool *isType);
377
385CAPI_FUNC(HRESULT) tfBerendsen_toBase(struct tfBerendsenHandle *handle, struct tfForceHandle *baseHandle);
386
394CAPI_FUNC(HRESULT) tfBerendsen_fromBase(struct tfForceHandle *baseHandle, struct tfBerendsenHandle *handle);
395
403CAPI_FUNC(HRESULT) tfBerendsen_getTimeConstant(struct tfBerendsenHandle *handle, tfFloatP_t *tau);
404
412CAPI_FUNC(HRESULT) tfBerendsen_setTimeConstant(struct tfBerendsenHandle *handle, tfFloatP_t tau);
413
414
416// Gaussian //
418
434CAPI_FUNC(HRESULT) tfGaussian_init(struct tfGaussianHandle *handle, tfFloatP_t std, tfFloatP_t mean, tfFloatP_t duration);
435
443CAPI_FUNC(HRESULT) tfGaussian_checkType(struct tfForceHandle *handle, bool *isType);
444
452CAPI_FUNC(HRESULT) tfGaussian_toBase(struct tfGaussianHandle *handle, struct tfForceHandle *baseHandle);
453
461CAPI_FUNC(HRESULT) tfGaussian_fromBase(struct tfForceHandle *baseHandle, struct tfGaussianHandle *handle);
462
470CAPI_FUNC(HRESULT) tfGaussian_getStd(struct tfGaussianHandle *handle, tfFloatP_t *std);
471
479CAPI_FUNC(HRESULT) tfGaussian_setStd(struct tfGaussianHandle *handle, tfFloatP_t std);
480
488CAPI_FUNC(HRESULT) tfGaussian_getMean(struct tfGaussianHandle *handle, tfFloatP_t *mean);
489
497CAPI_FUNC(HRESULT) tfGaussian_setMean(struct tfGaussianHandle *handle, tfFloatP_t mean);
498
506CAPI_FUNC(HRESULT) tfGaussian_getDuration(struct tfGaussianHandle *handle, tfFloatP_t *duration);
507
515CAPI_FUNC(HRESULT) tfGaussian_setDuration(struct tfGaussianHandle *handle, tfFloatP_t duration);
516
517
519// Friction //
521
522
540CAPI_FUNC(HRESULT) tfFriction_init(struct tfFrictionHandle *handle, tfFloatP_t coeff);
541
549CAPI_FUNC(HRESULT) tfFriction_checkType(struct tfForceHandle *handle, bool *isType);
550
558CAPI_FUNC(HRESULT) tfFriction_toBase(struct tfFrictionHandle *handle, struct tfForceHandle *baseHandle);
559
567CAPI_FUNC(HRESULT) tfFriction_fromBase(struct tfForceHandle *baseHandle, struct tfFrictionHandle *handle);
568
576CAPI_FUNC(HRESULT) tfFriction_getCoef(struct tfFrictionHandle *handle, tfFloatP_t *coef);
577
585CAPI_FUNC(HRESULT) tfFriction_setCoef(struct tfFrictionHandle *handle, tfFloatP_t coef);
586
587
589// Module functions //
591
592
601CAPI_FUNC(HRESULT) tfForce_add(struct tfForceHandle *f1, struct tfForceHandle *f2, struct tfForceSumHandle *fSum);
602
603
604#endif // _WRAPS_C_TFCFORCE_H_
Handle to a Berendsen instance.
Definition tfCForce.h:83
Handle to a CustomForce instance.
Definition tfCForce.h:75
Handle to a FORCE_TYPE instance.
Definition tfCForce.h:38
Handle to a Force instance.
Definition tfCForce.h:59
Handle to a ForceSum instance.
Definition tfCForce.h:67
Handle to a Friction instance.
Definition tfCForce.h:99
Handle to a Gaussian instance.
Definition tfCForce.h:91
Handle to a ParticleType instance.
Definition tfCParticle.h:119
Handle to a UserForceFuncType instance.
Definition tfCForce.h:51
HRESULT tfForce_toString(struct tfForceHandle *handle, char **str, unsigned int *numChars)
Get a JSON string representation.
HRESULT tfBerendsen_init(struct tfBerendsenHandle *handle, tfFloatP_t tau)
Creates a Berendsen thermostat.
HRESULT tfForce_getType(struct tfForceHandle *handle, unsigned int *te)
Get the force type.
HRESULT tfForce_EvalFcn_init(struct tfUserForceFuncTypeHandle *handle, tfUserForceFuncTypeHandleFcn *fcn)
Initialize an instance.
HRESULT tfForce_bind_species(struct tfForceHandle *handle, struct tfParticleTypeHandle *a_type, const char *coupling_symbol)
Bind a force to a species.
HRESULT tfForce_fromString(struct tfForceHandle *handle, const char *str)
Create from a JSON string representation.
HRESULT tfCustomForce_setPeriod(struct tfCustomForceHandle *handle, tfFloatP_t period)
Set force period.
HRESULT tfCustomForce_getPeriod(struct tfCustomForceHandle *handle, tfFloatP_t *period)
Get force period.
HRESULT tfCustomForce_setValue(struct tfCustomForceHandle *handle, tfFloatP_t *force)
Set current force value.
HRESULT tfFriction_fromBase(struct tfForceHandle *baseHandle, struct tfFrictionHandle *handle)
Cast from base force. Fails if instance is not of this type.
HRESULT tfCustomForce_setFunction(struct tfCustomForceHandle *handle, struct tfUserForceFuncTypeHandle *fcn)
Set force function.
HRESULT tfForce_EvalFcn_destroy(struct tfUserForceFuncTypeHandle *handle)
Destroy an instance.
HRESULT tfCustomForce_checkType(struct tfForceHandle *handle, bool *isType)
Check whether a base handle is of this force type.
HRESULT tfCustomForce_init(struct tfCustomForceHandle *handle, struct tfUserForceFuncTypeHandle *func, tfFloatP_t period)
Create a custom force with a force function.
HRESULT tfGaussian_setMean(struct tfGaussianHandle *handle, tfFloatP_t mean)
Set the magnitude mean.
HRESULT tfBerendsen_getTimeConstant(struct tfBerendsenHandle *handle, tfFloatP_t *tau)
Get the time constant.
HRESULT tfGaussian_toBase(struct tfGaussianHandle *handle, struct tfForceHandle *baseHandle)
Cast to base force.
HRESULT tfFriction_toBase(struct tfFrictionHandle *handle, struct tfForceHandle *baseHandle)
Cast to base force.
HRESULT tfFORCE_TYPE_init(struct tfFORCE_TYPEHandle *handle)
Initialize an instance.
HRESULT tfCustomForce_toBase(struct tfCustomForceHandle *handle, struct tfForceHandle *baseHandle)
Cast to base force.
HRESULT tfGaussian_init(struct tfGaussianHandle *handle, tfFloatP_t std, tfFloatP_t mean, tfFloatP_t duration)
Creates a random force.
HRESULT tfFriction_getCoef(struct tfFrictionHandle *handle, tfFloatP_t *coef)
Get the friction coefficient.
HRESULT tfForce_destroy(struct tfForceHandle *handle)
Destroy an instance.
HRESULT tfBerendsen_fromBase(struct tfForceHandle *baseHandle, struct tfBerendsenHandle *handle)
Cast from base force. Fails if instance is not of this type.
HRESULT tfForceSum_checkType(struct tfForceHandle *handle, bool *isType)
Check whether a base handle is of this force type.
HRESULT tfGaussian_getStd(struct tfGaussianHandle *handle, tfFloatP_t *std)
Get the magnitude standard deviation.
HRESULT tfGaussian_setStd(struct tfGaussianHandle *handle, tfFloatP_t std)
Set the magnitude standard deviation.
HRESULT tfCustomForce_fromBase(struct tfForceHandle *baseHandle, struct tfCustomForceHandle *handle)
Cast from base force. Fails if instance is not of this type.
HRESULT tfFriction_checkType(struct tfForceHandle *handle, bool *isType)
Check whether a base handle is of this force type.
HRESULT tfGaussian_getDuration(struct tfGaussianHandle *handle, tfFloatP_t *duration)
Get the magnitude duration.
HRESULT tfCustomForce_getValue(struct tfCustomForceHandle *handle, tfFloatP_t **force)
Get current force value.
HRESULT tfGaussian_checkType(struct tfForceHandle *handle, bool *isType)
Check whether a base handle is of this force type.
HRESULT tfGaussian_setDuration(struct tfGaussianHandle *handle, tfFloatP_t duration)
Set the magnitude duration.
HRESULT tfFriction_init(struct tfFrictionHandle *handle, tfFloatP_t coeff)
Creates a friction force.
HRESULT tfFriction_setCoef(struct tfFrictionHandle *handle, tfFloatP_t coef)
Set the friction coefficient.
HRESULT tfForceSum_toBase(struct tfForceSumHandle *handle, struct tfForceHandle *baseHandle)
Cast to base force.
HRESULT tfForceSum_getConstituents(struct tfForceSumHandle *handle, struct tfForceHandle *f1, struct tfForceHandle *f2)
Get the constituent forces.
HRESULT tfGaussian_fromBase(struct tfForceHandle *baseHandle, struct tfGaussianHandle *handle)
Cast from base force. Fails if instance is not of this type.
HRESULT tfBerendsen_setTimeConstant(struct tfBerendsenHandle *handle, tfFloatP_t tau)
Set the time constant.
HRESULT tfBerendsen_toBase(struct tfBerendsenHandle *handle, struct tfForceHandle *baseHandle)
Cast to base force.
HRESULT tfCustomForce_getLastUpdate(struct tfCustomForceHandle *handle, tfFloatP_t *lastUpdate)
Get time of last force update.
HRESULT tfGaussian_getMean(struct tfGaussianHandle *handle, tfFloatP_t *mean)
Get the magnitude mean.
HRESULT tfForceSum_fromBase(struct tfForceHandle *baseHandle, struct tfForceSumHandle *handle)
Cast from base force. Fails if instance is not of this type.
HRESULT tfForce_add(struct tfForceHandle *f1, struct tfForceHandle *f2, struct tfForceSumHandle *fSum)
Add two forces.
HRESULT tfBerendsen_checkType(struct tfForceHandle *handle, bool *isType)
Check whether a base handle is of this force type.