IS A: Difference between revisions
Jump to navigation
Jump to search
Restored page from Google Cache, uploaded by John Pye |
No edit summary |
||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE:IS_A}} | |||
The '''IS_A''' statement is used to declare a new variable or sub-MODEL in your [[MODEL]]. | The '''IS_A''' statement is used to declare a new variable or sub-MODEL in your [[MODEL]]. | ||
<source lang="a4c">x IS_A distance; (* this is an 'atomic' variable: just | <source lang="a4c">x IS_A distance; (* this is an 'atomic' variable: just | ||
Latest revision as of 22:00, 21 December 2010
The IS_A statement is used to declare a new variable or sub-MODEL in your MODEL.
x IS_A distance; (* this is an 'atomic' variable: just a single numerical value that can be solved for *) v IS_A vec3; (* vec3 is a sub-model containing x,y,z components *) v.x = x; (* once variables are declared, you can use them in relations involving other variables, possibly from your sum-models *)
IS_A can also be used to declare arrays and sets.
IS_A can also be used in parametric models to define constants that will be provided during the declaration, for example:
MODEL hxbase ( hotfluid, coldfluid, flowtype IS_A symbol_constant; (* this may have to be separated. *) ) WHERE ( flowtype IN ['counterflow','coflow']; (* == TRUE; may be needed, i forget *) ); (*...declaration for a specialisation of hxbase with water as the fluid... *) MODEL hxwater ( flowtype IS_A symbol_constant; ) REFINES hxbase ( hotfluid :=='water'; coldfluid:=='water'; ); (*...then later...*) a IS_A hxwater('coflow');
See also WILL_BE, IS_REFINED_TO, ALIASES, ARE_THE_SAME.