]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Move the DataEntryBase and derived classes out of the DataOut_DoFData class and into...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 14 Feb 2012 08:51:04 +0000 (08:51 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 14 Feb 2012 08:51:04 +0000 (08:51 +0000)
git-svn-id: https://svn.dealii.org/trunk@25063 0785d39b-7218-0410-832d-ea1e28bc413d

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

index 7397c59529d5dee378078b46559198d595c79137..f8b125fa5ab1be2159b27489c18b6abb060ebfc3 100644 (file)
@@ -1,7 +1,7 @@
 //---------------------------------------------------------------------------
 //    $Id$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -36,6 +36,190 @@ namespace internal
 {
   namespace DataOut
   {
+                                    /**
+                                      * For each vector that has been added
+                                      * through the add_data_vector()
+                                      * functions, we need to keep track of a
+                                      * pointer to it, and allow data
+                                      * extraction from it when we generate
+                                      * patches. Unfortunately, we need to do
+                                      * this for a number of different vector
+                                      * types. Fortunately, they all have the
+                                      * same interface. So the way we go is to
+                                      * have a base class that provides the
+                                      * functions to access the vector's
+                                      * information, and to have a derived
+                                      * template class that can be
+                                      * instantiated for each vector
+                                      * type. Since the vectors all have the
+                                      * same interface, this is no big
+                                      * problem, as they can all use the same
+                                      * general templatized code.
+                                      *
+                                      * @author Wolfgang Bangerth, 2004
+                                     */
+    template <class DH>
+    class DataEntryBase
+    {
+      public:
+                                        /**
+                                         * Constructor. Give a list of names
+                                         * for the individual components of
+                                         * the vector and their
+                                         * interpretation as scalar or vector
+                                         * data. This constructor assumes
+                                         * that no postprocessor is going to
+                                         * be used.
+                                         */
+       DataEntryBase (const std::vector<std::string> &names,
+                      const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation);
+
+                                        /**
+                                         * Constructor when a data
+                                         * postprocessor is going to be
+                                         * used. In that case, the names and
+                                         * vector declarations are going to
+                                         * be aquired from the postprocessor.
+                                         */
+       DataEntryBase (const DataPostprocessor<DH::space_dimension> *data_postprocessor);
+
+                                         /**
+                                          * Destructor made virtual.
+                                          */
+        virtual ~DataEntryBase ();
+
+                                         /**
+                                          * Assuming that the stored vector is
+                                          * a cell vector, extract the given
+                                          * element from it.
+                                          */
+        virtual
+        double
+        get_cell_data_value (const unsigned int cell_number) const = 0;
+
+                                         /**
+                                          * Given a FEValuesBase object,
+                                          * extract the values on the present
+                                          * cell from the vector we actually
+                                          * store.
+                                          */
+        virtual
+        void
+        get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                             std::vector<double>             &patch_values) const = 0;
+
+                                         /**
+                                          * Given a FEValuesBase object,
+                                          * extract the values on the present
+                                          * cell from the vector we actually
+                                          * store. This function does the same
+                                          * as the one above but for
+                                          * vector-valued finite elements.
+                                          */
+        virtual
+        void
+        get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                             std::vector<dealii::Vector<double> >    &patch_values_system) const = 0;
+
+                                         /**
+                                          * Given a FEValuesBase object,
+                                          * extract the gradients on the present
+                                          * cell from the vector we actually
+                                          * store.
+                                          */
+        virtual
+        void
+        get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                               std::vector<Tensor<1,DH::space_dimension> >       &patch_gradients) const = 0;
+
+                                         /**
+                                          * Given a FEValuesBase object,
+                                          * extract the gradients on the present
+                                          * cell from the vector we actually
+                                          * store. This function does the same
+                                          * as the one above but for
+                                          * vector-valued finite elements.
+                                          */
+        virtual
+        void
+        get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                               std::vector<std::vector<Tensor<1,DH::space_dimension> > > &patch_gradients_system) const = 0;
+
+                                         /**
+                                          * Given a FEValuesBase object, extract
+                                          * the second derivatives on the
+                                          * present cell from the vector we
+                                          * actually store.
+                                          */
+        virtual
+        void
+        get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                              std::vector<Tensor<2,DH::space_dimension> >       &patch_hessians) const = 0;
+
+                                         /**
+                                          * Given a FEValuesBase object, extract
+                                          * the second derivatives on the
+                                          * present cell from the vector we
+                                          * actually store. This function does
+                                          * the same as the one above but for
+                                          * vector-valued finite elements.
+                                          */
+        virtual
+        void
+        get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                              std::vector<std::vector< Tensor<2,DH::space_dimension> > > &patch_hessians_system) const = 0;
+
+                                         /**
+                                          * Clear all references to the
+                                          * vectors.
+                                          */
+        virtual void clear () = 0;
+
+                                        /**
+                                         * Determine an estimate for
+                                         * the memory consumption (in
+                                         * bytes) of this object.
+                                         */
+       virtual std::size_t memory_consumption () const = 0;
+
+                                        /**
+                                         * Names of the components of this
+                                         * data vector.
+                                         */
+       const std::vector<std::string> names;
+
+                                        /**
+                                         * A vector that for each of the
+                                         * n_output_variables variables of
+                                         * the current data set indicates
+                                         * whether they are scalar fields,
+                                         * parts of a vector-field, or any of
+                                         * the other supported kinds of data.
+                                         */
+       const std::vector<DataComponentInterpretation::DataComponentInterpretation>
+       data_component_interpretation;
+
+                                        /**
+                                         * Pointer to a DataPostprocessing
+                                         * object which shall be applied to
+                                         * this data vector.
+                                         */
+       SmartPointer<const dealii::DataPostprocessor<DH::space_dimension> > postprocessor;
+
+                                        /**
+                                         * Number of output variables this
+                                         * dataset provides (either number of
+                                         * components in vector valued function
+                                         * / data vector or number of computed
+                                         * quantities, if DataPostprocessor is
+                                         * applied). This variable is
+                                         * determined via and thus equivalent
+                                         * to <tt>names.size()</tt>.
+                                         */
+       unsigned int n_output_variables;
+    };
+
+
                                     /**
                                      * A data structure that holds
                                      * all data needed in one thread
@@ -720,330 +904,6 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                    << "> does not satisfy these conditions.");
 
   protected:
-                                    /**
-                                      * For each vector that has been added
-                                      * through the add_data_vector()
-                                      * functions, we need to keep track of a
-                                      * pointer to it, and allow data
-                                      * extraction from it when we generate
-                                      * patches. Unfortunately, we need to do
-                                      * this for a number of different vector
-                                      * types. Fortunately, they all have the
-                                      * same interface. So the way we go is to
-                                      * have a base class that provides the
-                                      * functions to access the vector's
-                                      * information, and to have a derived
-                                      * template class that can be
-                                      * instantiated for each vector
-                                      * type. Since the vectors all have the
-                                      * same interface, this is no big
-                                      * problem, as they can all use the same
-                                      * general templatized code.
-                                      *
-                                      * @author Wolfgang Bangerth, 2004
-                                     */
-    class DataEntryBase
-    {
-      public:
-                                        /**
-                                         * Constructor. Give a list of names
-                                         * for the individual components of
-                                         * the vector and their
-                                         * interpretation as scalar or vector
-                                         * data. This constructor assumes
-                                         * that no postprocessor is going to
-                                         * be used.
-                                         */
-       DataEntryBase (const std::vector<std::string> &names,
-                      const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation);
-
-                                        /**
-                                         * Constructor when a data
-                                         * postprocessor is going to be
-                                         * used. In that case, the names and
-                                         * vector declarations are going to
-                                         * be aquired from the postprocessor.
-                                         */
-       DataEntryBase (const DataPostprocessor<DH::space_dimension> *data_postprocessor);
-
-                                         /**
-                                          * Destructor made virtual.
-                                          */
-        virtual ~DataEntryBase ();
-
-                                         /**
-                                          * Assuming that the stored vector is
-                                          * a cell vector, extract the given
-                                          * element from it.
-                                          */
-        virtual
-        double
-        get_cell_data_value (const unsigned int cell_number) const = 0;
-
-                                         /**
-                                          * Given a FEValuesBase object,
-                                          * extract the values on the present
-                                          * cell from the vector we actually
-                                          * store.
-                                          */
-        virtual
-        void
-        get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                             std::vector<double>             &patch_values) const = 0;
-
-                                         /**
-                                          * Given a FEValuesBase object,
-                                          * extract the values on the present
-                                          * cell from the vector we actually
-                                          * store. This function does the same
-                                          * as the one above but for
-                                          * vector-valued finite elements.
-                                          */
-        virtual
-        void
-        get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                             std::vector<Vector<double> >    &patch_values_system) const = 0;
-
-                                         /**
-                                          * Given a FEValuesBase object,
-                                          * extract the gradients on the present
-                                          * cell from the vector we actually
-                                          * store.
-                                          */
-        virtual
-        void
-        get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                               std::vector<Tensor<1,DH::space_dimension> >       &patch_gradients) const = 0;
-
-                                         /**
-                                          * Given a FEValuesBase object,
-                                          * extract the gradients on the present
-                                          * cell from the vector we actually
-                                          * store. This function does the same
-                                          * as the one above but for
-                                          * vector-valued finite elements.
-                                          */
-        virtual
-        void
-        get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                               std::vector<std::vector<Tensor<1,DH::space_dimension> > > &patch_gradients_system) const = 0;
-
-                                         /**
-                                          * Given a FEValuesBase object, extract
-                                          * the second derivatives on the
-                                          * present cell from the vector we
-                                          * actually store.
-                                          */
-        virtual
-        void
-        get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                              std::vector<Tensor<2,DH::space_dimension> >       &patch_hessians) const = 0;
-
-                                         /**
-                                          * Given a FEValuesBase object, extract
-                                          * the second derivatives on the
-                                          * present cell from the vector we
-                                          * actually store. This function does
-                                          * the same as the one above but for
-                                          * vector-valued finite elements.
-                                          */
-        virtual
-        void
-        get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                              std::vector<std::vector< Tensor<2,DH::space_dimension> > > &patch_hessians_system) const = 0;
-
-                                         /**
-                                          * Clear all references to the
-                                          * vectors.
-                                          */
-        virtual void clear () = 0;
-
-                                        /**
-                                         * Determine an estimate for
-                                         * the memory consumption (in
-                                         * bytes) of this object.
-                                         */
-       virtual std::size_t memory_consumption () const = 0;
-
-                                        /**
-                                         * Names of the components of this
-                                         * data vector.
-                                         */
-       const std::vector<std::string> names;
-
-                                        /**
-                                         * A vector that for each of the
-                                         * n_output_variables variables of
-                                         * the current data set indicates
-                                         * whether they are scalar fields,
-                                         * parts of a vector-field, or any of
-                                         * the other supported kinds of data.
-                                         */
-       const std::vector<DataComponentInterpretation::DataComponentInterpretation>
-       data_component_interpretation;
-
-                                        /**
-                                         * Pointer to a DataPostprocessing
-                                         * object which shall be applied to
-                                         * this data vector.
-                                         */
-       SmartPointer<const DataPostprocessor<DH::space_dimension>,DataOut_DoFData<DH,patch_dim,patch_space_dim>  > postprocessor;
-
-                                        /**
-                                         * Number of output variables this
-                                         * dataset provides (either number of
-                                         * components in vector valued function
-                                         * / data vector or number of computed
-                                         * quantities, if DataPostprocessor is
-                                         * applied). This variable is
-                                         * determined via and thus equivalent
-                                         * to <tt>names.size()</tt>.
-                                         */
-       unsigned int n_output_variables;
-    };
-
-
-                                     /**
-                                      * Class that stores a pointer to a
-                                      * vector of type equal to the template
-                                      * argument, and provides the functions
-                                      * to extract data from it.
-                                      *
-                                      * @author Wolfgang Bangerth, 2004
-                                      */
-    template <typename VectorType>
-    class DataEntry : public DataEntryBase
-    {
-      public:
-                                        /**
-                                         * Constructor. Give a list of names
-                                         * for the individual components of
-                                         * the vector and their
-                                         * interpretation as scalar or vector
-                                         * data. This constructor assumes
-                                         * that no postprocessor is going to
-                                         * be used.
-                                         */
-       DataEntry (const VectorType               *data,
-                  const std::vector<std::string> &names,
-                  const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation);
-
-                                        /**
-                                         * Constructor when a data
-                                         * postprocessor is going to be
-                                         * used. In that case, the names and
-                                         * vector declarations are going to
-                                         * be aquired from the postprocessor.
-                                         */
-       DataEntry (const VectorType                       *data,
-                  const DataPostprocessor<DH::space_dimension> *data_postprocessor);
-
-                                         /**
-                                          * Assuming that the stored vector is
-                                          * a cell vector, extract the given
-                                          * element from it.
-                                          */
-        virtual
-        double
-        get_cell_data_value (const unsigned int cell_number) const;
-
-                                         /**
-                                          * Given a FEValuesBase object,
-                                          * extract the values on the present
-                                          * cell from the vector we actually
-                                          * store.
-                                          */
-        virtual
-        void
-        get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                             std::vector<double>             &patch_values) const;
-
-                                         /**
-                                          * Given a FEValuesBase object,
-                                          * extract the values on the present
-                                          * cell from the vector we actually
-                                          * store. This function does the same
-                                          * as the one above but for
-                                          * vector-valued finite elements.
-                                          */
-        virtual
-        void
-        get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                             std::vector<Vector<double> >    &patch_values_system) const;
-
-                                         /**
-                                          * Given a FEValuesBase object,
-                                          * extract the gradients on the present
-                                          * cell from the vector we actually
-                                          * store.
-                                          */
-        virtual
-        void
-        get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                               std::vector<Tensor<1,DH::space_dimension> >       &patch_gradients) const;
-
-                                         /**
-                                          * Given a FEValuesBase object,
-                                          * extract the gradients on the present
-                                          * cell from the vector we actually
-                                          * store. This function does the same
-                                          * as the one above but for
-                                          * vector-valued finite elements.
-                                          */
-        virtual
-        void
-        get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                               std::vector<std::vector<Tensor<1,DH::space_dimension> > > &patch_gradients_system) const;
-
-                                         /**
-                                          * Given a FEValuesBase object, extract
-                                          * the second derivatives on the
-                                          * present cell from the vector we
-                                          * actually store.
-                                          */
-        virtual
-        void
-        get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                              std::vector<Tensor<2,DH::space_dimension> >       &patch_hessians) const;
-
-                                         /**
-                                          * Given a FEValuesBase object, extract
-                                          * the second derivatives on the
-                                          * present cell from the vector we
-                                          * actually store. This function does
-                                          * the same as the one above but for
-                                          * vector-valued finite elements.
-                                          */
-        virtual
-        void
-        get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                              std::vector<std::vector< Tensor<2,DH::space_dimension> > > &patch_hessians_system) const;
-
-                                         /**
-                                          * Clear all references to the
-                                          * vectors.
-                                          */
-        virtual void clear ();
-
-                                        /**
-                                         * Determine an estimate for
-                                         * the memory consumption (in
-                                         * bytes) of this object.
-                                         */
-       virtual std::size_t memory_consumption () const;
-
-      private:
-                                         /**
-                                          * Pointer to the data
-                                          * vector. Note that
-                                          * ownership of the vector
-                                          * pointed to remains with
-                                          * the caller of this class.
-                                          */
-        const VectorType *vector;
-    };
-
-
                                     /**
                                      * Abbreviate the somewhat lengthy
                                      * name for the Patch class.
@@ -1059,13 +919,13 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      * List of data elements with vectors of
                                      * values for each degree of freedom.
                                      */
