Commit 0a1d1b6e authored by Robert K's avatar Robert K
Browse files

[cleanup] Adjust IdGrid to recent changes in dune-grid.

parent 996af606
#ifndef DUNE_HOSTGRID_INOUTSTREAMS_HH
#define DUNE_HOSTGRID_INOUTSTREAMS_HH
#include <dune/grid/utility/grapedataioformattypes.hh>
#include <dune/grid/alugrid/common/interfaces.hh>
#if HAVE_DUNE_ALUGRID
#include <dune/alugrid/common/interfaces.hh>
#endif
namespace Dune
{
......@@ -15,6 +16,7 @@ namespace Dune
{
};
#if HAVE_DUNE_ALUGRID
//! if in and out stream are present
template< class HostGrid >
struct HostGridHasInOutStreams< HostGrid, true > : public HasObjectStream
......@@ -25,6 +27,7 @@ namespace Dune
//! type of in stream for communication
typedef typename HostGrid::InStreamType InStreamType;
};
#endif
} // end namespace Dune
......
......@@ -2,62 +2,12 @@
#define DUNE_IDGRID_BACKUPRESTORE_HH
#include <dune/grid/common/backuprestore.hh>
#include <dune/grid/utility/grapedataioformattypes.hh>
#include <dune/grid/idgrid/capabilities.hh>
namespace Dune
{
// BackupRestoreFacilities
// -----------------------
template< class Grid, bool hasBackupRestoreFacilities = Capabilities::hasBackupRestoreFacilities< Grid > ::v >
class IdGridBackupRestoreFacilities
{};
template< class Grid >
class IdGridBackupRestoreFacilities< Grid, true >
{
typedef IdGridBackupRestoreFacilities< Grid, true > This;
protected:
IdGridBackupRestoreFacilities ()
{}
private:
IdGridBackupRestoreFacilities ( const This & );
This &operator= ( const This & );
public:
template< GrapeIOFileFormatType type >
bool writeGrid ( const std::string &filename, double time ) const
{
return asImp().hostGrid().template writeGrid< type >( filename, time );
}
template< GrapeIOFileFormatType type >
bool readGrid ( const std::string &filename, double &time )
{
const bool success
= asImp().hostGrid().template readGrid< type >( filename, time );
asImp().update();
return success;
}
protected:
const Grid &asImp () const
{
return static_cast< const Grid & >( *this );
}
Grid &asImp ()
{
return static_cast< Grid & >( *this );
}
};
// BackupRestoreFacility for IdGrid
// --------------------------------
......
#ifndef DUNE_IDGRID_CAPABILITIES_HH
#define DUNE_IDGRID_CAPABILITIES_HH
//- dune-common includes
#include <dune/common/version.hh>
//- dune-grid includes
#include <dune/grid/common/capabilities.hh>
......@@ -37,12 +40,13 @@ namespace Dune
static const bool v = hasEntity< HostGrid, codim >::v;
};
#if ! DUNE_VERSION_NEWER(DUNE_GRID,3,0)
template< class HostGrid >
struct isParallel< IdGrid< HostGrid > >
{
static const bool v = isParallel< HostGrid >::v;
};
#endif
template< class HostGrid, int codim >
......
......@@ -68,14 +68,15 @@ namespace Dune
// type of extra data, e.g. a pointer to grid (here empty)
typedef typename Traits::ExtraData ExtraData;
// type of entity implementation
typedef typename Traits::template Codim< codimension > :: EntityImpl EntityImpl;
public:
/** \name Host Types
* \{ */
//! type of corresponding host entity
typedef typename HostGrid::template Codim< codimension >::Entity HostEntity;
//! type of corresponding host entity pointer
typedef typename HostGrid::template Codim< codimension >::EntityPointer HostEntityPointer;
/** \} */
/** \name Construction, Initialization and Destruction
......@@ -137,6 +138,8 @@ namespace Dune
/** \brief return EntitySeed of host grid entity */
EntitySeed seed () const { return typename EntitySeed::Implementation( hostEntity().seed() ); }
bool equals( const EntityImpl& other ) const { return hostEntity() == other.hostEntity(); }
/** \} */
......@@ -238,8 +241,9 @@ namespace Dune
//! type of corresponding local geometry
typedef typename Traits::template Codim< codimension >::LocalGeometry LocalGeometry;
//! type of corresponding entity pointer
typedef typename Traits::template Codim< codimension >::EntityPointer EntityPointer;
//! type of Entity interface
typedef typename Traits ::template Codim< codimension >::Entity Entity;
//! type of hierarchic iterator
typedef typename Traits::HierarchicIterator HierarchicIterator;
......@@ -283,11 +287,11 @@ namespace Dune
}
template< int codim >
typename Grid::template Codim< codim >::EntityPointer
typename Grid::template Codim< codim >::Entity
subEntity ( int i ) const
{
typedef typename Traits::template Codim< codim >::EntityPointerImpl EntityPointerImpl;
return EntityPointerImpl( data(), hostEntity().template subEntity< codim >( i ) );
typedef typename Traits::template Codim< codim >::EntityImpl EntityImpl;
return EntityImpl( data(), hostEntity().template subEntity< codim >( i ) );
}
LevelIntersectionIterator ilevelbegin () const
......@@ -320,10 +324,10 @@ namespace Dune
return hostEntity().isLeaf();
}
EntityPointer father () const
Entity father () const
{
typedef typename Traits::template Codim< 0 >::EntityPointerImpl EntityPointerImpl;
return EntityPointerImpl( data(), hostEntity().father() );
typedef typename Traits::template Codim< 0 >::EntityImpl EntityImpl;
return EntityImpl( data(), hostEntity().father() );
}
bool hasFather () const
......
......@@ -30,15 +30,10 @@ namespace Dune
typedef typename Traits::template Codim< codimension >::Entity Entity;
protected:
typedef typename Traits::HostGrid::template Codim< codimension >::EntityPointer HostEntityPointer;
typedef typename Traits::ExtraData ExtraData;
typedef typename Traits::template Codim< codimension > :: EntityImpl EntityImpl;
private:
friend class IdGridEntityPointer< Grid, HostEntityPointer >;
public:
IdGridEntityPointer ( ExtraData data, const HostIterator &hostIterator )
: data_( data ),
......
#ifndef DUNE_IDGRID_GRID_HH
#define DUNE_IDGRID_GRID_HH
//- dune-common includes
#include <dune/common/nullptr.hh>
//- dune-grid includes
#include <dune/grid/common/grid.hh>
......@@ -54,7 +51,7 @@ namespace Dune
// type of data passed to entities, intersections, and iterators
// for IdGrid this is just an empty place holder
typedef EmptyData ExtraDataType;
typedef EmptyData ExtraData;
static const int dimension = HostGrid::dimension;
static const int dimensionworld = HostGrid::dimensionworld;
......@@ -80,8 +77,8 @@ namespace Dune
typedef Dune::Geometry< dimension-codim, dimensionworld, const Grid, IdGridGeometry > Geometry;
typedef Dune::Geometry< dimension-codim, dimension, const Grid, IdGridLocalGeometry > LocalGeometry;
typedef IdGridEntityPointer< const Grid, typename HostGrid::template Codim< codim >::EntityPointer > EntityPointerImpl;
typedef Dune::EntityPointer< const Grid, EntityPointerImpl > EntityPointer;
//typedef IdGridEntityPointer< const Grid, typename HostGrid::template Codim< codim >::EntityPointer > EntityPointerImpl;
//typedef Dune::EntityPointer< const Grid, EntityPointerImpl > EntityPointer;
typedef IdGridEntity< codim, dimension, const Grid > EntityImpl;
typedef Dune::Entity< codim, dimension, const Grid, IdGridEntity > Entity;
......@@ -112,12 +109,17 @@ namespace Dune
typedef typename HostGrid::Traits::CollectiveCommunication CollectiveCommunication;
/*
template< PartitionIteratorType pitype >
struct Partition
{
typedef Dune::GridView< IdGridViewTraits< typename HostGrid::template Partition< pitype >::LeafGridView, pitype > > LeafGridView;
typedef Dune::GridView< IdGridViewTraits< typename HostGrid::template Partition< pitype >::LevelGridView, pitype > > LevelGridView;
typedef Dune::GridView< IdGridViewTraits< typename HostGrid::Traits::template Partition< pitype >::LeafGridView, pitype > > LeafGridView;
typedef Dune::GridView< IdGridViewTraits< typename HostGrid::Traits::template Partition< pitype >::LevelGridView, pitype > > LevelGridView;
};
*/
typedef Dune::GridView< IdGridViewTraits< typename HostGrid::LeafGridView, All_Partition > > LeafGridView;
typedef Dune::GridView< IdGridViewTraits< typename HostGrid::LevelGridView, All_Partition > > LevelGridView;
};
};
......@@ -139,8 +141,7 @@ namespace Dune
/** \cond */
: public GridDefaultImplementation
< HostGrid::dimension, HostGrid::dimensionworld, typename HostGrid::ctype, IdGridFamily< HostGrid > >,
public IdGridExportParams< HostGrid >,
public IdGridBackupRestoreFacilities< IdGrid< HostGrid > >
public IdGridExportParams< HostGrid >
/** \endcond */
{
typedef IdGrid< HostGrid > Grid;
......@@ -195,16 +196,8 @@ namespace Dune
* \{ */
/** \brief Types for GridView */
template< PartitionIteratorType pitype >
struct Partition
{
typedef typename GridFamily::Traits::template Partition< pitype >::LevelGridView LevelGridView;
typedef typename GridFamily::Traits::template Partition< pitype >::LeafGridView LeafGridView;
};
/** \brief View types for All_Partition */
typedef typename Partition< All_Partition >::LevelGridView LevelGridView;
typedef typename Partition< All_Partition >::LeafGridView LeafGridView;
typedef typename Traits::LevelGridView LevelGridView;
typedef typename Traits::LeafGridView LeafGridView;
/** \} */
......@@ -692,24 +685,6 @@ namespace Dune
return gridChanged;
}
/** \brief View for a grid level */
template< PartitionIteratorType pitype >
typename Partition< pitype >::LevelGridView levelGridView ( int level ) const
{
typedef typename Partition< pitype >::LevelGridView View;
typedef typename View::GridViewImp ViewImp;
return View( ViewImp( *this, hostGrid().template levelGridView< pitype >( level ) ) );
}
/** \brief View for the leaf grid */
template< PartitionIteratorType pitype >
typename Partition< pitype >::LeafGridView leafGridView () const
{
typedef typename Traits::template Partition< pitype >::LeafGridView View;
typedef typename View::GridViewImp ViewImp;
return View( ViewImp( *this, hostGrid().template leafGridView< pitype >() ) );
}
/** \brief View for a grid level for All_Partition */
LevelGridView levelGridView ( int level ) const
{
......@@ -726,11 +701,11 @@ namespace Dune
/** \brief obtain EntityPointer from EntitySeed. */
template< class EntitySeed >
typename Traits::template Codim< EntitySeed::codimension >::EntityPointer
entityPointer ( const EntitySeed &seed ) const
typename Traits::template Codim< EntitySeed::codimension >::Entity
entity ( const EntitySeed &seed ) const
{
typedef typename Traits::template Codim< EntitySeed::codimension >::EntityPointerImpl EntityPointerImpl;
return EntityPointerImpl( extraData(), hostGrid().entityPointer( seed.impl().hostEntitySeed() ) );
typedef typename Traits::template Codim< EntitySeed::codimension >::EntityImpl EntityImpl;
return EntityImpl( extraData(), hostGrid().entity( seed.impl().hostEntitySeed() ) );
}
/** \} */
......@@ -774,7 +749,7 @@ namespace Dune
return getRealImplementation( entity ).hostEntity();
}
typedef typename Traits :: ExtraDataType ExtraData;
typedef typename Traits :: ExtraData ExtraData;
ExtraData extraData () const { return ExtraData(); }
protected:
......@@ -804,12 +779,6 @@ namespace Dune
*/
typedef typename Traits::template Codim< codim >::Entity Entity;
/** \brief type of entity pointer
*
* The entity pointer is a model of Dune::EntityPointer.
*/
typedef typename Traits::template Codim< codim >::EntityPointer EntityPointer;
/** \} */
/** \name Geometry Types
......
......@@ -189,8 +189,6 @@ namespace Dune
struct Codim
{
typedef typename Grid::Traits::template Codim< codim >::Entity Entity;
typedef typename Grid::Traits::template Codim< codim >::EntityPointer EntityPointer;
typedef typename Grid::template Codim< codim >::Geometry Geometry;
typedef typename Grid::template Codim< codim >::LocalGeometry LocalGeometry;
......
......@@ -20,19 +20,24 @@ namespace Dune
typedef typename remove_const< Grid >::type::Traits Traits;
typedef typename Traits :: ExtraData ExtraData ;
typedef typename Traits::template Codim< 0 >::EntityPointerImpl EntityPointerImpl;
public:
typedef typename Traits::ctype ctype;
static const int dimension = Traits::dimension;
static const int dimensionworld = Traits::dimensionworld;
typedef typename Traits::template Codim< 0 >::Entity Entity;
typedef typename Traits::template Codim< 0 >::EntityPointer EntityPointer;
typedef typename Traits::template Codim< 1 >::Geometry Geometry;
typedef typename Traits::template Codim< 1 >::LocalGeometry LocalGeometry;
typedef typename Traits::template Codim< 0 >::Entity Entity;
typedef typename Traits::template Codim< 0 >::EntityImpl EntityImpl;
typedef typename Traits::template Codim< 1 >::Geometry Geometry;
typedef typename Traits::template Codim< 1 >::LocalGeometry LocalGeometry;
public:
IdGridIntersection ()
: hostIntersection_( nullptr ),
data_()
{}
explicit IdGridIntersection ( ExtraData data )
: hostIntersection_( nullptr ),
data_( data )
......@@ -45,14 +50,20 @@ namespace Dune
operator bool () const { return bool( hostIntersection_ ); }
EntityPointer inside () const
template <class IntersectionImpl>
bool equals ( const IntersectionImpl& other ) const
{
return hostIntersection() == other.hostIntersection();
}
Entity inside () const
{
return EntityPointer( EntityPointerImpl( data(), hostIntersection().inside() ) );
return Entity( EntityImpl( data(), hostIntersection().inside() ) );
}
EntityPointer outside () const
Entity outside () const
{
return EntityPointer( EntityPointerImpl( data(), hostIntersection().outside() ) );
return Entity( EntityImpl( data(), hostIntersection().outside() ) );
}
bool boundary () const { return hostIntersection().boundary(); }
......
......@@ -29,7 +29,10 @@ namespace Dune
typedef typename Traits :: ExtraData ExtraData;
typedef typename Grid::template Codim< 0 >::EntityPointer EntityPointer;
IdGridIntersectionIterator ()
: intersection_(),
hostIterator_()
{}
IdGridIntersectionIterator ( ExtraData data, const HostIntersectionIterator &hostIterator )
: intersection_( IntersectionImpl( data ) ),
......
set(GRIDTYPE SGRID)
set(GRIDTYPE YASPGRID)
set(GRIDDIM 3)
set(WORLDDIM ${GRIDDIM})
......
......@@ -11,8 +11,6 @@
#include <dune/grid/test/checkintersectionit.hh>
#include <dune/grid/test/checkcommunicate.hh>
#include <dune/grid/io/visual/grapegriddisplay.hh>
using namespace Dune;
template <class GridType>
......@@ -55,12 +53,6 @@ void writeFile( const GridView& gridView )
template <class GridType>
void checkSerial(GridType & grid, int mxl = 2, const bool display = false)
{
if( display )
{
GrapeGridDisplay< GridType > grape( grid );
grape.display();
}
// be careful, each global refine create 8 x maxlevel elements
std::cout << " CHECKING: Macro" << std::endl;
gridcheck(grid);
......@@ -74,23 +66,11 @@ void checkSerial(GridType & grid, int mxl = 2, const bool display = false)
gridcheck(grid);
std::cout << " CHECKING: intersections" << std::endl;
checkIntersectionIterator(grid);
if( display )
{
GrapeGridDisplay< GridType > grape( grid );
grape.display();
}
}
// check also non-conform grids
makeNonConfGrid(grid,0,1);
if( display )
{
GrapeGridDisplay< GridType > grape( grid );
grape.display();
}
std::cout << " CHECKING: non-conform" << std::endl;
gridcheck(grid);
std::cout << " CHECKING: twists " << std::endl;
......@@ -108,12 +88,6 @@ void checkSerial(GridType & grid, int mxl = 2, const bool display = false)
template <class GridType>
void checkParallel(GridType & grid, int gref, int mxl = 3, const bool display = false )
{
if( display )
{
GrapeGridDisplay< GridType > grape( grid );
grape.display();
}
#if HAVE_MPI
makeNonConfGrid(grid,gref,mxl);
......
......@@ -9,8 +9,6 @@
#include <dune/grid/idgrid.hh>
#include <dune/grid/io/file/dgfparser/dgfwriter.hh>
#include <dune/grid/io/visual/grapegriddisplay.hh>
using namespace Dune;
#include "checkcalls.cc"
......
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