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->setABIVersion(openfluid::config::VERSION_FULL); \
64  Signature->ID = (id);
65 
66 
67 /**
68  Macro for the end of definition of signature hook
69 */
70 #define END_SIMULATOR_SIGNATURE \
71  return Signature; \
72  } \
73  }
74 
75 
76 // =====================================================================
77 // =====================================================================
78 
79 
80 /**
81  Macro for declaration of the simulator application domain
82 
83  @cond OpenFLUID:completion
84  {
85  "contexts" : ["SIMULATOR"],
86  "menupath" : ["Signature", "Scientific context"],
87  "title" : "Declare application domain",
88  "text" : "DECLARE_DOMAIN(\"%%SEL_START%%description%%SEL_END%%\")"
89  }
90  @endcond
91 */
92 #define DECLARE_DOMAIN(domain) \
93  Signature->Domain = domain;
94 
95 /**
96  Macro for declaration of the simulator application processes
97 
98  @cond OpenFLUID:completion
99  {
100  "contexts" : ["SIMULATOR"],
101  "menupath" : ["Signature", "Scientific context"],
102  "title" : "Declare modeled process(es)",
103  "text" : "DECLARE_PROCESS(\"%%SEL_START%%description%%SEL_END%%\")"
104  }
105  @endcond
106 */
107 #define DECLARE_PROCESS(process) \
108  Signature->Process = process;
109 
110 /**
111  Macro for declaration of the simulator application numerical method
112 
113  @cond OpenFLUID:completion
114  {
115  "contexts" : ["SIMULATOR"],
116  "menupath" : ["Signature", "Scientific context"],
117  "title" : "Declare modeling method",
118  "text" : "DECLARE_METHOD(\"%%SEL_START%%description%%SEL_END%%\")"
119  }
120  @endcond
121 */
122 #define DECLARE_METHOD(method) \
123  Signature->Method = method;
124 
125 
126 // =====================================================================
127 // =====================================================================
128 
129 
130 /**
131  Macro for declaration of an used simulator parameter
132  @param[in] name name of the parameter
133  @param[in] description description of the parameter
134  @param[in] unit unit of the parameter. Could be an empty string if there is no unit
135 
136  @cond OpenFLUID:completion
137  {
138  "contexts" : ["SIMULATOR"],
139  "menupath" : ["Signature", "Parameters"],
140  "title" : "Declare used parameter",
141  "text" : "DECLARE_USED_PARAMETER(\"%%SEL_START%%paramname%%SEL_END%%\",\"description\",\"SI unit\")"
142  }
143  @endcond
144 */
145 #define DECLARE_USED_PARAMETER(name,description,unit) \
146  Signature->HandledData.UsedParams\
147  .push_back(openfluid::ware::SignatureDataItem((name),description,unit));
148 
149 /**
150  @deprecated Since version 2.1.0. Use #DECLARE_USED_PARAMETER instead
151 */
152 #define DECLARE_SIMULATOR_PARAM(name,description,unit) DECLARE_USED_PARAMETER(name,description,unit)
153 
154 
155 /**
156  Macro for declaration of a required simulator parameter
157  @param[in] name name of the parameter
158  @param[in] description description of the parameter
159  @param[in] unit unit of the parameter. Could be an empty string if there is no unit
160 
161  @cond OpenFLUID:completion
162  {
163  "contexts" : ["SIMULATOR"],
164  "menupath" : ["Signature", "Parameters"],
165  "title" : "Declare required parameter",
166  "text" : "DECLARE_REQUIRED_PARAMETER(\"%%SEL_START%%paramname%%SEL_END%%\",\"description\",\"SI unit\")"
167  }
168  @endcond
169 */
170 #define DECLARE_REQUIRED_PARAMETER(name,description,unit) \
171  Signature->HandledData.RequiredParams\
172  .push_back(openfluid::ware::SignatureDataItem((name),description,unit));
173 
174 
175 // =====================================================================
176 // =====================================================================
177 
178 
179 /**
180  Macro for declaration of a produced variable
181  @param[in] name name of the variable
182  @param[in] uclass class of the concerned units
183  @param[in] description description of the variable
184  @param[in] unit unit of the variable. Could be an empty string if there is no unit
185 
186  @cond OpenFLUID:completion
187  {
188  "contexts" : ["SIMULATOR"],
189  "menupath" : ["Signature", "Variables"],
190  "title" : "Declare produced variable",
191  "text" : ["DECLARE_PRODUCED_VARIABLE(\"%%SEL_START%%var.name%%SEL_END%%\",",
192  "\"unitsclass\",\"description\",\"SI unit\")"]
193  }
194  @endcond
195 */
196 #define DECLARE_PRODUCED_VARIABLE(name,uclass,description,unit) \
197  Signature->HandledData.ProducedVars\
198  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
199 
200 /**
201  @deprecated Since version 2.1.0. Use #DECLARE_PRODUCED_VARIABLE instead
202 */
203 #define DECLARE_PRODUCED_VAR(name,uclass,description,unit) DECLARE_PRODUCED_VARIABLE(name,uclass,description,unit)
204 
205 
206 /**
207  Macro for declaration of an updated variable
208  @param[in] name name of the variable
209  @param[in] uclass class of the concerned units
210  @param[in] description description of the variable
211  @param[in] unit unit of the variable. Could be an empty string if there is no unit
212 
213  @cond OpenFLUID:completion
214  {
215  "contexts" : ["SIMULATOR"],
216  "menupath" : ["Signature", "Variables"],
217  "title" : "Declare updated variable",
218  "text" : "DECLARE_UPDATED_VARIABLE(\"%%SEL_START%%var.name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
219  }
220  @endcond
221 */
222 #define DECLARE_UPDATED_VARIABLE(name,uclass,description,unit) \
223  Signature->HandledData.UpdatedVars\
224  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
225 
226 /**
227  @deprecated Since version 2.1.0. Use #DECLARE_UPDATED_VARIABLE instead
228 */
229 #define DECLARE_UPDATED_VAR(name,uclass,description,unit) DECLARE_UPDATED_VARIABLE(name,uclass,description,unit)
230 
231 
232 /**
233  Macro for declaration of a required variable
234  @param[in] name name of the variable
235  @param[in] uclass class of the concerned units
236  @param[in] description description of the variable
237  @param[in] unit unit of the variable. Could be an empty string if there is no unit
238 
239  @cond OpenFLUID:completion
240  {
241  "contexts" : ["SIMULATOR"],
242  "menupath" : ["Signature", "Variables"],
243  "title" : "Declare required variable",
244  "text" : ["DECLARE_REQUIRED_VARIABLE(\"%%SEL_START%%var.name%%SEL_END%%\",",
245  "\"unitsclass\",\"description\",\"SI unit\")"]
246  }
247  @endcond
248 */
249 #define DECLARE_REQUIRED_VARIABLE(name,uclass,description,unit) \
250  Signature->HandledData.RequiredVars\
251  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
252 
253 /**
254  @deprecated Since version 2.1.0. Use #DECLARE_REQUIRED_VARIABLE instead
255 */
256 #define DECLARE_REQUIRED_VAR(name,uclass,description,unit) DECLARE_REQUIRED_VARIABLE(name,uclass,description,unit)
257 
258 
259 /**
260  Macro for declaration of an used variable
261  @param[in] name name of the variable
262  @param[in] uclass class of the concerned units
263  @param[in] description description of the variable
264  @param[in] unit unit of the variable. Could be an empty string if there is no unit
265 
266  @cond OpenFLUID:completion
267  {
268  "contexts" : ["SIMULATOR"],
269  "menupath" : ["Signature", "Variables"],
270  "title" : "Declare used variable",
271  "text" : "DECLARE_USED_VARIABLE(\"%%SEL_START%%var.name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
272  }
273  @endcond
274 */
275 #define DECLARE_USED_VARIABLE(name,uclass,description,unit) \
276  Signature->HandledData.UsedVars\
277  .push_back(openfluid::ware::SignatureTypedSpatialDataItem((name),uclass,description,unit));
278 
279 /**
280  @deprecated Since version 2.1.0. Use #DECLARE_USED_VARIABLE instead
281 */
282 #define DECLARE_USED_VAR(name,uclass,description,unit) DECLARE_USED_VARIABLE(name,uclass,description,unit)
283 
284 
285 /**
286  Macro for declaration of a produced attribute
287  @param[in] name name of the attribute
288  @param[in] uclass class of the concerned units
289  @param[in] description description of the attribute
290  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
291 
292  @cond OpenFLUID:completion
293  {
294  "contexts" : ["SIMULATOR"],
295  "menupath" : ["Signature", "Attributes"],
296  "title" : "Declare produced attribute",
297  "text" : "DECLARE_PRODUCED_ATTRIBUTE(\"%%SEL_START%%name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
298  }
299  @endcond
300 */
301 #define DECLARE_PRODUCED_ATTRIBUTE(name,uclass,description,unit) \
302  Signature->HandledData.ProducedAttribute\
303  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
304 
305 
306 /**
307  Macro for declaration of a required attribute
308  @param[in] name name of the attribute
309  @param[in] uclass class of the concerned units
310  @param[in] description description of the attribute
311  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
312 
313  @cond OpenFLUID:completion
314  {
315  "contexts" : ["SIMULATOR"],
316  "menupath" : ["Signature", "Attributes"],
317  "title" : "Declare required attribute",
318  "text" : "DECLARE_REQUIRED_ATTRIBUTE(\"%%SEL_START%%name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
319  }
320  @endcond
321 */
322 #define DECLARE_REQUIRED_ATTRIBUTE(name,uclass,description,unit) \
323  Signature->HandledData.RequiredAttribute\
324  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
325 
326 
327 /**
328  Macro for declaration of a used attribute
329  @param[in] name name of the attribute
330  @param[in] uclass class of the concerned units
331  @param[in] description description of the attribute
332  @param[in] unit unit of the attribute. Could be an empty string if there is no unit
333 
334  @cond OpenFLUID:completion
335  {
336  "contexts" : ["SIMULATOR"],
337  "menupath" : ["Signature", "Attributes"],
338  "title" : "Declare used attribute",
339  "text" : "DECLARE_USED_ATTRIBUTE(\"%%SEL_START%%name%%SEL_END%%\",\"unitsclass\",\"description\",\"SI unit\")"
340  }
341  @endcond
342 */
343 #define DECLARE_USED_ATTRIBUTE(name,uclass,description,unit) \
344  Signature->HandledData.UsedAttribute\
345  .push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
346 
347 
348 /**
349  Macro for declaration of used events
350  @param[in] uclass class of the concerned units
351 
352  @cond OpenFLUID:completion
353  {
354  "contexts" : ["SIMULATOR"],
355  "menupath" : ["Signature", "Events"],
356  "title" : "Declare used events",
357  "text" : "DECLARE_USED_EVENTS(\"%%SEL_START%%unitsclass%%SEL_END%%\",\"description\")"
358  }
359  @endcond
360 */
361 #define DECLARE_USED_EVENTS(uclass) Signature->HandledData.UsedEventsOnUnits.push_back(uclass);
362 
363 
364 /**
365  Macro for declaration of units graph modification
366  @param[in] description description of modification
367 
368  @cond OpenFLUID:completion
369  {
370  "contexts" : ["SIMULATOR"],
371  "menupath" : ["Signature", "Spatial structure"],
372  "title" : "Declare updated units graph",
373  "text" : "DECLARE_UPDATED_UNITSGRAPH(\"%%SEL_START%%description%%SEL_END%%\")"
374  }
375  @endcond
376 */
377 #define DECLARE_UPDATED_UNITSGRAPH(description) Signature->HandledUnitsGraph.UpdatedUnitsGraph = (description);
378 
379 
380 /**
381  Macro for declaration of units class creation or update
382  @param[in] uclass name of the created or updated class
383  @param[in] description description of the updated class
384 
385  @cond OpenFLUID:completion
386  {
387  "contexts" : ["SIMULATOR"],
388  "menupath" : ["Signature", "Spatial structure"],
389  "title" : "Declare updated units class",
390  "text" : "DECLARE_UPDATED_UNITSCLASS(\"%%SEL_START%%unitsclass%%SEL_END%%\",\"description\")"
391  }
392  @endcond
393 */
394 #define DECLARE_UPDATED_UNITSCLASS(uclass,description) \
395  Signature->HandledUnitsGraph.UpdatedUnitsClass\
396  .push_back(openfluid::ware::SignatureUnitsClassItem(uclass,description));
397 
398 
399 /**
400  Macro for declaration of required file
401  @param[in] name name of the file
402 
403  @cond OpenFLUID:completion
404  {
405  "contexts" : ["SIMULATOR"],
406  "menupath" : ["Signature", "Extra files"],
407  "title" : "Declare required extra file",
408  "text" : "DECLARE_REQUIRED_EXTRAFILE(\"%%SEL_START%%filename%%SEL_END%%\")"
409  }
410  @endcond
411 */
412 #define DECLARE_REQUIRED_EXTRAFILE(name) \
413  Signature->HandledData.RequiredExtraFiles.push_back(name);
414 
415 
416 /**
417  Macro for declaration of used file
418  @param[in] name name of the file
419 
420  @cond OpenFLUID:completion
421  {
422  "contexts" : ["SIMULATOR"],
423  "menupath" : ["Signature", "Extra files"],
424  "title" : "Declare used extra file",
425  "text" : "DECLARE_USED_EXTRAFILE(\"%%SEL_START%%filename%%SEL_END%%\")"
426  }
427  @endcond
428 */
429 #define DECLARE_USED_EXTRAFILE(name) \
430  Signature->HandledData.UsedExtraFiles.push_back(name);
431 
432 
433 /**
434  Macro for declaration of time scheduling as undefined
435 
436  @cond OpenFLUID:completion
437  {
438  "contexts" : ["SIMULATOR"],
439  "menupath" : ["Signature", "Scheduling"],
440  "title" : "Declare undefined scheduling",
441  "text" : "DECLARE_SCHEDULING_UNDEFINED"
442  }
443  @endcond
444 */
445 #define DECLARE_SCHEDULING_UNDEFINED \
446  Signature->TimeScheduling.setAsUndefined();
447 
448 
449 /**
450  Macro for declaration of time scheduling as default delta T
451 
452  @cond OpenFLUID:completion
453  {
454  "contexts" : ["SIMULATOR"],
455  "menupath" : ["Signature", "Scheduling"],
456  "title" : "Declare default deltaT scheduling",
457  "text" : "DECLARE_SCHEDULING_DEFAULT"
458  }
459  @endcond
460 */
461 #define DECLARE_SCHEDULING_DEFAULT \
462  Signature->TimeScheduling.setAsDefaultDeltaT();
463 
464 
465 /**
466  Macro for declaration of fixed time scheduling
467  @param[in] deltat fixed time scheduling value
468 
469  @cond OpenFLUID:completion
470  {
471  "contexts" : ["SIMULATOR"],
472  "menupath" : ["Signature", "Scheduling"],
473  "title" : "Declare fixed scheduling",
474  "text" : "DECLARE_SCHEDULING_FIXED(%%SEL_START%%duration%%SEL_END%%)"
475  }
476  @endcond
477 */
478 #define DECLARE_SCHEDULING_FIXED(deltat) \
479  Signature->TimeScheduling.setAsFixed(deltat);
480 
481 
482 /**
483  Macro for declaration of range of time scheduling
484  @param[in] min minimal time scheduling value
485  @param[in] max maximal time scheduling value
486 
487  @cond OpenFLUID:completion
488  {
489  "contexts" : ["SIMULATOR"],
490  "menupath" : ["Signature", "Scheduling"],
491  "title" : "Declare scheduling in range",
492  "text" : "DECLARE_SCHEDULING_RANGE(%%SEL_START%%min%%SEL_END%%,max)"
493  }
494  @endcond
495 */
496 #define DECLARE_SCHEDULING_RANGE(min,max) \
497  Signature->TimeScheduling.setAsRange(min,max);
498 
499 
500 #endif /* __OPENFLUID_WARE_SIMULATORSIGNATUREMACROS_HPP__ */