⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getdp.texi

📁 cfd求解器使用与gmsh网格的求解
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
List of expressions are defined as:@example@var{expression-list}:   @var{expression} <,@dots{}>@end example@menu* Operators::                   * Constants::                   * Functions::                   * Current values::              * Fields::                      @end menu@c -------------------------------------------------------------------------@c Constants@c -------------------------------------------------------------------------@node Constants, Operators, Expression definition, Expressions@section Constants@cindex Constant, definition@cindex Constant, evaluation@cindex Evaluation mechanism@cindex Integer numbers@cindex Real numbers@cindex Floating point numbers@cindex Numbers, real@cindex Numbers, integer@cindex String@tindex DefineConstant@tindex List@tindex ListAlt@tindex Pi@tindex 0D@tindex 1D@tindex 2D@tindex 3D@tindex =@tindex ~@vindex @var{integer}@vindex @var{real}@vindex @var{string}@vindex @var{expression-cst}@vindex @var{expression-cst-list}@vindex @var{expression-cst-list-item}@vindex @var{constant-id}@vindex @var{constant-def}@vindex @var{string-id}@vindex @var{expression-char}@vindex @var{affectation}The three constant types used in GetDP are @var{integer}, @var{real} and@var{string}.  These types have the same meaning and syntax as in the C orC++ programming languages. Besides general expressions (@var{expression}),purely constant expressions, denoted by the metasyntactic variable@var{expression-cst}, are also used:@example@var{expression-cst}:  ( @var{expression-cst} ) |  @var{integer} |  @var{real} |  @var{constant-id} |  @var{operator-unary} @var{expression-cst} |  @var{expression-cst} @var{operator-binary} @var{expression-cst} |  @var{expression-cst} @var{operator-ternary-left} @var{expression-cst} @var{operator-ternary-right}       @var{expression-cst} |  @var{math-function-id} [ < @var{expression-cst-list} > ]@end exampleList of constant expressions are defined as:@example@var{expression-cst-list}:  @var{expression-cst-list-item} <,@dots{}>@end example@noindent with@example@var{expression-cst-list-item}:  @var{expression-cst} |  @var{expression-cst} : @var{expression-cst} |  @var{expression-cst} : @var{expression-cst} : @var{expression-cst} |  @var{constant-id} @{@} |  @var{constant-id} @{ @var{expression-cst-list} @} |  List[ @var{constant-id} ] |  ListAlt[ @var{constant-id}, @var{constant-id} ] |  LinSpace[ @var{expression-cst}, @var{expression-cst}, @var{expression-cst} ] |  LogSpace[ @var{expression-cst}, @var{expression-cst}, @var{expression-cst} ]@end exampleThe second case in this last definition permits to create a list containingthe range of numbers comprised between the two @var{expression-cst}, with aunit incrementation step. The third case also permits to create a listcontaining the range of numbers comprised between the two@var{expression-cst}, but with a positive or negative incrementation stepequal to the third @var{expression-cst}. The fourth and fifth cases permitto reference constant identifiers (@var{constant-id}s) of lists of constantsand constant identifiers of sublists of constants (see below for thedefinition of constant identifiers) . The sixth case is a synonym for thefourth. The seventh case permits to create alternate lists: the arguments of@code{ListAlt} must be @var{constant-id}s of lists of constants of the samedimension. The result is an alternate list of these constants: firstconstant of argument 1, first constant of argument 2, second constant ofargument 1, etc. These kinds of lists of constants are for example oftenused for function parameters (@pxref{Functions}). The last two cases permitto create linear and logarithmic lists of numbers, respectively.Contrary to a general @var{expression} which is evaluated at runtime (thanksto an internal stack mechanism), an @var{expression-cst} is completelyevaluated during the syntactic analysis of the problem (when GetDP reads the@file{.pro} file). The definition of such constants or lists of constantswith identifiers can be made outside or inside any GetDP object. The syntaxfor the definition of constants is:@example@var{affectation}:  DefineConstant [ @var{constant-id} < = @var{expression-cst} >                    @var{string-id} < = "@var{string}" > <,@dots{}> ]; |  @var{constant-id} = @var{constant-def}; |  @var{string-id} = @var{string-def}; |  Printf("@var{string}"); |  Printf("@var{string}", @var{expression-cst-list}); |  Read(@var{constant-id}); |  Read(@var{constant-id})[@var{expression-cst}];@end example@noindent with@example@var{constant-id}:  @var{string} |  @var{string} ~ @{ @var{expression-cst} @}@var{constant-def}:  @var{expression-cst-list-item} |  @{ @var{expression-cst-list} @} |  ListFromFile [ @var{expression-char} ]@var{string-id}:  @var{string} |  @var{string} ~ @{ @var{expression-cst} @}@var{string-def}:  "@var{string}" |  Str[ @var{expression-char} ] |  StrCat[ @var{expression-char}, @var{expression-char} ]@end example@noindent Notes:@enumerate@itemFive constants are predefined in GetDP: @code{Pi} (3.1415926535897932),@code{0D} (0), @code{1D} (1), @code{2D} (2) and @code{3D} (3).@itemWhen @code{~@{@var{expression-cst}@}} is appended to a string @var{string},the result is a new string formed by the concatenation of @var{string},@code{_} (an underscore) and the value of the @var{expression-cst}. This ismost useful in loops (@pxref{Loops and conditionals}), where it permits todefine unique strings automatically. For example, @exampleFor i In @{1:3@}  x~@{i@} = i;EndFor@end exampleis the same as@examplex_1 = 1;x_2 = 2;x_3 = 3;@end example@itemThe assignment in @code{DefineConstant} (zero if no @var{expression-cst} isgiven) is performed only if @var{constant-id} has not yet been defined. Thiskind of explicit default definition mechanism is most useful in generalproblem definition structures making use of a large number of genericconstants, functions or groups. When exploiting only a part of a complexproblem definition structure, the default definition mechanism allows todefine the quantities of interest only, the others being assigned a defaultvalue (that will not be used during the processing but that avoids the errormessages produced when references to undefined quantities are made).@end enumerateSee @ref{Constant expression examples}, as well as @ref{Function examples}, forsome examples.Character expressions are defined as follows:@example@var{expression-char}:  "@var{string}" |  @var{string-id} |  StrCat[ @var{expression-char} , @var{expression-char} ] |  Sprintf( @var{expression-char} ) |  Sprintf( @var{expression-char}, @var{expression-cst-list} ) |  Date@end example@noindent The third case in this definition permits to concatenate twocharacter expressions; the next two cases permit to print the value ofvariables using standard C formatting; the last case permits to access thecurrent date.@c -------------------------------------------------------------------------@c Operators@c -------------------------------------------------------------------------@node Operators, Functions, Constants, Expressions@section Operators@menu* Operator types::              * Evaluation order::            @end menu@c .........................................................................@c Types@c .........................................................................@node Operator types, Evaluation order, Operators, Operators@subsection Operator typesThe operators in GetDP are similar to the corresponding operators in the Cor C++ programming languages.@cindex Operators, definition@cindex Unary operators@cindex Binary operators@cindex Ternary operators@vindex @var{operator-unary}@vindex @var{operator-binary}@vindex @var{operator-ternary-left}@vindex @var{operator-ternary-right}@tindex -@tindex !@tindex +@tindex -@tindex *@tindex /\@tindex /@tindex ^@tindex %@tindex >@tindex <@tindex >=@tindex <=@tindex ==@tindex !=@tindex ||@tindex &&@tindex ?:@noindent@var{operator-unary}:@table @code@item -Unary minus.@item !Logical not.@end table@noindent@var{operator-binary}:@table @code@item ^Exponentiation. The evaluation of the both arguments must result in a scalarvalue.@item *Multiplication or scalar product, depending on the type of the arguments. @item /\Cross product. The evaluation of both arguments must result in vectors.@item /Division.@item %Modulo. The evaluation of the second argument must result in a scalar value.@item +Addition.@item -Subtraction.@item ==Equality.@item !=Inequality.@item >Greater. The evaluation of both arguments must result in scalar values.@item >=Greater or equality. The evaluation of both arguments must result inscalar values.@item <Less. The evaluation of both arguments must result in scalar values.@item <=Less or equality. The evaluation of both arguments must result in scalar values.@item &&Logical `and'. The evaluation of both arguments must result in scalarvalues.@item ||Logical `or'. The evaluation of both arguments must result in floating pointvalues. Warning: the logical `or' always (unlike in C or C++) implies theevaluation of both arguments.  That is, the second operand of @code{||} isevaluated even if the first one is true.@end table@noindent@var{operator-ternary-left}:@table @code@item ?@end table@var{operator-ternary-right}:@table @code@item :The only ternary operator, formed by @var{operator-ternary-left} and@var{operator-ternary-right} is defined as in the C or C++ programminglanguages. The ternary operator first evaluates its first argument (the@var{expression-cst} located before the @code{?}), which must result in ascalar value. If it is true (non-zero) the second argument (located between@code{?} and @code{:}) is evaluated and returned; otherwise the thirdargument (located after @code{:}) is evaluated and returned.@end table@c .........................................................................@c Evaluation@c .........................................................................@node Evaluation order,  , Operator types, Operators@subsection Evaluation order@cindex Evaluation, order@cindex Order of evaluation@cindex Operation, priorities@cindex Priorities, operations@tindex ()The evaluation priorities are summarized below (from stronger to weaker,i.e., @code{^} has the highest evaluation priority). Parentheses@code{()} may be used anywhere to change the order of evaluation.@table @code@item ^@item - (unary), ! @item /\@item *, /, %@item +, - @item <, >, <=, >=@item !=, ==@item &&, ||@item ?:@end table@c -------------------------------------------------------------------------@c Functions@c -------------------------------------------------------------------------@node Functions, Current values, Operators, Expressions@section Functions@cindex Function, definition@cindex Built-in functions@cindex Piecewise functions@cindex Arguments@cindex Parameters@vindex @var{built-in-function-id}Two types of functions coexist in GetDP: user-defined functions(@var{function-id}, see @ref{Function}) and built-in functions(@var{built-in-function-id}, defined in this section). Both types of functions are always followed by a pair of brackets @code{[]}that can possibly contain arguments (@pxref{Arguments}). This makes itsimple to distinguish a @var{function-id} or a @var{built-in-function-id}from a @var{constant-id}. As shown below, built-in functions might also haveparameters, given between braces @code{@{@}}, and which are completelyevaluated during the analysis of the syntax (since they are of@var{expression-cst-list} type):@example@var{built-in-function-id} [ < @var{expression-list} > ] < @{ @var{expression-cst-list} @} >@end example

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -