]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Allow IndexSet as a vector type in FEValues::get_function_values and friends; consequ...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 14 Feb 2012 09:52:56 +0000 (09:52 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 14 Feb 2012 09:52:56 +0000 (09:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@25066 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/fe/fe_values.h
deal.II/include/deal.II/numerics/data_out.h
deal.II/source/fe/fe_values.cc
deal.II/source/fe/fe_values.inst.in
deal.II/source/numerics/data_out.cc
deal.II/source/numerics/data_out.inst.in

index 920122e5743d0361e42a42cac2eaa1eaff65958f..85588c0e13c9758f678f2cf6424aac606e243216 100644 (file)
@@ -34,6 +34,18 @@ inconvenience this causes.
 <h3>General</h3>
 
 <ol>
+<li> New: Functions like FEValues::get_function_values have long been
+able to extract values from pretty much any vector kind given to it (e.g.
+of kind Vector, BlockVector, PETScWrappers::Vector, etc). The list of
+allowed "vector" types now also includes IndexSet, which is interpreted
+as a vector of elements that are either zero or one, depending on whether
+an index is in the IndexSet or not.
+<br>
+As a consequence of this, the DataOut::add_data_vector functions now also
+work for such types of vectors, a use demonstrated in step-41.
+<br>
+(Wolfgang Bangerth, 2012/02/14)
+
 <li> New: It has long been a nuisance that the deal.II vector classes
 could only be accessed using <code>operator()</code> whereas the C++
 <code>std::vector</code> class required <code>operator[]</code>. This
index a7cac2ec3fdcba2b4fe633d5ec64b13593da3917..cdb1f571c04defaf07128d94dfbd4f41d2df28ad 100644 (file)
@@ -1,7 +1,7 @@
 //---------------------------------------------------------------------------
 //    $Id$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors
+//    Copyright (C) 1998, 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
@@ -1992,7 +1992,13 @@ class FEValuesBase : protected FEValuesData<dim,spacedim>,
                                      * associated with the DofHandler
                                      * object with which this
                                      * FEValues object was last
-                                     * initialized.
+                                     * initialized. Alternatively,
+                                     * if the vector argument is of
+                                     * type IndexSet, then the function
+                                     * is represented as one that
+                                     * is either zero or one, depending
+                                     * on whether a DoF index is in
+                                     * the set or not.
                                      */
     template <class InputVector, typename number>
     void get_function_values (const InputVector& fe_function,
@@ -2233,7 +2239,13 @@ class FEValuesBase : protected FEValuesData<dim,spacedim>,
                                      * associated with the DofHandler
                                      * object with which this
                                      * FEValues object was last
-                                     * initialized.
+                                     * initialized. Alternatively,
+                                     * if the vector argument is of
+                                     * type IndexSet, then the function
+                                     * is represented as one that
+                                     * is either zero or one, depending
+                                     * on whether a DoF index is in
+                                     * the set or not.
                                      */
     template <class InputVector>
     void get_function_gradients (const InputVector      &fe_function,
@@ -2399,7 +2411,13 @@ class FEValuesBase : protected FEValuesData<dim,spacedim>,
                                      * associated with the DofHandler
                                      * object with which this
                                      * FEValues object was last
-                                     * initialized.
+                                     * initialized. Alternatively,
+                                     * if the vector argument is of
+                                     * type IndexSet, then the function
+                                     * is represented as one that
+                                     * is either zero or one, depending
+                                     * on whether a DoF index is in
+                                     * the set or not.
                                      */
     template <class InputVector>
     void
@@ -2558,7 +2576,13 @@ class FEValuesBase : protected FEValuesData<dim,spacedim>,
                                      * associated with the DofHandler
                                      * object with which this
                                      * FEValues object was last
-                                     * initialized.
+                                     * initialized. Alternatively,
+                                     * if the vector argument is of
+                                     * type IndexSet, then the function
+                                     * is represented as one that
+                                     * is either zero or one, depending
+                                     * on whether a DoF index is in
+                                     * the set or not.
                                      */
     template <class InputVector, typename number>
     void
index cc9f8d8d5fc7b5502b53712ba609b4c90fcce055..f55315369a58f719ee99d6bd455915cc6faff37f 100644 (file)
@@ -592,16 +592,14 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      *
                                      * If it is a vector holding DoF
                                      * data, the names given shall be
-                                     * one for each component, if the
-                                     * finite element in use is
-                                     * composed of several
-                                     * subelements.  If it is a
-                                     * finite element composed of
-                                     * only one subelement, then
-                                     * there is another function
-                                     * following which takes a single
-                                     * name instead of a vector of
-                                     * names.
+                                     * one for each component of the
+                                     * underlying finite element.  If
+                                     * it is a finite element
+                                     * composed of only one
+                                     * subelement, then there is
+                                     * another function following
+                                     * which takes a single name
+                                     * instead of a vector of names.
                                      *
                                      * The data_component_interpretation
                                      * argument contains information about
@@ -648,11 +646,17 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      * class to see which characters
                                      * are valid and which are not.
                                      *
-                                     * The actual type for the template
-                                     * argument may be any vector type from
-                                     * which FEValues can extract values
-                                     * on a cell using the
-                                     * FEValuesBase::get_function_values() function.
+                                     * @note The actual type for the
+                                     * vector argument may be any
+                                     * vector type from which
+                                     * FEValues can extract values on
+                                     * a cell using the
+                                     * FEValuesBase::get_function_values()
+                                     * function. In particular, this
+                                     * includes all of the usual
+                                     * vector types, but also
+                                     * IndexSet (see step-41 for a
+                                     * use of this).
                                      */
     template <class VECTOR>
     void add_data_vector (const VECTOR                   &data,
@@ -715,11 +719,17 @@ class DataOut_DoFData : public DataOutInterface<patch_dim,patch_space_dim>
                                      * type is also known implicitly and does
                                      * not have to be given.
                                      *
-                                     * The actual type for the template
-                                     * argument may be any vector type from
-                                     * which FEValues can extract values
-                                     * on a cell using the
-                                     * FEValuesBase::get_function_values() function.
+                                     * @note The actual type for the
+                                     * vector argument may be any
+                                     * vector type from which
+                                     * FEValues can extract values on
+                                     * a cell using the
+                                     * FEValuesBase::get_function_values()
+                                     * function. In particular, this
+                                     * includes all of the usual
+                                     * vector types, but also
+                                     * IndexSet (see step-41 for a
+                                     * use of this).
                                      */
     template <class VECTOR>
     void add_data_vector (const VECTOR                           &data,
index 79182e569b4ec146e45025a61954b8ba08b15aaa..3c9aa45faf80dc2645bb3ee876827057e9cff60d 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors
+//    Copyright (C) 1998, 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
 DEAL_II_NAMESPACE_OPEN
 
 
+namespace
+{
+  template <class VectorType>
+  double
+  get_vector_element (const VectorType &vector,
+                     const unsigned int cell_number)
+  {
+    return vector[cell_number];
+  }
+
+
+  double
+  get_vector_element (const IndexSet &is,
+                     const unsigned int cell_number)
+  {
+    return (is.is_element(cell_number) ? 1 : 0);
+  }
+
+
+
+  template <typename VectorType>
+  struct ValueType
+  {
+      typedef typename VectorType::value_type type;
+  };
+
+
+  template <>
+  struct ValueType<IndexSet>
+  {
+      typedef double type;
+  };
+}
+
+
 namespace
 {
   template <int dim, int spacedim>
@@ -356,7 +391,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (values.begin(), values.end(), value_type());
@@ -398,7 +433,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (gradients.begin(), gradients.end(), gradient_type());
@@ -441,7 +476,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (hessians.begin(), hessians.end(), hessian_type());
@@ -484,7 +519,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (laplacians.begin(), laplacians.end(), value_type());
@@ -526,7 +561,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (values.begin(), values.end(), value_type());
@@ -588,7 +623,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (gradients.begin(), gradients.end(), gradient_type());
@@ -651,7 +686,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (symmetric_gradients.begin(), symmetric_gradients.end(),
@@ -716,7 +751,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (divergences.begin(), divergences.end(), divergence_type());
@@ -774,7 +809,7 @@ namespace FEValuesViews
      Assert (fe_function.size () == fe_values.present_cell->n_dofs_for_dof_handler (),
          ExcDimensionMismatch (fe_function.size (), fe_values.present_cell->n_dofs_for_dof_handler ()));
      // get function values of dofs on this cell
-     dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+     dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
      fe_values.present_cell->get_interpolated_dof_values (fe_function, dof_values);
 
      std::fill (curls.begin (), curls.end (), curl_type ());
@@ -947,7 +982,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (hessians.begin(), hessians.end(), hessian_type());
@@ -1010,7 +1045,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values (fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type> dof_values (fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill (laplacians.begin(), laplacians.end(), value_type());
@@ -1073,7 +1108,7 @@ namespace FEValuesViews
 
                                     // get function values of dofs
                                     // on this cell
-    dealii::Vector<typename InputVector::value_type > dof_values(fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type > dof_values(fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill(values.begin(), values.end(), value_type());
@@ -1138,7 +1173,7 @@ namespace FEValuesViews
 
                                      // get function values of dofs
                                      // on this cell
-    dealii::Vector<typename InputVector::value_type > dof_values(fe_values.dofs_per_cell);
+    dealii::Vector<typename ValueType<InputVector>::type > dof_values(fe_values.dofs_per_cell);
     fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
     std::fill(divergences.begin(), divergences.end(), divergence_type());
@@ -1336,6 +1371,15 @@ class FEValuesBase<dim,spacedim>::CellIteratorBase
     n_dofs_for_dof_handler () const = 0;
 
 #include "fe_values.decl.1.inst"
+
+                                     /// Call
+                                     /// @p get_interpolated_dof_values
+                                     /// of the iterator with the
+                                     /// given arguments.
+    virtual
+    void
+    get_interpolated_dof_values (const IndexSet &in,
+                                Vector<double> &out) const = 0;
 };
 
 
@@ -1397,6 +1441,15 @@ class FEValuesBase<dim,spacedim>::CellIterator : public FEValuesBase<dim,spacedi
 
 #include "fe_values.decl.2.inst"
 
+                                     /// Call
+                                     /// @p get_interpolated_dof_values
+                                     /// of the iterator with the
+                                     /// given arguments.
+    virtual
+    void
+    get_interpolated_dof_values (const IndexSet &in,
+                                Vector<double> &out) const;
+
   private:
                                     /**
                                      * Copy of the iterator which
@@ -1491,6 +1544,15 @@ class FEValuesBase<dim,spacedim>::TriaCellIterator : public FEValuesBase<dim,spa
 
 #include "fe_values.decl.2.inst"
 
+                                     /// Call
+                                     /// @p get_interpolated_dof_values
+                                     /// of the iterator with the
+                                     /// given arguments.
+    virtual
+    void
+    get_interpolated_dof_values (const IndexSet &in,
+                                Vector<double> &out) const;
+
   private:
                                     /**
                                      * Copy of the iterator which
@@ -1548,6 +1610,23 @@ FEValuesBase<dim,spacedim>::CellIterator<CI>::n_dofs_for_dof_handler () const
 #include "fe_values.impl.1.inst"
 
 
+template <int dim, int spacedim>
+template <typename CI>
+void
+FEValuesBase<dim,spacedim>::CellIterator<CI>::
+get_interpolated_dof_values (const IndexSet &in,
+                            Vector<double>       &out) const
+{
+  Assert (cell->has_children() == false, ExcNotImplemented());
+
+  std::vector<unsigned int> dof_indices (cell->get_fe().dofs_per_cell);
+  cell->get_dof_indices (dof_indices);
+
+  for (unsigned int i=0; i<cell->get_fe().dofs_per_cell; ++i)
+    out[i] = (in.is_element (dof_indices[i]) ? 1 : 0);
+}
+
+
 /* ---------------- FEValuesBase<dim,spacedim>::TriaCellIterator --------- */
 
 template <int dim, int spacedim>
@@ -1592,6 +1671,16 @@ FEValuesBase<dim,spacedim>::TriaCellIterator::n_dofs_for_dof_handler () const
 #include "fe_values.impl.2.inst"
 
 
+template <int dim, int spacedim>
+void
+FEValuesBase<dim,spacedim>::TriaCellIterator::
+get_interpolated_dof_values (const IndexSet &,
+                            Vector<double>       &) const
+{
+  Assert (false, ExcMessage (message_string));
+}
+
+
 
 /* --------------------- FEValuesData ----------------- */
 
@@ -1730,7 +1819,7 @@ void FEValuesBase<dim,spacedim>::get_function_values (
 
                                   // get function values of dofs
                                   // on this cell
-  Vector<typename InputVector::value_type> dof_values (dofs_per_cell);
+  Vector<typename ValueType<InputVector>::type> dof_values (dofs_per_cell);
   present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
                                   // initialize with zero
@@ -1818,7 +1907,7 @@ void FEValuesBase<dim,spacedim>::get_function_values (
                                   // innermost loop)
   for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
     {
-      const double value = fe_function(indices[shape_func]);
+      const double value = get_vector_element (fe_function, indices[shape_func]);
       if (value == 0.)
        continue;
 
@@ -1862,7 +1951,7 @@ void FEValuesBase<dim,spacedim>::get_function_values (
 
                                   // get function values of dofs
                                   // on this cell
-  Vector<typename InputVector::value_type> dof_values (dofs_per_cell);
+  Vector<typename ValueType<InputVector>::type> dof_values (dofs_per_cell);
   present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
                                   // initialize with zero
@@ -1997,7 +2086,7 @@ void FEValuesBase<dim,spacedim>::get_function_values (
   for (unsigned int mc = 0; mc < component_multiple; ++mc)
     for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
       {
-       const double value = fe_function(indices[shape_func+mc*dofs_per_cell]);
+       const double value = get_vector_element (fe_function, indices[shape_func+mc*dofs_per_cell]);
        if (value == 0.)
          continue;
 
@@ -2101,7 +2190,7 @@ void FEValuesBase<dim,spacedim>::get_function_values (
   for (unsigned int mc = 0; mc < component_multiple; ++mc)
     for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
       {
-       const double value = fe_function(indices[shape_func+mc*dofs_per_cell]);
+       const double value = get_vector_element (fe_function, indices[shape_func+mc*dofs_per_cell]);
        if (value == 0.)
          continue;
 
@@ -2171,7 +2260,7 @@ FEValuesBase<dim,spacedim>::get_function_gradients (
 
                                   // get function values of dofs
                                   // on this cell
-  Vector<typename InputVector::value_type> dof_values (dofs_per_cell);
+  Vector<typename ValueType<InputVector>::type> dof_values (dofs_per_cell);
   present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
                                   // initialize with zero
@@ -2261,7 +2350,7 @@ void FEValuesBase<dim,spacedim>::get_function_gradients (
                                   // in the innermost loop)
   for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
     {
-      const double value = fe_function(indices[shape_func]);
+      const double value = get_vector_element (fe_function, indices[shape_func]);
       if (value == 0.)
        continue;
 
@@ -2299,7 +2388,7 @@ FEValuesBase<dim,spacedim>::get_function_gradients (
 
                                   // get function values of dofs
                                   // on this cell
-  Vector<typename InputVector::value_type> dof_values (dofs_per_cell);
+  Vector<typename ValueType<InputVector>::type> dof_values (dofs_per_cell);
   present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
                                   // initialize with zero
@@ -2417,7 +2506,7 @@ void FEValuesBase<dim,spacedim>::get_function_gradients (
   for (unsigned int mc = 0; mc < component_multiple; ++mc)
     for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
       {
-       const double value = fe_function(indices[shape_func+mc*dofs_per_cell]);
+       const double value = get_vector_element (fe_function, indices[shape_func+mc*dofs_per_cell]);
        if (value == 0.)
          continue;
 
@@ -2487,7 +2576,7 @@ get_function_hessians (const InputVector           &fe_function,
 
                                   // get function values of dofs
                                   // on this cell
-  Vector<typename InputVector::value_type> dof_values (dofs_per_cell);
+  Vector<typename ValueType<InputVector>::type> dof_values (dofs_per_cell);
   present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
                                   // initialize with zero
@@ -2545,7 +2634,7 @@ void FEValuesBase<dim,spacedim>::get_function_hessians (
                                   // functions
   for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
     {
-      const double value = fe_function(indices[shape_func]);
+      const double value = get_vector_element (fe_function, indices[shape_func]);
       if (value == 0.)
        continue;
 
@@ -2584,7 +2673,7 @@ get_function_hessians (const InputVector                         &fe_function,
 
                                   // get function values of dofs
                                   // on this cell
-  Vector<typename InputVector::value_type> dof_values (dofs_per_cell);
+  Vector<typename ValueType<InputVector>::type> dof_values (dofs_per_cell);
   present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
                                   // initialize with zero
@@ -2708,7 +2797,7 @@ void FEValuesBase<dim, spacedim>::get_function_hessians (
   for (unsigned int mc = 0; mc < component_multiple; ++mc)
     for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
       {
-       const double value = fe_function(indices[shape_func+mc*dofs_per_cell]);
+       const double value = get_vector_element (fe_function, indices[shape_func+mc*dofs_per_cell]);
        if (value == 0.)
          continue;
 
@@ -2778,7 +2867,7 @@ void FEValuesBase<dim,spacedim>::get_function_laplacians (
 
                                   // get function values of dofs
                                   // on this cell
-  Vector<typename InputVector::value_type> dof_values (dofs_per_cell);
+  Vector<typename ValueType<InputVector>::type> dof_values (dofs_per_cell);
   present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
                                   // initialize with zero
@@ -2842,7 +2931,7 @@ void FEValuesBase<dim,spacedim>::get_function_laplacians (
                                   // the hessians and get their trace
   for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
     {
-      const double value = fe_function(indices[shape_func]);
+      const double value = get_vector_element (fe_function, indices[shape_func]);
       if (value == 0.)
        continue;
 
@@ -2887,7 +2976,7 @@ void FEValuesBase<dim,spacedim>::get_function_laplacians (
 
                                   // get function values of dofs
                                   // on this cell
-  Vector<typename InputVector::value_type> dof_values (dofs_per_cell);
+  Vector<typename ValueType<InputVector>::type> dof_values (dofs_per_cell);
   present_cell->get_interpolated_dof_values(fe_function, dof_values);
 
                                   // initialize with zero
@@ -2994,7 +3083,7 @@ void FEValuesBase<dim,spacedim>::get_function_laplacians (
   for (unsigned int mc = 0; mc < component_multiple; ++mc)
     for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
       {
-       const double value = fe_function(indices[shape_func+mc*dofs_per_cell]);
+       const double value = get_vector_element (fe_function, indices[shape_func+mc*dofs_per_cell]);
        if (value == 0.)
          continue;
 
@@ -3100,7 +3189,7 @@ void FEValuesBase<dim,spacedim>::get_function_laplacians (
   for (unsigned int mc = 0; mc < component_multiple; ++mc)
     for (unsigned int shape_func=0; shape_func<dofs_per_cell; ++shape_func)
       {
-       const double value = fe_function(indices[shape_func+mc*dofs_per_cell]);
+       const double value = get_vector_element (fe_function, indices[shape_func+mc*dofs_per_cell]);
        if (value == 0.)
          continue;
 
index b67f542d485a916f75cf91dcb260f158f6fe553c..56603423f44244d983ab894c8be7dc80e590962f 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors
+//    Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -388,3 +388,336 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS)
 
   }
 
+
+// instantiations for VEC=IndexSet
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+    template
+       void FEValuesViews::Scalar<deal_II_dimension>::get_function_values<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<double>&) const;
+    template
+       void FEValuesViews::Scalar<deal_II_dimension>::get_function_gradients<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension> >&) const;
+    template
+       void FEValuesViews::Scalar<deal_II_dimension>::get_function_hessians<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<2,deal_II_dimension> >&) const;
+    template
+       void FEValuesViews::Scalar<deal_II_dimension>::get_function_laplacians<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<double>&) const;
+
+    template
+       void FEValuesViews::Vector<deal_II_dimension>::get_function_values<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension> >&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension>::get_function_gradients<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<2,deal_II_dimension> >&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension>::get_function_symmetric_gradients<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<dealii::SymmetricTensor<2,deal_II_dimension> >&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension>::get_function_curls<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<curl_type>&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension>::get_function_divergences<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<double>&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension>::get_function_hessians<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<3,deal_II_dimension> >&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension>::get_function_laplacians<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension> >&) const;
+
+    template
+       void FEValuesViews::SymmetricTensor<2,deal_II_dimension>::get_function_values<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<dealii::SymmetricTensor<2,deal_II_dimension> >&) const;
+    template
+       void FEValuesViews::SymmetricTensor<2,deal_II_dimension>::get_function_divergences<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension> >&) const;
+
+
+#if deal_II_dimension != 3
+    template
+       void FEValuesViews::Scalar<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_values<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<value_type>&) const;
+    template
+       void FEValuesViews::Scalar<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_gradients<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> >&) const;
+    template
+       void FEValuesViews::Scalar<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_hessians<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<2,deal_II_dimension+1> >&) const;
+    template
+       void FEValuesViews::Scalar<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_laplacians<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<double>&) const;
+
+    template
+       void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_values<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> >&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_gradients<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<2,deal_II_dimension+1> >&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_symmetric_gradients<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<dealii::SymmetricTensor<2,deal_II_dimension+1> >&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_divergences<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<double>&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_hessians<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<3,deal_II_dimension+1> >&) const;
+    template
+       void FEValuesViews::Vector<deal_II_dimension, deal_II_dimension+1>
+       ::get_function_laplacians<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> >&) const;
+
+    template
+       void FEValuesViews::SymmetricTensor<2, deal_II_dimension, deal_II_dimension+1>
+        ::get_function_values<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<dealii::SymmetricTensor<2,deal_II_dimension+1> >&) const;
+    template
+       void FEValuesViews::SymmetricTensor<2, deal_II_dimension, deal_II_dimension+1>
+        ::get_function_divergences<dealii::IndexSet>
+       (const dealii::IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> >&) const;
+
+#endif
+
+  }
+
+
+
+// Instantiations of functions in FEValuesBase and IndexSet=IndexSet
+
+for (deal_II_dimension : DIMENSIONS)
+  {
+    template
+       void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, std::vector<double>&) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, std::vector<float>&) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, std::vector<Vector<double> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, std::vector<Vector<float> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Vector<double> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Vector<float> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       VectorSlice<std::vector<std::vector<double> > >, bool) const;
+//     template
+//       void FEValuesBase<deal_II_dimension>::get_function_values<IndexSet>
+//       (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+//        VectorSlice<std::vector<std::vector<float> > >, bool) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_gradients<IndexSet>
+      (const IndexSet&, std::vector<Tensor<1,deal_II_dimension> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_gradients<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Tensor<1,deal_II_dimension> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_gradients<IndexSet>
+      (const IndexSet&, std::vector<std::vector<Tensor<1,deal_II_dimension> > > &) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_gradients<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       VectorSlice<std::vector<std::vector<Tensor<1,deal_II_dimension> > > >, bool) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_hessians<IndexSet>
+      (const IndexSet&, std::vector<Tensor<2,deal_II_dimension> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_hessians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Tensor<2,deal_II_dimension> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_hessians<IndexSet>
+      (const IndexSet&, std::vector<std::vector<Tensor<2,deal_II_dimension> > > &, bool) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_hessians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       VectorSlice<std::vector<std::vector<Tensor<2,deal_II_dimension> > > >, bool) const;
+
+    template
+       void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, std::vector<double>&) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, std::vector<float>&) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, std::vector<Vector<double> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, std::vector<Vector<float> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Vector<double> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Vector<float> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<std::vector<double> > &, bool) const;
+    template
+      void FEValuesBase<deal_II_dimension>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<std::vector<float> > &, bool) const;
+
+
+#if deal_II_dimension != 3
+
+    template
+       void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, std::vector<double>&) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, std::vector<float>&) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, std::vector<Vector<double> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, std::vector<Vector<float> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Vector<double> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Vector<float> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       VectorSlice<std::vector<std::vector<double> > >, bool) const;
+//     template
+//       void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_values<IndexSet>
+//       (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+//        VectorSlice<std::vector<std::vector<float> > >, bool) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_gradients<IndexSet>
+      (const IndexSet&, std::vector<Tensor<1,deal_II_dimension+1> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_gradients<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Tensor<1,deal_II_dimension+1> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_gradients<IndexSet>
+      (const IndexSet&, std::vector<std::vector<Tensor<1,deal_II_dimension+1> > > &) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_gradients<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       VectorSlice<std::vector<std::vector<Tensor<1,deal_II_dimension+1> > > >, bool) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_hessians<IndexSet>
+      (const IndexSet&, std::vector<Tensor<2,deal_II_dimension+1> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_hessians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Tensor<2,deal_II_dimension+1> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_hessians<IndexSet>
+      (const IndexSet&, std::vector<std::vector<Tensor<2,deal_II_dimension+1> > > &, bool) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_hessians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       VectorSlice<std::vector<std::vector<Tensor<2,deal_II_dimension+1> > > >, bool) const;
+
+    template
+       void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, std::vector<double>&) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, std::vector<float>&) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<double>&) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&, std::vector<float>&) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, std::vector<Vector<double> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, std::vector<Vector<float> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Vector<double> > &) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<Vector<float> > &) const;
+
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<std::vector<double> > &, bool) const;
+    template
+      void FEValuesBase<deal_II_dimension,deal_II_dimension+1>::get_function_laplacians<IndexSet>
+      (const IndexSet&, const VectorSlice<const std::vector<unsigned int> >&,
+       std::vector<std::vector<float> > &, bool) const;
+
+
+#endif
+
+  }
index 961cc5b83cb7fbb1fb8b190fcad4e4473ddeb477..04da595d11de1f4862204f5616a5bba8a5b80d16 100644 (file)
@@ -96,6 +96,70 @@ namespace internal
 {
   namespace DataOut
   {
+    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>
+    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>
+    DataEntryBase<DH>::~DataEntryBase ()
+    {}
+
+
+
                                      /**
                                       * Class that stores a pointer to a
                                       * vector of type equal to the template
@@ -238,70 +302,6 @@ namespace internal
 
 
 
-    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>
-    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>
-    DataEntryBase<DH>::~DataEntryBase ()
-    {}
-
-
-
     template <class DH, class VectorType>
     DataEntry<DH,VectorType>::
     DataEntry (const VectorType                       *data,
@@ -324,13 +324,33 @@ namespace internal
     {}
 
 
+    namespace
+    {
+      template <class VectorType>
+      double
+      get_vector_element (const VectorType &vector,
+                         const unsigned int cell_number)
+      {
+       return vector[cell_number];
+      }
+
+
+      double
+      get_vector_element (const IndexSet &is,
+                         const unsigned int cell_number)
+      {
+       return (is.is_element(cell_number) ? 1 : 0);
+      }
+    }
+
+
 
     template <class DH, class VectorType>
     double
     DataEntry<DH,VectorType>::
     get_cell_data_value (const unsigned int cell_number) const
     {
-      return (*vector)(cell_number);
+      return get_vector_element(*vector, cell_number);
     }
 
 
index 6a2c8dbcec667cf124128d9fab98e4a651295162..4121cc77049d8b5726ef548b125edce47300c7d8 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2010 by the deal.II authors
+//    Copyright (C) 2010, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -15,93 +15,186 @@ for (VEC : SERIAL_VECTORS; DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENS
 {
 // codim=0
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension,deal_II_dimension>::
-  add_data_vector<VEC> (const VEC            &, 
-                       const std::string   &, 
-                       const DataVectorType,  
-                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &); 
+  add_data_vector<VEC> (const VEC            &,
+                       const std::string   &,
+                       const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension,deal_II_dimension>::
-  add_data_vector<VEC> (const VEC                       &, 
-                     const std::vector<std::string> &, 
-                     const DataVectorType,  
-                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &); 
+  add_data_vector<VEC> (const VEC                       &,
+                     const std::vector<std::string> &,
+                     const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension,deal_II_dimension>::
-  add_data_vector<VEC> (const VEC                 &, 
+  add_data_vector<VEC> (const VEC                 &,
                      const DataPostprocessor<DH<deal_II_dimension,deal_II_dimension>::space_dimension> &);
 
 // stuff needed for face data
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension-1,deal_II_dimension>::
-  add_data_vector<VEC> (const VEC            &, 
-                       const std::string   &, 
-                       const DataVectorType,  
-                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &); 
+  add_data_vector<VEC> (const VEC            &,
+                       const std::string   &,
+                       const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension-1,deal_II_dimension>::
-  add_data_vector<VEC> (const VEC                       &, 
-                     const std::vector<std::string> &, 
-                     const DataVectorType,  
-                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &); 
+  add_data_vector<VEC> (const VEC                       &,
+                     const std::vector<std::string> &,
+                     const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension-1,deal_II_dimension>::
-  add_data_vector<VEC> (const VEC                 &, 
+  add_data_vector<VEC> (const VEC                 &,
                      const DataPostprocessor<DH<deal_II_dimension,deal_II_dimension>::space_dimension> &);
 
 // things for DataOutRotation
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension+1,deal_II_dimension+1>::
-  add_data_vector<VEC> (const VEC            &, 
-                       const std::string   &, 
-                       const DataVectorType,  
-                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &); 
+  add_data_vector<VEC> (const VEC            &,
+                       const std::string   &,
+                       const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension+1,deal_II_dimension+1>::
-  add_data_vector<VEC> (const VEC                       &, 
-                     const std::vector<std::string> &, 
-                     const DataVectorType,  
-                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &); 
+  add_data_vector<VEC> (const VEC                       &,
+                     const std::vector<std::string> &,
+                     const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension+1,deal_II_dimension+1>::
-  add_data_vector<VEC> (const VEC                 &, 
+  add_data_vector<VEC> (const VEC                 &,
                      const DataPostprocessor<DH<deal_II_dimension,deal_II_dimension>::space_dimension> &);
 
 // codim 1
 
   #if deal_II_dimension < 3
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension+1>,deal_II_dimension,deal_II_dimension+1>::
-  add_data_vector<VEC> (const VEC            &, 
-                       const std::string   &, 
-                       const DataVectorType,  
-                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &); 
+  add_data_vector<VEC> (const VEC            &,
+                       const std::string   &,
+                       const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension+1>,deal_II_dimension,deal_II_dimension+1>::
-  add_data_vector<VEC> (const VEC                       &, 
-                     const std::vector<std::string> &, 
-                     const DataVectorType,  
-                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &); 
+  add_data_vector<VEC> (const VEC                       &,
+                     const std::vector<std::string> &,
+                     const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
 
-  template void 
+  template void
   DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension+1>,deal_II_dimension,deal_II_dimension+1>::
-  add_data_vector<VEC> (const VEC                 &, 
+  add_data_vector<VEC> (const VEC                 &,
                      const DataPostprocessor<DH<deal_II_dimension,deal_II_dimension+1>::space_dimension> &);
   #endif
 
 }
 
 
+
+for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS)
+{
+// codim=0
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension,deal_II_dimension>::
+  add_data_vector<IndexSet> (const IndexSet            &,
+                       const std::string   &,
+                       const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension,deal_II_dimension>::
+  add_data_vector<IndexSet> (const IndexSet                       &,
+                     const std::vector<std::string> &,
+                     const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension,deal_II_dimension>::
+  add_data_vector<IndexSet> (const IndexSet                 &,
+                     const DataPostprocessor<DH<deal_II_dimension,deal_II_dimension>::space_dimension> &);
+
+// stuff needed for face data
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension-1,deal_II_dimension>::
+  add_data_vector<IndexSet> (const IndexSet            &,
+                       const std::string   &,
+                       const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension-1,deal_II_dimension>::
+  add_data_vector<IndexSet> (const IndexSet                       &,
+                     const std::vector<std::string> &,
+                     const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension-1,deal_II_dimension>::
+  add_data_vector<IndexSet> (const IndexSet                 &,
+                     const DataPostprocessor<DH<deal_II_dimension,deal_II_dimension>::space_dimension> &);
+
+// things for DataOutRotation
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension+1,deal_II_dimension+1>::
+  add_data_vector<IndexSet> (const IndexSet            &,
+                       const std::string   &,
+                       const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension+1,deal_II_dimension+1>::
+  add_data_vector<IndexSet> (const IndexSet                       &,
+                     const std::vector<std::string> &,
+                     const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension>,deal_II_dimension+1,deal_II_dimension+1>::
+  add_data_vector<IndexSet> (const IndexSet                 &,
+                     const DataPostprocessor<DH<deal_II_dimension,deal_II_dimension>::space_dimension> &);
+
+// codim 1
+
+  #if deal_II_dimension < 3
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension+1>,deal_II_dimension,deal_II_dimension+1>::
+  add_data_vector<IndexSet> (const IndexSet            &,
+                       const std::string   &,
+                       const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension+1>,deal_II_dimension,deal_II_dimension+1>::
+  add_data_vector<IndexSet> (const IndexSet                       &,
+                     const std::vector<std::string> &,
+                     const DataVectorType,
+                    const std::vector<DataComponentInterpretation::DataComponentInterpretation> &);
+
+  template void
+  DataOut_DoFData<DH<deal_II_dimension,deal_II_dimension+1>,deal_II_dimension,deal_II_dimension+1>::
+  add_data_vector<IndexSet> (const IndexSet                 &,
+                     const DataPostprocessor<DH<deal_II_dimension,deal_II_dimension+1>::space_dimension> &);
+  #endif
+
+}
+
+
+
 for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS)
 {
   template class DataOut_DoFData<DH<deal_II_dimension>,deal_II_dimension>;

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.