Reference documentation for deal.II version Git f40be01994 2020-04-09 07:13:12 +0200
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
point_value_history.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2009 - 2018 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 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/point.h>
24 #include <deal.II/base/quadrature_lib.h>
25 #include <deal.II/base/smartpointer.h>
26 #include <deal.II/base/utilities.h>
27 
28 #include <deal.II/dofs/dof_accessor.h>
29 #include <deal.II/dofs/dof_handler.h>
30 
31 #include <deal.II/fe/component_mask.h>
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/grid/grid_tools.h>
38 
39 #include <deal.II/lac/vector.h>
40 
41 #include <deal.II/numerics/data_postprocessor.h>
42 
43 #include <fstream>
44 #include <iostream>
45 #include <map>
46 #include <sstream>
47 #include <string>
48 #include <vector>
49 
50 DEAL_II_NAMESPACE_OPEN
51 
52 namespace internal
53 {
54  namespace PointValueHistoryImplementation
55  {
60  template <int dim>
62  {
63  public:
65  const Point<dim> & new_requested_location,
66  const std::vector<Point<dim>> & new_locations,
67  const std::vector<types::global_dof_index> &new_sol_indices);
68  Point<dim> requested_location;
69  std::vector<Point<dim>> support_point_locations;
70  std::vector<types::global_dof_index> solution_indices;
71  };
72  } // namespace PointValueHistoryImplementation
73 } // namespace internal
74 
75 
76 
213 template <int dim>
215 {
216 public:
222  PointValueHistory(const unsigned int n_independent_variables = 0);
223 
238  PointValueHistory(const DoFHandler<dim> &dof_handler,
239  const unsigned int n_independent_variables = 0);
240 
246  PointValueHistory(const PointValueHistory &point_value_history);
247 
256  operator=(const PointValueHistory &point_value_history);
257 
262 
270  void
271  add_point(const Point<dim> &location);
272 
283  void
284  add_points(const std::vector<Point<dim>> &locations);
285 
286 
287 
295  void
296  add_field_name(const std::string & vector_name,
297  const ComponentMask &component_mask = ComponentMask());
298 
307  void
308  add_field_name(const std::string &vector_name,
309  const unsigned int n_components);
310 
315  void
316  add_component_names(const std::string & vector_name,
317  const std::vector<std::string> &component_names);
318 
323  void
324  add_independent_names(const std::vector<std::string> &independent_names);
325 
326 
327 
336  template <class VectorType>
337  void
338  evaluate_field(const std::string &name, const VectorType &solution);
339 
340 
358  template <class VectorType>
359  void
360  evaluate_field(const std::vector<std::string> &names,
361  const VectorType & solution,
362  const DataPostprocessor<dim> & data_postprocessor,
363  const Quadrature<dim> & quadrature);
364 
370  template <class VectorType>
371  void
372  evaluate_field(const std::string & name,
373  const VectorType & solution,
374  const DataPostprocessor<dim> &data_postprocessor,
375  const Quadrature<dim> & quadrature);
376 
377 
390  template <class VectorType>
391  void
392  evaluate_field_at_requested_location(const std::string &name,
393  const VectorType & solution);
394 
395 
404  void
405  start_new_dataset(const double key);
406 
413  void
414  push_back_independent(const std::vector<double> &independent_values);
415 
416 
435  void
436  write_gnuplot(const std::string & base_name,
437  const std::vector<Point<dim>> &postprocessor_locations =
438  std::vector<Point<dim>>());
439 
440 
465  mark_support_locations();
466 
474  void
475  get_support_locations(std::vector<std::vector<Point<dim>>> &locations);
476 
485  DEAL_II_DEPRECATED
486  void
487  get_points(std::vector<std::vector<Point<dim>>> &locations);
488 
498  void
499  get_postprocessor_locations(const Quadrature<dim> & quadrature,
500  std::vector<Point<dim>> &locations);
501 
513  void
514  close();
515 
516 
526  void
527  clear();
528 
534  void
535  status(std::ostream &out);
536 
537 
546  bool
547  deep_check(const bool strict);
548 
552  DeclExceptionMsg(ExcNoIndependent,
553  "A call has been made to push_back_independent() when "
554  "no independent values were requested.");
555 
560  ExcDataLostSync,
561  "This error is thrown to indicate that the data sets appear to be out of "
562  "sync. The class requires that the number of dataset keys is the same as "
563  "the number of independent values sets and mesh linked value sets. The "
564  "number of each of these is allowed to differ by one to allow new values "
565  "to be added with out restricting the order the user choses to do so. "
566  "Special cases of no FHandler and no independent values should not "
567  "trigger this error.");
568 
569 
574  ExcDoFHandlerRequired,
575  "A method which requires access to a @p DoFHandler to be meaningful has "
576  "been called when have_dof_handler is false (most likely due to default "
577  "constructor being called). Only independent variables may be logged with "
578  "no DoFHandler.");
579 
584  ExcDoFHandlerChanged,
585  "The triangulation has been refined or coarsened in some way. This "
586  "suggests that the internal DoF indices stored by the current "
587  "object are no longer meaningful.");
588 
589 private:
594  std::vector<double> dataset_key;
595 
599  std::vector<std::vector<double>> independent_values;
600 
606  std::vector<std::string> indep_names;
607 
615  std::map<std::string, std::vector<std::vector<double>>> data_store;
616 
620  std::map<std::string, ComponentMask> component_mask;
621 
622 
627  std::map<std::string, std::vector<std::string>> component_names_map;
628 
632  std::vector<internal::PointValueHistoryImplementation::PointGeometryData<dim>>
634 
635 
639  bool closed;
640 
644  bool cleared;
645 
646 
652 
653 
660 
666 
670  boost::signals2::connection tria_listener;
671 
675  unsigned int n_indep;
676 
677 
685  void
686  tria_change_listener();
687 };
688 
689 
690 DEAL_II_NAMESPACE_CLOSE
691 #endif /* dealii_point_value_history_h */
std::vector< std::vector< double > > independent_values
std::vector< internal::PointValueHistoryImplementation::PointGeometryData< dim > > point_geometry_data
std::vector< double > dataset_key
std::vector< std::string > indep_names
SmartPointer< const DoFHandler< dim >, PointValueHistory< dim > > dof_handler
boost::signals2::connection tria_listener
PointGeometryData(const Point< dim > &new_requested_location, const std::vector< Point< dim >> &new_locations, const std::vector< types::global_dof_index > &new_sol_indices)
Only a constructor needed for this class (a struct really)
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:496
std::map< std::string, std::vector< std::vector< double > > > data_store
std::map< std::string, ComponentMask > component_mask
std::map< std::string, std::vector< std::string > > component_names_map