LRSpline

class LRSplines.LRSpline(mesh: List[Element], basis: List[BSpline], meshlines: List[Meshline], u_range=None, v_range=None, unique_global_knots_u=None, unique_global_knots_v=None)[source]

Represents a LRSpline, which is a tuple (M, S), where M is a mesh and S is a set of basis functions defined on M.

contains_basis_function(B: LRSplines.b_spline.BSpline) → bool[source]

Returns true if B is found in self.S

Parameters:B – BSpline to find
Returns:true or false
contains_element(element: LRSplines.element.Element) → bool[source]

Returns true if element is found in self.M

Parameters:element – element to check
Returns:true or false
edge_functions()[source]

Returns the indices of all B-splines corresponding to an edge-degree-of-freedom. :return: np.ndarray

static get_full_span_meshline(e: LRSplines.element.Element, axis) → LRSplines.meshline.Meshline[source]

Finds the meshline in direction prescribed by the axis that splits all the supported B-splines on the element. :param e: element to refine by :param axis: direction to look for split, 0 vertical, 1 horizontal :return: full span meshline

static get_minimal_span_meshline(e: LRSplines.element.Element, axis) → LRSplines.meshline.Meshline[source]

Finds the shortest possible meshline in direction prescribed by axis that splits at least one supported B-spline on the element.

Parameters:
  • e – element to refine by
  • axis – direction to look for split, 0 vertical, 1 horizontal
Returns:

minimal span meshline

insert_line(meshline: LRSplines.meshline.Meshline, debug=False) → None[source]

Inserts a line in the mesh, splitting where necessary. Follows a four step procedure:

Step 1: Test all BSplines against the new meshline, and if the meshline traverses the support, split the BSpline into B1 and B2. For both B1 and B2, check whether they are already in the set of previous BSplines. If they are not, add them to the list of new functions. Add the function that was split to the list of functions to remove.

Step 2: Test all the new B-splines against all the meshlines already present in the mesh. They might have to be split further.

Step 3: Check all elements of the mesh, and make sure that any previous elements traversed by the new meshline are split accordingly.

Step 4: Make sure that all elements keep track of the basis functions they support, and that all basis functions keep track of the elements that support them.

Parameters:meshline – meshline to insert
merge_meshlines(meshline: LRSplines.meshline.Meshline) → Tuple[bool, LRSplines.meshline.Meshline][source]

Tests the meshline against all currently stored meshlines, and combines, updates and deletes meshlines as needed. Returns true if the meshline is already in the list of previous meshlines. There are three cases:

  1. The new meshline overlaps with a previous mesh line, but is not contained by the previous one.
  2. The new meshline is completely contained in a previous mesh line, (may in fact be equal)
  3. The new meshline is completely disjoint from all other meshlines.
Parameters:meshline – meshline to test against previous meshlines.
Returns:true if meshline was previously found, false otherwise.
mesh_to_array(N=20)[source]

Returns the set of meshlines as an array of size (len(self.meshlines), 2, N) for transformation and plotting purposes (IGA).

Parameters:N – Number of samples along each meshline
Returns:np.ndarray
peelable()[source]

Returns true if the peeling algorithms terminates with :return:

refine(beta: float, error_function: Callable, refinement_strategy='minimal') → None[source]

Refine the LR-mesh in order to introduce beta * dim(S) new degrees of freedom. The error function takes an element and returns the elemental error contribution. :param refinement_strategy: the refinement strategy used for splitting a single element. :param beta: growth parameter :param error_function: evaluates the error contribution from a given element :return: None

refine_by_element_full(e: LRSplines.element.Element) → None[source]

Refines the LRSpline by finding and inserting a meshline that ensures that all supported BSplines on the given element will be split by the refinement.

Parameters:e – element to refine
refine_by_element_minimal(e: LRSplines.element.Element) → None[source]

Refines the LRSpline by finding and inserting the smallest possible meshline that splits the support of at least one BSpline.

Parameters:e – element to refine
visualize_mesh(multiplicity=True, overloading=True, text=True, relative=True, filename=None, color=False, title=True, axes=False) → None[source]

Plots the LR-mesh.