/usr/include/dune/grid/test/basicunitcube.hh is in libdune-grid-dev 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | // -*- 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
// StructuredGridFactory cannot replace BasicUnitCube when creating a projected unit cube in test-alberta.cc
/*
#warning The BasicUnitCube class is deprecated (since dune-grid 2.1). Please use the StructuredGridFactory \
(in dune/grid/utility/structuredgridfactory.hh) instead!
*/
#include <dune/grid/common/gridfactory.hh>
// declaration of a basic unit cube that uses the GridFactory
template< int dim >
struct BasicUnitCube;
template<>
struct BasicUnitCube< 1 >
{
template< class Grid >
static void insertVertices ( Dune::GridFactory< Grid > &factory, const double left = 0.0, const double right = 1.0 )
{
Dune::FieldVector<double,1> pos;
pos[0] = left;
factory.insertVertex(pos);
pos[ 0 ] = right;
factory.insertVertex(pos);
}
template< class Grid >
static void insertSimplices ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::simplex, 1 );
std::vector< unsigned int > cornerIDs( 2 );
cornerIDs[0] = 0; cornerIDs[1] = 1;
factory.insertElement( type, cornerIDs );
}
template< class Grid >
static void insertCubes ( Dune::GridFactory< Grid > &factory )
{
const Dune::GeometryType type( Dune::GeometryType::cube, 1 );
std::vector< unsigned int > cornerIDs( 2 );
cornerIDs[0] = 0; cornerIDs[1] = 1;
factory.insertElement( type, cornerIDs );
}
};
// unit cube in two dimensions with 2 variants: triangle and rectangle elements
template<>
struct BasicUnitCube< 2 >
{
template< class Grid >
static void insertVertices ( Dune::GridFactory< Grid > &factory, const double left = 0.0, const double right = 1.0 )
{
Dune::FieldVector<double,2> pos;
pos[0] = right; pos[1] = left;
factory.insertVertex(pos); /*@\label{uc:iv}@*/
pos[0] = left; pos[1] = left;
factory.insertVertex(pos);
pos[0] = right; pos[1] = right;
factory.insertVertex(pos);
pos[0] = left; pos[1] = right;
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 ); /*@\label{uc:ie}@*/
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 );
}
};
// unit cube in 3 dimensions with two variants: tetraheda and hexahedra
template<>
struct BasicUnitCube< 3 >
{
template< class Grid >
static void insertVertices ( Dune::GridFactory< Grid > &factory, const double left = 0.0, const double right = 1.0 )
{
Dune::FieldVector< double, 3 > pos;
pos[0] = right; pos[1] = left; pos[2] = left; factory.insertVertex(pos);
pos[0] = left; pos[1] = left; pos[2] = left; factory.insertVertex(pos);
pos[0] = right; pos[1] = right; pos[2] = left; factory.insertVertex(pos);
pos[0] = left; pos[1] = right; pos[2] = left; factory.insertVertex(pos);
pos[0] = right; pos[1] = left; pos[2] = right; factory.insertVertex(pos);
pos[0] = left; pos[1] = left; pos[2] = right; factory.insertVertex(pos);
pos[0] = right; pos[1] = right; pos[2] = right; factory.insertVertex(pos);
pos[0] = left; pos[1] = right; pos[2] = right; 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 /*BASICUNITCUBE_HH*/
|