Reference documentation for deal.II version GIT relicensing-439-g5fda5c893d 2024-04-20 06:50: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\}}\)
Loading...
Searching...
No Matches
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
22#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 <fstream>
39#include <iostream>
40#include <map>
41#include <sstream>
42#include <string>
43#include <vector>
44
46
47namespace internal
48{
49 namespace PointValueHistoryImplementation
50 {
55 template <int dim>
57 {
58 public:
63 const Point<dim> &new_requested_location,
64 const std::vector<Point<dim>> &new_locations,
65 const std::vector<types::global_dof_index> &new_sol_indices);
67 std::vector<Point<dim>> support_point_locations;
68 std::vector<types::global_dof_index> solution_indices;
69 };
70 } // namespace PointValueHistoryImplementation
71} // namespace internal
72
73
74
211template <int dim>
213{
214public:
220 PointValueHistory(const unsigned int n_independent_variables = 0);
221
237 const unsigned int n_independent_variables = 0);
238
244 PointValueHistory(const PointValueHistory &point_value_history);
245
254 operator=(const PointValueHistory &point_value_history);
255
260
268 void
269 add_point(const Point<dim> &location);
270
281 void
282 add_points(const std::vector<Point<dim>> &locations);
283
284
285
293 void
294 add_field_name(const std::string &vector_name,
295 const ComponentMask &component_mask = {});
296
305 void
306 add_field_name(const std::string &vector_name,
307 const unsigned int n_components);
308
313 void
314 add_component_names(const std::string &vector_name,
315 const std::vector<std::string> &component_names);
316
321 void
322 add_independent_names(const std::vector<std::string> &independent_names);
323
324
325
334 template <typename VectorType>
335 void
336 evaluate_field(const std::string &name, const VectorType &solution);
337
338
356 template <typename VectorType>
357 void
358 evaluate_field(const std::vector<std::string> &names,
359 const VectorType &solution,
360 const DataPostprocessor<dim> &data_postprocessor,
361 const Quadrature<dim> &quadrature);
362
368 template <typename VectorType>
369 void
370 evaluate_field(const std::string &name,
371 const VectorType &solution,
372 const DataPostprocessor<dim> &data_postprocessor,
373 const Quadrature<dim> &quadrature);
374
375
388 template <typename VectorType>
389 void
390 evaluate_field_at_requested_location(const std::string &name,
391 const VectorType &solution);
392
393
402 void
403 start_new_dataset(const double key);
404
411 void
412 push_back_independent(const std::vector<double> &independent_values);
413
414
433 void
434 write_gnuplot(const std::string &base_name,
435 const std::vector<Point<dim>> &postprocessor_locations =
436 std::vector<Point<dim>>());
437
438
464
472 void
473 get_support_locations(std::vector<std::vector<Point<dim>>> &locations);
474
484 void
486 std::vector<Point<dim>> &locations);
487
499 void
500 close();
501
502
512 void
513 clear();
514
520 void
521 status(std::ostream &out);
522
523
532 bool
533 deep_check(const bool strict);
534
539 "A call has been made to push_back_independent() when "
540 "no independent values were requested.");
541
547 "This error is thrown to indicate that the data sets appear to be out of "
548 "sync. The class requires that the number of dataset keys is the same as "
549 "the number of independent values sets and mesh linked value sets. The "
550 "number of each of these is allowed to differ by one to allow new values "
551 "to be added with out restricting the order the user choses to do so. "
552 "Special cases of no FHandler and no independent values should not "
553 "trigger this error.");
554
555
561 "A method which requires access to a @p DoFHandler to be meaningful has "
562 "been called when have_dof_handler is false (most likely due to default "
563 "constructor being called). Only independent variables may be logged with "
564 "no DoFHandler.");
565
571 "The triangulation has been refined or coarsened in some way. This "
572 "suggests that the internal DoF indices stored by the current "
573 "object are no longer meaningful.");
574
575private:
580 std::vector<double> dataset_key;
581
585 std::vector<std::vector<double>> independent_values;
586
592 std::vector<std::string> indep_names;
593
601 std::map<std::string, std::vector<std::vector<double>>> data_store;
602
606 std::map<std::string, ComponentMask> component_mask;
607
608
613 std::map<std::string, std::vector<std::string>> component_names_map;
614
618 std::vector<internal::PointValueHistoryImplementation::PointGeometryData<dim>>
620
621
625 bool closed;
626
631
632
638
639
646
652
656 boost::signals2::connection tria_listener;
657
661 unsigned int n_indep;
662
663
671 void
673};
674
675
677#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)
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
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:111
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
static ::ExceptionBase & ExcNoIndependent()
static ::ExceptionBase & ExcDataLostSync()
static ::ExceptionBase & ExcDoFHandlerRequired()
#define DeclExceptionMsg(Exception, defaulttext)
Definition exceptions.h:494
static ::ExceptionBase & ExcDoFHandlerChanged()