]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Simplify things a bit: let all DataOut* classes use the same internal data structure...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Oct 2008 02:20:03 +0000 (02:20 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 29 Oct 2008 02:20:03 +0000 (02:20 +0000)
git-svn-id: https://svn.dealii.org/trunk@17390 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/numerics/data_out.h
deal.II/deal.II/include/numerics/data_out_faces.h
deal.II/deal.II/include/numerics/data_out_rotation.h
deal.II/deal.II/source/numerics/data_out.cc
deal.II/deal.II/source/numerics/data_out_faces.cc
deal.II/deal.II/source/numerics/data_out_rotation.cc

index fe1b75bd811d6af3bd50498fe716442af28f0019..1d135a8c0015e9e70eda2190e6641cd8e5def4de 100644 (file)
@@ -30,6 +30,62 @@ DEAL_II_NAMESPACE_OPEN
 
 template <int> class FEValuesBase;
 
+namespace internal
+{
+  namespace DataOut
+  {
+                                    /**
+                                     * A data structure that holds
+                                     * all data needed in one thread
+                                     * when building patches in
+                                     * parallel.  These data
+                                     * structures are created
+                                     * globally rather than on each
+                                     * cell to avoid allocation of
+                                     * memory in the threads.
+                                     *
+                                     * The #cell_to_patch_index_map is
+                                     * an array that stores for index
+                                     * <tt>[i][j]</tt> the number of the
+                                     * patch that associated with the
+                                     * cell with index @p j on level
+                                     * @p i. This information is set
+                                     * up prior to generation of the
+                                     * patches, and is needed to
+                                     * generate neighborship
+                                     * information.
+                                     *
+                                     * This structure is used by
+                                     * several of the DataOut*
+                                     * classes, not all of which use
+                                     * all fields.
+                                     */
+    template <int dim, int spacedim>
+    struct ParallelData
+    {
+       unsigned int n_threads;
+       unsigned int this_thread;
+       unsigned int n_components;
+       unsigned int n_datasets;
+       unsigned int n_subdivisions;
+       unsigned int n_patches_per_circle;
+       SmartPointer<const Mapping<dim> >              mapping;
+       std::vector<double>                            patch_values;
+       std::vector<Vector<double> >                   patch_values_system;
+       std::vector<Tensor<1,spacedim> >               patch_gradients;
+       std::vector<std::vector<Tensor<1,spacedim> > > patch_gradients_system;
+       std::vector<Tensor<2,spacedim> >               patch_hessians;
+       std::vector<std::vector<Tensor<2,spacedim> > > patch_hessians_system;
+       std::vector<Point<spacedim> >                  dummy_normals;
+       std::vector<Point<dim> >                       patch_normals;
+       std::vector<std::vector<Vector<double> > >     postprocessed_values;
+
+       std::vector<std::vector<unsigned int> > *cell_to_patch_index_map;
+    };
+  }
+}
+
+
 //TODO: Most of the documentation of DataOut_DoFData applies to DataOut.
 
 /**
@@ -1252,43 +1308,7 @@ class DataOut : public DataOut_DoFData<DH, DH::dimension>
                    << ", is not valid.");
     
   private:
-                                    /**
-                                     * All data needed in one thread
-                                     * is gathered in the struct
-                                     * Data.  The data is handled
-                                     * globally to avoid allocation
-                                     * of memory in the threads.
-                                     *
-                                     * The #cell_to_patch_index_map is
-                                     * an array that stores for index
-                                     * <tt>[i][j]</tt> the number of the
-                                     * patch that associated with the
-                                     * cell with index @p j on level
-                                     * @p i. This information is set
-                                     * up prior to generation of the
-                                     * patches, and is needed to
-                                     * generate neighborship
-                                     * information.
-                                     */
-    struct Data 
-    {
-       unsigned int n_threads;
-       unsigned int this_thread;
-       unsigned int n_components;
-       unsigned int n_datasets;
-       unsigned int n_subdivisions;
-        SmartPointer<const Mapping<DH::dimension> > mapping;
-       std::vector<double>          patch_values;
-       std::vector<Vector<double> > patch_values_system;
-       std::vector<Tensor<1,DH::dimension> >               patch_gradients;
-       std::vector<std::vector<Tensor<1,DH::dimension> > > patch_gradients_system;
-       std::vector<Tensor<2,DH::dimension> >               patch_hessians;
-       std::vector<std::vector<Tensor<2,DH::dimension> > > patch_hessians_system;
-       std::vector<Point<dim> >                            dummy_normals;
-       std::vector<std::vector<Vector<double> > >          postprocessed_values;
-
-        std::vector<std::vector<unsigned int> > *cell_to_patch_index_map;
-    };
+
                                     /**
                                      * Builds every @p n_threads's
                                      * patch. This function may be
@@ -1297,7 +1317,7 @@ class DataOut : public DataOut_DoFData<DH, DH::dimension>
                                      * used, the function is called
                                      * once and generates all patches.
                                      */
-    void build_some_patches (Data &data);
+    void build_some_patches (internal::DataOut::ParallelData<DH::dimension, DH::dimension> &data);
 
                                     /**
                                      * Store in which region cells shall be
index bd86ce8ce8b3eaecb9218ee11b9c44cfd675e844..a7ea4180327cbba3e1fffe7815ce3765c2edf4d7 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -181,32 +181,6 @@ class DataOutFaces : public DataOut_DoFData<DH,DH::dimension-1,
     DeclException0 (ExcCellNotActiveForCellData);
     
   private:
-                                    /**
-                                     * All data needed in one thread
-                                     * is gathered in the struct
-                                     * Data.
-                                     * The data is handled globally
-                                     * to avoid allocation of memory
-                                     * in the threads.
-                                     */
-    struct Data 
-    {
-       unsigned int n_threads;
-       unsigned int this_thread;
-       unsigned int n_components;
-       unsigned int n_datasets;
-       unsigned int n_subdivisions;
-       std::vector<double>                        patch_values;
-       std::vector<Vector<double> >               patch_values_system;
-       std::vector<Tensor<1,dim> >                patch_gradients;
-       std::vector<std::vector<Tensor<1,dim> > >  patch_gradients_system;
-       std::vector<Tensor<2,dim> >                patch_hessians;
-       std::vector<std::vector<Tensor<2,dim> > >  patch_hessians_system;
-       std::vector<std::vector<Vector<double> > > postprocessed_values;
-       std::vector<Point<dim> >                   patch_normals;
-       Data ()
-         {}
-    };
                                     /**
                                      * Builds every @p n_threads's
                                      * patch. This function may be
@@ -215,7 +189,7 @@ class DataOutFaces : public DataOut_DoFData<DH,DH::dimension-1,
                                      * used, the function is called
                                      * once and generates all patches.
                                      */
-    void build_some_patches (Data &data);
+    void build_some_patches (internal::DataOut::ParallelData<DH::dimension, DH::dimension> &data);
 };
 
 
