Skip to content
Snippets Groups Projects
Commit 6665e13b authored by Peter Bastian's avatar Peter Bastian
Browse files

Two new functions to ask for level of an element and coordinates of corners

in local coordinates.

[[Imported from SVN: r2971]]
parent ebade644
Branches
Tags
No related merge requests found
......@@ -118,6 +118,11 @@ namespace Dune {
return UG2d::UG_GlobalToLocal(n, cornerCoords, EvalPoint, localCoord);
}
static int myLevel (TargetType<0,2>::T* theElement) {
using UG2d::ELEMENT;
return LEVEL(theElement);
}
//! \todo Please doc me!
static int Sides_Of_Elem(TargetType<0,2>::T* theElement) {
using UG2d::element_descriptors;
......@@ -197,6 +202,15 @@ namespace Dune {
return 0;
}
//! get corner in local coordinates, corner number in UG's numbering system
template<class T>
static void getCornerLocal (const TargetType<0,2>::T* theElement, int corner, FieldVector<T, 2>& local)
{
using UG2d::element_descriptors;
local[0] = LOCAL_COORD_OF_TAG(TAG(theElement),corner)[0];
local[1] = LOCAL_COORD_OF_TAG(TAG(theElement),corner)[1];
}
//! Next element in the UG element lists
static TargetType<0,2>::T* succ(const TargetType<0,2>::T* theElement) {
return theElement->ge.succ;
......@@ -243,11 +257,13 @@ namespace Dune {
//! Gets the level index of a UG sidevector
static int& levelIndex(UGVectorType<2>::T* theVector) {
DUNE_THROW(GridError, "levelIndex in side vector only in 3D!");
return reinterpret_cast<int&>(theVector->index);
}
//! Gets the level index of a UG sidevector
static const int& levelIndex(const UGVectorType<2>::T* theVector) {
DUNE_THROW(GridError, "levelIndex in side vector only in 3D!");
return reinterpret_cast<const int&>(theVector->index);
}
......@@ -285,12 +301,12 @@ namespace Dune {
return theElement->ge.leafIndex;
}
//! Gets the level index of a UG sidevector
//! Gets the leaf index of a UG sidevector
static int& leafIndex(UGVectorType<2>::T* theVector) {
return reinterpret_cast<int &>(theVector->skip);
}
//! Gets the level index of a UG sidevector
//! Gets the leaf index of a UG sidevector
static const int& leafIndex(const UGVectorType<2>::T* theVector) {
return reinterpret_cast<const int &>(theVector->skip);
}
......@@ -374,6 +390,7 @@ namespace Dune {
//! access side vector from element (this is just a dummy to compile code also in 2d)
static UGVectorType<2>::T* SideVector (TargetType<0,2>::T* theElement, int i)
{
DUNE_THROW(GridError, "side vector only in 3D!");
return NULL;
}
......
......@@ -173,6 +173,11 @@ namespace Dune {
return UG3d::ReadCW(element, UG3d::NSONS_CE);
}
static int myLevel (TargetType<0,3>::T* theElement) {
using UG3d::ELEMENT;
return LEVEL(theElement);
}
static int GetSons(const UG3d::element* element, UG3d::element* sonList[MAX_SONS]) {
return UG3d::GetSons(element, sonList);
}
......@@ -199,6 +204,16 @@ namespace Dune {
return 0;
}
//! get corner in local coordinates, corner number in UG's numbering system
template<class T>
static void getCornerLocal (const TargetType<0,3>::T* theElement, int corner, FieldVector<T, 3>& local)
{
using UG2d::element_descriptors;
local[0] = LOCAL_COORD_OF_TAG(TAG(theElement),corner)[0];
local[1] = LOCAL_COORD_OF_TAG(TAG(theElement),corner)[1];
local[2] = LOCAL_COORD_OF_TAG(TAG(theElement),corner)[2];
}
//! Next element in the UG element lists
static TargetType<0,3>::T* succ(const TargetType<0,3>::T* theElement) {
return theElement->ge.succ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment