gf_slice
Purpose
General constructor for mesh_slice objects. Return a getfem++ handle
to the newly created mesh_slice object.
Synopsis
Description
This function creates a mesh slice. Mesh slices are very similar to a
P1-discontinuous mesh fem on which interpolation is very fast. The
slice is built from a mesh object, and a description of the slicing
operation, for example,
cuts the original mesh with the half space {y>0}. Each convex of the
original mesh m is simplexified (for example a quadrangle is
split into 2 triangles), and each simplex is refined 5 times.
Slicing operations can be:
SLICING OPERATIONS (sliceop):
Always specify them between braces (i.e. in a cell array). The first argument is the name of the operation, followed the slicing options.
There are also some special calls to gf_slice: gf_slice('streamlines',mesh_fem mf, vec U, mat seeds) computes streamlines of the (vector) field U, with seed points given by the columns of seeds. gf_slice('points', mesh m, mat P) returns the "slice" composed of points given by the columns of P (useful for interpolation on a given set of sparse points, see gf_compute(mf,U,'interpolate on',sl)).
sl = gf_slice({'planar',+1,[0;0],[1;0]}, m, 5);
- cutting with a plane, a sphere or a cylinder
- intersection or union of slices
- taking the boundary of the mesh, or shrinking each convex..
- iso-values surfaces/volumes, contour lines
- "points", "streamlines" (see below)
SLICING OPERATIONS (sliceop):
Always specify them between braces (i.e. in a cell array). The first argument is the name of the operation, followed the slicing options.
- {'none'} does not cut the mesh.
- {'planar', int orient, vec p, vec n} planar cut. p and n define a half-space, p being a point belong to the boundary of the half-space, and n being its normal. If orient is equal to -1 (resp. 0, +1), then the slicing operation will cut the mesh with the "interior" (resp. "boundary", "exterior") of the half-space. orient may also be set to +2 which means that the mesh will be sliced, but both the outer and inner parts will be kept: it just makes sure that no simplex crosses the slice boundary.
- {'ball', int orient, vec c, vec r} cut with a ball of center c and radius r.
- {'cylinder', int orient, vec p1, vec p2, vec r} cut with a cylinder whose axis is the line (p1,p2) and whose radius is r.
- {'isovalues', int orient, mesh_fem mf, vec U, scalar V} cut using the isosurface of the field U (defined on the mesh_fem MF). The result is the set {x such that U(x) <= V} or {x such that U(x) == V} or x such that U(x) <= V depending on the value of orient.
- {'boundary'[, sliceop]} returns the boundary of the result of sliceop, where sliceop is any slicing operation. If sliceop is not specified, then the whole mesh is considered (i.e. it is equivalent to {'boundary',{'none'}}).
- {'explode', c} build an "exploded" view of the mesh: each convex is shrinked (0 < c <= 1). In the case of 3D convexes, only their faces are kept.
- {'union', sliceop1, sliceop2}
- {'intersection', sliceop1, sliceop2}
- {'comp', sliceop}
- {'diff', sliceop1, sliceop2} perform boolean operations: returns the union, intersection, complementary or difference of slicing operations.
- {'mesh', mesh m} builds a slice which is the intersection of the sliced mesh with another mesh m. The slice is such that all of its simplexes are stricly contained into a convex of each mesh.
There are also some special calls to gf_slice: gf_slice('streamlines',mesh_fem mf, vec U, mat seeds) computes streamlines of the (vector) field U, with seed points given by the columns of seeds. gf_slice('points', mesh m, mat P) returns the "slice" composed of points given by the columns of P (useful for interpolation on a given set of sparse points, see gf_compute(mf,U,'interpolate on',sl)).
Examples
Apply the deformation given by mf,U on the mesh, then slice it with the z+ half-space, and keep only the part where U2(x) > 0.
View the convex quality of a 2D or 3D mesh m:
See the gf_plot_slice usage example for more slices.
sl = gf_slice(intersection',planar',+1,[0;0;0],[0;0;1]',... 'isovalues',-1,mf2,U2,0,mf,U,5);
gf_plot_slice(gfSlice('explode', 0.7, m, 2), 'convex_data',... gf_mesh_get(m,'quality'));
