system#
This system contains the type KFormSystem, used to hold the equations
described by mfv2d.kform.KEquation.
- class mfv2d.system.KFormSystem(*equations: KEquation, sorting: Callable[[KForm], Any] | None = None)[source]#
System of equations of differential forms, which are optionally sorted.
This is a collection of equations, which fully describe a problem to be solved for the degrees of freedom of differential forms.
- Parameters:
- unknown_forms: ElementFormSpecification#
There is also the wrapper around the C type
mfv2d._mfv2d.ElementFormSpecification provided by
ElementFormSpecification. It provides a nice constructor,
as well as wrappers that allow to use types from mfv2d.kform
instead of “raw” Python strings and integers. Some utility methods
are also provided.
- class mfv2d.system.ElementFormSpecification(*forms: KFormUnknown)[source]#
Specifications of element forms on an element.
- Parameters:
*specs (tuple of KFormUnknowns) – Specifications for differential forms on the element. Each form must be unique.
- __contains__(item: tuple[str, int] | KFormUnknown) bool[source]#
Check if the item is contained in the specifications.
- __getitem__(idx: SupportsIndex) tuple[str, UnknownFormOrder][source]#
Get the entry at the specified index.
- __iter__() Iterator[tuple[str, UnknownFormOrder]][source]#
Iterate over labels and orders of forms specified.
- static __new__(cls, *forms: KFormUnknown) Self[source]#
Create a new form specification.
- form_offset(idx: SupportsIndex, /, order_1: int, order_2: int) int#
Get the offset of the form in the element.
- Parameters:
idx (SupportsIndex) – Index of the form.
order_1 (int) – Order of the element in the first dimension.
order_2 (int) – Order of the element in the second dimension.
- Returns:
Offset of degrees of freedom of the differential form.
- Return type:
- form_offsets(order_1: int, order_2: int) tuple[int, ...]#
Get the offsets of all forms in the element.
- Parameters:
- Returns:
Offsets of degrees of freedom for all differential forms, with an extra entry at the end, which is the count of all degrees of freedom.
- Return type:
- form_size(idx: SupportsIndex, /, order_1: int, order_2: int) int#
Get the number of degrees of freedom of the form in the element.
- Parameters:
idx (SupportsIndex) – Index of the form.
order_1 (int) – Order of the element in the first dimension.
order_2 (int) – Order of the element in the second dimension.
- Returns:
Number of degrees of freedom of the differential form.
- Return type:
- form_sizes(order_1: int, order_2: int) tuple[int, ...]#
Get the number of degrees of freedom for each form in the element.
- get_form(idx: SupportsIndex, /) KFormUnknown[source]#
Get the entry at the specified index, but converted to a form.
- index(value: tuple[str, int] | KFormUnknown) int[source]#
Return the index of the form with the given label and order in the specs.
- Parameters:
value (tuple of (str, int) or KFormUnknown) – Label and index of the form, or the form itself.
- Returns:
Index of the form in the specification.
- Return type:
- iter_forms() Iterator[KFormUnknown][source]#
Iterate over forms in the specifications.
- total_size(order_1: int, order_2: int) int#
Get the total number of degrees of freedom of the forms.
- Parameters:
idx (SupportsIndex) – Index of the form.
order_1 (int) – Order of the element in the first dimension.
order_2 (int) – Order of the element in the second dimension.
- Returns:
Total number of degrees of freedom of all differential forms.
- Return type: