Reference documentation for deal.II version 8.4.2
data_out_stack.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2015 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__data_out_stack_h
17 #define dealii__data_out_stack_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/data_out_base.h>
22 #include <deal.II/base/smartpointer.h>
23 #include <deal.II/lac/vector.h>
24 #include <deal.II/numerics/data_out_dof_data.h>
25 
26 #include <string>
27 #include <vector>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
31 template <int dim, int spacedim> class DoFHandler;
32 
108 template <int dim, int spacedim=dim, typename DoFHandlerType = DoFHandler<dim,spacedim> >
109 class DataOutStack : public DataOutInterface<dim+1>
110 {
111 public:
116  enum VectorType { cell_vector, dof_vector };
117 
121  virtual ~DataOutStack ();
122 
129  void new_parameter_value (const double parameter_value,
130  const double parameter_step);
131 
139  void attach_dof_handler (const DoFHandlerType &dof_handler);
140 
149  void declare_data_vector (const std::string &name,
150  const VectorType vector_type);
151 
163  void declare_data_vector (const std::vector<std::string> &name,
164  const VectorType vector_type);
165 
166 
186  template <typename number>
187  void add_data_vector (const Vector<number> &vec,
188  const std::string &name);
189 
208  template <typename number>
209  void add_data_vector (const Vector<number> &vec,
210  const std::vector<std::string> &names);
211 
227  void build_patches (const unsigned int n_subdivisions = 0);
228 
235  void finish_parameter_value ();
236 
240  void clear ();
241 
246  std::size_t memory_consumption () const;
247 
251  DeclException1 (ExcVectorNotDeclared,
252  std::string,
253  << "The data vector for which the first component has the name "
254  << arg1 << " has not been added before.");
258  DeclExceptionMsg (ExcDataNotCleared,
259  "You cannot start a new time/parameter step before calling "
260  "finish_parameter_value() on the previous step.");
264  DeclExceptionMsg (ExcDataAlreadyAdded,
265  "You cannot declare additional vectors after already calling "
266  "build_patches(). All data vectors need to be declared "
267  "before you call this function the first time.");
271  DeclException1 (ExcNameAlreadyUsed,
272  std::string,
273  << "You tried to declare a component of a data vector with "
274  << "the name <" << arg1 << ">, but that name is already used.");
275 
276 private:
280  double parameter;
281 
287 
293 
297  std::vector< ::DataOutBase::Patch<dim+1,dim+1> > patches;
298 
303  struct DataVector
304  {
309 
313  std::vector<std::string> names;
314 
319  std::size_t memory_consumption () const;
320  };
321 
325  std::vector<DataVector> dof_data;
326 
330  std::vector<DataVector> cell_data;
331 
337  virtual const std::vector< ::DataOutBase::Patch<dim+1,dim+1> > & get_patches () const;
338 
339 
344  virtual std::vector<std::string> get_dataset_names () const;
345 };
346 
347 
348 DEAL_II_NAMESPACE_CLOSE
349 
350 #endif
std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > patches
std::size_t memory_consumption() const
DeclExceptionMsg(ExcDataNotCleared, "You cannot start a new time/parameter step before calling " "finish_parameter_value() on the previous step.")
SmartPointer< const DoFHandlerType, DataOutStack< dim, spacedim, DoFHandlerType > > dof_handler
std::vector< DataVector > cell_data
void attach_dof_handler(const DoFHandlerType &dof_handler)
DeclException1(ExcVectorNotDeclared, std::string,<< "The data vector for which the first component has the name "<< arg1<< " has not been added before.")
std::vector< DataVector > dof_data
std::size_t memory_consumption() const
double parameter_step
std::vector< std::string > names
void declare_data_vector(const std::string &name, const VectorType vector_type)
virtual ~DataOutStack()
virtual std::vector< std::string > get_dataset_names() const
void build_patches(const unsigned int n_subdivisions=0)
virtual const std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > & get_patches() const
void finish_parameter_value()
void new_parameter_value(const double parameter_value, const double parameter_step)
void add_data_vector(const Vector< number > &vec, const std::string &name)