Skip to content

Commit 22395e0

Browse files
rafacantonPProfizi
andauthored
Remove _result_properties (#2365)
Co-authored-by: Paul Profizi <[email protected]>
1 parent 45dcabc commit 22395e0

File tree

3 files changed

+14
-80
lines changed

3 files changed

+14
-80
lines changed

src/ansys/dpf/core/available_result.py

Lines changed: 2 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ def name(self):
200200
"""Result operator."""
201201
if self._properties and "scripting_name" in self._properties.keys():
202202
name = self._properties["scripting_name"]
203-
elif self.operator_name in _result_properties:
204-
name = _result_properties[self.operator_name]["scripting_name"]
205203
else:
206204
name = _remove_spaces(self._physics_name)
207205
return _make_as_function_name(name)
@@ -266,8 +264,8 @@ def native_location(self):
266264
"""Native location of the result."""
267265
if hasattr(self, "_properties") and "location" in self._properties.keys():
268266
return self._properties["location"]
269-
if self.operator_name in _result_properties:
270-
return _result_properties[self.operator_name]["location"]
267+
else:
268+
return ""
271269

272270
@property
273271
def native_scoping_location(self):
@@ -307,60 +305,6 @@ def qualifier_combinations(self) -> List[dict]:
307305
return [q.__dict__() for q in self.qualifiers]
308306

309307

310-
_result_properties = {
311-
"S": {"location": "ElementalNodal", "scripting_name": "stress"},
312-
"ENF": {"location": "ElementalNodal", "scripting_name": "element_nodal_forces"},
313-
"EPEL": {"location": "ElementalNodal", "scripting_name": "elastic_strain"},
314-
"EPPL": {"location": "ElementalNodal", "scripting_name": "plastic_strain"},
315-
"EPCR": {"location": "ElementalNodal", "scripting_name": "creep_strain"},
316-
"BFE": {"location": "ElementalNodal", "scripting_name": "structural_temperature"},
317-
"ETH": {"location": "ElementalNodal", "scripting_name": "thermal_strain"},
318-
"ETH_SWL": {"location": "ElementalNodal", "scripting_name": "swelling_strains"},
319-
"ENG_VOL": {"location": "Elemental", "scripting_name": "elemental_volume"},
320-
"ENG_SE": {"location": "Elemental", "scripting_name": "stiffness_matrix_energy"},
321-
"ENG_AHO": {
322-
"location": "Elemental",
323-
"scripting_name": "artificial_hourglass_energy",
324-
},
325-
"ENG_KE": {"location": "Elemental", "scripting_name": "kinetic_energy"},
326-
"ENG_CO": {"location": "Elemental", "scripting_name": "co_energy"},
327-
"ENG_INC": {"location": "Elemental", "scripting_name": "incremental_energy"},
328-
"ENG_TH": {"location": "Elemental", "scripting_name": "thermal_dissipation_energy"},
329-
"U": {"location": "Nodal", "scripting_name": "displacement"},
330-
"V": {"location": "Nodal", "scripting_name": "velocity"},
331-
"A": {"location": "Nodal", "scripting_name": "acceleration"},
332-
"RF": {"location": "Nodal", "scripting_name": "reaction_force"},
333-
"F": {"location": "Nodal", "scripting_name": "nodal_force"},
334-
"M": {"location": "Nodal", "scripting_name": "nodal_moment"},
335-
"TEMP": {"location": "Nodal", "scripting_name": "temperature"},
336-
"EF": {"location": "ElementalNodal", "scripting_name": "electric_field"},
337-
"VOLT": {"location": "Nodal", "scripting_name": "electric_potential"},
338-
"TF": {"location": "ElementalNodal", "scripting_name": "heat_flux"},
339-
"UTOT": {"location": "Nodal", "scripting_name": "raw_displacement"},
340-
"RFTOT": {"location": "Nodal", "scripting_name": "raw_reaction_force"},
341-
"ECT_STAT": {"location": "ElementalNodal", "scripting_name": "contact_status"},
342-
"ECT_PRES": {"location": "ElementalNodal", "scripting_name": "contact_pressure"},
343-
"ECT_PENE": {"location": "ElementalNodal", "scripting_name": "contact_penetration"},
344-
"ECT_SLIDE": {"location": "ElementalNodal", "scripting_name": "contact_sliding_distance"},
345-
"ECT_GAP": {"location": "ElementalNodal", "scripting_name": "contact_gap_distance"},
346-
"ECT_SFRIC": {"location": "ElementalNodal", "scripting_name": "contact_friction_stress"},
347-
"ECT_STOT": {"location": "ElementalNodal", "scripting_name": "contact_total_stress"},
348-
"ECT_FRES": {
349-
"location": "ElementalNodal",
350-
"scripting_name": "contact_fluid_penetration_pressure",
351-
},
352-
"ECT_FLUX": {"location": "ElementalNodal", "scripting_name": "contact_surface_heat_flux"},
353-
"B_N": {"location": "ElementalNodal", "scripting_name": "beam_axial_force"},
354-
"B_M1": {"location": "ElementalNodal", "scripting_name": "beam_s_bending_moment"},
355-
"B_M2": {"location": "ElementalNodal", "scripting_name": "beam_t_bending_moment"},
356-
"B_MT": {"location": "ElementalNodal", "scripting_name": "beam_torsional_moment"},
357-
"B_SN": {"location": "ElementalNodal", "scripting_name": "beam_axial_stress"},
358-
"B_EL": {"location": "ElementalNodal", "scripting_name": "beam_axial_total_strain"},
359-
"B_T1": {"location": "ElementalNodal", "scripting_name": "beam_s_shear_force"},
360-
"B_T2": {"location": "ElementalNodal", "scripting_name": "beam_t_shear_force"},
361-
}
362-
363-
364308
def available_result_from_name(name) -> AvailableResult:
365309
"""Create an instance of AvailableResult from a specified results name.
366310

src/ansys/dpf/core/result_info.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,17 +472,11 @@ def _get_result(self, numres):
472472
self._api.result_info_get_result_location(self, numres, loc_name)
473473
loc_name = str(loc_name)
474474
except AttributeError:
475-
if name in available_result._result_properties:
476-
loc_name = available_result._result_properties[name]["location"]
477-
else:
478-
loc_name = ""
475+
loc_name = ""
479476
try:
480477
scripting_name = self._api.result_info_get_result_scripting_name(self, numres)
481478
except AttributeError:
482-
if name in available_result._result_properties:
483-
scripting_name = available_result._result_properties[name]["scripting_name"]
484-
else:
485-
scripting_name = available_result._remove_spaces(physic_name)
479+
scripting_name = available_result._remove_spaces(physic_name)
486480
num_sub_res = self._api.result_info_get_number_of_sub_results(self, numres)
487481
sub_res = {}
488482
for ires in range(num_sub_res):

src/ansys/dpf/core/results.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,7 @@ def __init__(self, connector, mesh_by_default, result_info, server):
272272
self._mesh_scoping = None
273273
self._location = None
274274
self._mesh_by_default = mesh_by_default
275-
if isinstance(result_info, str):
276-
from ansys.dpf.core.available_result import available_result_from_name
277-
278-
self._result_info = available_result_from_name(result_info)
279-
else:
280-
self._result_info = result_info
275+
self._result_info = result_info
281276
self._specific_fc_type = None
282277
from ansys.dpf.core import operators
283278

@@ -644,8 +639,9 @@ class CommonResults(Results):
644639
of the class:'Results'.
645640
"""
646641

647-
def __init__(self, connector, mesh_by_default, result_info, server):
648-
super().__init__(connector, mesh_by_default, result_info, server, False)
642+
def __init__(self, connector, result_info, mesh_by_default, server):
643+
self._result_info = result_info
644+
super().__init__(connector, result_info, mesh_by_default, server, False)
649645
self._op_map_rev = dict(
650646
displacement="displacement",
651647
stress="stress",
@@ -678,7 +674,7 @@ def displacement(self):
678674
>>> disp = disp.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES")
679675
>>> last_time_disp = disp.eval()
680676
"""
681-
return super().__result__("displacement")
677+
return super().__result__(self._result_info["displacement"])
682678

683679
@property
684680
def elastic_strain(self):
@@ -704,7 +700,7 @@ def elastic_strain(self):
704700
>>> strain = strain.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES")
705701
>>> last_time_disp = strain.eval()
706702
"""
707-
return super().__result__("elastic_strain")
703+
return super().__result__(self._result_info["elastic_strain"])
708704

709705
@property
710706
def stress(self):
@@ -730,7 +726,7 @@ def stress(self):
730726
>>> stress = stress.on_last_time_freq.on_named_selection("_CONSTRAINEDNODES")
731727
>>> last_time_disp = stress.eval()
732728
"""
733-
return super().__result__("stress")
729+
return super().__result__(self._result_info["stress"])
734730

735731
@property
736732
def structural_temperature(self):
@@ -756,7 +752,7 @@ def structural_temperature(self):
756752
>>> structural_temperature = structural_temperature.on_last_time_freq()
757753
>>> last_time_disp = structural_temperature.eval()
758754
"""
759-
return super().__result__("structural_temperature")
755+
return super().__result__(self._result_info["structural_temperature"])
760756

761757
@property
762758
def temperature(self):
@@ -781,7 +777,7 @@ def temperature(self):
781777
>>> temperature = model.results.temperature.on_last_time_freq()
782778
>>> last_time_disp = temperature.eval()
783779
"""
784-
return super().__result__("temperature")
780+
return super().__result__(self._result_info["temperature"])
785781

786782
@property
787783
def electric_potential(self):
@@ -806,4 +802,4 @@ def electric_potential(self):
806802
>>> electric_potential = model.results.electric_potential.on_first_time_freq()
807803
>>> last_time_disp = electric_potential.eval()
808804
"""
809-
return super().__result__("electric_potential")
805+
return super().__result__(self._result_info["electric_potential"])

0 commit comments

Comments
 (0)