suanPan
Modifier.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  ******************************************************************************/
28 #ifndef MODIFIER_H
29 #define MODIFIER_H
30 
31 #include <Domain/Tag.h>
32 #include <Element/Element.h>
33 
34 class DomainBase;
35 
36 class Modifier : public Tag {
37 protected:
39 
40  std::vector<weak_ptr<Element>> element_pool;
41 
42 public:
43  explicit Modifier(
44  unsigned = 0, // tag
45  uvec&& = {} // element tags
46  );
47  Modifier(const Modifier&) = delete; // copy forbidden
48  Modifier(Modifier&&) = delete; // move forbidden
49  Modifier& operator=(const Modifier&) = delete; // assign forbidden
50  Modifier& operator=(Modifier&&) = delete; // assign forbidden
51 
52  ~Modifier() override = default;
53 
54  [[nodiscard]] virtual bool has_nonviscous() const { return false; }
55 
56  virtual int initialize(const shared_ptr<DomainBase>&);
57 
58  virtual bool if_apply(const shared_ptr<DomainBase>&);
59 
60  virtual int update_status() = 0;
61 };
62 
63 class ModifierDynamics : public Modifier {
64 public:
65  using Modifier::Modifier;
66 
67  bool if_apply(const shared_ptr<DomainBase>&) override;
68 };
69 
70 #endif
71 
The DomainBase class is a template.
Definition: DomainBase.h:104
Definition: Modifier.h:63
bool if_apply(const shared_ptr< DomainBase > &) override
Definition: Modifier.cpp:43
A Modifier class.
Definition: Modifier.h:36
Modifier & operator=(const Modifier &)=delete
std::vector< weak_ptr< Element > > element_pool
Definition: Modifier.h:40
Modifier & operator=(Modifier &&)=delete
virtual bool has_nonviscous() const
Definition: Modifier.h:54
virtual int initialize(const shared_ptr< DomainBase > &)
Definition: Modifier.cpp:26
uvec element_tag
Definition: Modifier.h:38
Modifier(unsigned=0, uvec &&={})
Definition: Modifier.cpp:22
virtual int update_status()=0
Modifier(Modifier &&)=delete
Modifier(const Modifier &)=delete
~Modifier() override=default
virtual bool if_apply(const shared_ptr< DomainBase > &)
Definition: Modifier.cpp:41
A base Tag class.
Definition: Tag.h:38