]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
A few updates of the CellSimilarity concept.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Mar 2009 17:44:59 +0000 (17:44 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Mar 2009 17:44:59 +0000 (17:44 +0000)
git-svn-id: https://svn.dealii.org/trunk@18469 0785d39b-7218-0410-832d-ea1e28bc413d

13 files changed:
deal.II/deal.II/include/fe/fe_update_flags.h
deal.II/deal.II/include/fe/mapping.h
deal.II/deal.II/include/fe/mapping_cartesian.h
deal.II/deal.II/include/fe/mapping_q.h
deal.II/deal.II/include/fe/mapping_q1.h
deal.II/deal.II/include/fe/mapping_q1_eulerian.h
deal.II/deal.II/include/fe/mapping_q_eulerian.h
deal.II/deal.II/source/fe/fe_values.cc
deal.II/deal.II/source/fe/mapping_cartesian.cc
deal.II/deal.II/source/fe/mapping_q.cc
deal.II/deal.II/source/fe/mapping_q1.cc
deal.II/deal.II/source/fe/mapping_q1_eulerian.cc
deal.II/deal.II/source/fe/mapping_q_eulerian.cc

index a7e8bc797ab8cac1dd00b7a6a7d0980a8dad392d..33fe2b8384ded798f311dfc5847a5030da49c1ca 100644 (file)
@@ -354,7 +354,8 @@ namespace CellSimilarity
   enum Similarity 
     {
       none, 
-      translation
+      translation,
+      invalid_next_cell
     };
 }
 
index 290a9b0757bc4fa12b8aa0565f08713e3bf9b534..334d2bff0eac6c6149b4f3f844aaa18215ec1b30 100644 (file)
@@ -546,7 +546,7 @@ class Mapping : public Subscriptor
     virtual void
     fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
                    const Quadrature<dim>                                     &quadrature,
-                   const enum CellSimilarity::Similarity                                  cell_similarity,
+                   enum CellSimilarity::Similarity                           &cell_similarity,
                    InternalDataBase                                          &internal,
                    std::vector<Point<spacedim> >                             &quadrature_points,
                    std::vector<double>                                       &JxW_values,
index 9b094b6ef862bbb5b7eb67b7db4fe6c446a6ecb1..2645ad8d3fa4be6cbb6186bcf99ba9fa046ce2f2 100644 (file)
@@ -61,7 +61,7 @@ class MappingCartesian : public Mapping<dim,spacedim>
     virtual void
     fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
                    const Quadrature<dim>                                     &quadrature,
-                   const enum CellSimilarity::Similarity      cell_similarity,
+                   enum CellSimilarity::Similarity                           &cell_similarity,
                    typename Mapping<dim, spacedim>::InternalDataBase         &mapping_data,
                    std::vector<Point<spacedim> >                             &quadrature_points,
                    std::vector<double>                                       &JxW_values,
index 038144041b26479d39ff5a7709b1fe638fef95ab..9ca37164123b744e22b688cf47493b75eb097d55 100644 (file)
@@ -205,7 +205,7 @@ class MappingQ : public MappingQ1<dim,spacedim>
     virtual void
     fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
                    const Quadrature<dim>                                     &quadrature,
-                   enum CellSimilarity::Similarity                            cell_similarity,
+                   enum CellSimilarity::Similarity                           &cell_similarity,
                    typename Mapping<dim,spacedim>::InternalDataBase          &mapping_data,
                    typename std::vector<Point<spacedim> >                    &quadrature_points,
                    std::vector<double>                                       &JxW_values,
index f21b8eee9a8c56e051fa8373ff6287b0a834da1e..8a8ee2f0a633c6421d73d528e7b369092c369c1b 100644 (file)
@@ -295,7 +295,7 @@ class MappingQ1 : public Mapping<dim,spacedim>
     virtual void
     fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
                    const Quadrature<dim>                                     &quadrature,
-                   const enum CellSimilarity::Similarity           cell_similarity,
+                   enum CellSimilarity::Similarity                           &cell_similarity,
                    typename Mapping<dim,spacedim>::InternalDataBase          &mapping_data,
                    typename std::vector<Point<spacedim> >                    &quadrature_points,
                    std::vector<double>                                       &JxW_values,
index 540c377bfcaca782edcef3954589c31baab84e7d..ff2635e7cf786bd5f469eda5fe7f90708a80ce0b 100644 (file)
@@ -152,7 +152,7 @@ class MappingQ1Eulerian : public MappingQ1<dim,spacedim>
     virtual void
     fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
                    const Quadrature<dim>                                     &quadrature,
-                   enum CellSimilarity::Similarity                            cell_similarity,
+                   enum CellSimilarity::Similarity                           &cell_similarity,
                    typename Mapping<dim,spacedim>::InternalDataBase          &mapping_data,
                    typename std::vector<Point<spacedim> >                    &quadrature_points,
                    std::vector<double>                                       &JxW_values,
