]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix problem in DataOutFaces where we used the face index instead of the cell index...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Feb 2003 17:10:27 +0000 (17:10 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 25 Feb 2003 17:10:27 +0000 (17:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@7244 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/data_out_faces.h
deal.II/deal.II/source/numerics/data_out_faces.cc
deal.II/doc/news/2002/c-3-4.html

index 07e575906a87f498e25d95542cc9d9b35ca9120c..e2a063ad9cc9af5482eb71fde84fdf1478484055 100644 (file)
@@ -164,6 +164,11 @@ class DataOutFaces : public DataOut_DoFData<dim,dim-1,dim>
                    int,
                    << "The number of subdivisions per patch, " << arg1
                    << ", is not valid.");
+
+                                    /**
+                                     * Exception
+                                     */
+    DeclException0 (ExcCellNotActiveForCellData);
     
   private:
                                     /**
index b56dea8934ff86da4483716a6d11090e07bce19e..a5225216b8b9830bcc4d607c6906f0f6bc3c14c0 100644 (file)
@@ -44,7 +44,6 @@ void DataOutFaces<dim>::build_some_patches (Data data)
 
   const unsigned int n_q_points = patch_points.n_quadrature_points;
   
-  unsigned int face_number = 0;
   typename std::vector< ::DataOutBase::Patch<dim-1,dim> >::iterator patch = this->patches.begin();
   FaceDescriptor face=first_face();
 
@@ -52,7 +51,6 @@ void DataOutFaces<dim>::build_some_patches (Data data)
   for (unsigned int i=0; (i<data.this_thread)&&(face.first != this->dofs->end()); ++i)
     {
       ++patch;
-      ++face_number;
       face=next_face(face);
     }
 
@@ -105,14 +103,29 @@ void DataOutFaces<dim>::build_some_patches (Data data)
                                           // then do the cell data
          for (unsigned int dataset=0; dataset<this->cell_data.size(); ++dataset)
            {
+                                              // we need to get at
+                                              // the number of the
+                                              // cell to which this
+                                              // face belongs in
+                                              // order to access the
+                                              // cell data. this is
+                                              // not readily
+                                              // available, so choose
+                                              // the following rather
+                                              // inefficient way:
+             Assert (face.first->active(), ExcCellNotActiveForCellData());
+             const unsigned int cell_number
+               = std::distance (this->dofs->begin_active(),
+                                typename DoFHandler<dim>::active_cell_iterator(face.first));
+             
              if (this->cell_data[dataset].has_block)
                {
-                 const double value = (*this->cell_data[dataset].block_data)(face_number);
+                 const double value = (*this->cell_data[dataset].block_data)(cell_number);
                  for (unsigned int q=0; q<n_q_points; ++q)
                    patch->data(dataset+this->dof_data.size()*data.n_components,q) =
                      value;
                } else {
-                 const double value = (*this->cell_data[dataset].single_data)(face_number);
+                 const double value = (*this->cell_data[dataset].single_data)(cell_number);
                  for (unsigned int q=0; q<n_q_points; ++q)
                    patch->data(dataset+this->dof_data.size()*data.n_components,q) =
                      value;
@@ -124,7 +137,6 @@ void DataOutFaces<dim>::build_some_patches (Data data)
           (i<data.n_threads)&&(face.first != this->dofs->end()); ++i)
        {
          ++patch;
-         ++face_number;
          face=next_face(face);
        }
     };
index 66e8c2531ada7ae5a4c787fb1b7ba5ea973fadac..5ae27eb27f8f5e9c67a547e9a184e6b769b86200 100644 (file)
@@ -739,6 +739,15 @@ contributor's names are abbreviated by WB (Wolfgang Bangerth), GK
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p>
+       Fixed: The <code class="class">DataOutFaces</code> class was
+       broken for cell data. It should now be correct, although the
+       algorithm used is not optimal, being approximately quadratic in
+       runtime.
+       <br>
+       (WB 2003/02/25)
+       </p>
+
   <li> <p>
        New: The <code class="member">ConstraintMatrix::shift</code>
        function shifts and translates the elements of the constraint

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.