FEM: code formating, flake8

This commit is contained in:
Bernd Hahnebach
2018-01-30 21:04:31 +01:00
committed by wmayer
parent 7405b886a2
commit 227a25a686
6 changed files with 9 additions and 10 deletions

View File

@@ -474,7 +474,7 @@ class _CommandFemMeshNetgenFromShape(CommandManager):
self.is_active = 'with_part_feature'
def Activated(self):
# a mesh could be made with and without an analysis,
# a mesh could be made with and without an analysis,
# we're going to check not for an analysis in command manager module
FreeCAD.ActiveDocument.openTransaction("Create FEM mesh Netgen")
mesh_obj_name = 'FEMMeshNetgen'

View File

@@ -87,7 +87,7 @@ class WriteXDMFTaskPanel:
self.form.tableGroups.setItem(ind, 3, QtGui.QTableWidgetItem(str(0)))
# default value for marked elements
self.form.tableGroups.setItem(ind, 4, QtGui.QTableWidgetItem(str(1)))
header = self.form.tableGroups.horizontalHeader()
header.setResizeMode(0, QtGui.QHeaderView.ResizeToContents)
header.setResizeMode(1, QtGui.QHeaderView.ResizeToContents)
@@ -100,7 +100,7 @@ class WriteXDMFTaskPanel:
num_rows = self.form.tableGroups.rowCount()
for r in range(num_rows):
g = int(self.form.tableGroups.item(r, 0).text()) # read-only no prob
g = int(self.form.tableGroups.item(r, 0).text()) # read-only no prob
default_value = 0
marked_value = 1
try:

View File

@@ -100,7 +100,7 @@ def get_FemMeshObjectElementTypes(fem_mesh_obj, remove_zero_element_entries=True
"Node": 0, "Edge": 1, "Hexa": 3, "Polygon": 2, "Polyhedron": 3,
"Prism": 3, "Pyramid": 3, "Quadrangle": 2, "Tetra": 3, "Triangle": 2}
eval_dict = locals() # to access local variables from eval
eval_dict = locals() # to access local variables from eval
elements_list_with_zero = [(eval("fem_mesh_obj.FemMesh." + s + "Count", eval_dict), s, d) for (s, d) in FreeCAD_element_names_dims.items()]
# ugly but necessary
if remove_zero_element_entries:

View File

@@ -396,7 +396,7 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
elif len(self.fluidsection_objects) > 1:
self.get_ccx_elsets_multiple_mat_multiple_fluid()
# TODO: some elemetIDs are collected for 1D-Flow calculation,
# TODO: some elemetIDs are collected for 1D-Flow calculation,
# this should be a def somewhere else, preferable inside the get_ccx_elsets_... methods
for ccx_elset in self.ccx_elsets:
if ccx_elset['ccx_elset'] and not isinstance(ccx_elset['ccx_elset'], six.string_types): # use six to be sure to be Python 2.7 and 3.x compatible

View File

@@ -35,7 +35,6 @@ if App.GuiUp:
from femguiobjects import FemSelectionWidgets
class Proxy(equationbase.BaseProxy):
def __init__(self, obj):

View File

@@ -609,14 +609,14 @@ class FemTest(unittest.TestCase):
def test_adding_refshaps(self):
doc = self.active_doc
slab = doc.addObject("Part::Plane","Face")
slab.Length=500.00
slab.Width=500.00
slab = doc.addObject("Part::Plane", "Face")
slab.Length = 500.00
slab.Width = 500.00
cf = ObjectsFem.makeConstraintFixed(doc)
ref_eles = []
# FreeCAD list property seam not to support append, thus we need some workaround, which is on many elements even much faster
for i, face in enumerate(slab.Shape.Edges):
ref_eles.append("Edge%d" % (i+1))
ref_eles.append("Edge%d" % (i + 1))
cf.References = [(slab, ref_eles)]
doc.recompute()
expected_reflist = [(slab, ('Edge1', 'Edge2', 'Edge3', 'Edge4'))]