From 441b60c70dcdc8d63cd6341be328a7f07953e9b0 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 6 Jul 2023 23:11:36 +0100 Subject: [PATCH] functionEntries::calcEntry: Extended the functionality of multi-statement/multi-line #calc If the code string is delimited by '#{...#}' multiple lines and multiple code statements can be used to generate the entry using 'os << ...;'. This is equivalent to #codeStream but with a more compact syntax, e.g. maxAngle 30; nAngles 7; Us #calc const vector U($testCalc2!U); const int nAngles = $nAngles; const scalar angleStep = ($maxAngle)/(nAngles - 1); List Us(nAngles); for(int i=0; is + "Name" #}; + fieldName #calc "$s + \"Name\" "; \endverbatim Additional include files for the #calc code compilation can be specified @@ -77,12 +68,31 @@ Usage dragDir #calc "transform(Ry($angle), vector(1, 0, 0))"; \endverbatim - Note: - Internally this is just a wrapper around codeStream functionality - the - #calc string is used to construct a dictionary for codeStream. + If the code string is delimited by '#{...#}' multiple lines and multiple + code statements can be used to generate the entry using 'os << ...;'. + This is equivalent to #codeStream but with a more compact syntax. + \verbatim + #calcInclude "transform.H" + maxAngle 30; + nAngles 7; + Us #calc + #{ + const vector U($testCalc2!U); + const int nAngles = $nAngles; + const scalar angleStep = ($maxAngle)/(nAngles - 1); + List Us(nAngles); + for(int i=0; i($nCellsByL*($max - $min) + vector::one/2) #}; +nCells #calc + "Vector