コマンドリファレンス作成

gf_colormap

概要

c=gf_colormap(name)

説明 :

カラーマップを返すか,現在のカラーマップを変更します.nameには, 'tripod', 'chouette', 'froid', 'tank' または 'earth' を指定できます.

gf_plot

概要

[hsurf, hcontour, hquiver, hmesh, hdefmesh]=gf_plot(mesh_fem mf, U, ...)

The options are specified as pairs of "option name"/"option value"

'zplot',{'off'|'on'}       : values of ``U`` are mapped on the $z$-axis (only possible when qdim=1, mdim=2).
'norm', {'off'|'on'}       : if qdim >= 2, color-plot the norm of the field
'dir',[]                    : or the scalar product of the field with 'dir' (can be a vector, or 'x', 'y' etc..)
'refine',8                  : nb of refinments for curved edges and surface plots
'interpolated',{'off'|'on'}: if triangular patch are interpolated
'pcolor',{'on'|'off'}      : if the field is scalar, a color plot of its values is plotted
'quiver',{'on'|'off'}      : if the field is vector, represent arrows
'quiver_density',50        : density of arrows in quiver plot
'quiver_scale',1           : scaling of arrows (0=>no scaling)
'mesh',{'off'|'on'}         : show the mesh ?
'meshopts',{cell(0)}           : cell array of options passed to gf_plot_slice for the mesh
'deformed_mesh', {'off'|'on'} : shows the deformed mesh (only when qdim == mdim)
'deformed_meshopts', {cell(0)}: cell array of options passed to gf_plot_slice for the deformed mesh
'deformation',[]            : plots on the deformed object (only when qdim == mdim)
'deformation_mf',[]        : plots on the deformed object (only when qdim == mdim)
'deformation_scale','10%'  : indicate the amplitude of the deformation. Can be a percentage of the mesh width if given as a string, or an absolute value if given as a number
'cvlst',[]                  : list of convexes to plot (empty=>all convexes)
'title',[]                 : set the title
'contour',[]               : list of contour values
'disp_options', {'off'|'on'} : shows the option or not.

説明 :

関数は U が行ベクトルであることを期待する. U がスカラーフィールドの場合, gf\_plot(mf,U) はUの値を表すカラーでメッシュを塗りつぶします. U がベクトルフィールドの場合, gf_plot のデフォルトの動作は U の値を表すベクトルを描画することです.

出力時に,この関数は作成されたさまざまなグラフィカルオブジェクトのハンドルを返します. hmesh はメッシュ線のハンドル, hbound は境界のエッジのハンドル,hvert は面のパッチオブジェクトのハンドル,( hconvhdof と答えてください)は頂点(resp. convexes, dof)ラベルのハンドルです.

たとえば,3次元メッシュの境界にスカラーフィールドをプロットするには,次のようにします.

% load the 'strange.mesh_fem' (found in the getfem_matlab/tests directory)
mf=gf_mesh_fem('load', 'strange.mesh_fem')
U=rand(1, gf_mesh_fem_get(mf, 'nbdof')); # random field that will be drawn
gf_plot(mf, U, 'refine', 25, 'cvlst', gf_mesh_get(mf,'outer faces'), 'mesh','on');

gf_plot_1D

概要

gf_plot_1D(mesh_fem mf, U, ...)

The options are specified as pairs of "option name"/"option value"


'style', 'bo-'       : the line style and dof marker style (same syntax as in the matlab command 'plot').
'color', []          : override the line color.
'dof_color', [1,0,0] : color of the markers for the degrees of freedom.
'width', 2           : line width.

説明 :

この関数は,1次元有限要素フィールドをプロットします.

gf_plot_mesh

概要

gf_plot_mesh(m, ...)

'vertices', {'off'|'on'}    : displays also vertices numbers.
'convexes', {'off'|'on'}    : displays also convexes numbers.
'dof',{'off'|'on'}          : displays also finite element nodes. In that case, ``m`` should be a ``mesh_fem`` identifier.
'regions',BLST              : displays the boundaries listed in BLST.
'cvlst',CVLST               : display only the listed convexes. If CVLST has two rows, display only the faces listed in the second row.
'edges', {'on' | 'off'}     : display edges ?
'faces', {'off'|'on'}       : fills each 2D-face of the mesh
'curved', {'off'|'on'}      : displays curved edges
'refine',N                  : refine curved edges and filled faces N times
'deformation', Udef         : optionnal deformation applied to the mesh (M must be a mesh_fem object)
'edges_color',[.6 .6 1]     : RGB values for the color of edges
'edges_width',1             : width of edges
'faces_color',[.75 .75 .75]): RGB values for the color of faces
'quality',{ 'off' | 'on' }  : Display the quality of the mesh.

