00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __deal2__data_out_stack_h
00013 #define __deal2__data_out_stack_h
00014
00015
00016 #include <deal.II/base/config.h>
00017 #include <deal.II/base/data_out_base.h>
00018 #include <deal.II/base/smartpointer.h>
00019 #include <deal.II/lac/vector.h>
00020
00021 #include <string>
00022 #include <vector>
00023
00024 DEAL_II_NAMESPACE_OPEN
00025
00026 template <int dim, int spacedim> class DoFHandler;
00027
00105 template <int dim, int spacedim=dim, class DH = DoFHandler<dim,spacedim> >
00106 class DataOutStack : public DataOutInterface<dim+1>
00107 {
00108 public:
00114 enum VectorType { cell_vector, dof_vector };
00115
00120 virtual ~DataOutStack ();
00121
00132 void new_parameter_value (const double parameter_value,
00133 const double parameter_step);
00134
00145 void attach_dof_handler (const DH& dof_handler);
00146
00160 void declare_data_vector (const std::string &name,
00161 const VectorType vector_type);
00162
00180 void declare_data_vector (const std::vector<std::string> &name,
00181 const VectorType vector_type);
00182
00183
00216 template <typename number>
00217 void add_data_vector (const Vector<number> &vec,
00218 const std::string &name);
00219
00248 template <typename number>
00249 void add_data_vector (const Vector<number> &vec,
00250 const std::vector<std::string> &names);
00251
00269 void build_patches (const unsigned int n_subdivisions = 0);
00270
00279 void finish_parameter_value ();
00280
00285 void clear ();
00286
00292 std::size_t memory_consumption () const;
00293
00297 DeclException0 (ExcNoDoFHandlerSelected);
00301 DeclException3 (ExcInvalidVectorSize,
00302 int, int, int,
00303 << "The vector has size " << arg1
00304 << " but the DoFHandler objects says there are " << arg2
00305 << " degrees of freedom and there are " << arg3
00306 << " active cells.");
00310 DeclException2 (ExcInvalidCharacter,
00311 std::string, size_t,
00312 << "Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl
00313 << "description strings since some graphics formats will only accept these."
00314 << std::endl
00315 << "The string you gave was <" << arg1
00316 << ">, the invalid character is <" << arg1[arg2]
00317 << ">." << std::endl);
00321 DeclException2 (ExcInvalidNumberOfNames,
00322 int, int,
00323 << "You have to give one name per component in your "
00324 << "data vector. The number you gave was " << arg1
00325 << ", but the number of components is " << arg2);
00329 DeclException1 (ExcVectorNotDeclared,
00330 std::string,
00331 << "The data vector for which the first component has the name "
00332 << arg1 << " has not been declared before.");
00336 DeclException0 (ExcDataNotCleared);
00340 DeclException0 (ExcDataAlreadyAdded);
00344 DeclException1 (ExcNameAlreadyUsed,
00345 std::string,
00346 << "You tried to declare a component of a data vector with "
00347 << "the name <" << arg1 << ">, but that name is already used.");
00351 DeclException1 (ExcInvalidNumberOfSubdivisions,
00352 int,
00353 << "The number of subdivisions per patch, " << arg1
00354 << ", is not valid.");
00355
00356 private:
00360 double parameter;
00361
00367 double parameter_step;
00368
00374 SmartPointer<const DH,DataOutStack<dim,spacedim,DH> > dof_handler;
00375
00380 std::vector< ::DataOutBase::Patch<dim+1,dim+1> > patches;
00381
00387 struct DataVector
00388 {
00392 Vector<double> data;
00393
00398 std::vector<std::string> names;
00399
00405 std::size_t memory_consumption () const;
00406 };
00407
00411 std::vector<DataVector> dof_data;
00412
00416 std::vector<DataVector> cell_data;
00417
00426 virtual const std::vector< ::DataOutBase::Patch<dim+1,dim+1> > & get_patches () const;
00427
00428
00435 virtual std::vector<std::string> get_dataset_names () const;
00436 };
00437
00438
00439 DEAL_II_NAMESPACE_CLOSE
00440
00441 #endif
00442