Skip to content

Commit

Permalink
Remove dead and live, replace by static.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioannis-vm committed Dec 12, 2024
1 parent 0cd5eb4 commit c9a4dfd
Showing 1 changed file with 10 additions and 30 deletions.
40 changes: 10 additions & 30 deletions src/osmg/analysis/load_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,25 +614,14 @@ class HasLoads:


@dataclass(repr=False)
class DeadLoadCase(LoadCase, HasLoads):
"""Dead load case."""
class StaticLoadCase(LoadCase, HasLoads):
"""Static load case."""

analysis: StaticAnalysis = field(default_factory=StaticAnalysis)

def __post_init__(self) -> None:
"""Post-initialization."""
self._case_type = 'Dead'


@dataclass(repr=False)
class LiveLoadCase(LoadCase, HasLoads):
"""Live load case."""

analysis: StaticAnalysis = field(default_factory=StaticAnalysis)

def __post_init__(self) -> None:
"""Post-initialization."""
self._case_type = 'Live'
self._case_type = 'Static'


@dataclass(repr=False)
Expand Down Expand Up @@ -959,15 +948,9 @@ class LoadCaseRegistry:
Load case registry.
A load case registry is an organized collection of load cases.
Load cases are categorized based on the nature of the loads, such
as `dead`, `live`, or `seismic_elf`. Each type of loading
necessitates a specific type of analysis needed to estimate the
structural response, with most being static. Custom analyses which
don't need to conform to load type classification can use the
`other` load case.
The load case registry can be used to orchestrate all analyses,
retrieve, and post-process results.
Load cases are categorized based on the type of analysis required,
such as `static`, or `modal`. Custom analyses which don't need to
conform to load type classification can use the `other` load case.
"""

def __init__(
Expand All @@ -978,8 +961,7 @@ def __init__(
self.result_setup = result_setup or AnalysisResultSetup()

# Initialize defaultdicts with factory functions that include the model
self.dead = defaultdict(lambda: DeadLoadCase(model=self.model))
self.live = defaultdict(lambda: LiveLoadCase(model=self.model))
self.static = defaultdict(lambda: StaticLoadCase(model=self.model))
self.modal = defaultdict(lambda: ModalLoadCase(model=self.model))
self.seismic_elf = defaultdict(lambda: SeismicELFLoadCase(model=self.model))
self.seismic_rs = defaultdict(lambda: SeismicRSLoadCase(model=self.model))
Expand Down Expand Up @@ -1008,7 +990,7 @@ def self_weight(self, case_name: str, scaling_factor: float = 1.0) -> None:
for component in components:
weight_per_length = component.get_section().sec_w * scaling_factor
udl = UDL((0.00, 0.00, -weight_per_length))
self.dead[case_name].load_registry.component_udl[component.uid] = udl
self.static[case_name].load_registry.component_udl[component.uid] = udl

def self_mass(
self,
Expand Down Expand Up @@ -1079,8 +1061,7 @@ def get_load_cases(self) -> dict[LoadCase]:
Dictionary of load cases.
"""
return (
self.dead
| self.live
self.static
| self.modal
| self.seismic_elf
| self.seismic_rs
Expand Down Expand Up @@ -1149,8 +1130,7 @@ def combine_recorder(self, recorder_name: str) -> pd.DataFrame:
"""
# TODO(JVM): in progress.
cases_list = [
('dead', cast(defaultdict[str, LoadCase], self.dead)),
('live', cast(defaultdict[str, LoadCase], self.live)),
('dead', cast(defaultdict[str, LoadCase], self.static)),
]
all_data: dict[str, dict[str, pd.DataFrame]] = defaultdict(dict)
case_type_data = {}
Expand Down

0 comments on commit c9a4dfd

Please sign in to comment.