sfepy.fem.region module¶
-
class
sfepy.fem.region.Region(name, definition, domain, parse_def)[source]¶ Region defines a subset of a FE domain.
Created: 31.10.2005
-
complete_description(ed, fa, surface_integral=False)[source]¶ Complete the region description by listing edges and faces for each element group.
Parameters: ed : Facets instance
The edge facets.
fa : Facets instance
The face facets.
surface_integral : bool
If True, the each region surface facet (edge in 2D, face in 3D) can be listed only in one group. Sub-entities are updated accordingly (vertices in 2D, vertices and edges in 3D).
Notes
If surface_integral is False, self.edges, self.faces simply list edge/face indices per group (pointers to ed.facets, fa.facets) - repetitions among groups are possible.
-
create_mapping(kind, ig)[source]¶ Create mapping from reference elements to physical elements, given the integration kind (‘v’ or ‘s’).
This mapping can be used to compute the physical quadrature points.
Returns: mapping : VolumeMapping or SurfaceMapping instance
The requested mapping.
-
static
from_faces(faces, domain, name='region', igs=None, can_cells=False)[source]¶ Create a new region containing given faces.
Parameters: faces : array
The array with indices to domain.fa.
domain : Domain instance
The domain containing the faces.
name : str, optional
The name of the region.
igs : list, optional
The allowed element groups. Other groups will be ignored, even though the region might have faces in them - the same effect the ‘forbid’ flag has.
can_cells : bool, optional
If True, the region can have cells.
Returns: obj : Region instance
The new region.
-
static
from_vertices(vertices, domain, name='region', igs=None, can_cells=False, surface_integral=False)[source]¶ Create a new region containing given vertices.
Parameters: vertices : array
The array of vertices.
domain : Domain instance
The domain containing the vertices.
name : str, optional
The name of the region.
igs : list, optional
The allowed element groups. Other groups will be ignored, even though the region might have vertices in them - the same effect the ‘forbid’ flag has.
can_cells : bool, optional
If True, the region can have cells.
surface_integral : bool, optional
If True, then each region surface facet (edge in 2D, face in 3D) can be listed only in one group.
Returns: obj : Region instance
The new region.
-
get_cells(ig, true_cells_only=True)[source]¶ Get cells of the region.
Raises ValueError if true_cells_only is True and the cells are not true cells (e.g. surface integration region).
-
get_charfun(by_cell=False, val_by_id=False)[source]¶ Return the characteristic function of the region as a vector of values defined either in the mesh nodes (by_cell == False) or cells. The values are either 1 (val_by_id == False) or sequential id + 1.
-
get_edge_graph()[source]¶ Return the graph of region edges as a sparse matrix having uid(k) + 1 at (i, j) if vertex[i] is connected with vertex[j] by the edge k.
Degenerate edges are ignored.
-
get_n_cells(ig=None, is_surface=False)[source]¶ Get number of region cells.
Parameters: ig : int, optional
The group index. If None, counts from all groups are added together.
is_surface : bool
If True, number of edges or faces according to domain dimension is returned instead.
Returns: n_cells : int
The number of cells.
-
get_vertices_of_cells(return_per_group=False)[source]¶ Return all vertices, that are in some cell of the region.
Parameters: return_per_group : bool
It True, return also a dict of vertices per element group.
-
set_faces(faces, igs=None, can_cells=False)[source]¶ Set region data using given faces. The region description is complete afterwards.
Parameters: faces : array
The array with indices to domain.fa.
igs : list, optional
The allowed element groups. Other groups will be ignored, even though the region might have faces in them.
can_cells : bool, optional
If True, the region can have cells.
-
setup_face_indices(reset=True)[source]¶ Initialize an array (per group) of (iel, ifa) for each face.
-
update_groups(force=False)[source]¶ Vertices common to several groups are listed only in all of them - fa, ed.unique_indx contain no edge/face duplicates already.
-
-
sfepy.fem.region.get_dependency_graph(region_defs)[source]¶ Return a dependency graph and a name-sort name mapping for given region definitions.

