23#include "rheolef/solver_option.h"
24#include <unordered_set>
47 if (dis_ext_nnz != 0) {
51#if defined(_RHEOLEF_HAVE_MUMPS)
52#if defined(_RHEOLEF_HAVE_MUMPS_WITH_METIS) || \
53 defined(_RHEOLEF_HAVE_MUMPS_WITH_PARMETIS) || \
54 defined(_RHEOLEF_HAVE_MUMPS_WITH_SCOTCH) || \
55 defined(_RHEOLEF_HAVE_MUMPS_WITH_PTSCOTCH)
56 constexpr bool have_mumps_scotch =
true,
57 have_mumps_no_scotch =
false;
59 constexpr bool have_mumps_scotch =
false,
60 have_mumps_no_scotch =
true;
63 constexpr bool have_mumps_scotch =
false,
64 have_mumps_no_scotch =
false;
66 constexpr bool have_mumps = have_mumps_scotch || have_mumps_no_scotch;
67#ifdef _RHEOLEF_HAVE_CHOLMOD
68 constexpr bool have_cholmod =
true;
70 constexpr bool have_cholmod =
false;
72#ifdef _RHEOLEF_HAVE_UMFPACK
73 constexpr bool have_umfpack =
true;
75 constexpr bool have_umfpack =
false;
98strip_white (std::string x)
102 while (first < x.length() && (x[first] ==
' ' || x[first] ==
',')) ++first;
103 return x.substr(first);
107split_options (std::string o, std::vector<std::string>& o_table)
111 while (first < o.length()) {
112 while (first < o.length() && (o[first] ==
' ' || o[first] ==
',')) ++first;
114 while ( last < o.length() && !(o[last] ==
' ' || o[last] ==
',')) ++last;
115 if (last - first != 0) {
116 string x = strip_white (
string(o, first, last-first));
117 o_table.push_back (x);
124split_options (std::string o, std::unordered_set<std::string>& o_table)
128 while (first < o.length()) {
129 while (first < o.length() && (o[first] ==
' ' || o[first] ==
',')) ++first;
131 while ( last < o.length() && !(o[last] ==
' ' || o[last] ==
',')) ++last;
132 if (last - first != 0) {
133 string x = o.substr (first, last-first);
142 const std::vector<std::string>& preferred,
143 const std::unordered_set<std::string>& available)
147 for (
size_t i = 0; i < preferred.size(); ++i) {
148 string x = strip_white(preferred[i]);
149 if (available.find (x) != available.end()) {
161 string preferred_library = (init_preferred_library !=
"") ? init_preferred_library : available_library;
162 vector<string> preferred;
163 unordered_set<string> available;
164 split_options (available_library, available);
166 string choice = try_choice (preferred, available);
168 if (dis_ext_nnz == 0) {
169 dis_warning_macro (
"preferred_library=\""<<init_preferred_library<<
"\" not available, use default=\""<<available_library<<
"\"");
171 vector<string> available_as_vector;
172 split_options (available_library, available_as_vector);
173 choice = try_choice (available_as_vector, available);
static std::string default_preferred_library(const csr< T, M > &a)
std::string preferred_library
static std::string _default_preferred_library(size_t dis_ext_nnz, bool is_sym, bool is_dp)
static std::string _used_library(std::string init_preferred_library, size_t dis_ext_nnz, bool is_sym, bool is_dp)
#define dis_warning_macro(message)
This file is part of Rheolef.