LCOV - code coverage report
Current view: top level - ugbase/bridge/grid_bridges - grid_bridge.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 97.0 % 67 65
Test Date: 2025-09-21 23:31:46 Functions: 50.0 % 8 4

            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              : #include "grid_bridges.h"
      34              : #include "../suffix_tag.h"
      35              : #include "lib_grid/grid/grid.h"
      36              : #include "lib_grid/grid/geometry.h"
      37              : #include "lib_grid/grid_objects/grid_objects.h"
      38              : #include "lib_grid/multi_grid.h"
      39              : using namespace std;
      40              : 
      41              : namespace ug{
      42              : namespace bridge{
      43              : 
      44              : template <class T>
      45              : static
      46            0 : bool IsValidPtr(T* o){
      47            0 :         return o != NULL;
      48              : }
      49              : 
      50              : template <int dim>
      51            3 : void RegisterGeometry(Registry& reg, string grp)
      52              : {
      53              :         typedef IGeometry<dim>    T;
      54            3 :         string suffix = GetDimensionSuffix<dim>();
      55            3 :         string tag = GetDimensionTag<dim>();
      56              : 
      57            3 :         string name = mkstr("IGeometry" << suffix);
      58            9 :         reg.add_class_<T>(name, grp);
      59            9 :         reg.add_class_to_group(name, "IGeometry", tag);
      60            3 : }
      61              : 
      62            1 : void RegisterGridBridge_Grid(Registry& reg, string parentGroup)
      63              : {
      64              :         string grp = parentGroup;
      65              : //      Geometric Objects
      66            3 :         reg.add_class_<GridObject>("GridObject", grp);
      67            3 :         reg.add_class_<Vertex, GridObject>("Vertex", grp);
      68            3 :         reg.add_class_<Edge, GridObject>("Edge", grp)
      69            3 :                 .add_method("num_vertices", &Edge::num_vertices, grp)
      70            3 :                 .add_method("vertex", &Edge::vertex, grp);
      71            3 :         reg.add_class_<Face, GridObject>("Face", grp)
      72            3 :                 .add_method("num_vertices", &Face::num_vertices, grp)
      73            3 :                 .add_method("vertex", &Face::vertex, grp);
      74            3 :         reg.add_class_<Volume, GridObject>("Volume", grp)
      75            3 :                 .add_method("num_vertices", &Volume::num_vertices, grp)
      76            3 :                 .add_method("vertex", &Volume::vertex, grp);
      77              : 
      78            3 :         reg.add_function("IsValid", &IsValidPtr<Vertex>, grp);
      79            3 :         reg.add_function("IsValid", &IsValidPtr<Edge>, grp);
      80            3 :         reg.add_function("IsValid", &IsValidPtr<Face>, grp);
      81            3 :         reg.add_function("IsValid", &IsValidPtr<Volume>, grp);
      82              : 
      83              : //      Grid
      84            3 :         reg.add_class_<Grid>("Grid", grp)
      85            1 :                 .add_constructor()
      86            3 :                 .add_method("clear", static_cast<void (Grid::*)()>(&Grid::clear))
      87            3 :                 .add_method("clear_geometry", &Grid::clear_geometry)
      88            2 :                 .add_method("num_vertices", &Grid::num_vertices)
      89            2 :                 .add_method("num_edges", &Grid::num_edges)
      90            2 :                 .add_method("num_faces", &Grid::num_faces)
      91            3 :                 .add_method("num_triangles", &Grid::num<Triangle>)
      92            4 :                 .add_method("num_quadrilaterals", &Grid::num<Quadrilateral>)
      93            3 :                 .add_method("num_volumes", &Grid::num_volumes)
      94            3 :                 .add_method("num_tetrahedrons", &Grid::num<Tetrahedron>)
      95            4 :                 .add_method("num_pyramids", &Grid::num<Pyramid>)
      96            4 :                 .add_method("num_prisms", &Grid::num<Prism>)
      97            4 :                 .add_method("num_hexahedrons", &Grid::num<Hexahedron>)
      98            4 :                 .add_method("reserve_vertices", &Grid::reserve<Vertex>, "", "num")
      99            4 :                 .add_method("reserve_edges", &Grid::reserve<Edge>, "", "num")
     100            4 :                 .add_method("reserve_faces", &Grid::reserve<Face>, "", "num")
     101            3 :                 .add_method("reserve_volumes", &Grid::reserve<Volume>, "", "num")
     102            1 :                 .set_construct_as_smart_pointer(true);
     103              : 
     104              : //      MultiGrid
     105            3 :         reg.add_class_<MultiGrid, Grid>("MultiGrid", grp)
     106            1 :                 .add_constructor()
     107            2 :                 .add_method("num_levels", &MultiGrid::num_levels)
     108              : 
     109            3 :                 .add_method("num_vertices", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Vertex>)
     110            4 :                 .add_method("num_edges", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Edge>)
     111            4 :                 .add_method("num_faces", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Face>)
     112            4 :                 .add_method("num_triangles", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Triangle>)
     113            4 :                 .add_method("num_quadrilaterals", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Quadrilateral>)
     114            4 :                 .add_method("num_volumes", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Volume>)
     115            4 :                 .add_method("num_tetrahedrons", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Tetrahedron>)
     116            4 :                 .add_method("num_pyramids", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Pyramid>)
     117            4 :                 .add_method("num_prisms", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Prism>)
     118            3 :                 .add_method("num_hexahedrons", (size_t (MultiGrid::*)(int) const) &MultiGrid::num<Hexahedron>)
     119            1 :                 .set_construct_as_smart_pointer(true);
     120              : 
     121              : //      standard attachments
     122            2 :         reg.add_class_<AInt>("AInt");
     123            2 :         reg.add_class_<ANumber>("ANumber");
     124            2 :         reg.add_class_<APosition1>("APosition1");
     125            2 :         reg.add_class_<APosition2>("APosition2");
     126            2 :         reg.add_class_<APosition3>("APosition3");
     127              : 
     128              : //      geometry
     129            2 :         RegisterGeometry<1>(reg, grp);
     130            2 :         RegisterGeometry<2>(reg, grp);
     131            2 :         RegisterGeometry<3>(reg, grp);
     132            1 : }
     133              : 
     134              : }//     end of namespace
     135              : }//     end of namespace
        

Generated by: LCOV version 2.0-1