7from ..Project
import Project
13 Generates repositories/SolverRepository.h/.cpp: one extern instance per
14 solver registered with the project, plus getMinTimeStamp()/
15 getMaxTimeStamp() aggregating over all of them.
19 TEMPLATE_HEADER_FILE =
"""
20// This file is part of the ExaHyPE2 project. For conditions of distribution and
21// use, please see the copyright notice at www.peano-framework.org
24{% for item in SOLVERS -%}
25#include "{{ item[0] }}.h"
26{# Comment to ensure that jinja2 adds a new line#}
30{% for item in NAMESPACE -%}
34 {% for item in SOLVERS -%}
35 extern {{ item[0] }} {{ item[1] }};
36 {# Comment to ensure that jinja2 adds a new line#}
40 * Return the global min time stamp over all solvers.
42 double getMinTimeStamp();
45 * Return the global max time stamp over all solvers.
47 double getMaxTimeStamp();
50 * Return the global min time step size over all solvers.
52 double getMinTimeStepSize();
55 * Return the global max time step size over all solvers.
57 double getMaxTimeStepSize();
60 * Does any solver want to plot? Only solvers with a plotter are asked.
61 * Each plotter then decides itself within the plot phase whether it
62 * plots (@see exahype2.api.Solver.Plotter).
66{% for item in NAMESPACE -%}
71 TEMPLATE_CPP_FILE =
"""
72// This file is part of the ExaHyPE2 project. For conditions of distribution and
73// use, please see the copyright notice at www.peano-framework.org
74#include "SolverRepository.h"
79{% for item in NAMESPACE -%}
83 {% for item in SOLVERS -%}
84 {{ item[0] }} {{ item[1] }};
85 {# Comment to ensure that jinja2 adds a new line#}
89 double getMinTimeStamp() {
90 double result = std::numeric_limits<double>::max();
91 {% for item in SOLVERS -%}
92 result = std::min( result, {{ item[1] }}.getMinTimeStamp() );
93 {# Comment to ensure that jinja2 adds a new line#}
99 double getMaxTimeStamp() {
101 {% for item in SOLVERS -%}
102 result = std::max( result, {{ item[1] }}.getMaxTimeStamp() );
103 {# Comment to ensure that jinja2 adds a new line#}
109 double getMinTimeStepSize() {
110 double result = std::numeric_limits<double>::max();
111 {% for item in SOLVERS -%}
112 result = std::min( result, {{ item[1] }}.getMinTimeStepSize() );
113 {# Comment to ensure that jinja2 adds a new line#}
119 double getMaxTimeStepSize() {
121 {% for item in SOLVERS -%}
122 result = std::max( result, {{ item[1] }}.getMaxTimeStepSize() );
123 {# Comment to ensure that jinja2 adds a new line#}
131 {% for item in PLOTTING_SOLVERS -%}
132 result |= {{ item }}.wantsToPlot();
133 {# Comment to ensure that jinja2 adds a new line#}
138{% for item in NAMESPACE -%}
149 "PLOTTING_SOLVERS": [],
150 "LOAD_BALANCER": self.
project._load_balancer_name,
151 "LOAD_BALANCER_ARGUMENTS": self.
project._load_balancer_arguments,
152 "LOG_FILTER_FILE": self.
project._log_filter_file,
153 "NUMBER_OF_THREADS": self.
project._number_of_threads,
154 "MULTICORE_ORCHESTRATION": self.
project._multicore_orchestration,
155 "TIMEOUT": self.
project._timeout,
157 "ADDITIONAL_INCLUDES": self.
project._additional_includes,
163 for solver
in self.
project._solvers:
165 (solver.get_name_of_solver_class(), solver.get_name_of_global_instance())
169 solver.get_name_of_global_instance()
172 generated_solver_files = (
177 peano_project.namespace + [
"repositories"],
178 os.path.join(peano_project.temporary_subdirectory,
"repositories"),
184 peano_project.output.add(generated_solver_files)
185 peano_project.output.makefile.add_cpp_file(
186 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)
dict 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)