Skip to content

Commit

Permalink
added group by materials
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfunk committed Jan 21, 2025
1 parent 8310f35 commit c12a7ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
9 changes: 8 additions & 1 deletion bluemira/base/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ class ConstructionParams(TypedDict):
component_filter: NotRequired[Callable[[Component], bool] | None]
n_sectors: NotRequired[int | None]
total_sectors: NotRequired[int | None]
group_by_materials: NotRequired[bool]


@dataclass(frozen=True)
Expand All @@ -148,6 +149,7 @@ class ConstructionParamValues:
component_filter: Callable[[Component], bool] | None
n_sectors: int
total_sectors: int
group_by_materials: bool

@classmethod
def empty(cls) -> ConstructionParamValues:
Expand All @@ -164,6 +166,7 @@ def empty(cls) -> ConstructionParamValues:
component_filter=None,
n_sectors=1,
total_sectors=1,
group_by_materials=False,
)

@classmethod
Expand Down Expand Up @@ -196,6 +199,7 @@ def from_construction_params(cls, construction_params: ConstructionParams | None
component_filter=comp_filter,
n_sectors=n_secs,
total_sectors=tot_secs,
group_by_materials=construction_params.get("groups_by_materials", False),
)


Expand Down Expand Up @@ -522,7 +526,10 @@ def build_comp_manager_save_xyz_cad_tree(
comp_manager, construction_params
)

mat_to_comps_map = _group_physical_components_by_material(constructed_phy_comps)
if construction_params.group_by_materials:
mat_to_comps_map = _group_physical_components_by_material(constructed_phy_comps)

Check warning on line 530 in bluemira/base/tools.py

View check run for this annotation

Codecov / codecov/patch

bluemira/base/tools.py#L530

Added line #L530 was not covered by tests
else:
mat_to_comps_map = {"": constructed_phy_comps}

return_comp = Component(name=manager_name)
return_comp.children = _build_compounds_from_map(
Expand Down
13 changes: 8 additions & 5 deletions eudemo/eudemo/reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
11. Produce power cycle report
"""

import sys
from pathlib import Path

import matplotlib.pyplot as plt
Expand Down Expand Up @@ -667,6 +666,14 @@ def build_radiation_plugs(
vv_thermal_shield, cryostat_thermal_shield
)

reactor.save_cad(
"xyz",
{
"with_components": [reactor.thermal_shield, reactor.pf_coils],
"group_by_materials": True,
},
)

reactor.coil_structures = build_coil_structures(
reactor_config.params_for("Coil structures"),
reactor_config.config_for("Coil structures"),
Expand Down Expand Up @@ -750,10 +757,6 @@ def build_radiation_plugs(
n_TF=reactor_config.global_params.n_TF.value,
)

reactor.save_cad()

sys.exit()

debug = [upper_port_koz_xz, eq_port_koz_xz, lower_port_koz_xz]
debug.extend(reactor.pf_coils.xz_boundary)
# I know there are clashes, I need to put in dynamic bounds on position opt to
Expand Down

0 comments on commit c12a7ed

Please sign in to comment.