Reference documentation for deal.II version GIT 2f5445400b 2023-02-05 22:30:02+00:00
\(\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 
29 
31 #include <deal.II/fe/fe_q.h>
32 #include <deal.II/fe/fe_values.h>
33 #include <deal.II/fe/mapping.h>
34 
35 #include <deal.II/lac/vector.h>
36 
38 
39 #include <fstream>
40 #include <iostream>
41 #include <map>
42 #include <sstream>
43 #include <string>
44 #include <vector>
45 
47 
48 namespace internal
49 {
50  namespace PointValueHistoryImplementation
51  {
56  template <int dim>
58  {
59  public:
64  const Point<dim> & new_requested_location,
65  const std::vector<Point<dim>> & new_locations,
66  const std::vector<types::global_dof_index> &new_sol_indices);
68  std::vector<Point<dim>> support_point_locations;
69  std::vector<types::global_dof_index> solution_indices;
70  };
71  } // namespace PointValueHistoryImplementation
72 } // namespace internal
73 
74 
75 
212 template <int dim>
214 {
215 public:
221  PointValueHistory(const unsigned int n_independent_variables = 0);
222 
238  const unsigned int n_independent_variables = 0);
239 
245  PointValueHistory(const PointValueHistory &point_value_history);
246 
255  operator=(const PointValueHistory &point_value_history);
256 
261 
269  void
270  add_point(const Point<dim> &location);
271 
282  void
283  add_points(const std::vector<Point<dim>> &locations);
284 
285 
286 
294  void
295  add_field_name(const std::string & vector_name,
297 
306  void
307  add_field_name(const std::string &vector_name,
308  const unsigned int n_components);
309 
314  void
315  add_component_names(const std::string & vector_name,
316  const std::vector<std::string> &component_names);
317 
322  void
323  add_independent_names(const std::vector<std::string> &independent_names);
324 
325 
326 
335  template <class VectorType>
336  void
337  evaluate_field(const std::string &name, const VectorType &solution);
338 
339 
357  template <class VectorType>
358  void
359  evaluate_field(const std::vector<std::string> &names,
360  const VectorType & solution,
361  const DataPostprocessor<dim> & data_postprocessor,
362  const Quadrature<dim> & quadrature);
363 
369  template <class VectorType>
370  void
371  evaluate_field(const std::string & name,
372  const VectorType & solution,
373  const DataPostprocessor<dim> &data_postprocessor,
374  const Quadrature<dim> & quadrature);
375 
376 
389  template <class VectorType>
390  void
391  evaluate_field_at_requested_location(const std::string &name,
392  const VectorType & solution);
393 
394 
403  void
404  start_new_dataset(const double key);
405 
412  void
413  push_back_independent(const std::vector<double> &independent_values);
414 
415 
434  void
435  write_gnuplot(const std::string & base_name,
436  const std::vector<Point<dim>> &postprocessor_locations =
437  std::vector<Point<dim>>());
438 
439 
465 
473  void
474  get_support_locations(std::vector<std::vector<Point<dim>>> &locations);
475 
485  void
486  get_postprocessor_locations(const Quadrature<dim> & quadrature,
487  std::vector<Point<dim>> &locations);
488 
500  void
501  close();
502 
503 
513  void
514  clear();
515 
521  void
522  status(std::ostream &out);
523 
524 
533  bool
534  deep_check(const bool strict);
535 
540  "A call has been made to push_back_independent() when "
541  "no independent values were requested.");
542 
548  "This error is thrown to indicate that the data sets appear to be out of "
549  "sync. The class requires that the number of dataset keys is the same as "
550  "the number of independent values sets and mesh linked value sets. The "
551  "number of each of these is allowed to differ by one to allow new values "
552  "to be added with out restricting the order the user choses to do so. "
553  "Special cases of no FHandler and no independent values should not "
554  "trigger this error.");
555 
556 
562  "A method which requires access to a @p DoFHandler to be meaningful has "
563  "been called when have_dof_handler is false (most likely due to default "
564  "constructor being called). Only independent variables may be logged with "
565  "no DoFHandler.");
566 
572  "The triangulation has been refined or coarsened in some way. This "
573  "suggests that the internal DoF indices stored by the current "
574  "object are no longer meaningful.");
575 
576 private:
581  std::vector<double> dataset_key;
582 
586  std::vector<std::vector<double>> independent_values;
587 
593  std::vector<std::string> indep_names;
594 
602  std::map<std::string, std::vector<std::vector<double>>> data_store;
603 
607  std::map<std::string, ComponentMask> component_mask;
608 
609 
614  std::map<std::string, std::vector<std::string>> component_names_map;
615 
619  std::vector<internal::PointValueHistoryImplementation::PointGeometryData<dim>>
621 
622 
626  bool closed;
627 
631  bool cleared;
632 
633 
639 
640 
647 
653 
657  boost::signals2::connection tria_listener;
658 
662  unsigned int n_indep;
663 
664 
672  void
674 };
675 
676 
678 #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:461
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:462
static ::ExceptionBase & ExcNoIndependent()
static ::ExceptionBase & ExcDoFHandlerChanged()
#define DeclExceptionMsg(Exception, defaulttext)
Definition: exceptions.h:488
static ::ExceptionBase & ExcDataLostSync()
static ::ExceptionBase & ExcDoFHandlerRequired()