Construct statements offer the possibility to automatically construct quantities based on previously read in boundary elements for
GeometryManipulations like
offset{,
scale{,
rotate{. The construct statements are evaluated sequentially in the startup phase together with the reading of the geometry files and this evaluation is depending on the order.
A typical order can be:
-
- read in a subset of geometry files
- establish a sequence of ConstructClause items for those geometries
- apply the results of the ConstructClause items in a subsequent reading of other geometry files
A construct statement may look as follows:
The possible CONSTRUCT-keywords can be found at the very bottom in the
List of members.
Note: Whenever there is a construction based on an alias list "alias1", "alias2", ..., also wildcards can be used. For example, "alias*" matches "alias1", "alias2", ..., see
AliasForGeometryItems.
Construct Environments
If the construct result is used in several places of the
USER_common_variables, a construct environment is preferred:
The result can be referenced by the name given on the left hand side in the same way as an
ALIAS, see also
Variables.
Notes:
(Experimental) begin_construct_always{
Another way to read in construct statements is using the
begin_construct_always{ environment. This allows to define construct variables for regular startup and restart runs in the same environment.
MESHFREE internally identifies if its a restarted run and automatically overwrites the updated construct variables which might be based on the updated boundary.
Warning: Using
begin_construct_always{ and
begin_construct{ in the same setup or, respectively,
begin_construct_always{ and
begin_construct_atRestart{ is not recommended. There is a workaround to support this if
CONTROL_ConstructClauses > 0. If
CONTROL_ConstructClauses = 0 (default), this will result in an error termination.
Examples
Example 1: Using construct to manipulate the read-in of other geometry parts
Example 2: Any
RightHandSideExpression can be used to save the result of a calculation during the initialization phase into an
ALIAS, for example to create new boundary elements from scratch after reading in other geometry.
Example 3: Using a vectorial
ALIAS on the right hand side of construct statements
begin_alias{}
"GeoGroup" = "front,back,top,bottom,in,out"
# group geometry aliases together
end_alias
begin_construct{}
# Version 1: This may become tedious for large groups
"xGG_Max_v1" = CONSTRUCT(
%CONSTRUCT_BoxMax%, "&GeoGroup(1)&", "&GeoGroup(2)&", "&GeoGroup(3)&", "&GeoGroup(4)&", "&GeoGroup(5)&", "&GeoGroup(6)&")
# Version 2: This is much shorter and does not need to be modified when changing the length of the vectorial alias
"xGG_Max_v2" = CONSTRUCT(
%CONSTRUCT_BoxMax%,
&GeoGroup& )
end_construct
Warning: When using version 2, make sure to stick to the correct syntax, e.g. putting "&GeoGroup&" instead of &GeoGroup& on the right hand side will lead to an incorrect result.
Example 4: Using a vectorial
ALIAS on the left hand side of construct statements
begin_construct{}
begin_loop{"i",1,1,5}
"vecAlias(&i&)" = "(&i&^2)"
end_loop
"vecAlias(3)" = "&vecAlias(5)&"
"vecAlias_min" = "(min(&vecAlias&))"
# minimum entry in vecAlias
"vecAlias_max" = "(max(&vecAlias&))"
# maximum entry in vecAlias
end_construct
If parenthesis are found on the left hand side of a construct statement, MESHFREE will interpret this as an indexing into a vectorial
ALIAS. The right hand side result will be placed at the specified location within the comma-separated vectorial
ALIAS string. In the above example, a vectorial
ALIAS "vecAlias" with (at least) the first five components (1,4,9,16,25) will be created and, susequently, the third component will be overwritten to give (1,4,25,16,25).
The example also shows how certain functions can be evaluated on the list of values stored in "vecAlias". Here, we determine the minimum and maximum values, which is possible since the comma-seperated list of values in "vecAlias" is simply put into the
min() or
max() function as a string when the alias reference &vecAlias& is resolved.
Warning: Do not mix double definitions of aliases outside of construct statements with the above indexing!