FEM: solver elmer, workaround for result reading

This commit is contained in:
Bernd Hahnebach
2020-01-27 07:41:33 +01:00
parent fa40b50565
commit 2edabee0fc

View File

@@ -133,7 +133,7 @@ class Results(run.Results):
def run(self):
if self.solver.ElmerResult is None:
self._createResults()
postPath = os.path.join(self.directory, "case0001.vtu")
postPath = self._getResultFile()
self.solver.ElmerResult.read(postPath)
self.solver.ElmerResult.getLastPostObject().touch()
self.solver.Document.recompute()
@@ -144,4 +144,20 @@ class Results(run.Results):
self.solver.ElmerResult.Label = self.solver.Label + "Result"
self.analysis.addObject(self.solver.ElmerResult)
def _getResultFile(self):
postPath = None
# elmer post file path changed with version x.x
# see https://forum.freecadweb.org/viewtopic.php?f=18&t=42732
# workaround
possible_post_file_0 = os.path.join(self.directory, "case0001.vtu")
possible_post_file_t = os.path.join(self.directory, "case_t0001.vtu")
if os.path.isfile(possible_post_file_0):
postPath = possible_post_file_0
elif os.path.isfile(possible_post_file_t):
postPath = possible_post_file_t
else:
self.report.error("Result file not found.")
self.fail()
return postPath
## @}