Reference documentation for deal.II version 8.1.0
data_out_stack.h
1 // ---------------------------------------------------------------------
2 // @f$Id: data_out_stack.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 1999 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__data_out_stack_h
18 #define __deal2__data_out_stack_h
19 
20 
21 #include <deal.II/base/config.h>
22 #include <deal.II/base/data_out_base.h>
23 #include <deal.II/base/smartpointer.h>
24 #include <deal.II/lac/vector.h>
25 
26 #include <string>
27 #include <vector>
28 
30 
31 template <int dim, int spacedim> class DoFHandler;
32 
110 template <int dim, int spacedim=dim, class DH = DoFHandler<dim,spacedim> >
111 class DataOutStack : public DataOutInterface<dim+1>
112 {
113 public:
119  enum VectorType { cell_vector, dof_vector };
120 
125  virtual ~DataOutStack ();
126 
137  void new_parameter_value (const double parameter_value,
138  const double parameter_step);
139 
150  void attach_dof_handler (const DH &dof_handler);
151 
165  void declare_data_vector (const std::string &name,
166  const VectorType vector_type);
167 
185  void declare_data_vector (const std::vector<std::string> &name,
186  const VectorType vector_type);
187 
188 
221  template <typename number>
222  void add_data_vector (const Vector<number> &vec,
223  const std::string &name);
224 
253  template <typename number>
254  void add_data_vector (const Vector<number> &vec,
255  const std::vector<std::string> &names);
256 
274  void build_patches (const unsigned int n_subdivisions = 0);
275 
284  void finish_parameter_value ();
285 
290  void clear ();
291 
297  std::size_t memory_consumption () const;
298 
302  DeclException0 (ExcNoDoFHandlerSelected);
306  DeclException3 (ExcInvalidVectorSize,
307  int, int, int,
308  << "The vector has size " << arg1
309  << " but the DoFHandler objects says there are " << arg2
310  << " degrees of freedom and there are " << arg3
311  << " active cells.");
315  DeclException2 (ExcInvalidCharacter,
316  std::string, size_t,
317  << "Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
318  << "description strings since some graphics formats will only accept these."
319  << std::endl
320  << "The string you gave was <" << arg1
321  << ">, the invalid character is <" << arg1[arg2]
322  << ">." << std::endl);
326  DeclException2 (ExcInvalidNumberOfNames,
327  int, int,
328  << "You have to give one name per component in your "
329  << "data vector. The number you gave was " << arg1
330  << ", but the number of components is " << arg2);
334  DeclException1 (ExcVectorNotDeclared,
335  std::string,
336  << "The data vector for which the first component has the name "
337  << arg1 << " has not been declared before.");
341  DeclException0 (ExcDataNotCleared);
345  DeclException0 (ExcDataAlreadyAdded);
349  DeclException1 (ExcNameAlreadyUsed,
350  std::string,
351  << "You tried to declare a component of a data vector with "
352  << "the name <" << arg1 << ">, but that name is already used.");
356  DeclException1 (ExcInvalidNumberOfSubdivisions,
357  int,
358  << "The number of subdivisions per patch, " << arg1
359  << ", is not valid.");
360 
361 private:
365  double parameter;
366 
373 
380 
385  std::vector< ::DataOutBase::Patch<dim+1,dim+1> > patches;
386 
392  struct DataVector
393  {
398 
403  std::vector<std::string> names;
404 
410  std::size_t memory_consumption () const;
411  };
412 
416  std::vector<DataVector> dof_data;
417 
421  std::vector<DataVector> cell_data;
422 
431  virtual const std::vector< ::DataOutBase::Patch<dim+1,dim+1> > & get_patches () const;
432 
433 
440  virtual std::vector<std::string> get_dataset_names () const;
441 };
442 
443 
444 DEAL_II_NAMESPACE_CLOSE
445 
446 #endif
void new_parameter_value(const double parameter_value, const double parameter_step)
DeclException0(ExcNoDoFHandlerSelected)
DeclException3(ExcInvalidVectorSize, int, int, int,<< "The vector has size "<< arg1<< " but the DoFHandler objects says there are "<< arg2<< " degrees of freedom and there are "<< arg3<< " active cells.")
std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > patches
SmartPointer< const DH, DataOutStack< dim, spacedim, DH > > dof_handler
double parameter_step
void add_data_vector(const Vector< number > &vec, const std::string &name)
void declare_data_vector(const std::string &name, const VectorType vector_type)
DeclException1(ExcVectorNotDeclared, std::string,<< "The data vector for which the first component has the name "<< arg1<< " has not been declared before.")
std::vector< std::string > names
std::vector< DataVector > dof_data
virtual std::vector< std::string > get_dataset_names() const
DeclException2(ExcInvalidCharacter, std::string, size_t,<< "Please use only the characters [a-zA-Z0-9_<>()] for"<< std::endl<< "description strings since some graphics formats will only accept these."<< std::endl<< "The string you gave was <"<< arg1<< ">, the invalid character is <"<< arg1[arg2]<< ">."<< std::endl)
virtual const std::vector< ::DataOutBase::Patch< dim+1, dim+1 > > & get_patches() const
void attach_dof_handler(const DH &dof_handler)
void finish_parameter_value()
void build_patches(const unsigned int n_subdivisions=0)
std::size_t memory_consumption() const
std::size_t memory_consumption() const
std::vector< DataVector > cell_data
virtual ~DataOutStack()