Coverage for mpcforces_extractor\api\db\models.py: 100%
33 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-17 22:54 +0100
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-17 22:54 +0100
1from typing import Dict
2from sqlmodel import SQLModel, Field, Column, JSON
5class RBE3DBModel(SQLModel, table=True):
6 """
7 Database Representation of RBE3 Class
8 """
10 id: int = Field(primary_key=True)
11 config: str = Field() # Store MPC_CONFIG as a string
12 master_node: int = Field() # Store master node as an integer
13 nodes: str = Field() # Store nodes as a string
14 part_id2nodes: Dict = Field(
15 default_factory=dict, sa_column=Column(JSON)
16 ) # Store part_id2nodes as a dictionary
17 subcase_id2part_id2forces: Dict = Field(
18 default_factory=dict, sa_column=Column(JSON)
19 ) # Store subcase_id2part_id2forces as a dictionary
22class RBE2DBModel(SQLModel, table=True):
23 """
24 Database Representation of RBE2 Class
25 """
27 id: int = Field(primary_key=True)
28 config: str = Field() # Store MPC_CONFIG as a string
29 master_node: int = Field() # Store master node as an integer
30 nodes: str = Field() # Store nodes as a string
31 part_id2nodes: Dict = Field(
32 default_factory=dict, sa_column=Column(JSON)
33 ) # Store part_id2nodes as a dictionary
34 subcase_id2part_id2forces: Dict = Field(
35 default_factory=dict, sa_column=Column(JSON)
36 ) # Store subcase_id2part_id2forces as a dictionary
39class NodeDBModel(SQLModel, table=True):
40 """
41 Database Representation of Node Instance
42 """
44 id: int = Field(primary_key=True)
45 coord_x: float = Field()
46 coord_y: float = Field()
47 coord_z: float = Field()
48 fx: float = Field(default=0.0)
49 fy: float = Field(default=0.0)
50 fz: float = Field(default=0.0)
51 fabs: float = Field(default=0.0)
52 mx: float = Field(default=0.0)
53 my: float = Field(default=0.0)
54 mz: float = Field(default=0.0)
55 mabs: float = Field(default=0.0)
58class SubcaseDBModel(SQLModel, table=True):
59 """
60 Database Representation of Subcase Class
61 """
63 id: int = Field(primary_key=True)
64 node_id2forces: Dict = Field(default_factory=dict, sa_column=Column(JSON))
65 time: float = Field()