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

bugfix

[[Imported from SVN: r4486]]
parent 9657db46
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,10 @@ namespace Dune {
this->realGeometry.target_ = target;
}
void setPosition(double p) {
this->realGeometry.storeCoordsLocally_ = true;
this->realGeometry.pos_[0] = p;
}
};
template<class GridImp>
......@@ -48,45 +52,6 @@ namespace Dune {
template <int codim, int dim, class GridImp>
class OneDGridEntity;
/****************************************************************/
/* Specialization for faces in a 1d grid (i.e. vertices) */
/****************************************************************/
/** \brief Special implementation of the vertex geometry class directly holding the vertex position
This vertex geometry class directly holds the vertex position instead of a pointer to an
implementation class. Therefore it can store vertices that don't actually exist in the
current grid. This is necessary for methods like
OneDGridIntersectionIterator::intersectionSelfLocal()
\todo This class can maybe completely replace the other one
*/
template<class GridImp>
class OneDGridVertex :
public Geometry<0, 1, GridImp, OneDGridGeometry>
{
public:
OneDGridVertex() :
Geometry<0, 1, GridImp, OneDGridGeometry>(OneDGridGeometry<0, 1, GridImp>())
{};
//! return the element type identifier (vertex)
GeometryType type () const {return GeometryType(GeometryType::cube,0);}
//! return the number of corners of this element (==1)
int corners () const {return 1;}
//! access to coordinates of corners. Index is the number of the corner
const FieldVector<typename GridImp::ctype, 1>& operator[] (int i) const {
return pos_;
}
//private:
FieldVector<typename GridImp::ctype, 1> pos_;
};
template<class GridImp>
class OneDGridGeometry <0, 1, GridImp> :
......@@ -100,6 +65,8 @@ namespace Dune {
public:
OneDGridGeometry() : storeCoordsLocally_(false) {}
//! return the element type identifier (vertex)
GeometryType type () const {return GeometryType(0);}
......@@ -108,13 +75,13 @@ namespace Dune {
//! access to coordinates of corners. Index is the number of the corner
const FieldVector<typename GridImp::ctype, 1>& operator[] (int i) const {
return target_->pos_;
return (storeCoordsLocally_) ? pos_ : target_->pos_;
}
/** \brief Maps a local coordinate within reference element to
* global coordinate in element */
FieldVector<typename GridImp::ctype, 1> global (const FieldVector<typename GridImp::ctype, 0>& local) const {
return target_->pos_;
return (storeCoordsLocally_) ? pos_ : target_->pos_;
}
/** \brief Maps a global coordinate within the element to a
......@@ -149,6 +116,11 @@ namespace Dune {
}
//private:
bool storeCoordsLocally_;
// Stores the element corner positions if it is returned as geometryInFather
FieldVector<typename GridImp::ctype,1> pos_;
OneDEntityImp<0>* target_;
FieldMatrix<typename GridImp::ctype,0,0> jacInverse_;
......
......@@ -150,14 +150,14 @@ namespace Dune {
//! Here returned element is in LOCAL coordinates of the element
//! where iteration started.
const LocalGeometry& intersectionSelfLocal () const {
intersectionSelfLocal_.pos_ = (numberInSelf() == 0) ? 0 : 1;
intersectionSelfLocal_.setPosition( (numberInSelf() == 0) ? 0 : 1 );
return intersectionSelfLocal_;
}
//! intersection of codimension 1 of this neighbor with element where iteration started.
//! Here returned element is in LOCAL coordinates of neighbor
const LocalGeometry& intersectionNeighborLocal () const {
intersectionNeighborLocal_.pos_ = (numberInSelf() == 0) ? 1 : 0;
intersectionNeighborLocal_.setPosition( (numberInSelf() == 0) ? 1 : 0 );
return intersectionNeighborLocal_;
}
......@@ -213,18 +213,12 @@ namespace Dune {
int neighbor_;
/** \brief The geometry that's being returned when intersectionSelfLocal() is called
\todo This one is returned either with coordinate 1 or zero. Can't we make two
static instances of this class and return those instead of carrying them around
in the iterator?
*/
mutable OneDGridVertex<GridImp> intersectionSelfLocal_;
mutable OneDMakeableGeometry<0,1,GridImp> intersectionSelfLocal_;
/** \brief The geometry that's being returned when intersectionSelfLocal() is called
\todo This one is returned either with coordinate 1 or zero. Can't we make two
static instances of this class and return those instead of carrying them around
in the iterator?
*/
mutable OneDGridVertex<GridImp> intersectionNeighborLocal_;
mutable OneDMakeableGeometry<0,1,GridImp> intersectionNeighborLocal_;
//! The geometry that's being returned when intersectionSelfGlobal() is called
mutable OneDMakeableGeometry<dim-1,dimworld,GridImp> intersectionGlobal_;
......
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