6from ..Project
import Project
12 Generates repositories/SolverRepository.h/.cpp: one extern instance per
13 solver registered with the project, plus getMinTimeStamp()/
14 getMaxTimeStamp() aggregating over all of them.
18 TEMPLATE_HEADER_FILE =
"""
19// This file is part of the ExaHyPE2 project. For conditions of distribution and
20// use, please see the copyright notice at www.peano-framework.org
23{% for item in SOLVERS -%}
24#include "{{ item[0] }}.h"
25{# Comment to ensure that jinja2 adds a new line#}
29{% for item in NAMESPACE -%}
33 {% for item in SOLVERS -%}
34 extern {{ item[0] }} {{ item[1] }};
35 {# Comment to ensure that jinja2 adds a new line#}
39 * Return the global min time stamp over all solvers.
41 double getMinTimeStamp();
44 * Return the global max time stamp over all solvers.
46 double getMaxTimeStamp();
49 * Return the global min time step size over all solvers.
51 double getMinTimeStepSize();
54 * Return the global max time step size over all solvers.
56 double getMaxTimeStepSize();
59 * Does any solver want to plot? Only solvers with a plotter are asked.
60 * Each plotter then decides itself within the plot phase whether it
61 * plots (@see exahype2.api.Solver.Plotter).
65{% for item in NAMESPACE -%}
70 TEMPLATE_CPP_FILE =
"""
71// This file is part of the ExaHyPE2 project. For conditions of distribution and
72// use, please see the copyright notice at www.peano-framework.org
73#include "SolverRepository.h"
78{% for item in NAMESPACE -%}
82 {% for item in SOLVERS -%}
83 {{ item[0] }} {{ item[1] }};
84 {# Comment to ensure that jinja2 adds a new line#}
88 double getMinTimeStamp() {
89 double result = std::numeric_limits<double>::max();
90 {% for item in SOLVERS -%}
91 result = std::min( result, {{ item[1] }}.getMinTimeStamp() );
92 {# Comment to ensure that jinja2 adds a new line#}
98 double getMaxTimeStamp() {
100 {% for item in SOLVERS -%}
101 result = std::max( result, {{ item[1] }}.getMaxTimeStamp() );
102 {# Comment to ensure that jinja2 adds a new line#}
108 double getMinTimeStepSize() {
109 double result = std::numeric_limits<double>::max();
110 {% for item in SOLVERS -%}
111 result = std::min( result, {{ item[1] }}.getMinTimeStepSize() );
112 {# Comment to ensure that jinja2 adds a new line#}
118 double getMaxTimeStepSize() {
120 {% for item in SOLVERS -%}
121 result = std::max( result, {{ item[1] }}.getMaxTimeStepSize() );
122 {# Comment to ensure that jinja2 adds a new line#}
130 {% for item in PLOTTING_SOLVERS -%}
131 result |= {{ item }}.wantsToPlot();
132 {# Comment to ensure that jinja2 adds a new line#}
137{% for item in NAMESPACE -%}
148 "PLOTTING_SOLVERS": [],
149 "LOAD_BALANCER": self.
project._load_balancer_name,
150 "LOAD_BALANCER_ARGUMENTS": self.
project._load_balancer_arguments,
151 "LOG_FILTER_FILE": self.
project._log_filter_file,
152 "NUMBER_OF_THREADS": self.
project._number_of_threads,
153 "MULTICORE_ORCHESTRATION": self.
project._multicore_orchestration,
154 "TIMEOUT": self.
project._timeout,
156 "ADDITIONAL_INCLUDES": self.
project._additional_includes,
162 for solver
in self.
project._solvers:
164 (solver.get_name_of_solver_class(), solver.get_name_of_global_instance())
168 solver.get_name_of_global_instance()
171 generated_solver_files = (
176 peano_project.namespace + [
"repositories"],
177 peano_project.subdirectory +
"repositories",
183 peano_project.output.add(generated_solver_files)
184 peano_project.output.makefile.add_cpp_file(
185 peano_project.subdirectory +
"repositories/SolverRepository.cpp", generated=
True
Base class for the code generation steps that turn an ExaHyPE 2 Project's configuration into actual g...
Generates repositories/SolverRepository.h/.cpp: one extern instance per solver registered with the pr...
__init__(self, Project project)
solverRepositoryDictionary
construct_output(self, peano_project)
Add this generator's output to peano_project (a peano4.api.Project-compatible object,...
__set_solver_repository_dict(self)