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