AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
IndexDistribution.inc.hpp
1#pragma once
2
3#include <amdis/Initfile.hpp>
4#include <amdis/Output.hpp>
5
6namespace AMDiS {
7
8#if HAVE_MPI
9
10template <class G, class L>
11 template <class Basis>
12ISTLIndexDistribution<G,L>::ISTLIndexDistribution(Basis const& basis)
13{
14 using SolverType = Dune::SolverCategory::Category;
15 std::string category = "default";
16 Parameters::get("solver category", category);
17
18 auto const& gv = basis.gridView();
19 int mpiSize = gv.comm().size();
20
21 cat_ = SolverType::sequential;
22 if (category == "default")
23 {
24 if (mpiSize == 1)
25 {
26 cat_ = SolverType::sequential;
27 }
28 else
29 {
30 // Use overlapping solver if grid has overlap
31 if (gv.overlapSize(0) > 0)
32 cat_ = SolverType::overlapping;
33 else
34 {
35 // TODO(FM): Remove once nonoverlapping solvers are supported
36 warning("Nonoverlapping solvers are currently not supported.");
37 cat_ = SolverType::nonoverlapping;
38 }
39 }
40 }
41 else if (category != "sequential" && mpiSize == 1)
42 {
43 warning("Only one process detected. Solver category set to sequential\n");
44 cat_ = SolverType::sequential;
45 }
46 else if (category == "sequential")
47 {
48 test_exit(mpiSize == 1, "Solver category sequential is not supported in parallel\n");
49 cat_ = SolverType::sequential;
50 }
51 else if (category == "overlapping")
52 {
53 if (gv.overlapSize(0) == 0)
54 warning("Overlapping solver category chosen for grid with no overlap\n");
55 cat_ = SolverType::overlapping;
56 }
57 else if (category == "nonoverlapping")
58 {
59 // TODO(FM): Remove once nonoverlapping solvers are supported
60 warning("Nonoverlapping solvers are currently not supported.");
61 cat_ = SolverType::nonoverlapping;
62 }
63 else
64 {
65 error_exit("Unknown solver category\n");
66 }
67
68 update(basis);
69}
70
71#endif // HAVE_MPI
72
73} // end namespace AMDiS
static std::optional< T > get(std::string const &key)
Get parameter-values from parameter-tree.
Definition: Initfile.hpp:25