-
Notifications
You must be signed in to change notification settings - Fork 0
/
mass.h
37 lines (33 loc) · 922 Bytes
/
mass.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
// Represents an ideal point mass with 1 DOF (horizontal motion only)
class Mass {
friend class Problem;
public:
double m; // mass value
double px; // horizontal position
double py; // vertical position
int xIndex; // global index of horizontal degree of freedom
// Assignment
Mass &operator=(const Mass &rhs) {
this->m = rhs.m;
this->px = rhs.px;
this->py = rhs.py;
this->xIndex = rhs.xIndex;
return *this;
}
// Copy constructor
Mass(const Mass &rhs) {
this->m = rhs.m;
this->px = rhs.px;
this->py = rhs.py;
this->xIndex = rhs.xIndex;
}
private:
// Mass instances can only be constructed by Problem instances
Mass(double m, double px, double py, int xIndex) {
this->m = m;
this->px = px;
this->py = py;
this->xIndex = xIndex;
}
};