MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
model.h
Go to the documentation of this file.
1 
40 #ifndef __MODEL_H__
41 #define __MODEL_H__
42 
43 #include "Python.h"
44 #include <stdbool.h>
45 #include "function.h"
46 #include "inputsoutputs.h"
47 
48 #undef __BEGIN_DECLS
49 #undef __END_DECLS
50 #ifdef __cplusplus
51 # define __BEGIN_DECLS extern "C" {
52 # define __END_DECLS }
53 #else
54 # define __BEGIN_DECLS /* empty */
55 # define __END_DECLS /* empty */
56 #endif
57 
58 __BEGIN_DECLS
59 
60 extern PyTypeObject modena_model_tType;
61 
62 extern PyObject *modena_SurrogateModel;
63 
73 {
74  struct modena_model_t *model;
75 
76  modena_inputs_t *inputs;
77 
78  modena_outputs_t *outputs;
79 
80  size_t map_inputs_size;
81 
82  size_t *map_inputs;
83 
84  size_t map_outputs_size;
85 
86  size_t *map_outputs;
87 
89 
94 typedef struct modena_model_t
95 {
96  PyObject_HEAD
97 
98  PyObject *pModel;
100  size_t outputs_size;
102  size_t inputs_size;
106  double *inputs_min;
108  double *inputs_max;
110  bool *argPos_used;
114  double *parameters;
118  void (*function)
119  (
120  const struct modena_model_t* model,
121  const double* i,
122  double *o
123  );
129  char** inputs_names;
130  char** outputs_names;
134 
259 (
260  const char *modelId
261 );
262 
274 (
275  const modena_model_t *self,
276  const char *name
277 );
278 
284 void modena_model_argPos_check(const modena_model_t *self);
285 
297 (
298  const modena_model_t *self,
299  const char *name
300 );
301 
310 (
311  const modena_model_t *self
312 );
313 
322 (
323  const modena_model_t *self
324 );
325 
334 (
335  const modena_model_t *self
336 );
337 
343 size_t modena_model_inputs_size(const modena_model_t *self);
344 
350 size_t modena_model_outputs_size(const modena_model_t *self);
351 
357 size_t modena_model_parameters_size(const modena_model_t *self);
358 
359 void modena_model_inputs_siunits
360 (
361  const modena_model_t *self,
362  const size_t i,
363  modena_siunits_t *units
364 );
365 
366 void modena_model_outputs_siunits
367 (
368  const modena_model_t *self,
369  const size_t i,
370  modena_siunits_t *units
371 );
372 
386 (
388  modena_inputs_t *inputs,
389  modena_outputs_t *outputs
390 );
391 
400 (
402  modena_inputs_t *inputs,
403  modena_outputs_t *outputs
404 );
405 
412  // end of C_interface_library
414 
415 __END_DECLS
416 
417 #endif /* __MODEL_H__ */
418 
double * parameters
Definition: model.h:114
struct modena_model_t modena_model_t
stores a surrogate model
char ** modena_model_parameters_names(const modena_model_t *self)
Function returning the names of the parameters.
Definition: model.c:442
char ** modena_model_inputs_names(const modena_model_t *self)
Function returning the names of the inputs.
Definition: model.c:432
size_t inputs_size
Definition: model.h:102
size_t modena_model_inputs_argPos(const modena_model_t *self, const char *name)
Function determining position of an argument in the input vector.
Definition: model.c:366
bool * argPos_used
Definition: model.h:110
size_t modena_model_inputs_size(const modena_model_t *self)
Function returning the size of the input vector.
Definition: model.c:447
size_t modena_model_outputs_size(const modena_model_t *self)
Function returning the size of the output vector.
Definition: model.c:452
size_t substituteModels_size
Definition: model.h:125
modena_model_t * modena_model_new(const char *modelId)
Function fetching a surrogate model from MongoDB.
Definition: model.c:281
struct modena_function_t * mf
Definition: model.h:116
PyObject_HEAD PyObject * pModel
Definition: model.h:98
struct modena_substitute_model_t modena_substitute_model_t
stores a model and mapping for substitution
char ** parameters_names
Definition: model.h:131
int modena_model_call(modena_model_t *model, modena_inputs_t *inputs, modena_outputs_t *outputs)
Function calling the surrogate model and checking for errors.
Definition: model.c:553
double * inputs_min
Definition: model.h:106
void modena_model_call_no_check(modena_model_t *model, modena_inputs_t *inputs, modena_outputs_t *outputs)
Function calling the surrogate model w/o checking for errors.
Definition: model.c:615
char ** inputs_names
Definition: model.h:129
stores a surrogate model
Definition: model.h:94
void modena_model_destroy(modena_model_t *model)
Function deallocating the memory allocated for the surrogate model.
Definition: model.c:665
Definition: model.f90:7
size_t modena_model_parameters_size(const modena_model_t *self)
Function returning the size of the parameter vector.
Definition: model.c:457
size_t modena_model_outputs_argPos(const modena_model_t *self, const char *name)
Function determining position of a result in the output vector.
Definition: model.c:392
char ** outputs_names
Definition: model.h:130
size_t parameters_size
Definition: model.h:112
size_t outputs_size
Definition: model.h:100
modena_substitute_model_t * substituteModels
Definition: model.h:127
size_t inputs_internal_size
Definition: model.h:104
void modena_model_argPos_check(const modena_model_t *self)
Function checking that the user has queried all input positions.
Definition: model.c:408
stores a model and mapping for substitution
Definition: model.h:72
char ** modena_model_outputs_names(const modena_model_t *self)
Function returning the names of the outputs.
Definition: model.c:437
double * inputs_max
Definition: model.h:108