Reference documentation for deal.II version Git f0d9923401 2020-09-28 19:47:38 -0600
\(\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 - 2019 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 
38 
39 #include <deal.II/lac/vector.h>
40 
42 
43 #include <fstream>
44 #include <iostream>
45 #include <map>
46 #include <sstream>
47 #include <string>
48 #include <vector>
49 
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);
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 
486  void
487  get_postprocessor_locations(const Quadrature<dim> & quadrature,
488  std::vector<Point<dim>> &locations);
489 
501  void
502  close();
503 
504 
514  void
515  clear();
516 
522  void
523  status(std::ostream &out);
524 
525 
534  bool
535  deep_check(const bool strict);
536 
540  DeclExceptionMsg(ExcNoIndependent,
541  "A call has been made to push_back_independent() when "
542  "no independent values were requested.");
543 
548  ExcDataLostSync,
549  "This error is thrown to indicate that the data sets appear to be out of "
550  "sync. The class requires that the number of dataset keys is the same as "
551  "the number of independent values sets and mesh linked value sets. The "
552  "number of each of these is allowed to differ by one to allow new values "
553  "to be added with out restricting the order the user choses to do so. "
554  "Special cases of no FHandler and no independent values should not "
555  "trigger this error.");
556 
557 
562  ExcDoFHandlerRequired,
563  "A method which requires access to a @p DoFHandler to be meaningful has "
564  "been called when have_dof_handler is false (most likely due to default "
565  "constructor being called). Only independent variables may be logged with "
566  "no DoFHandler.");
567 
572  ExcDoFHandlerChanged,
573  "The triangulation has been refined or coarsened in some way. This "
574  "suggests that the internal DoF indices stored by the current "
575  "object are no longer meaningful.");
576 
577 private:
582  std::vector<double> dataset_key;
583 
587  std::vector<std::vector<double>> independent_values;
588 
594  std::vector<std::string> indep_names;
595 
603  std::map<std::string, std::vector<std::vector<double>>> data_store;
604 
608  std::map<std::string, ComponentMask> component_mask;
609 
610 
615  std::map<std::string, std::vector<std::string>> component_names_map;
616 
620  std::vector<internal::PointValueHistoryImplementation::PointGeometryData<dim>>
622 
623 
627  bool closed;
628 
632  bool cleared;
633 
634 
640 
641 
648 
654 
658  boost::signals2::connection tria_listener;
659 
663  unsigned int n_indep;
664 
665 
673  void
674  tria_change_listener();
675 };
676 
677 
679 #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
void write_gnuplot(const std::vector< Patch< dim, spacedim >> &patches, const std::vector< std::string > &data_names, const std::vector< std::tuple< unsigned int, unsigned int, std::string, DataComponentInterpretation::DataComponentInterpretation >> &nonscalar_data_ranges, const GnuplotFlags &flags, std::ostream &out)
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:493
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:363
std::map< std::string, std::vector< std::vector< double > > > data_store
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:362
std::map< std::string, ComponentMask > component_mask
std::map< std::string, std::vector< std::string > > component_names_map