Reference documentation for deal.II version 8.5.1
data_out_stack.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2016 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 ();
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 
250  void clear ();
251 
256  std::size_t memory_consumption () const;
257 
262  std::string,
263  << "The data vector for which the first component has the name "
264  << arg1 << " has not been added before.");
269  "You cannot start a new time/parameter step before calling "
270  "finish_parameter_value() on the previous step.");
275  "You cannot declare additional vectors after already calling "
276  "build_patches(). All data vectors need to be declared "
277  "before you call this function the first time.");
282  std::string,
283  << "You tried to declare a component of a data vector with "
284  << "the name <" << arg1 << ">, but that name is already used.");
285 
286 private:
290  double parameter;
291 
297 
303 
307  std::vector< ::DataOutBase::Patch<dim+1,dim+1> > patches;
308 
313  struct DataVector
314  {
319 
323  std::vector<std::string> names;
324 
329  std::size_t memory_consumption () const;
330  };
331 
335  std::vector<DataVector> dof_data;
336 
340  std::vector<DataVector> cell_data;
341 
347  virtual const std::vector< ::DataOutBase::Patch<dim+1,dim+1> > & get_patches () const;
348 
349 
354  virtual std::vector<std::string> get_dataset_names () const;
355 };
356 
357 
358 DEAL_II_NAMESPACE_CLOSE
359 
360 #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:564
void declare_data_vector(const std::string &name, const VectorType vector_type)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:553
virtual ~DataOutStack()
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
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)