説明 :

この関数は,メッシュを表示するために使用します.

% the mesh is in the tests directory of the distribution
m=gf_mesh('import','gid','donut_with_quadratic_tetra_314_elements.msh');
gf_plot_mesh(m,'refine',15,'cvlst',gf_mesh_get(m,'outer faces'),'faces','on',\ldots, 'faces_color',[1. .9 .2],'curved','on','edges_width',2);
camlight % turn on the light!

gf_plot_slice

概要

gf_plot_slice(sl, ...)

The options are specified as pairs of "option name"/"option value"


data    []          : data to be plotted (one value per slice node)
convex_data    []   : data to be plotted (one value per mesh convex)
mesh, ['auto']      : 'on' -> show the mesh (faces of edges), 'off' -> ignore mesh
mesh_edges, ['on']  : show mesh edges ?
mesh_edges_color, [0.60 0.60 1] : color of mesh edges
mesh_edges_width, [0.70] : width of mesh edges
mesh_slice_edges, ['on'] : show edges of the slice ?
mesh_slice_edges_color, [0.70 0 0] : color of slice edges
mesh_slice_edges_width, [0.50] : width of slice edges
mesh_faces, ['off'] : 'on' -> fill mesh faces (otherwise they are transparent)
mesh_faces_color, [0.75 0.75 0.75]
pcolor, ['on']      : if the field is scalar, a color plot of its values is plotted
quiver, ['on']      : if the field is vector, represent arrows
quiver_density, 50  : density of arrows in quiver plot
quiver_scale, 1     : density of arrows in quiver plot
tube, ['on']        : use tube plot for 'filar' (1D) parts of the slice
tube_color, ['red'] : color of tubes (ignored if 'data' is not empty and 'pcolor' is on)
tube_radius, ['0.5%'] : tube radius; you can use a constant, or a percentage (of the mesh size) or a vector of nodal values
showoptions, ['on'] : display the list of options

the 'data' and 'convex_data' are mutually exclusive.

説明 :

この関数は,メッシュスライスのプロットに使用できます. gf_plot_meshgf_plot 関数でも使用されます.

例: 3D mesh_fem mf と,このmesh_femに定義されたベクトルフィールドUがあり,タンク内のStokes問題を解決します(testsディレクトリのデモ demo_stokes_3D_tank_draw.m を参照してください.).:

figure;
% slice the mesh with two half spaces, and take the boundary of the resulting quarter-cylinder
sl=gf_slice(\{'boundary',\{'intersection',\{'planar',+1,[0;0;0],[0;1;0]\},\ldots
                                          \{'planar',+1,[0;0;0],[1;0;0]\}\}\},m,6);
Usl=gf_compute(pde.mf_u,U,'interpolate on', sl);  % interpolate the solution on the slice
% show the norm of the displacement on this slice
gf_plot_slice(sl,'mesh','on','data',sqrt(sum(Usl.^2,1)),'mesh_slice_edges','off');

% another slice: now we take the lower part of the mesh
sl=gf_slice(\{'boundary',\{'intersection',\{'planar',+1,[0;0;6],[0;0;-1]\},\ldots
                                        \{'planar',+1,[0;0;0],[0;1;0]\}\}\},m,6);
Usl=gf_compute(pde.mf_u,U,'interpolate on', sl);
hold on;
gf_plot_slice(sl,'mesh','on','data',sqrt(sum(Usl.^2,1)),'mesh_slice_edges','off');

% this slice contains the transparent mesh faces displayed on the picture
sl2=gf_slice(\{'boundary',\{'planar',+1,[0;0;0],[0;1;0]\}\},\ldots
            m,6,setdiff(all_faces',TOPfaces','rows')');
gf_plot_slice(sl2,'mesh_faces','off','mesh','on','pcolor','off');

% last step is to plot the streamlines
hh=[1 5 9 12.5 16 19.5]; % vertical position of the different starting points of the streamlines
H=[zeros(2,numel(hh));hh];

% compute the streamlines
tsl=gf_slice('streamlines',pde.mf_u,U,H);
Utsl=gf_compute(pde.mf_u,U,'interpolate on', tsl);

% render them with "tube plot"
[a,h]=gf_plot_slice(tsl,'mesh','off','tube_radius',.2,'tube_color','white');
hold off;
% use a nice colormap
caxis([0 .7]);
c=[0 0 1; 0 .5 1; 0 1 .5; 0 1 0; .5 1 0; 1 .5 0; 1 .4 0; 1 0 0; 1 .2 0; 1 .4 0; 1 .6 0; 1 .8 0];
colormap(c);