api.ast.utilities#
Functions#
|
|
|
builds a types decorator from a list of arguments (of FunctionDef) |
|
This function computes atomic expressions needed to evaluate the Kernel final expression |
|
This function computes atomic expressions needed to evaluate EvaluteField/VectorField final expression |
|
This function computes atomic expressions needed to evaluate EvalMapping final expression |
|
|
|
|
|
|
|
|
|
|
|
|
|
Given a list of variable return the meaningful part of the name of the first variable that has a _name attribute. |
|
|
|
|
|
Given a Sympy expression, find all known mathematical atoms (functions and constants) that need to be imported from a math library (e.g. Numpy) when generating Python code. |
|
|
|
|
|
Details#
- build_pythran_types_header(name, args, order=None)[source]#
builds a types decorator from a list of arguments (of FunctionDef)
- compute_atoms_expr(atomic_exprs, indices_quad, indices_test, indices_trial, basis_trial, basis_test, cords, test_function, is_linear, mapping)[source]#
This function computes atomic expressions needed to evaluate the Kernel final expression
- Parameters:
- atomic_exprs<list>
list of atoms
- indices_quad<list>
list of quadrature indices used in the quadrature loops
- indices_test<list>
list of test_functions indices used in the for loops of the basis functions
- indices_trial<list>
list of trial_functions indices used in the for loops of the basis functions
- basis_test<list>
list of basis functions in each dimesion
- cords<list>
list of coordinates Symbols
- test_function<Symbol>
test_function Symbol
- is_linear<boolean>
variable to determine if we are in the linear case
- mapping<Mapping>
Mapping object
- Returns:
- inits<list>
list of assignments of the atomic expression evaluated in the quadrature points
- map_stmts<list>
list of assigments of atomic expression in case of mapping
- compute_atoms_expr_field(atomic_exprs, indices_quad, idxs, basis, test_function, mapping)[source]#
This function computes atomic expressions needed to evaluate EvaluteField/VectorField final expression
- Parameters:
- atomic_exprs<list>
list of atoms
- indices_quad<list>
list of quadrature indices used in the quadrature loops
- idxs<list>
list of basis functions indices used in the for loops of the basis functions
- basis<list>
list of basis functions in each dimesion
- test_function<Symbol>
test_function Symbol
- mapping<Mapping>
Mapping object
- Returns:
- inits<list>
list of assignments of the atomic expression evaluated in the quadrature points
- updates<list>
list of augmented assignments which are updated in each loop iteration
- map_stmts<list>
list of assignments of atomic expression in case of mapping
- new_atoms: <list>
updated list of atomic expressions (some were introduced in case of a mapping)
- compute_atoms_expr_mapping(atomic_exprs, indices_quad, idxs, basis, test_function)[source]#
This function computes atomic expressions needed to evaluate EvalMapping final expression
- Parameters:
- atomic_exprs<list>
list of atoms
- indices_quad<list>
list of quadrature indices used in the quadrature loops
- idxs<list>
list of basis functions indices used in the for loops of the basis functions
- basis<list>
list of basis functions in each dimesion
- test_function<Symbol>
test_function Symbol
- Returns:
- inits<list>
list of assignments of the atomic expression evaluated in the quadrature points
- updates<list>
list of augmented assignments which are updated in each loop iteration
- get_name(lhs)[source]#
Given a list of variable return the meaningful part of the name of the first variable that has a _name attribute.
Was added to solve issue #327 caused by trying to access the name of a variable that has not such attribute.
- Parameters:
- lhslist
list from whom we need to extract a name.
- Returns:
- str
meaningful part of the name of the variable or “zero term” if no variable has a name.
- math_atoms_as_str(expr, lib='math')[source]#
Given a Sympy expression, find all known mathematical atoms (functions and constants) that need to be imported from a math library (e.g. Numpy) when generating Python code.
- Parameters:
- exprsympy.core.expr.Expr
Symbolic expression for which Python code is to be generated.
- libstr
Library used to translate symbolic functions/constants into standard Python ones. Options: [‘math’, ‘mpmath’, ‘numpy’]. Default: ‘math’.
- Returns:
- importsset of str
Set of all names (strings) to be imported.