LCOV - code coverage report
Current view: top level - ugbase/lib_disc/time_disc - time_disc_interface.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 13 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 18 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2010-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Andreas Vogel
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : #ifndef __H__UG__LIB_DISC__TIME_DISC__TIME_DISC_INTERFACE__
      34              : #define __H__UG__LIB_DISC__TIME_DISC__TIME_DISC_INTERFACE__
      35              : 
      36              : // extern libraries
      37              : #include <deque>
      38              : 
      39              : // other ug libraries
      40              : #include "common/common.h"
      41              : 
      42              : // module intern libraries
      43              : #include "lib_disc/assemble_interface.h"
      44              : #include "lib_disc/time_disc/solution_time_series.h"
      45              : #include "lib_disc/spatial_disc/domain_disc_interface.h"
      46              : 
      47              : namespace ug{
      48              : 
      49              : /// \ingroup lib_disc_time_assemble
      50              : /// @{
      51              : 
      52              : /// Time Discretization Interface
      53              : /**
      54              :  * Defines the time discretization interface.
      55              :  *
      56              :  * This class uses a ISpatialDiscretization in order to implement the
      57              :  * IAssemble interface.
      58              :  *
      59              :  * After the method prepare step has been called, Jacobian/Defect can be computed.
      60              :  *
      61              :  * \tparam      TAlgebra                        Algebra Type
      62              :  */
      63              : template <typename TAlgebra>
      64            0 : class ITimeDiscretization : public IAssemble<TAlgebra>
      65              : {
      66              :         public:
      67              :         ///     Algebra type
      68              :                 typedef TAlgebra algebra_type;
      69              : 
      70              :         ///     Vector type
      71              :                 typedef typename algebra_type::vector_type vector_type;
      72              : 
      73              :         ///     Domain Discretization type
      74              :                 typedef IDomainDiscretization<TAlgebra>   domain_discretization_type;
      75              : 
      76              :         public:
      77              :         /// create and set domain discretization
      78              :         /**
      79              :          * \param[in] dd        Domain Discretization
      80              :          */
      81            0 :                 ITimeDiscretization(SmartPtr<IDomainDiscretization<TAlgebra> > spDD)
      82            0 :                         : m_spDomDisc(spDD)
      83              :                 {}
      84              : 
      85              :         /// prepares the assembling of Defect/Jacobian for a time step
      86              :         /**
      87              :          *      This function supplies the TimeDiscretization with previous time
      88              :          *      steps and step size before the assembling routines can be called.
      89              :          *
      90              :          * \param[in] prevSol   the solution at the previous time steps
      91              :          * \param[in] dt                size of time step
      92              :          */
      93              :                 virtual void prepare_step(SmartPtr<VectorTimeSeries<vector_type> > prevSol,
      94              :                                           number dt) = 0;
      95              : 
      96              :         /// prepares the assembling of Defect/Jacobian for a time step
      97              :         /**
      98              :          *      This function supplies the TimeDiscretization with previous time
      99              :          *      steps and step size before the assembling routines can be called.
     100              :          *      A sub-routine at element-level ("prep_timestep_elem") is called
     101              :          *      within this function.
     102              :          *
     103              :          * \param[in] prevSol   the solution at the previous time steps
     104              :          * \param[in] dt                size of time step
     105              :          * \param[in] dd                DoF Distribution
     106              :          */
     107              :         /// \{
     108              :                 virtual void prepare_step_elem(SmartPtr<VectorTimeSeries<vector_type> > prevSol,
     109              :                                                number dt, const GridLevel& gl) = 0;
     110            0 :                 void prepare_step_elem(SmartPtr<VectorTimeSeries<vector_type> > prevSol,
     111              :                                        number dt)
     112            0 :                 {prepare_step_elem(prevSol, dt, GridLevel());}
     113              :         /// \}
     114              : 
     115              :         /// finishes a time step and allows to adapt data depending on
     116              :         ///     the current solution elemDisc-wise
     117              :         /**
     118              :          *      This function is called after the assembling routines
     119              :          *      at the end of a time step.
     120              :          *
     121              :          * \param[in] currSol   the solution at the previous time steps
     122              :          * \param[in] dt                size of time step
     123              :          */
     124              :                 virtual void finish_step(SmartPtr<VectorTimeSeries<vector_type> > currSol) = 0;
     125              : 
     126              :         /// finishes a time step and allows to adapt data depending on
     127              :         ///     the current solution element-wise
     128              :         /**
     129              :          *      This function is called after the assembling routines at the end of a
     130              :          *      time step.
     131              :          *      Within this function "fsh_timestep_elem" is called which allows
     132              :          *      modifying data depending on the current solution at element-level.
     133              :          *
     134              :          * \param[in] currSol   the current solution
     135              :          * \param[in] dd                DoF Distribution
     136              :          */
     137              :         ///     \{
     138              :                 virtual void finish_step_elem(SmartPtr<VectorTimeSeries<vector_type> > currSol,
     139              :                                                                           const GridLevel& gl) = 0;
     140            0 :                 void finish_step_elem(SmartPtr<VectorTimeSeries<vector_type> > currSol)
     141            0 :                 {finish_step_elem(currSol, GridLevel());}
     142              :         ///     \}
     143              : 
     144              :         ///     returns the future time point (i.e. the one that will be computed)
     145              :                 virtual number future_time() const = 0;
     146              : 
     147              :         /// returns number of previous time steps needed
     148              :                 virtual size_t num_prev_steps() const = 0;
     149              : 
     150              :         ///     returns the number of stages
     151              :                 virtual size_t num_stages() const = 0;
     152              : 
     153              :         ///     sets the stage
     154              :                 virtual void set_stage(size_t stage) = 0;
     155              : 
     156              :         /// return underlying domain disc
     157              :                 SmartPtr<IDomainDiscretization<TAlgebra> > domain_disc() const
     158              :                 {return m_spDomDisc;}
     159              : 
     160              :         ///     returns the number of constraint
     161            0 :                 virtual size_t num_constraints() const
     162              :                 {
     163            0 :                         return m_spDomDisc->num_constraints();
     164              :                 }
     165              : 
     166              :         ///     returns the i'th constraint
     167            0 :                 virtual SmartPtr<IConstraint<TAlgebra> > constraint(size_t i)
     168              :                 {
     169            0 :                         return m_spDomDisc->constraint(i);
     170              :                 }
     171              : 
     172              :         protected:
     173              :                 SmartPtr<IDomainDiscretization<TAlgebra> > m_spDomDisc; ///< Domain Discretization
     174              : 
     175              :         private:
     176              :         ///     returns the assemble adapter
     177              :         /// \{
     178            0 :                 SmartPtr<AssemblingTuner<TAlgebra> > ass_tuner() {return m_spDomDisc->ass_tuner();}
     179            0 :                 ConstSmartPtr<AssemblingTuner<TAlgebra> > ass_tuner() const {return m_spDomDisc->ass_tuner();}
     180              :         /// \}
     181              : };
     182              : 
     183              : /// @}
     184              : 
     185              : } // end namespace ug
     186              : 
     187              : #endif /* __H__UG__LIB_DISC__TIME_DISC__TIME_DISC_INTERFACE__ */
        

Generated by: LCOV version 2.0-1