Loading [MathJax]/extensions/TeX/newcommand.js
 deal.II version GIT relicensing-2846-g6fb608615f 2025-03-15 04:10:00+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\}}
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
point_value_history.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2009 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15
16#ifndef dealii_point_value_history_h
17#define dealii_point_value_history_h
18
19#include <deal.II/base/config.h>
20
23#include <deal.II/base/point.h>
25
28
30#include <deal.II/fe/fe_q.h>
32#include <deal.II/fe/mapping.h>
33
34#include <deal.II/lac/vector.h>
35
37
38#include <boost/signals2/connection.hpp>
39
40#include <fstream>
41#include <iostream>
42#include <map>
43#include <sstream>
44#include <string>
45#include <vector>
46
48
49namespace internal
50{
51 namespace PointValueHistoryImplementation
52 {
57 template <int dim>
59 {
60 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
213template <int dim>
215{
216public:
222 PointValueHistory(const unsigned int n_independent_variables = 0);
223
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 = {});
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 <typename VectorType>
337 void
338 evaluate_field(const std::string &name, const VectorType &solution);
339
340
358 template <typename 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 <typename 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 <typename 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
466
474 void
475 get_support_locations(std::vector<std::vector<Point<dim>>> &locations);
476
486 void
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
541 "A call has been made to push_back_independent() when "
542 "no independent values were requested.");
543
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 without restricting the order the user chooses to do so. "
554 "Special cases of no FHandler and no independent values should not "
555 "trigger this error.");
556
557
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
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
577private:
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
633
634
640
641
648
654
658 boost::signals2::connection tria_listener;
659
663 unsigned int n_indep;
664
665
673 void
675};
676
677
679#endif /* dealii_point_value_history_h */
void evaluate_field_at_requested_location(const std::string &name, const VectorType &solution)
void add_field_name(const std::string &vector_name, const ComponentMask &component_mask={})
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)
ObserverPointer< const DoFHandler< dim >, PointValueHistory< dim > > dof_handler
void evaluate_field(const std::string &name, const VectorType &solution)
Vector< double > mark_support_locations()
std::vector< std::string > indep_names
std::vector< double > dataset_key
void write_gnuplot(const std::string &base_name, const std::vector< Point< dim > > &postprocessor_locations=std::vector< Point< dim > >())
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)
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)
void add_points(const std::vector< Point< dim > > &locations)
std::vector< std::vector< double > > independent_values
void push_back_independent(const std::vector< double > &independent_values)
void get_postprocessor_locations(const Quadrature< dim > &quadrature, std::vector< Point< dim > > &locations)
bool deep_check(const bool strict)
Definition point.h:113
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:40
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:41
static ::ExceptionBase & ExcNoIndependent()
static ::ExceptionBase & ExcDataLostSync()
static ::ExceptionBase & ExcDoFHandlerRequired()
#define DeclExceptionMsg(Exception, defaulttext)
static ::ExceptionBase & ExcDoFHandlerChanged()