from dolfin import *
mesh0 = Mesh("quads0.xml")
mesh1 = Mesh("quads1.xml")
c0 = mesh0.coordinates()
c1 = mesh1.coordinates()
values = c1 - c0
V = VectorFunctionSpace(mesh0, "Lagrange", 1)
u = Function(V)
print(u.vector())
u.vector()[:] = values.flatten()
dolfin.File("tmp/u.pvd", "compressed") << u
<?xml version="1.0" encoding="UTF-8"?>
<dolfin xmlns:dolfin="http://www.fenics.org/dolfin/">
<mesh celltype="triangle" dim="2">
<vertices size="9">
<vertex index="0" x="0.0" y="0.0"/>
<vertex index="1" x="1.0" y="0.0"/>
<vertex index="2" x="2.0" y="0.0"/>
<vertex index="3" x="0.2" y="1.0"/>
<vertex index="4" x="1.2" y="1.0"/>
<vertex index="5" x="2.2" y="1.0"/>
<vertex index="6" x="0.4" y="2.0"/>
<vertex index="7" x="1.4" y="2.0"/>
<vertex index="8" x="2.4" y="2.0"/>
</vertices>
<cells size="8">
<triangle index="0" v0="0" v1="1" v2="3"/>
<triangle index="1" v0="1" v1="4" v2="3"/>
<triangle index="2" v0="1" v1="2" v2="4"/>
<triangle index="3" v0="2" v1="5" v2="4"/>
<triangle index="4" v0="4" v1="5" v2="7"/>
<triangle index="5" v0="5" v1="8" v2="7"/>
<triangle index="6" v0="3" v1="4" v2="6"/>
<triangle index="7" v0="4" v1="7" v2="6"/>
</cells>
</mesh>
</dolfin>
You can use functions get/set_coordinates, ALE::move to manipulate
mesh geometries as Functions.
Note that DOLFIN does not support having two meshes with different
geometries and shared topologies, and in turn shared dofmaps. So I'd
recommend avoiding a use of more mesh objects resulting in duplicating
heavy data like mesh topologies and dofmaps, and preferred using a
single mesh and using above manipulations.
vertex_to_dof_map = V.dofmap().vertex_to_dof_map(mesh0)
dof_to_vertex_map = V.dofmap().dof_to_vertex_map(mesh0)
dofs_at_vertices = u.vector()[dof_to_vertex_map]
vd0 = dolfin.cpp.fem.vertex_to_dof_map(V)
try
dof2vtx =
vertex_to_dof_map(V)
--
You received this message because you are subscribed to the Google Groups "fenics-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fenics-suppor...@googlegroups.com.
To post to this group, send email to fenics-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fenics-support/70dea19c-c972-43ab-9e25-67ad9d47b571%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
try
dof2vtx = vertex_to_dof_map(V)