index 809bab67f8d0ea74909c1394919cd9d0247bce82..c1c5454e63bab12135009a85bdc85c4faeb315a5 100644 (file)
@@ -155,7 +155,7 @@ class MappingQEulerian : public MappingQ<dim, spacedim>
     virtual void
     fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator &cell,
                    const Quadrature<dim>                                     &quadrature,
-                   enum CellSimilarity::Similarity                            cell_similarity,
+                   enum CellSimilarity::Similarity                           &cell_similarity,
                    typename Mapping<dim,spacedim>::InternalDataBase          &mapping_data,
                    typename std::vector<Point<spacedim> >                    &quadrature_points,
                    std::vector<double>                                       &JxW_values,
index c66288f97f4174b5ae38e2f8aced9c5573ebc2a4..b3ff22769419696cf0c667917267b61a666200bc 100644 (file)
@@ -3249,6 +3249,16 @@ FEValuesBase<dim,spacedim>::check_cell_similarity
                                   // case that there has not been any cell
                                   // before
   if (&*this->present_cell == 0)
+    {
+      cell_similarity = CellSimilarity::none;
+      return;
+    }
+
+                                  // in MappingQ, data can have been
+                                  // modified during the last call. Then,
+                                  // we can't use that data on the new
+                                  // cell.
+  if (cell_similarity == CellSimilarity::invalid_next_cell)
     {
       cell_similarity = CellSimilarity::none;
       return;
@@ -3273,7 +3283,7 @@ FEValuesBase<dim,spacedim>::check_cell_similarity
     for (unsigned int i=1; i<GeometryInfo<dim>::vertices_per_cell; ++i)
       {
        Point<spacedim> dist_new = cell->vertex(i) - present_cell->vertex(i) - dist;
-       if (dist_new.norm_square() > 1e-28)
+       if (dist_new.norm_square() > 1e-30)
          {
            is_translation = false;
            break;
index db2c77f370876d48f5e5d172fbe986dbba13ad68..c5e55981e2719087289e4adaf81befa90728f436 100644 (file)
@@ -185,22 +185,25 @@ MappingCartesian<dim, spacedim>::compute_fill (const typename Triangulation<dim,
                                   // along axes.  Strange vertex
                                   // numbering makes this complicated
                                   // again.
-  switch (dim)
+  if (cell_similarity != CellSimilarity::translation)
     {
-      case 1:
-       data.length[0] = cell->vertex(1)(0) - start(0);
-       break;
-      case 2:
-       data.length[0] = cell->vertex(1)(0) - start(0);
-       data.length[1] = cell->vertex(2)(1) - start(1);
-       break;
-      case 3:
-       data.length[0] = cell->vertex(1)(0) - start(0);
-       data.length[1] = cell->vertex(2)(1) - start(1);
-       data.length[2] = cell->vertex(4)(2) - start(2);
-       break;
-      default:
-       Assert(false, ExcNotImplemented());
+      switch (dim)
+       {
+       case 1:
+         data.length[0] = cell->vertex(1)(0) - start(0);
+         break;
+       case 2:
+         data.length[0] = cell->vertex(1)(0) - start(0);
+         data.length[1] = cell->vertex(2)(1) - start(1);
+         break;
+       case 3:
+         data.length[0] = cell->vertex(1)(0) - start(0);
+         data.length[1] = cell->vertex(2)(1) - start(1);
+         data.length[2] = cell->vertex(4)(2) - start(2);
+         break;
+       default:
+         Assert(false, ExcNotImplemented());
+       }
     }
   
 
@@ -300,7 +303,7 @@ void
 MappingCartesian<dim, spacedim>::
 fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator& cell,
                 const Quadrature<dim>& q, 
-               const enum CellSimilarity::Similarity cell_similarity,
+               enum CellSimilarity::Similarity& cell_similarity,
                typename Mapping<dim,spacedim>::InternalDataBase& mapping_data,
                 std::vector<Point<spacedim> >& quadrature_points,
                 std::vector<double>& JxW_values,
@@ -347,7 +350,7 @@ fill_fe_values (const typename Triangulation<dim,spacedim>::cell_iterator& cell,
        {
          jacobians[i]=Tensor<2,dim>();
          for (unsigned int j=0; j<dim; ++j)
-           jacobians[j][j]=data.length[j];
+           jacobians[i][j][j]=data.length[j];
        }
                                   // "compute" the derivative of the Jacobian
                                   // at the quadrature points, which are all
index 106bd505322e4bec2de9d36ce752faee5435970a..65ea8d8b6e5b6f4c34205fd26e708044558a59b1 100644 (file)
@@ -307,7 +307,7 @@ void
 MappingQ<dim,spacedim>::fill_fe_values (
   const typename Triangulation<dim,spacedim>::cell_iterator &cell,
   const Quadrature<dim>                                     &q,
-  enum CellSimilarity::Similarity                            cell_similarity,
+  enum CellSimilarity::Similarity                           &cell_similarity,
   typename Mapping<dim,spacedim>::InternalDataBase          &mapping_data,
   std::vector<Point<spacedim> >                             &quadrature_points,
   std::vector<double>                                       &JxW_values,
@@ -341,17 +341,17 @@ MappingQ<dim,spacedim>::fill_fe_values (
                                   // recomputed anyway since then the
                                   // mapping changes the data. this needs
                                   // to be known also for later operations,
-                                  // so modify the variable here. TODO:
-                                  // still need to check how this will work
-                                  // when the previous cell disabled this
-                                  // flag.
+                                  // so modify the variable here. this also
+                                  // affects the calculation of the next
+                                  // cell -- if we use Q1 data on the next
+                                  // cell, the data will still be invalid.
   typename MappingQ1<dim,spacedim>::InternalData *p_data=0;
   if (data.use_mapping_q1_on_current_cell)
     p_data=&data.mapping_q1_data;
   else
     {
       p_data=&data;
-      cell_similarity = CellSimilarity::none;
+      cell_similarity = CellSimilarity::invalid_next_cell;
     }
   
   MappingQ1<dim,spacedim>::fill_fe_values(cell, q, cell_similarity, *p_data,
index c5985e9b5d9b1f8fc64ecc86ad4f125e010ec9cf..90741b0ad7b21c079dbf1c608e76c327b306cc39 100644 (file)
@@ -739,7 +739,7 @@ void
 MappingQ1<dim,spacedim>::fill_fe_values (
   const typename Triangulation<dim,spacedim>::cell_iterator &cell,
   const Quadrature<dim>                                     &q,
-  const enum CellSimilarity::Similarity                      cell_similarity,
+  enum CellSimilarity::Similarity                           &cell_similarity,
   typename Mapping<dim,spacedim>::InternalDataBase          &mapping_data,
   std::vector<Point<spacedim> >                             &quadrature_points,
   std::vector<double>                                       &JxW_values,
index 3e1bd7f83279ef149406ee929a9ab2995524f858..d6dfaf9e66eda91e543c47e5ee1b8839f1559f4b 100644 (file)
@@ -120,7 +120,7 @@ void
 MappingQ1Eulerian<dim,EulerVectorType,spacedim>::fill_fe_values (
   const typename Triangulation<dim,spacedim>::cell_iterator &cell,
   const Quadrature<dim>                                     &q,
-  enum CellSimilarity::Similarity                            cell_similarity,
+  enum CellSimilarity::Similarity                           &cell_similarity,
   typename Mapping<dim,spacedim>::InternalDataBase          &mapping_data,
   std::vector<Point<spacedim> >                             &quadrature_points,
   std::vector<double>                                       &JxW_values,
@@ -132,7 +132,7 @@ MappingQ1Eulerian<dim,EulerVectorType,spacedim>::fill_fe_values (
                                   // disable any previously detected
                                   // similarity and hand on to the
                                   // respective function of the base class.
-  cell_similarity = CellSimilarity::none;
+  cell_similarity = CellSimilarity::invalid_next_cell;
   MappingQ1<dim,spacedim>::fill_fe_values (cell, q, cell_similarity, mapping_data,
                                           quadrature_points, JxW_values, jacobians,
                                           jacobian_grads, inverse_jacobians,
index cff88e4ba01bb04d4fe6e1695bcb6aa3c8a26d96..1431787d1257614aa0dbe5e033e7dac3aa74656e 100644 (file)
@@ -187,7 +187,7 @@ void
 MappingQEulerian<dim,EulerVectorType,spacedim>::fill_fe_values (
   const typename Triangulation<dim,spacedim>::cell_iterator &cell,
   const Quadrature<dim>                                     &q,
-  enum CellSimilarity::Similarity                            cell_similarity,
+  enum CellSimilarity::Similarity                           &cell_similarity,
   typename Mapping<dim,spacedim>::InternalDataBase          &mapping_data,
   std::vector<Point<spacedim> >                             &quadrature_points,
   std::vector<double>                                       &JxW_values,
@@ -199,7 +199,7 @@ MappingQEulerian<dim,EulerVectorType,spacedim>::fill_fe_values (
                                   // disable any previously detected
                                   // similarity and hand on to the respective
                                   // function of the base class.
-  cell_similarity = CellSimilarity::none;
+  cell_similarity = CellSimilarity::invalid_next_cell;
   MappingQ<dim,spacedim>::fill_fe_values (cell, q, cell_similarity, mapping_data,
                                          quadrature_points, JxW_values, jacobians,
                                          jacobian_grads, inverse_jacobians,

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.