Reference documentation for deal.II version 9.4.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
point_value_history.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 - 2022 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.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 
17 #ifndef dealii_point_value_history_h
18 #define dealii_point_value_history_h
19 
20 #include <deal.II/base/config.h>
21 
23 #include <deal.II/base/point.h>
26 #include <deal.II/base/utilities.h>
27 
30 
32 #include <deal.II/fe/fe_q.h>
33 #include <deal.II/fe/fe_values.h>
34 #include <deal.II/fe/mapping.h>
35 #include <deal.II/fe/mapping_q1.h>
36 
37 #include <deal.II/lac/vector.h>
38 
40 
41 #include <fstream>
42 #include <iostream>
43 #include <map>
44 #include <sstream>
45 #include <string>
46 #include <vector>
47 
49 
50 namespace internal
51 {
52  namespace PointValueHistoryImplementation
53  {
58  template <int dim>
60  {
61  public:
66  const Point<dim> & new_requested_location,
67  const std::vector<Point<dim>> & new_locations,
68  const std::vector<types::global_dof_index> &new_sol_indices);
70  std::vector<Point<dim>> support_point_locations;
71  std::vector<types::global_dof_index> solution_indices;
72  };
73  } // namespace PointValueHistoryImplementation
74 } // namespace internal
75 
76 
77 
214 template <int dim>
216 {
217 public:
223  PointValueHistory(const unsigned int n_independent_variables = 0);
224 
240  const unsigned int n_independent_variables = 0);
241 
247  PointValueHistory(const PointValueHistory &point_value_history);
248 
257  operator=(const PointValueHistory &point_value_history);
258 
263 
271  void
272  add_point(const Point<dim> &location);
273 
284  void
285  add_points(const std::vector<Point<dim>> &locations);
286 
287 
288 
296  void
297  add_field_name(const std::string & vector_name,
299 
308  void
309  add_field_name(const std::string &vector_name,
310  const unsigned int n_components);
311 
316  void
317  add_component_names(const std::string & vector_name,
318  const std::vector<std::string> &component_names);
319 
324  void
325  add_independent_names(const std::vector<std::string> &independent_names);
326 
327 
328 
337  template <class VectorType>
338  void
339  evaluate_field(const std::string &name, const VectorType &solution);
340 
341 
359  template <class VectorType>
360  void
361  evaluate_field(const std::vector<std::string> &names,
362  const VectorType & solution,
363  const DataPostprocessor<dim> & data_postprocessor,
364  const Quadrature<dim> & quadrature);
365 
371  template <class VectorType>
372  void
373  evaluate_field(const std::string & name,
374  const VectorType & solution,
375  const DataPostprocessor<dim> &data_postprocessor,
376  const Quadrature<dim> & quadrature);
377 
378 
391  template <class VectorType>
392  void
393  evaluate_field_at_requested_location(const std::string &name,
394  const VectorType & solution);
395 
396 
405  void
406  start_new_dataset(const double key);
407 
414  void
415  push_back_independent(const std::vector<double> &independent_values);
416 
417 
436  void
437  write_gnuplot(const std::string & base_name,
438  const std::vector<Point<dim>> &postprocessor_locations =
439  std::vector<Point<dim>>());
440 
441 
467 
475  void
476  get_support_locations(std::vector<std::vector<Point<dim>>> &locations);
477 
487  void
488  get_postprocessor_locations(const Quadrature<dim> & quadrature,
489  std::vector<Point<dim>> &locations);
490 
502  void
503  close();
504 
505 
515  void
516  clear();
517 
523  void
524  status(std::ostream &out);
525 
526 
535  bool
536  deep_check(const bool strict);
537 
542  "A call has been made to push_back_independent() when "
543  "no independent values were requested.");
544 
550  "This error is thrown to indicate that the data sets appear to be out of "
551  "sync. The class requires that the number of dataset keys is the same as "
552  "the number of independent values sets and mesh linked value sets. The "
553  "number of each of these is allowed to differ by one to allow new values "
554  "to be added with out restricting the order the user choses to do so. "
555  "Special cases of no FHandler and no independent values should not "
556  "trigger this error.");
557 
558 
564  "A method which requires access to a @p DoFHandler to be meaningful has "
565  "been called when have_dof_handler is false (most likely due to default "
566  "constructor being called). Only independent variables may be logged with "
567  "no DoFHandler.");
568 
574  "The triangulation has been refined or coarsened in some way. This "
575  "suggests that the internal DoF indices stored by the current "
576  "object are no longer meaningful.");
577 
578 private:
583  std::vector<double> dataset_key;
584 
588  std::vector<std::vector<double>> independent_values;
589 
595  std::vector<std::string> indep_names;
596 
604  std::map<std::string, std::vector<std::vector<double>>> data_store;
605 
609  std::map<std::string, ComponentMask> component_mask;
610 
611 
616  std::map<std::string, std::vector<std::string>> component_names_map;
617 
621  std::vector<internal::PointValueHistoryImplementation::PointGeometryData<dim>>
623 
624 
628  bool closed;
629 
633  bool cleared;
634 
635 
641 
642 
649 
655 
659  boost::signals2::connection tria_listener;
660 
664  unsigned int n_indep;
665 
666 
674  void
676 };
677 
678 
680 #endif /* dealii_point_value_history_h */
void add_field_name(const std::string &vector_name, const ComponentMask &component_mask=ComponentMask())
void evaluate_field_at_requested_location(const std::string &name, const VectorType &solution)
boost::signals2::connection tria_listener
void add_point(const Point< dim > &location)
std::map< std::string, ComponentMask > component_mask
std::vector< internal::PointValueHistoryImplementation::PointGeometryData< dim > > point_geometry_data
std::map< std::string, std::vector< std::string > > component_names_map
PointValueHistory & operator=(const PointValueHistory &point_value_history)
void evaluate_field(const std::string &name, const VectorType &solution)
SmartPointer< const DoFHandler< dim >, PointValueHistory< dim > > dof_handler
Vector< double > mark_support_locations()
std::vector< std::string > indep_names
void write_gnuplot(const std::string &base_name, const std::vector< Point< dim >> &postprocessor_locations=std::vector< Point< dim >>())
std::vector< double > dataset_key
void status(std::ostream &out)
void add_independent_names(const std::vector< std::string > &independent_names)
void get_support_locations(std::vector< std::vector< Point< dim >>> &locations)
PointValueHistory(const unsigned int n_independent_variables=0)
void get_postprocessor_locations(const Quadrature< dim > &quadrature, std::vector< Point< dim >> &locations)
void add_points(const std::vector< Point< dim >> &locations)
std::map< std::string, std::vector< std::vector< double > > > data_store
void add_component_names(const std::string &vector_name, const std::vector< std::string > &component_names)
void start_new_dataset(const double key)
std::vector< std::vector< double > > independent_values
void push_back_independent(const std::vector< double > &independent_values)
bool deep_check(const bool strict)
Definition: point.h:111
Definition: vector.h:109
PointGeometryData(const Point< dim > &new_requested_location, const std::vector< Point< dim >> &new_locations, const std::vector< types::global_dof_index > &new_sol_indices)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
static ::ExceptionBase & ExcNoIndependent()
static ::ExceptionBase & ExcDoFHandlerChanged()
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:487
static ::ExceptionBase & ExcDataLostSync()
static ::ExceptionBase & ExcDoFHandlerRequired()