MaterialProperties.py 1.6 KB
Newer Older
Jiahang Chen's avatar
Jiahang Chen committed
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
53
54
55
56
57
58
59
60
61
from ml.ml40.features.properties.values.value import Value


class MaterialProperties(Value):
    def __init__(self, name="", identifier=""):
        super().__init__(
            name=name,
            identifier=identifier)
        self.__load_changes = None
        self.__material_type = None
        self.__yield_strength = None
        self.__young_modulus = None
        self.__json_out = dict()

    @property
    def loadChanges(self):
        return self.__load_changes

    @loadChanges.setter
    def loadChanges(self, value):
        self.__load_changes = value

    @property
    def materialType(self):
        return self.__material_type

    @materialType.setter
    def materialType(self, value):
        self.__material_type = value

    @property
    def yieldStrength(self):
        return self.__yield_strength

    @yieldStrength.setter
    def yieldStrength(self, value):
        self.__yield_strength = value

    @property
    def youngModulus(self):
        return self.__young_modulus

    @youngModulus.setter
    def youngModulus(self, value):
        self.__young_modulus = value

    def to_json(self):
        self.__json_out = super().to_json()
        if self.loadChanges is not None:
            self.__json_out["loadChanges"] = self.loadChanges

        if self.materialType is not None:
            self.__json_out["materialType"] = self.materialType

        if self.yieldStrength is not None:
            self.__json_out["yieldStrength"] = self.yieldStrength

        if self.youngModulus is not None:
            self.__json_out["youngModulus"] = self.youngModulus

        return self.__json_out