Skip to content
Snippets Groups Projects
Commit 92982b2e authored by Oliver Sander's avatar Oliver Sander
Browse files

Merge branch 'feature/update-to-dune-3.0' into 'master'

Feature/update to dune 3.0

This is based on merge request !4 

See merge request !7
parents 8c871f08 8c0e6c45
No related branches found
No related tags found
No related merge requests found
Showing
with 74 additions and 402 deletions
# Default cmake build directory
build-cmake
# default test result directory
Testing
# these are ignored by git
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
......
cmake_minimum_required(VERSION 2.8.6)
cmake_minimum_required(VERSION 2.8.12)
project(dune-foamgrid CXX)
if(NOT (dune-common_DIR OR dune-common_ROOT OR
......@@ -17,10 +17,10 @@ include(DuneMacros)
# start a dune project with information from dune.module
dune_project()
dune_enable_all_packages()
add_subdirectory(src)
add_subdirectory(m4)
add_subdirectory(dune EXCLUDE_FROM_ALL)
add_subdirectory(dune)
add_subdirectory(doc)
add_subdirectory(cmake/modules)
add_subdirectory(examples EXCLUDE_FROM_ALL)
......
# $Id: duneproject 5502 2009-04-03 15:05:58Z sander $
# we need the module file to be able to build via dunecontrol
EXTRA_DIST = dune.module \
CMakeLists.txt \
config.h.cmake
SUBDIRS = dune doc m4 src cmake
# don't follow the full GNU-standard
# we need automake 1.9 or newer
AUTOMAKE_OPTIONS = foreign 1.9
# pass most important options when "make distcheck" is used
DISTCHECK_CONFIGURE_FLAGS = --with-dune-common=$(DUNE_COMMON_ROOT) --with-dune-geometry=$(DUNE_GEOMETRY_ROOT) --with-dune-grid=$(DUNE_GRID_ROOT) CXX="$(CXX)" CC="$(CC)"
include $(top_srcdir)/am/top-rules
include $(top_srcdir)/am/global-rules
# Generate package configuration files for finding
# installed modules with CMake
include $(top_srcdir)/am/cmake-pkg-config
SUBDIRS = modules
include $(top_srcdir)/am/global-rules
MODULES = DuneFoamgridMacros.cmake
modulesdir = $(datadir)/dune/cmake/modules
dist_modules_DATA = ${MODULES}
include $(top_srcdir)/am/global-rules
EXTRA_DIST = CMakeLists.txt
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.62])
DUNE_AC_INIT # gets module version from dune.module file
AC_CONFIG_SRCDIR([src/dune_foamgrid.cc])
AC_CONFIG_HEADERS([config.h])
# we need no more than the standard DE-stuff
# this module depends on dune-common dune-geometry dune-grid
# this implies checking for [dune-common], [dune-geometry], [dune-grid]
DUNE_CHECK_ALL
# implicitly set the Dune-flags everywhere
AC_SUBST(AM_CPPFLAGS, $DUNE_CPPFLAGS)
AC_SUBST(AM_LDFLAGS, $DUNE_LDFLAGS)
LIBS="$DUNE_LIBS"
AC_CONFIG_FILES([
Makefile
src/Makefile
cmake/Makefile
cmake/modules/Makefile
dune/Makefile
dune/foamgrid/Makefile
dune/foamgrid/foamgrid/Makefile
dune/foamgrid/test/Makefile
doc/Makefile
doc/doxygen/Makefile
doc/doxygen/Doxyfile
m4/Makefile
dune-foamgrid.pc
])
AC_OUTPUT
# finally print the summary information
DUNE_SUMMARY_ALL
SUBDIRS = doxygen
CURDIR = doc
BASEDIR = ..
# add list of html files to generate from wml
PAGES=
docdir=$(datadir)/doc/dune-foamgrid
EXTRA_DIST = CMakeLists.txt
include $(top_srcdir)/am/webstuff
CLEANFILES = $(PAGES)
if ! BUILD_DOCS
# add tag to notify that dist has been build without documentation
dist-hook:
echo "# No documentation included in distribution! " > $(distdir)/$(DOCUMENTATION_TAG_FILE)
endif
include $(top_srcdir)/am/webstuff
include $(top_srcdir)/am/global-rules
BASEDIR=../..
CURDIR=doc/doxygen
EXTRA_DIST = CMakeLists.txt
include $(top_srcdir)/am/doxygen
include $(top_srcdir)/am/global-rules
# $Id: $
SUBDIRS = foamgrid
EXTRA_DIST = CMakeLists.txt
include $(top_srcdir)/am/global-rules
SUBDIRS = foamgrid test
EXTRA_DIST = CMakeLists.txt
foamgriddir = $(includedir)/dune/foamgrid
foamgrid_HEADERS = foamgrid.hh dgffoam.cc
include $(top_srcdir)/am/global-rules
......@@ -169,9 +169,7 @@ namespace Dune
template< class GG, class II >
const DGFBoundaryParameter::type &boundaryParameter ( const Dune::Intersection< GG, II > &intersection ) const
{
typedef Dune::Intersection< GG, II > Intersection;
typename Intersection::EntityPointer inside = intersection.inside();
const typename Intersection::Entity &entity = *inside;
const auto& entity = intersection.inside();
const int face = intersection.indexInInside();
const ReferenceElement< double, dimension > &refElem
......@@ -181,7 +179,7 @@ namespace Dune
for( int i = 0; i < corners; ++i )
{
const int k = refElem.subEntity( face, 1, i, dimension );
bound[ i ] = factory_.insertionIndex( *entity.template subEntity< dimension >( k ) );
bound[ i ] = factory_.insertionIndex( entity.template subEntity< dimension >( k ) );
}
DuneGridFormatParser::facemap_t::key_type key( bound, false );
......
......@@ -32,7 +32,6 @@
#include "foamgrid/foamgridleafiterator.hh"
#include "foamgrid/foamgridhierarchiciterator.hh"
#include "foamgrid/foamgridindexsets.hh"
#include "foamgrid/foamgridviews.hh"
namespace Dune {
......@@ -66,8 +65,8 @@ struct FoamGridFamily
FoamGridIdSet< const FoamGrid<dimgrid, dimworld> >, // local IdSet
unsigned int, // local id type
CollectiveCommunication<Dune::FoamGrid<dimgrid, dimworld> > ,
FoamGridLevelGridViewTraits,
FoamGridLeafGridViewTraits,
DefaultLevelGridViewTraits,
DefaultLeafGridViewTraits,
FoamGridEntitySeed
> Traits;
};
......@@ -110,11 +109,6 @@ class FoamGrid :
template <int codim_, class GridImp_>
friend class FoamGridEntityPointer;
template <class GridImp_, PartitionIteratorType PiType_>
friend class FoamGridLeafGridView;
template <class GridImp_, PartitionIteratorType PiType_>
friend class FoamGridLevelGridView;
public:
/** \brief FoamGrid is only implemented for 1 and 2 dimension */
......@@ -137,7 +131,6 @@ class FoamGrid :
*/
FoamGrid()
: leafIndexSet_(*this),
leafGridView_(*this),
globalRefined(0),
numBoundarySegments_(0),
growing_(false)
......@@ -301,24 +294,6 @@ class FoamGrid :
return leafIndexSet_;
}
//! View for the leaf grid
template<PartitionIteratorType pitype>
typename Traits::template Partition<pitype>::LeafGridView
leafGridView() const {
typedef typename Traits::template Partition<pitype>::LeafGridView View;
return View(leafGridView_);
}
//! View for the leaf grid for All_Partition
typename Traits::template Partition<All_Partition>::LeafGridView
leafGridView() const
{
typedef typename Traits::template Partition<All_Partition>::LeafGridView View;
return View(leafGridView_);
}
/** \brief Create EntityPointer from EnitySeed */
template < class EntitySeed >
static typename Traits::template Codim<EntitySeed::codimension>::EntityPointer
......@@ -350,7 +325,6 @@ class FoamGrid :
*/
void globalRefine (int refCount = 1);
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
/** \brief Mark entity for refinement
*
* This only works for entities of codim 0.
......@@ -395,52 +369,6 @@ class FoamGrid :
}
return 0;
}
#else
/** \brief Mark entity for refinement
*
* This only works for entities of codim 0.
* The parameter is currently ignored
*
* \return <ul>
* <li> true, if marking was successful </li>
* <li> false, if marking was not possible </li>
* </ul>
*/
bool mark(int refCount, const typename Traits::template Codim<0>::EntityPointer & e)
{
if (not e->isLeaf())
return false;
/** \todo Why do I need those const_casts here? */
if (refCount>=1)
const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(*e).target_)->markState_ = FoamGridEntityImp<dimgrid, dimgrid, dimworld>::REFINE;
else if (refCount<0)
const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(*e).target_)->markState_ = FoamGridEntityImp<dimgrid, dimgrid, dimworld>::COARSEN;
else
const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(*e).target_)->markState_ = FoamGridEntityImp<dimgrid, dimgrid, dimworld>::DO_NOTHING;
return true;
}
/** \brief Return refinement mark for entity
*
* \return refinement mark (1,0,-1)
*/
int getMark(const typename Traits::template Codim<0>::EntityPointer & e) const
{
switch(this->getRealImplementation(*e).target_->markState_)
{
case FoamGridEntityImp<dimgrid, dimgrid, dimworld>::DO_NOTHING:
case FoamGridEntityImp<dimgrid, dimgrid, dimworld>::IS_COARSENED:
return 0;
case FoamGridEntityImp<dimgrid, dimgrid, dimworld>::REFINE:
return 1;
case FoamGridEntityImp<dimgrid, dimgrid, dimworld>::COARSEN:
return -1;
}
return 0;
}
#endif
//! \brief Book-keeping routine to be called before adaptation
bool preAdapt();
......@@ -481,7 +409,7 @@ class FoamGrid :
newVertex.isNew_ = true;
// new vertices are numbered consecutively starting from
// the highest available index in the leaf index set +1
return leafGridView_.size(dimgrid) - 1 + verticesToInsert_.size();
return this->leafGridView().size(dimgrid) - 1 + verticesToInsert_.size();
}
/** \brief Add a new element to be added to the grid
......@@ -502,11 +430,11 @@ class FoamGrid :
for(std::size_t i = 0; i < vertices.size(); i++)
{
if(vertices[i] >= leafGridView_.size(dimgrid))
if(vertices[i] >= this->leafGridView().size(dimgrid))
{
// initialize with pointer to vertex in verticesToInsert_ vector, later overwrite with actual pointer
auto vIt = verticesToInsert_.begin();
std::advance(vIt, vertices[i] - leafGridView_.size(dimgrid));
std::advance(vIt, vertices[i] - this->leafGridView().size(dimgrid));
newElement.vertex_[i] = &*vIt;
}
else
......@@ -637,12 +565,11 @@ class FoamGrid :
void initializeGrowth_()
{
// update the index to vertex map
indexToVertexMap_.resize(leafGridView_.size(dimgrid));
typedef typename Traits::template Codim<dimgrid>::LeafIterator VertexIterator;
for (VertexIterator vIt = this->leafbegin<dimgrid>(), vItEnd = this->leafend<dimgrid>(); vIt != vItEnd; ++vIt)
indexToVertexMap_.resize(this->leafGridView().size(dimgrid));
for (const auto& vertex : vertices(this->leafGridView()))
{
std::size_t index = leafIndexSet().index(*vIt);
indexToVertexMap_[index] = const_cast<FoamGridEntityImp<0, dimgrid ,dimworld>*>(this->getRealImplementation(*vIt).target_);
std::size_t index = leafIndexSet().index(vertex);
indexToVertexMap_[index] = const_cast<FoamGridEntityImp<0, dimgrid ,dimworld>*>(this->getRealImplementation(vertex).target_);
}
// tell the grid it's ready for growth
......@@ -761,10 +688,6 @@ class FoamGrid :
//! The leaf index set
FoamGridLeafIndexSet<const FoamGrid > leafIndexSet_;
// The leaf grid view
FoamGridLeafGridView<const FoamGrid, All_Partition> leafGridView_;
//! The id set
FoamGridIdSet<const FoamGrid > idSet_;
......@@ -812,16 +735,6 @@ namespace Capabilities
static const bool v = true;
};
/** \brief True if the grid can be run on a distributed machine
*/
template <int dimgrid, int dimworld>
struct isParallel< FoamGrid<dimgrid, dimworld> >
{
static const bool v = false;
};
//! \todo Please doc me !
template <int dimgrid, int dimworld>
struct isLevelwiseConforming< FoamGrid<dimgrid, dimworld> >
......
foamgriddir = $(includedir)/dune/foamgrid/foamgrid
foamgrid_HEADERS = foamgrid.cc \
foamgridedge.hh \
foamgridelements.hh \
foamgridentity.hh \
foamgridentitypointer.hh \
foamgridentityseed.hh \
foamgridfactory.hh \
foamgridgeometry.hh \
foamgridhierarchiciterator.hh \
foamgridindexsets.hh \
foamgridintersectioniterators.hh \
foamgridintersections.hh \
foamgridleafiterator.hh \
foamgridleveliterator.hh \
foamgridvertex.hh \
foamgridviews.hh
include $(top_srcdir)/am/global-rules
......@@ -47,11 +47,9 @@ void Dune::FoamGrid<dimgrid, dimworld>::globalRefine (int refCount)
for (int i=refCount; i<0; ++i)
{
// Mark each leaf element for coarsening.
typedef typename Traits::template Codim<0>::LeafIterator Iterator;
for (Iterator elem=this->leafbegin<0>(), end = this->leafend<0>();
elem != end; ++elem)
for (const auto& element : elements(this->leafGridView()))
{
mark(-1,*elem);
mark(-1, element);
}
// do the adaptation
......@@ -155,27 +153,26 @@ bool Dune::FoamGrid<dimgrid, dimworld>::preAdapt()
{
// Loop over all leaf entities and check whether they might be
// coarsened. If there is one return true.
typedef typename Traits::template Codim<0>::LeafIterator Iterator;
int addLevels = 0;
willCoarsen = false;
for (Iterator elem=this->leafbegin<0>(), end = this->leafend<0>(); elem != end; ++elem)
for (const auto& element : elements(this->leafGridView()))
{
int mark=getMark(*elem);
addLevels=std::max(addLevels, elem->level()+mark-maxLevel());
int mark=getMark(element);
addLevels=std::max(addLevels, element.level()+mark-maxLevel());
if (mark<0)
{
// If the element is marked for coarsening but it is not allowed because of growth
// i.e. it contains a junction facet with has no father, we reset to DO_NOTHING
if(this->getRealImplementation(*elem).target_->coarseningBlocked_)
const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(*elem).target_)->markState_ = FoamGridEntityImp<dimgrid, dimgrid, dimworld>::DO_NOTHING;
if(this->getRealImplementation(element).target_->coarseningBlocked_)
const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(element).target_)->markState_ = FoamGridEntityImp<dimgrid, dimgrid, dimworld>::DO_NOTHING;
// If this element is marked for coarsening, but another child
// of this element's father is marked for refinement or has children, then we
// need to reset the marker to doNothing
bool otherChildRefined=false;
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& father = *this->getRealImplementation(*elem).target_->father_;
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& father = *this->getRealImplementation(element).target_->father_;
typedef typename array<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*, 1<<dimgrid >::iterator ChildrenIter;
for (ChildrenIter child=father.sons_.begin(); child != father.sons_.end(); ++child)
otherChildRefined = otherChildRefined ||
......@@ -211,17 +208,15 @@ bool Dune::FoamGrid<dimgrid, dimworld>::adapt()
bool haveRefined=false;
// Loop over all leaf elements and refine/coarsen those that marked for it.
typedef typename Traits::template Codim<0>::LeafIterator Iterator;
for (Iterator elem=this->leafbegin<0>(), end = this->leafend<0>();
elem != end; ++elem)
for (const auto& element : elements(this->leafGridView()))
{
int mark=getMark(*elem);
int mark=getMark(element);
if (mark>0)
{
// Refine simplices
if (elem->type().isTriangle() || elem->type().isLine())
if (element.type().isTriangle() || element.type().isLine())
{
refineSimplexElement(*const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(*elem).target_), 1);
refineSimplexElement(*const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(element).target_), 1);
haveRefined=true;
}
else
......@@ -231,10 +226,10 @@ bool Dune::FoamGrid<dimgrid, dimworld>::adapt()
if (mark<0) // If simplex was already treated by coarsenSimplex mark is 0
{
// Coarsen simplices
if (elem->type().isTriangle() || elem->type().isLine())
if (element.type().isTriangle() || element.type().isLine())
{
assert(elem->level());
coarsenSimplexElement(*const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(*elem).target_));
assert(element.level());
coarsenSimplexElement(*const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(element).target_));
}
else
DUNE_THROW(NotImplemented, "Coarsening only supported for simplices!");
......@@ -267,19 +262,18 @@ bool Dune::FoamGrid<dimgrid, dimworld>::adapt()
for (FacetIter facet=std::get<dimgrid-1>(entityImps_[level]).begin();
facet != std::get<dimgrid-1>(entityImps_[level]).end();)
{
typedef typename std::vector<const FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>::iterator ElementIter;
for (ElementIter elem=facet->elements_.begin(); elem != facet->elements_.end(); ++elem)
for (auto&& element : facet->elements_)
{
if((*elem)->willVanish_)
if(element->willVanish_)
{
*elem = (*elem)->father_;
element = element->father_;
}
}
// check if we have same level elements, if so this facet stays
bool hasSameLevelElements=false;
for (ElementIter elem=facet->elements_.begin(); elem != facet->elements_.end(); ++elem)
hasSameLevelElements = hasSameLevelElements || (*elem)->level()==level;
for (auto&& element : facet->elements_)
hasSameLevelElements = hasSameLevelElements || element->level()==level;
assert(facet->willVanish_!=hasSameLevelElements);
......@@ -325,15 +319,13 @@ void Dune::FoamGrid<dimgrid, dimworld>::postAdapt()
willCoarsen=false;
// Loop over all leaf entities and remove the isNew Marker.
typedef typename Traits::template Codim<0>::LeafIterator Iterator;
for (Iterator elem=this->leafbegin<0>(), end = this->leafend<0>(); elem != end; ++elem)
for (const auto& element : elements(this->leafGridView()))
{
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& element=*const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(*elem).target_);
element.isNew_=false;
assert(!element.willVanish_);
if (element.father_)
element.father_->markState_=FoamGridEntityImp<dimgrid, dimgrid, dimworld>::DO_NOTHING;
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& e = *const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(element).target_);
e.isNew_=false;
assert(!e.willVanish_);
if (e.father_)
e.father_->markState_=FoamGridEntityImp<dimgrid, dimgrid, dimworld>::DO_NOTHING;
}
}
......@@ -342,13 +334,11 @@ void Dune::FoamGrid<dimgrid, dimworld>::postAdapt()
template <int dimgrid, int dimworld>
void Dune::FoamGrid<dimgrid, dimworld>::erasePointersToEntities(std::list<FoamGridEntityImp<dimgrid, dimgrid, dimworld> >& elements)
{
typedef typename std::list<FoamGridEntityImp<dimgrid, dimgrid, dimworld> >::iterator EntityIterator;
for(EntityIterator element=elements.begin();
element != elements.end(); ++element)
for(auto&& element : elements)
{
if(element->willVanish_)
if(element.willVanish_)
{
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& father=*element->father_;
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& father=*element.father_;
for (unsigned int i=0; i<father.nSons_; i++)
father.sons_[i]=nullptr;
// reset the number of sons for the father
......@@ -1331,23 +1321,23 @@ void Dune::FoamGrid<dimgrid, dimworld>::postGrow()
{
// Loop over all leaf entities and remove the isNew Marker
// and set the coarseing blocker in case we created a T-junction
for (auto elem=this->leafbegin<0>(), end = this->leafend<0>(); elem != end; ++elem)
for (auto&& element : elements(this->leafGridView()))
{
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& element=*const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(*elem).target_);
element.isNew_=false;
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& e = *const_cast<FoamGridEntityImp<dimgrid, dimgrid, dimworld>*>(this->getRealImplementation(element).target_);
e.isNew_=false;
for(auto&& vertex : element.vertex_)
for(auto&& vertex : e.vertex_)
vertex->isNew_ = false;
//Block elements that do now have a facet being a junction and not having a father for coarsening
for(auto&& facet : element.facet_)
for(auto&& facet : e.facet_)
if(facet->elements_.size() > 2 && !(facet->hasFather()))
element.coarseningBlocked_ = true;
e.coarseningBlocked_ = true;
// Also block all children of the father as one child marked for coarsening is enough to coarsen all
if(element.coarseningBlocked_ && element.hasFather())
if(e.coarseningBlocked_ && e.hasFather())
{
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& father=*(element.father_);
FoamGridEntityImp<dimgrid, dimgrid, dimworld>& father=*(e.father_);
for (auto&& child : father.sons_)
child->coarseningBlocked_ = true;
}
......
......@@ -10,7 +10,6 @@
#include <dune/foamgrid/foamgrid/foamgridvertex.hh>
#include <dune/foamgrid/foamgrid/foamgridedge.hh>
#include <dune/common/nullptr.hh>
namespace Dune {
......
......@@ -268,11 +268,7 @@ class FoamGridEntity<0, 2, GridImp> :
template<int cc>
int count () const
{
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
static_assert(0<=cc && cc<=2, "Only codimensions with 0 <= cc <= 2 are valid!");
#else
dune_static_assert(0<=cc && cc<=2, "Only codimensions with 0 <= cc <= 2 are valid!");
#endif
return (cc==0) ? 1 : 3;
}
......@@ -309,7 +305,6 @@ class FoamGridEntity<0, 2, GridImp> :
DUNE_THROW(GridError, "Non-existing codimension requested!");
}
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
/** \brief Access to codim 0 subentities */
template<int codim>
typename std::enable_if<codim==0, typename Codim<0>::Entity>::type
......@@ -336,26 +331,6 @@ class FoamGridEntity<0, 2, GridImp> :
assert(i==0 || i==1 || i==2);
return typename Codim<2>::Entity(FoamGridEntity<2, dimgrid, GridImp>(this->target_->vertex_[i]));
}
#else
/** \brief Provide access to sub entity i of given codimension. Entities
* are numbered 0 ... count<cc>()-1
*/
template<int codim>
typename GridImp::template Codim<codim>::EntityPointer subEntity (int i) const{
if (codim==0) {
// The cast is correct when this if clause is executed
return FoamGridEntityPointer<codim, GridImp>( (FoamGridEntityImp<dimgrid-codim, dimgrid, dimworld>*)this->target_);
} else if (codim==1) {
// The cast is correct when this if clause is executed
return FoamGridEntityPointer<codim, GridImp>( (FoamGridEntityImp<dimgrid-codim, dimgrid, dimworld>*)this->target_->facet_[i]);
} else if (codim==2) {
// The cast is correct when this if clause is executed
return FoamGridEntityPointer<codim, GridImp>( (FoamGridEntityImp<dimgrid-codim, dimgrid, dimworld>*)this->target_->vertex_[i]);
}
DUNE_THROW(GridError, "Non-existing codimension requested!");
}
#endif
//! First level intersection
FoamGridLevelIntersectionIterator<GridImp> ilevelbegin () const{
......@@ -404,20 +379,11 @@ class FoamGridEntity<0, 2, GridImp> :
return target_->mightVanish();
}
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
//! Inter-level access to father element on coarser grid.
//! Assumes that meshes are nested.
Entity father () const {
return Entity(FoamGridEntity<0, dimgrid, GridImp>(target_->father_));
}
#else
//! Inter-level access to father element on coarser grid.
//! Assumes that meshes are nested.
FoamGridEntityPointer<0, GridImp> father () const {
return FoamGridEntityPointer<0, GridImp>(target_->father_);
}
#endif
/** \brief Location of this element relative to the reference element element of the father.
* This is sufficient to interpolate all dofs in conforming case.
......@@ -620,12 +586,8 @@ class FoamGridEntity<0, 1, GridImp> :
template<int cc>
int count () const
{
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
static_assert(0<=cc && cc<=1, "Only codimensions with 0 <= cc <= 1 are valid!");
#else
dune_static_assert(0<=cc && cc<=1, "Only codimensions with 0 <= cc <= 1 are valid!");
#endif
return (cc==0) ? 1 : 2;
return (cc==0) ? 1 : 2;
}
/** \brief Return the number of subEntities of codimension cc.
......@@ -659,7 +621,6 @@ class FoamGridEntity<0, 1, GridImp> :
DUNE_THROW(GridError, "Non-existing codimension requested!");
}
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
/** \brief Access to codim 0 subentities */
template<int codim>
typename std::enable_if<codim==0, typename Codim<0>::Entity>::type
......@@ -677,21 +638,6 @@ class FoamGridEntity<0, 1, GridImp> :
assert(i==0 || i==1);
return typename Codim<1>::Entity(FoamGridEntity<1, dimgrid, GridImp>(this->target_->vertex_[i]));
}
#else
/** \brief Provide access to sub entity i of given codimension. Entities
* are numbered 0 ... count<cc>()-1
*/
template<int codim>
typename GridImp::template Codim<codim>::EntityPointer subEntity (int i) const{
if (codim==0) {
// The cast is correct when this if clause is executed
return FoamGridEntityPointer<codim,GridImp>( (FoamGridEntityImp<dimgrid-codim, dimgrid, dimworld>*)this->target_);
} else if (codim==1) {
// The cast is correct when this if clause is executed
return FoamGridEntityPointer<codim,GridImp>( (FoamGridEntityImp<dimgrid-codim, dimgrid, dimworld>*)this->target_->vertex_[i]);
}
}
#endif
//! First level intersection
FoamGridLevelIntersectionIterator<GridImp> ilevelbegin () const{
......@@ -740,19 +686,11 @@ class FoamGridEntity<0, 1, GridImp> :
return target_->mightVanish();
}
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
//! Inter-level access to father element on coarser grid.
//! Assumes that meshes are nested.
Entity father () const {
return Entity(FoamGridEntity<0, dimgrid, GridImp>(target_->father_));
}
#else
//! Inter-level access to father element on coarser grid.
//! Assumes that meshes are nested.
FoamGridEntityPointer<0, GridImp> father () const {
return FoamGridEntityPointer<0, GridImp>(target_->father_);
}
#endif
/** \brief Location of this element relative to the reference element element of the father.
* This is sufficient to interpolate all dofs in conforming case.
......
......@@ -53,40 +53,25 @@ class FoamGridEntityPointer
{
GridImp::getRealImplementation(virtualEntity_).setToTarget(it);
}
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
//! equality
bool equals(const FoamGridEntityPointer<codim,GridImp>& other) const {
return virtualEntity_ == other.virtualEntity_;
}
#else
bool equals(const FoamGridEntityPointer<codim,GridImp>& i) const {
return GridImp::getRealImplementation(virtualEntity_).target_ == GridImp::getRealImplementation(i.virtualEntity_).target_;
}
#endif
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
//! dereferencing
const Entity& dereference() const {
return virtualEntity_;
}
#else
//! dereferencing
Entity& dereference() const {
return virtualEntity_;
}
#endif
//! ask for level of entity
int level () const {
return virtualEntity_.level();
}
protected:
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,4)
//! virtual entity
Entity virtualEntity_;
#else
mutable MakeableInterfaceObject<Entity> virtualEntity_;
#endif
//! equality
bool equals(const FoamGridEntityPointer<codim,GridImp>& other) const {
return virtualEntity_ == other.virtualEntity_;
}
//! dereferencing
const Entity& dereference() const {
return virtualEntity_;
}
//! ask for level of entity
int level () const {
return virtualEntity_.level();
}
protected:
//! virtual entity
Entity virtualEntity_;
};
......
......@@ -6,8 +6,6 @@
* \brief Implementation of EntitySeed for the FoamGrid grid manager
*/
#include <dune/common/nullptr.hh>
#include "foamgridentity.hh"
namespace Dune {
......
......@@ -87,7 +87,7 @@ template <int dimgrid, int dimworld>
Currently, the BoundarySegment object does not actually have any effect.
*/
virtual void insertBoundarySegment(const std::vector<unsigned int>& vertices,
const shared_ptr<BoundarySegment<dimgrid, dimworld> >& boundarySegment)
const std::shared_ptr<BoundarySegment<dimgrid, dimworld> >& boundarySegment)
{
insertBoundarySegment(vertices);
}
......
......@@ -13,18 +13,6 @@
namespace Dune {
#if ! DUNE_VERSION_NEWER(DUNE_GRID,2,4)
template<int mydim, int coorddim, class GridImp> class FoamGridGeometry;
namespace FacadeOptions
{
template< int mydim, int cdim, class GridImp>
struct StoreGeometryReference<mydim, cdim, GridImp, FoamGridGeometry>
{
static const bool v = false;
};
}
#endif
template<int mydim, int coorddim, class GridImp>
class FoamGridGeometry :
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment