From 0f3ab44a273707b219a47f85d3c46e0ad496752b Mon Sep 17 00:00:00 2001 From: wolf Date: Fri, 29 Jul 2005 20:40:23 +0000 Subject: [PATCH] Handle the case that a vector-valued element is given to add_data_vector, but only a single name. git-svn-id: https://svn.dealii.org/trunk@11218 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/include/numerics/data_out_stack.h | 8 ++++ .../deal.II/source/numerics/data_out_stack.cc | 37 ++++++++++++++++++- deal.II/doc/news/changes.html | 10 +++++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/deal.II/deal.II/include/numerics/data_out_stack.h b/deal.II/deal.II/include/numerics/data_out_stack.h index 62500f5d88..df9ba68e19 100644 --- a/deal.II/deal.II/include/numerics/data_out_stack.h +++ b/deal.II/deal.II/include/numerics/data_out_stack.h @@ -191,6 +191,14 @@ class DataOutStack : public DataOutInterface * and therefore only one name needs to * be given. * + * If @p vec is a vector with + * multiple components this + * function will generate + * distinct names for all + * components by appending an + * underscore and the number of + * each component to @p name + * * The data vector must have been * registered using the @p declare_data_vector * function before actually using it the diff --git a/deal.II/deal.II/source/numerics/data_out_stack.cc b/deal.II/deal.II/source/numerics/data_out_stack.cc index 75915ed45c..8cd39eff8d 100644 --- a/deal.II/deal.II/source/numerics/data_out_stack.cc +++ b/deal.II/deal.II/source/numerics/data_out_stack.cc @@ -24,7 +24,11 @@ #include #include - +#ifdef HAVE_STD_STRINGSTREAM +# include +#else +# include +#endif template @@ -128,8 +132,37 @@ template void DataOutStack::add_data_vector (const Vector &vec, const std::string &name) { + const unsigned int n_components = dof_handler->get_fe().n_components (); + std::vector names; - names.push_back (name); + // if only one component or vector + // is cell vector: we only need one + // name + if ((n_components == 1) || + (vec.size() == dof_handler->get_tria().n_active_cells())) + { + names.resize (1, name); + } + else + // otherwise append _i to the + // given name + { + names.resize (n_components); + for (unsigned int i=0; ideal.II
    +
  1. + New: The DataOutStack::add_data_vector + function now also allows to give only a single name even if the data is + vector-valued. It then makes up names for the individual components by + adding numbers to the name, just like the DataOut class already does for a long time. +
    + (WB, 2005/07/29) +

    +
  2. New: The DataOutStack class can now also be used to stack two-dimensional time or parameter dependent data into a 3d -- 2.39.5