FEM: XML/XDMF: removed trailing whitespaces

This commit is contained in:
joha2
2023-04-15 11:59:43 +02:00
committed by Bernd Hahnebach
parent 1e49852fa8
commit bfb3efbc72
4 changed files with 11 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
# ***************************************************************************
# * Copyright (c) 2017-2023 Johannes Hartung <j.hartung@gmx.net> *
# * Copyright (c) 2017-2023 Johannes Hartung <j.hartung@gmx.net> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
@@ -54,6 +54,7 @@ if FreeCAD.GuiUp:
This task panel is used to write mesh groups with user defined values.
It will called if there are mesh groups detected. Else it will be bypassed.
"""
def __init__(self, fem_mesh_obj, fileString):
self.form = FreeCADGui.PySideUic.loadUi(os.path.join(
FreeCAD.getHomePath(),
@@ -176,8 +177,8 @@ def export(objectslist, fileString, group_values_dict_nogui=None):
if fileExtension.lower() == ".xml":
if obj.ElementOrder != "1st":
Console.PrintWarning(
"XML is not designed to save higher order elements.\n" +
"Reducing order for second order mesh.\n" +
"XML is not designed to save higher order elements.\n" +
"Reducing order for second order mesh.\n" +
"Tri6 -> Tri3, Tet10 -> Tet4, etc.\n")
writeFenicsXML.write_fenics_mesh_xml(obj, fileString)
elif fileExtension.lower() == ".xdmf":

View File

@@ -105,8 +105,8 @@ def read_fenics_mesh_xml(xmlfilename):
ind = int(cell.get("index"))
if cell.tag.lower() != cell_type.lower():
Console.PrintWarning("Strange mismatch between cell type " +
f"{cell_type} and " +
Console.PrintWarning("Strange mismatch between cell type " +
f"{cell_type} and " +
f"cell tag {cell.tag.lower()}\n")
num_vertices = cells_parts_dim[cell_type][0]

View File

@@ -171,7 +171,7 @@ def write_fenics_mesh_codim_xdmf(
fc_topo = fem_mesh_obj.FemMesh.Nodes
else:
fc_topo = []
Console.PrintError("Dimension of mesh incompatible with export" +
Console.PrintError("Dimension of mesh incompatible with export" +
f" XDMF function: {dim_topo}\n")
nodeindices = [(
@@ -307,8 +307,8 @@ def write_fenics_mesh_xdmf(
mesh_function_codim = dim_cell - FreeCAD_Group_Dimensions[mesh_function_type]
mesh_function_name = fem_mesh.getGroupName(g)
Console.PrintMessage(f"group id: {g} (label: {mesh_function_name})" +
f" with element type {mesh_function_type} and" +
Console.PrintMessage(f"group id: {g} (label: {mesh_function_name})" +
f" with element type {mesh_function_type} and" +
" codim {mesh_function_codim}\n")
mesh_function_grid = ET.SubElement(
@@ -325,7 +325,7 @@ def write_fenics_mesh_xdmf(
codim=mesh_function_codim, encoding=encoding
)
mesh_function_geometry = ET.SubElement(mesh_function_grid, "Geometry",
mesh_function_geometry = ET.SubElement(mesh_function_grid, "Geometry",
Reference="XML")
mesh_function_geometry.text = "/Xdmf/Domain/Grid/Geometry"
mesh_function_attribute = ET.SubElement(mesh_function_grid, "Attribute")

View File

@@ -80,7 +80,7 @@ def write_fenics_mesh_xml(fem_mesh_obj, outputfile):
(num_cells, cellname_fc, dim_cell) = celltype_in_mesh
cellname_fenics = FreeCAD_to_Fenics_dict[cellname_fc]
num_verts_cell = XML_Number_of_Nodes_dict[cellname_fenics]
Console.PrintMessage(f"Celltype in mesh -> {str(celltype_in_mesh)} " +
Console.PrintMessage(f"Celltype in mesh -> {str(celltype_in_mesh)} " +
f"and its Fenics name: {cellname_fenics}\n")
root = ET.Element("dolfin", dolfin="http://fenicsproject.org")