Commit da60acc2 authored by Martin Nolte's avatar Martin Nolte

split unitcube.hh into two files (second one is basicunitcube.hh) and reenabled

section on GridFactory again

[[Imported from SVN: r229]]
parent 4d3fd0fa
......@@ -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
unitcube.hh parevolve.hh unitcube_onedgrid.hh basicunitcube.hh
examples_PROGRAMS = gettingstarted traversal integration othergrids\
adaptiveintegration finitevolume adaptivefinitevolume parfinitevolume\
......
// -*- 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
......@@ -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,113 +6,7 @@
#include <dune/common/exceptions.hh>
#include <dune/common/fvector.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 );
}
};
#include "basicunitcube.hh"
// 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