-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfemessentials.py
52 lines (36 loc) · 1.46 KB
/
femessentials.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""This module provides classes that contain material properties and geometric properties."""
import numpy as np
from abc import ABC
class Material:
"""This is a class that contains material properties."""
def __init__(self, name: str, e_young: np.float64, a_thermal: np.float64 = 1e-5):
self.name = name
self.e_young = e_young
self.a_thermal = a_thermal
def get_e_young(self) -> np.float64:
return self.e_young
def get_a_thermal(self) -> np.float64:
return self.a_thermal
class BaseProperties(ABC):
"""This is a base class that contains geometric properties."""
def __init__(self, name):
self.name = name
class PlanarTrussProperties(BaseProperties):
"""Contains the geometric properties(area) of a planar truss structure."""
def __init__(self, name: str, area: np.float64):
super().__init__(name)
self.area = area
def get_area(self) -> np.float64:
return self.area
class PlanarBeamProperties(BaseProperties):
def __init__(self, name: str, area: np.float64, moment_of_inertia: np.float64, height: np.float64 = None):
super().__init__(name)
self.area = area
self.moment_of_inertia = moment_of_inertia
self.height = height
def get_area(self) -> np.float64:
return self.area
def get_moment_of_inertia(self) -> np.float64:
return self.moment_of_inertia
def get_height(self) -> np.float64:
return self.height