24#ifndef DUMUX_ASSEMBLY_INITIAL_SOLUTION_HH
25#define DUMUX_ASSEMBLY_INITIAL_SOLUTION_HH
39template<
class SolutionVector,
class Problem>
42 const auto& gg = problem.gridGeometry();
43 using GridGeometry = std::decay_t<
decltype(gg)>;
48 constexpr int dim = GridGeometry::GridView::dimension;
49 const auto numDofs = gg.vertexMapper().size();
50 const auto numVert = gg.gridView().size(dim);
55 if (numDofs != numVert)
57 std::vector<bool> dofVisited(numDofs,
false);
58 for (
const auto& element : elements(gg.gridView()))
60 for (
int i = 0; i < element.subEntities(dim); ++i)
62 const auto dofIdxGlobal = gg.vertexMapper().subIndex(element, i, dim);
64 if (!dofVisited[dofIdxGlobal])
66 sol[dofIdxGlobal] = problem.initial(element.template subEntity<dim>(i));
67 dofVisited[dofIdxGlobal] =
true;
76 for (
const auto& vertex : vertices(gg.gridView()))
77 sol[gg.vertexMapper().index(vertex)] = problem.initial(vertex);
84 problem.applyInitialSolution(sol);
90 sol.resize(gg.numDofs());
91 for (
const auto& element : elements(gg.gridView()))
92 sol[gg.elementMapper().index(element)] = problem.initial(element);
101template<
class SolutionVector,
class Problem>
The available discretization methods in Dumux.
void assembleInitialSolution(SolutionVector &sol, const Problem &problem)
Definition: initialsolution.hh:40
SolutionVector makeInitialSolution(const Problem &problem)
Definition: initialsolution.hh:102