Commit 76f49c17 authored by Beatrix Becker's avatar Beatrix Becker
Browse files

[decoupled] increase flexibility of some functions

The calls to several functions are hardwired to the base class.
By using asImp, some of those calls are now forwarded to the
derived class, if applicable.
parent 496eb859
......@@ -100,6 +100,9 @@ template<class TypeTag> class FVPressure2P: public FVPressure<TypeTag>
{
typedef FVPressure<TypeTag> ParentType;
//the model implementation
typedef typename GET_PROP_TYPE(TypeTag, PressureModel) Implementation;
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView;
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar;
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem;
......@@ -300,7 +303,7 @@ public:
// iterate through leaf grid
for (const auto& element : Dune::elements(problem_.gridView()))
{
storePressureSolution(element);
asImp_().storePressureSolution(element);
}
}
......@@ -547,6 +550,14 @@ public:
}
private:
//! Returns the implementation of the problem (i.e. static polymorphism)
Implementation &asImp_()
{ return *static_cast<Implementation *>(this); }
//! \copydoc Dumux::IMPETProblem::asImp_()
const Implementation &asImp_() const
{ return *static_cast<const Implementation *>(this); }
Problem& problem_;
const GlobalPosition& gravity_; //!< vector including the gravity constant
......
......@@ -132,6 +132,7 @@ class FVSaturation2P: public FVTransport<TypeTag>
typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition;
typedef Dune::FieldVector<Scalar, dim> DimVector;
protected:
CapillaryFlux& capillaryFlux()
{
return *capillaryFlux_;
......@@ -261,7 +262,7 @@ public:
if (this->enableLocalTimeStepping())
this->innerUpdate(updateVec);
else
updateSaturationSolution(updateVec);
asImp_().updateSaturationSolution(updateVec);
}
/*! \brief Updates the primary transport variable.
......@@ -272,7 +273,7 @@ public:
*/
void updateTransportedQuantity(TransportSolutionType& updateVec, Scalar dt)
{
updateSaturationSolution(updateVec, dt);
asImp_().updateSaturationSolution(updateVec, dt);
}
/*! \brief Globally updates the saturation solution
......
......@@ -225,7 +225,7 @@ public:
*/
void update()
{
assemble(false); Dune::dinfo << "pressure calculation"<< std::endl;
asImp_().assemble(false); Dune::dinfo << "pressure calculation"<< std::endl;
solve();
return;
......@@ -431,9 +431,8 @@ void FVPressure<TypeTag>::assemble(bool first)
int eIdxGlobalJ = problem_.variables().index(elementNeighbor);
// check for hanging nodes
// take a hanging node never from the element with smaller level!
bool haveSameLevel = (element.level() == elementNeighbor.level());
// calculate only from one side, but add matrix entries for both sides
// calculate only from one side (except for hanging nodes), but add matrix entries for both sides
// the last condition is needed to properly assemble in the presence
// of ghost elements
if (GET_PROP_VALUE(TypeTag, VisitFacesOnlyOnce)
......@@ -441,7 +440,6 @@ void FVPressure<TypeTag>::assemble(bool first)
&& elementNeighbor.partitionType() == Dune::InteriorEntity)
continue;
//check for hanging nodes
entries = 0;
asImp_().getFlux(entries, intersection, cellDataI, first);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment