20 bool petsc_running =
false;
22 bool mpi_started_here =
false;
24 void stop_if_flavor_is_missing()
26 const std::string flavor = param_globals::flavor !=
nullptr ? param_globals::flavor :
"";
28 if (flavor ==
"ginkgo") {
29 fprintf(stderr,
"\n*** The flavor \"ginkgo\" is not available, openCARP was built without the Ginkgo backend.\n\n");
34 if (!flavor.empty() && flavor !=
"ginkgo") {
35 fprintf(stderr,
"\n*** The flavor \"%s\" is not available, openCARP was built with only the Ginkgo backend.\n\n",
47 return param_globals::flavor !=
nullptr && std::string{param_globals::flavor} ==
"ginkgo";
60 stop_if_flavor_is_missing();
64 initialize_PETSc(argc, argv, rc, help_msg);
70 while (delimiter < *argc && strcmp(argv[delimiter],
DELIMIT_OPTS) != 0) delimiter++;
71 const bool has_petsc_options = delimiter + 1 < *argc;
75 MPI_Initialized(&initialized);
79 MPI_Init_thread(
nullptr,
nullptr, MPI_THREAD_FUNNELED, &provided);
80 mpi_started_here =
true;
83 if (has_petsc_options)
84 log_msg(NULL, 3, 0,
"The options after \"%s\" are PETSc options, which the Ginkgo backend ignores.",
DELIMIT_OPTS);
95 if (mpi_started_here) {
96 mpi_started_here =
false;
108 void set_petsc_active(
bool active)
110 petsc_running = active;
Starts and stops the linear algebra backend the flavor parameter selects.
#define DELIMIT_OPTS
separates the openCARP options from the PETSc options on the command line
Basic utility structs and functions, mostly IO related.
void finalize_backend_and_exit(int code)
void initialize_backend(int *argc, char **argv, char *rc, char *help_msg)
void log_msg(FILE_SPEC out, int level, unsigned char flag, const char *fmt,...)