index 843f39528125468d6fabbf612a3f9c75b19def68..65b1565a927c64a7dfe576fac1d59a1c5701e79a 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -169,33 +169,6 @@ class DataOutRotation : public DataOut_DoFData<DH,DH::dimension+1>
                    << "The radial variable attains a negative value of " << arg1);
     
   private:
-                                    /**
-                                     * All data needed in one thread
-                                     * is gathered in the struct
-                                     * Data.
-                                     * The data is handled globally
-                                     * to avoid allocation of memory
-                                     * in the threads.
-                                     */
-    struct Data 
-    {
-       unsigned int n_threads;
-       unsigned int this_thread;
-       unsigned int n_components;
-       unsigned int n_datasets;
-       unsigned int n_patches_per_circle;
-       unsigned int n_subdivisions;
-       std::vector<double>                        patch_values;
-       std::vector<Vector<double> >               patch_values_system;
-       std::vector<Tensor<1,dim> >                patch_gradients;
-       std::vector<std::vector<Tensor<1,dim> > >  patch_gradients_system;
-       std::vector<Tensor<2,dim> >                patch_hessians;
-       std::vector<std::vector<Tensor<2,dim> > >  patch_hessians_system;
-       std::vector<std::vector<Vector<double> > > postprocessed_values;
-       std::vector<Point<dim> >                   dummy_normals;
-       Data ()
-         {}
-    };
                                     /**
                                      * Builds every @p n_threads's
                                      * patch. This function may be
@@ -204,7 +177,7 @@ class DataOutRotation : public DataOut_DoFData<DH,DH::dimension+1>
                                      * used, the function is called
                                      * once and generates all patches.
                                      */
