zoomy_core.transformation.generic_c module

zoomy_core.transformation.generic_c module#

Module zoomy_core.transformation.generic_c.

zoomy_core.transformation.generic_c.flatten_index(indices, shape)#

Flatten index.

zoomy_core.transformation.generic_c.get_nested_shape(expr)#

Get nested shape.

class zoomy_core.transformation.generic_c.GenericCppBase(*args, **kwargs)#

Bases: CXX11CodePrinter

GenericCppBase. (class).

gpu_enabled = True#
real_type = 'double'#
math_namespace = 'std::'#
ARG_MAPPING = {'aux_minus': 'Qaux_minus', 'aux_plus': 'Qaux_plus', 'aux_variables': 'Qaux', 'distance': 'dX', 'dt': 'dt', 'dx': 'dx', 'flux_minus': 'flux_minus', 'flux_plus': 'flux_plus', 'gradient_variables': 'gradQ', 'normal': 'n', 'p': 'p', 'position': 'X', 'q_minus': 'Q_minus', 'q_plus': 'Q_plus', 'source': 'source_term', 'time': 'time', 'variables': 'Q'}#
c_functions = {'Abs': <function GenericCppBase.<lambda>>, 'Max': <function GenericCppBase.<lambda>>, 'Min': <function GenericCppBase.<lambda>>, 'clamp_momentum': <function GenericCppBase.<lambda>>, 'clamp_positive': <function GenericCppBase.<lambda>>, 'conditional': <function GenericCppBase.<lambda>>, 'max_wavespeed': <function GenericCppBase.<lambda>>}#
register_map(name, keys)#

Register map.

get_array_type(shape)#

Returns the C++ type string for the array.

get_array_declaration(target_name, shape, init_zero=False)#

Returns the C++ declaration string for the array.

format_array_initialization(sym_name, elements)#

Hook to format how local argument arrays are initialized.

convert_expression_body(expr, shape, target='res')#

Convert expression body.

get_includes()#

Get includes.

get_simple_array_def()#

Get simple array def.

format_accessor(var_name, index)#

Format accessor.

format_assignment(target_name, indices, value, shape)#

Format assignment.

get_variable_declaration(variable_name)#

Get variable declaration.

wrap_function_signature(name, args_str, body_str, shape)#

Wrap function signature.

doprint(expr, **settings)#

Doprint.

class zoomy_core.transformation.generic_c.GenericCppModel(model, *args, **kwargs)#

Bases: GenericCppBase

GenericCppModel. (class).

classmethod write_code(model, settings, filename='Model.H')#

Write code.

create_code()#

Create code.

get_file_header()#

Get file header.

Get file footer.

get_bc_args()#

Hook to define boundary condition arguments.

class zoomy_core.transformation.generic_c.GenericCppNumerics(numerics, gpu_enabled=False, *args, **kwargs)#

Bases: GenericCppBase

GenericCppNumerics. (class).

classmethod write_code(numerics, settings, filename='Numerics.H', gpu_enabled=False)#

Write code.

create_code()#

Create code.

get_file_header()#

Get file header.

Get file footer.

class zoomy_core.transformation.generic_c.CppModel(model, *args, **kwargs)#

Bases: GenericCppModel

CppModel. (class).

class zoomy_core.transformation.generic_c.CppNumerics(numerics, *args, **kwargs)#

Bases: GenericCppNumerics

CppNumerics. (class).