GeFEM Slice object
Creation of a mesh slice. Mesh slices are very similar to a P1-discontinuous MeshFem on which interpolation is very fast. The slice is built from a mesh object, and a description of the slicing operation, for example:
sl = Slice(('planar',+1,[[0],[0]],[[0],[1]]), m, 5)
cuts the original mesh with the half space {y>0}. Each convex of the original Mesh m is simplexified (for example a quadrangle is splitted into 2 triangles), and each simplex is refined 5 times.
Slicing operations can be:
If the first argument is a MeshFem mf instead of a Mesh, and if it is followed by a mf-field u, then the deformation u will be applied to the mesh before the slicing operation.
The first argument can also be a slice.
General constructor for Slice objects
sl = Slice(sliceop, {Slice sl|{Mesh m| MeshFem mf, vec U}, int refine}[, mat CVfids]) Create a Slice using sliceop operation.
sliceop operation is specified with Tuple or List, do not forget the extra parentheses!. The first element 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.
(‘ball’, int orient, vec c, scalar r) : Cut with a ball of center c and radius r.
(‘cylinder’, int orient, vec p1, vec p2, scalar r) : Cut with a cylinder whose axis is the line (p1, p2) and whose radius is r.
(‘isovalues’, int orient, MeshFem mf, vec U, scalar s) : Cut using the isosurface of the field U (defined on the MeshFem mf). The result is the set {x such that :math:`U(x) leq s}` or {x such that `U`(x)=`s}` or {x such that `U`(x) >= `s}` depending on the value of orient.
(‘boundary’[, SLICEOP]) : Return 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’, mat Coef) : Build an ‘exploded’ view of the mesh: each convex is shrinked (). In the case of 3D convexes, only their faces are kept.
(‘union’, SLICEOP1, SLICEOP2) : Returns the union of slicing operations.
(‘intersection’, SLICEOP1, SLICEOP2) : Returns the intersection of slicing operations, for example:
sl = Slice((intersection',('planar',+1,[[0],[0],[0]],[[0],[0],[1]]),
('isovalues',-1,mf2,u2,0)),mf,u,5)
(‘comp’, SLICEOP) : Returns the complementary of slicing operations.
(‘diff’, SLICEOP1, SLICEOP2) : Returns the difference of slicing operations.
(‘mesh’, Mesh m) : Build a slice which is the intersection of the sliced mesh with another mesh. The slice is such that all of its simplexes are stricly contained into a convex of each mesh.
sl = Slice('streamlines', MeshFem mf, mat U, mat S) Compute streamlines of the (vector) field U, with seed points given by the columns of S.
sl = Slice('points', Mesh m, mat Pts) Return the “slice” composed of points given by the columns of Pts (useful for interpolation on a given set of sparse points, see gf_compute('interpolate on',sl).
sl = Slice('load', string filename[, Mesh m]) Load the slice (and its linked mesh if it is not given as an argument) from a text file.
Return the area of the slice.
Output a (unique) string representation of the Slice.
This can be used to perform comparisons between two different Slice objects. This function is to be completed.
Return the list of convexes of the original mesh contained in the slice.
Return the dimension of the slice (2 for a 2D mesh, etc..).
displays a short summary for a Slice object.
Return the edges of the linked mesh contained in the slice.
P contains the list of all edge vertices, E1 contains the indices of each mesh edge in P, and E2 contains the indices of each “edges” which is on the border of the slice. This function is useless except for post-processing purposes.
Synopsis: Slice.export_to_dx(self, string filename, ...)
Export a slice to OpenDX.
Following the filename, you may use any of the following options:
More than one dataset may be written, just list them. Each dataset consists of either:
Synopsis: Slice.export_to_pos(self, string filename[, string name][[,MeshFem mf1], mat U1, string nameU1[[,MeshFem mf1], mat U2, string nameU2,...])
Export a slice to Gmsh.
More than one dataset may be written, just list them. Each dataset consists of either:
Export a the triangles of the slice to POV-RAY.
Synopsis: Slice.export_to_vtk(self, string filename, ...)
Export a slice to VTK.
Following the filename, you may use any of the following options:
More than one dataset may be written, just list them. Each dataset consists of either:
Examples:
Interpolate data given on each convex of the mesh to the slice nodes.
The input array Ucv may have any number of dimensions, but its last dimension should be equal to Mesh.max_cvid().
Example of use: Slice.interpolate_convex_data(Mesh.quality()).
Return the mesh on which the slice was taken.
Return the amount of memory (in bytes) used by the slice object.
Return the mesh on which the slice was taken (identical to ‘linked mesh’)
Return the number of points in the slice.
Return the number of simplexes in the slice.
Since the slice may contain points (simplexes of dim 0), segments (simplexes of dimension 1), triangles etc., the result is a vector of size Slice.dim()+1, except if the optional argument dim is used.
Return the list of point coordinates.
Replace the points of the slice.
The new points P are stored in the columns the matrix. Note that you can use the function to apply a deformation to a slice, or to change the dimension of the slice (the number of rows of P is not required to be equal to Slice.dim()).
Return the list of simplexes of dimension dim.
On output, S has ‘dim+1’ rows, each column contains the point numbers of a simplex. The vector CV2S can be used to find the list of simplexes for any convex stored in the slice. For example ‘S[:,CV2S[4]:CV2S[5]]’ gives the list of simplexes for the fourth convex.