Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • bugfix/variant-memory-leak
  • feature/add_boundary_in_hostgrid_outside_in_hostgrid
  • feature/geometryInInOutside
  • fix/bump-version-to28
  • master
  • releases/2.0-1
  • releases/2.0-2
  • releases/2.1-1
  • releases/2.2-1
  • releases/2.4-1
  • releases/2.5-1
  • releases/2.6-1
  • releases/2.7
  • releases/2.8
14 results

Target

Select target project
  • neubertw/dune-subgrid
  • agnumpde/dune-subgrid
2 results
Select Git revision
  • bugfix/variant-memory-leak
  • feature/geometryInInOutside
  • master
  • releases/2.0-1
  • releases/2.0-2
  • releases/2.1-1
  • releases/2.2-1
  • releases/2.4-1
  • releases/2.5-1
  • releases/2.6-1
10 results
Show changes
Commits on Source (27)
Showing
with 157 additions and 617 deletions
# /
/Makefile
/Makefile.in
/config.*
/configure
/aclocal.m4
/dependencies.m4
/autom4te.cache
/depcomp
/install-sh
/missing
/mkinstalldirs
/libtool
/dune-subgrid.pc
/semantic.cache
/configure.lineno
/stamp-h1
/dune-subgrid-*.tar.gz
/dune-subgrid-?.?
/ltmain.sh
/.libs
/am
# /doc/
/doc/Makefile
/doc/Makefile.in
/doc/Makefile.dist
/doc/Makefile.dist.in
# /doc/doxygen/
/doc/doxygen/Doxyfile.in
/doc/doxygen/doxygen-tag
/doc/doxygen/doxygen.log
/doc/doxygen/html
/doc/doxygen/html-dist
/doc/doxygen/Makefile
/doc/doxygen/Makefile.in
/doc/doxygen/semantic.cache
# /dune/
/dune/Makefile.in
/dune/Makefile
# /dune/subgrid/
/dune/subgrid/Makefile.in
/dune/subgrid/Makefile
# /dune/subgrid/subgrid/
/dune/subgrid/subgrid/Makefile.in
/dune/subgrid/subgrid/Makefile
# /dune/subgrid/test/
/dune/subgrid/test/Makefile.in
/dune/subgrid/test/Makefile
/dune/subgrid/test/semantic.cache
/dune/subgrid/test/.deps
/dune/subgrid/test/test-w-albertagrid
/dune/subgrid/test/test-w-alugrid
/dune/subgrid/test/test-w-sgrid
/dune/subgrid/test/test-w-onedgrid
/dune/subgrid/test/test-w-ug
/dune/subgrid/test/test-w-yaspgrid
# /m4/
/m4/Makefile.in
/m4/Makefile
# /subgrid/
/subgrid/Makefile.in
/subgrid/Makefile
# ignore all build folders
/build*/
# ignore backup files
*~
# ignore Python files
*.pyc
---
dune:git--clang:
image: duneci/dune:git
script: duneci-standard-test --opts=/duneci/opts.clang
before_script:
- duneci-install-module https://gitlab.dune-project.org/extensions/dune-alugrid.git
dune:git--gcc:
image: duneci/dune:git
.common: &common
script: duneci-standard-test
artifacts:
expire_in: 2 years
reports:
junit: junit/*.xml
dune:git gcc-8 C++17:
<<: *common
image: registry.dune-project.org/docker/ci/dune:git-debian-10-gcc-8-17
dune:git clang C++17:
<<: *common
image: registry.dune-project.org/docker/ci/dune:git-debian-10-clang-7-libcpp-17
# Master (will become release 2.8)
- ...
## Deprecations and removals
- ...
add_subdirectory(common)
add_subdirectory(facetools)
add_subdirectory(subgrid)
add_subdirectory(test)
......
set(commonincludedir ${CMAKE_INSTALL_INCLUDEDIR}/dune/subgrid/common)
set(commoninclude_HEADERS variant.hh)
# include not needed for CMake
# include $(top_srcdir)/am/global-rules
install(FILES ${commoninclude_HEADERS} DESTINATION ${commonincludedir})
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_COMMON_STD_VARIANT_HH
#define DUNE_COMMON_STD_VARIANT_HH
#include <tuple>
#include <memory>
#include <dune/common/hybridutilities.hh>
#include <dune/common/exceptions.hh>
namespace Dune {
namespace Std {
namespace Impl {
// indicator value if something's not yet (or not any longer) valid
constexpr const auto invalidIndex = std::numeric_limits<size_t>::max();
/* helper constructs to find position of a type T in a pack Ts... */
template <typename T, typename... Ts>
struct index_in_pack;
template <typename T, typename... Ts>
struct index_in_pack<T, T, Ts...> : std::integral_constant<std::size_t, 0> {};
template <typename T, typename U, typename... Ts>
struct index_in_pack<T, U, Ts...> : std::integral_constant<std::size_t, 1 + index_in_pack<T, Ts...>::value> {};
/* end helper constructs to find position of a type T in a pack Ts... */
template<typename Tp>
struct Buffer_ : std::aligned_storage<sizeof(Tp)> {
using Storage = typename std::aligned_storage_t<sizeof(Tp)>::type;
Storage storage_;
void* addr() {
return static_cast<void*>(&storage_);
}
const void* addr() const {
return static_cast<const void*>(&storage_);
}
Tp* ptr() {
return static_cast<Tp*>(addr());
}
const Tp* ptr() const {
return static_cast<const Tp*>(addr());
}
};
template<typename Tp, bool isTrivial>
struct TypeStorage_ { };
template<typename Tp>
struct TypeStorage_<Tp, true> {
TypeStorage_(Tp t) :
tp_(t) {}
template<typename... Args>
TypeStorage_(Args... args) :
tp_(args...) {}
auto& get() {
return tp_;
}
const auto& get() const {
return tp_;
}
void reset() {};
private:
Tp tp_;
};
template<typename Tp>
struct TypeStorage_<Tp, false> {
TypeStorage_(Tp t) {
::new (&tp_) Tp(t);
}
template<typename... Args>
TypeStorage_(Args... args) {
::new (&tp_) Tp(std::forward<Args>(args)...);
}
TypeStorage_() = delete;
auto& get() {
return *(tp_.ptr());
}
const auto& get() const {
return *(tp_.ptr());
}
void reset() {
// Properly destruct the member:
tp_.ptr()->~Tp();
// (the memory itself doesn't need to be free'd. This is done when the Buffer_ member gets destructed)
}
private:
Buffer_<Tp> tp_;
};
template<typename... T>
union variant_union_ {
// dummy (this should never be called)
void resetByIndex(size_t) {
assert(false);
};
};
template<typename Head_, typename... Tail_>
union variant_union_<Head_, Tail_...> {
constexpr variant_union_() :
tail_() {}
template<typename... Args>
constexpr variant_union_(std::integral_constant<size_t, 0>, Args&&... args) :
head_(std::forward<Args...>(args)...) {}
template<size_t N, typename... Args>
constexpr variant_union_(std::integral_constant<size_t, N>, Args&&... args) :
tail_(std::integral_constant<size_t, N-1>(), std::forward<Args...>(args)...) {}
auto& getByIndex(std::integral_constant<size_t, 0>) {
return head_.get();
}
const auto& getByIndex(std::integral_constant<size_t, 0>) const {
return head_.get();
}
template<size_t N>
auto& getByIndex(std::integral_constant<size_t, N>) {
return tail_.getByIndex(std::integral_constant<size_t, N-1>());
}
template<size_t N>
const auto& getByIndex(std::integral_constant<size_t, N>) const {
return tail_.getByIndex(std::integral_constant<size_t, N-1>());
}
void resetByIndex(size_t indexToReset) {
if (indexToReset == 0) {
head_.reset();
return;
}
else {
tail_.resetByIndex(indexToReset-1);
}
}
template<typename Tp>
void set(Tp&& obj) {
using T = std::decay_t<Tp>;
Dune::Hybrid::ifElse(std::is_same<T, Head_>(),
[&](auto&& id) { id(head_)=std::forward<Tp>(obj); },
[&](auto&& id) { return id(tail_).set(std::forward<Tp>(obj)); }
);
}
constexpr size_t size() const {
return sizeof...(Tail_)+1;
}
private:
TypeStorage_<Head_, std::is_trivial<Head_>::value> head_;
variant_union_<Tail_...> tail_;
};
template<typename...T>
struct variant_{
constexpr variant_() :
unions_(),
index_(invalidIndex) {}
template<typename Tp>
constexpr variant_(Tp obj) :
unions_(),
index_(index_in_pack<Tp, T...>::value)
{
unions_.set(std::move(obj));
}
variant_(variant_&& other) {
unions_ = std::move(other.unions_);
index_ = other.index_;
other.index_ = invalidIndex;
}
variant_(const variant_& other) {
index_ = other.index_;
namespace H = Dune::Hybrid;
H::forEach(H::integralRange(std::integral_constant<size_t, size_>()), [&](auto i) {
if(i==index_)
unions_.set(other.template get<i>());
});
}
variant_& operator=(const variant_& other) {
if(index_ != invalidIndex)
unions_.resetByIndex(index_);
index_ = other.index_;
namespace H = Dune::Hybrid;
H::forEach(H::integralRange(std::integral_constant<size_t, size_>()), [&](auto i) {
if(i==index_)
unions_.set(other.template get<i>());
});
return *this;
}
variant_& operator=(variant_&& other) {
unions_ = std::move(other.unions_);
index_ = other.index_;
other.index_ = invalidIndex;
return *this;
}
template<typename Tp>
auto& get() {
constexpr size_t idx = index_in_pack<Tp, T...>::value;
if (index_ != idx)
DUNE_THROW(Dune::Exception, "Bad variant access.");
return get<idx>();
}
template<typename Tp>
const auto& get() const {
constexpr size_t idx = index_in_pack<Tp, T...>::value;
if (index_ != idx)
DUNE_THROW(Dune::Exception, "Bad variant access.");
return get<idx>();
}
template<typename Tp>
Tp* get_if() {
if (not holds_alternative<Tp>())
return (Tp*) nullptr;
else
return &(get<Tp>());
}
template<typename Tp>
const Tp* get_if() const {
if (not holds_alternative<Tp>())
return (Tp*) nullptr;
else
return &(get<Tp>());
}
template<size_t N>
auto* get_if() {
using Tp = std::decay_t<decltype(get<N>())>;
if (not holds_alternative<N>())
return (Tp*) nullptr;
else
return &(get<Tp>());
}
template<size_t N>
const auto* get_if() const {
using Tp = std::decay_t<decltype(get<N>())>;
if (not holds_alternative<N>())
return (Tp*) nullptr;
else
return &(get<Tp>());
}
template<size_t N>
auto& get() {
if (index_ != N || index_ == invalidIndex)
DUNE_THROW(Dune::Exception, "Bad variant access.");
return unions_.template getByIndex(std::integral_constant<size_t, N>());
}
template<size_t N>
const auto& get() const {
if (index_ != N || index_ == invalidIndex)
DUNE_THROW(Dune::Exception, "Bad variant access.");
return unions_.template getByIndex(std::integral_constant<size_t, N>());
}
template<typename Tp>
constexpr Tp& operator=(Tp obj) {
constexpr auto index = index_in_pack<Tp, T...>::value;
// before setting a new object into the buffer, we have to destruct the old element
if(not (index_ == index or index_ == invalidIndex)) {
unions_.resetByIndex(index_);
}
unions_.set(std::move(obj));
index_=index;
return unions_.getByIndex(std::integral_constant<size_t,index>());
}
constexpr std::size_t index() const noexcept {
return index_;
}
constexpr auto size() const {
return sizeof...(T);
}
~variant_() {
if (index_ != invalidIndex) {
unions_.resetByIndex(index_);
}
}
/* \brief Apply visitor to the active variant.
*
* visit assumes that the result of
* func(T) has the same type for all types T
* in this variant.
*/
template<typename F>
auto visit(F&& func) {
using namespace Dune::Hybrid;
using Result = decltype(func(unions_.getByIndex(std::integral_constant<size_t, 0>())));
return ifElse(std::is_same<Result, void>(), [&, this](auto id) {
constexpr auto tsize = size_;
Dune::Hybrid::forEach(Dune::Hybrid::integralRange(std::integral_constant<size_t, tsize>()), [&](auto i) {
if (i==this->index_)
func(id(unions_).getByIndex(std::integral_constant<size_t, i>()));
});
return;},
[&func,this](auto id) {
constexpr auto tsize = size_;
auto result = std::unique_ptr<Result>();
Dune::Hybrid::forEach(Dune::Hybrid::integralRange(std::integral_constant<size_t, tsize>()), [&, this](auto i) {
if (i==this->index_)
result = std::make_unique<Result>(func(id(this->unions_).getByIndex(std::integral_constant<size_t, i>())));
});
return *result;
});
}
template<typename F>
auto visit(F&& func) const {
using namespace Dune::Hybrid;
using Result = decltype(func(unions_.getByIndex(std::integral_constant<size_t, 0>())));
return ifElse(std::is_same<Result, void>(), [&, this](auto id) {
constexpr auto tsize = size_;
Dune::Hybrid::forEach(Dune::Hybrid::integralRange(std::integral_constant<size_t, tsize>()), [&](auto i) {
if (i==this->index_)
func(id(unions_).getByIndex(std::integral_constant<size_t, i>()));
});
return;},
[&func,this](auto id) {
constexpr auto tsize = size_;
auto result = std::unique_ptr<Result>();
Dune::Hybrid::forEach(Dune::Hybrid::integralRange(std::integral_constant<size_t, tsize>()), [&, this](auto i) {
if (i==this->index_)
result = std::make_unique<Result>(func(id(this->unions_).getByIndex(std::integral_constant<size_t, i>())));
});
return *result;
});
}
/** \brief Check if a given type is the one that is currently active in the variant. */
template<typename Tp>
constexpr bool holds_alternative() const {
// I have no idea how this could be really constexpr, but for STL-conformity,
// I'll leave the modifier there.
return (index_in_pack<Tp, T...>::value == index_);
}
/** \brief Check if a given type is the one that is currently active in the variant. */
template<size_t N>
constexpr bool holds_alternative() const {
// I have no idea how this could be really constexpr, but for STL-conformity,
// I'll leave the modifier there.
return (N == index_);
}
private:
variant_union_<T...> unions_;
std::size_t index_;
constexpr static auto size_ = sizeof...(T);
};
} // end namespace Impl
/** \brief Incomplete re-implementation of C++17's std::variant. */
template<typename ...T>
using variant = Impl::variant_<T...>;
template<size_t N, typename... T>
auto& get(variant<T...>& var) {
return var.template get<N>();
}
template<size_t N, typename... T>
const auto& get(const variant<T...>& var) {
return var.template get<N>();
}
template<typename F, typename... T>
auto visit(F&& visitor, variant<T...>& var) {
return var.visit(std::forward<F>(visitor));
}
template<typename F, typename... T>
auto visit(F&& visitor, const variant<T...>& var) {
return var.visit(std::forward<F>(visitor));
}
template<typename Tp, typename ...T>
auto& get(variant<T...>& var) {
return var.template get<Tp>();
}
template<typename Tp, typename ...T>
const auto& get(const variant<T...>& var) {
return var.template get<Tp>();
}
template<typename Tp, typename ...T>
const auto* get_if(const variant<T...>& var) {
return var.template get_if<Tp>();
}
template<typename Tp, typename ...T>
auto* get_if(variant<T...>& var) {
return var.template get_if<Tp>();
}
template<size_t N, typename ...T>
const auto* get_if(const variant<T...>& var) {
return var.template get_if<N>();
}
template<size_t N, typename ...T>
auto* get_if(variant<T...>& var) {
return var.template get_if<N>();
}
template<typename Tp, typename ...T>
constexpr bool holds_alternative(const variant<T...>& var) {
return var.template holds_alternative<Tp>();
}
template <typename... T>
constexpr auto variant_size_v(const variant<T...>&) {
return std::integral_constant<std::size_t,sizeof...(T)>::value;
}
} // end namespace Std
} // end namespace Dune
#endif
......@@ -12,7 +12,13 @@
#include <vector>
#include <type_traits>
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,7)
#include <dune/common/parallel/collectivecommunication.hh>
#else
#include <dune/common/parallel/communication.hh>
#endif
#include <dune/grid/common/backuprestore.hh>
#include <dune/grid/common/capabilities.hh>
#include <dune/grid/common/grid.hh>
......@@ -318,7 +324,7 @@ class SubGrid :
typedef typename Traits::template Codim<EntitySeed::codimension>::Entity Entity;
typedef SubGridEntity<EntitySeed::codimension, Entity::dimension, const typename Traits::Grid> EntityImp;
return Entity(EntityImp(this, hostgrid_->entity(this->getRealImplementation(seed).hostEntitySeed())));
return Entity(EntityImp(this, hostgrid_->entity(seed.impl().hostEntitySeed())));
}
......@@ -329,7 +335,7 @@ class SubGrid :
/** global refinement
* \todo optimize implementation
*/
void globalRefine (int refCount DUNE_UNUSED)
void globalRefine ([[maybe_unused]] int refCount)
{
for (auto&& e : elements(this->leafGridView()))
mark(1, e);
......@@ -625,9 +631,9 @@ class SubGrid :
{
if (refinementMark_[level][index])
{
if (this->getRealImplementation(e).hostEntity().isLeaf())
if (e.impl().hostEntity().isLeaf())
{
hostgrid_->mark(1, this->getRealImplementation(e).hostEntity());
hostgrid_->mark(1, e.impl().hostEntity());
callHostgridAdapt = true;
}
}
......@@ -1148,7 +1154,7 @@ class SubGrid :
template <int codim>
typename HostGrid::Traits::template Codim<codim>::Entity getHostEntity(const typename Traits::template Codim<codim>::Entity& e) const
{
return this->getRealImplementation(e).hostEntity();
return e.impl().hostEntity();
}
......@@ -1187,7 +1193,7 @@ class SubGrid :
template<class ElementTransfer>
void transfer(ElementTransfer& elementTransfer) const
{
typedef typename HostGrid::template Codim<0>::Entity::Entity HostGridElement;
typedef typename HostGrid::template Codim<0>::Entity HostGridElement;
int hostMaxLevel = hostgrid_->maxLevel();
......
......@@ -19,11 +19,10 @@ class SubGridFaceIterator :
{
enum {dim=GridImp::dimension};
typedef typename GridImp::ctype ctype;
using ctype = typename GridImp::ctype;
public:
typedef typename GridImp::HostGridType::template Codim<0>::Entity HostElement;
typedef typename GridImp::HostGridType::LevelGridView::IntersectionIterator HostLevelIntersectionIterator;
using HostElement = typename GridImp::HostGridType::template Codim<0>::Entity;
//! Default Constructor.
SubGridFaceIterator()
......@@ -338,7 +337,7 @@ protected:
{
index_ = -1;
const HostElement& e = *it_;
for(uint i=0; i < e.subEntities(1); ++i)
for(unsigned int i=0; i < e.subEntities(1); ++i)
if (Base::isSubFace(father, fatherFace, e, i)) {
index_ = i;
break;
......
......@@ -5,7 +5,13 @@
* \brief The SubGridGeometry class and its specializations
*/
#include <type_traits>
#include <dune/subgrid/common/variant.hh>
#include <dune/common/version.hh>
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
#include <dune/common/std/variant.hh>
#else
#include <variant>
#endif
#include <dune/common/fmatrix.hh>
#include <dune/common/typetraits.hh>
......@@ -147,7 +153,11 @@ class SubGridLocalGeometry
using MultiLinGeometry = MultiLinearGeometry<ctype, mydim, coorddim>;
// use a variant to store either a HostGridLocalGeometry or a MultiLinearGeometry
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
using GeometryContainer = Std::variant<HostGridLocalGeometry, MultiLinGeometry>;
#else
using GeometryContainer = std::variant<HostGridLocalGeometry, MultiLinGeometry>;
#endif
public:
......@@ -177,45 +187,77 @@ class SubGridLocalGeometry
/** \brief Return the element type identifier
*/
GeometryType type () const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.type();}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.type();}, localGeometry_);
#endif
}
/** \brief Return true if the geometry mapping is affine and false otherwise */
bool affine() const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.affine();}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.affine();}, localGeometry_);
#endif
}
//! return the number of corners of this element. Corners are numbered 0...n-1
int corners () const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.corners();}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.corners();}, localGeometry_);
#endif
}
//! access to coordinates of corners. Index is the number of the corner
FieldVector<ctype, coorddim> corner (int i) const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.corner(i);}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.corner(i);}, localGeometry_);
#endif
}
/** \brief Maps a local coordinate within reference element to
* global coordinate in element */
FieldVector<ctype, coorddim> global (const FieldVector<ctype, mydim>& local) const{
FieldVector<ctype, coorddim> global (const FieldVector<ctype, mydim>& local) const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.global(local);}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.global(local);}, localGeometry_);
#endif
}
/** \brief Maps a global coordinate within the element to a
* local coordinate in its reference element */
FieldVector<ctype, mydim> local (const FieldVector<ctype, coorddim>& global) const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.local(global);}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.local(global);}, localGeometry_);
#endif
}
/**
*/
ctype integrationElement (const FieldVector<ctype, mydim>& local) const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.integrationElement(local);}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.integrationElement(local);}, localGeometry_);
#endif
}
/** \brief return volume of geometry */
ctype volume () const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.volume();}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.volume();}, localGeometry_);
#endif
}
/** \brief return center of geometry
......@@ -228,17 +270,29 @@ class SubGridLocalGeometry
* find reasonably efficient ways to implement it properly.
*/
FieldVector<ctype, coorddim> center () const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return geom.center();}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return geom.center();}, localGeometry_);
#endif
}
//! The Jacobian matrix of the mapping from the reference element to this element
const JacobianTransposed jacobianTransposed (const FieldVector<ctype, mydim>& local) const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return static_cast<JacobianTransposed>(geom.jacobianTransposed(local));}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return static_cast<JacobianTransposed>(geom.jacobianTransposed(local));}, localGeometry_);
#endif
}
//! The inverse of the Jacobian matrix of the mapping from the reference element to this element
const JacobianInverseTransposed jacobianInverseTransposed (const FieldVector<ctype, mydim>& local) const {
#if DUNE_VERSION_LT(DUNE_COMMON,2,8)
return Std::visit([&](auto&& geom) {return static_cast<JacobianInverseTransposed>(geom.jacobianInverseTransposed(local));}, localGeometry_);
#else
return std::visit([&](auto&& geom) {return static_cast<JacobianInverseTransposed>(geom.jacobianInverseTransposed(local));}, localGeometry_);
#endif
}
private:
......
......@@ -57,7 +57,7 @@ class SubGridHierarchicIterator :
*
* \param endDummy Here only to distinguish it from the other constructor
*/
explicit SubGridHierarchicIterator(const GridImp* subGrid, const SubGridElement& startEntity, int maxLevel, bool endDummy DUNE_UNUSED) :
explicit SubGridHierarchicIterator(const GridImp* subGrid, const SubGridElement& startEntity, int maxLevel, [[maybe_unused]] bool endDummy) :
Base(subGrid, startEntity.hostEntity().hend(maxLevel)),
hostHierarchicEndIterator_(hostIterator_)
{}
......
......@@ -78,8 +78,8 @@ class SubGridLevelIndexSet :
template<class EntityType>
bool contains (const EntityType& e) const
{
return grid_ == &(grid_->getRealImplementation(e).grid())
&& level_ == grid_->getRealImplementation(e).hostEntity().level();
return grid_ == &(e.impl().grid())
&& level_ == e.impl().hostEntity().level();
}
......@@ -217,7 +217,7 @@ class SubGridGlobalIdSet :
GlobalIdType id (const typename std::remove_const<GridImp>::type::Traits::template Codim<cd>::Entity& e) const
{
// Return id of the host entity
return grid_->getHostGrid().globalIdSet().id(grid_->getRealImplementation(e).hostEntity());
return grid_->getHostGrid().globalIdSet().id(e.impl().hostEntity());
}
......@@ -229,7 +229,7 @@ class SubGridGlobalIdSet :
GlobalIdType subId (const typename std::remove_const<GridImp>::type::Traits::template Codim<0>::Entity& e, int i, unsigned int cc) const
{
// Return sub id of the host entity
return grid_->getHostGrid().globalIdSet().subId(grid_->getRealImplementation(e).hostEntity(),i,cc);
return grid_->getHostGrid().globalIdSet().subId(e.impl().hostEntity(),i,cc);
}
......@@ -273,7 +273,7 @@ class SubGridLocalIdSet :
LocalIdType id (const typename std::remove_const<GridImp>::type::Traits::template Codim<cd>::Entity& e) const
{
// Return id of the host entity
return grid_->getHostGrid().localIdSet().id(grid_->getRealImplementation(e).hostEntity());
return grid_->getHostGrid().localIdSet().id(e.impl().hostEntity());
}
......@@ -285,7 +285,7 @@ class SubGridLocalIdSet :
LocalIdType subId (const typename std::remove_const<GridImp>::type::Traits::template Codim<0>::Entity& e, int i, unsigned int cc) const
{
// Return sub id of the host entity
return grid_->getHostGrid().localIdSet().subId(grid_->getRealImplementation(e).hostEntity(),i,cc);
return grid_->getHostGrid().localIdSet().subId(e.impl().hostEntity(),i,cc);
}
......
......@@ -180,7 +180,7 @@ class SubGridIndexStorageBase
//! get multilevel geometry type counter for given geometry type for usage on given level
MultilevelCounter& getGeometryTypeCountForLevel(const GeometryType& gt, int level DUNE_UNUSED)
MultilevelCounter& getGeometryTypeCountForLevel(const GeometryType& gt, [[maybe_unused]] int level)
{
// Is this the first time we see this kind of entity?
auto countIt = numEntities.find(gt);
......@@ -196,7 +196,7 @@ class SubGridIndexStorageBase
return countIt->second;
}
const MultilevelCounter& getGeometryTypeCountForLevel(const GeometryType& gt, int level DUNE_UNUSED) const
const MultilevelCounter& getGeometryTypeCountForLevel(const GeometryType& gt, [[maybe_unused]] int level) const
{
return numEntities.find(gt)->second;
}
......@@ -214,7 +214,7 @@ class SubGridIndexStorageBase
template <int codim>
int getHostLevelIndex(int level, const GridEntity<codim>& e) const
{
return hostgrid.levelIndexSet(level).index(grid.getRealImplementation(e).hostEntity());
return hostgrid.levelIndexSet(level).index(e.impl().hostEntity());
}
......@@ -222,7 +222,7 @@ class SubGridIndexStorageBase
template <int cc>
int getHostLevelSubIndex(int level, const GridEntity<cc>& e, int i, unsigned int codim) const
{
return hostgrid.levelIndexSet(level).subIndex(grid.getRealImplementation(e).hostEntity(), i, codim+CodimInHostGrid);
return hostgrid.levelIndexSet(level).subIndex(e.impl().hostEntity(), i, codim+CodimInHostGrid);
}
......@@ -230,14 +230,14 @@ class SubGridIndexStorageBase
template <int codim>
HostIdType getHostId(const GridEntity<codim>& e) const
{
return hostgrid.globalIdSet().id(grid.getRealImplementation(e).hostEntity());
return hostgrid.globalIdSet().id(e.impl().hostEntity());
}
//! get id of host grid subentity encapsulated in given subentity
HostIdType getHostSubId(const GridEntity<0>& e, int i, unsigned int codim) const
{
return hostgrid.globalIdSet().subId(grid.getRealImplementation(e).hostEntity(), i, codim);
return hostgrid.globalIdSet().subId(e.impl().hostEntity(), i, codim);
}
......@@ -571,7 +571,7 @@ class SubGridMapSubindexSetter<GridType,0>
typedef typename std::remove_const<GridType>::type::template Codim<0>::Entity Element;
static void insertSubEntities(SubGridMapIndexStorage<GridType>& indexStorage DUNE_UNUSED, const Element& e DUNE_UNUSED, bool isLeaf DUNE_UNUSED, int level DUNE_UNUSED)
static void insertSubEntities([[maybe_unused]] SubGridMapIndexStorage<GridType>& indexStorage, [[maybe_unused]] const Element& e, [[maybe_unused]] bool isLeaf, [[maybe_unused]] int level)
{};
};
......@@ -834,7 +834,7 @@ class SubGridVectorSubindexSetter
//! \todo Please doc me !
static void insertSubEntities(SubGridVectorIndexStorage<GridType>& indexStorage, const Element& e, bool isLeaf, int level)
{
for(uint i=0; i < e.subEntities(codim); ++i)
for(unsigned int i=0; i < e.subEntities(codim); ++i)
{
// get host index and GeometryType index of entity
int hostIndex = indexStorage.template getHostLevelSubIndex<0>(level, e, i, codim);
......@@ -863,7 +863,7 @@ class SubGridVectorSubindexSetter
nonLeafCopyFound = false;
father = father.father();
--fatherLevel;
for(uint j=0; j < father.subEntities(codim); ++j)
for(unsigned int j=0; j < father.subEntities(codim); ++j)
{
// if subentity is copy of ancestor subentity
// copy leaf index from father subentity
......@@ -951,7 +951,7 @@ class SubGridVectorSubindexSetter<GridType,0>
typedef typename std::remove_const<GridType>::type::template Codim<0>::Entity Element;
static void insertSubEntities(SubGridVectorIndexStorage<GridType>& indexStorage DUNE_UNUSED, const Element& e DUNE_UNUSED, bool isLeaf DUNE_UNUSED, int level DUNE_UNUSED)
static void insertSubEntities([[maybe_unused]] SubGridVectorIndexStorage<GridType>& indexStorage, [[maybe_unused]] const Element& e, [[maybe_unused]] bool isLeaf, [[maybe_unused]] int level)
{};
};
......
......@@ -2,7 +2,7 @@
#define DUNE_SUBGRID_SUBGRID_LEAF_INTERSECTION_ITERATOR_HH
#include <list>
#include <tr1/memory>
#include <memory>
#include <dune/common/shared_ptr.hh>
#include <dune/subgrid/subgrid/subgridfaceiterator.hh>
......
......@@ -64,7 +64,7 @@ class SubGridLeafIterator :
*
* \param endDummy Here only to distinguish it from the other constructor
*/
explicit SubGridLeafIterator(const GridImp* subGrid, bool endDummy DUNE_UNUSED) :
explicit SubGridLeafIterator(const GridImp* subGrid, [[maybe_unused]] bool endDummy) :
Base(subGrid, subGrid->getHostGrid().levelGridView(subGrid->maxLevel()).template end<codim>()),
hostLevelEndIterator_(subGrid->getHostGrid().levelGridView(0).template end<codim>()),
level_(0)
......
......@@ -2,7 +2,7 @@
#define DUNE_SUBGRID_SUBGRID_LEVEL_INTERSECTION_ITERATOR_HH
#include <list>
#include <tr1/memory>
#include <memory>
#include <dune/common/shared_ptr.hh>
/** \file
......
......@@ -52,10 +52,10 @@ class SubGridLevelIterator :
/**
* \brief Constructor which create the end iterator
*
*
* \param endDummy Here only to distinguish it from the other constructor
*/
explicit SubGridLevelIterator(const GridImp* subGrid, int level, bool endDummy DUNE_UNUSED) :
explicit SubGridLevelIterator(const GridImp* subGrid, int level, [[maybe_unused]] bool endDummy) :
Base(subGrid, subGrid->getHostGrid().levelGridView(level).template end<codim>()),
hostLevelEndIterator_(hostIterator_)
{}
......
set(TESTPROGS test-w-onedgrid test-w-yaspgrid test-w-alugrid testvariant)
set(TESTPROGS test-w-onedgrid test-w-yaspgrid test-w-alugrid)
if(ALBERTA_FOUND)
list(APPEND TESTPROGS test-w-albertagrid2d)
......
......@@ -2,6 +2,8 @@
#define DISABLE_DEPRECATED_METHOD_CHECK 1
#include <memory>
#include <dune/common/exceptions.hh>
#include <dune/grid/utility/structuredgridfactory.hh>
......@@ -24,7 +26,7 @@ enum EltGeometryType {SIMPLEX, CUBE, NA};
template <class GridType, EltGeometryType EGT>
struct CoarseGridConstructor
{
static Dune::shared_ptr<GridType> constructCoarseGrid(size_t ncells=1)
static std::shared_ptr<GridType> constructCoarseGrid(size_t ncells=1)
{
DUNE_THROW(Dune::NotImplemented,"not implemented for this Element geometry");
}
......@@ -45,7 +47,7 @@ struct CoarseGridConstructor<GridType, SIMPLEX>
template <class GridType>
struct CoarseGridConstructor<GridType, CUBE>
{
static Dune::shared_ptr<GridType> constructCoarseGrid(size_t ncells=1)
static std::shared_ptr<GridType> constructCoarseGrid(size_t ncells=1)
{
const int dim=GridType::dimension;
std::array<unsigned int, dim> elts;
......@@ -231,9 +233,9 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
}
catch (Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
std::cerr << e.what() << std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
......@@ -243,9 +245,9 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
}
catch (Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
std::cerr << e.what() << std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
try {
......@@ -253,9 +255,9 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
checkLeafIntersections(subgrid);
} catch (Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
std::cerr << e.what() << std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
......@@ -283,9 +285,9 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
}
catch (Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
std::cerr << e.what() << std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
try {
......@@ -294,9 +296,9 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
}
catch (Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
std::cerr << e.what() << std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
try {
......@@ -305,9 +307,9 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
}
catch (Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
std::cerr << e.what() << std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
......@@ -325,8 +327,8 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
catch (Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
/* // IntersectionIterator tests only make sense if coarse grid elements are fully covered by the subgrid
......@@ -334,11 +336,11 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
std::cout << "Performing checkIntersectionIterator\n";
checkIntersectionIterator(subgrid);
}
catch (Dune::NotImplemented& e)
catch (const Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
std::cerr << e.what() << std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
*/
......@@ -348,9 +350,9 @@ size_t checkWithHostGrid(size_t host_prerefine=2, int sub_initlevel=-1, size_t s
}
catch (Dune::NotImplemented& e)
{
std::cerr << e << std::endl;
} catch (Dune::Exception e) {
std::cerr << e <<std::endl;
std::cerr << e.what() << std::endl;
} catch (const Dune::Exception& e) {
std::cerr << e.what() <<std::endl;
ret = 1;
}
......
......@@ -23,7 +23,7 @@ int main(int argc, char* argv[]) try {
std::cout << "Test for SubGrid with AlbertaGrid<2,2> " << (return_val==0 ? "passed." : "failed.") << std::endl;
return return_val;
} catch (Exception e) {
std::cout << e << std::endl;
} catch (const Exception& e) {
std::cout << e.what() << std::endl;
return 1;
}
......@@ -23,7 +23,7 @@ int main(int argc, char* argv[]) try {
std::cout << "Test for SubGrid with AlbertaGrid<3,3> " << (return_val==0 ? "passed." : "failed.") << std::endl;
return return_val;
} catch (Exception e) {
std::cout << e << std::endl;
} catch (const Exception& e) {
std::cout << e.what() << std::endl;
return 1;
}