Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
62fdf92
[FXC-3529] Introduce `EntitySelector` data model into `EntityList` (#…
benflexcompute Oct 7, 2025
eb83310
[FXC-3530] Added `EntitySelector` expansion function (#1471)
benflexcompute Oct 10, 2025
90d1d15
Merge branch 'develop' into BenY/FXC-3494/TextExpression
benflexcompute Oct 10, 2025
e31ab25
[FXC-3554] `EntitySelector` generation flunet API (#1492)
benflexcompute Oct 13, 2025
55eb9ba
Merge remote-tracking branch 'origin/main' into BenY/FXC-3494/TextExp…
benflexcompute Oct 23, 2025
bbc4862
Merge branch 'develop' into BenY/FXC-3494/TextExpression
benflexcompute Oct 23, 2025
7a5c783
Removed Flow360BaseModel inheritance from InputFileModel
benflexcompute Oct 23, 2025
9b1f154
Merge branch 'develop' into BenY/FXC-3494/TextExpression
benflexcompute Oct 28, 2025
ab0d402
Merge branch 'develop' into BenY/FXC-3494/TextExpression
benflexcompute Oct 31, 2025
1853352
Merge branch 'develop' into BenY/FXC-3494/TextExpression
benflexcompute Nov 4, 2025
bfc1974
Merge branch 'develop' into BenY/FXC-3494/TextExpression
benflexcompute Nov 9, 2025
bea49d3
Merge branch 'develop' into BenY/FXC-3494/TextExpression
benflexcompute Nov 9, 2025
515741b
Merge branch 'main' into BenY/FXC-3494/TextExpression
benflexcompute Nov 14, 2025
bfe189a
Merge branch 'main' into BenY/FXC-3494/TextExpression
benflexcompute Nov 14, 2025
e737e5f
Merge branch 'main' into BenY/FXC-3494/TextExpression
benflexcompute Nov 17, 2025
ddb1952
Merge branch 'main' into BenY/FXC-3494/TextExpression
benflexcompute Nov 17, 2025
fcd9fc6
[Text expression] Update the service to ensure expanding before the v…
benflexcompute Nov 18, 2025
2022f42
Merge branch 'main' into BenY/FXC-3494/TextExpression
benflexcompute Nov 18, 2025
d1baa32
Merge remote-tracking branch 'origin/main' into BenY/FXC-3494/TextExp…
benflexcompute Nov 18, 2025
abd127c
fix(): Moving the preprocessing of dict before validaiton into a func…
benflexcompute Nov 19, 2025
21bf112
feat: add selector tokenization support (#1608)
benflexcompute Nov 19, 2025
910ea49
Merge branch 'main' into BenY/FXC-3494/TextExpression
benflexcompute Nov 20, 2025
25d4e8e
Added description and `selector_id` (#1610)
benflexcompute Nov 21, 2025
dbbf286
Added description and `selector_id` (#1612)
benflexcompute Nov 21, 2025
737932b
Added contexted field/model validators (#1613)
benflexcompute Nov 22, 2025
364b86c
renamed to contextual and also examined stored entities validations
benflexcompute Nov 22, 2025
4914ccb
Added unit test ensuring the entities matched by selectors are remove…
benflexcompute Nov 22, 2025
e5fd513
Added warning and empty selector error
benflexcompute Nov 22, 2025
7417dfb
QOL: Removed the logging for unit system internally
benflexcompute Nov 22, 2025
6c6fa57
Fixed unit test
benflexcompute Nov 22, 2025
faa0098
Merge remote-tracking branch 'origin/main' into BenY/FXC-3494/TextExp…
benflexcompute Nov 22, 2025
2c9614d
Fixed linting
benflexcompute Nov 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions flow360/component/results/base_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

from flow360.cloud.s3_utils import get_local_filename_and_create_folders
from flow360.component.simulation.entity_info import GeometryEntityInfo
from flow360.component.simulation.framework.entity_expansion_utils import (
expand_entity_list_in_context,
)
from flow360.component.simulation.models.surface_models import BoundaryBase
from flow360.component.simulation.simulation_params import SimulationParams
from flow360.component.v1.flow360_params import Flow360Params
Expand Down Expand Up @@ -673,7 +676,6 @@ def full_name_pattern(word: str) -> re.Pattern:
return rf"^(?:{re.escape(word)}|[^/]+/{re.escape(word)})$"

self.reload_data() # Remove all the imposed filters
print(">> _x_columns =", self._x_columns)
raw_values = {}
for x_column in self._x_columns:
raw_values[x_column] = np.array(self.raw_values[x_column])
Expand Down Expand Up @@ -712,9 +714,8 @@ def by_boundary_condition(self, params: SimulationParams) -> PerEntityResultCSVM
if not isinstance(model, BoundaryBase):
continue
boundary_name = model.name if model.name is not None else model.type
entity_groups[boundary_name].extend(
[entity.name for entity in model.entities.stored_entities]
)
entity_names = expand_entity_list_in_context(model.entities, params, return_names=True)
entity_groups[boundary_name].extend(entity_names)
self_copy = copy.deepcopy(self) # Shield from modifying the current instance
# pylint: disable=protected-access
return self_copy._create_forces_group(entity_groups=entity_groups)
Expand Down
2 changes: 2 additions & 0 deletions flow360/component/results/results_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def _collect_disk_axes_and_centers(
for model in params.models:
if model.type != model_type:
continue
# No draft entity (cylinder) selector so it is fine.
for cyl in model.entities.stored_entities:
# Axis is assumed normalized by the inputs
# pylint:disable=protected-access
Expand Down Expand Up @@ -475,6 +476,7 @@ def format_headers(

diskCount = 0
for disk in bet_disks:
# No draft entity (cylinder) selector so it is fine.
for disk_local_index, cylinder in enumerate(disk.entities.stored_entities):
new_name = pattern.replace("$BETName", disk.name)
new_name = new_name.replace("$CylinderName", cylinder.name)
Expand Down
11 changes: 0 additions & 11 deletions flow360/component/simulation/entity_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,14 +625,3 @@ def parse_entity_info_model(data) -> EntityInfoUnion:
parse entity info data and return one of [GeometryEntityInfo, VolumeMeshEntityInfo, SurfaceMeshEntityInfo]
"""
return pd.TypeAdapter(EntityInfoUnion).validate_python(data)


def get_entity_info_type_from_str(entity_type: str) -> type[EntityInfoModel]:
"""Get EntityInfo type from the asset type from the project tree"""
entity_info_type = None
if entity_type == "Geometry":
entity_info_type = GeometryEntityInfo
if entity_type == "VolumeMesh":
entity_info_type = VolumeMeshEntityInfo

return entity_info_type
51 changes: 2 additions & 49 deletions flow360/component/simulation/framework/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import rich
import unyt as u
import yaml
from pydantic import ConfigDict
from pydantic._internal._decorators import Decorator, FieldValidatorDecoratorInfo
from pydantic_core import InitErrorDetails

from flow360.component.simulation.conversion import need_conversion
from flow360.component.simulation.framework.base_model_config import base_model_config
from flow360.component.simulation.validation import validation_context
from flow360.error_messages import do_not_modify_file_manually_msg
from flow360.exceptions import Flow360FileError
Expand Down Expand Up @@ -60,34 +60,6 @@ def _preprocess_nested_list(value, required_by, params, exclude, flow360_unit_sy
return new_list


def snake_to_camel(string: str) -> str:
"""
Convert a snake_case string to camelCase.

This function takes a snake_case string as input and converts it to camelCase.
It splits the input string by underscores, capitalizes the first letter of
each subsequent component (after the first one), and joins them together.

Parameters:
string (str): The input string in snake_case format.

Returns:
str: The converted string in camelCase format.

Example:
>>> snake_to_camel("example_snake_case")
'exampleSnakeCase'
"""
components = string.split("_")

camel_case_string = components[0]

for component in components[1:]:
camel_case_string += component[0].upper() + component[1:]

return camel_case_string


class Conflicts(pd.BaseModel):
"""
Wrapper for handling fields that cannot be specified simultaneously
Expand Down Expand Up @@ -153,26 +125,7 @@ def __pydantic_init_subclass__(cls, **kwargs) -> None:
cls.model_rebuild(force=True)
super().__pydantic_init_subclass__(**kwargs) # Correct use of super

model_config = ConfigDict(
##:: Pydantic kwargs
arbitrary_types_allowed=True, # ?
extra="forbid",
frozen=False,
populate_by_name=True,
validate_assignment=True,
validate_default=True,
##:: Custom keys
require_one_of=[],
allow_but_remove=[],
conflicting_fields=[],
include_hash=False,
include_defaults_in_schema=True,
# pylint: disable=fixme
# TODO: Remove alias_generator since it is only for translator
alias_generator=pd.AliasGenerator(
serialization_alias=snake_to_camel,
),
)
model_config = base_model_config

def __setattr__(self, name, value):
# pylint: disable=unsupported-membership-test, unsubscriptable-object
Expand Down
55 changes: 55 additions & 0 deletions flow360/component/simulation/framework/base_model_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""
Sharing the config for base models to reduce unnecessary inheritance from Flow360BaseModel.
"""

import pydantic as pd


def snake_to_camel(string: str) -> str:
"""
Convert a snake_case string to camelCase.

This function takes a snake_case string as input and converts it to camelCase.
It splits the input string by underscores, capitalizes the first letter of
each subsequent component (after the first one), and joins them together.

Parameters:
string (str): The input string in snake_case format.

Returns:
str: The converted string in camelCase format.

Example:
>>> snake_to_camel("example_snake_case")
'exampleSnakeCase'
"""
components = string.split("_")

camel_case_string = components[0]

for component in components[1:]:
camel_case_string += component[0].upper() + component[1:]

return camel_case_string


base_model_config = pd.ConfigDict(
##:: Pydantic kwargs
arbitrary_types_allowed=True, # ?
extra="forbid",
frozen=False,
populate_by_name=True,
validate_assignment=True,
validate_default=True,
##:: Custom keys
require_one_of=[],
allow_but_remove=[],
conflicting_fields=[],
include_hash=False,
include_defaults_in_schema=True,
# pylint: disable=fixme
# TODO: Remove alias_generator since it is only for translator
alias_generator=pd.AliasGenerator(
serialization_alias=snake_to_camel,
),
)
Loading
Loading