FEM: code formating: flake8
This commit is contained in:
parent
24572e1afc
commit
6463d04f3f
|
@ -47,17 +47,18 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
||||||
analysis_type=None, eigenmode_parameters=None,
|
analysis_type=None, eigenmode_parameters=None,
|
||||||
dir_name=None
|
dir_name=None
|
||||||
):
|
):
|
||||||
FemInputWriter.FemInputWriter.__init__(self,
|
|
||||||
analysis_obj, solver_obj,
|
FemInputWriter.FemInputWriter.__init__(
|
||||||
mesh_obj, mat_obj,
|
self,
|
||||||
fixed_obj, displacement_obj,
|
analysis_obj, solver_obj,
|
||||||
contact_obj, planerotation_obj,
|
mesh_obj, mat_obj,
|
||||||
selfweight_obj, force_obj, pressure_obj,
|
fixed_obj, displacement_obj,
|
||||||
temperature_obj, heatflux_obj, initialtemperature_obj,
|
contact_obj, planerotation_obj,
|
||||||
beamsection_obj, shellthickness_obj,
|
selfweight_obj, force_obj, pressure_obj,
|
||||||
analysis_type, eigenmode_parameters,
|
temperature_obj, heatflux_obj, initialtemperature_obj,
|
||||||
dir_name
|
beamsection_obj, shellthickness_obj,
|
||||||
)
|
analysis_type, eigenmode_parameters,
|
||||||
|
dir_name)
|
||||||
self.file_name = self.dir_name + '/' + self.mesh_object.Name + '.inp'
|
self.file_name = self.dir_name + '/' + self.mesh_object.Name + '.inp'
|
||||||
print('FemInputWriterCcx --> self.dir_name --> ' + self.dir_name)
|
print('FemInputWriterCcx --> self.dir_name --> ' + self.dir_name)
|
||||||
print('FemInputWriterCcx --> self.file_name --> ' + self.file_name)
|
print('FemInputWriterCcx --> self.file_name --> ' + self.file_name)
|
||||||
|
|
|
@ -44,17 +44,18 @@ class FemInputWriterZ88(FemInputWriter.FemInputWriter):
|
||||||
analysis_type=None, eigenmode_parameters=None,
|
analysis_type=None, eigenmode_parameters=None,
|
||||||
dir_name=None
|
dir_name=None
|
||||||
):
|
):
|
||||||
FemInputWriter.FemInputWriter.__init__(self,
|
|
||||||
analysis_obj, solver_obj,
|
FemInputWriter.FemInputWriter.__init__(
|
||||||
mesh_obj, mat_obj,
|
self,
|
||||||
fixed_obj, displacement_obj,
|
analysis_obj, solver_obj,
|
||||||
contact_obj, planerotation_obj,
|
mesh_obj, mat_obj,
|
||||||
selfweight_obj, force_obj, pressure_obj,
|
fixed_obj, displacement_obj,
|
||||||
temperature_obj, heatflux_obj, initialtemperature_obj,
|
contact_obj, planerotation_obj,
|
||||||
beamsection_obj, shellthickness_obj,
|
selfweight_obj, force_obj, pressure_obj,
|
||||||
analysis_type, eigenmode_parameters,
|
temperature_obj, heatflux_obj, initialtemperature_obj,
|
||||||
dir_name
|
beamsection_obj, shellthickness_obj,
|
||||||
)
|
analysis_type, eigenmode_parameters,
|
||||||
|
dir_name)
|
||||||
self.file_name = self.dir_name + '/z88'
|
self.file_name = self.dir_name + '/z88'
|
||||||
print('FemInputWriterZ88 --> self.dir_name --> ' + self.dir_name)
|
print('FemInputWriterZ88 --> self.dir_name --> ' + self.dir_name)
|
||||||
print('FemInputWriterZ88 --> self.file_name --> ' + self.file_name)
|
print('FemInputWriterZ88 --> self.file_name --> ' + self.file_name)
|
||||||
|
|
|
@ -88,16 +88,15 @@ class FemToolsCcx(FemTools.FemTools):
|
||||||
self.inp_file_name = ""
|
self.inp_file_name = ""
|
||||||
try:
|
try:
|
||||||
inp_writer = iw.FemInputWriterCcx(
|
inp_writer = iw.FemInputWriterCcx(
|
||||||
self.analysis, self.solver,
|
self.analysis, self.solver,
|
||||||
self.mesh, self.materials,
|
self.mesh, self.materials,
|
||||||
self.fixed_constraints, self.displacement_constraints,
|
self.fixed_constraints, self.displacement_constraints,
|
||||||
self.contact_constraints, self.planerotation_constraints,
|
self.contact_constraints, self.planerotation_constraints,
|
||||||
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
|
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
|
||||||
self.temperature_constraints, self.heatflux_constraints, self.initialtemperature_constraints,
|
self.temperature_constraints, self.heatflux_constraints, self.initialtemperature_constraints,
|
||||||
self.beam_sections, self.shell_thicknesses,
|
self.beam_sections, self.shell_thicknesses,
|
||||||
self.analysis_type, self.eigenmode_parameters,
|
self.analysis_type, self.eigenmode_parameters,
|
||||||
self.working_dir
|
self.working_dir)
|
||||||
)
|
|
||||||
self.inp_file_name = inp_writer.write_calculix_input_file()
|
self.inp_file_name = inp_writer.write_calculix_input_file()
|
||||||
except:
|
except:
|
||||||
print("Unexpected error when writing CalculiX input file:", sys.exc_info()[0])
|
print("Unexpected error when writing CalculiX input file:", sys.exc_info()[0])
|
||||||
|
@ -158,7 +157,7 @@ class FemToolsCcx(FemTools.FemTools):
|
||||||
if not ont_backup:
|
if not ont_backup:
|
||||||
ont_backup = str(num_cpu_pref)
|
ont_backup = str(num_cpu_pref)
|
||||||
if num_cpu_pref > 1:
|
if num_cpu_pref > 1:
|
||||||
_env = os.putenv('OMP_NUM_THREADS', str(num_cpu_pref)) # if user picked a number use that instead
|
_env = os.putenv('OMP_NUM_THREADS', str(num_cpu_pref)) # if user picked a number use that instead
|
||||||
else:
|
else:
|
||||||
_env = os.putenv('OMP_NUM_THREADS', str(multiprocessing.cpu_count()))
|
_env = os.putenv('OMP_NUM_THREADS', str(multiprocessing.cpu_count()))
|
||||||
# change cwd because ccx may crash if directory has no write permission
|
# change cwd because ccx may crash if directory has no write permission
|
||||||
|
|
|
@ -81,16 +81,15 @@ class FemToolsZ88(FemTools.FemTools):
|
||||||
self.inp_file_name = ""
|
self.inp_file_name = ""
|
||||||
try:
|
try:
|
||||||
inp_writer = iw.FemInputWriterZ88(
|
inp_writer = iw.FemInputWriterZ88(
|
||||||
self.analysis, self.solver,
|
self.analysis, self.solver,
|
||||||
self.mesh, self.materials,
|
self.mesh, self.materials,
|
||||||
self.fixed_constraints, self.displacement_constraints,
|
self.fixed_constraints, self.displacement_constraints,
|
||||||
self.contact_constraints, self.planerotation_constraints,
|
self.contact_constraints, self.planerotation_constraints,
|
||||||
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
|
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
|
||||||
self.temperature_constraints, self.heatflux_constraints, self.initialtemperature_constraints,
|
self.temperature_constraints, self.heatflux_constraints, self.initialtemperature_constraints,
|
||||||
self.beam_sections, self.shell_thicknesses,
|
self.beam_sections, self.shell_thicknesses,
|
||||||
self.analysis_type, None,
|
self.analysis_type, None,
|
||||||
self.working_dir
|
self.working_dir)
|
||||||
)
|
|
||||||
self.inp_file_name = inp_writer.write_z88_input()
|
self.inp_file_name = inp_writer.write_z88_input()
|
||||||
except:
|
except:
|
||||||
print("Unexpected error when writing Z88 input files:", sys.exc_info()[0])
|
print("Unexpected error when writing Z88 input files:", sys.exc_info()[0])
|
||||||
|
|
|
@ -60,7 +60,6 @@ class FemWorkbench (Workbench):
|
||||||
import _CommandSolverZ88
|
import _CommandSolverZ88
|
||||||
import _CommandConstraintSelfWeight
|
import _CommandConstraintSelfWeight
|
||||||
|
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from platform import system
|
from platform import system
|
||||||
ccx_path = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem").GetString("ccxBinaryPath")
|
ccx_path = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem").GetString("ccxBinaryPath")
|
||||||
|
@ -78,7 +77,6 @@ class FemWorkbench (Workbench):
|
||||||
FreeCAD.Console.PrintError("CalculiX ccx binary not found! Please set it manually in FEM preferences.\n")
|
FreeCAD.Console.PrintError("CalculiX ccx binary not found! Please set it manually in FEM preferences.\n")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
FreeCAD.Console.PrintError(e.message)
|
FreeCAD.Console.PrintError(e.message)
|
||||||
fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
working_dir = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem").GetString("WorkingDir")
|
working_dir = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem").GetString("WorkingDir")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user