-
Notifications
You must be signed in to change notification settings - Fork 35
Ondrej Michal - Mesh & Optimization settings #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2a3523b
initial commit
78c47aa
Merge remote-tracking branch 'remotes/origin/main' into OndrejMichal-…
9f0e66a
mesh and optimization settings finished incl. unit tests
82d2c12
Merge remote-tracking branch 'remotes/origin/main' into OndrejMichal-…
cb8ba8e
SurfacesShapeOfFiniteElements enum added
dca26b3
enum added to test_Calculate.py
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,170 @@ | ||
| from RFEM.initModel import Model, CheckAddonStatus, SetAddonStatus, clearAtributes | ||
|
|
||
| class MeshSettings(): | ||
| ComonMeshConfig: dict = { | ||
| 'general_target_length_of_fe': None, | ||
| 'general_maximum_distance_between_node_and_line': None, | ||
| 'general_maximum_number_of_mesh_nodes': None, | ||
| 'members_number_of_divisions_for_special_types': None, | ||
| 'members_activate_division_for_large_deformation_and_post_critical_analysis': None, | ||
| 'members_number_of_divisions_for_result_diagram': None, | ||
| 'members_number_of_divisions_for_min_max_values': None, | ||
| 'members_use_division_for_concrete_members': None, | ||
| 'members_number_of_divisions_for_concrete_members': None, | ||
| 'members_use_division_for_straight_members': None, | ||
| 'members_division_for_straight_members_type': None, | ||
| 'members_length_of_fe': None, | ||
| 'members_minimum_number_of_divisions': None, | ||
| 'members_use_division_for_members_with_nodes': None, | ||
| 'surfaces_maximum_ratio_of_fe': None, | ||
| 'surfaces_maximum_out_of_plane_inclination': None, | ||
| 'surfaces_mesh_refinement': None, | ||
| 'surfaces_relationship': None, | ||
| 'surfaces_integrate_also_unutilized_objects': None, | ||
| 'surfaces_shape_of_finite_elements': None, | ||
| 'surfaces_same_squares': None, | ||
| 'surfaces_triangles_for_membranes': None, | ||
| 'surfaces_mapped_mesh_preferred': None, | ||
| 'solids_use_refinement_if_containing_close_nodes': None, | ||
| 'solids_maximum_number_of_elements': None} | ||
| SurfacesMeshQualityConfig: dict = { | ||
| 'mesh_quality_color_indicator_ok_color': None, | ||
| 'mesh_quality_color_indicator_warning_color': None, | ||
| 'mesh_quality_color_indicator_failure_color': None, | ||
| 'QualityCriteriaConfig': { | ||
| 'quality_criterion_check_aspect_ratio': None, | ||
| 'quality_criterion_check_aspect_ratio_warning': None, | ||
| 'quality_criterion_check_aspect_ratio_failure': None, | ||
| 'quality_criterion_parallel_deviations': None, | ||
| 'quality_criterion_parallel_deviations_warning': None, | ||
| 'quality_criterion_parallel_deviations_failure': None, | ||
| 'quality_criterion_corner_angles_of_triangle_elements': None, | ||
| 'quality_criterion_corner_angles_of_triangle_elements_warning': None, | ||
| 'quality_criterion_corner_angles_of_triangle_elements_failure': None, | ||
| 'quality_criterion_corner_angles_of_quadrangle_elements': None, | ||
| 'quality_criterion_corner_angles_of_quadrangle_elements_warning': None, | ||
| 'quality_criterion_corner_angles_of_quadrangle_elements_failure': None, | ||
| 'quality_criterion_warping_of_membrane_elements': None, | ||
| 'quality_criterion_warping_of_membrane_elements_warning': None, | ||
| 'quality_criterion_warping_of_membrane_elements_failure': None, | ||
| 'quality_criterion_warping_of_non_membrane_elements': None, | ||
| 'quality_criterion_warping_of_non_membrane_elements_warning': None, | ||
| 'quality_criterion_warping_of_non_membrane_elements_failure': None, | ||
| 'quality_criterion_jacobian_ratio': None, | ||
| 'quality_criterion_jacobian_ratio_warning': None, | ||
| 'quality_criterion_jacobian_ratio_failure': None}} | ||
| SolidsMeshQualityConfig: dict = { | ||
| 'mesh_quality_color_indicator_ok_color': None, | ||
| 'mesh_quality_color_indicator_warning_color': None, | ||
| 'mesh_quality_color_indicator_failure_color': None, | ||
| 'QualityCriteriaConfig': { | ||
| 'quality_criterion_check_aspect_ratio': None, | ||
| 'quality_criterion_check_aspect_ratio_warning': None, | ||
| 'quality_criterion_check_aspect_ratio_failure': None, | ||
| 'quality_criterion_parallel_deviations': None, | ||
| 'quality_criterion_parallel_deviations_warning': None, | ||
| 'quality_criterion_parallel_deviations_failure': None, | ||
| 'quality_criterion_corner_angles_of_triangle_elements': None, | ||
| 'quality_criterion_corner_angles_of_triangle_elements_warning': None, | ||
| 'quality_criterion_corner_angles_of_triangle_elements_failure': None, | ||
| 'quality_criterion_corner_angles_of_quadrangle_elements': None, | ||
| 'quality_criterion_corner_angles_of_quadrangle_elements_warning': None, | ||
| 'quality_criterion_corner_angles_of_quadrangle_elements_failure': None, | ||
| 'quality_criterion_warping': None, | ||
| 'quality_criterion_warping_warning': None, | ||
| 'quality_criterion_warping_failure': None, | ||
| 'quality_criterion_jacobian_ratio': None, | ||
| 'quality_criterion_jacobian_ratio_warning': None, | ||
| 'quality_criterion_jacobian_ratio_failure': None}} | ||
| WindSimulationMeshConfig: dict = { | ||
| 'windsimulation_mesh_config_value_simplify_model': None, | ||
| 'windsimulation_mesh_config_value_determine_details_by': None, | ||
| 'windsimulation_mesh_config_value_level_of_details': None, | ||
| 'windsimulation_mesh_config_value_detail_size': None, | ||
| 'windsimulation_mesh_config_value_small_openings_closure_type': None, | ||
| 'windsimulation_mesh_config_value_small_openings_closure_value': None, | ||
| 'windsimulation_mesh_config_value_optimized_member_topology': None, | ||
| 'windsimulation_mesh_config_value_optimized_member_topo_value': None, | ||
| 'windsimulation_mesh_config_value_active_objects_only': None, | ||
| 'windsimulation_mesh_config_value_terrain': None, | ||
| 'windsimulation_mesh_config_value_terrain_from_model': None, | ||
| 'windsimulation_mesh_config_value_terrain_objects_id': None, | ||
| 'windsimulation_mesh_config_value_terrain_objects_all': None, | ||
| 'windsimulation_mesh_config_value_surrounding_model': None, | ||
| 'windsimulation_mesh_config_value_surrounding_model_ifc_objects_id': None, | ||
| 'windsimulation_mesh_config_value_surrounding_model_ifc_objects_all': None, | ||
| 'windsimulation_mesh_config_value_surrounding_model_visual_objects_id': None, | ||
| 'windsimulation_mesh_config_value_surrounding_model_visual_objects_all': None, | ||
| 'windsimulation_mesh_config_value_keep_results_if_mesh_deleted': None, | ||
| 'windsimulation_mesh_config_value_consider_surface_thickness': None, | ||
| 'windsimulation_mesh_config_value_run_rwind_silent': None} | ||
|
|
||
| def __init__(self, | ||
| commonConfig: dict = ComonMeshConfig, | ||
| surfaceConfig: dict = SurfacesMeshQualityConfig, | ||
| solidConfig: dict = SolidsMeshQualityConfig, | ||
| windConfig: dict = WindSimulationMeshConfig): | ||
| """ | ||
| The object is automaticaly created therefore we can assume that it will not be created but only updated. | ||
| Only posititve values are recognized. | ||
|
|
||
| Args: | ||
| commonConfig: common parameters settings | ||
| surfaceConfig: surface specific parameters | ||
| solidConfig: solid specific parameters | ||
| windConfig: wind specific parameters; use only when Wind Simulation Add-on is active | ||
| """ | ||
| # Get current mesh settings | ||
| config = Model.clientModel.service.get_mesh_settings() | ||
|
|
||
| clientObject = {} | ||
| for i in config: | ||
| if i[0] == 'windSimulationMeshConfig': | ||
| if CheckAddonStatus(Model.clientModel, 'wind_simulation_active'): | ||
| clientObject[i[0]] = config[i[0]] | ||
| else: | ||
| clientObject[i[0]] = config[i[0]] | ||
|
|
||
| # No parameter can be set to None | ||
| for key in commonConfig: | ||
| if commonConfig[key]: | ||
| clientObject[key] = commonConfig[key] | ||
| for key in surfaceConfig: | ||
| if key == 'QualityCriteriaConfig': | ||
| for key_ in surfaceConfig['QualityCriteriaConfig']: | ||
| if surfaceConfig['QualityCriteriaConfig'][key_]: | ||
| clientObject['SurfacesMeshQualityConfig']['QualityCriteriaConfig'][key_] = surfaceConfig['QualityCriteriaConfig'][key_] | ||
| elif surfaceConfig[key]: | ||
| clientObject['SurfacesMeshQualityConfig'][key] = surfaceConfig[key] | ||
| for key in solidConfig: | ||
| if key == 'QualityCriteriaConfig': | ||
| for key_ in solidConfig['QualityCriteriaConfig']: | ||
| if solidConfig['QualityCriteriaConfig'][key_]: | ||
| clientObject['SolidsMeshQualityConfig']['QualityCriteriaConfig'][key_] = solidConfig['QualityCriteriaConfig'][key_] | ||
| elif solidConfig[key]: | ||
| clientObject['SolidsMeshQualityConfig'][key] = solidConfig[key] | ||
| if CheckAddonStatus(Model.clientModel, 'wind_simulation_active'): | ||
| for key in windConfig: | ||
| if windConfig[key]: | ||
| clientObject['windSimulationMeshConfig'][key] = windConfig[key] | ||
|
|
||
| # Add Mesh Settings to client model | ||
| Model.clientModel.service.set_mesh_settings(clientObject) | ||
|
|
||
| def get_mesh_settings(self): | ||
| return Model.clientModel.service.get_mesh_settings() | ||
|
|
||
| def set_mesh_settings(self, all_settings): | ||
| new_sett = {} | ||
|
|
||
| for i in all_settings: | ||
| if i[0] == 'windSimulationMeshConfig': | ||
| if CheckAddonStatus(Model.clientModel, 'wind_simulation_active'): | ||
| new_sett['wind_simulation_active'] = all_settings['wind_simulation_active'] | ||
| else: | ||
| new_sett[i[0]] = all_settings[i[0]] | ||
|
|
||
| Model.clientModel.service.set_mesh_settings(new_sett) | ||
|
|
||
| def get_model_info(self): | ||
| return Model.clientModel.service.get_model_info() | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better explain users, which configuration has controlled by which data type(integer, string, boolean or enumeration item).
There are two possible ways:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I can not add default values. I have to differ which parameters are set and which are not. This class is just prototype to show user, which parameters can be set. Frankly, I'm not able to describe them more eloquently than the name of the parameter itself :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe adding type of parameters in DocStrings can help us to document this. That looks like my duty 👍🏻