]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add functions which tell us how often a given line/quad/hex is refined.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 May 1999 11:59:50 +0000 (11:59 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 4 May 1999 11:59:50 +0000 (11:59 +0000)
git-svn-id: https://svn.dealii.org/trunk@1263 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_accessor.h
deal.II/deal.II/include/grid/tria_accessor.templates.h
deal.II/deal.II/source/fe/fe_values.cc
deal.II/deal.II/source/grid/tria_accessor.cc

index 12bdd7fecd2da4d3adf60caa1afcfa08ce64665f..ee28d62fae9e4895b640c1fe204f63dc50050268 100644 (file)
@@ -385,6 +385,17 @@ class LineAccessor :  public TriaAccessor<dim> {
                                      */
     bool has_children () const;
 
+                                    /**
+                                     * Return the number of times that this
+                                     * cell is refined. Note that not all
+                                     * its children are refined that often
+                                     * (which is why we prepend #max_#), 
+                                     * the returned number is rather the
+                                     * maximum number of refinement in
+                                     * any branch of children of this object.
+                                     */
+    unsigned int max_refinement_depth () const;
+    
                                     /**
                                      * Return the boundary indicator of this
                                      * line. Since boundary data is only useful
@@ -715,6 +726,17 @@ class QuadAccessor :  public TriaAccessor<dim> {
                                      */
     bool has_children () const;
 
+                                    /**
+                                     * Return the number of times that this
+                                     * cell is refined. Note that not all
+                                     * its children are refined that often
+                                     * (which is why we prepend #max_#), 
+                                     * the returned number is rather the
+                                     * maximum number of refinement in
+                                     * any branch of children of this object.
+                                     */
+    unsigned int max_refinement_depth () const;
+    
                                     /**
                                      * Return the boundary indicator of this
                                      * quad. Since boundary data is only useful
@@ -1074,6 +1096,17 @@ class HexAccessor :  public TriaAccessor<dim> {
                                      */
     bool has_children () const;
 
+                                    /**
+                                     * Return the number of times that this
+                                     * cell is refined. Note that not all
+                                     * its children are refined that often
+                                     * (which is why we prepend #max_#), 
+                                     * the returned number is rather the
+                                     * maximum number of refinement in
+                                     * any branch of children of this object.
+                                     */
+    unsigned int max_refinement_depth () const;    
+    
                                     /**
                                      * Return the boundary indicator of this
                                      * hex. Since boundary data is only useful
index c1addddbd278eb682fd9284f9e750ec26c0266af..c49912ff2ab88614f8b84d5df2285f4333facfaf 100644 (file)
@@ -169,6 +169,22 @@ LineAccessor<dim>::has_children () const {
 
 
 
+template <int dim>
+inline
+unsigned int
+LineAccessor<dim>::max_refinement_depth () const
+{
+  if (!has_children())
+    return 0;
+
+  const unsigned int depths[2] = { child(0)->max_refinement_depth() + 1,
+                                  child(1)->max_refinement_depth() + 1  };
+  return max (depths[0], depths[1]);
+};
+      
+           
+
+
 template <int dim>
 inline
 void
@@ -331,6 +347,24 @@ QuadAccessor<dim>::has_children () const {
 
 
 
+template <int dim>
+inline
+unsigned int
+QuadAccessor<dim>::max_refinement_depth () const
+{
+  if (!has_children())
+    return 0;
+
+  const unsigned int depths[4] = { child(0)->max_refinement_depth() + 1,
+                                  child(1)->max_refinement_depth() + 1,
+                                  child(2)->max_refinement_depth() + 1,
+                                  child(3)->max_refinement_depth() + 1 };
+  return max (max (depths[0], depths[1]),
+             max (depths[2], depths[3]));
+};
+
+
+
 template <int dim>
 inline
 void
@@ -539,6 +573,37 @@ int HexAccessor<dim>::child_index (unsigned int i) const {
 
 
 
+template <int dim>
+bool HexAccessor<dim>::has_children () const {
+  Assert (state() == valid, ExcDereferenceInvalidObject());
+  return (tria->levels[present_level]->hexes.children[present_index] != -1);
+};
+
+
+
+template <int dim>
+inline
+unsigned int
+HexAccessor<dim>::max_refinement_depth () const
+{
+  if (!has_children())
+    return 0;
+
+  const unsigned int depths[8] = { child(0)->max_refinement_depth() + 1,
+                                  child(1)->max_refinement_depth() + 1,
+                                  child(2)->max_refinement_depth() + 1,
+                                  child(3)->max_refinement_depth() + 1,
+                                  child(4)->max_refinement_depth() + 1,
+                                  child(5)->max_refinement_depth() + 1,
+                                  child(6)->max_refinement_depth() + 1,
+                                  child(7)->max_refinement_depth() + 1  };
+  return max (max (max (depths[0], depths[1]),
+                  max (depths[2], depths[3])),
+             max (max (depths[4], depths[5]),
+                  max (depths[6], depths[7])));
+};
+
+
 
 template <int dim>
 inline
index 048ebe4ade3cac2ed829959cc8d61b6f8485dccd..3745fb14f45d50a44912cb156e2037ccb9bf9843 100644 (file)
@@ -142,8 +142,8 @@ template <int dim>
 void FEValuesBase<dim>::get_function_grads (const Vector<double>   &fe_function,
                                            vector<Tensor<1,dim> > &gradients) const
 {
-  Assert (fe->n_components == 1,
-         ExcWrongNoOfComponents());
+//  Assert (fe->n_components == 1,
+//       ExcWrongNoOfComponents());
   Assert (gradients.size() == n_quadrature_points,
          ExcWrongVectorSize(gradients.size(), n_quadrature_points));
 
index 1551fbc68c49534fec8339b996109fcc7be7c172..770f021f507c474b52a539140b593af767cbeb7c 100644 (file)
@@ -680,14 +680,6 @@ void HexAccessor<dim>::clear_children () const {
 
 
 
-template <int dim>
-bool HexAccessor<dim>::has_children () const {
-  Assert (state() == valid, ExcDereferenceInvalidObject());
-  return (tria->levels[present_level]->hexes.children[present_index] != -1);
-};
-
-
-
 template <int dim>
 unsigned char HexAccessor<dim>::boundary_indicator () const {
   Assert (dim<4, ExcNotUsefulForThisDimension());

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.