Commit 0d8df047 authored by Timo Koch's avatar Timo Koch
Browse files

[io][grid] Rename GmshBoundaryFlag->BoundarySegmentIndexFlag in common

The boudnary segment index flag is the default except if it's
overwritten for a specfific grid. This is currently done in ALU which
per default only works with DGF boundary flags.
parent 2b0189cd
......@@ -25,24 +25,24 @@
#define DUMUX_BOUNDARY_FLAG_HH
#include <cstddef>
#include <limits>
namespace Dumux {
/*!
* \file
* \ingroup Common
* \brief Boundary flag to store e.g. in sub control volume faces
* \note Can be specialized for each grid manager (in the gridmanager headers)
* \tparam Grid the type of the grid
* \ingroup InputOutput
* \brief Class for accessing boundary flags
* \note this works for all grid managers with gmsh meshes.
*/
template<class Grid>
class BoundaryFlag
class BoundarySegmentIndexFlag
{
public:
BoundaryFlag() : flag_(-1) {}
BoundarySegmentIndexFlag()
: flag_(std::numeric_limits<std::size_t>::max()) {}
template<class Intersection>
BoundaryFlag(const Intersection& i) : flag_(-1)
BoundarySegmentIndexFlag(const Intersection& i)
: flag_(std::numeric_limits<std::size_t>::max())
{
if (i.boundary())
flag_ = i.boundarySegmentIndex();
......@@ -56,6 +56,17 @@ private:
value_type flag_;
};
/*!
* \file
* \ingroup Common
* \brief Boundary flag to store e.g. in sub control volume faces
* \note Can be specialized for each grid manager (in the gridmanager headers)
* \tparam Grid the type of the grid
*/
template<class Grid>
class BoundaryFlag : public BoundarySegmentIndexFlag
{ using BoundarySegmentIndexFlag::BoundarySegmentIndexFlag; };
} // end namespace Dumux
#endif
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup InputOutput
* \brief Boundary flag implementation for Gmsh meshes.
*/
#ifndef DUMUX_GMSH_BOUNDARY_FLAG_HH
#define DUMUX_GMSH_BOUNDARY_FLAG_HH
#include <limits>
namespace Dumux {
/*!
* \ingroup InputOutput
* \brief Class for accessing boundary flags for Gmsh meshes.
*/
class GmshBoundaryFlag
{
public:
GmshBoundaryFlag()
: flag_(std::numeric_limits<std::size_t>::max()) {}
template<class Intersection>
GmshBoundaryFlag(const Intersection& i)
: flag_(std::numeric_limits<std::size_t>::max())
{
if (i.boundary())
flag_ = i.boundarySegmentIndex();
}
using value_type = std::size_t;
value_type get() const { return flag_; }
private:
value_type flag_;
};
} // end namespace Dumux
#endif
......@@ -17,7 +17,8 @@
/*!
* \file
*
* \brief Test whether GmshBoundaryFlag works as expected with Box and CCTpfa
* \brief Test whether BoundarySegmentIndexFlag works as expected with Box and CCTpfa and ALUGrid
* \note Alu currently defaults to a boundary flag that works for DGF files only
*/
#include <config.h>
#include <iostream>
......@@ -27,8 +28,8 @@
#include <dune/alugrid/grid.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <dumux/common/parameters.hh>
#include <dumux/common/boundaryflag.hh>
#include <dumux/io/grid/gridmanager.hh>
#include <dumux/io/grid/gmshboundaryflag.hh>
#include <dumux/discretization/box.hh>
#include <dumux/discretization/cctpfa.hh>
......@@ -37,13 +38,12 @@
namespace Dumux {
// In order to use an alternative BoundaryFlag class, we have to adapt the GridGeometryTraits
template<class GridView>
struct MyBoxGridGeometryTraits : public BoxDefaultGridGeometryTraits<GridView>
{
struct MyScvfTraits : public BoxDefaultScvfGeometryTraits<GridView>
{ using BoundaryFlag = GmshBoundaryFlag; };
{ using BoundaryFlag = BoundarySegmentIndexFlag; };
using SubControlVolumeFace = BoxSubControlVolumeFace<GridView, MyScvfTraits>;
};
......@@ -52,7 +52,7 @@ template<class GridView>
struct MyCCTpfaGridGeometryTraits : public CCTpfaDefaultGridGeometryTraits<GridView>
{
struct MyScvfTraits : public CCTpfaDefaultScvfGeometryTraits<GridView>
{ using BoundaryFlag = GmshBoundaryFlag; };
{ using BoundaryFlag = BoundarySegmentIndexFlag; };
using SubControlVolumeFace = CCTpfaSubControlVolumeFace<GridView, MyScvfTraits>;
};
......@@ -109,7 +109,6 @@ int main(int argc, char** argv) try
// run the test
GmshBoundaryFlagTest<Grid>::testGmshBoundaryFlag<CCTpfaFVGridGeometry>(leafGridView, ccTpfaFvGridGeometry, gridData);
return 0;
}
catch (Dumux::ParameterException &e) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment