MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
inputsoutputs.c
1 /*
2 
3  ooo ooooo oooooooooo. ooooo ooo
4  `88. .888' `888' `Y8b `888b. `8'
5  888b d'888 .ooooo. 888 888 .ooooo. 8 `88b. 8 .oooo.
6  8 Y88. .P 888 d88' `88b 888 888 d88' `88b 8 `88b. 8 `P )88b
7  8 `888' 888 888 888 888 888 888ooo888 8 `88b.8 .oP"888
8  8 Y 888 888 888 888 d88' 888 .o 8 `888 d8( 888
9  o8o o888o `Y8bod8P' o888bood8P' `Y8bod8P' o8o `8 `Y888""8o
10 
11 Copyright
12  2014-2016 MoDeNa Consortium, All rights reserved.
13 
14 License
15  This file is part of Modena.
16 
17  The Modena interface library is free software; you can redistribute it
18  and/or modify it under the terms of the GNU Lesser General Public License
19  as published by the Free Software Foundation, either version 3 of the
20  License, or (at your option) any later version.
21 
22  Modena is distributed in the hope that it will be useful, but WITHOUT ANY
23  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
24  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
25  details.
26 
27  You should have received a copy of the GNU General Public License along
28  with Modena. If not, see <http://www.gnu.org/licenses/>.
29 */
30 
31 #include "global.h"
32 
33 #undef __INLINE_H__
34 #define __INLINE_H__ /* first, ignore the gsl_inline.h header file */
35 
36 #undef INLINE_DECL
37 #define INLINE_DECL /* disable inline in declarations */
38 
39 #undef INLINE_FUN
40 #define INLINE_FUN /* disable inline in definitions */
41 
42 #ifndef HAVE_INLINE /* enable compilation of definitions in .h files */
43 #define HAVE_INLINE
44 #endif
45 
46 #include "inputsoutputs.h"
47 
48 #ifdef HAVE_INLINE /* disable compilation of definitions in .h files */
49 #undef HAVE_INLINE
50 #endif
51 
52 #include "model.h"
53 
55 {
56  return malloc(sizeof(modena_siunits_t));
57 }
58 
59 void modena_siunits_destroy(modena_siunits_t *self)
60 {
61  free(self);
62 }
63 
64 modena_inputs_t *modena_inputs_new(const modena_model_t *self)
65 {
66  modena_inputs_t *i = malloc(sizeof(modena_inputs_t));
67  i->inputs = malloc(self->inputs_internal_size*sizeof(double));
68  return i;
69 }
70 
71 modena_outputs_t *modena_outputs_new(const modena_model_t *self)
72 {
73  modena_outputs_t *o = malloc(sizeof(modena_outputs_t));
74  o->outputs = malloc(self->outputs_size*sizeof(double));
75  return o;
76 }
77 
78 void modena_inputs_destroy(modena_inputs_t *self)
79 {
80  free(self->inputs);
81  free(self);
82 }
83 
84 void modena_outputs_destroy(modena_outputs_t *self)
85 {
86  free(self->outputs);
87  free(self);
88 }
89 
stores a surrogate model
Definition: model.h:94
modena_siunits_t * modena_siunits_new()
Definition: inputsoutputs.c:54