Back to index

salome-med  6.5.0

MEDMEM::Extractor is a tool taking an input field and making a field of lower dimension by cutting the given field by a plane or a line.

The following extractions are possible:

The input field is supposed to comply with following conditions

The result field is a field constant by element on triangles, quadrangles, polygons or edges. It holds ownership of its support, which in its turn holds ownership of its mesh.

Algorithm to cut mesh in 3D space by plane and in 2D by line

  1. Calculate a normal normalized vector to the plane in 3D space or the line in 2D space.
  2. For each node of input mesh calculate its distance to the plane/line as scalar product of the normal vector and a vector node -> coords (coords is the arg of extractPlane() and extractLine()). The distance has a sign.
  3. Store the distances of all nodes in a vector<double>.
  4. Analyse edges of each cell. If extremities of an edge have different sign, we consider the edge to be cut by plane/line. If at least one cut edge of the cell has intersection point not closer than a certain precision from edge extremities, we consider the cell to be cut and we make a new cell in the new mesh. Also we consider a cell to be cut if 3D cell has three intersections at nodes and 2D cell has two intersections at nodes.
  5. Calculate an intersection points using ratio of node distances. If the intersection point is too close to the edge extremity, we take coordinates of a corresponding node.
  6. Make new nodes of intersection points and set them in proper order to make an element. For 2D elements we sort nodes by angle with the first edge of the new element.

Algorithm to cut 3D mesh by the line

  1. Use descending connectivity to find outer faces. Outer face is bound to only one cell.
  2. Find any outer face intersecting with the line.
  3. Use the reverse descending connectivity or the reverse nodal connectivity to get cells to try next intersection.
  4. Find another intersected face among faces of the got cells and so on.
  5. Try to find the next outer face intersecting with the line. This is for the case if the input mesh has several domains. To avoid unnecessary outer face-line intersection searches, we classify outer faces along the line. So we won't try to intersect outer faces that are between the first and the last intersected outer faces we have already found.