suanPan
ConditionalModifier.h
Go to the documentation of this file.
1/*******************************************************************************
2 * Copyright (C) 2017-2024 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 ******************************************************************************/
33#ifndef CONDITIONALMODIFIER_H
34#define CONDITIONALMODIFIER_H
35
36#include <Domain/Tag.h>
37
38class DomainBase;
39class Amplitude;
40
41class ConditionalModifier : public Tag {
42protected:
43 const bool initialized = false;
44
45 const bool connected = false;
46
47 unsigned start_step, end_step = static_cast<unsigned>(-1);
48
49 const unsigned amplitude_tag;
50
51 uvec node_encoding; // node/element encoding
52 uvec dof_reference; // reference DoF ZERO based
53 uvec dof_encoding; // DoF encoding
54
55 shared_ptr<Amplitude> magnitude;
56
61 uvec get_nodal_active_dof(const shared_ptr<DomainBase>&);
66 uvec get_all_nodal_active_dof(const shared_ptr<DomainBase>&);
67
68public:
70 unsigned, // tag
71 unsigned, // step tag
72 unsigned, // amplitude tag
73 uvec&&, // node tag
74 uvec&& // dof tag
75 );
76
77 virtual int initialize(const shared_ptr<DomainBase>&);
78
85 virtual int process(const shared_ptr<DomainBase>&) = 0;
93 virtual int process_resistance(const shared_ptr<DomainBase>&);
94
100 virtual void stage(const shared_ptr<DomainBase>&) {}
101
102 [[nodiscard]] const uvec& get_node_encoding() const;
103 [[nodiscard]] const uvec& get_dof_encoding() const;
104
105 void set_initialized(bool) const;
106 [[nodiscard]] bool is_initialized() const;
107
108 void set_start_step(unsigned);
109 [[nodiscard]] unsigned get_start_step() const;
110
111 void set_end_step(unsigned);
112 [[nodiscard]] unsigned get_end_step() const;
113
119 void set_connected(bool) const;
120 [[nodiscard]] bool is_connected() const;
121
122 [[nodiscard]] bool validate_step(const shared_ptr<DomainBase>&) const;
123
124 // some may manage state
125 virtual void update_status(const vec&);
126 virtual void commit_status();
127 virtual void clear_status();
128 virtual void reset_status();
129};
130
131#endif
132
An Amplitude class that can generate Amplitude pattern.
Definition: Amplitude.h:67
A ConditionalModifier class.
Definition: ConditionalModifier.h:41
void set_connected(bool) const
Some constraints may modify global stiffness matrix so that it needs to be treated as an element whic...
Definition: ConditionalModifier.cpp:98
uvec dof_reference
Definition: ConditionalModifier.h:52
void set_initialized(bool) const
Definition: ConditionalModifier.cpp:83
const uvec & get_node_encoding() const
Definition: ConditionalModifier.cpp:79
virtual int process(const shared_ptr< DomainBase > &)=0
This method provides all necessary pieces of typical constraints/loads required, including additional...
unsigned get_end_step() const
Definition: ConditionalModifier.cpp:96
virtual int initialize(const shared_ptr< DomainBase > &)
Definition: ConditionalModifier.cpp:56
void set_end_step(unsigned)
Definition: ConditionalModifier.cpp:94
const bool initialized
Definition: ConditionalModifier.h:43
bool is_connected() const
Definition: ConditionalModifier.cpp:100
virtual void commit_status()
Definition: ConditionalModifier.cpp:109
uvec get_all_nodal_active_dof(const shared_ptr< DomainBase > &)
Generate active DoF vector from all nodes in the model.
Definition: ConditionalModifier.cpp:37
ConditionalModifier(unsigned, unsigned, unsigned, uvec &&, uvec &&)
Definition: ConditionalModifier.cpp:49
virtual void reset_status()
Definition: ConditionalModifier.cpp:113
bool is_initialized() const
Definition: ConditionalModifier.cpp:85
uvec dof_encoding
Definition: ConditionalModifier.h:53
const uvec & get_dof_encoding() const
Definition: ConditionalModifier.cpp:81
virtual void stage(const shared_ptr< DomainBase > &)
Some algorithms needs to manually modify some variables after solving. Typical example is the predict...
Definition: ConditionalModifier.h:100
const bool connected
Definition: ConditionalModifier.h:45
void set_start_step(unsigned)
Definition: ConditionalModifier.cpp:87
uvec get_nodal_active_dof(const shared_ptr< DomainBase > &)
Generate active DoF vector from assigned nodes.
Definition: ConditionalModifier.cpp:24
virtual void clear_status()
Definition: ConditionalModifier.cpp:111
uvec node_encoding
Definition: ConditionalModifier.h:51
bool validate_step(const shared_ptr< DomainBase > &) const
Definition: ConditionalModifier.cpp:102
virtual int process_resistance(const shared_ptr< DomainBase > &)
For some algorithms, the global stiffness is formed only once in each substep. After calling solver,...
Definition: ConditionalModifier.cpp:77
unsigned get_start_step() const
Definition: ConditionalModifier.cpp:92
const unsigned amplitude_tag
Definition: ConditionalModifier.h:49
shared_ptr< Amplitude > magnitude
Definition: ConditionalModifier.h:55
virtual void update_status(const vec &)
Definition: ConditionalModifier.cpp:107
unsigned end_step
Definition: ConditionalModifier.h:47
unsigned start_step
Definition: ConditionalModifier.h:47
The DomainBase class is a template.
Definition: DomainBase.h:104
A base Tag class.
Definition: Tag.h:38