-    std::vector<std_cxx1x::shared_ptr<DataEntryBase> >  dof_data;
+    std::vector<std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> > >  dof_data;
 
                                     /**
                                      * List of data elements with vectors of
                                      * values for each cell.
                                      */
-    std::vector<std_cxx1x::shared_ptr<DataEntryBase> >  cell_data;
+    std::vector<std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> > >  cell_data;
 
                                     /**
                                      * This is a list of patches that is
@@ -1111,33 +971,6 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      */
     template <class, int, int>
     friend class DataOut_DoFData;
-
-#ifdef DEAL_II_NESTED_CLASS_FRIEND_BUG
-                                     /**
-                                      * Make DataEntry a friend. This should
-                                      * not be strictly necessary, since
-                                      * members are implicitly friends, but in
-                                      * this case it seems as if icc needs
-                                      * this. Otherwise, it complains that
-                                      * DataEntry can't derive from
-                                      * DataEntryBase since the latter is a
-                                      * private member of DataOut_DoFData.
-                                     *
-                                     * For whatever weird reason, it is also
-                                     * not enough to make just DataEntry a
-                                     * friend, but we have to fully qualify
-                                     * it for icc, while gcc 2.95 insists on
-                                     * the non-qualified version...
-                                      */
-#  ifdef DEAL_II_NESTED_CLASS_TEMPL_FRIEND_BUG
-    template <typename>
-    friend class DataEntry;
-#  else
-    template <int N1, template <int> class DH1, int N2, int N3>
-    template <typename>
-    friend class DataOut_DoFData<DH1,N2,N3>::DataEntry;
-#  endif
-#endif
 };
 
 
