To write a mesh Th and values U in a VTK file.
Parameters
FileName : a VTK file name (string)
mesh Th : a 2D or 3D mesh
U : an array of cells which contains all the values to save in VTK file,
names : an array of cells which contains all the names of the values to save in the VTK file.
Examples
% Saving scalar values to a VTK file Th = GetMeshOpt('sphere-1-10.mesh', 'format', 'medit'); U = cos(Th.q(1,:).^2+Th.q(2,:).^2+Th.q(3,:).^2); V = cos(Th.q(1,:).^2+Th.q(2,:).^2+Th.q(3,:).^2); vtkWrite('sample01.vtk', Th, {U',V'}, {'u','v'});
% Saving vector values to a VTK file U{1} = Th.q(1,:).^2+Th.q(2,:).^2+Th.q(3,:).^2; U{2} = cos(U{1}); U{3} = sin(U{1}); vtkWrite('sample02.vtk', Th, {[U{1},U{2},U{3}]}, {'U'});
The following code
Th=GetMeshOpt('magnetism.msh',2, 'format','gmsh'); vtkWrite('magnetism.vtk',Th);
gives an example of how 'vtkWrite' is used.
The following code
Th3=GetMeshOpt('sphere8-4.msh',3, 'format','gmsh'); vtkWrite('sphere8-4.vtk',Th3);
gives an example of how 'vtkWrite' is used.
The following code
Th3=GetMeshOpt( 'FlowVelocity3d01-3.mesh',3); vtkWrite('flowvel3d.vtk',Th3);
gives an example of how 'vtkWrite' is used.
The following code
Th=GetMeshOpt('magnetism.msh',2,'format','gmsh'); U=cos(Th.q(1,:).^2+Th.q(2,:).^2); vtkWrite('magnetism-s.vtk',Th,{U'},{'u'});
gives an example of how 'vtkWrite' is used.
The following code
Th=GetMeshOpt('magnetism.msh',2, 'format','gmsh'); U=cell(2,1);U{1}=Th.q(1,:).^2+Th.q(2,:).^2; U{2}=cos(U{1}); vtkWrite('magnetism-v.vtk',Th, {[U{1}',U{2}']},{'U'});
gives an example of how 'vtkWrite' is used.
The following code
Th=GetMeshOpt('sphere8-4.msh',3,'format','gmsh'); f=@(x,y,z) x.*y.^2+z; U=f(Th.q(1,:),Th.q(2,:),Th.q(3,:)); vtkWrite('spheresurf.vtk',Th,{U'},{'U'});
gives an example of how 'vtkWrite' is used.
The following code
Th=GetMeshOpt('magnetism.msh',2, 'format','gmsh'); U=cell(2,1);U{1}=Th.q(1,:).^2+Th.q(2,:).^2; U{2}=cos(U{1}); vtkWrite('magnetism-v.vtk',Th, {[U{1}',U{2}']},{'U'});
gives an example of how 'vtkWrite' is used.
The following code
Th=GetMeshOpt('sphere8-4.msh',3,'format','gmsh'); f=@(x,y,z) x.*y.^2+z; U=f(Th.q(1,:),Th.q(2,:),Th.q(3,:)); vtkWrite('spheresurf.vtk',Th,{U'},{'U'});
gives an example of how 'vtkWrite' is used.
The following code
Th3=GetMeshOpt('sphere8-4.msh',3, 'format','gmsh'); U{1}=Th3.q(1,:).^2+Th3.q(2,:).^2+Th3.q(3,:).^2; U{2}=cos(U{1}); U{3}=sin(U{1}); vtkWrite('sphere8-4-v.vtk',Th3, {[U{1}',U{2}',U{3}']},{'U'});
gives an example of how 'vtkWrite' is used.
The following code
Th3=GetMeshOpt('sphere8-4.msh',3,'format','gmsh'); U=cos(Th3.q(1,:).^2+Th3.q(2,:).^2+Th3.q(3,:).^2); V=cos(Th3.q(1,:).^2+Th3.q(2,:).^2+Th3.q(3,:).^2); vtkWrite('sphere8-4-s.vtk',Th3,{U',V'},{'u','v'});
gives an example of how 'vtkWrite' is used.
Package: ovisumesh