Manual for OpenFLUID 2.1.11

SimulatorSignatureMacros.hpp
Go to the documentation of this file.
1 /*
2 
3  This file is part of OpenFLUID software
4  Copyright(c) 2007, INRA - Montpellier SupAgro
5 
6 
7  == GNU General Public License Usage ==
8 
9  OpenFLUID is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  OpenFLUID is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21 
22 
23  == Other Usage ==
24 
25  Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26  license, and requires a written agreement between You and INRA.
27  Licensees for Other Usage of OpenFLUID may use this file in accordance
28  with the terms contained in the written agreement between You and INRA.
29 
30 */
31 
32 /**
33  @file SimulatorSignatureMacros.hpp
34 
35  @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
36 */
37 
38 
39 #ifndef __OPENFLUID_WARE_SIMULATORSIGNATUREMACROS_HPP__
40 #define __OPENFLUID_WARE_SIMULATORSIGNATUREMACROS_HPP__
41 
42 
44 
45 
46 /**
47  Macro for the beginning of definition of signature hook
48 
49  @cond OpenFLUID:completion
50  {
51  "contexts" : ["SIMULATOR"],
52  "menupath" : ["Signature"],
53  "title" : "Insert signature block",
54  "text" : "BEGIN_SIMULATOR_SIGNATURE(\"%%SEL_START%%sim.id%%SEL_END%%\")\n\nEND_SIMULATOR_SIGNATURE"
55  }
56  @endcond
57 */
58 #define BEGIN_SIMULATOR_SIGNATURE(id) \
59  extern "C" { \
60  OPENFLUID_PLUGIN openfluid::ware::SimulatorSignature* WARESIGNATURE_PROC_DECL() \
61  { \
62  openfluid::ware::SimulatorSignature* Signature = new openfluid::ware::SimulatorSignature(); \
63  Signature->ID = (id); \
64  Signature->BuildInfo.SDKVersion = openfluid::config::VERSION_FULL; \
65  Signature->BuildInfo.BuildType = (WAREBUILD_BUILD_TYPE); \
66  Signature->BuildInfo.CompilerID = (WAREBUILD_COMPILER_ID); \
67  Signature->BuildInfo.CompilerVersion = (WAREBUILD_COMPILER_VERSION); \
68  Signature->BuildInfo.CompilationFlags = (WAREBUILD_COMPILATION_FLAGS);
69 
70 /**
71  Macro for the end of definition of signature hook
72 */
73 #define END_SIMULATOR_SIGNATURE \
74  return Signature; \
75  } \
76  }
77 
78 
79 // =====================================================================
80 // =====================================================================
81 
82 
83 /**
84  Macro for declaration of the simulator application domain
85 
86  @cond OpenFLUID:completion
87  {
88  "contexts" : ["SIMULATOR"],
89  "menupath" : ["Signature", "Scientific context"],
90  "title" : "Declare application domain",
91  "text" : "DECLARE_DOMAIN(\"%%SEL_START%%description%%SEL_END%%\")"
92  }
93  @endcond
94 */
95 #define DECLARE_DOMAIN(domain) \
96  Signature->Domain = domain;
97 
98 /**
99  Macro for declaration of the simulator application processes
100 
101  @cond OpenFLUID:completion
102  {
103  "contexts" : ["SIMULATOR"],
104  "menupath" : ["Signature", "Scientific context"],
105  "title" : "Declare modeled process(es)",
106  "text" : "DECLARE_PROCESS(\"%%SEL_START%%description%%SEL_END%%\")"
107  }
108  @endcond
109 */
110 #define DECLARE_PROCESS(process) \
111  Signature->Process = process;
112 
113 /**
114  Macro for declaration of the simulator application numerical method
115 
116  @cond OpenFLUID:completion
117  {
118  "contexts" : ["SIMULATOR"],
119  "menupath" : ["Signature", "Scientific context"],
120  "title" : "Declare modeling method",
121  "text" : "DECLARE_METHOD(\"%%SEL_START%%description%%SEL_END%%\")"
122  }
123  @endcond
124 */
125 #define DECLARE_METHOD(method) \
126  Signature->Method = method;
127 
128 
129 // =====================================================================
130 // =====================================================================
131 
132 
133 /**
134  Macro for declaration of an used simulator parameter
135  @param[in] name name of the parameter
136  @param[in] description description of the parameter
137  @param[in] unit unit of the parameter. Could be an empty string if there is no unit
138 
139  @cond OpenFLUID:completion
140  {
141  "contexts" : ["SIMULATOR"],
142  "menupath" : ["Signature", "Parameters"],
143  "title" : "Declare used parameter",
144  "text" : "DECLARE_USED_PARAMETER(\"%%SEL_START%%paramname%%SEL_END%%\",\"description\",\"SI unit\")"
145  }
146  @endcond
147 */
148 #define DECLARE_USED_PARAMETER(name,description,unit) \
149  Signature->HandledData.UsedParams\
150  .push_back(openfluid::ware::SignatureDataItem((name),description,unit));
151 
152 /**
153  @deprecated Since version 2.1.0. Use #DECLARE_USED_PARAMETER instead
154 */
155 #define DECLARE_SIMULATOR_PARAM(name,description,unit) DECLARE_USED_PARAMETER(name,description,unit)
156 
157 
158 /**
159  Macro for declaration of a required simulator parameter
160  @param[in] name name of the parameter
161  @param[in] description description of the parameter
162  @param[in] unit unit of the parameter. Could be an empty string if there is no unit
163 
164  @cond OpenFLUID:completion
165  {
166  "contexts" : ["SIMULATOR"],
167  "menupath" : ["Signature", "Parameters"],
168  "title" : "Declare required parameter",
169  "text" : "DECLARE_REQUIRED_PARAMETER(\"%%SEL_START%%paramname%%SEL_END%%\",\"description\",\"SI unit\")"
170  }
171  @endcond
172 */
173 #define DECLARE_REQUIRED_PARAMETER(name,description,unit) \
174  Signature->HandledData.RequiredParams\
175  .push_back(openfluid::ware::SignatureDataItem((name),description,unit));
176 
177 
178 // =====================================================================
179 // =====================================================================
180 
181 
182 /**
183  Macro for declaration of a produced variable
184  @param[in] name name of the variable
185  @param[in] uclass class of the concerned units
186  @param[in] description description of the variable
187  @param[in] unit unit of the variable. Could be an empty string if there is no unit
188 
189  @cond OpenFLUID:completion
190  {
191  "contexts" : ["SIMULATOR"],
192  "menupath" : ["Signature", "Variables"],
193  "title" : "Declare produced variable",
194  "text" : ["DECLARE_PRODUCED_VARIABLE(\"%%SEL_START%%var.name%%SEL_END%%\",",
195  "\"unitsclass\",\"description\",\"SI unit\")"]
196  }
197  @endcond
198 */
199 #define DECLARE_PRODUCED_VARIABLE(name,uclass,description,unit) \
200  Signature->HandledData.ProducedVars\
201  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
202 
203 /**
204  @deprecated Since version 2.1.0. Use #DECLARE_PRODUCED_VARIABLE instead
205 */
206 #define DECLARE_PRODUCED_VAR(name,uclass,description,unit) DECLARE_PRODUCED_VARIABLE(name,uclass,description,unit)
207 
208 
209 /**
210  Macro for declaration of an updated variable
211  @param[in] name name of the variable
212  @param[in] uclass class of the concerned units
213  @param[in] description description of the variable
214  @param[in] unit unit of the variable. Could be an empty string if there is no unit
215 
216  @cond OpenFLUID:completion
217  {
218  "contexts" : ["SIMULATOR"],
219  "menupath" : ["Signature", "Variables"],
220  "title" : "Declare updated variable",
221  "text" : "DECLARE_UPDATED_VARIABLE(\"%%SEL_START%%var.name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
222  }
223  @endcond
224 */
225 #define DECLARE_UPDATED_VARIABLE(name,uclass,description,unit) \
226  Signature->HandledData.UpdatedVars\
227  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
228 
229 /**
230  @deprecated Since version 2.1.0. Use #DECLARE_UPDATED_VARIABLE instead
231 */
232 #define DECLARE_UPDATED_VAR(name,uclass,description,unit) DECLARE_UPDATED_VARIABLE(name,uclass,description,unit)
233 
234 
235 /**
236  Macro for declaration of a required variable
237  @param[in] name name of the variable
238  @param[in] uclass class of the concerned units
239  @param[in] description description of the variable
240  @param[in] unit unit of the variable. Could be an empty string if there is no unit
241 
242  @cond OpenFLUID:completion
243  {
244  "contexts" : ["SIMULATOR"],
245  "menupath" : ["Signature", "Variables"],
246  "title" : "Declare required variable",
247  "text" : ["DECLARE_REQUIRED_VARIABLE(\"%%SEL_START%%var.name%%SEL_END%%\",",
248  "\"unitsclass\",\"description\",\"SI unit\")"]
249  }
250  @endcond
251 */
252 #define DECLARE_REQUIRED_VARIABLE(name,uclass,description,unit) \
253  Signature->HandledData.RequiredVars\
254  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
255 
256 /**
257  @deprecated Since version 2.1.0. Use #DECLARE_REQUIRED_VARIABLE instead
258 */
259 #define DECLARE_REQUIRED_VAR(name,uclass,description,unit) DECLARE_REQUIRED_VARIABLE(name,uclass,description,unit)
260 
261 
262 /**
263  Macro for declaration of an used variable
264  @param[in] name name of the variable
265  @param[in] uclass class of the concerned units
266  @param[in] description description of the variable
267  @param[in] unit unit of the variable. Could be an empty string if there is no unit
268 
269  @cond OpenFLUID:completion
270  {
271  "contexts" : ["SIMULATOR"],
272  "menupath" : ["Signature", "Variables"],
273  "title" : "Declare used variable",
274  "text" : "DECLARE_USED_VARIABLE(\"%%SEL_START%%var.name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
275  }
276  @endcond
277 */
278 #define DECLARE_USED_VARIABLE(name,uclass,description,unit) \
279  Signature->HandledData.UsedVars\
280  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
281 
282 /**
283  @deprecated Since version 2.1.0. Use #DECLARE_USED_VARIABLE instead
284 */
285 #define DECLARE_USED_VAR(name,uclass,description,unit) DECLARE_USED_VARIABLE(name,uclass,description,unit)
286 
287 
288 /**
289  Macro for declaration of a produced attribute
290  @param[in] name name of the attribute
291  @param[in] uclass class of the concerned units
292  @param[in] description description of the attribute
293  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
294 
295  @cond OpenFLUID:completion
296  {
297  "contexts" : ["SIMULATOR"],
298  "menupath" : ["Signature", "Attributes"],
299  "title" : "Declare produced attribute",
300  "text" : "DECLARE_PRODUCED_ATTRIBUTE(\"%%SEL_START%%name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
301  }
302  @endcond
303 */
304 #define DECLARE_PRODUCED_ATTRIBUTE(name,uclass,description,unit) \
305  Signature->HandledData.ProducedAttribute\
306  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
307 
308 
309 /**
310  Macro for declaration of a required attribute
311  @param[in] name name of the attribute
312  @param[in] uclass class of the concerned units
313  @param[in] description description of the attribute
314  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
315 
316  @cond OpenFLUID:completion
317  {
318  "contexts" : ["SIMULATOR"],
319  "menupath" : ["Signature", "Attributes"],
320  "title" : "Declare required attribute",
321  "text" : "DECLARE_REQUIRED_ATTRIBUTE(\"%%SEL_START%%name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
322  }
323  @endcond
324 */
325 #define DECLARE_REQUIRED_ATTRIBUTE(name,uclass,description,unit) \
326  Signature->HandledData.RequiredAttribute\
327  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
328 
329 
330 /**
331  Macro for declaration of a used attribute
332  @param[in] name name of the attribute
333  @param[in] uclass class of the concerned units
334  @param[in] description description of the attribute
335  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
336 
337  @cond OpenFLUID:completion
338  {
339  "contexts" : ["SIMULATOR"],
340  "menupath" : ["Signature", "Attributes"],
341  "title" : "Declare used attribute",
342  "text" : "DECLARE_USED_ATTRIBUTE(\"%%SEL_START%%name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
343  }
344  @endcond
345 */
346 #define DECLARE_USED_ATTRIBUTE(name,uclass,description,unit) \
347  Signature->HandledData.UsedAttribute\
348  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
349 
350 
351 /**
352  Macro for declaration of used events
353  @param[in] uclass class of the concerned units
354 
355  @cond OpenFLUID:completion
356  {
357  "contexts" : ["SIMULATOR"],
358  "menupath" : ["Signature", "Events"],
359  "title" : "Declare used events",
360  "text" : "DECLARE_USED_EVENTS(\"%%SEL_START%%unitsclass%%SEL_END%%\",\"description\")"
361  }
362  @endcond
363 */
364 #define DECLARE_USED_EVENTS(uclass) Signature->HandledData.UsedEventsOnUnits.push_back(uclass);
365 
366 
367 /**
368  Macro for declaration of units graph modification
369  @param[in] description description of modification
370 
371  @cond OpenFLUID:completion
372  {
373  "contexts" : ["SIMULATOR"],
374  "menupath" : ["Signature", "Spatial structure"],
375  "title" : "Declare updated units graph",
376  "text" : "DECLARE_UPDATED_UNITSGRAPH(\"%%SEL_START%%description%%SEL_END%%\")"
377  }
378  @endcond
379 */
380 #define DECLARE_UPDATED_UNITSGRAPH(description) Signature->HandledUnitsGraph.UpdatedUnitsGraph = (description);
381 
382 
383 /**
384  Macro for declaration of units class creation or update
385  @param[in] uclass name of the created or updated class
386  @param[in] description description of the updated class
387 
388  @cond OpenFLUID:completion
389  {
390  "contexts" : ["SIMULATOR"],
391  "menupath" : ["Signature", "Spatial structure"],
392  "title" : "Declare updated units class",
393  "text" : "DECLARE_UPDATED_UNITSCLASS(\"%%SEL_START%%unitsclass%%SEL_END%%\",\"description\")"
394  }
395  @endcond
396 */
397 #define DECLARE_UPDATED_UNITSCLASS(uclass,description) \
398  Signature->HandledUnitsGraph.UpdatedUnitsClass\
399  .push_back(openfluid::ware::SignatureUnitsClassItem(uclass,description));
400 
401 
402 /**
403  Macro for declaration of required file
404  @param[in] name name of the file
405 
406  @cond OpenFLUID:completion
407  {
408  "contexts" : ["SIMULATOR"],
409  "menupath" : ["Signature", "Extra files"],
410  "title" : "Declare required extra file",
411  "text" : "DECLARE_REQUIRED_EXTRAFILE(\"%%SEL_START%%filename%%SEL_END%%\")"
412  }
413  @endcond
414 */
415 #define DECLARE_REQUIRED_EXTRAFILE(name) \
416  Signature->HandledData.RequiredExtraFiles.push_back(name);
417 
418 
419 /**
420  Macro for declaration of used file
421  @param[in] name name of the file
422 
423  @cond OpenFLUID:completion
424  {
425  "contexts" : ["SIMULATOR"],
426  "menupath" : ["Signature", "Extra files"],
427  "title" : "Declare used extra file",
428  "text" : "DECLARE_USED_EXTRAFILE(\"%%SEL_START%%filename%%SEL_END%%\")"
429  }
430  @endcond
431 */
432 #define DECLARE_USED_EXTRAFILE(name) \
433  Signature->HandledData.UsedExtraFiles.push_back(name);
434 
435 
436 /**
437  Macro for declaration of time scheduling as undefined
438 
439  @cond OpenFLUID:completion
440  {
441  "contexts" : ["SIMULATOR"],
442  "menupath" : ["Signature", "Scheduling"],
443  "title" : "Declare undefined scheduling",
444  "text" : "DECLARE_SCHEDULING_UNDEFINED"
445  }
446  @endcond
447 */
448 #define DECLARE_SCHEDULING_UNDEFINED \
449  Signature->TimeScheduling.setAsUndefined();
450 
451 
452 /**
453  Macro for declaration of time scheduling as default delta T
454 
455  @cond OpenFLUID:completion
456  {
457  "contexts" : ["SIMULATOR"],
458  "menupath" : ["Signature", "Scheduling"],
459  "title" : "Declare default deltaT scheduling",
460  "text" : "DECLARE_SCHEDULING_DEFAULT"
461  }
462  @endcond
463 */
464 #define DECLARE_SCHEDULING_DEFAULT \
465  Signature->TimeScheduling.setAsDefaultDeltaT();
466 
467 
468 /**
469  Macro for declaration of fixed time scheduling
470  @param[in] deltat fixed time scheduling value
471 
472  @cond OpenFLUID:completion
473  {
474  "contexts" : ["SIMULATOR"],
475  "menupath" : ["Signature", "Scheduling"],
476  "title" : "Declare fixed scheduling",
477  "text" : "DECLARE_SCHEDULING_FIXED(%%SEL_START%%duration%%SEL_END%%)"
478  }
479  @endcond
480 */
481 #define DECLARE_SCHEDULING_FIXED(deltat) \
482  Signature->TimeScheduling.setAsFixed(deltat);
483 
484 
485 /**
486  Macro for declaration of range of time scheduling
487  @param[in] min minimal time scheduling value
488  @param[in] max maximal time scheduling value
489 
490  @cond OpenFLUID:completion
491  {
492  "contexts" : ["SIMULATOR"],
493  "menupath" : ["Signature", "Scheduling"],
494  "title" : "Declare scheduling in range",
495  "text" : "DECLARE_SCHEDULING_RANGE(%%SEL_START%%min%%SEL_END%%,max)"
496  }
497  @endcond
498 */
499 #define DECLARE_SCHEDULING_RANGE(min,max) \
500  Signature->TimeScheduling.setAsRange(min,max);
501 
502 
503 #endif /* __OPENFLUID_WARE_SIMULATORSIGNATUREMACROS_HPP__ */
WareSignatureMacros.hpp