Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dolfin_dic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ALVAREZ BARRIENTOS Felipe
dolfin_dic
Commits
2a65da72
Commit
2a65da72
authored
6 years ago
by
Martin Genet
Browse files
Options
Downloads
Patches
Plain Diff
Using MeshSeries in initialization of displacement
parent
afbda85c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ImageIterator.py
+20
-12
20 additions, 12 deletions
ImageIterator.py
MeshSeries.py
+9
-0
9 additions, 0 deletions
MeshSeries.py
__init__.py
+21
-20
21 additions, 20 deletions
__init__.py
fedic2.py
+10
-2
10 additions, 2 deletions
fedic2.py
with
60 additions
and
34 deletions
ImageIterator.py
+
20
−
12
View file @
2a65da72
...
...
@@ -8,19 +8,17 @@
### ###
################################################################################
import
dolfin
import
glob
import
numpy
import
os
import
time
import
vtk
import
myPythonLibrary
as
mypy
import
myVTKPythonLibrary
as
myvtk
import
dolfin_dic
as
ddic
import
dolfin
from
vtk.util
import
numpy_support
as
ns
import
numpy
as
np
import
vtk
################################################################################
...
...
@@ -40,6 +38,10 @@ class ImageIterator():
self
.
working_folder
=
parameters
[
"
working_folder
"
]
if
(
"
working_folder
"
in
parameters
)
else
"
.
"
self
.
working_basename
=
parameters
[
"
working_basename
"
]
if
(
"
working_basename
"
in
parameters
)
else
"
sol
"
self
.
initialize_U_from_file
=
parameters
[
"
initialize_U_from_file
"
]
if
(
"
initialize_U_from_file
"
in
parameters
)
else
False
self
.
initialize_U_folder
=
parameters
[
"
initialize_U_folder
"
]
if
(
"
initialize_U_folder
"
in
parameters
)
else
"
.
"
self
.
initialize_U_basename
=
parameters
[
"
initialize_U_basename
"
]
if
(
"
initialize_U_basename
"
in
parameters
)
else
None
self
.
initialize_U_ext
=
parameters
[
"
initialize_U_ext
"
]
if
(
"
initialize_U_ext
"
in
parameters
)
else
"
vtu
"
self
.
initialize_U_array_name
=
parameters
[
"
initialize_U_array_name
"
]
if
(
"
initialize_U_array_name
"
in
parameters
)
else
"
displacement
"
self
.
initialize_DU_with_DUold
=
parameters
[
"
initialize_DU_with_DUold
"
]
if
(
"
initialize_DU_with_DUold
"
in
parameters
)
else
False
...
...
@@ -75,6 +77,13 @@ class ImageIterator():
self
.
printer
.
dec
()
self
.
printer
.
print_str
(
"
Looping over frames…
"
)
if
(
self
.
initialize_U_from_file
):
mesh_series
=
ddic
.
MeshSeries
(
problem
=
self
.
problem
,
folder
=
self
.
initialize_U_folder
,
basename
=
self
.
initialize_U_basename
,
ext
=
self
.
initialize_U_ext
)
n_iter_tot
=
0
global_success
=
True
for
forward_or_backward
in
[
"
forward
"
,
"
backward
"
]:
...
...
@@ -101,13 +110,12 @@ class ImageIterator():
#self.printer.print_var("k_frame_old",k_frame_old,-1)
if
(
self
.
initialize_U_from_file
):
filename
=
self
.
initialize_U_from_file
+
"
_
"
+
str
(
k_frame
).
zfill
(
2
)
+
"
.vtu
"
ugrid
=
myvtk
.
readUGrid
(
filename
)
vtk_u
=
ugrid
.
GetPointData
().
GetArray
(
"
U
"
)
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
)]
mesh
=
mesh_series
.
get_mesh
(
k_frame
)
array_U
=
mesh
.
GetPointData
().
GetArray
(
self
.
initialize_U_array_name
)
array_U
=
vtk
.
util
.
numpy_support
.
vtk_to_numpy
(
array_U
)
array_U
=
array_U
.
astype
(
float
)
array_U
=
numpy
.
reshape
(
array_U
,
array_U
.
size
)
self
.
problem
.
U
.
vector
()[:]
=
array_U
[
dolfin
.
dof_to_vertex_map
(
self
.
problem
.
U_fs
)]
elif
(
self
.
initialize_DU_with_DUold
):
self
.
problem
.
U
.
vector
().
axpy
(
1.
,
self
.
problem
.
DUold
.
vector
())
...
...
This diff is collapsed.
Click to expand it.
MeshSeries.py
+
9
−
0
View file @
2a65da72
...
...
@@ -62,3 +62,12 @@ class MeshSeries():
k_frame
):
return
self
.
folder
+
"
/
"
+
self
.
basename
+
"
_
"
+
str
(
k_frame
).
zfill
(
self
.
zfill
)
+
"
.
"
+
self
.
ext
def
get_mesh
(
self
,
k_frame
):
return
myvtk
.
readDataSet
(
filename
=
self
.
get_mesh_filename
(
k_frame
=
k_frame
))
This diff is collapsed.
Click to expand it.
__init__.py
+
21
−
20
View file @
2a65da72
#this file was generated by __init__.py.py
from
fedic2
import
*
from
NonlinearSolver
import
*
from
compute_warped_mesh
import
*
from
image_expressions_py
import
*
from
compute_warped_images
import
*
from
compute_displacement_error
import
*
from
compute_displacements
import
*
from
compute_quadrature_degree
import
*
from
compute_strains
import
*
from
compute_unwarped_images
import
*
from
compute_warped_images
import
*
from
compute_warped_mesh
import
*
from
Energy
import
*
from
Energy_Regularization
import
*
from
Energy_WarpedImage
import
*
from
fedic
import
*
from
fedic2
import
*
from
generate_images
import
*
from
plot_binned_strains_vs_radius
import
*
from
plot_regional_strains
import
*
from
ImageIterator
import
*
from
Problem
import
*
from
Energy_WarpedImage
import
*
from
generate_undersampled_images
import
*
from
Energy_Regularization
import
*
from
compute_strains
import
*
from
compute_displacements
import
*
from
compute_displacement_error
import
*
from
ImageSeries
import
*
from
compute_quadrature_degree
import
*
from
generated_image_expressions_cpp
import
*
from
write_VTU_file
import
*
from
Energy
import
*
from
image_expressions_cpp
import
*
from
Problem_ImageRegistration
import
*
from
plot_strains
import
*
from
image_expressions_py
import
*
from
ImageIterator
import
*
from
ImageSeries
import
*
from
MeshSeries
import
*
from
NonlinearSolver
import
*
from
plot_binned_strains_vs_radius
import
*
from
plot_displacement_error
import
*
from
plot_regional_strains
import
*
from
plot_strains
import
*
from
plot_strains_vs_radius
import
*
from
Problem
import
*
from
Problem_ImageRegistration
import
*
from
write_VTU_file
import
*
This diff is collapsed.
Click to expand it.
fedic2.py
+
10
−
2
View file @
2a65da72
...
...
@@ -42,6 +42,10 @@ def fedic2(
relax_type
=
"
gss
"
,
# constant, aitken, gss
relax_init
=
1.0
,
initialize_U_from_file
=
0
,
initialize_U_folder
=
None
,
initialize_U_basename
=
None
,
initialize_U_ext
=
"
vtu
"
,
initialize_U_array_name
=
"
displacement
"
,
initialize_DU_with_DUold
=
0
,
tol_res
=
None
,
tol_res_rel
=
None
,
...
...
@@ -138,7 +142,11 @@ def fedic2(
parameters
=
{
"
working_folder
"
:
working_folder
,
"
working_basename
"
:
working_basename
,
"
initialize_DU_with_DUold
"
:
initialize_DU_with_DUold
,
"
initialize_U_from_file
"
:
initialize_U_from_file
})
"
initialize_U_from_file
"
:
initialize_U_from_file
,
"
initialize_U_folder
"
:
initialize_U_folder
,
"
initialize_U_basename
"
:
initialize_U_basename
,
"
initialize_U_ext
"
:
initialize_U_ext
,
"
initialize_U_array_name
"
:
initialize_U_array_name
,
"
initialize_DU_with_DUold
"
:
initialize_DU_with_DUold
})
image_iterator
.
iterate
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment