Skip to content
Snippets Groups Projects
Commit 45e03847 authored by Adrian Burri's avatar Adrian Burri
Browse files

New utility classes

[[Imported from SVN: r3717]]
parent 26f4e16d
Branches
Tags
No related merge requests found
# $Id$
gridutilitydir = $(includedir)/dune/grid/utility
gridutility_HEADERS = twistutility.hh
include $(top_srcdir)/am/global-rules
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_STRUCTUREUTILITY_HH
#define DUNE_STRUCTUREUTILITY_HH
//#include <dune/grid/yaspgrid.hh>
#include <dune/grid/sgrid.hh>
namespace Dune {
template <class GridImp>
struct IsUnstructured {
static const bool value;
};
template <class GridImp>
const bool IsUnstructured<GridImp>::value = true;
template <int dim, int dimw>
struct IsUnstructured<SGrid<dim, dimw> > {
static const bool value;
};
template <int dim, int dimw>
const bool IsUnstructured<SGrid<dim, dimw> >::value = false;
/*
template <int dim, int dimw>
struct IsUnstructured<YaspGrid<dim, dimw> > {
static const bool value = false;
};
*/
template <class GridImp>
struct OneGeometryType {
static const bool value;
};
template <class GridImp>
const bool OneGeometryType<GridImp>::value = true;
/*
template <int dim, int dimw>
struct OneGeometryType<UGGrid<dim, dimw> > {
static const bool value = false;
};
*/
} // end namespace Dune
#endif
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_TWISTUTILITY_HH
#define DUNE_TWISTUTILITY_HH
#include <dune/grid/alu3dgrid.hh>
#include <dune/grid/albertagrid.hh>
#include <dune/grid/sgrid.hh>
namespace Dune {
// for structured grids, the twist is always zero
// ? is this correct
template <class GridImp>
class TwistUtility
{
public:
typedef GridImp GridType;
typedef typename GridImp::Traits::IntersectionIterator IntersectionIterator;
public:
TwistUtility(const GridType& grid) :
grid_(grid)
{}
int twistInSelf(IntersectionIterator& it) const {
//DUNE_THROW(NotImplemented, "Hey, implement it yourself if you need it!");
return 0;
}
int twistInNeighbor(IntersectionIterator& it) const {
//DUNE_THROW(NotImplemented, "Hey, implement it yourself if you need it!");
return 0;
}
private:
const GridType& grid_;
};
template <int dim, int dimW>
class TwistUtility<AlbertaGrid<dim, dimW> >
{
public:
typedef AlbertaGrid<dim, dimW> GridType;
typedef typename GridType::Traits::IntersectionIterator IntersectionIterator;
public:
TwistUtility(const GridType& grid) :
grid_(grid)
{}
int twistInSelf(IntersectionIterator& it) const {
DUNE_THROW(NotImplemented, "Hey, implement it yourself if you need it!");
return 0;
}
int twistInNeighbor(IntersectionIterator& it) const {
DUNE_THROW(NotImplemented, "Hey, implement it yourself if you need it!");
return 0;
}
private:
const GridType& grid_;
};
template <int dim, int dimW, ALU3dGridElementType elType>
class TwistUtility<ALU3dGrid<dim, dimW, elType> >
{
public:
typedef ALU3dGrid<dim, dimW, elType> GridType;
typedef typename GridType::Traits::IntersectionIterator IntersectionIterator;
public:
TwistUtility(const GridType& grid) :
grid_(grid)
{}
int twistInSelf(const IntersectionIterator& it) const {
return grid_.getRealIntersectionIterator(it).twistInSelf();
}
int twistInNeighbor(const IntersectionIterator& it) const {
return grid_.getRealIntersectionIterator(it).twistInNeighbor();
}
private:
TwistUtility(const TwistUtility&);
TwistUtility& operator=(const TwistUtility&);
private:
const GridType& grid_;
};
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment