sfepy.discrete.fem.utils module

sfepy.discrete.fem.utils.compute_nodal_edge_dirs(nodes, region, field, return_imap=False)[source]

Nodal edge directions are computed by simple averaging of direction vectors of edges a node is contained in. Edges are assumed to be straight and a node must be on a single edge (a border node) or shared by exactly two edges.

sfepy.discrete.fem.utils.compute_nodal_normals(nodes, region, field, return_imap=False)[source]

Nodal normals are computed by simple averaging of element normals of elements every node is contained in.

sfepy.discrete.fem.utils.extend_cell_data(data, domain, rname, val=None, is_surface=False, average_surface=True)[source]

Extend cell data defined in a region to the whole domain.

Parameters:
dataarray

The data defined in the region.

domainFEDomain instance

The FE domain.

rnamestr

The region name.

valfloat, optional

The value for filling cells not covered by the region. If not given, the smallest value in data is used.

is_surfacebool

If True, the data are defined on a surface region. In that case the values are averaged or summed into the cells containing the region surface faces (a cell can have several faces of the surface), see average_surface.

average_surfacebool

If True, the data defined on a surface region are averaged, otherwise the data are summed.

Returns:
edataarray

The data extended to all domain elements.

sfepy.discrete.fem.utils.get_edge_paths(graph, mask)[source]

Get all edge paths in a graph with non-masked vertices. The mask is updated.

sfepy.discrete.fem.utils.get_min_value(dofs)[source]

Get a reasonable minimal value of DOFs suitable for extending over a whole domain.

sfepy.discrete.fem.utils.invert_remap(remap)[source]

Return the inverse of remap, i.e. a mapping from a sub-range indices to a full range, see prepare_remap().

sfepy.discrete.fem.utils.prepare_remap(indices, n_full)[source]

Prepare vector for remapping range [0, n_full] to its subset given by indices.

sfepy.discrete.fem.utils.prepare_translate(old_indices, new_indices)[source]

Prepare vector for translating old_indices to new_indices.

Returns:
translatearray

The translation vector. Then new_ar = translate[old_ar].

sfepy.discrete.fem.utils.refine_mesh(filename, level)[source]

Uniformly refine level-times a mesh given by filename.

The refined mesh is saved to a file with name constructed from base name of filename and level-times appended ‘_r’ suffix.

Parameters:
filenamestr

The mesh file name.

levelint

The refinement level.