Skip to content
Snippets Groups Projects
Commit 66715966 authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

Some fixed. Intersection Interator now works.

Adaption works. Boundary id's implemented.
The BuckleyLeverett problem now works adaptive.

[[Imported from SVN: r977]]
parent fa6b7478
No related branches found
No related tags found
No related merge requests found
......@@ -306,6 +306,9 @@ namespace Dune
//! geometry of this entity
BSGridElement<dim,dimworld>& geometry ();
//! return partition type of this entity ( see grid.hh )
PartitionType partitionType() const;
/*! Intra-element access to entities of codimension cc > codim. Return number of entities
with codimension cc.
*/
......@@ -381,7 +384,7 @@ namespace Dune
private:
BSGrid<dim,dimworld> &grid_;
BSSPACE HElementType *item_;
BSSPACE GEOElementType *item_;
//! the cuurent geometry
BSGridElement<dim,dimworld> geo_;
......@@ -455,15 +458,9 @@ namespace Dune
friend class BSGridIntersectionIterator<dim,dimworld>;
public:
BSGridBoundaryEntity () : _geom (false) ,
_neigh (-1) {};
_neigh (-1), _id(-1) {};
//! return type of boundary , i.e. Neumann, Dirichlet ...
BoundaryType type ()
{
return Dirichlet ;
}
int id () { return -1; }
int id () { return _id; }
//! return true if geometry of ghost cells was filled
bool hasGeometry () { return false; }
......@@ -475,8 +472,13 @@ namespace Dune
}
private:
int _neigh;
void setId ( int id )
{
_id = id;
}
int _neigh;
int _id;
// BSGrid<dim,dimworld> & _grid;
BSGridElement<dim,dimworld> _geom;
};
......@@ -609,6 +611,8 @@ namespace Dune
BSSPACE NeighbourFaceType neighpair_;
BSGridElement<dim-1,dimworld> interSelfGlobal_; //! intersection_self_global
BSGridBoundaryEntity<dim,dimworld> bndEntity_;
};
......@@ -697,27 +701,21 @@ namespace Dune
CompileTimeChecker<dimworld == 3> BSGrid_only_implemented_for_3dw;
friend class BSGridEntity <0,dim,dimworld>;
friend class BSGridIntersectionIterator<dim,dimworld>;
#if 0
//friend class BSGridEntity <1,dim,dimworld>;
//friend class BSGridEntity <1 << dim-1 ,dim,dimworld>;
friend class BSGridEntity <dim,dim,dimworld>;
friend class BaumMarkerVector;
// friends because of fillElInfo
friend class BSGridLevelIterator<0,dim,dimworld>;
friend class BSGridLevelIterator<1,dim,dimworld>;
friend class BSGridLevelIterator<2,dim,dimworld>;
friend class BSGridLevelIterator<3,dim,dimworld>;
friend class BSGridHierarchicIterator<dim,dimworld>;
friend class BSGridIntersectionIterator<dim,dimworld>;
#endif
//! BSGrid is only implemented for 2 and 3 dimension
//! for 1d use SGrid or SimpleGrid
//CompileTimeChecker<dimworld != 1> Do_not_use_BSGrid_for_1d_Grids;
//**********************************************************
// The Interface Methods
//**********************************************************
......@@ -815,6 +813,9 @@ namespace Dune
//! not an interface method yet
bs_ctype getTime () const { return time_; };
//! calculate max edge length
double calcGridWidth () { return 1; }
BSSPACE GitterBasisImpl *mygrid();
private:
......
......@@ -16,6 +16,7 @@ namespace Dune {
assert(mygrid_ != 0);
mygrid_->printsize();
postAdapt();
calcExtras();
}
......@@ -379,6 +380,7 @@ namespace Dune {
assert(index_ >= 0);
iter_.next();
index_++;
if (iter_.done())
{
index_ = -1;
......@@ -625,7 +627,8 @@ namespace Dune {
inline BSGridIntersectionIterator<dim,dimworld> ::
BSGridIntersectionIterator(BSGrid<dim,dimworld> &grid,
BSSPACE HElementType *el, int wLevel,bool end) :
entity_( grid ), item_(0), neigh_(0), index_(0)
entity_( grid )
, item_(0), neigh_(0), index_(0)
, needSetup_ (true), needNormal_(true)
, interSelfGlobal_ (false)
, theSituation_ (false) , daOtherSituation_ (false)
......@@ -640,6 +643,7 @@ namespace Dune {
done();
}
}
template<int dim, int dimworld>
inline void BSGridIntersectionIterator<dim,dimworld> ::
first (BSSPACE HElementType & elem, int wLevel)
......@@ -652,7 +656,6 @@ namespace Dune {
// if needed more than once we spare the virtual funtion call
isBoundary_ = item_->myneighbour(index_).first->isboundary();
theSituation_ = ( (elem.level() < wLevel ) && elem.leaf() );
daOtherSituation_ = false;
......@@ -829,6 +832,7 @@ namespace Dune {
{
if( boundary() || ( !daOtherSituation_ ) )
{
// if boundary calc normal normal ;)
item_->outerNormal(index_,outNormal_);
}
else
......@@ -862,12 +866,22 @@ namespace Dune {
inline BSGridElement<dim-1,dimworld>&
BSGridIntersectionIterator<dim,dimworld>::intersection_self_global ()
{
const BSSPACE Gitter::Geometric::hface3_GEO & face = *(static_cast<BSSPACE GEOElementType &>(*item_).myhface3(index_));
const BSSPACE Gitter::Geometric::hface3_GEO & face = *(item_->myhface3(index_));
bool init = interSelfGlobal_.builtGeom(face);
return interSelfGlobal_;
}
template< int dim, int dimworld>
inline BSGridBoundaryEntity<dim,dimworld>&
BSGridIntersectionIterator<dim,dimworld>::boundaryEntity ()
{
typename BSSPACE BNDFaceType * bnd = item_->myneighbour(index_).first;
int id = bnd->bndtype(); // id's are positive
bndEntity_.setId( -id );
return bndEntity_;
}
/************************************************************************************
###### # # ##### # ##### # #
# ## # # # # # #
......@@ -880,7 +894,7 @@ namespace Dune {
template<int dim, int dimworld>
inline BSGridEntity<0,dim,dimworld> :: BSGridEntity(BSGrid<dim,dimworld> &grid,
BSSPACE HElementType & element,int index, int wLevel) :
grid_(grid), item_(&element)
grid_(grid), item_(static_cast<BSSPACE GEOElementType *> (&element))
, builtgeometry_(false), geo_(false)
, index_(index) , walkLevel_ (wLevel)
{}
......@@ -929,10 +943,17 @@ namespace Dune {
{
assert(cc == dim);
assert(item_ != 0);
return IndexWrapper<cc>::subIndex (
( static_cast<BSSPACE GEOElementType &> (*item_)) ,i);
return IndexWrapper<cc>::subIndex ( *item_ ,i);
}
template<int dim, int dimworld>
inline PartitionType BSGridEntity<0,dim,dimworld> ::
partitionType () const
{
return InteriorEntity;
}
template<int dim, int dimworld>
inline bool BSGridEntity<0,dim,dimworld> :: hasChildren()
{
......@@ -1013,13 +1034,11 @@ namespace Dune {
if(ref < 0)
{
if(level() <= 0) return false;
if(static_cast<BSSPACE GEOElementType &>
(*item_).requestrule() == BSSPACE refine_element_t)
if((*item_).requestrule() == BSSPACE refine_element_t)
{
return false;
}
static_cast<BSSPACE GEOElementType &>
(*item_).request( BSSPACE coarse_element_t );
grid_.setCoarsenMark();
return true;
......@@ -1027,7 +1046,6 @@ namespace Dune {
if(ref > 0)
{
static_cast<BSSPACE GEOElementType &>
(*item_).request( BSSPACE refine_element_t );
return true;
}
......@@ -1038,16 +1056,13 @@ namespace Dune {
template<int dim, int dimworld>
inline AdaptationState BSGridEntity<0,dim,dimworld> :: state () const
{
if(static_cast<BSSPACE GEOElementType &>
(*item_).requestrule() == BSSPACE coarse_element_t)
if((*item_).requestrule() == BSSPACE coarse_element_t)
{
//std::cout << "return COARSEND \n";
return COARSEN;
}
if(item_->hasBeenRefined())
{
//std::cout << "return REFINED\n";
return REFINED;
}
......
......@@ -51,6 +51,8 @@ namespace BernhardSchuppGrid {
typedef Gitter::Geometric::tetra_GEO GEOElementType; // real Element
typedef Gitter::Geometric::hasFace3 HasFace3Type; // has Face with 3 polygons
typedef Gitter::Geometric::hbndseg3_GEO BNDFaceType;
// refinement and coarsening enum for tetrahedons
enum { refine_element_t = Gitter::Geometric::TetraRule::iso8 };
enum { coarse_element_t = Gitter::Geometric::TetraRule::crs };
......
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