MoDeNa  1.0
Software framework facilitating sequential multi-scale modelling
inputsoutputs.h
Go to the documentation of this file.
1 /*
2 @cond
3 
4  ooo ooooo oooooooooo. ooooo ooo
5  `88. .888' `888' `Y8b `888b. `8'
6  888b d'888 .ooooo. 888 888 .ooooo. 8 `88b. 8 .oooo.
7  8 Y88. .P 888 d88' `88b 888 888 d88' `88b 8 `88b. 8 `P )88b
8  8 `888' 888 888 888 888 888 888ooo888 8 `88b.8 .oP"888
9  8 Y 888 888 888 888 d88' 888 .o 8 `888 d8( 888
10  o8o o888o `Y8bod8P' o888bood8P' `Y8bod8P' o8o `8 `Y888""8o
11 
12 Copyright
13  2014-2016 MoDeNa Consortium, All rights reserved.
14 
15 License
16  This file is part of Modena.
17 
18  The Modena interface library is free software; you can redistribute it
19  and/or modify it under the terms of the GNU Lesser General Public License
20  as published by the Free Software Foundation, either version 3 of the
21  License, or (at your option) any later version.
22 
23  Modena is distributed in the hope that it will be useful, but WITHOUT ANY
24  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
25  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
26  details.
27 
28  You should have received a copy of the GNU General Public License along
29  with Modena. If not, see <http://www.gnu.org/licenses/>.
30 
31 @endcond
32 @file
33 
34 Low-level interface library
35 
36 @author Henrik Rusche
37 @copyright 2014-2016, MoDeNa Project. GNU Public License.
38 */
39 
40 #include "inline.h"
41 #include <stddef.h>
42 
43 #ifndef __INPUTSOUTPUTS_H__
44 #define __INPUTSOUTPUTS_H__
45 
46 #undef __BEGIN_DECLS
47 #undef __END_DECLS
48 #ifdef __cplusplus
49 # define __BEGIN_DECLS extern "C" {
50 # define __END_DECLS }
51 #else
52 # define __BEGIN_DECLS /* empty */
53 # define __END_DECLS /* empty */
54 #endif
55 
56 __BEGIN_DECLS
57 
63 // Forward declaration
64 struct modena_model_t;
65 
69 typedef struct
70 {
71  int exponents[6];
72 
74 
78 typedef struct
79 {
80  double *inputs;
81 
82  double *inherited_inputs;
83 
85 
89 typedef struct
90 {
91  double *outputs;
92 
94 
99 
100 int modena_siunits_get(const modena_siunits_t *self, const size_t i);
101 
102 void modena_siunits_destroy(modena_siunits_t *self);
103 
104 modena_inputs_t *modena_inputs_new(const struct modena_model_t *self);
105 
106 modena_outputs_t *modena_outputs_new(const struct modena_model_t *self);
107 
108 void modena_inputs_destroy(modena_inputs_t *inputs);
109 
110 void modena_outputs_destroy(modena_outputs_t *outputs);
111 
112 INLINE_DECL void modena_inputs_set(modena_inputs_t *self, const size_t i, double x);
113 
114 INLINE_DECL void modena_inherited_inputs_set
115 (
116  modena_inputs_t *self,
117  const size_t i,
118  double x
119 );
120 
121 INLINE_DECL double modena_inputs_get(const modena_inputs_t *self, const size_t i);
122 
123 INLINE_DECL double modena_inherited_inputs_get
124 (
125  const modena_inputs_t *self,
126  const size_t i
127 );
128 
129 INLINE_DECL double modena_outputs_get(const modena_outputs_t *self, const size_t i);
130 
131 #ifdef HAVE_INLINE
132 
133 INLINE_FUN void modena_inputs_set(modena_inputs_t *self, const size_t i, double x)
134 {
135  self->inputs[i] = x;
136 }
137 
138 INLINE_FUN void modena_inherited_inputs_set
139 (
140  modena_inputs_t *self,
141  const size_t i,
142  double x
143 )
144 {
145  self->inherited_inputs[i] = x;
146 }
147 
148 INLINE_FUN double modena_inputs_get(const modena_inputs_t *self, const size_t i)
149 {
150  return self->inputs[i];
151 }
152 
153 INLINE_FUN double modena_inherited_inputs_get
154 (
155  const modena_inputs_t *self,
156  const size_t i
157 )
158 {
159  return self->inherited_inputs[i];
160 }
161 
162 INLINE_FUN double modena_outputs_get(const modena_outputs_t *self, const size_t i)
163 {
164  return self->outputs[i];
165 }
166 
167 #endif /* HAVE_INLINE */
168  // end of C_interface_library
170 
171 __END_DECLS
172 
173 #endif /* __INPUTSOUTPUTS_H__ */
174 
175 
stores a surrogate model
Definition: model.h:94
modena_siunits_t * modena_siunits_new()
Definition: inputsoutputs.c:54