engforge 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- engforge/__init__.py +26 -0
- engforge/_testing_components.py +864 -0
- engforge/analysis.py +257 -0
- engforge/attr_dynamics.py +222 -0
- engforge/attr_plotting.py +811 -0
- engforge/attr_signals.py +116 -0
- engforge/attr_slots.py +211 -0
- engforge/attr_solver.py +443 -0
- engforge/attributes.py +326 -0
- engforge/common.py +76 -0
- engforge/component_collections.py +276 -0
- engforge/components.py +55 -0
- engforge/configuration.py +673 -0
- engforge/dataframe.py +185 -0
- engforge/datastores/__init__.py +116 -0
- engforge/datastores/data.py +519 -0
- engforge/datastores/gdocs.py +2650 -0
- engforge/datastores/reporting.py +935 -0
- engforge/datastores/secrets.py +549 -0
- engforge/dynamics.py +662 -0
- engforge/eng/__init__.py +0 -0
- engforge/eng/costs.py +1459 -0
- engforge/eng/fluid_material.py +279 -0
- engforge/eng/geometry.py +1060 -0
- engforge/eng/pipes.py +1211 -0
- engforge/eng/prediction.py +366 -0
- engforge/eng/solid_materials.py +445 -0
- engforge/eng/structure.py +2228 -0
- engforge/eng/structure_beams.py +821 -0
- engforge/eng/thermodynamics.py +271 -0
- engforge/engforge_attributes.py +380 -0
- engforge/env_var.py +214 -0
- engforge/locations.py +18 -0
- engforge/logging.py +290 -0
- engforge/patterns.py +449 -0
- engforge/problem_context.py +2251 -0
- engforge/properties.py +501 -0
- engforge/reporting.py +595 -0
- engforge/solveable.py +964 -0
- engforge/solver.py +316 -0
- engforge/solver_utils.py +726 -0
- engforge/system.py +143 -0
- engforge/system_reference.py +299 -0
- engforge/tabulation.py +288 -0
- engforge/test/__init__.py +2 -0
- engforge/test/_pre_test_structures.py +221 -0
- engforge/test/report_testing.py +158 -0
- engforge/test/test_airfilter.py +91 -0
- engforge/test/test_analysis.py +3 -0
- engforge/test/test_comp_iter.py +196 -0
- engforge/test/test_composition.py +139 -0
- engforge/test/test_costs.py +338 -0
- engforge/test/test_dynamics.py +109 -0
- engforge/test/test_dynamics_spaces.py +39 -0
- engforge/test/test_four_bar.py +97 -0
- engforge/test/test_modules.py +72 -0
- engforge/test/test_performance.py +93 -0
- engforge/test/test_pipes.py +49 -0
- engforge/test/test_problem.py +411 -0
- engforge/test/test_problem_deepscoping.py +68 -0
- engforge/test/test_slider_crank.py +51 -0
- engforge/test/test_solver.py +343 -0
- engforge/test/test_tabulation.py +233 -0
- engforge/typing.py +92 -0
- engforge-0.3.0.dist-info/METADATA +392 -0
- engforge-0.3.0.dist-info/RECORD +69 -0
- engforge-0.3.0.dist-info/WHEEL +5 -0
- engforge-0.3.0.dist-info/licenses/LICENSE +7 -0
- engforge-0.3.0.dist-info/top_level.txt +1 -0
engforge/components.py
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from contextlib import contextmanager
|
|
2
|
+
import attr
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
# from engforge.logging import LoggingMixin, log
|
|
6
|
+
from engforge.tabulation import TabulationMixin, system_property
|
|
7
|
+
from engforge.configuration import forge, Configuration
|
|
8
|
+
from engforge.solver import SolveableMixin
|
|
9
|
+
from engforge.properties import class_cache
|
|
10
|
+
from engforge.dynamics import DynamicsMixin
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
import os, sys
|
|
14
|
+
import inspect
|
|
15
|
+
|
|
16
|
+
# import pathlib
|
|
17
|
+
import random
|
|
18
|
+
import matplotlib.pyplot as plt
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@forge
|
|
22
|
+
class SolveableInterface(Configuration, TabulationMixin, SolveableMixin):
|
|
23
|
+
"""common base betwewn solvable and system"""
|
|
24
|
+
|
|
25
|
+
parent: typing.Union["Component", "System"] = attr.ib(default=None)
|
|
26
|
+
_last_context: "ProblemExec"
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def last_context(self):
|
|
30
|
+
"""get the last context run, or the parent's"""
|
|
31
|
+
if hasattr(self, "_last_context"):
|
|
32
|
+
# cleanup parent context
|
|
33
|
+
if hasattr(self, "_parent_context") and not self.parent.last_context:
|
|
34
|
+
del self._last_context
|
|
35
|
+
del self._parent_context
|
|
36
|
+
else:
|
|
37
|
+
return self._last_context
|
|
38
|
+
elif (
|
|
39
|
+
hasattr(self, "parent")
|
|
40
|
+
and self.parent
|
|
41
|
+
and (ctx := self.parent.last_context)
|
|
42
|
+
):
|
|
43
|
+
self._last_context = ctx
|
|
44
|
+
self._parent_context = True
|
|
45
|
+
return ctx
|
|
46
|
+
return None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# NOTE: components / systems not interchangable, systems are like components but are have solver capabilities
|
|
50
|
+
# TODO: justify separation of components and systems, and not making system a subclass of component. Otherwise make system a subclass of component
|
|
51
|
+
@forge
|
|
52
|
+
class Component(SolveableInterface, DynamicsMixin):
|
|
53
|
+
"""Component is an Evaluatable configuration with tabulation, and solvable functionality"""
|
|
54
|
+
|
|
55
|
+
pass
|