LCOV - code coverage report
Current view: top level - ugbase/lib_disc/spatial_disc/user_data/common_user_data - lognormal_random_field.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 % 15 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2014-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Authors: Ivo Muha, Martin Rupp
       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              : /*
      34              :  *      example usage (on unit square)
      35              :  *              elemDisc = ConvectionDiffusion("c", "Inner", disc)
      36              :  *                      elemDisc:set_diffusion(LognormalRandomField(100, 0, 1, 0.01))
      37              :  */
      38              : 
      39              : #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__LOGNORMAL_RANDOM_FIELD__
      40              : #define __H__UG__LIB_DISC__SPATIAL_DISC__LOGNORMAL_RANDOM_FIELD__
      41              : 
      42              : // extern headers
      43              : #include <vector>
      44              : #include "lib_disc/spatial_disc/user_data/std_glob_pos_data.h"
      45              : 
      46              : namespace ug{
      47              : 
      48              : template <typename TData, int dim, typename TRet = void>
      49              : class LognormalRandomField
      50              :                 : public StdGlobPosData<LognormalRandomField<TData, dim, TRet>, TData, dim, TRet>
      51              : {
      52              : 
      53              : public:
      54              : 
      55            0 :         LognormalRandomField()
      56            0 :         {
      57            0 :                 m_bNoExp=false;
      58            0 :                 set_config(100, 0, 1, 0.1);
      59            0 :         };
      60              : 
      61            0 :         LognormalRandomField(size_t N, double mean_f, double sigma_f, double sigma)
      62            0 :         {
      63            0 :                 m_bNoExp=false;
      64            0 :                 set_config(N, mean_f, sigma_f, sigma);
      65            0 :         };
      66              : 
      67              : 
      68            0 :         virtual ~LognormalRandomField()
      69              :         {
      70            0 :         }
      71              :         inline TRet evaluate(TData& D, const MathVector<dim>& x, number time, int si) const;
      72              : 
      73            0 :         void set_no_exp() { m_bNoExp = true; }
      74              :         void set_config(size_t N, double mean_f, double sigma_f, double sigma);
      75              : 
      76              :         std::string config_string() const;
      77              : 
      78              : private:
      79              :         double gasdev();
      80              :     double undev();
      81              :     double eval_K(const MathVector<dim> &x)  const;
      82              : 
      83              :     MathVector<dim> m_sigma;
      84              : 
      85              :     double m_dMean_f;
      86              :     double m_dSigma_f;
      87              :     double m_N;
      88              :     bool m_bNoExp;
      89              :     double m_dSigma;
      90              : 
      91              :         std::vector<MathVector<dim> > m_vRandomQvec;
      92              :         std::vector<double> m_vRandomAlpha;
      93              : 
      94              : };
      95              : 
      96              : } // end ug
      97              : 
      98              : #include "lognormal_random_field_impl.h"
      99              : 
     100              : #endif /* __H__UG__LIB_DISC__SPATIAL_DISC__LOGNORMAL_FIELD__ */
        

Generated by: LCOV version 2.0-1