-    void build_some_patches (Data &data);
+    void build_some_patches (internal::DataOut::ParallelData<DH::dimension, DH::dimension> &data);
 };
 
 
index 18001c900f110618562dde8e02341437291d1601..b5593136de049c388afef0abeeba0d661627d445 100644 (file)
@@ -620,7 +620,7 @@ DataOut_DoFData<DH,patch_dim,patch_space_dim>::memory_consumption () const
 
 
 template <int dim, class DH>
-void DataOut<dim,DH>::build_some_patches (Data &data)
+void DataOut<dim,DH>::build_some_patches (internal::DataOut::ParallelData<DH::dimension, DH::dimension> &data)
 {
                                   // Check consistency of redundant
                                   // template parameter
@@ -1049,7 +1049,7 @@ void DataOut<dim,DH>::build_patches (const Mapping<DH::dimension> &mapping,
   
 
                                   // init data for the threads    
-  std::vector<Data> thread_data(n_threads);
+  std::vector<internal::DataOut::ParallelData<DH::dimension, DH::dimension> > thread_data(n_threads);
   for (unsigned int i=0;i<n_threads;++i)
     {
       thread_data[i].n_threads      = n_threads;
index 759f623e014568744aae2496dd34ad415cc6e977..b4e78651098ee2d3e90afb86944ecf13aaabc7f3 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -31,7 +31,7 @@ DEAL_II_NAMESPACE_OPEN
 
 
 template <int dim, class DH>
-void DataOutFaces<dim,DH>::build_some_patches (Data &data)
+void DataOutFaces<dim,DH>::build_some_patches (internal::DataOut::ParallelData<DH::dimension, DH::dimension> &data)
 {
                                   // Check consistency of redundant
                                   // template parameter
@@ -279,7 +279,7 @@ void DataOutFaces<dim,DH>::build_patches (const unsigned int nnnn_subdivisions,
        face = next_face(face))
     ++n_patches;
 
-  std::vector<Data> thread_data(n_threads);
+  std::vector<internal::DataOut::ParallelData<DH::dimension, DH::dimension> > thread_data(n_threads);
 
                                   // init data for the threads
   for (unsigned int i=0;i<n_threads;++i)
index 9d3befa0c3861bdcea3e19b6c72f1d3a8303c11a..44d2202ec10382023f6f0f3bd03c993780f3ad0d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -43,7 +43,7 @@ DEAL_II_NAMESPACE_OPEN
 
 #if deal_II_dimension < 3
 template <int dim, class DH>
-void DataOutRotation<dim,DH>::build_some_patches (Data &data)
+void DataOutRotation<dim,DH>::build_some_patches (internal::DataOut::ParallelData<DH::dimension, DH::dimension> &data)
 {
   QTrapez<1>     q_trapez;
   QIterated<DH::dimension> patch_points (q_trapez, data.n_subdivisions);
@@ -406,7 +406,7 @@ void DataOutRotation<dim,DH>::build_some_patches (Data &data)
 #else
 
 template <int dim, class DH>
-void DataOutRotation<dim,DH>::build_some_patches (Data&)
+void DataOutRotation<dim,DH>::build_some_patches (internal::DataOut::ParallelData<DH::dimension, DH::dimension> &)
 {
                                   // would this function make any
                                   // sense after all? who would want
@@ -477,7 +477,7 @@ void DataOutRotation<dim,DH>::build_patches (
                                   // rotation
   n_patches *= n_patches_per_circle;
 
-  std::vector<Data> thread_data(n_threads);
+  std::vector<internal::DataOut::ParallelData<DH::dimension, DH::dimension> > thread_data(n_threads);
 
                                   // init data for the threads
   for (unsigned int i=0;i<n_threads;++i)
@@ -521,7 +521,7 @@ void DataOutRotation<dim,DH>::build_patches (
 
   if (DEAL_II_USE_MT)
     {
-      void (DataOutRotation<dim,DH>::*p) (Data &)
+      void (DataOutRotation<dim,DH>::*p) (internal::DataOut::ParallelData<DH::dimension, DH::dimension> &)
         = &DataOutRotation<dim,DH>::build_some_patches;
 
       Threads::ThreadGroup<> threads;

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.