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

compile ReferenceTopologySet into libdune

[[Imported from SVN: r2057]]
parent d7ed8434
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,9 @@
SUBDIRS = albertagrid alu3dgrid common onedgrid sgrid uggrid yaspgrid . test
noinst_LTLIBRARIES = libgrid.la
libgrid_la_SOURCES = reftopology.cc
griddir = $(includedir)/dune/grid
grid_HEADERS = albertagrid.hh \
alu3dgrid.hh \
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
/** \file
* \brief Implementation of the reference topologies
*/
#include <dune/grid/reftopology.hh>
using namespace Dune;
namespace Dune {
template <int inputCodim, int outputCodim>
void Dune::ReferenceTopologySet::getSubEntities(const GeometryType& eType,
int entity,
const int*& result,
int& n)
{
DUNE_THROW(NotImplemented, "no subEntity information for these codims");
}
template <>
void Dune::ReferenceTopologySet::getSubEntities<1,1>(const GeometryType& eType,
int entity,
const int*& result,
int& n)
{
switch (eType) {
case line : {
n = 1;
result = &lineVerticesPerFace[entity];
return;
}
default :
DUNE_THROW(NotImplemented, "No subEntity handling for codims (1,2) and element type" << eType);
}
}
template <>
void Dune::ReferenceTopologySet::getSubEntities<1,2>(const GeometryType& eType,
int entity,
const int*& result,
int& n)
{
switch (eType) {
case line : {
n = 1;
result = &lineVerticesPerFace[entity];
return;
}
case triangle : {
n = 2;
result = &triangleVerticesPerFace[entity][0];
return;
}
case quadrilateral : {
n = 2;
result = &quadrilateralVerticesPerFace[entity][0];
return;
}
default :
DUNE_THROW(NotImplemented, "No subEntity handling for codims (1,2) and element type" << eType);
}
}
template <>
void Dune::ReferenceTopologySet::getSubEntities<1,3>(const GeometryType& eType,
int entity,
const int*& result,
int& n)
{
switch (eType) {
case tetrahedron : {
n = 3;
result = &tetrahedronVerticesPerFace[entity][0];
return;
}
case pyramid : {
const int faceSizes[5] = {4, 3, 3, 3, 3};
n = faceSizes[entity];
result = &pyramidVerticesPerFace[entity][0];
return;
}
case prism : {
const int faceSizes[5] = {3, 4, 4, 4, 3};
n = faceSizes[entity];
result = &prismVerticesPerFace[entity][0];
return;
}
case hexahedron : {
n = 4;
result = &hexahedronVerticesPerFace[entity][0];
return;
}
default :
DUNE_THROW(NotImplemented, "No subEntity handling for codims (1,3) and element type" << eType);
}
}
} // end namespace Dune
const int Dune::ReferenceTopologySet::lineVerticesPerFace[2] = {0,1};
const int Dune::ReferenceTopologySet::triangleVerticesPerFace[3][2] = { {1,2}, {2,0}, {0,1} };
const int Dune::ReferenceTopologySet::quadrilateralVerticesPerFace[4][2] = { {2,0}, {1,3} , {0,1} , {3,2}};
const int Dune::ReferenceTopologySet::tetrahedronVerticesPerFace[4][3] = { {1, 2, 3},
{0, 3, 2},
{0, 1, 3},
{0, 2, 1} };
const int Dune::ReferenceTopologySet::pyramidVerticesPerFace[5][4] = { {0, 3, 2, 1},
{0, 1, 4, -1},
{1, 2, 4, -1},
{2, 3, 4, -1},
{0, 4, 3, -1} };
const int Dune::ReferenceTopologySet::prismVerticesPerFace[5][4] = { {0, 2, 1, -1},
{0, 1, 4, 3},
{1, 2, 5, 4},
{0, 3, 5, 2},
{3, 4, 5, -1} };
const int Dune::ReferenceTopologySet::hexahedronVerticesPerFace[6][4] = { {0, 4, 6, 2},
{1, 3, 7, 5},
{0, 1, 5, 4},
{2, 6, 7, 3},
{0, 2, 3, 1},
{5, 7, 6, 4} };
......@@ -3,6 +3,9 @@
#ifndef DUNE_REFERENCE_TOPOLOGY_HH
#define DUNE_REFERENCE_TOPOLOGY_HH
#include <dune/grid/common/grid.hh>
#include <dune/common/exceptions.hh>
/** \file
* \brief The reference topologies
*/
......@@ -14,19 +17,19 @@ namespace Dune {
*/
class ReferenceTopologySet {
static const int ReferenceTopologySet::lineVerticesPerFace[2];
static const int lineVerticesPerFace[2];
static const int ReferenceTopologySet::triangleVerticesPerFace[3][2];
static const int triangleVerticesPerFace[3][2];
static const int ReferenceTopologySet::quadrilateralVerticesPerFace[4][2];
static const int quadrilateralVerticesPerFace[4][2];
static const int ReferenceTopologySet::tetrahedronVerticesPerFace[4][3];
static const int tetrahedronVerticesPerFace[4][3];
static const int ReferenceTopologySet::pyramidVerticesPerFace[5][4];
static const int pyramidVerticesPerFace[5][4];
static const int ReferenceTopologySet::prismVerticesPerFace[5][4];
static const int prismVerticesPerFace[5][4];
static const int ReferenceTopologySet::hexahedronVerticesPerFace[6][4];
static const int hexahedronVerticesPerFace[6][4];
public:
......@@ -54,146 +57,7 @@ namespace Dune {
};
template <int inputCodim, int outputCodim>
void ReferenceTopologySet::getSubEntities(const GeometryType& eType,
int entity,
const int*& result,
int& n)
{
DUNE_THROW(NotImplemented, "no subEntity information for these codims");
}
template <>
void ReferenceTopologySet::getSubEntities<1,1>(const GeometryType& eType,
int entity,
const int*& result,
int& n)
{
switch (eType) {
case line : {
n = 1;
result = &lineVerticesPerFace[entity];
return;
}
default :
DUNE_THROW(NotImplemented, "No subEntity handling for codims (1,2) and element type" << eType);
}
}
template <>
void ReferenceTopologySet::getSubEntities<1,2>(const GeometryType& eType,
int entity,
const int*& result,
int& n)
{
switch (eType) {
case line : {
n = 1;
result = &lineVerticesPerFace[entity];
return;
}
case triangle : {
n = 2;
result = &triangleVerticesPerFace[entity][0];
return;
}
case quadrilateral : {
n = 2;
result = &quadrilateralVerticesPerFace[entity][0];
return;
}
default :
DUNE_THROW(NotImplemented, "No subEntity handling for codims (1,2) and element type" << eType);
}
}
template <>
void ReferenceTopologySet::getSubEntities<1,3>(const GeometryType& eType,
int entity,
const int*& result,
int& n)
{
switch (eType) {
case tetrahedron : {
n = 3;
result = &tetrahedronVerticesPerFace[entity][0];
return;
}
case pyramid : {
const int faceSizes[5] = {4, 3, 3, 3, 3};
n = faceSizes[entity];
result = &pyramidVerticesPerFace[entity][0];
return;
}
case prism : {
const int faceSizes[5] = {3, 4, 4, 4, 3};
n = faceSizes[entity];
result = &prismVerticesPerFace[entity][0];
return;
}
case hexahedron : {
n = 4;
result = &hexahedronVerticesPerFace[entity][0];
return;
}
default :
DUNE_THROW(NotImplemented, "No subEntity handling for codims (1,3) and element type" << eType);
}
}
const int ReferenceTopologySet::lineVerticesPerFace[2] = {0,1};
const int ReferenceTopologySet::triangleVerticesPerFace[3][2] = { {1,2}, {2,0}, {0,1} };
const int ReferenceTopologySet::quadrilateralVerticesPerFace[4][2] = { {2,0}, {1,3} , {0,1} , {3,2}};
const int ReferenceTopologySet::tetrahedronVerticesPerFace[4][3] = { {1, 2, 3},
{0, 3, 2},
{0, 1, 3},
{0, 2, 1} };
const int ReferenceTopologySet::pyramidVerticesPerFace[5][4] = { {0, 3, 2, 1},
{0, 1, 4, -1},
{1, 2, 4, -1},
{2, 3, 4, -1},
{0, 4, 3, -1} };
const int ReferenceTopologySet::prismVerticesPerFace[5][4] = { {0, 2, 1, -1},
{0, 1, 4, 3},
{1, 2, 5, 4},
{0, 3, 5, 2},
{3, 4, 5, -1} };
const int ReferenceTopologySet::hexahedronVerticesPerFace[6][4] = { {0, 4, 6, 2},
{1, 3, 7, 5},
{0, 1, 5, 4},
{2, 6, 7, 3},
{0, 2, 3, 1},
{5, 7, 6, 4} };
}
} // end namespace Dune
#endif
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