]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Initial things for the 3D support.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 10 Dec 1998 16:24:39 +0000 (16:24 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 10 Dec 1998 16:24:39 +0000 (16:24 +0000)
git-svn-id: https://svn.dealii.org/trunk@691 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/geometry_info.h
deal.II/deal.II/include/grid/tria_levels.h

index 5c42ee95607c3a157181e9202890f6311bfadb37..e1cbdd25ffd8758d00209c71553e2080bfee25a8 100644 (file)
@@ -14,7 +14,7 @@ template <int dim> struct GeometryInfo;
 
 /**
  *  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
@@ -61,7 +61,7 @@ struct GeometryInfo<1> {
 
 /**
  *  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
@@ -152,6 +152,61 @@ struct GeometryInfo<2> {
 
 
 
+/**
+ *  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 --------------------------------*/
index 4a212e07ba1534be365037052903c713718530c5..0d228d869837584194fc535f23641e3b106c1e89 100644 (file)
@@ -10,6 +10,7 @@
 #include <vector>
 #include <grid/tria_line.h>
 #include <grid/tria_quad.h>
+#include <grid/tria_hex.h>
 #include <base/point.h>
 
 
@@ -173,6 +174,7 @@ class TriangulationLevel<0> {
  *  this one.
  *
  *  @memo Information belonging to one level of the multilevel hierarchy.
+ *  @author Wolfgang Bangerth, 1998
  */
 template <>
 class TriangulationLevel<1> : public TriangulationLevel<0> {
@@ -243,7 +245,7 @@ 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
@@ -321,6 +323,7 @@ class TriangulationLevel<1> : public TriangulationLevel<0> {
  *  #TriangulationLevel<1>#.
  *
  *  @memo Information belonging to one level of the multilevel hierarchy.
+ *  @author Wolfgang Bangerth, 1998
  */
 template <>
 class TriangulationLevel<2> :  public TriangulationLevel<1>
@@ -361,7 +364,7 @@ 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
@@ -417,6 +420,114 @@ class TriangulationLevel<2> :  public TriangulationLevel<1>
 
 
 
+/**
+ *  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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.