suanPan
🧮 An Open Source, Parallel and Heterogeneous Finite Element Analysis Framework
Loading...
Searching...
No Matches
Recorder.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2026 Theodore Chang
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 ******************************************************************************/
27#ifndef RECORDER_H
28#define RECORDER_H
29
30#include <Domain/Tag.h>
31#include <Recorder/OutputType.h>
32
33class DomainBase;
34
35class Recorder : public UniqueTag {
36 const bool use_hdf5;
37
38 static auto normalise_size(std::vector<std::vector<vec>>&);
39
40protected:
41 static std::vector<vec> normalise_size(std::vector<vec>&&);
42
44 const int component;
45 const unsigned interval;
47
49 std::vector<double> time_pool; // recorded data
50 std::unordered_map<uword, std::vector<std::vector<vec>>> data_pool; // recorded data
51
52 unsigned counter = 0u;
53
54 virtual const uvec& update_tag(const shared_ptr<DomainBase>&);
55
56 virtual void record_impl(const shared_ptr<DomainBase>&) = 0;
57
58public:
60 unsigned, // tag
61 uvec&&, // object tags
62 OutputType, // recorder type
63 unsigned, // interval
64 bool // if to use hdf5
65 );
66
67 virtual void initialize(const shared_ptr<DomainBase>&);
68
69 void insert(double);
70 void insert(std::vector<vec>&&, uword);
71
72 void record(const shared_ptr<DomainBase>&);
73
74 virtual void clear_status();
75
76 virtual void save();
77
78 void print() override;
79};
80
81#endif
82
OutputType
Definition OutputType.h:23
The DomainBase class is a template.
Definition DomainBase.h:94
A Recorder class.
Definition Recorder.h:35
std::vector< double > time_pool
Definition Recorder.h:49
const unsigned interval
Definition Recorder.h:45
unsigned counter
Definition Recorder.h:52
const OutputType variable_type
Definition Recorder.h:43
void insert(double)
Definition Recorder.cpp:74
const int component
Definition Recorder.h:44
const OutputType original_type
Definition Recorder.h:43
const uvec reference_tag
Definition Recorder.h:46
virtual const uvec & update_tag(const shared_ptr< DomainBase > &)
Definition Recorder.cpp:53
virtual void save()
Definition Recorder.cpp:95
virtual void clear_status()
Definition Recorder.cpp:88
virtual void initialize(const shared_ptr< DomainBase > &)
Definition Recorder.cpp:72
std::unordered_map< uword, std::vector< std::vector< vec > > > data_pool
Definition Recorder.h:50
void record(const shared_ptr< DomainBase > &)
Definition Recorder.cpp:84
uvec object_tag
Definition Recorder.h:48
virtual void record_impl(const shared_ptr< DomainBase > &)=0
void print() override
Definition Recorder.cpp:168
Label objects that cannot be copied.
Definition Tag.h:88