Mentions légales du service

Skip to content
Snippets Groups Projects
Commit afbda85c authored by Martin Genet's avatar Martin Genet
Browse files

Merge remote-tracking branch 'remotes/cecile/init_disp' into init_disp

parents 42f124e4 870ee63a
No related branches found
No related tags found
1 merge request!13Init disp
...@@ -16,6 +16,11 @@ import myPythonLibrary as mypy ...@@ -16,6 +16,11 @@ import myPythonLibrary as mypy
import myVTKPythonLibrary as myvtk import myVTKPythonLibrary as myvtk
import dolfin_dic as ddic import dolfin_dic as ddic
import dolfin
from vtk.util import numpy_support as ns
import numpy as np
import vtk
################################################################################ ################################################################################
...@@ -96,10 +101,14 @@ class ImageIterator(): ...@@ -96,10 +101,14 @@ class ImageIterator():
#self.printer.print_var("k_frame_old",k_frame_old,-1) #self.printer.print_var("k_frame_old",k_frame_old,-1)
if (self.initialize_U_from_file): if (self.initialize_U_from_file):
xdmf_filename = self.initialize_U_from_file+"_"+str(k_frame).zfill(2)+".xdmf" filename = self.initialize_U_from_file+"_"+str(k_frame).zfill(2)+".vtu"
xdmf_file = dolfin.XDMFFile(xdmf_filename) ugrid = myvtk.readUGrid(filename)
xdmf_file.read(self.problem.U, "U") vtk_u = ugrid.GetPointData().GetArray("U")
xdmf_file.close() np_U = ns.vtk_to_numpy(vtk_u)
np_U_float = np_U.astype(float)
np_U_float_reshape = np.reshape(np_U_float, np_U_float.size)
self.problem.U.vector()[:] = np_U_float_reshape[dolfin.dof_to_vertex_map(self.problem.U_fs)]
elif (self.initialize_DU_with_DUold): elif (self.initialize_DU_with_DUold):
self.problem.U.vector().axpy(1., self.problem.DUold.vector()) self.problem.U.vector().axpy(1., self.problem.DUold.vector())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment