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)[source]

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)[source]

Get the probe points.

Returns:
parsarray_like

The independent coordinate of the probe.

pointsarray_like

The probe points, parametrized by pars.

is_cyclic = True
static parse_report(lines)[source]

Parse report lines to get the probe parameters.

report()[source]

Report the probe parameters.

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

Evaluate integral expressions.

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

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)[source]

Get the probe points.

Returns:
parsarray_like

The independent coordinate of the probe.

pointsarray_like

The probe points, parametrized by pars.

static parse_report(lines)[source]

Parse report lines to get the probe parameters.

report()[source]

Report the probe parameters.

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

Probe variables in given points.

get_points(refine_flag=None)[source]

Get the probe points.

Returns:
parsarray_like

The independent coordinate of the probe.

pointsarray_like

The probe points, parametrized by pars.

static parse_report(lines)[source]

Parse report lines to get the probe parameters.

refine_points(variable, points, cache)[source]

No refinement for this probe.

report()[source]

Report the probe parameters.

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

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)[source]

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()[source]

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

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

Probe the given variable.

Parameters:
variableVariable 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_pointsbool

If True, return also the probe points.

Returns:
parsarray

The parametrization of the probe points.

pointsarray, optional

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

valsarray

The probed values.

static refine_pars(pars, refine_flag, cyclic_val=None)[source]

Refine the probe parametrization based on the refine_flag.

refine_points(variable, points, cells)[source]

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

Returns:
refine_flagbool array

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

report()[source]

Report the probe parameters.

reset_refinement()[source]

Reset the probe refinement state.

set_n_point(n_point)[source]

Set the number of probe points.

Parameters:
n_pointint

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)[source]

Set the probe options.

Parameters:
close_limitfloat

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

size_hintfloat

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)[source]

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)[source]

Generate the probe points and their parametrization.

get_points(refine_flag=None)[source]

Get the probe points.

Returns:
parsarray_like

The independent coordinate of the probe.

pointsarray_like

The probe points, parametrized by pars.

static parse_report(lines)[source]

Parse report lines to get the probe parameters.

refine_points(variable, points, cache)[source]

No refinement for this probe.

report()[source]

Report the probe parameters.

sfepy.discrete.probes.get_data_name(fd)[source]

Try to read next data name in file fd.

Returns:
namestr

The data name.

ncint

The number of data columns.

sfepy.discrete.probes.parse_scalar(line)[source]
sfepy.discrete.probes.parse_vector(line)[source]
sfepy.discrete.probes.read_header(fd)[source]

Read the probe data header from file descriptor fd.

Returns:
headerStruct instance

The probe data header.

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

Read probing results from a file.

Parameters:
filenamestr or file object

The probe results file name.

Returns:
headerStruct instance

The probe data header.

resultsdict

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

sfepy.discrete.probes.write_results(filename, probe, results)[source]

Write probing results into a file.

Parameters:
filenamestr or file object

The output file name.

probeProbe subclass instance

The probe used to obtain the results.

resultsdict

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