Reference documentation for deal.II version 9.0.0
data_out_stack.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2018 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:
117  {
126  };
127 
131  virtual ~DataOutStack () = default;
132 
139  void new_parameter_value (const double parameter_value,
140  const double parameter_step);
141 
149  void attach_dof_handler (const DoFHandlerType &dof_handler);
150 
159  void declare_data_vector (const std::string &name,
160  const VectorType vector_type);
161 
173  void declare_data_vector (const std::vector<std::string> &name,
174  const VectorType vector_type);
175 
176 
196  template <typename number>
197  void add_data_vector (const Vector<number> &vec,
198  const std::string &name);
199 
218  template <typename number>
219  void add_data_vector (const Vector<number> &vec,
220  const std::vector<std::string> &names);
221 
237  void build_patches (const unsigned int n_subdivisions = 0);
238 
245  void finish_parameter_value ();
246 
251  std::size_t memory_consumption () const;
252 
257  std::string,
258  << "The data vector for which the first component has the name "
259  << arg1 << " has not been added before.");
264  "You cannot start a new time/parameter step before calling "
265  "finish_parameter_value() on the previous step.");
270  "You cannot declare additional vectors after already calling "
271  "build_patches(). All data vectors need to be declared "
272  "before you call this function the first time.");
277  std::string,
278  << "You tried to declare a component of a data vector with "
279  << "the name <" << arg1 << ">, but that name is already used.");
280 
281 private:
285  double parameter;
286 
292 
298 
302  std::vector< ::DataOutBase::Patch<dim+1,dim+1> > patches;
303 
308  struct DataVector
309  {
314 
318  std::vector<std::string> names;
319 
324  std::size_t memory_consumption () const;
325  };
326 
330  std::vector<DataVector> dof_data;
331 
335  std::vector<DataVector> cell_data;
336 
342  virtual const std::vector< ::DataOutBase::Patch<dim+1,dim+1> > & get_patches () const;
343 
344 
349  virtual std::vector<std::string> get_dataset_names () const;
350 };
351 
352 
353 DEAL_II_NAMESPACE_CLOSE
354 
355 #endif
static ::ExceptionBase & ExcNameAlreadyUsed(std::string arg1)
std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > patches
std::size_t memory_consumption() const
SmartPointer< const DoFHandlerType, DataOutStack< dim, spacedim, DoFHandlerType > > dof_handler
std::vector< DataVector > cell_data
static ::ExceptionBase & ExcDataAlreadyAdded()
void attach_dof_handler(const DoFHandlerType &dof_handler)
std::vector< DataVector > dof_data
static ::ExceptionBase & ExcDataNotCleared()
std::size_t memory_consumption() const
double parameter_step
std::vector< std::string > names
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:346
void declare_data_vector(const std::string &name, const VectorType vector_type)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:335
static ::ExceptionBase & ExcVectorNotDeclared(std::string arg1)
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
virtual ~DataOutStack()=default
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)