Commit 9e5218d7 authored by Christoph Gersbacher's avatar Christoph Gersbacher

Import of release candidate 2.2

parent 70181f84
/aclocal.m4
/am
/autom4te.cache
/compile
/config.guess
/config.h
/config.h.in
/config.log
/config.lt
/config.status
/config.sub
/configure
/depcomp
/dependencies.m4
/dune-prismgrid.pc
/install-sh
/libtool
/ltmain.sh
/missing
/stamp-h1
Makefile
Makefile.in
.libs/
.deps/
*.la
*.lo
*.o
*~
# $Id$
EXTRA_DIST = \
CMakeLists.txt \
config.h.cmake \
dune.module
# we need the module file to be able to build via dunecontrol
EXTRA_DIST = dune.module \
CMakeLists.txt \
config.h.cmake
SUBDIRS = cmake doc dune m4
SUBDIRS = src m4 dune doc cmake
if BUILD_DOCS
# TODO: set up documentation tree automatically
#SUBDIRS += doc
endif
# 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-grid=$(DUNE_GRID_ROOT) CXX="$(CXX)" CC="$(CC)"
DISTCHECK_CONFIGURE_FLAGS = --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
# -*- 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_prismgrid.cc])
DUNE_AC_INIT
AC_CONFIG_SRCDIR([dune/grid/prismgrid/declaration.hh])
AC_CONFIG_HEADERS([config.h])
# we need no more than the standard DE-stuff
# this module depends on 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
doc/Makefile
doc/doxygen/Makefile
doc/doxygen/Doxyfile
doc/doxygen/Makefile
dune-prismgrid.pc
dune/Makefile
dune/prismgrid/Makefile
dune/grid/Makefile
dune/grid/prismgrid/Makefile
dune/grid/test/Makefile
m4/Makefile
dune-prismgrid.pc
])
AC_OUTPUT
# finally print the summary information
DUNE_SUMMARY_ALL
/Doxyfile
/Doxyfile.in
add_subdirectory(prismgrid)
add_subdirectory(grid)
SUBDIRS = prismgrid
SUBDIRS = grid
EXTRA_DIST = CMakeLists.txt
......
add_subdirectory(prismgrid)
#add_subdirectory(test)
prismgridincludedir = $(includedir)/dune/prismgrid
prismgridinclude_HEADERS = prismgrid.hh
SUBDIRS = prismgrid test
EXTRA_DIST = CMakeLists.txt
......
install(FILES
boundarysegmentindexset.hh
capabilities.hh
columniterator.hh
datahandle.hh
declaration.hh
dgfparser.cc
dgfparser.hh
entity.hh
entityiterator.hh
entitypointer.hh
entityseed.hh
geometryhelper.hh
geometry.hh
gridenums.hh
gridfamily.hh
grid.hh
hierarchiciterator.hh
hostcorners.hh
hostgridaccess.hh
idset.hh
indexset.hh
intersection.hh
intersectioniterator.hh
normalgrid.hh
persistentcontainer.hh
prismgrid.hh
tangentialgeometry.hh
utility.hh
DESTINATION include/dune/grid/prismgrid)
prismgriddir = $(includedir)/dune/grid/prismgrid
prismgrid_HEADERS = \
boundarysegmentindexset.hh \
capabilities.hh \
columniterator.hh \
datahandle.hh \
declaration.hh \
dgfparser.cc \
dgfparser.hh \
entity.hh \
entityiterator.hh \
entitypointer.hh \
entityseed.hh \
geometryhelper.hh \
geometry.hh \
gridenums.hh \
gridfamily.hh \
grid.hh \
hierarchiciterator.hh \
hostcorners.hh \
hostgridaccess.hh \
idset.hh \
indexset.hh \
intersection.hh \
intersectioniterator.hh \
normalgrid.hh \
persistentcontainer.hh \
prismgrid.hh \
tangentialgeometry.hh \
utility.hh
EXTRA_DIST = CMakeLists.txt
include $(top_srcdir)/am/global-rules
/******************************************************************************
The Dune (see www.dune-project.org) meta grid module dune-prismgrid
provides an implementation of the Dune grid interface. From the
host grid view's elements generic prismatic elements are created.
The resulting grid is structured in the augmented spatial direction.
The implementation features access to the underlying host grid and
additional iterators for traversing individual columns.
Copyright (C) 2009 - 2013 Christoph Gersbacher
Copyright (C) 2009 - 2013 Martin Nolte
Copyright (C) 2009 Andreas Dedner
Copyright (C) 2011 - 2012 Robert Kloefkorn
The dune-prismgrid module 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.
The dune-prismgrid module 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 module. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef DUNE_GRID_PRISMGRID_BOUNDARYSEGMENTINDEXSET_HH
#define DUNE_GRID_PRISMGRID_BOUNDARYSEGMENTINDEXSET_HH
#include <cassert>
#include <cstddef>
#include <map>
#include <utility>
#include <dune/common/typetraits.hh>
#include "gridenums.hh"
namespace Dune
{
#ifndef DOXYGEN
// Forward declaration
// -------------------
template< class > class PrismIntersection;
// BoundaryIntersectionIndexSet
// ----------------------------
template< class GridView >
class BoundaryIntersectionIndexSet
{
typedef BoundaryIntersectionIndexSet< GridView > This;
public:
typedef size_t IndexType;
typedef typename GridView::Intersection Intersection;
private:
typedef typename GridView::IndexSet IndexSet;
typedef std::pair< typename GridView::IndexSet::IndexType, int > Key;
typedef std::map< Key, IndexType > IndexMap;
public:
explicit BoundaryIntersectionIndexSet ( const GridView &gridView );
private:
BoundaryIntersectionIndexSet ( const This &other );
BoundaryIntersectionIndexSet &operator= ( const This &other );
public:
IndexType index ( const Intersection &intersection ) const
{
Key key = getKey( intersection );
return indexMap_.find( key )->second;
}
IndexType size () const { return lastIndex_ + 1; }
private:
void add ( const Intersection &intersection )
{
assert( intersection.boundary() );
Key key = getKey( intersection );
assert( indexMap_.find( key ) == indexMap_.end() );
indexMap_[ key ] = ++lastIndex_;
}
Key getKey ( const Intersection &intersection ) const
{
typename Intersection::EntityPointer entityPointer = intersection.inside();
return Key( indexSet().index( *entityPointer ), intersection.indexInInside() );
}
const IndexSet &indexSet () const { return indexSet_; }
const IndexSet &indexSet_;
IndexMap indexMap_;
int lastIndex_;
};
// Implementation of BoundaryIntersectionIndexSet
// ----------------------------------------------
template< class GridView >
inline BoundaryIntersectionIndexSet< GridView >
::BoundaryIntersectionIndexSet ( const GridView &gridView )
: indexSet_( gridView.indexSet() ),
lastIndex_( -1 )
{
typedef typename GridView::template Codim< 0 >::Iterator Iterator;
const Iterator end = gridView.template end< 0 >();
for( Iterator it = gridView.template begin< 0 >(); it != end; ++it )
{
typedef typename Iterator::Entity Entity;
const Entity &entity = *it;
typedef typename GridView::IntersectionIterator IntersectionIterator;
const IntersectionIterator iend = gridView.iend( entity );
for( IntersectionIterator iit = gridView.ibegin( entity ); iit != iend; ++iit )
{
const Intersection &intersection = *iit;
if( intersection.boundary() )
add( intersection );
}
}
}
#endif // #ifndef DOXYGEN
// PrismBoundarySegmentIndexSet
// ----------------------------
/** \ingroup BoundarySegmentIndexSet
*
* \brief An index set for enumerating boundary segments.
*
* \tparam GridImp Prism grid type.
*/
template< class GridImp >
class PrismBoundarySegmentIndexSet
{
typedef PrismBoundarySegmentIndexSet< GridImp > This;
typedef typename remove_const< GridImp >::type::Traits Traits;
public:
//! \brief grid type
typedef typename Traits::Grid Grid;
//! \brief intersection implementations type
typedef PrismIntersection< const Grid > IntersectionImp;
private:
typedef typename Traits::HostGridView HostGridView;
typedef typename HostGridView::IndexSet HostIndexSet;
typedef BoundaryIntersectionIndexSet< HostGridView > HostIntersectionIndexSet;
public:
//! \brief constructor
explicit PrismBoundarySegmentIndexSet ( const Grid &grid )
: hostGridView_( grid.hostGridView() ),
hostIntersectionIndexSet_( hostGridView_ ),
layers_( grid.layers() )
{}
//! \brief return number of boundary segments
size_t size () const
{
return ( hostIntersectionIndexSet().size()*layers() + 2*hostIndexSet().size( 0 ) );
}
//! \brief return index of boundary segment
size_t index ( const IntersectionImp &intersection ) const;
private:
PrismBoundarySegmentIndexSet ( const This & );
This &operator= ( const This & );
const HostGridView &hostGridView () const { return hostGridView_; }
const HostIndexSet &hostIndexSet () const { return hostGridView().indexSet(); }
const HostIntersectionIndexSet &hostIntersectionIndexSet () const
{
return hostIntersectionIndexSet_;
}
int layers () const { return layers_; }
HostGridView hostGridView_;
HostIntersectionIndexSet hostIntersectionIndexSet_;
int layers_;
};
// Implementation of PrismBoundarySegmentIndexSet
// ----------------------------------------------
template< class Grid >
inline size_t PrismBoundarySegmentIndexSet< Grid >
::index ( const IntersectionImp &intersection ) const
{
typedef typename IntersectionImp::HostIntersection HostIntersection;
const int subIndex = intersection.insideEntity().subIndex();
if( intersection.isLateral() )
{
assert( intersection.hasHostIntersection() );
const HostIntersection &hostIntersection = intersection.hostIntersection();
return ( hostIntersectionIndexSet().index( hostIntersection )*layers() + subIndex );
}
else
{
size_t ret = hostIntersectionIndexSet().size()*layers();
if( intersection.face() == upperFace )
ret += hostIndexSet().size( 0 );
ret += hostIndexSet().index( intersection.insideEntity().hostEntity() );
return ret;
}
}
} // namespace Dune
#endif // #ifndef DUNE_GRID_PRISMGRID_BOUNDARYSEGMENTINDEXSET_HH
/******************************************************************************
The Dune (see www.dune-project.org) meta grid module dune-prismgrid
provides an implementation of the Dune grid interface. From the
host grid view's elements generic prismatic elements are created.
The resulting grid is structured in the augmented spatial direction.
The implementation features access to the underlying host grid and
additional iterators for traversing individual columns.
Copyright (C) 2009 - 2013 Christoph Gersbacher
Copyright (C) 2009 - 2013 Martin Nolte
Copyright (C) 2009 Andreas Dedner
Copyright (C) 2011 - 2012 Robert Kloefkorn
The dune-prismgrid module 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.
The dune-prismgrid module 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 module. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef DUNE_GRID_PRISMGRID_CAPABILITIES_HH
#define DUNE_GRID_PRISMGRID_CAPABILITIES_HH
#include <dune/common/typetraits.hh>
#include <dune/geometry/genericgeometry/topologytypes.hh>
#include <dune/grid/common/capabilities.hh>
#include "declaration.hh"
namespace Dune
{
namespace Capabilities
{
/** \ingroup Capabilities
*
* \brief Capability is \b true, if and only if the
* host grid has single geometry type.
*/
template< class HostGrid >
struct hasSingleGeometryType< PrismGrid< HostGrid > >
{
private:
struct NonHybrid
{
typedef typename GenericGeometry::Topology<
hasSingleGeometryType< HostGrid >::topologyId, HostGrid::dimension
>::type HostTopology;
static const int id = GenericGeometry::Prism< HostTopology >::id;
};
struct Hybrid { static const int id = ~0; };
public:
static const bool v = hasSingleGeometryType< HostGrid >::v;
static const int topologyId = SelectType< v, NonHybrid, Hybrid >::Type::id;
};
/** \ingroup Capabilities
*
* \brief PrismGrid supports entities of codimensions <tt>0</tt> and
* <tt>PrismGrid::dimension</tt>.
*/
template< class HostGrid, int codim >
struct hasEntity< PrismGrid< HostGrid >, codim >
{
static const bool v = ( codim == 0 || codim == PrismGrid< HostGrid >::dimension );
};
/** \ingroup Capabilities
*
* \brief PrismGrid is parallel if and only if the host grid is.
*/
template< class HostGrid >
struct isParallel< PrismGrid< HostGrid > >
{
static const bool v = isParallel< HostGrid >::v;
};
/** \ingroup Capabilities
*
* \brief PrismGrid can communinate codimension 0 entities only.
*/
template< class HostGrid, int codim >
struct canCommunicate< PrismGrid< HostGrid >, codim >
{
static const bool v = ( codim == 0 && canCommunicate< HostGrid, 0 >::v );
};
/** \ingroup Capabilities
*
* \brief This capability is set to \b true, if the host
* grid's leaf level grid view is conforming.
*/
template< class HostGrid >
struct isLevelwiseConforming< PrismGrid< HostGrid > >
{
static const bool v = isLeafwiseConforming< HostGrid >::v;
};
/** \ingroup Capabilities
*
* \brief This capability is set to \b true, if the host
* grid's leaf level grid view is conforming.
*/
template< class HostGrid >
struct isLeafwiseConforming< PrismGrid< HostGrid > >
{
static const bool v = isLeafwiseConforming< HostGrid >::v;
};
/** \ingroup Capabilities
*
* \brief PrismGrid does not support backup/restore facilities.
*/
template< class HostGrid >
struct hasBackupRestoreFacilities< PrismGrid< HostGrid > >
{
static const bool v = false; // hasBackupRestoreFacilities< HostGrid >::v;
};
/** \ingroup Capabilities
*
* \brief Don't claim that PrismGrid is thread safe.
*/
template< class HostGrid >
struct threadSafe< PrismGrid< HostGrid > >
{
static const bool v = false;
};
/** \ingroup Capabilities
*
* \brief Don't claim that PrismGrid is view thread safe.
*/
template< class HostGrid >
struct viewThreadSafe< PrismGrid< HostGrid > >
{
static const bool v = false;
};
} // namespace Capabilities
} // namespace Dune
#endif // #ifndef DUNE_GRID_PRISMGRID_CAPABILITIES_HH
/******************************************************************************
The Dune (see www.dune-project.org) meta grid module dune-prismgrid
provides an implementation of the Dune grid interface. From the
host grid view's elements generic prismatic elements are created.
The resulting grid is structured in the augmented spatial direction.
The implementation features access to the underlying host grid and
additional iterators for traversing individual columns.
Copyright (C) 2009 - 2013 Christoph Gersbacher
Copyright (C) 2009 - 2013 Martin Nolte
Copyright (C) 2009 Andreas Dedner
Copyright (C) 2011 - 2012 Robert Kloefkorn
The dune-prismgrid module 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.
The dune-prismgrid module 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 module. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef DUNE_GRID_PRISMGRID_COLUMNITERATOR_HH
#define DUNE_GRID_PRISMGRID_COLUMNITERATOR_HH
#include <dune/common/typetraits.hh>
#include <dune/grid/common/entityiterator.hh>
#include "entitypointer.hh"
#include "gridenums.hh"
namespace Dune
{
// PrismColumnIterator
// -------------------
/** \ingroup ColumnIterator
*
* \brief Additional iterator for column
*
* See the following code example for usage:
* \code
* typedef typename HostGrid::template Codim< 0 >::LeafIterator HostLeafIterator;
* const HostLeafIterator end = hostGrid.template leafend< 0 >();
* for( HostLeafIterator it = hostGrid.template leafbegin< 0 >(); it != end; ++it )
* {
* const typename HostGrid::template Codim< 0 >::Entity &hostEntity = *it;
*
* ColumnIteratorType direction = up;
*
* typedef typename Grid::template Codim< 0 >::ColumnIterator ColumnIterator;
* const ColumnIterator cend = grid.template cend< 0 >( hostEntity, direction );
* for( ColumnIterator cit = grid.template cbegin< 0 >( hostEntity, direction ); cit != cend; ++cit )
* {
* const typename Grid::template Codim< 0 >::Entity &entity = *cit;
* }
* }
* \endcode
*/
template< int codim, class GridImp >
class PrismColumnIterator
: public PrismEntityPointer< PrismEntityPointerTraits< codim, GridImp > >
{
typedef PrismColumnIterator< codim, GridImp > This;
typedef PrismEntityPointer< PrismEntityPointerTraits< codim, GridImp > > Base;
public:
//! \brief grid type
typedef typename Base::Grid Grid;
//! \brief entity pointer implementation type
typedef This EntityPointerImp;
//! \brief entity type
typedef typename Base::Entity Entity;
//! \brief entity implementation type
typedef typename Base::EntityImp EntityImp;
//! \brief host iterator type
typedef typename Base::HostIterator HostIterator;
//! \brief host entity type
typedef typename HostIterator::Entity HostEntity;
private:
// we only support codimensions 0 and dim...
static const bool isLateral = ( Base::codimension == 0 );
#ifndef DOXYGEN
protected:
using Base::entity_;
using Base::hostIterator_;
using Base::layers;
#endif // #ifndef DOXYGEN
public:
using Base::level;
//! \brief constructor
PrismColumnIterator ( const HostIterator &hostIterator, int subIndex,
const Grid &grid, ColumnIteratorType direction )
: Base( hostIterator, subIndex, grid ),
direction_( direction )
{}
//! \brief return begin iterator
static PrismColumnIterator begin ( const HostEntity &hostEntity,
const Grid &grid,
ColumnIteratorType direction = up )
{
HostIterator hostIterator( hostEntity );
if( direction == up )
return This( hostIterator, 0, grid, direction );
int subIndex = ( isLateral ) ? grid.layers() - 1 : grid.layers();
return This( hostIterator, subIndex, grid, direction );
}
//! \brief return end iterator
static PrismColumnIterator end ( const HostEntity &hostEntity,