Commit 259f76a2 authored by Christian Engwer's avatar Christian Engwer

revert last patch to have a clean base for Martin Drohmanns patch set

[[Imported from SVN: r231]]
parent da60acc2
......@@ -9,7 +9,7 @@ examples_HEADERS = elementdata.hh parfvdatahandle.hh unitcube_sgrid.hh \
finitevolumeadapt.hh transportproblem.hh unitcube_yaspgrid.hh \
functors.hh unitcube_albertagrid.hh vertexdata.hh \
initialize.hh unitcube_alugrid.hh vtkout.hh integrateentity.hh \
unitcube.hh parevolve.hh unitcube_onedgrid.hh basicunitcube.hh
unitcube.hh parevolve.hh unitcube_onedgrid.hh
examples_PROGRAMS = gettingstarted traversal integration othergrids\
adaptiveintegration finitevolume adaptivefinitevolume parfinitevolume\
......
......@@ -33,43 +33,6 @@ struct P0Layout
}
};
template<class G>
void gnuplot (G& grid, std::vector<double>& c)
{
// first we extract the dimensions of the grid
const int dim = G::dimension;
const int dimworld = G::dimensionworld;
// type used for coordinates in the grid
// such a type is exported by every grid implementation
typedef typename G::ctype ct;
// the grid has an iterator providing the access to
// all elements (better codim 0 entities) which are leafs
// of the refinement tree.
// Note the use of the typename keyword and the traits class
typedef typename G::template Codim<0>::LeafIterator ElementLeafIterator;
// make a mapper for codim 0 entities in the leaf grid
Dune::LeafMultipleCodimMultipleGeomTypeMapper<G,P0Layout>
mapper(grid);
// iterate through all entities of codim 0 at the leafs
int count = 0;
for (ElementLeafIterator it = grid.template leafbegin<0>();
it!=grid.template leafend<0>(); ++it)
{
Dune::GeometryType gt = it->type();
const Dune::FieldVector<ct,dim>&
local = Dune::ReferenceElements<ct,dim>::general(gt).position(0,0);
Dune::FieldVector<ct,dimworld>
global = it->geometry().global(local);
std::cout << global[0] << " " << c[mapper.map(*it)] << std::endl;
count++;
}
}
template<class G>
void timeloop (G& grid, double tend, int lmin, int lmax)
{
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef BASICUNITCUBE_HH
#define BASICUNITCUBE_HH
#include <dune/common/exceptions.hh>
#include <dune/common/fvector.hh>
#include <dune/grid/common/gridfactory.hh>
template< int dim >
class BasicUnitCube;
template<>
class BasicUnitCube< 2 >
{
protected:
template< class Grid >
static void insertVertices ( Dune::GridFactory< Grid > &factory )
{
Dune::FieldVector<double,2> pos;
pos[0] = 0; pos[1] = 0;
factory.insertVertex(pos);
pos[0] = 1; pos[1] = 0;
factory.insertVertex(pos);
pos[0] = 0; pos[1] = 1;
factory.insertVertex(pos);
pos[0] = 1; pos[1] = 1;
factory.insertVertex(pos);
}
template< class Grid >
static void insertSimplices ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::simplex, 2 );
std::vector< unsigned int > cornerIDs( 3 );
cornerIDs[0] = 0; cornerIDs[1] = 1; cornerIDs[2] = 2;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 2; cornerIDs[1] = 1; cornerIDs[2] = 3;
factory.insertElement( type, cornerIDs );
}
template< class Grid >
static void insertCubes ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::cube, 2 );
std::vector< unsigned int > cornerIDs( 4 );
for( int i = 0; i < 4; ++i )
cornerIDs[ i ] = i;
factory.insertElement( type, cornerIDs );
}
};
template<>
class BasicUnitCube< 3 >
{
protected:
template< class Grid >
static void insertVertices ( Dune::GridFactory< Grid > &factory )
{
Dune::FieldVector< double, 3 > pos;
pos[0] = 0; pos[1] = 0; pos[2] = 0; factory.insertVertex(pos);
pos[0] = 1; pos[1] = 0; pos[2] = 0; factory.insertVertex(pos);
pos[0] = 0; pos[1] = 1; pos[2] = 0; factory.insertVertex(pos);
pos[0] = 1; pos[1] = 1; pos[2] = 0; factory.insertVertex(pos);
pos[0] = 0; pos[1] = 0; pos[2] = 1; factory.insertVertex(pos);
pos[0] = 1; pos[1] = 0; pos[2] = 1; factory.insertVertex(pos);
pos[0] = 0; pos[1] = 1; pos[2] = 1; factory.insertVertex(pos);
pos[0] = 1; pos[1] = 1; pos[2] = 1; factory.insertVertex(pos);
}
template< class Grid >
static void insertSimplices ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::simplex, 3 );
std::vector< unsigned int > cornerIDs( 4 );
cornerIDs[0] = 0; cornerIDs[1] = 1; cornerIDs[2] = 2; cornerIDs[3] = 4;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 1; cornerIDs[1] = 3; cornerIDs[2] = 2; cornerIDs[3] = 7;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 1; cornerIDs[1] = 7; cornerIDs[2] = 2; cornerIDs[3] = 4;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 1; cornerIDs[1] = 7; cornerIDs[2] = 4; cornerIDs[3] = 5;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 4; cornerIDs[1] = 7; cornerIDs[2] = 2; cornerIDs[3] = 6;
factory.insertElement( type, cornerIDs );
}
template< class Grid >
static void insertCubes ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::cube, 3 );
std::vector< unsigned int > cornerIDs( 8 );
for( int i = 0; i < 8; ++i )
cornerIDs[ i ] = i;
factory.insertElement( type, cornerIDs );
}
};
#endif
......@@ -33,7 +33,7 @@ CURDIR=doc/grid-howto
docdir=$(datadir)/doc/dune-grid-howto
doc_DATA = grid-howto.pdf
doc_DATA = grid-howto.pdf grid-howto.html
EXTRAINSTALL = grid-howto.pdf grid-howto*.html *.png *.css
......
......@@ -960,21 +960,21 @@ used.
numberstyle=\tiny, numbersep=5pt]{../unitcube_yaspgrid.hh}
\end{lst}
\minisec{GridFactory}
% \minisec{GridFactory}
The file \lstinline!basicunitcube.hh!\ provides an interface class for the
set-up of a unit cube in two or three dimensions with simplicial or cubic
elements with help of the dune-grid class \lstinline!GridFactory!. This class
hides grid specific methods for insertion of vertices and elements in the macro
grid. Specializations of the \lstinline!GridFactory!\ exist for
\lstinline!UGGrid!, \lstinline!AlbertaGrid!\ and the three dimensional
\lstinline!ALUGrid!\ objects.
% The file \lstinline!basicunitcube.hh!\ provides an interface class for the
% set-up of a unit cube in two or three dimensions with simplicial or cubic
% elements with help of the dune-grid class \lstinline!GridFactory!. This class
% hides grid specific methods for insertion of vertices and elements in the macro
% grid. Specializations of the \lstinline!GridFactory!\ exist for
% \lstinline!UGGrid!, \lstinline!AlbertaGrid!\ and the three dimensional
% \lstinline!ALUGrid!\ objects.
\begin{lst}[File dune-grid-howto/basicunitcube.hh] \mbox{}
\nopagebreak
\lstinputlisting[basicstyle=\ttfamily\scriptsize,numbers=left,
numberstyle=\tiny, numbersep=5pt]{../basicunitcube.hh}
\end{lst}
% \begin{lst}[File dune-grid-howto/basicunitcube.hh] \mbox{}
% \nopagebreak
% \lstinputlisting[basicstyle=\ttfamily\scriptsize,numbers=left,
% numberstyle=\tiny, numbersep=5pt]{../basicunitcube.hh}
% \end{lst}
\minisec{UGGrid}
......
......@@ -6,7 +6,113 @@
#include <dune/common/exceptions.hh>
#include <dune/common/fvector.hh>
#include "basicunitcube.hh"
#include <dune/grid/common/gridfactory.hh>
// UGGrid 3d, variant 2 (tetrahedra) specialization
template< int dim >
class BasicUnitCube;
template<>
class BasicUnitCube< 2 >
{
protected:
template< class Grid >
static void insertVertices ( Dune::GridFactory< Grid > &factory )
{
Dune::FieldVector<double,2> pos;
pos[0] = 0; pos[1] = 0;
factory.insertVertex(pos);
pos[0] = 1; pos[1] = 0;
factory.insertVertex(pos);
pos[0] = 0; pos[1] = 1;
factory.insertVertex(pos);
pos[0] = 1; pos[1] = 1;
factory.insertVertex(pos);
}
template< class Grid >
static void insertSimplices ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::simplex, 2 );
std::vector< unsigned int > cornerIDs( 3 );
cornerIDs[0] = 0; cornerIDs[1] = 1; cornerIDs[2] = 2;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 2; cornerIDs[1] = 1; cornerIDs[2] = 3;
factory.insertElement( type, cornerIDs );
}
template< class Grid >
static void insertCubes ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::cube, 2 );
std::vector< unsigned int > cornerIDs( 4 );
for( int i = 0; i < 4; ++i )
cornerIDs[ i ] = i;
factory.insertElement( type, cornerIDs );
}
};
template<>
class BasicUnitCube< 3 >
{
protected:
template< class Grid >
static void insertVertices ( Dune::GridFactory< Grid > &factory )
{
Dune::FieldVector< double, 3 > pos;
pos[0] = 0; pos[1] = 0; pos[2] = 0; factory.insertVertex(pos);
pos[0] = 1; pos[1] = 0; pos[2] = 0; factory.insertVertex(pos);
pos[0] = 0; pos[1] = 1; pos[2] = 0; factory.insertVertex(pos);
pos[0] = 1; pos[1] = 1; pos[2] = 0; factory.insertVertex(pos);
pos[0] = 0; pos[1] = 0; pos[2] = 1; factory.insertVertex(pos);
pos[0] = 1; pos[1] = 0; pos[2] = 1; factory.insertVertex(pos);
pos[0] = 0; pos[1] = 1; pos[2] = 1; factory.insertVertex(pos);
pos[0] = 1; pos[1] = 1; pos[2] = 1; factory.insertVertex(pos);
}
template< class Grid >
static void insertSimplices ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::simplex, 3 );
std::vector< unsigned int > cornerIDs( 4 );
cornerIDs[0] = 0; cornerIDs[1] = 1; cornerIDs[2] = 2; cornerIDs[3] = 4;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 1; cornerIDs[1] = 3; cornerIDs[2] = 2; cornerIDs[3] = 7;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 1; cornerIDs[1] = 7; cornerIDs[2] = 2; cornerIDs[3] = 4;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 1; cornerIDs[1] = 7; cornerIDs[2] = 4; cornerIDs[3] = 5;
factory.insertElement( type, cornerIDs );
cornerIDs[0] = 4; cornerIDs[1] = 7; cornerIDs[2] = 2; cornerIDs[3] = 6;
factory.insertElement( type, cornerIDs );
}
template< class Grid >
static void insertCubes ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::cube, 3 );
std::vector< unsigned int > cornerIDs( 8 );
for( int i = 0; i < 8; ++i )
cornerIDs[ i ] = i;
factory.insertElement( type, cornerIDs );
}
};
// default implementation for any template parameter
template<typename T, int variant>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment