LCOV - code coverage report
Current view: top level - ugbase/lib_disc/spatial_disc/user_data/linker - linker_traits.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 6 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 3 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__SPATIAL_DISC__DATA_LINKER_TRAITS__
      34              : #define __H__UG__LIB_DISC__SPATIAL_DISC__DATA_LINKER_TRAITS__
      35              : 
      36              : #include "common/common.h"
      37              : 
      38              : namespace ug{
      39              : 
      40              : ////////////////////////////////////////////////////////////////////////////////
      41              : // Linker Traits to allow generic programming
      42              : ////////////////////////////////////////////////////////////////////////////////
      43              : 
      44              : /// Linker Traits
      45              : template <typename TData, typename TDataIn, typename TRet = TData>
      46              : struct linker_traits
      47              : {
      48              : ///     computes out += s * in1 (with appropriate '*')
      49              :         static void mult_add(TData& out, const TData& in1, const TDataIn& s);
      50              : };
      51              : 
      52              : template <>
      53              : struct linker_traits<number, number>
      54              : {
      55              :         static void mult_add(number& out, const number& in1, const number& s)
      56              :         {
      57            0 :                 out += in1 * s;
      58              :         }
      59              : };
      60              : 
      61              : template <std::size_t dim>
      62              : struct linker_traits< MathVector<dim>, number >
      63              : {
      64              :         static void mult_add(MathVector<dim>& out,
      65              :                              const MathVector<dim>& in1,
      66              :                                                  const number& s)
      67              :         {
      68            0 :                 VecScaleAppend(out, s, in1);
      69              :         }
      70              : };
      71              : 
      72              : template <std::size_t dim>
      73              : struct linker_traits< MathVector<dim>, MathMatrix<dim,dim> >
      74              : {
      75              :         static void mult_add(MathVector<dim>& out,
      76              :                              const MathVector<dim>& in1,
      77              :                                                  const MathMatrix<dim,dim>& s)
      78              :         {
      79              :                 MatVecMultAppend(out, s, in1);
      80              :         }
      81              : };
      82              : 
      83              : template <std::size_t dim>
      84              : struct linker_traits< MathVector<dim>,  MathVector<dim>, number >
      85              : {
      86              :         static void mult_add(number& out,
      87              :                              const MathVector<dim>& in1,
      88              :                                                  const MathVector<dim>& s)
      89              :         {
      90            0 :                 out = VecDot(s, in1);
      91              :         }
      92              : };
      93              : 
      94              : template <std::size_t dim>
      95              : struct linker_traits< MathMatrix<dim,dim>, number >
      96              : {
      97              :         static void mult_add(MathMatrix<dim,dim>& out,
      98              :                              const MathMatrix<dim,dim>& in1,
      99              :                                                  const number& s)
     100              :         {
     101            0 :                 MatScaleAppend(out, s, in1);
     102              :         }
     103              : };
     104              : 
     105              : template <std::size_t dim>
     106              : struct linker_traits< MathTensor<4,dim>, number >
     107              : {
     108            0 :         static void mult_add(MathTensor<4,dim>& out,
     109              :                              const MathTensor<4, dim>& in1,
     110              :                                                  const number& s)
     111              :         {
     112              :                 out = in1;
     113            0 :                 UG_THROW("linker_traits for MathTensor4 not implemented");
     114              :         }
     115              : };
     116              : 
     117              : } // end namespace ug
     118              : 
     119              : #endif /* __H__UG__LIB_DISC__SPATIAL_DISC__DATA_LINKER_TRAITS__ */
        

Generated by: LCOV version 2.0-1