index 16c7ff58a9ea66d0c5d3d6af9cdbf26962854a73..961cc5b83cb7fbb1fb8b190fcad4e4473ddeb477 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors
+//    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -92,216 +92,336 @@ namespace internal
 }
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntryBase::DataEntryBase (const std::vector<std::string> &names_in,
-                             const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation)
-               :
-               names(names_in),
-               data_component_interpretation (data_component_interpretation),
-               postprocessor(0, typeid(*this).name()),
-               n_output_variables(names.size())
+namespace internal
 {
-  Assert (names.size() == data_component_interpretation.size(),
-         ExcDimensionMismatch(data_component_interpretation.size(),
-                              names.size()));
-
-                                  // check that the names use only allowed
-                                  // characters
-                                  // check names for invalid characters
-  for (unsigned int i=0; i<names.size(); ++i)
-    Assert (names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
-                                      "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-                                      "0123456789_<>()") == std::string::npos,
-           ExcInvalidCharacter (names[i],
-                                names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
-                                                           "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-                                                           "0123456789_<>()")));
-}
+  namespace DataOut
+  {
+                                     /**
+                                      * Class that stores a pointer to a
+                                      * vector of type equal to the template
+                                      * argument, and provides the functions
+                                      * to extract data from it.
+                                      *
+                                      * @author Wolfgang Bangerth, 2004
+                                      */
+    template <class DH, typename VectorType>
+    class DataEntry : public DataEntryBase<DH>
+    {
+      public:
+                                        /**
+                                         * Constructor. Give a list of names
+                                         * for the individual components of
+                                         * the vector and their
+                                         * interpretation as scalar or vector
+                                         * data. This constructor assumes
+                                         * that no postprocessor is going to
+                                         * be used.
+                                         */
+       DataEntry (const VectorType               *data,
+                  const std::vector<std::string> &names,
+                  const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation);
+
+                                        /**
+                                         * Constructor when a data
+                                         * postprocessor is going to be
+                                         * used. In that case, the names and
+                                         * vector declarations are going to
+                                         * be aquired from the postprocessor.
+                                         */
+       DataEntry (const VectorType                       *data,
+                  const DataPostprocessor<DH::space_dimension> *data_postprocessor);
+
+                                         /**
+                                          * Assuming that the stored vector is
+                                          * a cell vector, extract the given
+                                          * element from it.
+                                          */
+        virtual
+        double
+        get_cell_data_value (const unsigned int cell_number) const;
+
+                                         /**
+                                          * Given a FEValuesBase object,
+                                          * extract the values on the present
+                                          * cell from the vector we actually
+                                          * store.
+                                          */
+        virtual
+        void
+        get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                             std::vector<double>             &patch_values) const;
+
+                                         /**
+                                          * Given a FEValuesBase object,
+                                          * extract the values on the present
+                                          * cell from the vector we actually
+                                          * store. This function does the same
+                                          * as the one above but for
+                                          * vector-valued finite elements.
+                                          */
+        virtual
+        void
+        get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                             std::vector<dealii::Vector<double> >    &patch_values_system) const;
+
+                                         /**
+                                          * Given a FEValuesBase object,
+                                          * extract the gradients on the present
+                                          * cell from the vector we actually
+                                          * store.
+                                          */
+        virtual
+        void
+        get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                               std::vector<Tensor<1,DH::space_dimension> >       &patch_gradients) const;
+
+                                         /**
+                                          * Given a FEValuesBase object,
+                                          * extract the gradients on the present
+                                          * cell from the vector we actually
+                                          * store. This function does the same
+                                          * as the one above but for
+                                          * vector-valued finite elements.
+                                          */
+        virtual
+        void
+        get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                               std::vector<std::vector<Tensor<1,DH::space_dimension> > > &patch_gradients_system) const;
+
+                                         /**
+                                          * Given a FEValuesBase object, extract
+                                          * the second derivatives on the
+                                          * present cell from the vector we
+                                          * actually store.
+                                          */
+        virtual
+        void
+        get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                              std::vector<Tensor<2,DH::space_dimension> >       &patch_hessians) const;
+
+                                         /**
+                                          * Given a FEValuesBase object, extract
+                                          * the second derivatives on the
+                                          * present cell from the vector we
+                                          * actually store. This function does
+                                          * the same as the one above but for
+                                          * vector-valued finite elements.
+                                          */
+        virtual
+        void
+        get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                              std::vector<std::vector< Tensor<2,DH::space_dimension> > > &patch_hessians_system) const;
+
+                                         /**
+                                          * Clear all references to the
+                                          * vectors.
+                                          */
+        virtual void clear ();
+
+                                        /**
+                                         * Determine an estimate for
+                                         * the memory consumption (in
+                                         * bytes) of this object.
+                                         */
+       virtual std::size_t memory_consumption () const;
+
+      private:
+                                         /**
+                                          * Pointer to the data
+                                          * vector. Note that
+                                          * ownership of the vector
+                                          * pointed to remains with
+                                          * the caller of this class.
+                                          */
+        const VectorType *vector;
+    };
+
+
+
+    template <class DH>
+    DataEntryBase<DH>::DataEntryBase (const std::vector<std::string> &names_in,
+                                     const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation)
+                   :
+                   names(names_in),
+                   data_component_interpretation (data_component_interpretation),
+                   postprocessor(0, typeid(*this).name()),
+                   n_output_variables(names.size())
+    {
+      Assert (names.size() == data_component_interpretation.size(),
+             ExcDimensionMismatch(data_component_interpretation.size(),
+                                  names.size()));
+
+                                      // check that the names use only allowed
+                                      // characters
+                                      // check names for invalid characters
+      for (unsigned int i=0; i<names.size(); ++i)
+       Assert (names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+                                          "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                                          "0123456789_<>()") == std::string::npos,
+               typename dealii::DataOut<DH::dimension>::
+               ExcInvalidCharacter (names[i],
+                                    names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+                                                               "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                                                               "0123456789_<>()")));
+    }
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntryBase::DataEntryBase (const DataPostprocessor<DH::space_dimension> *data_postprocessor)
-               :
-               names(data_postprocessor->get_names()),
-               data_component_interpretation (data_postprocessor->get_data_component_interpretation()),
-               postprocessor(data_postprocessor, typeid(*this).name()),
-               n_output_variables(names.size())
-{
-  Assert (data_postprocessor->get_names().size()
-          ==
-          data_postprocessor->get_data_component_interpretation().size(),
-          ExcDimensionMismatch (data_postprocessor->get_names().size(), 
-                                data_postprocessor->get_data_component_interpretation().size()));
-  
-                                  // check that the names use only allowed
-                                  // characters
-  for (unsigned int i=0; i<names.size(); ++i)
-    Assert (names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
-                                      "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-                                      "0123456789_<>()") == std::string::npos,
-           ExcInvalidCharacter (names[i],
-                                names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
-                                                           "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-                                                           "0123456789_<>()")));
-}
+    template <class DH>
+    DataEntryBase<DH>::DataEntryBase (const DataPostprocessor<DH::space_dimension> *data_postprocessor)
+                   :
+                   names(data_postprocessor->get_names()),
+                   data_component_interpretation (data_postprocessor->get_data_component_interpretation()),
+                   postprocessor(data_postprocessor, typeid(*this).name()),
+                   n_output_variables(names.size())
+    {
+      Assert (data_postprocessor->get_names().size()
+             ==
+             data_postprocessor->get_data_component_interpretation().size(),
+             ExcDimensionMismatch (data_postprocessor->get_names().size(),
+                                   data_postprocessor->get_data_component_interpretation().size()));
+
+                                      // check that the names use only allowed
+                                      // characters
+      for (unsigned int i=0; i<names.size(); ++i)
+       Assert (names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+                                          "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                                          "0123456789_<>()") == std::string::npos,
+               typename dealii::DataOut<DH::dimension>::
+               ExcInvalidCharacter (names[i],
+                                    names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz"
+                                                               "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+                                                               "0123456789_<>()")));
+    }
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntryBase::~DataEntryBase ()
-{}
+    template <class DH>
+    DataEntryBase<DH>::~DataEntryBase ()
+    {}
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-template <typename VectorType>
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-DataEntry (const VectorType                       *data,
-          const std::vector<std::string>         &names,
-          const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation)
-               :
-                DataEntryBase (names, data_component_interpretation),
-               vector (data)
-{}
+    template <class DH, class VectorType>
+    DataEntry<DH,VectorType>::
+    DataEntry (const VectorType                       *data,
+              const std::vector<std::string>         &names,
+              const std::vector<DataComponentInterpretation::DataComponentInterpretation> &data_component_interpretation)
+                   :
+                   DataEntryBase<DH> (names, data_component_interpretation),
+                   vector (data)
+    {}
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-template <typename VectorType>
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-DataEntry (const VectorType                       *data,
-          const DataPostprocessor<DH::space_dimension> *data_postprocessor)
-               :
-                DataEntryBase (data_postprocessor),
-               vector (data)
-{}
+    template <class DH, class VectorType>
+    DataEntry<DH,VectorType>::
+    DataEntry (const VectorType                       *data,
+              const DataPostprocessor<DH::space_dimension> *data_postprocessor)
+                   :
+                   DataEntryBase<DH> (data_postprocessor),
+                   vector (data)
+    {}
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-template <typename VectorType>
-double
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-get_cell_data_value (const unsigned int cell_number) const
-{
-  return (*vector)(cell_number);
-}
+    template <class DH, class VectorType>
+    double
+    DataEntry<DH,VectorType>::
+    get_cell_data_value (const unsigned int cell_number) const
+    {
+      return (*vector)(cell_number);
+    }
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-template <typename VectorType>
-void
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                     std::vector<Vector<double> >    &patch_values_system) const
-{
-  fe_patch_values.get_function_values (*vector, patch_values_system);
-}
+    template <class DH, class VectorType>
+    void
+    DataEntry<DH,VectorType>::
+    get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                        std::vector<dealii::Vector<double> >    &patch_values_system) const
+    {
+      fe_patch_values.get_function_values (*vector, patch_values_system);
+    }
 
 
 
-template <class DH,
-         int patch_dim, int patch_space_dim>
-template <typename VectorType>
-void
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                     std::vector<double>             &patch_values) const
-{
-  fe_patch_values.get_function_values (*vector, patch_values);
-}
+    template <class DH, typename VectorType>
+    void
+    DataEntry<DH,VectorType>::
+    get_function_values (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                        std::vector<double>             &patch_values) const
+    {
+      fe_patch_values.get_function_values (*vector, patch_values);
+    }
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-template <typename VectorType>
-void
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                       std::vector<std::vector<Tensor<1,DH::space_dimension> > >   &patch_gradients_system) const
-{
-  fe_patch_values.get_function_grads (*vector, patch_gradients_system);
-}
+    template <class DH, class VectorType>
+    void
+    DataEntry<DH,VectorType>::
+    get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                           std::vector<std::vector<Tensor<1,DH::space_dimension> > >   &patch_gradients_system) const
+    {
+      fe_patch_values.get_function_grads (*vector, patch_gradients_system);
+    }
 
 
 
-template <class DH,
-         int patch_dim, int patch_space_dim>
-template <typename VectorType>
-void
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                       std::vector<Tensor<1,DH::space_dimension> >       &patch_gradients) const
-{
-  fe_patch_values.get_function_grads (*vector, patch_gradients);
-}
+    template <class DH, typename VectorType>
+    void
+    DataEntry<DH,VectorType>::
+    get_function_gradients (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                           std::vector<Tensor<1,DH::space_dimension> >       &patch_gradients) const
+    {
+      fe_patch_values.get_function_grads (*vector, patch_gradients);
+    }
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-template <typename VectorType>
-void
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                      std::vector<std::vector<Tensor<2,DH::space_dimension> > >   &patch_hessians_system) const
-{
-  fe_patch_values.get_function_2nd_derivatives (*vector, patch_hessians_system);
-}
+    template <class DH, class VectorType>
+    void
+    DataEntry<DH,VectorType>::
+    get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                          std::vector<std::vector<Tensor<2,DH::space_dimension> > >   &patch_hessians_system) const
+    {
+      fe_patch_values.get_function_2nd_derivatives (*vector, patch_hessians_system);
+    }
 
 
 
