# sfepy.discrete.iga.iga module

Isogeometric analysis utilities.

## Notes

The functions `compute_bezier_extraction_1d()` and `eval_nurbs_basis_tp()` implement the algorithms described in [1].

[1] Michael J. Borden, Michael A. Scott, John A. Evans, Thomas J. R. Hughes:

  Isogeometric finite element data structures based on Bezier extraction of NURBS, Institute for Computational Engineering and Sciences, The University of Texas at Austin, Austin, Texas, March 2010.

sfepy.discrete.iga.iga.combine_bezier_extraction(cs)

  For a nD B-spline parametric domain, combine the 1D element extraction operators in each parametric dimension into a single operator for each nD element.

  Parameters:
    cs list of lists of 2D arrays

      The element extraction operators in each parametric dimension.

  Returns:
    ccs list of 2D arrays

      The combined element extraction operators.

sfepy.discrete.iga.iga.compute_bezier_control(control_points, weights, ccs, conn, bconn)

  Compute the control points and weights of the Bezier mesh.

  Parameters:
    control_points array

      The NURBS control points.

    weights array

      The NURBS weights.

    ccs list of 2D arrays

      The combined element extraction operators.

    conn array

      The connectivity of the global NURBS basis.

    bconn array

      The connectivity of the Bezier basis.

  Returns:
    bezier_control_points array

      The control points of the Bezier mesh.

    bezier_weights array

      The weights of the Bezier mesh.

sfepy.discrete.iga.iga.compute_bezier_extraction(knots, degrees)

  Compute local (element) Bezier extraction operators for a nD B-spline parametric domain.

  Parameters:
    knots sequence of array or array

      The knot vectors.

    degrees sequence of ints or int

      Polynomial degrees in each parametric dimension.

  Returns:
    cs list of lists of 2D arrays

      The element extraction operators in each parametric dimension.

sfepy.discrete.iga.iga.compute_bezier_extraction_1d(knots, degree)

  Compute local (element) Bezier extraction operators for a 1D B-spline parametric domain.

  Parameters:
    knots array

      The knot vector.

    degree int

      The curve degree.

  Returns:
    cs array of 2D arrays (3D array)

      The element extraction operators.

sfepy.discrete.iga.iga.create_boundary_qp(coors, dim)

  Create boundary quadrature points from the surface quadrature points.

  Uses the Bezier element tensor product structure.

  Parameters:
    coors array, shape (n_qp, d)

      The coordinates of the surface quadrature points.

    dim int

      The topological dimension.

  Returns:
    bcoors array, shape (n_qp, d + 1)

      The coordinates of the boundary quadrature points.

sfepy.discrete.iga.iga.create_connectivity(n_els, knots, degrees)

  Create connectivity arrays of nD Bezier elements.

  Parameters:
    n_els sequence of ints

      The number of elements in each parametric dimension.

    knots sequence of array or array

      The knot vectors.

    degrees sequence of ints or int

      The basis degrees in each parametric dimension.

  Returns:
    conn array

      The connectivity of the global NURBS basis.

    bconn array

      The connectivity of the Bezier basis.

sfepy.discrete.iga.iga.create_connectivity_1d(n_el, knots, degree)

  Create connectivity arrays of 1D Bezier elements.

  Parameters:
    n_el int

      The number of elements.

    knots array

      The knot vector.

    degree int

      The basis degree.

  Returns:
    conn array

      The connectivity of the global NURBS basis.

    bconn array

      The connectivity of the Bezier basis.

sfepy.discrete.iga.iga.eval_bernstein_basis(x, degree)

  Evaluate the Bernstein polynomial basis of the given degree, and its derivatives, in a point x in [0, 1].

  Parameters:
    x float

      The point in [0, 1].

    degree int

      The basis degree.

  Returns:
    funs array

      The degree + 1 values of the Bernstein polynomial basis.

    ders array

      The degree + 1 values of the Bernstein polynomial basis derivatives.

sfepy.discrete.iga.iga.eval_mapping_data_in_qp(qps, control_points, weights, degrees, cs, conn, cells=None)

  Evaluate data required for the isogeometric domain reference mapping in the given quadrature points. The quadrature points are the same for all Bezier elements and should correspond to the Bernstein basis degree.

  Parameters:
    qps array

      The quadrature points coordinates with components in [0, 1] reference element domain.

    control_points array

      The NURBS control points.

    weights array

      The NURBS weights.

    degrees sequence of ints or int

      The basis degrees in each parametric dimension.

    cs list of lists of 2D arrays

      The element extraction operators in each parametric dimension.

    conn array

      The connectivity of the global NURBS basis.

    cells array, optional

      If given, use only the given Bezier elements.

  Returns:
    bfs array

      The NURBS shape functions in the physical quadrature points of all elements.

    bfgs array

      The NURBS shape functions derivatives w.r.t. the physical coordinates in the physical quadrature points of all elements.

    dets array

      The Jacobians of the mapping to the unit reference element in the physical quadrature points of all elements.

