include/deal.II/numerics/point_value_history.h

00001 //---------------------------------------------------------------------------
00002 //    @f$Id: point_value_history.h 25345 2012-03-31 08:37:04Z bangerth @f$
00003 //
00004 //    Copyright (C) 2009, 2012 by Michael Rapson and the deal.II authors
00005 //
00006 //    This file is subject to QPL and may not be  distributed
00007 //    without copyright and license information. Please refer
00008 //    to the file deal.II/doc/license.html for the  text  and
00009 //    further information on this license.
00010 //
00011 //---------------------------------------------------------------------------
00012 
00013 #ifndef __dealii__point_value_history_h
00014 #define __dealii__point_value_history_h
00015 
00016 #include <deal.II/dofs/dof_handler.h>
00017 #include <deal.II/base/point.h>
00018 #include <deal.II/lac/vector.h>
00019 
00020 #include <deal.II/dofs/dof_accessor.h>
00021 #include <deal.II/base/exceptions.h>
00022 #include <deal.II/base/quadrature_lib.h>
00023 #include <deal.II/fe/fe_q.h>
00024 #include <deal.II/fe/mapping.h>
00025 #include <deal.II/fe/mapping_q1.h>
00026 #include <deal.II/fe/fe_values.h>
00027 #include <deal.II/base/smartpointer.h>
00028 #include <deal.II/base/utilities.h>
00029 
00030 #include <vector>
00031 #include <iostream>
00032 #include <fstream>
00033 #include <sstream>
00034 #include <string>
00035 #include <map>
00036 
00037 DEAL_II_NAMESPACE_OPEN
00038 
00039 namespace internal
00040 {
00041   namespace PointValueHistory
00042   {
00043     template <int dim> class PointGeometryData;
00044   }
00045 }
00046 
00047 
00048 
00049 namespace internal
00050 {
00051   namespace PointValueHistory
00052   {
00058     template <int dim>
00059     class PointGeometryData
00060     {
00061       public:
00062         PointGeometryData(const std::vector <Point <dim> > &new_locations,
00063                           const std::vector <int> &new_sol_indices);
00064         std::vector <Point <dim> > locations;
00065         std::vector <int> solution_indices;
00066     };
00067   }
00068 }
00069 
00070 
00071 
00139 template <int dim>
00140 class PointValueHistory
00141 {
00142   public:
00151     PointValueHistory (const unsigned int n_independent_variables = 0);
00152 
00184     PointValueHistory (const DoFHandler<dim> & dof_handler,
00185                        const unsigned int n_independent_variables = 0);
00186 
00196     PointValueHistory (const PointValueHistory & point_value_history);
00197 
00212     PointValueHistory & operator=(const PointValueHistory & point_value_history);
00213 
00217     ~PointValueHistory ();
00218 
00230     void add_point(const Point <dim> & location);
00231 
00250     void add_points (const std::vector <Point <dim> > & locations);
00251 
00252 
00253 
00262     void add_field_name(const std::string &vector_name);
00263 
00274     template <class VECTOR>
00275     void evaluate_field(const std::string &vector_name, const VECTOR & solution);
00276 
00290     void start_new_dataset(double key);
00291 
00302     void push_back_independent(const std::vector <double> &independent_values);
00303 
00304 
00317     void write_gnuplot(const std::string &base_name);
00318 
00319 
00348     Vector<double> mark_locations();
00349 
00350 
00362     void get_points (std::vector <std::vector<Point <dim> > > & locations);
00363 
00364 
00385     void close();
00386 
00387 
00403     void clear();
00404 
00412     void status(std::ostream &out);
00413 
00414 
00427     bool deep_check (bool strict);
00428 
00434     DeclException0(ExcNoIndependent);
00435 
00450     DeclException0(ExcDataLostSync);
00451 
00452 
00462     DeclException0(ExcDoFHandlerRequired);
00463 
00472     DeclException2(ExcDoFHandlerChanged,
00473                    int,
00474                    int,
00475                    << "Original n_dofs (" << arg1 << ") != current n_dofs (" << arg2 << ")");
00476 
00477   private:
00483     std::vector <double> dataset_key;
00484 
00489     std::vector <std::vector <double> > independent_values;
00490 
00496     std::map <std::string, std::vector <std::vector <double> > > data_store;
00497 
00502     std::vector <internal::PointValueHistory::PointGeometryData <dim> >
00503     point_geometry_data;
00504 
00509     std::pair<std::string, std::vector <std::vector <double> > > pair_data; // could possibly be removed
00510 
00515     bool closed;
00516 
00521     bool cleared;
00522 
00523 
00529     SmartPointer<const DoFHandler<dim>,PointValueHistory<dim> > dof_handler;
00530 
00535                                      /* A cheap way to check that the
00536                                       * triangulation has not been refined in
00537                                       * anyway since the class was set up.
00538                                       * Refinement will invalidate stored dof
00539                                       * indices linked to support points.
00540                                       */
00541     unsigned int n_dofs;
00546     unsigned int n_indep;
00547 
00548 };
00549 
00550 
00551 DEAL_II_NAMESPACE_CLOSE
00552 #endif /* __dealii__point_value_history_h */
00553 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Wed May 23 2012 06:07:43 by doxygen 1.7.3