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

introducing method PFirstNode for iterating through the grids nodes even in a parallel grid

[[Imported from SVN: r1373]]
parent 241a5177
No related branches found
No related tags found
No related merge requests found
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef __DUNE_UG_FUNCTIONS_HH__
#define __DUNE_UG_FUNCTIONS_HH__
#ifndef DUNE_UG_FUNCTIONS_HH
#define DUNE_UG_FUNCTIONS_HH
/** \file
* \brief Encapsulates some UG macros and functions
......@@ -10,11 +10,33 @@
#include "ugtypes.hh"
namespace Dune {
//! \todo Please doc me!
/** \brief Encapsulates a few UG methods and macros
*
* This class provides a wrapper to several methods and macros from
* UG. There are two reasons for doing this. First, we don't want
* to call UG macros directly from DUNE, because they pollute the
* namespace and therefore we undefine them all. Secondly, UG methods
* appear in the namespaces UG2d and UG3d, but we need the dimension
* as a template parameter.
*/
template<int dim>
class UG_NS {
public:
/** \brief The PFIRSTNODE macros which returns the first node in a
* grid even in a parallel setting.
*/
static typename TargetType<dim,dim>::T* PFirstNode(typename UGTypes<dim>::GridType* grid) {
using UG::PrioHGhost;
using UG::PrioVGhost;
using UG::PrioVHGhost;
using UG::PrioMaster;
using UG::PrioBorder;
return PFIRSTNODE(grid);
}
/** \brief Returns pointers to the coordinate arrays of an UG element */
static void Corner_Coordinates(typename TargetType<0,dim>::T* theElement, double* x[]) {
......@@ -199,12 +221,7 @@ namespace Dune {
};
//! \todo Please doc me!
template <int codim, int dimworld>
class UGGridSubEntityFactory {
// public:
// static TargetType<codim,dimworld>::T* get(TargetType<codim,dimworld>::T* c, int i){
// DUNE_THROW(GridError, "UGGridSubEnt");
// }
};
class UGGridSubEntityFactory {};
#ifdef _2
template<>
......
......@@ -37,7 +37,7 @@ public:
UGGridLevelIterator<2,2,2,All_Partition> getIterator(UGTypes<2>::GridType* theGrid, int level) {
UGGridLevelIterator<2,2,2,All_Partition> it(level);
it.setToTarget(theGrid->firstNode[0], level);
it.setToTarget(UG_NS<2>::PFirstNode(theGrid), level);
return it;
}
......@@ -67,7 +67,7 @@ public:
UGGridLevelIterator<2,2,2,PiType> getIterator(UGTypes<2>::GridType* theGrid, int level) {
std::cout << "Simulating a parallel LevelIterator using a sequential one!" << std::endl;
UGGridLevelIterator<2,2,2,PiType> it(level);
it.setToTarget(theGrid->firstNode[0], level);
it.setToTarget(UG_NS<2>(theGrid), level);
return it;
}
......@@ -100,8 +100,7 @@ public:
UGGridLevelIterator<3,3,3,All_Partition> it(level);
UG3d::node* mytarget = theGrid->firstNode[0];
it.setToTarget(mytarget, level);
it.setToTarget(UG_NS<3>::PFirstNode(theGrid), level);
return it;
}
};
......
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