-template <class DH,
-         int patch_dim, int patch_space_dim>
-template <typename VectorType>
-void
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::
-get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
-                      std::vector<Tensor<2,DH::space_dimension> >       &patch_hessians) const
-{
-  fe_patch_values.get_function_2nd_derivatives (*vector, patch_hessians);
-}
+    template <class DH, typename VectorType>
+    void
+    DataEntry<DH,VectorType>::
+    get_function_hessians (const FEValuesBase<DH::dimension,DH::space_dimension> &fe_patch_values,
+                          std::vector<Tensor<2,DH::space_dimension> >       &patch_hessians) const
+    {
+      fe_patch_values.get_function_2nd_derivatives (*vector, patch_hessians);
+    }
 
 
 
-template <class DH,
-         int patch_dim, int patch_space_dim>
-template <typename VectorType>
-std::size_t
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::memory_consumption () const
-{
-  return (sizeof (vector) +
-         MemoryConsumption::memory_consumption (this->names));
-}
+    template <class DH, typename VectorType>
+    std::size_t
+    DataEntry<DH,VectorType>::memory_consumption () const
+    {
+      return (sizeof (vector) +
+             MemoryConsumption::memory_consumption (this->names));
+    }
 
 
 
-template <class DH, int patch_dim, int patch_space_dim>
-template <typename VectorType>
-void
-DataOut_DoFData<DH,patch_dim,patch_space_dim>::
-DataEntry<VectorType>::clear ()
-{
-  vector = 0;
+    template <class DH, class VectorType>
+    void
+    DataEntry<DH,VectorType>::clear ()
+    {
+      vector = 0;
+    }
+  }
 }
 
 
 
