Spaces:
Sleeping
Sleeping
| """Abstract base class for analytical structural solvers. | |
| Every solver implements exact closed-form solutions from classical mechanics. | |
| No numerical approximation — these are the ground truth the neural surrogate | |
| learns to approximate. | |
| """ | |
| from abc import ABC, abstractmethod | |
| from typing import Any | |
| from src.data.schema import SolutionResult | |
| class AnalyticalSolver(ABC): | |
| """Base class for all analytical structural solvers. | |
| Each subclass implements solve() for a specific structural element | |
| (beam, plate, pressure vessel) using exact closed-form equations. | |
| """ | |
| def solve(self, params: dict[str, Any]) -> SolutionResult: | |
| """Compute analytical solution for given parameters. | |
| Args: | |
| params: Dictionary of input parameters (geometry, material, loading). | |
| Returns: | |
| SolutionResult with max_stress, max_deflection, safety_factor, | |
| and safety_category. | |
| """ | |
| def config_id(self) -> str: | |
| """Unique identifier for this solver configuration.""" | |
| def problem_family(self) -> str: | |
| """Problem family: 'beam', 'plate', or 'vessel'.""" | |