From e26ac777c2dcea6a2ed7619cd600b7055896f365 Mon Sep 17 00:00:00 2001 From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de> Date: Wed, 25 Jul 2018 15:31:53 +0200 Subject: [PATCH] [staggered][elementSolutiuon] Add convenience function * directly creates elementSolution from CC privars --- .../staggered/elementsolution.hh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/dumux/discretization/staggered/elementsolution.hh b/dumux/discretization/staggered/elementsolution.hh index 06a9482c07..51bcbc0f4a 100644 --- a/dumux/discretization/staggered/elementsolution.hh +++ b/dumux/discretization/staggered/elementsolution.hh @@ -32,10 +32,10 @@ namespace Dumux { /*! * \ingroup StaggeredDiscretization - * \brief Helper function to creater a PrimaryVariables object from CellCenterPrimaryVariables + * \brief Helper function to create a PrimaryVariables object from CellCenterPrimaryVariables * \tparam PrimaryVariables The type of the desired primary variables object * \tparam CellCenterPrimaryVariables The type of the cell center (input) primary variables object - * \param CellCenterPrimaryVariables The cell center (input) primary variables object + * \param cellCenterPrimaryVariables The cell center (input) primary variables object */ template<class PrimaryVariables, class CellCenterPrimaryVariables> PrimaryVariables makePriVarsFromCellCenterPriVars(const CellCenterPrimaryVariables& cellCenterPriVars) @@ -56,7 +56,7 @@ using StaggeredElementSolution = Dune::BlockVector<PrimaryVariables>; /*! * \ingroup StaggeredDiscretization * \brief Make an element solution for staggered schemes - * \note This is e.g. used to contruct an element solution at Dirichlet boundaries + * \note This is e.g. used to construct an element solution at Dirichlet boundaries */ template<class FVElementGeometry, class PrimaryVariables> auto elementSolution(PrimaryVariables&& priVars) @@ -66,6 +66,19 @@ auto elementSolution(PrimaryVariables&& priVars) return StaggeredElementSolution<PrimaryVariables>({std::move(priVars)}); } +/*! + * \ingroup StaggeredDiscretization + * \brief Helper function to create an elementSolution from cell center primary variables + * \tparam PrimaryVariables The type of the desired primary variables object + * \tparam CellCenterPrimaryVariables The type of the cell center (input) primary variables object + * \param cellCenterPrimaryVariables The cell center (input) primary variables object + */ +template<class PrimaryVariables, class CellCenterPrimaryVariables> +StaggeredElementSolution<PrimaryVariables> makeElementSolutionFromCellCenterPrivars(const CellCenterPrimaryVariables& cellCenterPriVars) +{ + return StaggeredElementSolution<PrimaryVariables>({makePriVarsFromCellCenterPriVars<PrimaryVariables>(cellCenterPriVars)}); +} + } // end namespace Dumux #endif -- GitLab