/**
* Publish some information about geometrical interconnections to the
- * outside world, for one spacial dimension in this case. These are,
+ * outside world, for one spatial 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
/**
* Publish some information about geometrical interconnections to the
- * outside world, for two spacial dimensions in this case. These are,
+ * outside world, for two spatial dimensions 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
+/**
+ * Publish some information about geometrical interconnections to the
+ * outside world, for three spatial dimensions 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.
+ */
+template <>
+struct GeometryInfo<3> {
+ public:
+ /**
+ * Present dimension
+ */
+ static const unsigned int dim = 3;
+
+ /**
+ * Number of children a cell has.
+ */
+ static const unsigned int children_per_cell = (1<<dim);
+
+ /**
+ * Number of faces a cell has.
+ */
+ static const unsigned int faces_per_cell = 2*dim;
+
+ /**
+ * Number of children each face has
+ * when the adjacent cell is refined.
+ */
+ static const unsigned int subfaces_per_face = (1<<(dim-1));
+
+ /**
+ * Number of vertices a cell has.
+ */
+ static const unsigned int vertices_per_cell = (1<<dim);
+
+ /**
+ * Number of vertices each face has.
+ */
+ static const unsigned int vertices_per_face = (1<<(dim-1));
+
+ /**
+ * Exception
+ */
+ DeclException2 (ExcInvalidIndex,
+ int,
+ int,
+ << "Invalid index " << arg1
+ << ", index must be between 0 and " << arg2 << ".");
+};
+
+
+
/*---------------------------- Inline functions --------------------------------*/
#include <vector>
#include <grid/tria_line.h>
#include <grid/tria_quad.h>
+#include <grid/tria_hex.h>
#include <base/point.h>
* this one.
*
* @memo Information belonging to one level of the multilevel hierarchy.
+ * @author Wolfgang Bangerth, 1998
*/
template <>
class TriangulationLevel<1> : public TriangulationLevel<0> {
/**
* Store boundary and material data. In
* one dimension, this field stores
- * the material id of a line, which is
+ * the material id of a line, which is a
* number between 0 and 254. In more
* than one dimension, lines have no
* material id, but they may be at the
* #TriangulationLevel<1>#.
*
* @memo Information belonging to one level of the multilevel hierarchy.
+ * @author Wolfgang Bangerth, 1998
*/
template <>
class TriangulationLevel<2> : public TriangulationLevel<1>
/**
* Store boundary and material data. In
* two dimension, this field stores
- * the material id of a quad, which is
+ * the material id of a quad, which is a
* number between 0 and 254. In more
* than two dimensions, quads have no
* material id, but they may be at the
+/**
+ * Store all information which belongs to one level of the multilevel hierarchy.
+ *
+ * In 3D this is a vector of the lines, one of quads and one of the
+ * hexaeders on this levels, as well as a the associated vectors holding
+ * information about the children of these lines, quads and hexs.
+ *
+ * The vectors of lines and quads and their children are derived from
+ * #TriangulationLevel<2>#.
+ *
+ * @memo Information belonging to one level of the multilevel hierarchy.
+ * @author Wolfgang Bangerth, 1998
+ */
+template <>
+class TriangulationLevel<3> : public TriangulationLevel<2>
+{
+ /**
+ * This subclass groups together all that
+ * is needed to describe the hexs on one
+ * level.
+ *
+ * It is fully analogous to the
+ * #LinesData# structure inherited from
+ * #Triangulation<1>#.
+ */
+ struct HexesData {
+ /**
+ * Same as for the #lines# array.
+ */
+ vector<Hexahedron> hexes;
+ /**
+ * Same as for the #LineData::chilren#
+ * array, but since there are four
+ * children, the index points to the
+ * first while the other three are
+ * following immediately afterwards.
+ */
+ vector<int> children;
+
+ /**
+ * Same as for #LineData::used#.
+ */
+ vector<bool> used;
+
+ /**
+ * Same as for #LineData::used#.
+ */
+ vector<bool> user_flags;
+
+ /**
+ * Store boundary and material data. In
+ * two dimension, this field stores
+ * the material id of a hex, which is a
+ * number between 0 and 254. In more
+ * than three dimensions, hexes have no
+ * material id, but they may be at the
+ * boundary; then, we store the
+ * boundary indicator in this field,
+ * which denotes to which part of the
+ * boundary this line belongs and which
+ * boundary conditions hold on this
+ * part. The boundary indicator also
+ * is a number between zero and 254;
+ * the id 255 is reserved for hexes
+ * in the interior and may be used
+ * to check whether a hex is at the
+ * boundary or not, which otherwise
+ * is not possible if you don't know
+ * which cell it belongs to.
+ */
+ vector<unsigned char> material_id;
+
+
+ /**
+ * Pointer which is not used by the
+ * library but may be accessed an set
+ * by the user to handle data local to
+ * a line/quad/etc.
+ */
+ vector<void*> user_pointers;
+ };
+
+ public:
+ /**
+ * Data about the hexes.
+ */
+ HexesData hexes;
+
+ /**
+ * Assert that enough space is allocated
+ * to accomodate #new_quads# new quads.
+ */
+ void reserve_space (const unsigned int new_quads);
+
+ /**
+ * Check the memory consistency of the
+ * different containers. Should only be
+ * called with the prepro flag #DEBUG#
+ * set. The function should be called from
+ * the functions of the higher
+ * #TriangulationLevel# classes.
+ */
+ void monitor_memory (const unsigned int true_dimension) const;
+};
+
+
+
+
/*---------------------------- tria_levels.h ---------------------------*/
/* end of #ifndef __tria_levels_H */
#endif