sfepy.discrete.iga.iga.eval_nurbs_basis_tp(qp, ie, control_points, weights, degrees, cs, conn)

  Evaluate the tensor-product NURBS shape functions in a quadrature point for a given Bezier element.

  Parameters:
    qp array

      The quadrature point coordinates with components in [0, 1] reference element domain.

    ie int

      The Bezier element index.

    control_points array

      The NURBS control points.

    weights array

      The NURBS weights.

    degrees sequence of ints or int

      The basis degrees in each parametric dimension.

    cs list of lists of 2D arrays

      The element extraction operators in each parametric dimension.

    conn array

      The connectivity of the global NURBS basis.

  Returns:
    R array

      The NURBS shape functions.

    dR_dx array

      The NURBS shape functions derivatives w.r.t. the physical coordinates.

    det array

      The Jacobian of the mapping to the unit reference element.

sfepy.discrete.iga.iga.eval_variable_in_qp(variable, qps, control_points, weights, degrees, cs, conn, cells=None)

  Evaluate a field variable in the given quadrature points. The quadrature points are the same for all Bezier elements and should correspond to the Bernstein basis degree. The field variable is defined by its DOFs - the coefficients of the NURBS basis.

  Parameters:
    variable array

      The DOF values of the variable with n_c components, shape (:, n_c).

    qps array

      The quadrature points coordinates with components in [0, 1] reference element domain.

    control_points array

      The NURBS control points.

    weights array

      The NURBS weights.

    degrees sequence of ints or int

      The basis degrees in each parametric dimension.

    cs list of lists of 2D arrays

      The element extraction operators in each parametric dimension.

    conn array

      The connectivity of the global NURBS basis.

    cells array, optional

      If given, use only the given Bezier elements.

  Returns:
    coors array

      The physical coordinates of the quadrature points of all elements.

    vals array

      The field variable values in the physical quadrature points.

    dets array

      The Jacobians of the mapping to the unit reference element in the physical quadrature points.

sfepy.discrete.iga.iga.get_bezier_element_entities(degrees)

  Get faces and edges of a Bezier mesh element in terms of indices into the element’s connectivity (reference Bezier element entities).

  Parameters:
    degrees sequence of ints or int

      Polynomial degrees in each parametric dimension.

  Returns:
    faces list of arrays

      The indices for each face or None if not 3D.

    edges list of arrays

      The indices for each edge or None if not at least 2D.

    vertices list of arrays

      The indices for each vertex.

  Notes

  The ordering of faces and edges has to be the same as in `sfepy.discrete.fem.geometry_element.geometry_data`.

sfepy.discrete.iga.iga.get_bezier_topology(bconn, degrees)

  Get a topology connectivity corresponding to the Bezier mesh connectivity.

  In the referenced Bezier control points the Bezier mesh is interpolatory.

  Parameters:
    bconn array

      The connectivity of the Bezier basis.

    degrees sequence of ints or int

      The basis degrees in each parametric dimension.

  Returns:
    tconn array

      The topology connectivity (corner nodes, or vertices, of Bezier elements) with vertex ordering suitable for a FE mesh.

sfepy.discrete.iga.iga.get_facet_axes(dim)

  For each reference Bezier element facet return the facet axes followed by the remaining (perpendicular) axis, as well as the remaining axis coordinate of the facet.

  Parameters:
    dim int

      The topological dimension.

  Returns:
    axes array

      The axes of the reference element facets.

    coors array

      The remaining coordinate of the reference element facets.

sfepy.discrete.iga.iga.get_patch_box_regions(n_els, degrees)

  Get box regions of Bezier topological mesh in terms of element corner vertices of Bezier mesh.

  Parameters:
    n_els sequence of ints

      The number of elements in each parametric dimension.

    degrees sequence of ints or int

      Polynomial degrees in each parametric dimension.

  Returns:
    regions dict

      The Bezier mesh vertices of box regions.

sfepy.discrete.iga.iga.get_raveled_index(indices, shape)

  Get a global raveled index corresponding to nD indices into an array of the given shape.

sfepy.discrete.iga.iga.get_surface_degrees(degrees)

  Get degrees of the NURBS patch surfaces.

  Parameters:
    degrees sequence of ints or int

      Polynomial degrees in each parametric dimension.

  Returns:
    sdegrees list of arrays

      The degrees of the patch surfaces, in the order of the reference Bezier element facets.

sfepy.discrete.iga.iga.get_unraveled_indices(index, shape)

  Get nD indices into an array of the given shape corresponding to a global raveled index.

sfepy.discrete.iga.iga.tensor_product(a, b)

  Compute tensor product of two 2D arrays with possibly different shapes. The result has the form:

      c = [[a00 b, a01 b, ...],
           [a10 b, a11 b, ...],
            ...
            ...               ]