20 #include "pism/util/Context.hh"
21 #include "pism/util/Profiling.hh"
22 #include "pism/util/Units.hh"
23 #include "pism/util/Time.hh"
24 #include "pism/util/Logger.hh"
25 #include "pism/util/EnthalpyConverter.hh"
26 #include "pism/util/error_handling.hh"
27 #include "pism/pism_config.hh"
40 std::shared_ptr<units::System> sys,
41 std::shared_ptr<Config> conf,
42 std::shared_ptr<EnthalpyConverter> EC,
43 std::shared_ptr<Time> t,
44 std::shared_ptr<Logger>
log,
54 std::shared_ptr<Time>
time;
62 std::shared_ptr<Config> config, std::shared_ptr<EnthalpyConverter> EC, std::shared_ptr<Time> t,
63 std::shared_ptr<Logger>
L,
65 : m_impl(new
Impl(c, sys, config, EC, t,
L, p)) {
74 m_impl->
logger->message(1,
"Error: failed to de-allocate a ParallelIO I/O system\n");
141 #if (Pism_USE_PIO==1)
143 int ierr = PIOc_set_iosystem_error_handling(PIO_DEFAULT, PIO_BCAST_ERROR, NULL);
149 base =
config()->get_number(
"output.pio.base"),
150 stride =
config()->get_number(
"output.pio.stride"),
151 n_writers =
config()->get_number(
"output.pio.n_writers");
153 if (n_writers > this->
size()) {
155 "number of ParallelIO writers (%d)"
156 " exceeds the communicator size (%d)",
157 n_writers, this->
size());
160 ierr = PIOc_Init_Intracomm(
m_impl->
com, n_writers, stride, base, PIO_REARR_BOX,
171 const std::string &prefix,
187 Time::Ptr time = std::make_shared<Time>(com, config, *logger, sys);
192 return std::shared_ptr<Context>(
new Context(com, sys, config, EC, time, logger, prefix));
std::shared_ptr< Config > Ptr
std::shared_ptr< Config > config
std::shared_ptr< Logger > logger
Impl(MPI_Comm c, std::shared_ptr< units::System > sys, std::shared_ptr< Config > conf, std::shared_ptr< EnthalpyConverter > EC, std::shared_ptr< Time > t, std::shared_ptr< Logger > log, const std::string &p)
std::shared_ptr< Time > time
std::shared_ptr< EnthalpyConverter > enthalpy_converter
std::shared_ptr< units::System > unit_system
Context(MPI_Comm c, std::shared_ptr< units::System > sys, std::shared_ptr< Config > conf, std::shared_ptr< EnthalpyConverter > EC, std::shared_ptr< Time > t, std::shared_ptr< Logger > log, const std::string &p)
std::shared_ptr< const Config > config() const
const std::string & prefix() const
const Profiling & profiling() const
std::shared_ptr< const Logger > log() const
std::shared_ptr< units::System > unit_system() const
std::shared_ptr< const Time > time() const
std::shared_ptr< EnthalpyConverter > enthalpy_converter() const
std::shared_ptr< EnthalpyConverter > Ptr
Converts between specific enthalpy and temperature or liquid content.
std::shared_ptr< Logger > Ptr
static RuntimeError formatted(const ErrorLocation &location, const char format[],...) __attribute__((format(printf
build a RuntimeError with a formatted message
std::shared_ptr< Time > Ptr
std::shared_ptr< System > Ptr
#define PISM_ERROR_LOCATION
std::shared_ptr< Context > context_from_options(MPI_Comm com, const std::string &prefix, bool print)
Create a default context using options.
Logger::Ptr logger_from_options(MPI_Comm com)
Config::Ptr config_from_options(MPI_Comm com, const Logger &log, units::System::Ptr unit_system)
Create a configuration database using command-line options.
void print_config(const Logger &log, int verbosity_threshhold, const Config &config)
Report configuration parameters to stdout.
static double S(unsigned n)