suanPan
Mass.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (C) 2017-2023 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  ******************************************************************************/
55 #ifndef MASS_H
56 #define MASS_H
57 
58 #include <Element/Element.h>
59 
60 class MassBase : public Element {
61 public:
62  MassBase(unsigned, // tag
63  unsigned, // number of nodes
64  unsigned, // number of dofs
65  uvec&&, // node encoding
66  std::vector<DOF>&& // dof identifier
67  );
68 
69  int update_status() override;
70 
71  int commit_status() override;
72  int clear_status() override;
73  int reset_status() override;
74 
75  void print() override;
76 
77 #ifdef SUANPAN_VTK
78  void Setup() override;
79  void GetData(vtkSmartPointer<vtkDoubleArray>&, OutputType) override;
80  mat GetData(OutputType) override;
81  void SetDeformation(vtkSmartPointer<vtkPoints>&, double) override;
82 #endif
83 };
84 
85 class Mass2D final : public MassBase {
86  const double magnitude;
87 
88  const uvec dof_label;
89 
90 public:
91  Mass2D(unsigned, // element tag
92  unsigned, // node tag
93  double, // magnitude
94  uvec&& // dof tags
95  );
96 
97  int initialize(const shared_ptr<DomainBase>&) override;
98 };
99 
100 class Mass3D final : public MassBase {
101  const double magnitude;
102 
103  const uvec dof_label;
104 
105 public:
106  Mass3D(unsigned, // element tag
107  unsigned, // node tag
108  double, // magnitude
109  uvec&& // dof tags
110  );
111 
112  int initialize(const shared_ptr<DomainBase>&) override;
113 };
114 
115 class MassPoint2D final : public MassBase {
116  const double translational_magnitude;
117  const double rotational_magnitude;
118 
119 public:
120  MassPoint2D(unsigned, // element tag
121  unsigned, // node tag
122  double // translational magnitude
123  );
124  MassPoint2D(unsigned, // element tag
125  unsigned, // node tag
126  double, // translational magnitude
127  double // rotational magnitude
128  );
129 
130  int initialize(const shared_ptr<DomainBase>&) override;
131 };
132 
133 class MassPoint3D final : public MassBase {
134  const double translational_magnitude;
135  const double rotational_magnitude;
136 
137 public:
138  MassPoint3D(unsigned, // element tag
139  unsigned, // node tag
140  double // translational magnitude
141  );
142  MassPoint3D(unsigned, // element tag
143  unsigned, // node tag
144  double, // translational magnitude
145  double // rotational magnitude
146  );
147 
148  int initialize(const shared_ptr<DomainBase>&) override;
149 };
150 
151 #endif
152 
OutputType
Definition: OutputType.h:21
A Element class.
Definition: Element.h:92
Definition: Mass.h:85
int initialize(const shared_ptr< DomainBase > &) override
Definition: Mass.cpp:90
Mass2D(unsigned, unsigned, double, uvec &&)
Definition: Mass.cpp:76
Definition: Mass.h:100
int initialize(const shared_ptr< DomainBase > &) override
Definition: Mass.cpp:116
Mass3D(unsigned, unsigned, double, uvec &&)
Definition: Mass.cpp:99
Definition: Mass.h:60
int commit_status() override
Definition: Mass.cpp:26
void print() override
Definition: Mass.cpp:32
int clear_status() override
Definition: Mass.cpp:28
int reset_status() override
Definition: Mass.cpp:30
int update_status() override
Definition: Mass.cpp:24
MassBase(unsigned, unsigned, unsigned, uvec &&, std::vector< DOF > &&)
Definition: Mass.cpp:21
Definition: Mass.h:115
int initialize(const shared_ptr< DomainBase > &) override
Definition: Mass.cpp:135
MassPoint2D(unsigned, unsigned, double)
Definition: Mass.cpp:125
Definition: Mass.h:133
MassPoint3D(unsigned, unsigned, double)
Definition: Mass.cpp:146
int initialize(const shared_ptr< DomainBase > &) override
Definition: Mass.cpp:156