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

implemented checkInside() and removed a few obsolete member variables

[[Imported from SVN: r1789]]
parent 0b2ad995
No related branches found
No related tags found
No related merge requests found
......@@ -147,6 +147,58 @@ operator [](int i) const
return coord_[i];
}
template<int mydim, int coorddim, class GridImp>
inline bool UGGridGeometry<mydim,coorddim,GridImp>::
checkInside(const FieldVector<UGCtype, coorddim> &global) const
{
FieldVector<UGCtype, mydim> loc = local(global);
switch (mydim) {
case 0 : // vertex
return false;
case 1 : // line
return 0 <= loc[0] && loc[0] <= 1;
case 2 :
#ifdef _2
switch (UG_NS<coorddim>::Tag(target_)) {
case UG2d::TRIANGLE :
return 0 <= loc[0] && 0 <= loc[1] && (loc[0]+loc[1])<=1;
case UG2d::QUADRILATERAL :
return 0 <= loc[0] && loc[0] <= 1
&& 0 <= loc[1] && loc[1] <= 1;
default :
DUNE_THROW(GridError, "UGGridGeometry::checkInside(): ERROR: Unknown type "
<< UG_NS<coorddim>::Tag(target_) << " found!");
}
#endif
case 3 :
switch (UG_NS<coorddim>::Tag(target_)) {
#ifdef _3
case UG3d::TETRAHEDRON :
return 0 <= loc[0] && 0 <= loc[1] && 0 <= loc[2]
&& (loc[0]+loc[1]+loc[2]) <= 1;
case UG3d::PYRAMID :
return 0 <= loc[0] && 0 <= loc[1] && 0 <= loc[2]
&& (loc[0]+loc[2]) <= 1
&& (loc[1]+loc[2]) <= 1;
case UG3d::PRISM :
return 0 <= loc[0] && 0 <= loc[1]
&& (loc[0]+loc[1])<=1
&& 0 <= loc[2] && loc[2] <= 1;
case UG3d::HEXAHEDRON :
return 0 <= loc[0] && loc[0] <= 1
&& 0 <= loc[1] && loc[1] <= 1
&& 0 <= loc[2] && loc[2] <= 1;
default :
DUNE_THROW(GridError, "UGGridGeometry::checkInside(): ERROR: Unknown type "
<< UG_NS<coorddim>::Tag(target_) << " found!");
#endif
}
}
}
template< int mydim, int coorddim, class GridImp>
inline FieldVector<UGCtype, coorddim> UGGridGeometry<mydim,coorddim,GridImp>::
......
......@@ -128,11 +128,7 @@ namespace Dune {
FieldVector<UGCtype, mydim> local (const FieldVector<UGCtype, coorddim>& global) const;
//! Returns true if the point is in the current element
/** \todo Not implemented yet! */
bool checkInside(const FieldVector<UGCtype, coorddim> &global) const {
DUNE_THROW(GridError, "UGGridGeometry::checkInside() not implemented yet!");
return true;
}
bool checkInside(const FieldVector<UGCtype, coorddim> &global) const;
/**
Integration over a general element is done by integrating over the reference element
......@@ -171,12 +167,6 @@ namespace Dune {
//! The jacobian inverse
mutable FieldMatrix<UGCtype,coorddim,coorddim> jac_inverse_;
//! storage for global coords
FieldVector<UGCtype, coorddim> globalCoord_;
//! storage for local coords
FieldVector<UGCtype, mydim> localCoord_;
typename TargetType<coorddim-mydim,coorddim>::T* target_;
};
......@@ -260,12 +250,6 @@ namespace Dune {
//! The jacobian inverse
mutable FieldMatrix<UGCtype,3,3> jac_inverse_;
//! storage for global coords
FieldVector<UGCtype, 4> globalCoord_;
//! storage for local coords
FieldVector<UGCtype, 2> localCoord_;
};
......
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