LCOV - code coverage report
Current view: top level - ugbase/bridge/misc_bridges - raster_bridge.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 32 32
Test Date: 2025-09-21 23:31:46 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2016:  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              : #include <string>
      34              : #include "bridge/bridge.h"
      35              : #include "bridge/util.h"
      36              : #include "bridge/suffix_tag.h"
      37              : #include "common/util/raster.h"
      38              : 
      39              : using namespace std;
      40              : 
      41              : namespace ug{
      42              : namespace bridge{
      43              : 
      44              : template <class TValue, int TDIM>
      45            3 : static void RegisterRaster(Registry& reg, string name, string grp)
      46              : {
      47            3 :         string suffix = GetDimensionSuffix<TDIM>();
      48            3 :         string tag = GetDimensionTag<TDIM>();
      49              : 
      50              :         typedef Raster<TValue, TDIM> T;
      51              :         string fullName = name + suffix;
      52              : 
      53            9 :         reg.add_class_<T>(fullName, grp)
      54            6 :                 .template add_constructor<void (*)()>()
      55            9 :                 .add_method("dim", &T::dim, "dimension", "", "Returns the dimension of the raster.")
      56           12 :                 .add_method("blur", &T::blur,
      57              :                         "", "alpha || min=0.D, max=1.D, val=0.5D # iterations || min=0, val=10",
      58              :                         "Blurs the raster data by repeatedly averaging between neighbored cells.")
      59           12 :                 .add_method("load_from_asc", &T::load_from_asc,
      60              :                         "", "filename", "Loads the given file and creates the raster accordingly.")
      61           12 :                 .add_method("save_to_asc", &T::save_to_asc,
      62              :                         "", "filename", "Saves the given raster to an 'asc' file.")
      63            9 :                 .add_method("set_num_nodes", static_cast<void (T::*)(int, size_t)>(&T::set_num_nodes),
      64              :                         "", "dim # numNodes", "set the number of nodes for the given dimension.")
      65            6 :                 .add_method("num_nodes", static_cast<size_t (T::*)(int) const>(&T::num_nodes),
      66              :                         "numNodes", "dim", "returns the number of nodes for the given dimension.")
      67            9 :                 .add_method("create", &T::create,
      68              :                         "", "", "Creates the raster according to the set number of nodes (use 'set_num_nodes').")
      69            9 :                 .add_method("set_min_corner", static_cast<void (T::*)(int, number)>(&T::set_min_corner),
      70              :                         "", "dim # coordinate", "set the coordinate of the minimum corner of the raster for the given dimension.")
      71            6 :                 .add_method("min_corner", static_cast<number (T::*)(int) const>(&T::min_corner),
      72              :                         "coordinate", "dim", "returns the coordinate of the minimum corner of the raster for the given dimension.")
      73            6 :                 .add_method("set_extension", static_cast<void (T::*)(int, number)>(&T::set_extension),
      74              :                         "", "dim # coordinate", "set the extension of the raster for the given dimension.")
      75            6 :                 .add_method("extension", static_cast<number (T::*)(int) const>(&T::extension),
      76              :                         "coordinate", "dim", "returns the extension of the raster for the given dimension.")
      77            6 :                 .add_method("select_node", static_cast<void (T::*)(int, size_t)>(&T::select_node),
      78              :                         "", "dim # index", "select a node by specifying the index in each dimension.")
      79            9 :                 .add_method("selected_node_value", &T::selected_node_value,
      80              :                         "value", "", "returns the value of the selected node (use 'select_node' to select a node).")
      81           12 :                 .add_method("set_selected_node_value", &T::set_selected_node_value,
      82              :                         "", "value", "set the value of the selected node (use 'select_node' to select a node).")
      83            9 :                 .add_method("set_cursor", static_cast<void (T::*)(int, number)>(&T::set_cursor),
      84              :                         "", "dim # coordinate", "set the coordinate of the cursor for each dimension.")
      85            9 :                 .add_method("interpolate_at_cursor", &T::interpolate_at_cursor,
      86              :                         "value", "", "returns the interpolated value (using the given order) at the cursor (use 'set_cursor' to set the cursor).")
      87           12 :                 .add_method("set_no_data_value", &T::set_no_data_value,
      88              :                         "", "value", "set the 'no-data-value'of the raster. Nodes with this value are ignored in some applications.")
      89            9 :                 .add_method("no_data_value", &T::no_data_value,
      90              :                         "value", "", "returns the 'no-data-value'of the raster. Nodes with this value are ignored in some applications.")
      91            3 :                 .set_construct_as_smart_pointer(true);
      92              : 
      93            6 :         reg.add_class_to_group(fullName, name, tag);
      94            3 : }
      95              : 
      96            1 : void RegisterBridge_Raster(Registry& reg, string parentGroup)
      97              : {
      98            1 :         string grp = parentGroup; grp.append("/Util/Raster");
      99              : 
     100            2 :         RegisterRaster<number, 1>(reg, "NumberRaster", parentGroup);
     101            2 :         RegisterRaster<number, 2>(reg, "NumberRaster", parentGroup);
     102            2 :         RegisterRaster<number, 3>(reg, "NumberRaster", parentGroup);
     103            1 : }
     104              : 
     105              : }//     end of namespace
     106              : }//     end of namespace
        

Generated by: LCOV version 2.0-1