Commit 71cee19e authored by Michael Kuron's avatar Michael Kuron
Browse files

pystencils_walberla: sort generated field extractions and parameter access

That way, their order is deterministic and the generated code does not change every time the generation is run.
parent 40498f3e
......@@ -163,18 +163,18 @@ def generate_block_data_to_field_extraction(ctx, kernel_info, parameters_to_igno
}
result = "\n".join(
field_extraction_code(field=field, is_temporary=False, update_member=update_member, **args) for field in
normal_fields) + "\n"
normal_fields)
result += "\n".join(
field_extraction_code(field=field, is_temporary=True, update_member=update_member, **args) for field in
temporary_fields)
return result
return "\n".join(sorted(result.split("\n")))
def generate_refs_for_kernel_parameters(kernel_info, prefix, parameters_to_ignore=(), ignore_fields=False):
symbols = {p.field_name for p in kernel_info.parameters if p.is_field_pointer and not ignore_fields}
symbols.update(p.symbol.name for p in kernel_info.parameters if not p.is_field_parameter)
symbols.difference_update(parameters_to_ignore)
return "\n".join("auto & %s = %s%s_;" % (s, prefix, s) for s in symbols)
return "\n".join(sorted("auto & %s = %s%s_;" % (s, prefix, s) for s in symbols))
@jinja2.contextfilter
......@@ -365,7 +365,7 @@ def generate_members(ctx, kernel_info, parameters_to_ignore=(), only_fields=Fals
if hasattr(kernel_info, 'varying_parameters'):
result.extend(["%s %s_;" % e for e in kernel_info.varying_parameters])
return "\n".join(result)
return "\n".join(sorted(result))
def generate_destructor(kernel_info, class_name):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment