# sfepy.discrete.probes module

Classes for probing values of Variables, for example, along a line.

class sfepy.discrete.probes.CircleProbe(centre, normal, radius, n_point, share_geometry=True)

  Probe variables along a circle.

  If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is negative, -n_point is used as an initial guess.

  get_points(refine_flag=None)

    Get the probe points.

    Returns:
      pars array_like

        The independent coordinate of the probe.

      points array_like

        The probe points, parametrized by pars.

  is_cyclic = True
  static parse_report(lines)

    Parse report lines to get the probe parameters.

  report()

    Report the probe parameters.

class sfepy.discrete.probes.IntegralProbe(name, problem, expressions, labels)

  Evaluate integral expressions.

class sfepy.discrete.probes.LineProbe(p0, p1, n_point, share_geometry=True)

  Probe variables along a line.

  If n_point is positive, that number of evenly spaced points is used. If n_point is None or non-positive, an adaptive refinement based on element diameters is used and the number of points and their spacing are determined automatically. If it is negative, -n_point is used as an initial guess.

  get_points(refine_flag=None)

    Get the probe points.

    Returns:
      pars array_like

        The independent coordinate of the probe.

      points array_like

        The probe points, parametrized by pars.

  static parse_report(lines)

    Parse report lines to get the probe parameters.

  report()

    Report the probe parameters.

class sfepy.discrete.probes.PointsProbe(points, share_geometry=True)

  Probe variables in given points.

  get_points(refine_flag=None)

    Get the probe points.

    Returns:
      pars array_like

        The independent coordinate of the probe.

      points array_like

        The probe points, parametrized by pars.

  static parse_report(lines)

    Parse report lines to get the probe parameters.

  refine_points(variable, points, cache)

    No refinement for this probe.

  report()

    Report the probe parameters.

class sfepy.discrete.probes.Probe(name, share_geometry=True, n_point=None, **kwargs)

  Base class for all point probes. Enforces two points minimum.

  cache = Struct:probe_shared_evaluate_cache
  get_actual_cache(pars, cache, hash_chunk_size=100000)

    Return the actual evaluate cache, which is a combination of the (mesh-based) evaluate cache and probe-specific data, like the reference element coordinates. The reference element coordinates are reused, if the sha1 hash of the probe parameter vector does not change.

  get_evaluate_cache()

    Return the evaluate cache for domain-related data given by self.share_geometry.

  is_cyclic = False
  probe(variable, mode='val', ret_points=False)

    Probe the given variable.

    Parameters:
      variable Variable instance

        The variable to be sampled along the probe.

      mode{‘val’, ‘grad’}, optional

        The evaluation mode: the variable value (default) or the variable value gradient.

      ret_points bool

        If True, return also the probe points.

    Returns:
      pars array

        The parametrization of the probe points.

      points array, optional

        If ret_points is True, the coordinates of points corresponding to pars, where the variable is evaluated.

      vals array

        The probed values.

  static refine_pars(pars, refine_flag, cyclic_val=None)

    Refine the probe parametrization based on the refine_flag.

  refine_points(variable, points, cells)

    Mark intervals between points for a refinement, based on element sizes at those points. Assumes the points to be ordered.

    Returns:
      refine_flag bool array

        True at places corresponding to intervals between subsequent points that need to be refined.

  report()

    Report the probe parameters.

  reset_refinement()

    Reset the probe refinement state.

  set_n_point(n_point)

    Set the number of probe points.

    Parameters:
      n_point int

        The (fixed) number of probe points, when positive. When non-positive, the number of points is adaptively increased starting from -n_point, until the neighboring point distance is less than the diameter of the elements enclosing the points. When None, it is set to -10.

  set_options(close_limit=None, size_hint=None)

    Set the probe options.

    Parameters:
      close_limit float

        The maximum limit distance of a point from the closest element allowed for extrapolation.

      size_hint float

        Element size hint for the refinement of probe parametrization.

class sfepy.discrete.probes.RayProbe(p0, dirvec, p_fun, n_point, both_dirs, share_geometry=True)

  Probe variables along a ray. The points are parametrized by a function of radial coordinates from a given point in a given direction.

  gen_points(sign)

    Generate the probe points and their parametrization.

  get_points(refine_flag=None)

    Get the probe points.

    Returns:
      pars array_like

        The independent coordinate of the probe.

      points array_like

        The probe points, parametrized by pars.

  static parse_report(lines)

    Parse report lines to get the probe parameters.

  refine_points(variable, points, cache)

    No refinement for this probe.

  report()

    Report the probe parameters.

sfepy.discrete.probes.get_data_name(fd)

  Try to read next data name in file fd.

  Returns:
    name str

      The data name.

    nc int

      The number of data columns.

sfepy.discrete.probes.parse_scalar(line)

sfepy.discrete.probes.parse_vector(line)

sfepy.discrete.probes.read_header(fd)

  Read the probe data header from file descriptor fd.

  Returns:
    header Struct instance

      The probe data header.

sfepy.discrete.probes.read_results(filename, only_names=None)

  Read probing results from a file.

  Parameters:
    filename str or file object

      The probe results file name.

  Returns:
    header Struct instance

      The probe data header.

    results dict

      The dictionary of probing results. Keys are data names, values are the probed values.

sfepy.discrete.probes.write_results(filename, probe, results)

  Write probing results into a file.

  Parameters:
    filename str or file object

      The output file name.

    probe Probe subclass instance

      The probe used to obtain the results.

    results dict

      The dictionary of probing results. Keys are data names, values are the probed values.