Loading...
Searching...
No Matches
DefaultGeometryPolicy.hpp
//===========================================================================
//
// File: DefaultGeometryPolicy.hpp
//
// Created: Tue Jun 2 16:23:01 2009
//
// Author(s): Atgeirr F Rasmussen <atgeirr@sintef.no>
// Bård Skaflestad <bard.skaflestad@sintef.no>
//
// $Date$
//
// $Revision$
//
//===========================================================================
/*
Copyright 2009, 2010 SINTEF ICT, Applied Mathematics.
Copyright 2009, 2010, 2022 Equinor ASA.
This file is part of The Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_DEFAULTGEOMETRYPOLICY_HEADER
#define OPM_DEFAULTGEOMETRYPOLICY_HEADER
#include "EntityRep.hpp"
namespace Dune
{
class CpGrid;
namespace cpgrid
{
template<int mydim, int dim>
class Geometry;
class DefaultGeometryPolicy
{
friend class CpGridData;
template<int mydim, int dim>
friend class Geometry;
friend class ::Dune::CpGrid;
public:
DefaultGeometryPolicy()
: cell_geom_ptr_(std::make_shared<EntityVariable<cpgrid::Geometry<3, 3>, 0>>()),
face_geom_ptr_(std::make_shared<EntityVariable<cpgrid::Geometry<2, 3>, 1>>()),
point_geom_ptr_(std::make_shared<EntityVariable<cpgrid::Geometry<0, 3>, 3>>())
{
}
DefaultGeometryPolicy(const EntityVariable<cpgrid::Geometry<3, 3>, 0>& cell_geom,
const EntityVariable<cpgrid::Geometry<2, 3>, 1>& face_geom,
const EntityVariable<cpgrid::Geometry<0, 3>, 3>& point_geom)
: cell_geom_ptr_(std::make_shared<EntityVariable<cpgrid::Geometry<3, 3>, 0>>(cell_geom)),
face_geom_ptr_(std::make_shared<EntityVariable<cpgrid::Geometry<2, 3>, 1>>(face_geom)),
point_geom_ptr_(std::make_shared<EntityVariable<cpgrid::Geometry<0, 3>, 3>>(point_geom))
{
}
template <int codim>
const EntityVariable<cpgrid::Geometry<3 - codim, 3>, codim>& geomVector() const
{
static_assert(codim != 2, "");
return *geomVector(std::integral_constant<int,codim>());
}
std::shared_ptr<const EntityVariable<cpgrid::Geometry<3, 3>, 0>> geomVector(const std::integral_constant<int, 0>&) const
{
return cell_geom_ptr_;
}
std::shared_ptr<EntityVariable<cpgrid::Geometry<3, 3>, 0>> geomVector(const std::integral_constant<int, 0>&)
{
return cell_geom_ptr_;
}
std::shared_ptr<const EntityVariable<cpgrid::Geometry<2, 3>, 1>> geomVector(const std::integral_constant<int, 1>&) const
{
return face_geom_ptr_;
}
std::shared_ptr<EntityVariable<cpgrid::Geometry<2, 3>, 1>> geomVector(const std::integral_constant<int, 1>&)
{
return face_geom_ptr_;
}
template<int codim>
std::shared_ptr<const EntityVariable<cpgrid::Geometry<0, 3>, 3>> geomVector(const std::integral_constant<int, codim>&) const
{
static_assert(codim==3, "Codim has to be 3");
return point_geom_ptr_;
}
template<int codim>
std::shared_ptr<EntityVariable<cpgrid::Geometry<0, 3>, 3>> geomVector(const std::integral_constant<int, codim>&)
{
static_assert(codim==3, "Codim has to be 3");
return point_geom_ptr_;
}
private:
std::shared_ptr<EntityVariable<cpgrid::Geometry<3, 3>, 0>> cell_geom_ptr_;
std::shared_ptr<EntityVariable<cpgrid::Geometry<2, 3>, 1>> face_geom_ptr_;
std::shared_ptr<EntityVariable<cpgrid::Geometry<0, 3>, 3>> point_geom_ptr_;
};
} // namespace cpgrid
} // namespace Dune
#endif // OPM_DEFAULTGEOMETRYPOLICY_HEADER
Dune::CpGrid
[ provides Dune::Grid ]
Definition CpGrid.hpp:203
Dune::cpgrid::DefaultGeometryPolicy::geomVector
std::shared_ptr< const EntityVariable< cpgrid::Geometry< 3, 3 >, 0 > > geomVector(const std::integral_constant< int, 0 > &) const
Get cell geometry.
Definition DefaultGeometryPolicy.hpp:93
Dune::cpgrid::DefaultGeometryPolicy::geomVector
const EntityVariable< cpgrid::Geometry< 3 - codim, 3 >, codim > & geomVector() const
Definition DefaultGeometryPolicy.hpp:86
Dune::cpgrid::DefaultGeometryPolicy::DefaultGeometryPolicy
DefaultGeometryPolicy()
Definition DefaultGeometryPolicy.hpp:61
Dune::cpgrid::DefaultGeometryPolicy::geomVector
std::shared_ptr< EntityVariable< cpgrid::Geometry< 0, 3 >, 3 > > geomVector(const std::integral_constant< int, codim > &)
Get point geometry.
Definition DefaultGeometryPolicy.hpp:122
Dune::cpgrid::DefaultGeometryPolicy::DefaultGeometryPolicy
DefaultGeometryPolicy(const EntityVariable< cpgrid::Geometry< 3, 3 >, 0 > &cell_geom, const EntityVariable< cpgrid::Geometry< 2, 3 >, 1 > &face_geom, const EntityVariable< cpgrid::Geometry< 0, 3 >, 3 > &point_geom)
Definition DefaultGeometryPolicy.hpp:71
Dune::cpgrid::DefaultGeometryPolicy::geomVector
std::shared_ptr< EntityVariable< cpgrid::Geometry< 3, 3 >, 0 > > geomVector(const std::integral_constant< int, 0 > &)
Get cell geometry.
Definition DefaultGeometryPolicy.hpp:98
Dune::cpgrid::DefaultGeometryPolicy::geomVector
std::shared_ptr< EntityVariable< cpgrid::Geometry< 2, 3 >, 1 > > geomVector(const std::integral_constant< int, 1 > &)
Get face geometry.
Definition DefaultGeometryPolicy.hpp:108
Dune::cpgrid::DefaultGeometryPolicy::geomVector
std::shared_ptr< const EntityVariable< cpgrid::Geometry< 2, 3 >, 1 > > geomVector(const std::integral_constant< int, 1 > &) const
Get face geometry.
Definition DefaultGeometryPolicy.hpp:103
Dune::cpgrid::DefaultGeometryPolicy::geomVector
std::shared_ptr< const EntityVariable< cpgrid::Geometry< 0, 3 >, 3 > > geomVector(const std::integral_constant< int, codim > &) const
Get point geometry.
Definition DefaultGeometryPolicy.hpp:115
Dune::cpgrid::EntityVariable
A class design to hold a variable with a value for each entity of the given codimension,...
Definition EntityRep.hpp:272
Dune::cpgrid::Geometry
This class encapsulates geometry for vertices, intersections, and cells.
Definition Geometry.hpp:76
Dune::cpgrid
Copyright 2019 Equinor AS.
Definition GridPartitioning.cpp:673
Dune
The namespace Dune is the main namespace for all Dune code.
Definition CartesianIndexMapper.hpp:10