LCOV - code coverage report
Current view: top level - ugbase/lib_algebra/operator/interface - operator.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2026-06-01 23:54:59 Functions: - 0 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__LIB_ALGEBRA__OPERATOR__INTERFACE__OPERATOR__
      34              : #define __H__LIB_ALGEBRA__OPERATOR__INTERFACE__OPERATOR__
      35              : 
      36              : 
      37              : namespace ug{
      38              : 
      39              : ///////////////////////////////////////////////////////////////////////////////
      40              : // (Nonlinear-) Operator
      41              : ///////////////////////////////////////////////////////////////////////////////
      42              : 
      43              : /// describes a mapping X->Y
      44              : /**
      45              :  * This class is the base class for all mappings between two spaces. The domain
      46              :  * space and the codomain space are passed as template parameters. In particular,
      47              :  * the mapping can be nonlinear. For linear (or linearized) mappings see
      48              :  * ILinearizedOperator. The basic usage of this class is to provide the
      49              :  * computation of:
      50              :  *
      51              :  *              d := N(u),
      52              :  *
      53              :  * where d is from the codomain space, u a function of the domain space and
      54              :  * N() is a (nonlinear-) mapping.
      55              :  *
      56              :  * This application is splitted into three methods, that have to be called
      57              :  * in the correct order:
      58              :  *
      59              :  * 1. init(): This method initializes the operator for application. It has
      60              :  *                        to be called once before one of the other two methods can be
      61              :  *                        invoked. There is no need to call this method more than once, but
      62              :  *                        sometimes - due to parameter change - this is desirable and
      63              :  *                        can be done.
      64              :  *
      65              :  * 2. prepare(): This method is used to prepare the in- and output vector used
      66              :  *                               later in apply. It can be called, after the init method has
      67              :  *                               been called at least once. The prepare method is e.g. used
      68              :  *                               to set dirichlet values.
      69              :  *
      70              :  * 3. apply(): This method can be called when the operator has been initialized
      71              :  *                         by a call of init and with two functions, that have been prepare
      72              :  *                         using the prepare method. It maps the function from the domain
      73              :  *                         space to the range space.
      74              :  *
      75              :  * This splitting has been made, since initialization and preparation may be
      76              :  * computationally expansive. Thus, the user of this class has the choice
      77              :  * when to call this initialization/preparation. E.g. when the operator is
      78              :  * applied several times on the same vectors, those have only to be prepared
      79              :  * once and the init of the operator is only needed once.
      80              :  *
      81              :  * \tparam      X       Domain space function
      82              :  * \tparam      Y       Range space function
      83              :  */
      84              : template <typename X, typename Y = X>
      85            0 : class IOperator
      86              : {
      87              :         public:
      88              :         ///     Domain space
      89              :                 typedef X domain_function_type;
      90              : 
      91              :         ///     Range space
      92              :                 typedef Y codomain_function_type;
      93              : 
      94              :         public:
      95              :         /// initializes the operator
      96              :         /**
      97              :          * This method initializes the operator. It must be called before any of
      98              :          * the other methods are called.
      99              :          *
     100              :          * \returns     bool    success flag
     101              :          */
     102              :                 virtual void init() = 0;
     103              : 
     104              :         /// prepares domain and codomain functions for application
     105              :         /**
     106              :          * This method prepares the in- and output functions for the application
     107              :          * and has to be called once before the apply method can be invoked with
     108              :          * the functions used here.
     109              :          *
     110              :          * \param[in]   u               domain function
     111              :          * \returns     bool    flag if preparation successful
     112              :          */
     113              :                 virtual void prepare(X& u) = 0;
     114              : 
     115              :         ///     computes the nonlinear mapping d := N(u)
     116              :         /**
     117              :          * This method maps a function from the domain space to the range space.
     118              :          * Note, that is must be called with functions, that have previously been
     119              :          * prepared using the 'prepare'-method and that the operator must have been
     120              :          * initialized using the 'init'-method
     121              :          *
     122              :          * \param[in]   u               domain function
     123              :          * \param[out]  d               codomain function
     124              :          * \returns     bool    flag if application successful
     125              :          */
     126              :                 virtual void apply(Y& d, const X& u) = 0;
     127              : 
     128              :         ///     virtual destructor
     129              :                 virtual ~IOperator() {};
     130              : };
     131              : 
     132              : } // end namespace ug
     133              : 
     134              : #endif /* __H__LIB_ALGEBRA__OPERATOR__INTERFACE__OPERATOR__ */
        

Generated by: LCOV version 2.0-1