FEM: remove trailing spaces and newlines when writing input files for solvers
This commit is contained in:
@@ -2360,10 +2360,12 @@ void FemMesh::writeABAQUS(const std::string& Filename,
|
||||
}
|
||||
else {
|
||||
if (first_line) {
|
||||
anABAQUS_Output << "," << std::endl;
|
||||
anABAQUS_Output << "," << std::endl << *kt;
|
||||
first_line = false;
|
||||
}
|
||||
anABAQUS_Output << *kt << ", ";
|
||||
else {
|
||||
anABAQUS_Output << ", " << *kt;
|
||||
}
|
||||
}
|
||||
}
|
||||
anABAQUS_Output << std::endl;
|
||||
|
||||
@@ -163,4 +163,4 @@ def write_step_equation(f, ccxwriter):
|
||||
|
||||
def write_step_end(f, ccxwriter):
|
||||
f.write("\n{}\n".format(59 * "*"))
|
||||
f.write("*END STEP \n")
|
||||
f.write("*END STEP\n")
|
||||
|
||||
@@ -282,10 +282,13 @@ class _Writer:
|
||||
self._stream = stream
|
||||
|
||||
def write(self):
|
||||
sortedSections = sorted(self._sections, key=lambda s: s.priority, reverse=True)
|
||||
firstSection, *sortedSections = sorted(
|
||||
self._sections, key=lambda s: s.priority, reverse=True
|
||||
)
|
||||
self._writeSection(firstSection)
|
||||
for s in sortedSections:
|
||||
self._writeSection(s)
|
||||
self._stream.write(_NEWLINE)
|
||||
self._writeSection(s)
|
||||
|
||||
def _writeSection(self, s):
|
||||
self._writeSectionHeader(s)
|
||||
@@ -295,8 +298,8 @@ class _Writer:
|
||||
|
||||
def _writeSectionHeader(self, s):
|
||||
self._stream.write(s.name)
|
||||
self._stream.write(_WHITESPACE)
|
||||
if isNumbered(s):
|
||||
self._stream.write(_WHITESPACE)
|
||||
self._stream.write(str(self._idMgr.getId(s)))
|
||||
|
||||
def _writeSectionFooter(self, s):
|
||||
|
||||
@@ -255,7 +255,7 @@ class Writer:
|
||||
def _writeStartinfo(self):
|
||||
path = os.path.join(self.directory, _STARTINFO_NAME)
|
||||
with open(path, "w") as f:
|
||||
f.write(_SIF_NAME)
|
||||
f.write(f"{_SIF_NAME}\n")
|
||||
|
||||
def _exportToUnv(self, groups, mesh, meshPath):
|
||||
unvGmshFd, unvGmshPath = tempfile.mkstemp(suffix=".unv")
|
||||
|
||||
Reference in New Issue
Block a user