FEM: solver tasks, delete duplicate methods

This commit is contained in:
Bernd Hahnebach
2018-12-07 10:36:33 +01:00
committed by Yorik van Havre
parent 99a7bad13d
commit c2e5df0e16
2 changed files with 2 additions and 40 deletions

View File

@@ -201,7 +201,7 @@ class _Container(object):
elif m.isDerivedFrom("Fem::ConstraintForce"):
force_constraint_dict = {}
force_constraint_dict['Object'] = m
force_constraint_dict['RefShapeType'] = self.get_refshape_type(m)
force_constraint_dict['RefShapeType'] = FemUtils.get_refshape_type(m)
self.force_constraints.append(force_constraint_dict)
elif m.isDerivedFrom("Fem::ConstraintPressure"):
PressureObjectDict = {}
@@ -253,23 +253,4 @@ class _Container(object):
shell_thickness_dict['Object'] = m
self.shell_thicknesses.append(shell_thickness_dict)
def get_refshape_type(self, fem_doc_object):
# returns the reference shape type
# for force object:
# in GUI defined frc_obj all frc_obj have at least one ref_shape and ref_shape have all the same shape type
# for material object:
# in GUI defined material_obj could have no RefShape and RefShapes could be different type
# we're going to need the RefShapes to be the same type inside one fem_doc_object
# TODO here: check if all RefShapes inside the object really have the same type
import femmesh.meshtools as FemMeshTools
if hasattr(fem_doc_object, 'References') and fem_doc_object.References:
first_ref_obj = fem_doc_object.References[0]
first_ref_shape = FemMeshTools.get_element(first_ref_obj[0], first_ref_obj[1][0])
st = first_ref_shape.ShapeType
print(fem_doc_object.Name + ' has ' + st + ' reference shapes.')
return st
else:
print(fem_doc_object.Name + ' has empty References.')
return ''
## @}

View File

@@ -199,7 +199,7 @@ class _Container(object):
elif m.isDerivedFrom("Fem::ConstraintForce"):
force_constraint_dict = {}
force_constraint_dict['Object'] = m
force_constraint_dict['RefShapeType'] = self.get_refshape_type(m)
force_constraint_dict['RefShapeType'] = FemUtils.get_refshape_type(m)
self.force_constraints.append(force_constraint_dict)
elif m.isDerivedFrom("Fem::ConstraintPressure"):
PressureObjectDict = {}
@@ -251,23 +251,4 @@ class _Container(object):
shell_thickness_dict['Object'] = m
self.shell_thicknesses.append(shell_thickness_dict)
def get_refshape_type(self, fem_doc_object):
# returns the reference shape type
# for force object:
# in GUI defined frc_obj all frc_obj have at least one ref_shape and ref_shape have all the same shape type
# for material object:
# in GUI defined material_obj could have no RefShape and RefShapes could be different type
# we're going to need the RefShapes to be the same type inside one fem_doc_object
# TODO: check if all RefShapes inside the object really have the same type
import femmesh.meshtools as FemMeshTools
if hasattr(fem_doc_object, 'References') and fem_doc_object.References:
first_ref_obj = fem_doc_object.References[0]
first_ref_shape = FemMeshTools.get_element(first_ref_obj[0], first_ref_obj[1][0])
st = first_ref_shape.ShapeType
print(fem_doc_object.Name + ' has ' + st + ' reference shapes.')
return st
else:
print(fem_doc_object.Name + ' has empty References.')
return ''
## @}