-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "[SCFD-3769] fix(): Python submited ghost surface not …
…recogniz…" (#732) This reverts commit 8f78b18. Fixed the optaional setting and also add symeetric back
- Loading branch information
1 parent
3e34f1d
commit baae401
Showing
29 changed files
with
1,546 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
flow360/component/simulation/framework/updater_functions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
"""Implementation of the updater functions. The updated.py should just import functions from here.""" | ||
|
||
|
||
def fix_ghost_sphere_schema(*, params_as_dict: dict): | ||
""" | ||
The previous ghost farfield has wrong schema (bug) and therefore needs data alternation. | ||
""" | ||
|
||
def i_am_outdated_ghost_sphere(*, data: dict): | ||
"""Identify if the current dict is a outdated ghost sphere.""" | ||
if "type_name" in data.keys() and data["type_name"] == "GhostSphere": | ||
return True | ||
return False | ||
|
||
def recursive_fix_ghost_surface(*, data): | ||
if isinstance(data, dict): | ||
# 1. Check if this is a ghost sphere instance | ||
if i_am_outdated_ghost_sphere(data=data): | ||
data.pop("type_name") | ||
data["private_attribute_entity_type_name"] = "GhostSphere" | ||
|
||
# 2. Otherwise, recurse into each item in the dictionary | ||
for _, val in data.items(): | ||
recursive_fix_ghost_surface( | ||
data=val, | ||
) | ||
|
||
elif isinstance(data, list): | ||
# Recurse into each item in the list | ||
for _, item in enumerate(data): | ||
recursive_fix_ghost_surface(data=item) | ||
|
||
recursive_fix_ghost_surface(data=params_as_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.