From b6f6efe3db79fb084077d44cc7b193612759534b Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@dune-project.org> Date: Thu, 3 Feb 2005 09:43:17 +0000 Subject: [PATCH] passes the 2d test [[Imported from SVN: r1436]] --- grid/uggrid/ugfunctions.hh | 16 ++++++ grid/uggrid/uggridelement.hh | 4 +- grid/uggrid/uggridentity.cc | 79 ++++++++++++------------------ grid/uggrid/uggridleveliterator.hh | 2 +- 4 files changed, 52 insertions(+), 49 deletions(-) diff --git a/grid/uggrid/ugfunctions.hh b/grid/uggrid/ugfunctions.hh index b162950cb..76253d2a3 100644 --- a/grid/uggrid/ugfunctions.hh +++ b/grid/uggrid/ugfunctions.hh @@ -157,6 +157,22 @@ namespace Dune { return theNode->succ; } + //! Gets the index of a UG element + static int index(const typename TargetType<0,dim>::T* theElement) { + return theElement->ge.id; + } + + //! Gets the index of a UG node + static int index(const typename TargetType<dim,dim>::T* theNode) { + return theNode->myvertex->iv.id; + } + + //! Calm the compiler + static int index(const void* theWhatever) { + DUNE_THROW(NotImplemented, "No index available for this kind of object"); + return 0; + } + //! \todo Please doc me! static void Local_To_Global(int n, DOUBLE** y, const FieldVector<double, dim>& local, diff --git a/grid/uggrid/uggridelement.hh b/grid/uggrid/uggridelement.hh index c30248c22..76c816104 100644 --- a/grid/uggrid/uggridelement.hh +++ b/grid/uggrid/uggridelement.hh @@ -278,7 +278,9 @@ namespace Dune { //! Maps a global coordinate within the element to a //! local coordinate in its reference element - FieldVector<UGCtype, 1> local (const FieldVector<UGCtype, 2>& global) const; + FieldVector<UGCtype, 1> local (const FieldVector<UGCtype, 2>& global) const { + DUNE_THROW(NotImplemented, "local not implemented yet!"); + } //! Returns true if the point is in the current element /** \todo Not implemented yet! */ diff --git a/grid/uggrid/uggridentity.cc b/grid/uggrid/uggridentity.cc index a7e485f4d..46132fb17 100644 --- a/grid/uggrid/uggridentity.cc +++ b/grid/uggrid/uggridentity.cc @@ -50,27 +50,9 @@ template<int codim, int dim, class GridImp> inline int UGGridEntity < codim, dim ,GridImp>:: index() const { - std::cerr << "UGGridEntity <" << codim << ", " << dim - << ">::index() not implemented!\n"; - return -1; + return UG_NS<dim>::index(target_); } -#ifdef _3 -template<class GridImp> -inline int UGGridEntity < 3, 3 ,GridImp>:: -index() -{ - return target_->myvertex->iv.id; -} - -template<> -inline int UGGridEntity < 0, 3 ,3 >:: -index() -{ - return target_->ge.id; -} -#endif - #ifdef _2 #if 0 template<class GridImp> @@ -99,34 +81,6 @@ geometry() const -//************************************ -// -// --UGGridEntity codim = 0 -// --Entity codim = 0 -// -//************************************ -template< int dim, class GridImp> -inline bool UGGridEntity < 0, dim ,GridImp>:: -mark( int refCount ) -{ -#ifdef _3 - if (!UG3d::EstimateHere(target_)) - return false; - - return UG3d::MarkForRefinement(target_, - UG3d::RED, - 0); // no user data -#else - if (!UG2d::EstimateHere(target_)) - return false; - - return UG2d::MarkForRefinement(target_, - UG2d::RED, // red refinement rule - 0); // no user data -#endif -} - - //*****************************************************************8 // count @@ -175,6 +129,37 @@ inline AdaptationState UGGridEntity < 0, dim ,GridImp >::state() const std::cerr << "UGGridEntity::state() not yet implemented!\n"; return NONE; } + +template<int dim, class GridImp> +inline int UGGridEntity < 0, dim ,GridImp>:: +index() const +{ + return UG_NS<dim>::index(target_); +} + + +template< int dim, class GridImp> +inline bool UGGridEntity < 0, dim ,GridImp>:: +mark( int refCount ) +{ +#ifdef _3 + if (!UG3d::EstimateHere(target_)) + return false; + + return UG3d::MarkForRefinement(target_, + UG3d::RED, + 0); // no user data +#else + if (!UG2d::EstimateHere(target_)) + return false; + + return UG2d::MarkForRefinement(target_, + UG2d::RED, // red refinement rule + 0); // no user data +#endif +} + + //*****************************************************************8 // count template <int dim, class GridImp> diff --git a/grid/uggrid/uggridleveliterator.hh b/grid/uggrid/uggridleveliterator.hh index bbc7525b4..5d5d11327 100644 --- a/grid/uggrid/uggridleveliterator.hh +++ b/grid/uggrid/uggridleveliterator.hh @@ -82,7 +82,7 @@ namespace Dune { } // private Members - mutable UGMakeableEntity<0,GridImp::dimension,GridImp> virtualEntity_; + mutable UGMakeableEntity<codim,GridImp::dimension,GridImp> virtualEntity_; //! element number int elNum_; -- GitLab