LCOV - code coverage report
Current view: top level - ugbase/common/util - field.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 4 0
Test Date: 2025-09-21 23:31:46 Functions: - 0 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Sebastian Reiter
       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_field__
      34              : #define __H__UG_field__
      35              : 
      36              : #include "common/boost_serialization.h"
      37              : #include <boost/serialization/split_member.hpp> // if boost is not from BoostForUG4 for separate load/save methods
      38              : 
      39              : namespace ug{
      40              : 
      41              : template <class T>
      42              : class Field{
      43              :         public:
      44              :                 Field();
      45              :                 Field(size_t width, size_t height);
      46              :                 Field(size_t width, size_t height, const T& value);
      47              :                 Field(const Field& f);
      48              :                 ~Field();
      49              : 
      50              :                 Field& operator=(const Field& field);
      51              : 
      52              :                 void            resize_no_copy(size_t width, size_t height);
      53              : 
      54              :                 inline T&           at(size_t x, size_t y);
      55              :                 inline const T&     at(size_t x, size_t y) const;
      56              : 
      57            0 :                 size_t          width() const           {return m_width;}
      58            0 :                 size_t          height() const          {return m_height;}
      59            0 :                 size_t          size() const            {return m_width * m_height;}
      60              :                 size_t          capacity() const        {return m_capacity;}
      61              :                 T*                      data()                          {return m_data;}
      62            0 :                 const T*        data() const            {return m_data;}
      63              : 
      64              :                 void fill(size_t x, size_t y, size_t w, size_t h, const T& value);
      65              :                 void fill_all(const T& value);
      66              :                 void copy(size_t x, size_t y, const Field& f);
      67              :                 void swap(Field& f);
      68              : 
      69              :         private:
      70              :                 inline size_t array_index(size_t x, size_t y) const;
      71              : 
      72              :         //      BEGIN SERIALIZATION
      73              :                 friend class boost::serialization::access;
      74              : 
      75              :                 template <class Archive>
      76              :                 void save( Archive& ar, const unsigned int version) const;
      77              : 
      78              :                 template <class Archive>
      79              :                 void load( Archive& ar, const unsigned int version);
      80              :                 
      81              :                 BOOST_SERIALIZATION_SPLIT_MEMBER()
      82              :         //      END SERIALIZATION
      83              : 
      84              :                 size_t  m_width;
      85              :                 size_t  m_height;
      86              :                 size_t  m_capacity;
      87              :                 T*              m_data;
      88              : };
      89              : 
      90              : }//     end of namespace
      91              : 
      92              : 
      93              : ////////////////////////////////////////
      94              : //      include implementation
      95              : #include "field_impl.hpp"
      96              : 
      97              : #endif  //__H__UG_field__
        

Generated by: LCOV version 2.0-1