-
 template <class DH,
          int patch_dim, int patch_space_dim>
 DataOut_DoFData<DH,patch_dim,patch_space_dim>::DataOut_DoFData ()
@@ -431,12 +551,13 @@ add_data_vector (const VECTOR                             &vec,
            Assert (false, ExcInternalError());
     }
 
-  DataEntryBase * new_entry = new DataEntry<VECTOR>(&vec, names,
-                                                   data_component_interpretation);
+  internal::DataOut::DataEntryBase<DH> * new_entry
+    = new internal::DataOut::DataEntry<DH,VECTOR>(&vec, names,
+                                                 data_component_interpretation);
   if (actual_type == type_dof_data)
-    dof_data.push_back (std_cxx1x::shared_ptr<DataEntryBase>(new_entry));
+    dof_data.push_back (std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> >(new_entry));
   else
-    cell_data.push_back (std_cxx1x::shared_ptr<DataEntryBase>(new_entry));
+    cell_data.push_back (std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> >(new_entry));
 }
 
 
@@ -464,8 +585,9 @@ add_data_vector (const VECTOR                           &vec,
                                dofs->n_dofs(),
                                dofs->get_tria().n_active_cells()));
 
-  DataEntryBase * new_entry = new DataEntry<VECTOR>(&vec, &data_postprocessor);
-  dof_data.push_back (std_cxx1x::shared_ptr<DataEntryBase>(new_entry));
+  internal::DataOut::DataEntryBase<DH> * new_entry
+    = new internal::DataOut::DataEntry<DH,VECTOR>(&vec, &data_postprocessor);
+  dof_data.push_back (std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> >(new_entry));
 }
 
 
@@ -530,7 +652,7 @@ get_dataset_names () const
                                   // collect the names of dof
                                   // and cell data
   typedef
-    typename std::vector<std_cxx1x::shared_ptr<DataEntryBase> >::const_iterator
+    typename std::vector<std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> > >::const_iterator
     data_iterator;
 
   for (data_iterator  d=dof_data.begin();
@@ -559,7 +681,7 @@ DataOut_DoFData<DH,patch_dim,patch_space_dim>::get_vector_data_ranges () const
                                   // collect the ranges of dof
                                   // and cell data
   typedef
-    typename std::vector<std_cxx1x::shared_ptr<DataEntryBase> >::const_iterator
+    typename std::vector<std_cxx1x::shared_ptr<internal::DataOut::DataEntryBase<DH> > >::const_iterator
     data_iterator;
 
   unsigned int output_component = 0;

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.