api.ast.utilities#

Functions#

build_pyccel_type_annotations(args[, order])

build_pythran_types_header(name, args[, order])

builds a types decorator from a list of arguments (of FunctionDef)

compute_atoms_expr(atomic_exprs, ...)

This function computes atomic expressions needed to evaluate the Kernel final expression

compute_atoms_expr_field(atomic_exprs, ...)

This function computes atomic expressions needed to evaluate EvaluteField/VectorField final expression

compute_atoms_expr_mapping(atomic_exprs, ...)

This function computes atomic expressions needed to evaluate EvalMapping final expression

compute_boundary_jacobian(parent_namespace, ...)

compute_normal_vector(parent_namespace, ...)

compute_tangent_vector(parent_namespace, ...)

filter_loops(indices, ranges, body, boundary)

filter_product(indices, args, boundary)

fusion_loops(loops)

get_name(lhs)

Given a list of variable return the meaningful part of the name of the first variable that has a _name attribute.

is_mapping(expr)

logical2physical(expr)

math_atoms_as_str(expr[, lib])

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.

random_string(n)

rationalize_eval_mapping(mapping, nderiv, ...)

select_loops(indices, ranges, body, boundary)

variables(names, dtype, **args)

Details#

build_pyccel_type_annotations(args, order=None)[source]#
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

compute_boundary_jacobian(parent_namespace, boundary, mapping=None)[source]#
compute_normal_vector(parent_namespace, vector, boundary, mapping=None)[source]#
compute_tangent_vector(parent_namespace, vector, boundary, mapping)[source]#
filter_loops(indices, ranges, body, boundary, boundary_basis=False)[source]#
filter_product(indices, args, boundary)[source]#
fusion_loops(loops)[source]#
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.

is_mapping(expr)[source]#
logical2physical(expr)[source]#
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.

random_string(n)[source]#
rationalize_eval_mapping(mapping, nderiv, space, indices_quad)[source]#
select_loops(indices, ranges, body, boundary, boundary_basis=False)[source]#
variables(names, dtype, **args)[source]#