FEM: imports, use small character for fem utils imports
This commit is contained in:
@@ -33,7 +33,7 @@ import FreeCADGui
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
# for the panel
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from FreeCAD import Units
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
@@ -68,8 +68,8 @@ class _TaskPanel(object):
|
||||
FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/ElectrostaticPotential.ui")
|
||||
self._initParamWidget()
|
||||
self.form = [self._refWidget, self._paramWidget]
|
||||
analysis = FemUtils.findAnalysisOfMember(obj)
|
||||
self._mesh = FemUtils.get_single_member(analysis, "Fem::FemMeshObject")
|
||||
analysis = femutils.findAnalysisOfMember(obj)
|
||||
self._mesh = femutils.get_single_member(analysis, "Fem::FemMeshObject")
|
||||
self._part = self._mesh.Part if self._mesh is not None else None
|
||||
self._partVisible = None
|
||||
self._meshVisible = None
|
||||
|
||||
@@ -33,7 +33,7 @@ import FreeCADGui
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
# for the panel
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from FreeCAD import Units
|
||||
from . import FemSelectionWidgets
|
||||
|
||||
@@ -68,8 +68,8 @@ class _TaskPanel(object):
|
||||
FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/FlowVelocity.ui")
|
||||
self._initParamWidget()
|
||||
self.form = [self._refWidget, self._paramWidget]
|
||||
analysis = FemUtils.findAnalysisOfMember(obj)
|
||||
self._mesh = FemUtils.get_single_member(analysis, "Fem::FemMeshObject")
|
||||
analysis = femutils.findAnalysisOfMember(obj)
|
||||
self._mesh = femutils.get_single_member(analysis, "Fem::FemMeshObject")
|
||||
self._part = None
|
||||
if hasattr(self._mesh, "Part"): # Geometry of Gmesh mesh obj
|
||||
self._part = self._mesh.Part
|
||||
|
||||
@@ -33,7 +33,7 @@ import FreeCADGui
|
||||
from . import ViewProviderFemConstraint
|
||||
|
||||
# for the panel
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from FreeCAD import Units
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ class _TaskPanel(object):
|
||||
FreeCAD.getHomePath() + "Mod/Fem/Resources/ui/InitialFlowVelocity.ui")
|
||||
self._initParamWidget()
|
||||
self.form = [self._paramWidget]
|
||||
analysis = FemUtils.findAnalysisOfMember(obj)
|
||||
self._mesh = FemUtils.get_single_member(analysis, "Fem::FemMeshObject")
|
||||
analysis = femutils.findAnalysisOfMember(obj)
|
||||
self._mesh = femutils.get_single_member(analysis, "Fem::FemMeshObject")
|
||||
self._part = self._mesh.Part if self._mesh is not None else None
|
||||
self._partVisible = None
|
||||
self._meshVisible = None
|
||||
|
||||
@@ -30,7 +30,7 @@ import os
|
||||
import glob
|
||||
|
||||
import FreeCAD
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
|
||||
from .. import run
|
||||
from .. import solverbase
|
||||
@@ -44,7 +44,7 @@ ANALYSIS_TYPES = ["static", "frequency", "thermomech"]
|
||||
|
||||
|
||||
def create(doc, name="SolverCalculiX"):
|
||||
return FemUtils.createObject(
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ __url__ = "http://www.freecadweb.org"
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from ... import equationbase
|
||||
from . import linear
|
||||
|
||||
|
||||
def create(doc, name="Elasticity"):
|
||||
return FemUtils.createObject(
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ __url__ = "http://www.freecadweb.org"
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from ... import equationbase
|
||||
from . import linear
|
||||
|
||||
|
||||
def create(doc, name="Electrostatic"):
|
||||
return FemUtils.createObject(
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ __url__ = "http://www.freecadweb.org"
|
||||
|
||||
import FreeCAD as App
|
||||
from ... import equationbase
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
|
||||
if App.GuiUp:
|
||||
import FreeCADGui as Gui
|
||||
@@ -75,8 +75,8 @@ class _TaskPanel(object):
|
||||
self.form = self._refWidget
|
||||
else:
|
||||
self.form = [self.refWidget, propWidget]
|
||||
analysis = FemUtils.findAnalysisOfMember(obj)
|
||||
self._mesh = FemUtils.get_single_member(analysis, "Fem::FemMeshObject")
|
||||
analysis = femutils.findAnalysisOfMember(obj)
|
||||
self._mesh = femutils.get_single_member(analysis, "Fem::FemMeshObject")
|
||||
self._part = self._mesh.Part if self._mesh is not None else None
|
||||
self._partVisible = None
|
||||
self._meshVisible = None
|
||||
|
||||
@@ -26,13 +26,13 @@ __url__ = "http://www.freecadweb.org"
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from . import nonlinear
|
||||
from ... import equationbase
|
||||
|
||||
|
||||
def create(doc, name="Flow"):
|
||||
return FemUtils.createObject(
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ __url__ = "http://www.freecadweb.org"
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from ... import equationbase
|
||||
from . import linear
|
||||
|
||||
|
||||
def create(doc, name="Fluxsolver"):
|
||||
return FemUtils.createObject(
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ __url__ = "http://www.freecadweb.org"
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from . import nonlinear
|
||||
from ... import equationbase
|
||||
|
||||
|
||||
def create(doc, name="Heat"):
|
||||
return FemUtils.createObject(
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ __url__ = "http://www.freecadweb.org"
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
|
||||
from .. import run
|
||||
from .. import solverbase
|
||||
@@ -40,7 +40,7 @@ from .equations import flow
|
||||
|
||||
|
||||
def create(doc, name="ElmerSolver"):
|
||||
return FemUtils.createObject(
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import tempfile
|
||||
|
||||
from FreeCAD import Units
|
||||
import Fem
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
import femmesh.gmshtools as gmshtools
|
||||
from .. import settings
|
||||
from . import sifio
|
||||
@@ -92,7 +92,7 @@ def getConstant(name, dimension):
|
||||
class Writer(object):
|
||||
|
||||
def __init__(self, solver, directory, testmode=False):
|
||||
self.analysis = FemUtils.findAnalysisOfMember(solver)
|
||||
self.analysis = femutils.findAnalysisOfMember(solver)
|
||||
self.solver = solver
|
||||
self.directory = directory
|
||||
self.testmode = testmode
|
||||
@@ -197,7 +197,7 @@ class Writer(object):
|
||||
def _handleHeat(self):
|
||||
activeIn = []
|
||||
for equation in self.solver.Group:
|
||||
if FemUtils.is_of_type(equation, "Fem::FemEquationElmerHeat"):
|
||||
if femutils.is_of_type(equation, "Fem::FemEquationElmerHeat"):
|
||||
if equation.References:
|
||||
activeIn = equation.References[0][1]
|
||||
else:
|
||||
@@ -297,7 +297,7 @@ class Writer(object):
|
||||
def _handleElectrostatic(self):
|
||||
activeIn = []
|
||||
for equation in self.solver.Group:
|
||||
if FemUtils.is_of_type(equation, "Fem::FemEquationElmerElectrostatic"):
|
||||
if femutils.is_of_type(equation, "Fem::FemEquationElmerElectrostatic"):
|
||||
if equation.References:
|
||||
activeIn = equation.References[0][1]
|
||||
else:
|
||||
@@ -361,7 +361,7 @@ class Writer(object):
|
||||
def _handleFluxsolver(self):
|
||||
activeIn = []
|
||||
for equation in self.solver.Group:
|
||||
if FemUtils.is_of_type(equation, "Fem::FemEquationElmerFluxsolver"):
|
||||
if femutils.is_of_type(equation, "Fem::FemEquationElmerFluxsolver"):
|
||||
if equation.References:
|
||||
activeIn = equation.References[0][1]
|
||||
else:
|
||||
@@ -382,7 +382,7 @@ class Writer(object):
|
||||
def _handleElasticity(self):
|
||||
activeIn = []
|
||||
for equation in self.solver.Group:
|
||||
if FemUtils.is_of_type(equation, "Fem::FemEquationElmerElasticity"):
|
||||
if femutils.is_of_type(equation, "Fem::FemEquationElmerElasticity"):
|
||||
if equation.References:
|
||||
activeIn = equation.References[0][1]
|
||||
else:
|
||||
@@ -540,7 +540,7 @@ class Writer(object):
|
||||
def _handleFlow(self):
|
||||
activeIn = []
|
||||
for equation in self.solver.Group:
|
||||
if FemUtils.is_of_type(equation, "Fem::FemEquationElmerFlow"):
|
||||
if femutils.is_of_type(equation, "Fem::FemEquationElmerFlow"):
|
||||
if equation.References:
|
||||
activeIn = equation.References[0][1]
|
||||
else:
|
||||
@@ -773,10 +773,10 @@ class Writer(object):
|
||||
self._builder.addSection(section)
|
||||
|
||||
def _getMember(self, t):
|
||||
return FemUtils.get_member(self.analysis, t)
|
||||
return femutils.get_member(self.analysis, t)
|
||||
|
||||
def _getSingleMember(self, t):
|
||||
return FemUtils.get_single_member(self.analysis, t)
|
||||
return femutils.get_single_member(self.analysis, t)
|
||||
|
||||
|
||||
class WriteError(Exception):
|
||||
|
||||
@@ -33,7 +33,7 @@ import threading
|
||||
import shutil
|
||||
|
||||
import FreeCAD as App
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
from . import settings
|
||||
from . import signal
|
||||
from . import task
|
||||
@@ -157,7 +157,7 @@ class BaseTask(task.Thread):
|
||||
|
||||
@property
|
||||
def analysis(self):
|
||||
return FemUtils.findAnalysisOfMember(self.solver)
|
||||
return femutils.findAnalysisOfMember(self.solver)
|
||||
|
||||
|
||||
class Machine(BaseTask):
|
||||
@@ -260,7 +260,7 @@ class Machine(BaseTask):
|
||||
class Check(BaseTask):
|
||||
|
||||
def checkMesh(self):
|
||||
meshes = FemUtils.get_member(
|
||||
meshes = femutils.get_member(
|
||||
self.analysis, "Fem::FemMeshObject")
|
||||
if len(meshes) == 0:
|
||||
self.report.error("Missing a mesh object.")
|
||||
@@ -275,7 +275,7 @@ class Check(BaseTask):
|
||||
return True
|
||||
|
||||
def checkMaterial(self):
|
||||
matObjs = FemUtils.get_member(
|
||||
matObjs = femutils.get_member(
|
||||
self.analysis, "App::MaterialObjectPython")
|
||||
if len(matObjs) == 0:
|
||||
self.report.error(
|
||||
@@ -287,10 +287,10 @@ class Check(BaseTask):
|
||||
|
||||
def checkSupported(self, allSupported):
|
||||
for m in self.analysis.Group:
|
||||
if FemUtils.is_of_type(m, "Fem::Constraint"):
|
||||
if femutils.is_of_type(m, "Fem::Constraint"):
|
||||
supported = False
|
||||
for sc in allSupported:
|
||||
if FemUtils.is_of_type(m, *sc):
|
||||
if femutils.is_of_type(m, *sc):
|
||||
supported = True
|
||||
if not supported:
|
||||
self.report.warning(
|
||||
@@ -302,15 +302,15 @@ class Solve(BaseTask):
|
||||
|
||||
def _observeSolver(self, process):
|
||||
output = ""
|
||||
line = FemUtils.pydecode(process.stdout.readline())
|
||||
line = femutils.pydecode(process.stdout.readline())
|
||||
self.pushStatus(line)
|
||||
output += line
|
||||
line = FemUtils.pydecode(process.stdout.readline())
|
||||
line = femutils.pydecode(process.stdout.readline())
|
||||
while line:
|
||||
line = "\n%s" % line.rstrip()
|
||||
self.pushStatus(line)
|
||||
output += line
|
||||
line = FemUtils.pydecode(process.stdout.readline())
|
||||
line = femutils.pydecode(process.stdout.readline())
|
||||
return output
|
||||
|
||||
|
||||
@@ -384,7 +384,7 @@ class _DocObserver(object):
|
||||
def _checkEquation(self, obj):
|
||||
for o in obj.Document.Objects:
|
||||
if (
|
||||
FemUtils.is_derived_from(o, "Fem::FemSolverObject")
|
||||
femutils.is_derived_from(o, "Fem::FemSolverObject")
|
||||
and hasattr(o, "Group")
|
||||
and obj in o.Group
|
||||
):
|
||||
@@ -392,13 +392,13 @@ class _DocObserver(object):
|
||||
_machines[o].reset()
|
||||
|
||||
def _checkSolver(self, obj):
|
||||
analysis = FemUtils.findAnalysisOfMember(obj)
|
||||
analysis = femutils.findAnalysisOfMember(obj)
|
||||
for m in iter(_machines.values()):
|
||||
if analysis == m.analysis and obj == m.solver:
|
||||
m.reset()
|
||||
|
||||
def _checkAnalysis(self, obj):
|
||||
if FemUtils.is_derived_from(obj, "Fem::FemAnalysis"):
|
||||
if femutils.is_derived_from(obj, "Fem::FemAnalysis"):
|
||||
deltaObjs = self._getAdded(obj)
|
||||
if deltaObjs:
|
||||
reset = False
|
||||
@@ -410,7 +410,7 @@ class _DocObserver(object):
|
||||
|
||||
def _checkModel(self, obj):
|
||||
if self._partOfModel(obj):
|
||||
analysis = FemUtils.findAnalysisOfMember(obj)
|
||||
analysis = femutils.findAnalysisOfMember(obj)
|
||||
if analysis is not None:
|
||||
self._resetAll(analysis)
|
||||
|
||||
@@ -428,7 +428,7 @@ class _DocObserver(object):
|
||||
|
||||
def _partOfModel(self, obj):
|
||||
for t in self._WHITELIST:
|
||||
if FemUtils.is_derived_from(obj, t):
|
||||
if femutils.is_derived_from(obj, t):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import os
|
||||
import glob
|
||||
|
||||
import FreeCAD
|
||||
import femtools.femutils as FemUtils
|
||||
import femtools.femutils as femutils
|
||||
|
||||
from .. import run
|
||||
from .. import solverbase
|
||||
@@ -44,7 +44,7 @@ ANALYSIS_TYPES = ["static"]
|
||||
|
||||
|
||||
def create(doc, name="SolverZ88"):
|
||||
return FemUtils.createObject(
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user