From 30a62da01d5e29aaf96b6276be6282dc6c4c4540 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 7 May 1998 15:08:49 +0000 Subject: [PATCH] Add geometry information to the library. git-svn-id: https://svn.dealii.org/trunk@265 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/grid/geometry_info.h | 170 +++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 deal.II/deal.II/include/grid/geometry_info.h diff --git a/deal.II/deal.II/include/grid/geometry_info.h b/deal.II/deal.II/include/grid/geometry_info.h new file mode 100644 index 0000000000..81ae9574f4 --- /dev/null +++ b/deal.II/deal.II/include/grid/geometry_info.h @@ -0,0 +1,170 @@ +/*---------------------------- geometry_info.h ---------------------------*/ +/* $Id$ */ +#ifndef __geometry_info_H +#define __geometry_info_H +/*---------------------------- geometry_info.h ---------------------------*/ + + +#include + + +template struct GeometryInfo; + + +/** + Publish some information about geometrical interconnections to the + outside world, for one spacial dimension in this case. These are, + for example the numbers of children per cell, faces per cell, etc, + but also neighborship information, It is especially useful if you + want to loop over all faces in any space dimension, but don't want + to think about their number in a dimension independent expression. + This not only reduces thinking effort but also error possibilities. +*/ +struct GeometryInfo<1> { + public: + /** + * Present dimension. + */ + static const unsigned int dim = 1; + + /** + * Number of children a cell has. + */ + static const unsigned int children_per_cell = (1< { + public: + /** + * Present dimension + */ + static const unsigned int dim = 2; + + /** + * Number of children a cell has. + */ + static const unsigned int children_per_cell = (1<--2 + * | | + * 3 ^ ^ 1 + * | | + * 0-->--1 + * 0 + * Vertices and faces are indicated + * with their numbers, faces also with + * their directions. + * + * Now, when refined, the layout is + * like this: + * *--*--* + * | 3|2 | + * *--*--* + * | 0|1 | + * *--*--* + * + * Thus, the child cells on face zero + * are (ordered in the direction of the + * face) 0 and 1, on face 2 they are + * 3 and 2, etc. + */ + static unsigned int child_cell_on_face (unsigned int face, + unsigned int subface); + + /** + * Exception + */ + DeclException2 (ExcInvalidIndex, + int, + int, + << "Invalid index " << arg1 + << ", index must be between 0 and " << arg2 << "."); +}; + + + + + +/*---------------------------- Inline functions --------------------------------*/ + +inline +unsigned int GeometryInfo<2>::child_cell_on_face (const unsigned int face, + const unsigned int subface) { + Assert (face