nurbs_multipatch_surface Derived Type
type, public :: nurbs_multipatch_surface
Ordered collection of connected NURBS surface patches.
Valid side labels are u_min, u_max, v_min, and v_max, with the
documented aliases accepted by connect. reverse reverses the single
tangential boundary coordinate. continuity=-1 records topology without
constraints. Nonnegative continuity contributes sparse equations, while
interpolatory normal endpoints additionally permit direct control sharing.
Sampling is independent of the IGA knot discretization. The legacy
res1/res2 form broadcasts two counts. A rank-one res contains common
directional counts, while rank-two res(d,k) specifies direction d of
patch k. create(target_size=h) estimates counts in physical space.
New resolution overloads synchronize connected tangential directions by
default; synchronize=.false. retains exact independent requests.
Diagnostic codes are: 201 invalid patch identifier; 202 invalid side; 203 invalid continuity metadata; 204 incompatible interface geometry or trace space; 205 invalid patch state; 206 invalid sampling request; and 207 invalid transformation data and 208 invalid or unrepresentable sensitivity data.
Components
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(debug), | public | :: | err |
Recoverable diagnostic state for the most recent failed operation. |
Type-Bound Procedures
procedure, public :: add_patch => add_patch_surface
Append a validated patch copy and optionally return its identifier.
-
private pure subroutine add_patch_surface(this, patch, id)
Append a copy of a valid surface patch.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this Multipatch container.
type(nurbs_surface), intent(in) :: patch Complete, internally consistent surface geometry with a clear diagnostic state.
integer, intent(out), optional :: id Assigned one-based patch identifier; zero is returned on failure.
procedure, public :: assemble_sensitivities => assemble_sensitivities_surface
Assemble independent control and log-weight gradients.
-
private pure subroutine assemble_sensitivities_surface(this, local_dXc, local_dlogWc, dXc, dlogWc, err, map)
Assemble patch-local partials in independent design variables. See
assemble_design_gradient.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this real(kind=rk), intent(in), optional :: local_dXc(:,:) real(kind=rk), intent(in), optional :: local_dlogWc(:) real(kind=rk), intent(out), optional, allocatable :: dXc(:,:) real(kind=rk), intent(out), optional, allocatable :: dlogWc(:) type(debug), intent(out), optional :: err integer, intent(out), optional, allocatable :: map(:)
procedure, public :: cmp_dof_constraint => cmp_dof_constraint_surface
Assemble derivative-continuity equations in CSR form.
-
private pure subroutine cmp_dof_constraint_surface(this, rowptr, col, val, geometric, field, err, active_only)
Assemble one-based sparse continuity equations for connected edges. Call
is_validto verify the geometry. Seeconstraint_rowsfor the field, solver-numbering and connection-filter options.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this integer, intent(out), allocatable :: rowptr(:) integer, intent(out), allocatable :: col(:) real(kind=rk), intent(out), allocatable :: val(:) logical, intent(in), optional :: geometric logical, intent(in), optional :: field type(debug), intent(out), optional :: err logical, intent(in), optional :: active_only
procedure, public :: cmp_dof_map => cmp_dof_map_surface
Compact directly shareable controls.
-
private pure function cmp_dof_map_surface(this, active_only) result(map)
Number scalar controls across periodic seams and directly shareable edges. The input index follows patch storage order. A directly shared trace requires an interpolatory endpoint on each side and proportional oriented trace weights. Call
is_validto check the geometry. General traces use cmp_dof_constraint.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this logical, intent(in), optional :: active_only Number participating controls in first-active storage order and return zero elsewhere.
Return Value integer, allocatable, (:)
procedure, public :: cmp_dof_offsets => cmp_dof_offsets_surface
Return prefix offsets for unmerged patch controls.
-
private pure function cmp_dof_offsets_surface(this) result(offsets)
Return prefix offsets into patch-concatenated control-variable numbering. The result starts at zero and its final entry is the total unmerged control-point count across all patches.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this Return Value integer, allocatable, (:)
procedure, public :: cmp_elem => cmp_elem_surface
Concatenate patch element connectivity with optional shared numbering.
-
private pure function cmp_elem_surface(this, shared, active_only) result(elem)
Concatenate active tensor-product elements from all surface patches. Rows follow patch insertion order and direction-1-fastest local element order. Different local basis sizes are zero-padded to the largest row.
shared=.true.applies direct sharing from the compact map; the default retains unmerged patch-offset numbering. General unclamped traces and rational traces with nonconstant projective scale still requirecmp_dof_constraint.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this logical, intent(in), optional :: shared logical, intent(in), optional :: active_only Use the shared active solver IDs, with zero padding for shorter element rows.
Return Value integer, allocatable, (:,:)
procedure, public :: cmp_elem_local => cmp_elem_local_surface
Return the patch-local identifier for every global element.
-
private pure function cmp_elem_local_surface(this) result(local_id)
Return each concatenated element's one-based patch-local identifier.
Result ordering is identical to cmp_elem.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this Return Value integer, allocatable, (:)
procedure, public :: cmp_elem_patch => cmp_elem_patch_surface
Return the owning patch identifier for every global element.
-
private pure function cmp_elem_patch_surface(this) result(patch_id)
Return the owning patch identifier for every concatenated element.
Result ordering is identical to cmp_elem.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this Return Value integer, allocatable, (:)
procedure, public :: connect => connect_surface
Validate metadata and trace-space shape, then record an edge interface.
-
private pure subroutine connect_surface(this, patch_a, side_a, patch_b, side_b, continuity, reverse, geometric, reparameterization, transition_jet, projective_jet)
Record two surface edges with parametric or geometric metadata.
geometricdefaults to.false.for C^n continuity. For the compact G^n representation,reparameterizationstores the scalar normal transition derivatives. The general representation usestransition_jet(i,c,r), the Bernstein coefficient of . Componentc=1is the mapped patch-B tangential coordinate andc=2its normal coordinate.projective_jet(i,r+1)similarly stores for homogeneous rational continuity. Tangential orientation is controlled independently byreverse. Do not pass both compact and full transition jets.Matching traces have equal tangential degree and affine-equivalent knot vectors. At order zero with an implicit weight scale, interpolating sides also accept clamped edge knots obtained by insertion on the coarser side. Call is_valid to verify geometry and weights.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this Multipatch container.
integer, intent(in) :: patch_a One-based first patch identifier.
character(len=*), intent(in) :: side_a First side label (
u_min,u_max,v_min, orv_max).integer, intent(in) :: patch_b One-based second patch identifier.
character(len=*), intent(in) :: side_b Second side label.
integer, intent(in), optional :: continuity Requested order, default zero;
-1disables constraints.logical, intent(in), optional :: reverse Reverse the tangential coordinate of patch B.
logical, intent(in), optional :: geometric Select geometric rather than parametric continuity.
real(kind=rk), intent(in), optional, contiguous :: reparameterization(:) Compact normalized normal transition derivatives for .
real(kind=rk), intent(in), optional, contiguous :: transition_jet(:,:,:) Full Bernstein transition coefficients
[q+1,2,n].real(kind=rk), intent(in), optional, contiguous :: projective_jet(:,:) Bernstein projective-factor coefficients
[q+1,n+1].
generic, public :: create => create_common, create_uniform, create_patches, create_automatic
Sample patches with common, patch-specific, or physically scaled resolutions.
-
private pure subroutine create_surface(this, res1, res2, Xt1, Xt2, Xt)
Sample every surface patch with common directional sampling arguments. Arguments are forwarded unchanged to create. Any patch failure is converted to multipatch diagnostic code 205.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this integer, intent(in), optional :: res1 integer, intent(in), optional :: res2 real(kind=rk), intent(in), optional, contiguous :: Xt1(:) real(kind=rk), intent(in), optional, contiguous :: Xt2(:) real(kind=rk), intent(in), optional, contiguous :: Xt(:,:) -
private pure subroutine create_surface_uniform(this, res, synchronize)
Sample every surface patch with one common directional resolution.
res=[n_u,n_v]is broadcast to all patches before connected tangential directions are synchronized. This rank-one overload complements the legacyres1/res2keywords without changing their behavior.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this integer, intent(in), contiguous :: res(:) Two positive directional sample counts.
logical, intent(in), optional :: synchronize Synchronize connected tangential counts; default is true.
-
private pure subroutine create_surface_patches(this, res, synchronize)
Sample surface patches with independent directional resolutions.
res(d,k)requests the sample count in parameter directiondof patchk. With synchronization enabled, requested counts are lower bounds: every connected edge receives the largest count requested in its transitive tangential-direction component. Reversal changes parameter order but not the count.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this integer, intent(in), contiguous :: res(:,:) Positive resolution matrix with shape
[2,npatch].logical, intent(in), optional :: synchronize Synchronize connected tangential counts; default is true.
-
private pure subroutine create_surface_automatic(this, target_size, min_res, max_res, synchronize)
Choose surface-patch resolutions from a physical target edge size.
In each parameter direction, the estimator takes the longest corresponding control-polygon line and applies . Connected tangential directions are subsequently synchronized unless disabled. The control-net estimate is inexpensive and scale aware, but is not a certified surface-tessellation error bound.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this real(kind=rk), intent(in) :: target_size Positive finite target physical edge size.
integer, intent(in), optional, contiguous :: min_res(:) Two minimum directional counts; defaults to
[2,2].integer, intent(in), optional, contiguous :: max_res(:) Two maximum directional counts; defaults to the integer range limit.
logical, intent(in), optional :: synchronize Synchronize connected tangential counts; default is true.
procedure, public :: export_Xc => export_Xc_surface
Export separate or combined patch control nets.
-
private impure subroutine export_Xc_surface(this, prefix, encoding, combined)
Export patch control nets in legacy VTK format.
By default patch
iis written as<prefix>_Xc_<i>.vtk. Withcombined=.true., all cells are written to<prefix>_Xc.vtkand retain their one-based owner in the cell fieldpatch_id.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this character(len=*), intent(in) :: prefix character(len=*), intent(in), optional :: encoding logical, intent(in), optional :: combined
procedure, public :: export_Xg => export_Xg_surface
Export separate or combined cached patch geometry.
-
private impure subroutine export_Xg_surface(this, prefix, encoding, combined)
Export cached patch geometry in legacy VTK format.
By default patch
iis written as<prefix>_Xg_<i>.vtk. Withcombined=.true., all cells are written to<prefix>_Xg.vtkand retain their one-based owner in the cell fieldpatch_id.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this character(len=*), intent(in) :: prefix character(len=*), intent(in), optional :: encoding logical, intent(in), optional :: combined
procedure, public :: export_Xth_in_Xg => export_Xth_in_Xg_surface
Export separate or combined embedded parameter grids.
-
private impure subroutine export_Xth_in_Xg_surface(this, prefix, res, encoding, combined)
Export parameter lines mapped into every surface patch.
By default patch
iis written as<prefix>_Xth_<i>.vtk. Withcombined=.true., all line segments are written to<prefix>_Xth.vtkwith cell fieldpatch_id.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this character(len=*), intent(in) :: prefix integer, intent(in), optional :: res character(len=*), intent(in), optional :: encoding logical, intent(in), optional :: combined
procedure, public :: finalize => clear_surface
Release patches and connections and reset counts.
-
private pure elemental subroutine clear_surface(this)
Release all owned surface patches and connections.
Active counts are reset to zero and the multipatch diagnostic is preserved.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this
procedure, public :: get_connection => get_connection_surface
Return a copy of one connection.
-
private pure function get_connection_surface(this, i) result(conn)
Return a value copy of connection
i.An out-of-range one-based identifier returns a default connection.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this integer, intent(in) :: i Return Value type(multipatch_connection)
procedure, public :: get_elem => cmp_elem_surface
Alias for cmp_elem.
-
private pure function cmp_elem_surface(this, shared, active_only) result(elem)
Concatenate active tensor-product elements from all surface patches. Rows follow patch insertion order and direction-1-fastest local element order. Different local basis sizes are zero-padded to the largest row.
shared=.true.applies direct sharing from the compact map; the default retains unmerged patch-offset numbering. General unclamped traces and rational traces with nonconstant projective scale still requirecmp_dof_constraint.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this logical, intent(in), optional :: shared logical, intent(in), optional :: active_only Use the shared active solver IDs, with zero padding for shorter element rows.
Return Value integer, allocatable, (:,:)
procedure, public :: get_nconnection => get_nconnection_surface
Return the active connection count.
-
private pure elemental function get_nconnection_surface(this) result(n)
Return the number of recorded edge connections.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this Return Value integer
procedure, public :: get_npatch => get_npatch_surface
Return the active patch count.
-
private pure elemental function get_npatch_surface(this) result(n)
Return the number of active surface patches.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this Return Value integer
procedure, public :: get_patch => get_patch_surface
Return a copy of one patch.
-
private pure function get_patch_surface(this, i) result(patch)
Return a value copy of patch
i.An out-of-range one-based identifier returns a default empty patch.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this integer, intent(in) :: i Return Value type(nurbs_surface)
procedure, public :: interface_quadrature => interface_quadrature_surface
Paired integration on a connected boundary.
-
private pure subroutine interface_quadrature_surface(this, connection, Xt_a, Xt_b, weight, ngauss, physical, err)
Quadrature on both trace meshes. See
interface_quadrature.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this integer, intent(in) :: connection real(kind=rk), intent(out), allocatable :: Xt_a(:,:) real(kind=rk), intent(out), allocatable :: Xt_b(:,:) real(kind=rk), intent(out), allocatable :: weight(:) integer, intent(in), optional :: ngauss(:) logical, intent(in), optional :: physical type(debug), intent(out), optional :: err
procedure, public :: is_rational => is_rational_surface
Report whether any patch has nonuniform rational weights.
-
private pure elemental function is_rational_surface(this) result(r)
Report whether at least one active patch uses nonuniform rational weights.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this Return Value logical
procedure, public :: is_valid => is_valid_surface
Validate patch states, traces, orientations, and continuity.
-
private pure function is_valid_surface(this, rtol, atol) result(ok)
Validate the stored surface patches, their oriented interfaces and homogeneous continuity residuals. See
valid_multipatchfor the residual test used by geometry sensitivity assembly.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(in) :: this real(kind=rk), intent(in), optional :: rtol Relative trace and homogeneous-residual tolerance; default
sqrt(epsilon(rk)).real(kind=rk), intent(in), optional :: atol Absolute homogeneous-residual tolerance; default zero.
Return Value logical
procedure, public :: rotate_Xc => rotate_Xc_surface
Rotate all patch control points.
-
private pure subroutine rotate_Xc_surface(this, alpha, beta, theta)
Apply one x-y-z Euler rotation in degrees to every control net.
Cached physical samples are not changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this real(kind=rk), intent(in) :: alpha real(kind=rk), intent(in) :: beta real(kind=rk), intent(in) :: theta
procedure, public :: rotate_Xg => rotate_Xg_surface
Rotate all cached patch geometry points.
-
private pure subroutine rotate_Xg_surface(this, alpha, beta, theta)
Apply one x-y-z Euler rotation in degrees to every sampled patch.
Control points are not changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this real(kind=rk), intent(in) :: alpha real(kind=rk), intent(in) :: beta real(kind=rk), intent(in) :: theta
procedure, public :: transform => transform_surface
Apply one affine map to every patch and cache.
-
private pure subroutine transform_surface(this, linear, translation, center)
Apply one common affine transformation to all surface patches.
Every control net and existing sampled-geometry cache receives . A common affine map preserves matching interface jets and homogeneous projective relations, so recorded and connections remain valid whenever the original multipatch was valid.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: linear(:,:) Square linear map shared by every patch.
real(kind=rk), intent(in), optional, contiguous :: translation(:) Shared translation vector.
real(kind=rk), intent(in), optional, contiguous :: center(:) Shared transformation center.
procedure, public :: translate_Xc => translate_Xc_surface
Translate all patch control points.
-
private pure subroutine translate_Xc_surface(this, vec)
Translate every patch control net by physical vector
vec.Cached physical samples are not changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: vec(:)
procedure, public :: translate_Xg => translate_Xg_surface
Translate all cached patch geometry points.
-
private pure subroutine translate_Xg_surface(this, vec)
Translate every patch's cached samples by physical vector
vec.Control points are not changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: vec(:)