nurbs_multipatch_curve Derived Type
type, public :: nurbs_multipatch_curve
Ordered collection of connected NURBS curve patches.
Valid side labels accepted by connect are left, right, min, and
max (case variants shown in the implementation are accepted).
continuity=-1 retains an interface without continuity equations.
Nonnegative orders appear in the sparse constraint matrix; direct
endpoint sharing is additionally available for interpolatory endpoints.
Sampling is independent of the IGA knot discretization. In
create(res=n), n is broadcast to every patch; create(res=r) with
rank-one integer r uses r(k) for patch k; and
create(target_size=h) estimates every patch count from its physical
control-polygon length.
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_curve
Append a validated patch copy and optionally return its identifier.
-
private pure subroutine add_patch_curve(this, patch, id)
Append a copy of a valid curve patch.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(inout) :: this Multipatch container.
type(nurbs_curve), intent(in) :: patch Complete, internally consistent curve 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_curve
Assemble independent control and log-weight gradients.
-
private pure subroutine assemble_sensitivities_curve(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_curve), 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_curve
Assemble derivative-continuity equations in CSR form.
-
private pure subroutine cmp_dof_constraint_curve(this, rowptr, col, val, geometric, field, err, active_only)
Assemble one-based sparse continuity equations for connected endpoints. 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_curve), 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_curve
Compact directly shareable controls.
-
private pure function cmp_dof_map_curve(this, active_only) result(map)
Number scalar controls across periodic seams and directly shareable endpoints. 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_curve), 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_curve
Return prefix offsets for unmerged patch control variables.
-
private pure function cmp_dof_offsets_curve(this) result(offsets)
Return prefix offsets into patch-concatenated control-variable numbering. The result has size
get_npatch()+1, starts at zero, and the final entry is the total number of unmerged patch control points.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(in) :: this Return Value integer, allocatable, (:)
procedure, public :: cmp_elem => cmp_elem_curve
Concatenate patch element connectivity with optional shared numbering.
-
private pure function cmp_elem_curve(this, shared, active_only) result(elem)
Concatenate active-span element connectivity from all patches.
Rows follow patch insertion order and then each patch's span order. Columns are padded with zero when patch degrees differ. By default node identifiers use unmerged patch offsets; with
shared=.true., the result uses identifiers from cmp_dof_map. Unclamped traces that are not directly shareable still require the returned sparse constraint matrix.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(in) :: this Multipatch curve.
logical, intent(in), optional :: shared Compact directly shareable controls; default false.
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_curve
Return the patch-local identifier for every global element.
-
private pure function cmp_elem_local_curve(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_curve), intent(in) :: this Return Value integer, allocatable, (:)
procedure, public :: cmp_elem_patch => cmp_elem_patch_curve
Return the owning patch identifier for every global element.
-
private pure function cmp_elem_patch_curve(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_curve), intent(in) :: this Return Value integer, allocatable, (:)
procedure, public :: connect => connect_curve
Validate connection metadata and record an oriented endpoint interface.
-
private pure subroutine connect_curve(this, patch_a, side_a, patch_b, side_b, continuity, reverse, geometric, reparameterization)
Record two curve endpoints with parametric or geometric metadata.
continuitydefaults to zero andgeometricdefaults to.false.. A G^n connection requiresreparameterization(k)to contain the kth derivative of patch B's normalized parameter with respect to patch A's normalized local parameter at the interface. The scalar transition is the complete local reparameterization model for a curve endpoint.reversehas no mathematical effect because an endpoint has no tangential coordinate; it is stored only for API symmetry.This routine validates identifiers, side labels, continuity order, and transition-jet shape before recording the connection. Endpoint coincidence, derivative residuals, coordinate dimensions, and rational projective compatibility are checked later by is_valid.
Warning
A recorded connection is not proof of a valid geometric join; call is_valid before assembly or analysis.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(inout) :: this Multipatch container.
integer, intent(in) :: patch_a One-based first patch identifier.
character(len=*), intent(in) :: side_a First endpoint label:
left/minorright/max.integer, intent(in) :: patch_b One-based second patch identifier.
character(len=*), intent(in) :: side_b Second endpoint label.
integer, intent(in), optional :: continuity Requested order, default zero;
-1disables constraints.logical, intent(in), optional :: reverse Rank-consistent metadata flag; it has no effect for a single endpoint.
logical, intent(in), optional :: geometric Select geometric rather than parametric continuity.
real(kind=rk), intent(in), optional, contiguous :: reparameterization(:) Normalized transition derivatives for .
generic, public :: create => create_common, create_patches, create_automatic
Sample patches with common, patch-specific, or physically scaled resolutions.
-
private pure subroutine create_curve(this, res, Xt)
Sample every patch and cache its single-patch geometry data.
resis passed to every patch. WhenXtis present, the same explicit parameter vector is used for every patch andresis ignored by the corresponding single-patch overload.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(inout) :: this integer, intent(in), optional :: res real(kind=rk), intent(in), optional, contiguous :: Xt(:) -
private pure subroutine create_curve_patches(this, res)
Sample curve patches with independent resolutions.
res(i)is the number of cached parameter samples for patchi. Curve interfaces are points and therefore impose no tangential sampling compatibility between neighboring patches.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(inout) :: this integer, intent(in), contiguous :: res(:) Positive sample count for every active patch.
-
private pure subroutine create_curve_automatic(this, target_size, min_res, max_res)
Choose patch resolutions from a physical target segment size.
For patch , let be the length of its control polygon. The generated sample count is
where . Positive rational weights preserve the convex-hull and variation-diminishing construction underlying this inexpensive physical-space density estimate. It controls visualization density; it is not a certified Hausdorff-error bound.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(inout) :: this real(kind=rk), intent(in) :: target_size Positive finite target physical segment size.
integer, intent(in), optional :: min_res Minimum samples per patch; default is two.
integer, intent(in), optional :: max_res Maximum samples per patch; default is the integer range limit.
procedure, public :: export_Xc => export_Xc_curve
Export separate or combined patch control polygons.
-
private impure subroutine export_Xc_curve(this, prefix, encoding, combined)
Export patch control polygons 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_curve), 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_curve
Export separate or combined cached patch geometry.
-
private impure subroutine export_Xg_curve(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_curve), 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_curve
Export separate or combined embedded parameter lines.
-
private impure subroutine export_Xth_in_Xg_curve(this, prefix, res, encoding, combined)
Export parameter lines mapped into every curve 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_curve), 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_curve
Release patches and connections and reset counts.
-
private pure elemental subroutine clear_curve(this)
Release all owned curve patches and connections.
Active counts are reset to zero and the multipatch diagnostic is preserved.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(inout) :: this
procedure, public :: get_connection => get_connection_curve
Return a copy of one connection.
-
private pure function get_connection_curve(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_curve), intent(in) :: this integer, intent(in) :: i Return Value type(multipatch_connection)
procedure, public :: get_elem => cmp_elem_curve
Alias for cmp_elem.
-
private pure function cmp_elem_curve(this, shared, active_only) result(elem)
Concatenate active-span element connectivity from all patches.
Rows follow patch insertion order and then each patch's span order. Columns are padded with zero when patch degrees differ. By default node identifiers use unmerged patch offsets; with
shared=.true., the result uses identifiers from cmp_dof_map. Unclamped traces that are not directly shareable still require the returned sparse constraint matrix.Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(in) :: this Multipatch curve.
logical, intent(in), optional :: shared Compact directly shareable controls; default false.
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_curve
Return the active connection count.
-
private pure elemental function get_nconnection_curve(this) result(n)
Return the number of recorded endpoint connections.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(in) :: this Return Value integer
procedure, public :: get_npatch => get_npatch_curve
Return the active patch count.
-
private pure elemental function get_npatch_curve(this) result(n)
Return the number of active curve patches.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(in) :: this Return Value integer
procedure, public :: get_patch => get_patch_curve
Return a copy of one patch.
-
private pure function get_patch_curve(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_curve), intent(in) :: this integer, intent(in) :: i Return Value type(nurbs_curve)
procedure, public :: is_rational => is_rational_curve
Report whether any patch has nonuniform rational weights.
-
private pure elemental function is_rational_curve(this) result(r)
Report whether at least one active patch uses nonuniform rational weights.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(in) :: this Return Value logical
procedure, public :: is_valid => is_valid_curve
Validate patch states, interfaces, orientations, and requested continuity.
-
private pure function is_valid_curve(this, rtol, atol) result(ok)
Validate the stored curve 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_curve), 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_curve
Rotate all patch control points.
-
private pure subroutine rotate_Xc_curve(this, alpha, beta, theta)
Apply one x-y-z Euler rotation in degrees to every control polygon.
Cached physical samples are not changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), 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_curve
Rotate all cached patch geometry points.
-
private pure subroutine rotate_Xg_curve(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_curve), 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_curve
Apply one affine map to every patch and cache.
-
private pure subroutine transform_curve(this, linear, translation, center)
Apply one common affine transformation to all curve patches.
Every control polygon 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_curve), 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_curve
Translate all patch control points.
-
private pure subroutine translate_Xc_curve(this, vec)
Translate every patch control polygon by physical vector
vec.Cached physical samples are not changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_multipatch_curve), intent(inout) :: this real(kind=rk), intent(in), contiguous :: vec(:)
procedure, public :: translate_Xg => translate_Xg_curve
Translate all cached patch geometry points.
-
private pure subroutine translate_Xg_curve(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_curve), intent(inout) :: this real(kind=rk), intent(in), contiguous :: vec(:)