Cut (multi-threaded)

Description

Cut a grid (structured of unstructured) using a given geometrical shape. This treatment is multithreaded and can be used on computers with shared memory nodes. It may be used in co-processing with a workflow based on MPI/threads paradigm.

Parameters

  • base: Base

    The input base to be cut.

  • coordinates: seq(str)

    The variable names that define the set of coordinates. If no value is given, the default coordinate system of the base is used.

  • nb_cuts: int, default= 1

    The desired number of cuts of the same kind. It defines the length of the list of the varying arguments. Performing multiple cuts at once, ‘origin’, ‘normal’, ‘axis’ become lists of parameters. Only works when type=”plane”.

  • type: str, default= “plane”

    The type of geometrical shape used to cut. The values are:

    • plane

    • cylinder

    • sphere

    • isosurface

  • origin: seq(float) or list(seq(float))

    The coordinates (sequence of 3 floats) of the origin used to define the cutting shape. Used for:

    • plane

    • cylinder

    • sphere

    They must be coherent with coordinates. Sequence of 3 floats for a single cut, or list of sequences of 3 floats for a multiple cut.

  • normal: seq(float) or list(seq(float))

    The coordinates of the normal vector used to define a cutting plane (type=”plane”). Sequence of 3 floats for a single cut, or list of sequences of 3 floats for a multiple cut.

  • axis: seq(3*floats) or list(seq(3*floats))

    The axis of rotation for type=’cylinder’ or type=’cone’. Sequence of 3 floats for a single cut, or list of sequences of 3 floats for a multiple cut.

    • example: axis =[0., 0., 1.] to set ‘z’ as the axis in 3D with the cartesian coordinates [‘x’, ‘y’, ‘z’]

  • radius: float

    Radius of the cutting cylinder or sphere (type=’cylinder’ or type=’sphere’).

  • variable: str

    For type=”isosurface”, the name of the variable to make the iso-surface.

  • value: float

    For type=”isosurface”, the value of the variable to make the iso-surface.

  • cutter: antares.utils.mshcppcutter._cut_mesh.CutMesh, default= None

    If set, will use the object to interpolate the variables onto the cut mesh without recutting the original Base. Does nothing with type=”isosurface”.

  • return_cutter: bool, default= False

    If set to True, will return the CutMesh object instead of a new base. The CutMesh object can then be used with the ‘cutter’ parameter to interpolate variable. Useful when cutting multiple the same Base in succession with the same cut, but with different variables. Does nothing with type=”isosurface”.

  • nb_threads: int, default= 1

    The number of threads the treatment will try to use for each cut.

  • ignore_unsupported_cells: bool, default= False

    If set to True, this will ignore any cell that are not supported in this Treatment, instead of throwing an error.

  • ignore_openMP_checks: bool, default= False

    If set to True, this will prevent the Treatment to raise an Error when nb_threads is greater then 1, but the library was not compiled with openMP.

  • skip_checks: bool, default= False

    If set to True, the Treatment will skip most parameter checks. This will make it faster, at the cost of a potential error with no clear backtrace. Use this option when performance is critical.

Preconditions

If shared coordinates, ALL coordinates must be in the shared instant. This treatment handles 3d meshes only.

Cases with only shared variables are not handled.

Requirements for cut type:

  • Plane: ‘origin’, ‘normal’

  • Cylinder: ‘axis’, ‘origin’, ‘radius’

  • Sphere: ‘origin’, ‘radius’

  • Iso-surface: ‘variable’, ‘value’

Example

The following example shows a cutting with a plane defined with the point (0., 0., 0.) and the normal vector (1., 0., 0.).

import antares
myt = antares.Treatment('ccut')
myt['base'] = base
myt['type'] = 'plane'
myt['origin'] = [0., 0., 0.]
myt['normal'] = [1., 0., 0.]
myt['n_threads'] = 16
cutbase = myt.execute()

Main functions

class antares.treatment.TreatmentCcut.TreatmentCcut

Define a cut treatment using a custom C++ library.

The interface for this treatment is mostly compatible with ACut.

cut_batch()
cut_once()
execute()

Perform the cutting process with multiple threads.

Returns:

an unstructured cut

Return type:

Base