[Dune] Grid Interface Design
Peter Bastian
Peter.Bastian at iwr.uni-heidelberg.de
Thu Feb 20 16:37:23 CET 2003
Hallo,
leider haeb ich heute morgen das falsche Hauptprogramm
eingebunden. Hier ist die richtige Fassung:
#include<iostream>
using namespace std;
#include"grid.hh"
#include"sgrid.hh"
template<class Engine, int codim>
void bar (LevelIterator<Engine,codim>& i)
{
}
template<class Engine>
void foo (Grid<Engine>& g)
{
// loop over elements of codim 1 of level 1
for (typename LevelIterator<Engine,1>::Engine i = g.lbegin<1>(1);
i!=g.lend<1>(1); i++)
{
cout << i->level();
bar(i);
}
// make element of codim 0
Element<Engine,0> e;
}
int main ()
{
// make object of concrete class
SGrid<1> sgrid(1.0,2,2);
// call generic function
foo(sgrid);
// test generic cube grid mapper
Tupel<int,2> N;
N[0] = 4; N[1] = 3; // N[2] = 10; N[3] = 10;
CubeMapper<2> cm(N);
Tupel<int,2> z;
for (int i1=0; i1<=2*N[1]; i1++)
for (int i0=0; i0<=2*N[0]; i0++)
{
z[0]=i0; z[1]=i1;
cout << " [" << i0 << "," << i1 << "]"
<< " c = " << cm.codim(z)
<< " n = " << cm.n(z)
<< endl;
}
}
Sorry !
-- Peter
------------------------------------------------------------------
Peter Bastian, IWR,Uni Heidelberg, INF 348,R 020, 69120 Heidelberg
email: Peter.Bastian at iwr.uni-heidelberg.de Tel: +49 6221 54 4984
WWW: http://www.iwr.uni-heidelberg.de/~Peter.Bastian Fax: ... 8860
More information about the Dune
mailing list