diff --git a/dumux/decoupled/2p/diffusion/diffusionproblem2p.hh b/dumux/decoupled/2p/diffusion/diffusionproblem2p.hh index cf69e6a179c9aeec87de53b716ebe1146b9a0aa8..3421f40e825027ae5d509be32fa06e0fd13da39d 100644 --- a/dumux/decoupled/2p/diffusion/diffusionproblem2p.hh +++ b/dumux/decoupled/2p/diffusion/diffusionproblem2p.hh @@ -113,7 +113,7 @@ public: */ Scalar temperature() const { - return asImp_()->temperature(); + return this->asImp_()->temperature(); } ; @@ -147,18 +147,6 @@ public: // \} private: - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation *asImp_() - { - return static_cast<Implementation *> (this); - } - - //! \copydoc asImp_() - const Implementation *asImp_() const - { - return static_cast<const Implementation *> (this); - } - GlobalPosition gravity_; // fluids and material properties diff --git a/dumux/decoupled/2p/impes/impesproblem2p.hh b/dumux/decoupled/2p/impes/impesproblem2p.hh index f1c82e08411c58ffe7edd3723cce859c03806646..3eb33684c6838d422d07f4579ddf83b41019df78 100644 --- a/dumux/decoupled/2p/impes/impesproblem2p.hh +++ b/dumux/decoupled/2p/impes/impesproblem2p.hh @@ -98,7 +98,7 @@ public: * This method MUST be overwritten by the actual problem. */ Scalar temperature() const - { return asImp_()->temperature(); }; + { return this->asImp_()->temperature(); }; /*! * \brief Returns the acceleration due to gravity. @@ -126,13 +126,6 @@ public: private: //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation *asImp_() - { return static_cast<Implementation *>(this); } - - //! \copydoc asImp_() - const Implementation *asImp_() const - { return static_cast<const Implementation *>(this); } - GlobalPosition gravity_; // fluids and material properties diff --git a/dumux/decoupled/2p/transport/transportproblem2p.hh b/dumux/decoupled/2p/transport/transportproblem2p.hh index 795cad9bd1ab01df39cd546fd3e09c78b77389e9..35b5fd6efdd526145dd8eac8f698deaae0469d63 100644 --- a/dumux/decoupled/2p/transport/transportproblem2p.hh +++ b/dumux/decoupled/2p/transport/transportproblem2p.hh @@ -77,7 +77,7 @@ public: * This method MUST be overwritten by the actual problem. */ Scalar temperature() const - { return asImp_()->temperature(); }; + { return this->asImp_()->temperature(); }; /*! * \brief Returns the acceleration due to gravity. @@ -104,14 +104,6 @@ public: // \} private: - //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation *asImp_() - { return static_cast<Implementation *>(this); } - - //! \copydoc asImp_() - const Implementation *asImp_() const - { return static_cast<const Implementation *>(this); } - GlobalPosition gravity_; // fluids and material properties diff --git a/dumux/decoupled/common/impesproblem.hh b/dumux/decoupled/common/impesproblem.hh index 843fa1b82912bef861de3859d96dfb898d1043ba..727a0ff9869ccb640099e84cb2fafea90f0a8669 100644 --- a/dumux/decoupled/common/impesproblem.hh +++ b/dumux/decoupled/common/impesproblem.hh @@ -98,19 +98,19 @@ public: variables_(gridView), dt_(0) { -// // calculate the bounding box of the grid view -// VertexIterator vIt = gridView.template begin<dim>(); -// const VertexIterator vEndIt = gridView.template end<dim>(); -// for (; vIt!=vEndIt; ++vIt) { -// for (int i=0; i<dim; i++) { -// bboxMin_[i] = std::min(bboxMin_[i], vIt->geometry().corner(0)[i]); -// bboxMax_[i] = std::max(bboxMax_[i], vIt->geometry().corner(0)[i]); -// } -// } - - pressModel_ = new PressureModel(*asImp_()); - satModel_ = new SaturationModel(*asImp_()); - model_ = new IMPESModel(*asImp_()) ; + // calculate the bounding box of the grid view + VertexIterator vIt = gridView.template begin<dim>(); + const VertexIterator vEndIt = gridView.template end<dim>(); + for (; vIt!=vEndIt; ++vIt) { + for (int i=0; i<dim; i++) { + bboxMin_[i] = std::min(bboxMin_[i], vIt->geometry().corner(0)[i]); + bboxMax_[i] = std::max(bboxMax_[i], vIt->geometry().corner(0)[i]); + } + } + + pressModel_ = new PressureModel(asImp_()); + satModel_ = new SaturationModel(asImp_()); + model_ = new IMPESModel(asImp_()) ; } //! destructor @@ -157,7 +157,7 @@ public: { // allocate temporary vectors for the updates typedef TransportSolutionType Solution; - Solution k1 = (*asImp_()).variables().transportedQuantity(); + Solution k1 = asImp_().variables().transportedQuantity(); Scalar t = timeManager().time(); @@ -182,7 +182,7 @@ public: timeManager().setTimeStepSize(dt_); // explicit Euler: Sat <- Sat + dt*N(Sat) - (*asImp_()).variables().transportedQuantity() += (k1 *= timeManager().timeStepSize()); + asImp_().variables().transportedQuantity() += (k1 *= timeManager().timeStepSize()); } /*! @@ -195,7 +195,7 @@ public: */ void postTimeStep() { - (*asImp_()).pressureModel().updateMaterialLaws(); + asImp_().pressureModel().updateMaterialLaws(); }; /*! @@ -376,7 +376,7 @@ public: typedef Dumux::Restart Restarter; Restarter res; - res.serializeBegin(*asImp_()); + res.serializeBegin(asImp_()); std::cerr << "Serialize to file " << res.fileName() << "\n"; timeManager_.serialize(res); @@ -397,7 +397,7 @@ public: typedef Dumux::Restart Restarter; Restarter res; - res.deserializeBegin(*asImp_(), t); + res.deserializeBegin(asImp_(), t); std::cerr << "Deserialize from file " << res.fileName() << "\n"; timeManager_.deserialize(res); @@ -423,12 +423,12 @@ public: protected: //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation *asImp_() - { return static_cast<Implementation *>(this); } + Implementation &asImp_() + { return *static_cast<Implementation *>(this); } //! \copydoc asImp_() - const Implementation *asImp_() const - { return static_cast<const Implementation *>(this); } + const Implementation &asImp_() const + { return *static_cast<const Implementation *>(this); } VtkMultiWriter& resultWriter() { diff --git a/dumux/decoupled/common/onemodelproblem.hh b/dumux/decoupled/common/onemodelproblem.hh index 5d70c800b257c414cf6c3c6a1ca68642d44ad80a..0a8f16437c252b9ee3d91748a21ebbbddee47345 100644 --- a/dumux/decoupled/common/onemodelproblem.hh +++ b/dumux/decoupled/common/onemodelproblem.hh @@ -96,8 +96,7 @@ public: bboxMax_(-std::numeric_limits<double>::max()), timeManager_(verbose), variables_(gridView), - dt_(0), - resultWriter_(asImp_()->name()) + dt_(0) { // // calculate the bounding box of the grid view // VertexIterator vIt = gridView.template begin<dim>(); @@ -109,7 +108,7 @@ public: // } // } - model_ = new Model(*asImp_()) ; + model_ = new Model(asImp_()) ; } //! destructor @@ -118,29 +117,6 @@ public: delete model_; } - /*! - * \name Simulation steering - */ - // \{ - - /*! - * \brief Start the simulation procedure. - * - * This method is usually called by the main() function and simply - * uses Dumux::TimeManager::runSimulation() to do the actual - * work. - */ -/* - bool simulate(Scalar dtInitial, Scalar tEnd) - { - // set the initial time step and the time where the simulation ends - timeManager_.setEndTime(tEnd); - timeManager_.setTimeStepSize(dtInitial); - timeManager_.runSimulation(*asImp_()); - return true; - }; -*/ - /*! * \brief Called by the Dumux::TimeManager in order to @@ -174,7 +150,7 @@ public: { // allocate temporary vectors for the updates typedef typename Model::SolutionType Solution; - Solution k1 = (*asImp_()).variables().saturation(); + Solution k1 = asImp_().variables().saturation(); dt_ = 1e100; Scalar t = timeManager().time(); @@ -187,7 +163,7 @@ public: timeManager().setTimeStepSize(dt_); // explicit Euler: Sat <- Sat + dt*N(Sat) - (*asImp_()).variables().saturation() += (k1 *= dt_); + asImp_().variables().saturation() += (k1 *= dt_); } /*! @@ -382,9 +358,7 @@ public: typedef Dumux::Restart Restarter; Restarter res; - res.deserializeBegin(gridView(), - asImp_()->name(), - t); + res.deserializeBegin(asImp_(), t); std::cerr << "Deserialize from file " << res.fileName() << "\n"; timeManager_.deserialize(res); @@ -398,12 +372,12 @@ public: protected: //! Returns the implementation of the problem (i.e. static polymorphism) - Implementation *asImp_() - { return static_cast<Implementation *>(this); } + Implementation &asImp_() + { return *static_cast<Implementation *>(this); } //! \copydoc asImp_() - const Implementation *asImp_() const - { return static_cast<const Implementation *>(this); } + const Implementation &asImp_() const + { return *static_cast<const Implementation *>(this); } VtkMultiWriter& resultWriter() {