]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
BlockVector in DataOut
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 Oct 2001 09:45:54 +0000 (09:45 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 12 Oct 2001 09:45:54 +0000 (09:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@5145 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/multigrid/multigrid.templates.h
deal.II/deal.II/include/numerics/data_out.h
deal.II/deal.II/include/numerics/vectors.h
deal.II/deal.II/source/dofs/dof_accessor.cc
deal.II/deal.II/source/fe/fe_values.cc
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
deal.II/deal.II/source/numerics/data_out_stack.cc
deal.II/deal.II/source/numerics/vectors.cc
deal.II/doc/news/2001/c-3-2.html

index 8874e31296235ceaad76d53fa4c4dfdc21e4eccb..2519312541000f692930abb44fc30722397996b6 100644 (file)
@@ -15,7 +15,7 @@
 
 
 #include <dofs/dof_constraints.h>
-#include <numerics/data_out.h>
+//#include <numerics/data_out.h>
 #include <multigrid/multigrid.h>
 #include <algorithm>
 #include <fstream>
@@ -185,52 +185,52 @@ Multigrid<dim>::copy_from_mg(Vector<number> &dst) const
 
 template <int dim>
 void
-Multigrid<dim>::print_vector (const unsigned int level,
-                             const Vector<double>& v,
-                             const char* name) const
+Multigrid<dim>::print_vector (const unsigned int /*level*/,
+                             const Vector<double>& /*v*/,
+                             const char* /*name*/) const
 {
-  if (level!=maxlevel)
-    return;
+//    if (level!=maxlevel)
+//      return;
   
-  const DoFHandler<dim>* dof = mg_dof_handler;
+//    const DoFHandler<dim>* dof = mg_dof_handler;
   
-  Vector<double> out_vector(dof->n_dofs());
+//    Vector<double> out_vector(dof->n_dofs());
 
-  out_vector = -10000;
+//    out_vector = -10000;
   
-  const unsigned int dofs_per_cell = mg_dof_handler->get_fe().dofs_per_cell;
-
-  std::vector<unsigned int> global_dof_indices (dofs_per_cell);
-  std::vector<unsigned int> level_dof_indices (dofs_per_cell);
-
-  typename DoFHandler<dim>::active_cell_iterator
-    global_cell = dof->begin_active(level);
-  typename MGDoFHandler<dim>::active_cell_iterator
-    level_cell = mg_dof_handler->begin_active(level);
-  const typename MGDoFHandler<dim>::cell_iterator
-    endc = mg_dof_handler->end(level);
-
-                                  // traverse all cells and copy the
-                                  // data appropriately to the output
-                                  // vector
-  for (; level_cell != endc; ++level_cell, ++global_cell)
-    {
-      global_cell->get_dof_indices (global_dof_indices);
-      level_cell->get_mg_dof_indices(level_dof_indices);
-
-                                      // copy level-wise data to
-                                      // global vector
-      for (unsigned int i=0; i<dofs_per_cell; ++i)
-       out_vector(global_dof_indices[i])
-         = v(level_dof_indices[i]);
-    }
-
-  std::ofstream out_file(name);
-  DataOut<dim> out;
-  out.attach_dof_handler(*dof);
-  out.add_data_vector(out_vector, "v");
-  out.build_patches(5);
-  out.write_gnuplot(out_file);
+//    const unsigned int dofs_per_cell = mg_dof_handler->get_fe().dofs_per_cell;
+
+//    std::vector<unsigned int> global_dof_indices (dofs_per_cell);
+//    std::vector<unsigned int> level_dof_indices (dofs_per_cell);
+
+//    typename DoFHandler<dim>::active_cell_iterator
+//      global_cell = dof->begin_active(level);
+//    typename MGDoFHandler<dim>::active_cell_iterator
+//      level_cell = mg_dof_handler->begin_active(level);
+//    const typename MGDoFHandler<dim>::cell_iterator
+//      endc = mg_dof_handler->end(level);
+
+//                                // traverse all cells and copy the
+//                                // data appropriately to the output
+//                                // vector
+//    for (; level_cell != endc; ++level_cell, ++global_cell)
+//      {
+//        global_cell->get_dof_indices (global_dof_indices);
+//        level_cell->get_mg_dof_indices(level_dof_indices);
+
+//                                    // copy level-wise data to
+//                                    // global vector
+//        for (unsigned int i=0; i<dofs_per_cell; ++i)
+//     out_vector(global_dof_indices[i])
+//       = v(level_dof_indices[i]);
+//      }
+
+//    std::ofstream out_file(name);
+//    DataOut<dim> out;
+//    out.attach_dof_handler(*dof);
+//    out.add_data_vector(out_vector, "v");
+//    out.build_patches(5);
+//    out.write_gnuplot(out_file);
 }
 
 #endif
index 128e126a51d052efc676194e2b756ac211313d2e..47a8b04f46c4f3ca9d87b6c655e5ce05d1186a9c 100644 (file)
@@ -16,6 +16,7 @@
 #include <base/data_out_base.h>
 #include <dofs/dof_handler.h>
 
+template<typename number> class BlockVector;
 
 
 /**
@@ -266,7 +267,8 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      * class to see which characters
                                      * are valid and which are not.
                                      */
-    void add_data_vector (const Vector<double>           &data,
+  template <class VECTOR>
+    void add_data_vector (const VECTOR                   &data,
                          const std::vector<std::string> &names,
                          const DataVectorType            type = type_automatic);
 
@@ -294,7 +296,8 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      * underscore and the number of
                                      * each component to @p{name}
                                      */
-    void add_data_vector (const Vector<double> &data,
+  template <class VECTOR>
+    void add_data_vector (const VECTOR         &data,
                          const std::string    &name,
                          const DataVectorType  type = type_automatic);
 
@@ -405,6 +408,12 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                          * STL classes).
                                          */
        DataEntry (const Vector<double>           *data = 0,
+                  const std::vector<std::string> &names = std::vector<std::string>());
+
+                                        /**
+                                         * Constructor for block vector data.
+                                         */
+       DataEntry (const BlockVector<double>      *data,
                   const std::vector<std::string> &names = std::vector<std::string>());
 
                                         /**
@@ -421,8 +430,22 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                          * pointed to remains with
                                          * the caller of this class.
                                          */
-       const Vector<double> *data;
-       
+      const Vector<double> *single_data;
+
+                                      /**
+                                       * Pointer to a block vector of
+                                       * data.  Either this pointer
+                                       * or the previous is used,
+                                       * depending on the stored
+                                       * vector type.
+                                       */
+      const BlockVector<double>* block_data;
+
+                                      /**
+                                       * True if stored vector is a block vector.
+                                       */
+      bool has_block;
+
                                         /**
                                          * Names of the components of this
                                          * data vector.
index b3c947646220115265a0cdadb69e7d4cbe1edc28..4fcf3abe4ffe34b1ce69232c6e20773ec72748ed 100644 (file)
@@ -746,12 +746,12 @@ class VectorTools
                                      * See the general documentation of this
                                      * class for more information.
                                      */
-    template <int dim>
+    template <int dim, class InVector, class OutVector>
     static void integrate_difference (const Mapping<dim>    &mapping,
                                      const DoFHandler<dim> &dof,
-                                     const Vector<double>  &fe_function,
+                                     const InVector        &fe_function,
                                      const Function<dim>   &exact_solution,
-                                     Vector<float>         &difference,
+                                     OutVector             &difference,
                                      const Quadrature<dim> &q,
                                      const NormType        &norm,
                                      const Function<dim>   *weight=0);
@@ -761,11 +761,11 @@ class VectorTools
                                      * function, see above, with
                                      * @p{mapping=MappingQ1<dim>()}.
                                      */
-    template <int dim>
+    template <int dim, class InVector, class OutVector>
     static void integrate_difference (const DoFHandler<dim> &dof,
-                                     const Vector<double>  &fe_function,
+                                     const InVector        &fe_function,
                                      const Function<dim>   &exact_solution,
-                                     Vector<float>         &difference,
+                                     OutVector             &difference,
                                      const Quadrature<dim> &q,
                                      const NormType        &norm,
                                      const Function<dim>   *weight=0);
index d7aa8ea17e8b52ea2a2e0e06bbf16e4adfc19ce5..9b5495a782a4d8fd3e67f0e8cb7b6104ea78ad2d 100644 (file)
@@ -847,6 +847,14 @@ template
 void
 DoFObjectAccessor<3,deal_II_dimension>::set_dof_values (const Vector<double>  &,
                                                        BlockVector<double> &) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension>::get_dof_values (const BlockVector<float> &,
+                                                       Vector<float>       &) const;
+template
+void
+DoFObjectAccessor<3,deal_II_dimension>::set_dof_values (const Vector<float>  &,
+                                                       BlockVector<float> &) const;
 
 
 #endif
@@ -891,6 +899,18 @@ DoFCellAccessor<deal_II_dimension>::
 set_dof_values_by_interpolation(const Vector<double> &,
                                BlockVector<double> &) const;
 
+template
+void
+DoFCellAccessor<deal_II_dimension>::
+get_interpolated_dof_values (const BlockVector<float> &,
+                            Vector<float>       &) const;
+
+template
+void
+DoFCellAccessor<deal_II_dimension>::
+set_dof_values_by_interpolation(const Vector<float> &,
+                               BlockVector<float> &) const;
+
 
 template class DoFAccessor<deal_II_dimension>;
 
index 408d6b3bddbc1b631facdddef6321768abd114c4..ab4e9353649d43b758a16044545fb23919bc7368 100644 (file)
@@ -835,14 +835,23 @@ template class FESubfaceValues<deal_II_dimension>;
 //-----------------------------------------------------------------------------
 
 template
-void FEValuesBase<deal_II_dimension>::get_function_values (const Vector<double> &,
-                                                          std::vector<double>       &) const;
+void FEValuesBase<deal_II_dimension>::get_function_values (const Vector<double>&,
+                                                          std::vector<double>&) const;
 template
-void FEValuesBase<deal_II_dimension>::get_function_values (const Vector<float> &,
-                                                          std::vector<float>      &) const;
+void FEValuesBase<deal_II_dimension>::get_function_values (const Vector<float>&,
+                                                          std::vector<double>&) const;
 template
-void FEValuesBase<deal_II_dimension>::get_function_values (const BlockVector<double> &,
-                                                          std::vector<double>      &) const;
+void FEValuesBase<deal_II_dimension>::get_function_values (const Vector<float>&,
+                                                          std::vector<float>&) const;
+template
+void FEValuesBase<deal_II_dimension>::get_function_values (const BlockVector<double>&,
+                                                          std::vector<double>&) const;
+template
+void FEValuesBase<deal_II_dimension>::get_function_values (const BlockVector<float>&,
+                                                          std::vector<double>&) const;
+template
+void FEValuesBase<deal_II_dimension>::get_function_values (const BlockVector<float>&,
+                                                          std::vector<float>&) const;
 
 //-----------------------------------------------------------------------------
 
@@ -850,11 +859,17 @@ template
 void FEValuesBase<deal_II_dimension>::get_function_values (const Vector<double> &,
                                                           std::vector<Vector<double> > &) const;
 template
+void FEValuesBase<deal_II_dimension>::get_function_values (const Vector<float> &,
+                                                          std::vector<Vector<double> > &) const;
+template
 void FEValuesBase<deal_II_dimension>::get_function_values (const Vector<float> &,
                                                           std::vector<Vector<float> > &) const;
 template
 void FEValuesBase<deal_II_dimension>::get_function_values (const BlockVector<double> &,
                                                           std::vector<Vector<double> >     &) const;
+template
+void FEValuesBase<deal_II_dimension>::get_function_values (const BlockVector<float> &,
+                                                          std::vector<Vector<double> >     &) const;
 
 //-----------------------------------------------------------------------------
 
@@ -879,6 +894,9 @@ void FEValuesBase<deal_II_dimension>::get_function_grads (const Vector<float> &,
 template
 void FEValuesBase<deal_II_dimension>::get_function_grads (const BlockVector<double> &,
                                                          std::vector<std::vector<Tensor<1,deal_II_dimension> > > &) const;
+template
+void FEValuesBase<deal_II_dimension>::get_function_grads (const BlockVector<float> &,
+                                                         std::vector<std::vector<Tensor<1,deal_II_dimension> > > &) const;
 
 //-----------------------------------------------------------------------------
 
index 9bf1555c511383676b0d8d489d19165185199629..d08c5e76dddf8bb836364da9e25574c9c4e74fd8 100644 (file)
@@ -15,6 +15,7 @@
 #include <base/quadrature_lib.h>
 #include <base/memory_consumption.h>
 #include <lac/vector.h>
+#include <lac/block_vector.h>
 #include <numerics/data_out.h>
 #include <grid/tria.h>
 #include <dofs/dof_handler.h>
@@ -42,7 +43,19 @@ template <int dof_handler_dim, int patch_dim, int patch_space_dim>
 DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::DataEntry::
 DataEntry (const Vector<double> *data,
           const std::vector<std::string> &names) :
-               data(data),
+               single_data(data),
+               has_block(false),
+               names(names)
+{};
+
+
+
+template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::DataEntry::
+DataEntry (const BlockVector<double> *data,
+          const std::vector<std::string> &names) :
+               block_data(data),
+               has_block(true),
                names(names)
 {};
 
@@ -53,7 +66,7 @@ unsigned int
 DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
 DataEntry::memory_consumption () const
 {
-  return (sizeof (data) +
+  return (sizeof (single_data) + sizeof (block_data) +
          MemoryConsumption::memory_consumption (names));
 };
 
@@ -95,9 +108,10 @@ attach_dof_handler (const DoFHandler<dof_handler_dim> &d)
 
 
 template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <class VECTOR>
 void
 DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
-add_data_vector (const Vector<double>           &vec,
+add_data_vector (const VECTOR                   &vec,
                 const std::vector<std::string> &names,
                 const DataVectorType            type)
 {
@@ -162,9 +176,10 @@ add_data_vector (const Vector<double>           &vec,
 
 
 template <int dof_handler_dim, int patch_dim, int patch_space_dim>
+template <class VECTOR>
 void
 DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::
-add_data_vector (const Vector<double> &vec,
+add_data_vector (const VECTOR         &vec,
                 const std::string    &name,
                 const DataVectorType  type)
 {
@@ -215,10 +230,16 @@ void
 DataOut_DoFData<dof_handler_dim,patch_dim,patch_space_dim>::clear_input_data_references ()
 {
   for (unsigned int i=0; i<dof_data.size(); ++i)
-    dof_data[i].data = 0;
+    {
+      dof_data[i].single_data = 0;
+      dof_data[i].block_data = 0;
+    }
   
   for (unsigned int i=0; i<cell_data.size(); ++i)
-    cell_data[i].data = 0;
+    {
+      cell_data[i].single_data = 0;
+      cell_data[i].block_data = 0;
+    }
 
   if (dofs != 0)
     {
@@ -345,16 +366,26 @@ void DataOut<dim>::build_some_patches (Data data)
            {
              if (data.n_components == 1)
                {
-                 fe_patch_values.get_function_values (*dof_data[dataset].data,
-                                                      data.patch_values);
+                 if (dof_data[dataset].has_block)
+                   fe_patch_values.get_function_values (*dof_data[dataset].block_data,
+                                                        data.patch_values);
+                 else
+                   fe_patch_values.get_function_values (*dof_data[dataset].single_data,
+                                                        data.patch_values);
+
                  for (unsigned int q=0; q<n_q_points; ++q)
                    patch->data(dataset,q) = data.patch_values[q];
                }
              else
                                                 // system of components
                {
-                 fe_patch_values.get_function_values (*dof_data[dataset].data,
-                                                      data.patch_values_system);
+                 if (dof_data[dataset].has_block)
+                   fe_patch_values.get_function_values (*dof_data[dataset].block_data,
+                                                        data.patch_values_system);
+                 else
+                   fe_patch_values.get_function_values (*dof_data[dataset].single_data,
+                                                        data.patch_values_system);
+
                  for (unsigned int component=0; component<data.n_components;
                       ++component)
                    for (unsigned int q=0; q<n_q_points; ++q)
@@ -366,10 +397,18 @@ void DataOut<dim>::build_some_patches (Data data)
                                           // then do the cell data
          for (unsigned int dataset=0; dataset<cell_data.size(); ++dataset)
            {
-             const double value = (*cell_data[dataset].data)(cell_number);
-             for (unsigned int q=0; q<n_q_points; ++q)
-               patch->data(dataset+dof_data.size()*data.n_components,q) =
-                 value;
+             if (cell_data[dataset].has_block)
+               {
+                 const double value = (*cell_data[dataset].block_data)(cell_number);
+                 for (unsigned int q=0; q<n_q_points; ++q)
+                   patch->data(dataset+dof_data.size()*data.n_components,q) =
+                     value;
+               } else {
+                 const double value = (*cell_data[dataset].single_data)(cell_number);
+                 for (unsigned int q=0; q<n_q_points; ++q)
+                   patch->data(dataset+dof_data.size()*data.n_components,q) =
+                     value;
+               } 
            };
        };
                                       // next cell (patch) in this thread
@@ -501,11 +540,75 @@ DataOut<dim>::next_cell (const typename DoFHandler<dim>::cell_iterator &cell)
 
 // explicit instantiations
 template class DataOut_DoFData<deal_II_dimension,deal_II_dimension>;
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension>::add_data_vector (
+  const Vector<double> &vec,
+  const std::vector<std::string>    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension>::add_data_vector (
+  const BlockVector<double> &vec,
+  const std::vector<std::string>    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension>::add_data_vector (
+  const Vector<double> &vec,
+  const std::string    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension>::add_data_vector (
+  const BlockVector<double> &vec,
+  const std::string    &name,
+  const DataVectorType  type);
+
 template class DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>;
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::add_data_vector (
+  const Vector<double> &vec,
+  const std::vector<std::string>    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::add_data_vector (
+  const BlockVector<double> &vec,
+  const std::vector<std::string>    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::add_data_vector (
+  const Vector<double> &vec,
+  const std::string    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension+1>::add_data_vector (
+  const BlockVector<double> &vec,
+  const std::string    &name,
+  const DataVectorType  type);
+
 template class DataOut<deal_II_dimension>;
 
 
+
 // for 3d, also generate an extra class
 #if deal_II_dimension >= 2
 template class DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>;
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::add_data_vector (
+  const Vector<double> &vec,
+  const std::vector<std::string>    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::add_data_vector (
+  const BlockVector<double> &vec,
+  const std::vector<std::string>    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::add_data_vector (
+  const Vector<double> &vec,
+  const std::string    &name,
+  const DataVectorType  type);
+template void
+DataOut_DoFData<deal_II_dimension,deal_II_dimension-1,deal_II_dimension>::add_data_vector (
+  const BlockVector<double> &vec,
+  const std::string    &name,
+  const DataVectorType  type);
+
 #endif
index 2cedfbe3276376af8583e7af35588cccae4333d7..0467ac8487d6e9f2529c34876dd46f7134f4ea83 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <base/quadrature_lib.h>
 #include <lac/vector.h>
+#include <lac/block_vector.h>
 #include <numerics/data_out_faces.h>
 #include <grid/tria.h>
 #include <dofs/dof_handler.h>
@@ -78,16 +79,26 @@ void DataOutFaces<dim>::build_some_patches (Data data)
            {
              if (data.n_components == 1)
                {
-                 fe_patch_values.get_function_values (*dof_data[dataset].data,
-                                                      data.patch_values);
+                 if (dof_data[dataset].has_block)
+                   fe_patch_values.get_function_values (*dof_data[dataset].block_data,
+                                                        data.patch_values);
+                 else
+                   fe_patch_values.get_function_values (*dof_data[dataset].single_data,
+                                                        data.patch_values);
+
                  for (unsigned int q=0; q<n_q_points; ++q)
                    patch->data(dataset,q) = data.patch_values[q];
                }
              else
                                                 // system of components
                {
-                 fe_patch_values.get_function_values (*dof_data[dataset].data,
-                                                      data.patch_values_system);
+                 if (dof_data[dataset].has_block)
+                   fe_patch_values.get_function_values (*dof_data[dataset].block_data,
+                                                        data.patch_values_system);
+                 else
+                   fe_patch_values.get_function_values (*dof_data[dataset].single_data,
+                                                        data.patch_values_system);
+
                  for (unsigned int component=0; component<data.n_components;
                       ++component)
                    for (unsigned int q=0; q<n_q_points; ++q)
@@ -99,10 +110,18 @@ void DataOutFaces<dim>::build_some_patches (Data data)
                                           // then do the cell data
          for (unsigned int dataset=0; dataset<cell_data.size(); ++dataset)
            {
-             const double value = (*cell_data[dataset].data)(face_number);
-             for (unsigned int q=0; q<n_q_points; ++q)
-               patch->data(dataset+dof_data.size()*data.n_components,q) =
-                 value;
+             if (cell_data[dataset].has_block)
+               {
+                 const double value = (*cell_data[dataset].block_data)(face_number);
+                 for (unsigned int q=0; q<n_q_points; ++q)
+                   patch->data(dataset+dof_data.size()*data.n_components,q) =
+                     value;
+               } else {
+                 const double value = (*cell_data[dataset].single_data)(face_number);
+                 for (unsigned int q=0; q<n_q_points; ++q)
+                   patch->data(dataset+dof_data.size()*data.n_components,q) =
+                     value;
+               } 
            };
        };
                                       // next cell (patch) in this thread
index 877d5446196c14c9bc6adb9c261f4d3b31e88971..b1230087a33ae52989b591d7173c508ddae40a20 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <base/quadrature_lib.h>
 #include <lac/vector.h>
+#include <lac/block_vector.h>
 #include <numerics/data_out_rotation.h>
 #include <grid/tria.h>
 #include <dofs/dof_handler.h>
@@ -165,8 +166,13 @@ void DataOutRotation<dim>::build_some_patches (Data data)
                {
                  if (data.n_components == 1)
                    {
-                     fe_patch_values.get_function_values (*dof_data[dataset].data,
-                                                          data.patch_values);
+                     if (dof_data[dataset].has_block)
+                       fe_patch_values.get_function_values (*dof_data[dataset].block_data,
+                                                            data.patch_values);
+                     else
+                       fe_patch_values.get_function_values (*dof_data[dataset].single_data,
+                                                            data.patch_values);
+
                      switch (dim)
                        {
                          case 1:
@@ -195,8 +201,13 @@ void DataOutRotation<dim>::build_some_patches (Data data)
                  else
                                                     // system of components
                    {
-                     fe_patch_values.get_function_values (*dof_data[dataset].data,
-                                                          data.patch_values_system);
+                     if (dof_data[dataset].has_block)
+                       fe_patch_values.get_function_values (*dof_data[dataset].block_data,
+                                                            data.patch_values_system);
+                     else
+                       fe_patch_values.get_function_values (*dof_data[dataset].single_data,
+                                                            data.patch_values_system);
+
                      for (unsigned int component=0; component<data.n_components;
                           ++component)
                        {
@@ -231,7 +242,9 @@ void DataOutRotation<dim>::build_some_patches (Data data)
                                               // then do the cell data
              for (unsigned int dataset=0; dataset<cell_data.size(); ++dataset)
                {
-                 const double value = (*cell_data[dataset].data)(cell_number);
+                 const double value = cell_data[dataset].has_block ?
+                   (*cell_data[dataset].block_data)(cell_number) :
+                   (*cell_data[dataset].single_data)(cell_number);
                  switch (dim)
                    {
                      case 1:
index 7cc13423a375183b784d6e05f5b5b88f21c9fa10..a9caedd691a7d8940cc400c88214a65f8a751b87 100644 (file)
@@ -16,6 +16,7 @@
 #include <base/quadrature_lib.h>
 #include <base/memory_consumption.h>
 #include <lac/vector.h>
+#include <lac/block_vector.h>
 #include <dofs/dof_handler.h>
 #include <dofs/dof_accessor.h>
 #include <grid/tria_iterator.h>
index 3e9d1dd42f19b0dbe608946c5da54b2750469da0..b859fea894a46c3aebd3c3f9996d6ae6fb36ae93 100644 (file)
@@ -1057,13 +1057,13 @@ VectorTools::project_boundary_values (const DoFHandler<dim>    &dof,
 
 
 
-template <int dim>
+template <int dim, class InVector, class OutVector>
 void
 VectorTools::integrate_difference (const Mapping<dim>    &mapping,
                                   const DoFHandler<dim> &dof,
-                                  const Vector<double>  &fe_function,
+                                  const InVector        &fe_function,
                                   const Function<dim>   &exact_solution,
-                                  Vector<float>         &difference,
+                                  OutVector             &difference,
                                   const Quadrature<dim> &q,
                                   const NormType        &norm,
                                   const Function<dim>   *weight)
@@ -1389,12 +1389,12 @@ VectorTools::integrate_difference (const Mapping<dim>    &mapping,
 };
 
 
-template <int dim>
+template <int dim, class InVector, class OutVector>
 void
 VectorTools::integrate_difference (const DoFHandler<dim>    &dof,
-                                  const Vector<double>     &fe_function,
+                                  const InVector           &fe_function,
                                   const Function<dim>      &exact_solution,
-                                  Vector<float>            &difference,
+                                  OutVector                &difference,
                                   const Quadrature<dim>    &q,
                                   const NormType           &norm,
                                   const Function<dim>      *weight)
@@ -1536,6 +1536,125 @@ void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
                                        const Quadrature<deal_II_dimension> &,
                                        const NormType                      &,
                                        const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const Mapping<deal_II_dimension>    &,
+                                       const DoFHandler<deal_II_dimension> &,
+                                       const Vector<double>                &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<double>                      &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
+                                       const Vector<double>                &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<double>                      &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const Mapping<deal_II_dimension>    &,
+                                       const DoFHandler<deal_II_dimension> &,
+                                       const Vector<float>                 &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<float>                       &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
+                                       const Vector<float>                 &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<float>                       &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const Mapping<deal_II_dimension>    &,
+                                       const DoFHandler<deal_II_dimension> &,
+                                       const Vector<float>                 &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<double>                      &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
+                                       const Vector<float>                 &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<double>                      &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const Mapping<deal_II_dimension>    &,
+                                       const DoFHandler<deal_II_dimension> &,
+                                       const BlockVector<double>                &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<float>                       &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
+                                       const BlockVector<double>                &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<float>                       &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const Mapping<deal_II_dimension>    &,
+                                       const DoFHandler<deal_II_dimension> &,
+                                       const BlockVector<double>                &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<double>                      &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
+                                       const BlockVector<double>                &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<double>                      &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const Mapping<deal_II_dimension>    &,
+                                       const DoFHandler<deal_II_dimension> &,
+                                       const BlockVector<float>                 &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<float>                       &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
+                                       const BlockVector<float>                 &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<float>                       &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const Mapping<deal_II_dimension>    &,
+                                       const DoFHandler<deal_II_dimension> &,
+                                       const BlockVector<float>                 &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<double>                      &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
+template
+void VectorTools::integrate_difference (const DoFHandler<deal_II_dimension> &,
+                                       const BlockVector<float>                 &,
+                                       const Function<deal_II_dimension>   &,
+                                       Vector<double>                      &,
+                                       const Quadrature<deal_II_dimension> &,
+                                       const NormType                      &,
+                                       const Function<deal_II_dimension>   *);
 #if deal_II_dimension != 1
 template
 void VectorTools::project_boundary_values (const Mapping<deal_II_dimension>     &,
index a887b90a248b3068de40fee6269ada543b63145f..214920348b2fa2d0e5bd08a5be231d54501c8592 100644 (file)
@@ -84,6 +84,27 @@ documentation, etc</a>.
 <h3>deal.II</h3>
 
 <ol>
+  <li> <p>
+       Improved: Both functions <code
+       class="class">DataOut_DoFData</code>::<code
+       class="member">add_data_vector</code> accepts <code
+       class="class">BlockVector</code> as argument.
+       <br>
+       (GK 2001/10/12)
+       </p>
+
+  <li> <p>
+       Improved: Both functions <code
+       class="class">VectorTools</code>::<code
+       class="member">integrate_difference</code> take ingoing and
+       outgoing vector types as template arguments. This allows
+       applying them to <code class="class">BlockVector</code> and of
+       outputting a vector of doubles suitable for <code
+       class="class">DataOut</code>.
+       <br>
+       (GK 2001/10/12)
+       </p>
+
   <li> <p>
        Fixed: Functions creating sparsity patterns for DG elements in
        <code class="class">DoFTools</code> get the pattern type as

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.