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

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2012-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__OPERATOR__LINEAR_OPERATOR__TRANSFER_INTERFACE__
      34              : #define __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__TRANSFER_INTERFACE__
      35              : 
      36              : #include "lib_algebra/operator/interface/operator.h"
      37              : #include "lib_grid/tools/grid_level.h"
      38              : #include "lib_disc/function_spaces/grid_function.h"
      39              : #include "lib_disc/spatial_disc/constraints/constraint_interface.h"
      40              : 
      41              : namespace ug{
      42              : 
      43              : ///////////////////////////////////////////////////////////////////////////////
      44              : // Transfer Operator
      45              : ///////////////////////////////////////////////////////////////////////////////
      46              : 
      47              : /// interface for transfer routines
      48              : template <typename TDomain, typename TAlgebra>
      49              : class ITransferOperator
      50              : {
      51              :         public:
      52              :         ///     Vector type
      53              :                 typedef typename TAlgebra::vector_type vector_type;
      54              : 
      55              :         ///     Matrix type
      56              :                 typedef typename TAlgebra::matrix_type matrix_type;
      57              : 
      58              :         ///     Domain type
      59              :                 typedef TDomain domain_type;
      60              : 
      61              :         public:
      62              :         ///     constructor
      63            0 :                 ITransferOperator(){clear_constraints();}
      64              : 
      65              :         ///     clears dirichlet post processes
      66            0 :                 virtual void clear_constraints(){m_vConstraint.clear();};
      67              : 
      68              :         ///     adds a dirichlet post process (not added if already registered)
      69            0 :                 virtual void add_constraint(SmartPtr<IConstraint<TAlgebra> > pp){
      70              :                         //      add only once
      71            0 :                         if(std::find(m_vConstraint.begin(), m_vConstraint.end(), pp) !=
      72              :                                         m_vConstraint.end()) return;
      73            0 :                         m_vConstraint.push_back(pp);
      74              :                 };
      75              : 
      76              :         ///     removes a post process
      77            0 :                 virtual void remove_constraint(SmartPtr<IConstraint<TAlgebra> > pp){
      78            0 :                         m_vConstraint.erase(m_vConstraint.begin(),
      79            0 :                             std::remove(m_vConstraint.begin(), m_vConstraint.end(), pp));
      80            0 :                 }
      81              : 
      82              :         public:
      83              :         ///     initialize the operator
      84              :                 virtual void init() = 0;
      85              : 
      86              :         /// Set Levels for Prolongation coarse -> fine
      87              :                 virtual void set_levels(GridLevel coarseLevel, GridLevel fineLevel) = 0;
      88              : 
      89              :         /// Prolongates vector, i.e. moves data from coarse to fine level
      90              :                 virtual void prolongate(vector_type& uFine, const vector_type& uCoarse) = 0;
      91              : 
      92              :         /// Restricts vector, i.e. moves data from fine to coarse level
      93              :                 virtual void do_restrict(vector_type& uCoarse, const vector_type& uFine) = 0;
      94              : 
      95              :         ///     returns prolongation as a matrix
      96              :                 virtual SmartPtr<matrix_type>
      97            0 :                 prolongation(const GridLevel& fineGL, const GridLevel& coarseGL,
      98              :                              ConstSmartPtr<ApproximationSpace<TDomain> > spApproxSpace){
      99            0 :                         UG_THROW("ITransferOperator: Matrix-prolongation not implemented.")
     100              :                 }
     101              : 
     102              :         ///     returns restriction as a matrix
     103              :                 virtual SmartPtr<matrix_type>
     104            0 :                 restriction(const GridLevel& coarseGL, const GridLevel& fineGL,
     105              :                             ConstSmartPtr<ApproximationSpace<TDomain> > spApproxSpace){
     106            0 :                         UG_THROW("ITransferOperator: Matrix-restriction not implemented.")
     107              :                 }
     108              : 
     109              :         ///     Clone
     110              :                 virtual SmartPtr<ITransferOperator<TDomain, TAlgebra> > clone() = 0;
     111              : 
     112              :         ///     virtual destructor
     113            0 :                 virtual ~ITransferOperator() {}
     114              : 
     115              :         protected:
     116              :         ///     list of post processes
     117              :                 std::vector<SmartPtr<IConstraint<TAlgebra> > > m_vConstraint;
     118              : 
     119              : };
     120              : 
     121              : ///////////////////////////////////////////////////////////////////////////////
     122              : // Transfer Post Process
     123              : ///////////////////////////////////////////////////////////////////////////////
     124              : 
     125              : /// interface for transfer routines
     126              : template <typename TDomain, typename TAlgebra>
     127              : class ITransferPostProcess
     128              : {
     129              :         public:
     130              :         ///     Vector type
     131              :                 typedef typename TAlgebra::vector_type vector_type;
     132              : 
     133              :         ///     Domain type
     134              :                 typedef TDomain domain_type;
     135              : 
     136              :         ///     GridFunction type
     137              :                 typedef GridFunction<TDomain, TAlgebra> GF;
     138              : 
     139              :         public:
     140              :         /// apply post process
     141              :                 virtual void post_process(SmartPtr<GF> spGF) = 0;
     142              : 
     143              :         ///     virtual destructor
     144              :                 virtual ~ITransferPostProcess() {}
     145              : };
     146              : 
     147              : } // end namespace ug
     148              : 
     149              : #endif /* __H__UG__LIB_DISC__OPERATOR__LINEAR_OPERATOR__TRANSFER_INTERFACE__ */
        

Generated by: LCOV version 2.0-1