nurbs_surface Derived Type
- BSD 3-Clause
- 124 statements
type, public :: nurbs_surface
Mutable tensor-product B-spline or NURBS surface.
Initialize the object with set. The two entries of
degree, nc, ng, and wrapping options correspond to parameter
directions 1 and 2. degree(d) is the polynomial degree, while spline
order is degree(d)+1. Weights must be finite and strictly positive.
Control coordinates are required to be finite and have at least one
component; coordinate finiteness is a caller precondition in setter
overloads that do not explicitly diagnose it.
create stores a Cartesian product of parameter samples. Sample and control arrays follow direction-1-fastest ordering. Exact insertion and elevation operate directionally in homogeneous coordinates; removal is accepted only when an internal roundoff-scaled geometry test passes.
Successful setters discard sampled points and connectivity while keeping parameters for create() to refresh. Fixed-shape modify_Xc/modify_Wc operations discard samples and retain control and IGA connectivity.
Warning
Fitting and the separate
rotate_Xc or translate_Xc operations do not automatically recompute
every sampled or connectivity cache. transform instead
keeps an existing Xg cache affine-consistent with Xc. Rebuild
connectivity after a control-count or spline-space change.
Diagnostic codes are: 100 invalid argument or index; 101 shape mismatch; 102--105 missing geometry state; 106 underdetermined fitting problem; 107 invalid parameters; 108 singular system, Jacobian, or metric; and 109 iterative nonconvergence.
Note
Getter generics return allocatable copies of object-owned arrays.
Components
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(debug), | public | :: | err |
Recoverable diagnostic state for the most recent failed operation. |
Type-Bound Procedures
procedure, public :: ansatz
Evaluate element-local physical basis data and differential area.
-
private pure subroutine ansatz(this, ie, ig, Tgc, dTgc_dXg, dA, ngauss, d2Tgc_dXg2, strict, err, Xg, dXg_dXt, dmeasure_dXc, dmeasure_dlogWc, dgradient_dXc, dgradient_dlogWc, djacobian_dXc, djacobian_dlogWc)
Compute element-local IGA basis data at one quadrature point.
Element and local basis ordering agree with
cmp_elem.dAincludes the tensor Gauss weight, span maps, and either the absolute planar Jacobian or for an embedded surface metric . For a planar two-coordinate mapping, gradients are physical Cartesian gradients. For an embedded surface, they are ambient Cartesian components of the tangential gradient; optional Hessians are intrinsic covariant surface Hessians represented as ambient tangential tensors. A singular Jacobian or rank-deficient metric sets diagnostic code 108. Withstrict=.true., a two-coordinate physical map must additionally have a positive Jacobian determinant. For an embedded surface, strict mode verifies rank but cannot assign a signed orientation without an external reference normal. The check is local to the requested quadrature point and does not prove global injectivity between quadrature points.With , , and , the ambient tangential gradient is
Let denote the contravariant tangent vectors, the columns of . The optional ambient representation of the covariant Hessian is
IGA formulation reference: T. J. R. Hughes, J. A. Cottrell, and Y. Bazilevs, CMAME 194 (2005), 4135--4195. doi:10.1016/j.cma.2004.10.008.
Elementwise analysis assumes an invertible geometry map with a smooth inverse: Y. Bazilevs et al., MMMAS 16 (2006), 1031--1090. doi:10.1142/S0218202506001455.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in) :: ie One-based direction-1-fastest active element index.
integer, intent(in) :: ig One-based flattened tensor quadrature-point index.
real(kind=rk), intent(out), allocatable :: Tgc(:) Local basis values, size
(degree(1)+1)*(degree(2)+1).real(kind=rk), intent(out), allocatable :: dTgc_dXg(:,:) Local physical or ambient tangential gradients
[nlocal,physical_dim].real(kind=rk), intent(out) :: dA Weighted differential area contribution.
integer, intent(in), optional :: ngauss(2) Optional positive point counts
[2]; defaults todegree+1.real(kind=rk), intent(out), optional, allocatable, target :: d2Tgc_dXg2(:,:,:) Optional planar physical or embedded covariant Hessians
[nlocal,ncoord,ncoord].logical, intent(in), optional :: strict Reject orientation reversal in addition to rank deficiency.
type(debug), intent(out), optional :: err Caller-owned diagnostic; when present, object diagnostics are neither read nor changed.
real(kind=rk), intent(out), optional, allocatable, target :: Xg(:) Physical point
[ncoord]and raw geometry Jacobian[ncoord,2].real(kind=rk), intent(out), optional, allocatable, target :: dXg_dXt(:,:) Physical point
[ncoord]and raw geometry Jacobian[ncoord,2].real(kind=rk), intent(out), optional, allocatable, target :: dmeasure_dXc(:,:) Derivatives of this weighted area w.r.t. local controls and log weights.
real(kind=rk), intent(out), optional, allocatable, target :: dmeasure_dlogWc(:) Derivatives of this weighted area w.r.t. local controls and log weights.
real(kind=rk), intent(out), optional, allocatable :: dgradient_dXc(:,:,:,:) Physical basis gradient derivatives with respect to controls
(A,i,B,j)and log weights(A,i,B).real(kind=rk), intent(out), optional, allocatable :: dgradient_dlogWc(:,:,:) Physical basis gradient derivatives with respect to controls
(A,i,B,j)and log weights(A,i,B).real(kind=rk), intent(out), optional, allocatable :: djacobian_dXc(:,:) Raw Jacobian derivatives for controls (A,alpha) and log weights (i,alpha,A).
real(kind=rk), intent(out), optional, allocatable :: djacobian_dlogWc(:,:,:) Raw Jacobian derivatives for controls (A,alpha) and log weights (i,alpha,A).
procedure, public :: ansatz_element
Evaluate all quadrature data for one analysis element.
-
private pure subroutine ansatz_element(this, ie, Tgc, dTgc_dXg, dA, ngauss, Xg, d2Tgc_dXg2, strict, err, dXg_dXt, dmeasure_dXc, dmeasure_dlogWc, dgradient_dXc, dgradient_dlogWc, djacobian_dXc, djacobian_dlogWc)
Evaluate all quadrature points of one surface analysis element.
This batched form of ansatz constructs the tensor Gauss rule and locates the two knot spans once per element. It returns contiguous quadrature columns with shapes
Tgc(nlocal,nquadrature),dTgc_dXg(nlocal,ncoord,nquadrature), anddA(nquadrature). Optional physical points useXg(ncoord,nquadrature)and optional physical Hessians used2Tgc_dXg2(nlocal,ncoord,ncoord,nquadrature).Allocatable outputs have
intent(inout)and retain their allocation when the required shape is unchanged. Rational values and derivatives use the same exact radix-power weight normalization and quotient recurrence as ansatz. A failure at any quadrature point zeros all element outputs before settingerr, so callers cannot assemble a partially evaluated element.The planar inverse-Jacobian and embedded contravariant transformations, strict orientation policy, and mathematical references are documented by ansatz.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in) :: ie One-based direction-1-fastest active element index.
real(kind=rk), intent(inout), allocatable :: Tgc(:,:) Basis values
[nlocal,nquadrature].real(kind=rk), intent(inout), allocatable :: dTgc_dXg(:,:,:) Physical gradients
[nlocal,ncoord,nquadrature].real(kind=rk), intent(inout), allocatable :: dA(:) Weighted differential areas
[nquadrature].integer, intent(in), optional :: ngauss(2) Optional positive directional quadrature counts; default
degree+1.real(kind=rk), intent(inout), optional, allocatable, target :: Xg(:,:) Optional physical points
[ncoord,nquadrature].real(kind=rk), intent(inout), optional, allocatable, target :: d2Tgc_dXg2(:,:,:,:) Optional physical Hessians
[nlocal,ncoord,ncoord,nquadrature].logical, intent(in), optional :: strict Reject planar orientation reversal in addition to rank deficiency.
type(debug), intent(out), optional :: err Caller-owned diagnostic; when present, object diagnostics are neither read nor changed.
real(kind=rk), intent(inout), optional, allocatable, target :: dXg_dXt(:,:,:) Raw geometry Jacobians
[ncoord,2,nquadrature].real(kind=rk), intent(inout), optional, allocatable, target :: dmeasure_dXc(:,:,:) Derivatives of each weighted area w.r.t. local controls and log weights, with Gauss point last.
real(kind=rk), intent(inout), optional, allocatable, target :: dmeasure_dlogWc(:,:) Derivatives of each weighted area w.r.t. local controls and log weights, with Gauss point last.
real(kind=rk), intent(inout), optional, allocatable :: dgradient_dXc(:,:,:,:,:) Physical basis gradient derivatives with respect to controls
(A,i,B,j,q)and log weights(A,i,B,q).real(kind=rk), intent(inout), optional, allocatable :: dgradient_dlogWc(:,:,:,:) Physical basis gradient derivatives with respect to controls
(A,i,B,j,q)and log weights(A,i,B,q).real(kind=rk), intent(inout), optional, allocatable :: djacobian_dXc(:,:,:) Raw Jacobian derivatives for controls (A,alpha,q) and log weights (i,alpha,A,q).
real(kind=rk), intent(inout), optional, allocatable :: djacobian_dlogWc(:,:,:,:) Raw Jacobian derivatives for controls (A,alpha,q) and log weights (i,alpha,A,q).
generic, public :: basis => basis_vector, basis_scalar
Evaluate the dense rational or polynomial basis.
-
private pure subroutine basis_vector(this, res1, res2, Xt1, Xt2, Tgc, side)
Evaluate the dense surface basis on a tensor-product parameter grid. Explicit directional vectors take precedence over resolutions; every in-domain output row sums to one. Omitted directions reuse cached sample parameters. Query parameters and counts are local, preserving stored samples. With no arguments, cached paired rows are reused. Invalid resolutions, missing parameters, and nonfinite explicit parameters produce a diagnostic.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this integer, intent(in), optional :: res1 Optional positive uniform-grid sizes in directions 1 and 2.
integer, intent(in), optional :: res2 Optional positive uniform-grid sizes in directions 1 and 2.
real(kind=rk), intent(in), optional, contiguous :: Xt1(:) Optional directional parameter vectors.
real(kind=rk), intent(in), optional, contiguous :: Xt2(:) Optional directional parameter vectors.
real(kind=rk), intent(out), allocatable :: Tgc(:,:) Basis matrix
[ng_total,nc_total].integer, intent(in), optional :: side(:) -
private pure subroutine basis_scalar(this, Xt, Tgc, elem, side)
Evaluate the surface basis at one parameter pair. Optional
elemselects and orders a local control subset.Xtmust have at least two finite entries; later entries are ignored. The spline must be initialized. This convenience overload does not diagnose those preconditions.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Parameter pair .
real(kind=rk), intent(out), allocatable :: Tgc(:) Dense or selected basis vector.
integer, intent(in), optional :: elem(:) Optional one-based flattened control indices.
integer, intent(in), optional :: side(:)
generic, public :: bezier => bezier_element, bezier_all
Extract one exact Bezier element or decompose the patch.
-
private pure subroutine bezier_element(this, ie, piece, C, ids, bounds, err)
Extract one exact element; optional polynomial extraction satisfies N=C*B. Element and support IDs use direction-1-fastest stored-control ordering. Bounds have shape [2,2]. The piece retains literal span coordinates, with clamped knots, right/left endpoint traces and disabled wrapping. Caller err bypasses the source diagnostic; source geometry and caches are untouched.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: ie type(nurbs_surface), intent(out), optional :: piece real(kind=rk), intent(out), optional, allocatable :: C(:,:) integer, intent(out), optional, allocatable :: ids(:) real(kind=rk), intent(out), optional, allocatable :: bounds(:,:) type(debug), intent(out), optional :: err -
private pure subroutine bezier_all(this, pieces, err)
Decompose all positive active spans in cmp_elem ordering, without source sampling. Failure returns an empty array; request err to inspect the diagnostic.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this type(nurbs_surface), intent(out), allocatable :: pieces(:) type(debug), intent(out), optional :: err
generic, public :: cmp_Xg => cmp_Xg_scalar, cmp_Xg_vector, cmp_Xg_grid
Evaluate a point, paired batch, or tensor grid without changing samples.
-
private pure function cmp_Xg_scalar(this, Xt, order, side) result(Xg)
Evaluate a point or mixed parametric derivative without changing caches or diagnostics. At least two finite parameters are required; later entries are ignored.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this real(kind=rk), intent(in) :: Xt(:) integer, intent(in), optional :: order(:) Nonnegative parametric derivative order; omitted means position.
integer, intent(in), optional :: side(:) Trace per direction: -1 left, 0 default, +1 right.
Return Value real(kind=rk), allocatable, (:)
-
private pure function cmp_Xg_vector(this, Xt, order, side) result(Xg)
Evaluate paired parameter rows without changing caches or diagnostics. Only the first two columns are used. A valid empty batch returns [0,ncoord]; invalid parameters or missing geometry return [0,0]. Strided inputs are accepted.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this real(kind=rk), intent(in) :: Xt(:,:) integer, intent(in), optional :: order(:) Nonnegative order; omitted means position.
integer, intent(in), optional :: side(:) Trace per direction: -1 left, 0 default, +1 right.
Return Value real(kind=rk), allocatable, (:,:)
-
private pure function cmp_Xg_grid(this, Xt1, Xt2, side) result(Xg)
Evaluate the Cartesian product of two parameter axes, with direction 1 varying fastest.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this real(kind=rk), intent(in) :: Xt1(:) real(kind=rk), intent(in) :: Xt2(:) integer, intent(in), optional :: side(:) Trace at interior knots in each direction.
Return Value real(kind=rk), allocatable, (:,:)
procedure, public :: cmp_Xth_in_Xg
Build embedded active isoparametric grid lines.
-
private impure subroutine cmp_Xth_in_Xg(this, Xg, elemConn, res)
Build active isoparametric grid lines embedded in physical space.
The returned rows of
elemConnare VTK polyline connectivities intoXg. No file is written.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(out), allocatable :: Xg(:,:) integer, intent(out), allocatable :: elemConn(:,:) integer, intent(in), optional :: res
procedure, public :: cmp_area
Integrate surface area with elementwise tensor Gauss quadrature.
-
private pure subroutine cmp_area(this, area, ngauss, strict, err)
Integrate nonnegative physical area over the active knot-span cells. One tensor Gauss rule is reused on every cell; degree+1 points per direction are the default numerical approximation. Local rational derivatives and the conditioned Jacobian frame match ansatz_element. Invalid, singular, or strictly inverted points are omitted while valid contributions remain in area. An active object diagnostic returns zero. With caller-owned err, object diagnostics are neither read nor changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this real(kind=rk), intent(out) :: area Accumulated nonnegative area, including valid points preceding any failure.
integer, intent(in), optional :: ngauss(2) Positive points per direction; default degree+1.
logical, intent(in), optional :: strict Reject planar orientation reversal as well as rank deficiency.
type(debug), intent(out), optional, target :: err Caller-owned diagnostic, reset at entry and independent of the object diagnostic.
procedure, public :: cmp_degree
Infer both degrees from knots and control-net dimensions.
-
private pure subroutine cmp_degree(this, dir)
Infer one or both polynomial degrees from the stored spline dimensions.
When a control count is known, direction uses , where is the knot-vector size and is the number of control points. Otherwise the leading knot multiplicity is interpreted as . Optional
dirrestricts the update to direction 1 or 2.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in), optional :: dir
procedure, public :: cmp_dof_map
Map stored periodic controls to independent cyclic degrees of freedom.
-
private pure function cmp_dof_map(this) result(map)
Map stored controls to independent cyclic IGA degrees of freedom.
The returned one-based array follows direction-1-fastest storage. A bounded direction keeps all stored controls; a verified periodic degree- direction identifies its final layers with its first layers. Apply this map to cmp_elem connectivity.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value integer, allocatable, (:)
procedure, public :: cmp_elem
Build nonzero-span tensor-product IGA connectivity.
-
private pure function cmp_elem(this) result(elemConn)
Build IGA connectivity over all nonzero tensor-product knot spans.
Each row contains flattened control indices in direction-1-fastest order. Repeated knots change adjacent overlap according to their multiplicities. For verified periodic directions, apply cmp_dof_map before assembling independent cyclic degrees of freedom.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value integer, allocatable, (:,:)
procedure, public :: cmp_elem_Xc_vis
Build quadrilateral connectivity for the control net.
-
private pure function cmp_elem_Xc_vis(this, p) result(elemConn)
Build structured quadrilateral connectivity for the control net.
Optional
p=[p_1,p_2]selects the visualization cell order; the default is bilinear. Numbering follows direction-1-fastest storage.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in), optional, contiguous :: p(:) Return Value integer, allocatable, (:,:)
procedure, public :: cmp_elem_Xg_vis
Build quadrilateral connectivity for cached samples.
-
private pure function cmp_elem_Xg_vis(this, p) result(elemConn)
Build structured quadrilateral connectivity for cached geometry samples.
Optional
p=[p_1,p_2]selects the visualization cell order; the default is bilinear. Numbering follows direction-1-fastest storage. An absent physical sample cache returns allocated empty connectivity.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in), optional, contiguous :: p(:) Return Value integer, allocatable, (:,:)
procedure, public :: cmp_elem_Xth
Build quadrilateral connectivity for the parameter grid.
-
private pure function cmp_elem_Xth(this, p) result(elemConn)
Build quadrilateral connectivity for the active parameter-span grid.
Grid vertices are the distinct active knots in both directions. Optional
pselects cell order and defaults to[1,1].Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in), optional, contiguous :: p(:) Return Value integer, allocatable, (:,:)
procedure, public :: cmp_nc
Compute control-point counts implied by knots and degrees.
-
private pure subroutine cmp_nc(this, dir)
Infer one or both directional control counts from knots and degree.
Each selected direction uses , where is the knot-vector size. Optional
dirmust be 1 or 2.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in), optional :: dir
procedure, public :: create
Sample a tensor grid and cache parameters, points, and connectivity.
-
private pure subroutine create(this, res1, res2, Xt1, Xt2, Xt)
Sample and cache surface geometry.
Directional
Xt1/Xt2replace cached vectors;res1/res2generate uniformly spaced vectors when the corresponding explicit vector is absent. Existing vectors are reused when neither is supplied. Unless explicit point rowsXt(:,1:2)are supplied,ndgrid(Xt1,Xt2)forms a direction-1-fastest Cartesian grid. Paired rows ignore directional inputs and clear directional caches. With no inputs, create() reuses all retained parameter rows. Validation and evaluation finish before any cache changes.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in), optional :: res1 Positive directional grid counts; explicit parameter vectors take precedence.
integer, intent(in), optional :: res2 Positive directional grid counts; explicit parameter vectors take precedence.
real(kind=rk), intent(in), optional, contiguous :: Xt1(:) Directional vectors defining a Cartesian product.
real(kind=rk), intent(in), optional, contiguous :: Xt2(:) Directional vectors defining a Cartesian product.
real(kind=rk), intent(in), optional, contiguous :: Xt(:,:) Paired rows [npoint,at least 2], taking precedence over directional inputs.
generic, public :: derivative => derivative_vector, derivative_scalar
Evaluate first parametric derivatives.
-
private pure subroutine derivative_vector(this, res1, res2, Xt1, Xt2, dTgc, Tgc, side)
Evaluate first parametric derivatives on a tensor-product grid.
Explicit directional parameter vectors take precedence over resolutions; omitted directions reuse their caches. With no arguments, cached paired rows are reused. Flattened grid rows follow direction-1-fastest
ndgridordering. Query parameters and counts are local, preserving all cached samples. Missing parameter vectors, invalid resolutions, and nonfinite explicit parameters produce a diagnostic.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this integer, intent(in), optional :: res1 Optional positive uniform-grid sizes in directions 1 and 2.
integer, intent(in), optional :: res2 Optional positive uniform-grid sizes in directions 1 and 2.
real(kind=rk), intent(in), optional, contiguous :: Xt1(:) Optional directional parameter vectors.
real(kind=rk), intent(in), optional, contiguous :: Xt2(:) Optional directional parameter vectors.
real(kind=rk), intent(out), allocatable :: dTgc(:,:,:) Parametric gradients
[ng_total,nc_total,2], ordered as .real(kind=rk), intent(out), optional, allocatable :: Tgc(:,:) Optional basis matrix
[ng_total,nc_total].integer, intent(in), optional :: side(:) -
private pure subroutine derivative_scalar(this, Xt, dTgc, Tgc, elem, side)
Evaluate the parametric basis gradient at one parameter pair. Optional
elemselects and orders a local control subset.Xtmust have at least two finite entries; later entries are ignored. The spline must be initialized. This convenience overload does not diagnose those preconditions.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Parameter pair .
real(kind=rk), intent(out), allocatable :: dTgc(:,:) Selected parametric gradients
[nselected,2].real(kind=rk), intent(out), optional, allocatable :: Tgc(:) Optional selected basis values
[nselected].integer, intent(in), optional :: elem(:) Optional one-based flattened control indices.
integer, intent(in), optional :: side(:)
generic, public :: derivative2 => derivative2_vector, derivative2_scalar
Evaluate complete parametric Hessians.
-
private pure subroutine derivative2_vector(this, res1, res2, Xt1, Xt2, d2Tgc, dTgc, Tgc, side)
Evaluate complete parametric basis Hessians on a tensor-product grid.
Let
ncp=product(nc). The packed output has shape[ng_total,2*ncp,2], withd2Tgc(g,(a-1)*ncp+A,b)equal to . Thus both pure and mixed derivatives are available and symmetry is represented explicitly. Parameter selection and validation are the same as for the vector derivative overload.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: 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(out), allocatable :: d2Tgc(:,:,:) Packed Hessians
[ng_total,2*nc_total,2].real(kind=rk), intent(out), optional, allocatable :: dTgc(:,:,:) Optional first derivatives
[ng_total,nc_total,2].real(kind=rk), intent(out), optional, allocatable :: Tgc(:,:) Optional basis matrix
[ng_total,nc_total].integer, intent(in), optional :: side(:) -
private pure subroutine derivative2_scalar(this, Xt, d2Tgc, dTgc, Tgc, elem, side)
Evaluate a complete parametric basis Hessian at one parameter pair.
For
nselected=product(nc)orsize(elem), the Hessian entryd2Tgc((a-1)*nselected+i,b)stores the selected basis derivative . Both mixed entries are populated. Rational normalization uses the complete active support, including controls omitted byelem.Xtmust have at least two finite entries; later entries are ignored. Missing spline state or invalid active parameters produce a diagnostic and empty requested outputs.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Parameter pair .
real(kind=rk), intent(out), allocatable :: d2Tgc(:,:) Packed selected Hessian
[2*nselected,2].real(kind=rk), intent(out), optional, allocatable :: dTgc(:,:) Optional selected first derivatives
[nselected,2].real(kind=rk), intent(out), optional, allocatable :: Tgc(:) Optional selected basis values
[nselected].integer, intent(in), optional :: elem(:) Optional one-based global controls; ordering and repeats are preserved, invalid entries are zero.
integer, intent(in), optional :: side(:)
generic, public :: derivative_order => derivative_order_vector, derivative_order_scalar
Evaluate dense mixed derivatives.
-
private pure subroutine derivative_order_vector(this, order, Dgc, res1, res2, Xt1, Xt2, side)
Compute one requested mixed derivative on a tensor grid of surface parameters. For
order=[k1,k2], the dense matrix storesExplicit directional vectors take precedence over positive resolutions; omitted directions reuse cached sample parameters. Query parameters and counts are local, so stored samples remain unchanged. With no arguments, cached paired rows are reused. Nonfinite explicit parameters and unavailable omitted directions produce a diagnostic.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this integer, intent(in) :: order(2) Nonnegative mixed-derivative orders
[du,dv].real(kind=rk), intent(out), allocatable :: Dgc(:,:) Dense derivative matrix
[product(ng),product(nc)].integer, intent(in), optional :: res1 Optional positive generated counts by direction.
integer, intent(in), optional :: res2 Optional positive generated counts by direction.
real(kind=rk), intent(in), optional, contiguous :: Xt1(:) Optional explicit directional parameter vectors.
real(kind=rk), intent(in), optional, contiguous :: Xt2(:) Optional explicit directional parameter vectors.
integer, intent(in), optional :: side(:) Trace per direction: -1 left, 0 default, +1 right.
-
private pure subroutine derivative_order_scalar(this, Xt, order, Dgc, elem, side)
Compute one requested mixed derivative at one surface parameter pair. Without
elem, the result follows direction-1-fastest global control order. Withelem, entries follow the supplied one-based flattened indices and an out-of-range index returns zero. A finite two-entryXtis a caller precondition; this overload diagnoses its length and the derivative orders, but not nonfinite parameter values.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Parameter pair
[u,v].integer, intent(in) :: order(2) Nonnegative mixed-derivative orders
[du,dv].real(kind=rk), intent(out), allocatable :: Dgc(:) Dense
[product(nc)]or selected[size(elem)]derivative vector.integer, intent(in), optional, contiguous :: elem(:) Optional ordered one-based flattened control indices.
integer, intent(in), optional :: side(:) Trace per direction: -1 left, 0 default, +1 right.
generic, public :: derivative_order_active => derivative_order_active_vector, derivative_order_active_scalar
Evaluate active mixed derivatives.
-
private pure subroutine derivative_order_active_vector(this, Xt1, Xt2, order, first_active, Dgc, side)
Compute active mixed derivatives on an explicit surface parameter grid. Grid points use . For local offsets , define
where . Then
Dgc(ell,g)is fororder=[k1,k2]. Wrapping is applied directionally. If an unwrapped coordinate is outside its active interval, the derivative column is zero and the corresponding first-active index is 1.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt1(:) Finite directional parameter vectors defining a Cartesian grid.
real(kind=rk), intent(in), contiguous :: Xt2(:) Finite directional parameter vectors defining a Cartesian grid.
integer, intent(in) :: order(2) Nonnegative mixed-derivative orders
[du,dv].integer, intent(out), allocatable :: first_active(:,:) First active control-point indices
[2,npoint].real(kind=rk), intent(out), allocatable :: Dgc(:,:) Local derivatives
[product(degree+1),size(Xt1)*size(Xt2)].integer, intent(in), optional :: side(:) Trace per direction: -1 left, 0 default, +1 right.
-
private pure subroutine derivative_order_active_scalar(this, Xt, order, first_active, Dgc, side)
Compute one active mixed surface derivative. Local and global control indices use the same direction-1-fastest formulas as the vector overload, with one parameter pair.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Finite parameter pair
[u,v].integer, intent(in) :: order(2) Nonnegative mixed-derivative orders
[du,dv].integer, intent(out) :: first_active(2) First active control-point index in each direction.
real(kind=rk), intent(out), allocatable :: Dgc(:) Local derivatives
[product(degree+1)].integer, intent(in), optional :: side(:) Trace per direction: -1 left, 0 default, +1 right.
procedure, public :: elevate_degree
Elevate degree while preserving active-domain geometry in one direction.
-
private pure subroutine elevate_degree(this, dir, t, B, Bs)
Raise the degree in one tensor direction while preserving active-domain geometry. Optional
BsandBare the full scalar and coordinate-expanded tensor-product mappings from old to elevated Euclidean control values after fixing the output weights. For rational data they depend on the old and new weights and are not homogeneous elevation operators. Fort>0, a verified periodic direction retains its cyclic knot extension and repeated control layers. Other non-clamped input in the selected direction is converted to an equivalent open-clamped representation on its active interval. Other tensor directions are unchanged.Algorithm: H. Prautzsch, Computer Aided Geometric Design 1 (1984), 193--198. doi:10.1016/0167-8396(84)90031-1. Applied directionally using Piegl and Tiller, Algorithm A5.9.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout), target :: this integer, intent(in) :: dir Elevated parameter direction, 1 or 2.
integer, intent(in) :: t Nonnegative degree increment; zero is the identity operation.
real(kind=rk), intent(out), optional, allocatable :: B(:,:) Optional coordinate-expanded elevation operator.
real(kind=rk), intent(out), optional, allocatable :: Bs(:,:) Optional scalar elevation operator.
procedure, public :: export_Xc
Export the control net in legacy VTK format.
-
private impure subroutine export_Xc(this, filename, point_data, field_names, encoding)
Export the control net as legacy VTK quadrilateral cells.
Stored visualization connectivity is used when available; otherwise bilinear connectivity is generated. Optional
point_datais point-associated data with matchingfield_names.encodingis forwarded to the VTK writer.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this character(len=*), intent(in) :: filename real(kind=rk), intent(in), optional, contiguous :: point_data(:,:) character(len=*), intent(in), optional, contiguous :: field_names(:) character(len=*), intent(in), optional :: encoding
procedure, public :: export_Xg
Export cached surface samples in legacy VTK format.
-
private impure subroutine export_Xg(this, filename, point_data, field_names, encoding)
Export cached physical samples as legacy VTK quadrilateral cells.
Call create before this operation. Stored visualization connectivity is used when available; otherwise bilinear connectivity is generated.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this character(len=*), intent(in) :: filename real(kind=rk), intent(in), optional, contiguous :: point_data(:,:) character(len=*), intent(in), optional, contiguous :: field_names(:) character(len=*), intent(in), optional :: encoding
procedure, public :: export_Xth
Export the sampled parameter surface in legacy VTK format.
-
private impure subroutine export_Xth(this, filename, point_data, field_names, encoding)
Export the active tensor-product parameter grid in parameter space.
Vertices are pairs of distinct active knots and quadrilateral cells span adjacent values. The written coordinates are , not physical surface points.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this character(len=*), intent(in) :: filename real(kind=rk), intent(in), optional, contiguous :: point_data(:,:) character(len=*), intent(in), optional, contiguous :: field_names(:) character(len=*), intent(in), optional :: encoding
procedure, public :: export_Xth_in_Xg
Export parameter-grid lines embedded in physical space.
-
private impure subroutine export_Xth_in_Xg(this, filename, res, encoding)
Export active isoparametric grid lines embedded in physical space.
Every distinct active knot in one direction defines a line sampled over all active spans of the other direction. Optional
ressets the minimum number of points per span and defaults to 10.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this character(len=*), intent(in) :: filename integer, intent(in), optional :: res character(len=*), intent(in), optional :: encoding
procedure, public :: export_iges
Export the surface as IGES entity 128.
-
private impure subroutine export_iges(this, filename)
Export the current surface as IGES entity 128.
Both knot vectors, degrees, control-net ordering, weights, and active parameter ranges are transferred to a Rational B-Spline Surface entity. One- and two-dimensional embeddings are padded with zero coordinates; for embeddings above three dimensions, only the first three coordinates are written because entity 128 stores three Cartesian coordinates. Closed and periodic properties are classified independently of parameter wrapping. A direction is closed only when its two boundary traces agree throughout every positive tangential knot span. On each span, the comparison uses interior points: after clearing the positive rational denominators, each coordinate difference has degree at most , so these values determine equality of the two trace pieces. A direction is periodic only when it is closed and its final control layers repeat the first layers while its knot sequence repeats after intervals. Rational periodicity also requires repeated weights. The polynomial/rational property follows is_rational, including its roundoff-scale uniform-weight classification.
The routine requires initialized surface data. File-system and writer failures are delegated to
forIGESand are not converted to err.Format reference: U.S. National Bureau of Standards, Initial Graphics Exchange Specification (IGES), Version 4.0, NBSIR 88-3813 (1988), Rational B-Spline Surface Entity 128. NIST publication.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this Valid initialized surface. Existing diagnostic errors suppress export.
character(len=*), intent(in) :: filename Nonempty destination path for the IGES text file.
procedure, public :: finalize
Release all owned and derived surface data while preserving diagnostics.
-
private pure elemental subroutine finalize(this)
Release all owned surface arrays and reset derived state.
The diagnostic object is deliberately preserved so callers can inspect an error after cleanup.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this
generic, public :: get_Wc => get_Wc_all, get_Wci
Query control weights.
-
private pure function get_Wc_all(this) result(Wc)
Return an allocated copy of the flattened control weights.
The result has size
product(nc). Polynomial surfaces, unset weights, and active diagnostics produce an allocated empty result.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value real(kind=rk), allocatable, (:)
-
private pure elemental function get_Wci(this, n) result(Wc)
Return one flattened control weight.
The elemental query returns zero when no weights are stored,
nis invalid, or the object has an active diagnostic.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: n Return Value real(kind=rk)
generic, public :: get_Xc => get_Xc_all, get_Xci, get_Xcid
Query control-point data.
-
private pure function get_Xc_all(this) result(Xc)
Return an allocated copy of the flattened control net.
The result has shape
[product(nc),ncoord]and uses direction-1-fastest ordering. An active diagnostic or unset control net produces an allocated[0,0]result.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value real(kind=rk), allocatable, (:,:)
-
private pure function get_Xci(this, n) result(Xc)
Return one control point from the flattened control net.
nis the one-based, direction-1-fastest control index. An invalid index or unavailable control net produces an allocated empty result.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: n Return Value real(kind=rk), allocatable, (:)
-
private pure elemental function get_Xcid(this, n, dir) result(Xc)
Return one Cartesian component of one flattened control point.
The elemental query returns zero when
nordiris outside the stored control-net bounds, or when the object has an active diagnostic.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: n integer, intent(in) :: dir Return Value real(kind=rk)
generic, public :: get_Xg => get_Xg_all, get_Xgi, get_Xgid
Query cached geometry points.
-
private pure function get_Xg_all(this) result(Xg)
Return an allocated copy of all cached physical samples.
The result has shape
[product(ng),ncoord]and direction 1 varies fastest. An active diagnostic or absent cache produces[0,0].Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value real(kind=rk), allocatable, (:,:)
-
private pure function get_Xgi(this, n) result(Xg)
Return one cached physical sample.
nis the one-based flattened sample index. Invalid or unavailable data produces an allocated empty result.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: n Return Value real(kind=rk), allocatable, (:)
-
private pure elemental function get_Xgid(this, n, dir) result(Xg)
Return one Cartesian component of one cached physical sample.
The elemental query returns zero for an invalid sample or coordinate index and while the object has an active diagnostic.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: n integer, intent(in) :: dir Return Value real(kind=rk)
procedure, public :: get_Xt
Return cached parameter samples in one direction.
-
private pure function get_Xt(this, dir) result(Xt)
Return cached parameter samples in direction
dir.Valid directions are 1 and 2. For a Cartesian cache created from directional vectors, the result contains the corresponding vector. A row-wise cache created by
put_to_nurbs, an invalid direction, absent directional data, or an active diagnostic produces an allocated empty result.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value real(kind=rk), allocatable, (:)
procedure, public :: get_continuity
Return metadata for each distinct stored knot.
-
private pure function get_continuity(this, dir) result(c)
Return at every distinct stored directional knot.
For degree and knot multiplicity , entry is . At interior active knots this is guaranteed spline-space continuity; a particular surface can be smoother. Endpoint entries and entries outside the active interval describe representation multiplicity, not continuity between two active spans.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value integer, allocatable, (:)
generic, public :: get_degree => get_degree_all, get_degree_dir
Query polynomial degrees.
-
private pure function get_degree_all(this) result(degree)
Return both polynomial degrees .
An active diagnostic produces zeros.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value integer, (2)
-
private pure elemental function get_degree_dir(this, dir) result(degree)
Return the polynomial degree in one parameter direction.
Valid directions are 1 and 2. Invalid input or an active diagnostic returns zero.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value integer
procedure, public :: get_elem
Return IGA element-to-control-point connectivity.
-
private pure function get_elem(this) result(elemConn)
Return an allocated copy of cached IGA element-to-control-point connectivity. An absent cache or active diagnostic returns shape
[0,0].cmp_elem()computes connectivity independently without populating this cache.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value integer, allocatable, (:,:)
procedure, public :: get_elem_Xc_vis
Return control-net visualization connectivity.
-
private pure function get_elem_Xc_vis(this) result(elemConn)
Return an allocated copy of control-net visualization connectivity.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value integer, allocatable, (:,:)
procedure, public :: get_elem_Xg_vis
Return sampled-surface visualization connectivity.
-
private pure function get_elem_Xg_vis(this) result(elemConn)
Return an allocated copy of sampled-surface visualization connectivity.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value integer, allocatable, (:,:)
generic, public :: get_knot => get_knoti, get_knot_all
Query knot-vector data.
-
private pure elemental function get_knoti(this, dir, i) result(knot)
Return one knot from a selected parameter direction.
The elemental query returns zero for an invalid direction or index, unavailable knots, or an active diagnostic.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir integer, intent(in) :: i Return Value real(kind=rk)
-
private pure function get_knot_all(this, dir) result(knot)
Return an allocated copy of one directional knot vector.
Valid directions are 1 and 2. Invalid input, unavailable knots, or an active diagnostic produces an allocated empty result.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value real(kind=rk), allocatable, (:)
procedure, public :: get_multiplicity
Return multiplicities of all distinct stored knots in one direction.
-
private pure function get_multiplicity(this, dir) result(m)
Return multiplicities of the distinct knots in one direction.
Result entries correspond, in nondecreasing order, to the unique values in the complete selected knot vector. Invalid input or unavailable state produces an allocated empty result.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value integer, allocatable, (:)
generic, public :: get_nc => get_nc_all, get_nc_dir
Query directional control-point counts.
-
private pure function get_nc_all(this) result(nc)
Return control-point counts .
An active diagnostic produces zeros.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value integer, (2)
-
private pure elemental function get_nc_dir(this, dir) result(nc)
Return the control-point count in one direction.
Invalid input, unavailable knots, or an active diagnostic returns zero.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value integer
procedure, public :: get_ng
Return cached sample counts by direction.
-
private pure function get_ng(this) result(ng)
Return the two directional sample counts.
A Cartesian cache reports its two directional counts. A row-wise cache reports
[npoint,1]. The result is zero before sampling and while a diagnostic is active. The parameter grid is retained after control or weight edits, but counts remain zero until create() regenerates geometry.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value integer, (2)
procedure, public :: get_parameter_topology
Classify one stored parameter topology.
-
private pure function get_parameter_topology(this, dir) result(topology)
Classify one stored parameter topology.
The result is
"periodic"only when the selected knot extension, every repeated control layer, and any stored weight layer satisfy the cyclic identities inperiodic_topology. Every other valid direction is"bounded". Invalid directions and incomplete or inconsistent objects return"invalid". Parameter wrapping is independent.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value character(len=8)
procedure, public :: get_parameter_wrapping
Report modulo parameter mapping in one direction.
-
private pure elemental function get_parameter_wrapping(this, dir) result(wrap_parameters)
Report modulo parameter mapping in one surface direction. Invalid directions or an active diagnostic return
.false..Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value logical
procedure, public :: insert_knots
Insert knots while preserving active-domain geometry.
-
private pure subroutine insert_knots(this, dir, Xth, r, B, Bs)
Insert knots in one tensor direction without changing the surface.
Requests are applied in array order. The resulting multiplicity may not exceed
degree(dir)+1; equality represents a break in the selected direction. For a verified periodic direction, the maximum isdegree(dir)and insertion also updates the cyclic exterior knots and repeated control layers. Let be its current active interval and the value returned byknot_tolerance. Writing forXth(i), validation accepts , but inserts the supplied value exactly: no endpoint snapping or tolerance-based multiplicity matching is applied.Rational data are refined in homogeneous coordinates. Writing and for the old and new Euclidean control arrays, after the new weights are fixed
Bs[new_control,old_control]is the full flattened tensor-product operator satisfying for every coordinate .Bis its coordinate-block expansion for control-point-major vectors. For rational data these are Euclidean fixed-weight maps that depend on the old and new weights, not homogeneous refinement maps.Algorithm: W. Boehm, Computer-Aided Design 12 (1980), 199--201. doi:10.1016/0010-4485(80)90154-2. Applied directionally using Piegl and Tiller, Algorithm A5.1.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in) :: dir Refined parameter direction, 1 or 2.
real(kind=rk), intent(in), contiguous :: Xth(:) Finite values in the tolerance-expanded closed active interval; values are not snapped.
integer, intent(in), contiguous :: r(:) Nonnegative counts; final multiplicity is at most
degree(dir)+1, ordegree(dir)if periodic.real(kind=rk), intent(out), optional, allocatable :: B(:,:) Optional coordinate-expanded refinement operator.
real(kind=rk), intent(out), optional, allocatable :: Bs(:,:) Optional scalar refinement operator.
procedure, public :: is_rational
Report whether nonuniform weights affect the current basis.
-
private pure elemental function is_rational(this) result(r)
Report whether stored nonuniform weights affect basis evaluation.
Exactly equal weights select the polynomial basis. Every nonconstant positive weight list selects rational evaluation; no tolerance discards weight variation. An active diagnostic or absent weights returns false.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Return Value logical
procedure, public :: is_valid
Report whether complete, internally consistent surface geometry is stored.
-
private pure function is_valid(this) result(ok)
Report whether the defining surface geometry is complete and consistent.
For directional degrees and control counts , both knot vectors must satisfy . The flattened control net must contain finite points with at least one physical coordinate. Explicit weights, when stored, must comprise the same number of finite positive values and agree with the cached rational classification. Sample and connectivity caches are derived state and are not inspected.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this Surface geometry to inspect.
Return Value logical
procedure, public :: lsq_fit_bspline
Fit polynomial control points by structured least squares.
-
private pure subroutine lsq_fit_bspline(this, Xt, Xdata, ndata)
Fit polynomial tensor-product B-spline control points to parameterized data.
ndata=[n1,n2]defines the number of rows used. For a recognized direction-1-fastest Cartesian parameter grid, Kronecker separability is exploited through two directional banded normal-equation solves. If a directional factorization fails, two directional Householder QR solves preserve the Kronecker structure and avoid a dense tensor design. The grid test requires exactlyproduct(ndata)parameter and data rows. Repeated coordinates are compared componentwise against 32 times the larger of their ULPs andepsilon(rk)times that parameter direction's sampled span. No absolute unit floor is used. Otherwise the firstproduct(ndata)rows use one banded tensor-product normal equation, with a dense pivoted-QR fallback allocated only if Cholesky fails.The routine fits a polynomial tensor-product B-spline model. A surface with nonuniform weights is rejected without changing its controls; use lsq_fit_nurbs for a rational model. Uniform weights produce the same polynomial basis.
XtandXdatamust provide enough finite rows,Xtmust have at least two columns,Xdataat least one, and each directional parameter set must give full-rank active-domain coverage. These shape and finiteness preconditions are not completely diagnosed. OnlyXcis replaced; cachedXgis not recomputed.All paths require numerical full column rank. The QR fallback diagnoses rank deficiency with code 108 instead of returning nonunique controls.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: Xt(:,:) Parameter pairs
[at least product(ndata),2].real(kind=rk), intent(in), contiguous :: Xdata(:,:) Data coordinates
[at least product(ndata),ncoord].integer, intent(in) :: ndata(2) Directional data counts
[2], each at least the correspondingnc.
procedure, public :: lsq_fit_nurbs
Fit control points and positive weights by damped nonlinear least squares.
-
private pure subroutine lsq_fit_nurbs(this, Xt, Xdata, ndata, maxit, tol, lambda_xc, mu0, reg_logw)
Alternately fit surface control points and positive rational weights.
Control points and log-weights are updated from banded normal equations. Mean log-weight removal fixes projective scale at geometric mean weight one. Each trial weight vector is used to recompute its least-squares controls before the residual is tested. A trial is accepted only when its residual norm does not increase; otherwise controls and weights remain at the last accepted iterate and the damping is increased. Accepted trials reduce the damping. Log-weight steps outside the finite exponential range are rejected before exponentiation.
With and residuals , the monitored quantity is
This is not an RMS residual. After an accepted trial, iteration stops when , or when . The latter recognizes a fit at the attainable accuracy of the normal-equation solves without accepting an increasing trial. The default tolerance is . Exhausting
maxitsets diagnostic code 109 and retains the last accepted controls and weights. Only controls, weights, and rational-state metadata are updated; cachedXgis not recomputed. Inputs must provide enough finite rows and at least two parameter columns and one coordinate column, withndata>=nccomponentwise,maxit>0,tol>=0, and finite, nonnegative regularization/damping values. The objective is nonconvex.Damped least-squares references: K. Levenberg, "A Method for the Solution of Certain Non-Linear Problems in Least Squares," Quarterly of Applied Mathematics 2 (1944), 164--168 (doi:10.1090/qam/10666); D. W. Marquardt, "An Algorithm for Least-Squares Estimation of Nonlinear Parameters," Journal of the Society for Industrial and Applied Mathematics 11 (1963), 431--441 (doi:10.1137/0111030).
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: Xt(:,:) Parameter pairs
[at least product(ndata),2].real(kind=rk), intent(in), contiguous :: Xdata(:,:) Data coordinates
[at least product(ndata),ncoord].integer, intent(in) :: ndata(2) Directional data counts
[2].integer, intent(in), optional :: maxit Optional positive iteration limit; default 30.
real(kind=rk), intent(in), optional :: tol Optional nonnegative relative decrease tolerance; default
sqrt(epsilon(rk)).real(kind=rk), intent(in), optional :: lambda_xc Optional nonnegative control-point diagonal regularization.
real(kind=rk), intent(in), optional :: mu0 Optional nonnegative initial log-weight damping.
real(kind=rk), intent(in), optional :: reg_logw Optional nonnegative additional log-weight regularization.
generic, public :: modify_Wc => modify_Wc_scalar, modify_Wc_all
Replace one weight or all positive control weights.
-
private pure subroutine modify_Wc_scalar(this, W, num)
Replace one positive weight; polynomial surfaces initially have unit weights. Physical samples are cleared; create() reuses the retained parameter grid.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in) :: W integer, intent(in) :: num -
private pure subroutine modify_Wc_all(this, Wc)
Atomically replace all positive weights at fixed control counts. Physical samples are cleared; create() reuses the retained parameter grid.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in) :: Wc(:)
generic, public :: modify_Xc => modify_Xc_scalar, modify_Xc_all
Replace one coordinate or a fixed-shape control net.
-
private pure subroutine modify_Xc_scalar(this, X, num, dir)
Replace one finite control coordinate; num and dir are one-based. Physical samples are cleared; create() reuses the retained parameter grid.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in) :: X integer, intent(in) :: num integer, intent(in) :: dir -
private pure subroutine modify_Xc_all(this, Xc)
Atomically replace a finite control net of the same shape. Physical samples are cleared; knots and control connectivity remain valid. create() reuses the retained parameter grid.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in) :: Xc(:,:)
procedure, public :: nearest_point
Select the nearest cached geometry sample.
-
private pure subroutine nearest_point(this, point_Xg, nearest_Xg, nearest_Xt, id)
Find the closest cached sample in the shared physical coordinate prefix. Extra query coordinates are ignored and a longer output is zero-padded. Ties select the first cached sample. Missing/sticky state, empty data or nonfinite inputs return zero outputs. Call create() before this discrete search.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this real(kind=rk), intent(in), contiguous :: point_Xg(:) real(kind=rk), intent(out), optional :: nearest_Xg(size(point_Xg)) real(kind=rk), intent(out), optional :: nearest_Xt(2) integer, intent(out), optional :: id
procedure, public :: nearest_point2
Minimize squared distance with bounded Newton iterations and backtracking.
-
private pure subroutine nearest_point2(this, point_Xg, tol, maxit, nearest_Xt, nearest_Xg, initial_Xt, err)
Find a bounded local closest-point candidate without changing sample caches. Span-aware coarse seeds or optional literal initial_Xt initialize a shared projected Newton solve with Gauss-Newton/descent fallback and backtracking. Rational geometry jets use local support; no dense basis matrices are formed. This is a local numerical candidate, without a global-nearest guarantee. An optional caller err is reset for this call and leaves this%err unchanged; without it, sticky object diagnostics are respected and failures stored there. Invalid input returns zero outputs. A failed iteration retains its candidate; maxit=0 returns the bounded initial candidate with nonconvergence diagnostic109.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: point_Xg(:) Finite query with at least ncoord entries; extra coordinates are ignored.
real(kind=rk), intent(in) :: tol Finite nonnegative convergence tolerance.
integer, intent(in) :: maxit Nonnegative iteration limit.
real(kind=rk), intent(out) :: nearest_Xt(2) real(kind=rk), intent(out), optional :: nearest_Xg(:) Optional point output with exactly ncoord entries.
real(kind=rk), intent(in), optional :: initial_Xt(:) Optional finite parameter pair inside the literal active box.
type(debug), intent(out), optional :: err
procedure, public :: put_to_nurbs
Map structured points to the current parameter domain and cache them.
-
private pure subroutine put_to_nurbs(this, X, elemConn)
Parameterize rows by two coordinates and cache the mapped surface.
Columns 1 and 2 of
Xare independently mapped from their data ranges to the active intervals and :Remaining columns do not affect the parameterization. The routine atomically replaces the flattened parameter-point pairs and stores their count as
ng=[size(X,1),1]. Because arbitrary input rows need not form a Cartesian product, directional parameter vectors are cleared. WhenelemConnis absent, sampled visualization connectivity is reset to an empty quadrilateral topology.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this Initialized surface whose sampled geometry cache is replaced.
real(kind=rk), intent(in), contiguous :: X(:,:) Ordering data
[npoint,ncolumn]; columns 1 and 2 need nonzero ranges.integer, intent(in), optional, contiguous :: elemConn(:,:) Optional one-based visualization connectivity for the cached points.
procedure, public :: reduce_degree
Reduce degree under one physical geometry-error budget.
-
private pure subroutine reduce_degree(this, dir, t, tol, reduced, error_bound)
Reduce degree under one Euclidean error budget for the complete call. Each candidate is compared with the call-entry geometry. Return the longest accepted prefix in reduced; over-budget proposals are normal rejections. Commit once, clearing derived caches only when at least one step succeeds.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in) :: dir integer, intent(in) :: t Requested decrement, 0 <= t <= the selected degree.
real(kind=rk), intent(in) :: tol Finite nonnegative physical error budget, including every accepted step.
integer, intent(out), optional :: reduced Number of committed decrements; zero on failure or complete rejection.
real(kind=rk), intent(out), optional :: error_bound Conservative whole-call bound for the committed geometry.
procedure, public :: remove_knots
Remove directional knots that pass an internal geometry test.
-
private pure subroutine remove_knots(this, dir, Xth, r, removed, tol, error_bound)
Remove interior knots with optional physical geometry-error control. Requests use exact stored knots and are processed in array order. Each request accepts its longest removable prefix; a rejected candidate is not an error. Without
tol, the original roundoff-scaled homogeneous control test applies. Withtol, every candidate is compared with the call-entry geometry in a common basis, bounding Euclidean error over the complete active domain. The bound includes all accepted requests in this call; it is conservative, subject to floating-point arithmetic, and is not a sampled or measured maximum. Periodic removals preserve complete cyclic knot orbits. Invalid requests leave geometry unchanged and return zero counts and bound.Algorithm: Piegl and Tiller, Algorithm A5.8; W. Tiller, doi:10.1016/0010-4485(92)90012-Y.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in) :: dir Modified parameter direction, 1 through 2.
real(kind=rk), intent(in), contiguous :: Xth(:) Exact stored knot values strictly inside the active interval.
integer, intent(in), contiguous :: r(:) Nonnegative requested counts, not exceeding current multiplicity.
integer, intent(out), optional, allocatable :: removed(:) Committed counts per request; zero on failure or rejection.
real(kind=rk), intent(in), optional :: tol Finite nonnegative bound in physical units for this complete call.
real(kind=rk), intent(out), optional :: error_bound Conservative Euclidean bound for the committed update; zero on failure.
generic, public :: reparameterize => reparameterize_interval, reparameterize_axes
Rescale or reorder parameter axes.
-
private pure function reparameterize_interval(this, dir, a, b) result(patch)
Affinely map one active domain to a finite increasing interval, preserving exterior knots. Parameters retain their relative position; geometry, degree, control order, explicit weights and wrapping are preserved. Mapped derivatives scale by ((old_hi-old_lo)/(b-a))**order in the selected direction.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir real(kind=rk), intent(in) :: a real(kind=rk), intent(in) :: b Return Value type(nurbs_surface)
-
private pure function reparameterize_axes(this, axes) result(patch)
New axis d takes source axis abs(axes(d)); a negative entry reverses its original interval.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: axes(:) Return Value type(nurbs_surface)
procedure, public :: restrict
Extract a bounded patch on a literal parameter subinterval.
-
private pure function restrict(this, dir, a, b) result(patch)
Restrict one parameter to a literal interval inside its active domain. The selected direction is clamped on [a,b] without rescaling parameters; its wrapping is disabled and the other direction is unchanged. At a discontinuity, the lower endpoint takes the right trace and the upper endpoint the left trace. The result owns fresh geometry and diagnostics.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir real(kind=rk), intent(in) :: a real(kind=rk), intent(in) :: b Return Value type(nurbs_surface)
procedure, public :: reverse
Reverse one parameter direction and its control/weight ordering.
-
private pure function reverse(this, dir) result(patch)
Reverse one parameter while retaining the full knot vector and explicit weights. On smooth spans, Q(u)=S(lo+hi-u) in the selected direction. At a break, the new right trace is the old left trace; the endpoint traces are exchanged. Wrapping is preserved, including this choice of trace at a nonclosed seam. The result owns geometry only; source geometry and caches remain unchanged.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir Return Value type(nurbs_surface)
procedure, public :: rotate_Xc
Rotate control points in three-dimensional embedding space.
-
private pure subroutine rotate_Xc(this, alpha, beta, theta)
Rotate all control points in place using x-y-z Euler angles in degrees.
The active extrinsic convention is . For fewer than three coordinates, only the leading principal matrix block is applied; coordinates after the third are unchanged. Cached physical samples are not changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_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 cached geometry points in three-dimensional embedding space.
-
private pure subroutine rotate_Xg(this, alpha, beta, theta)
Rotate all cached physical samples using x-y-z Euler angles in degrees.
The convention and coordinate-dimension behavior match rotate_Xc. Control points are not changed.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in) :: alpha real(kind=rk), intent(in) :: beta real(kind=rk), intent(in) :: theta
generic, public :: set => set1, set2, set3, set4
Replace surface geometry or initialize a fitting space.
-
private pure subroutine set1(this, knot1, knot2, Xc, Wc, degree, wrap_parameters)
Replace the surface with explicit directional knots and control data.
Xcis direction-1-fastest. Ifdegreeis absent, an open-clamped candidate inferred from the initial knot runs takes precedence. If that candidate is invalid, exhaustive degree/count search must find exactly one valid pair. Pass explicit degrees whenever this convention is ambiguous or should not determine the interpretation of non-open data.Xcmust contain at least one flattened control row and one finite coordinate component. Coordinate, knot, and positive-weight invariants are validated before any core state is replaced.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: knot1(:) Complete knot vector in direction 1.
real(kind=rk), intent(in), contiguous :: knot2(:) Complete knot vector in direction 2.
real(kind=rk), intent(in), contiguous :: Xc(:,:) Flattened control net
[nc(1)*nc(2),ncoord].real(kind=rk), intent(in), optional, contiguous :: Wc(:) Optional positive flattened weights
[product(nc)].integer, intent(in), optional, contiguous :: degree(:) Optional polynomial degrees
[2].logical, intent(in), optional, contiguous :: wrap_parameters(:) Optional modulo evaluation flags
[2]. -
private pure subroutine set2(this, Xth_dir1, Xth_dir2, degree, continuity1, continuity2, Xc, Wc)
Construct both spline directions from breakpoints and continuities.
continuity1/2are converted to knot multiplicities bycompute_knot_vector. Optional control data must match the resulting tensor-product count. In direction , breakpoints must be finite and strictly increasing. Values in retain a breakpoint with multiplicity ;-1gives full multiplicity , whilec_i=p_domits that breakpoint. Both generated knot vectors are validated before object state changes. IfXcis absent, any previous control net is released and the result is a tensor-product spline space for subsequent fitting, not complete surface geometry. Optional weights are retained only when explicitly supplied.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: Xth_dir1(:) Finite, strictly increasing breakpoints in direction 1.
real(kind=rk), intent(in), contiguous :: Xth_dir2(:) Finite, strictly increasing breakpoints in direction 2.
integer, intent(in), contiguous :: degree(:) Polynomial degrees
[2].integer, intent(in), contiguous :: continuity1(:) One value per direction-1 breakpoint in
-1:degree(1); the upper value omits it.integer, intent(in), contiguous :: continuity2(:) One value per direction-2 breakpoint in
-1:degree(2); the upper value omits it.real(kind=rk), intent(in), optional, contiguous :: Xc(:,:) Optional flattened control net
[product(computed_nc),ncoord].real(kind=rk), intent(in), optional, contiguous :: Wc(:) Optional positive weights
[product(computed_nc)]. -
private pure subroutine set3(this, nc, Xc, Wc)
Construct a tensor-product Bezier or rational Bezier surface on . Directional degrees are
nc(1:2)-1; all endpoint knots are fully clamped.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in), contiguous :: nc(:) Control-point counts
[2].real(kind=rk), intent(in), contiguous :: Xc(:,:) Direction-1-fastest control net
[product(nc),ncoord].real(kind=rk), intent(in), optional, contiguous :: Wc(:) Optional positive weights
[product(nc)]. -
private pure subroutine set4(this, degree, nc, Xc, Wc)
Construct a clamped open-uniform surface on . Interior knots are uniformly spaced and simple in each direction.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in), contiguous :: degree(:) Polynomial degrees
[2], each smaller thannc.integer, intent(in), contiguous :: nc(:) Directional control-point counts
[2].real(kind=rk), intent(in), contiguous :: Xc(:,:) Direction-1-fastest control net
[product(nc),ncoord].real(kind=rk), intent(in), optional, contiguous :: Wc(:) Optional positive weights
[product(nc)].
procedure, public :: set_C
Construct the predefined planar C-shaped surface.
-
private pure subroutine set_C(this, center, radius1, radius2)
Construct an exact planar rational C-shaped annular sector.
Two quadratic rational arcs span 240 degrees on each circular boundary; a linear radial direction connects the boundaries. The result has a
5 x 2control net in the xy plane atcenter(3). Boundary radii are the absolute scale values. Use nonzero scales of the same sign and unequal magnitudes for a regular C-shaped annular sector; opposite signs create crossing radial lines.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this Surface replaced by the annular sector.
real(kind=rk), intent(in), contiguous :: center(:) Common center; at least three finite components are required.
real(kind=rk), intent(in) :: radius1 Finite signed scale of the first circular boundary.
real(kind=rk), intent(in) :: radius2 Finite signed scale of the second circular boundary.
procedure, public :: set_elem
Replace stored IGA connectivity.
-
private pure subroutine set_elem(this, elemConn)
Replace stored IGA element connectivity with a copy of
elemConn.This low-level setter does not verify consistency with the current knot vectors or control-net dimensions.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in), contiguous :: elemConn(:,:)
procedure, public :: set_elem_Xc_vis
Replace control-net visualization connectivity.
-
private pure subroutine set_elem_Xc_vis(this, elemConn)
Replace control-net visualization connectivity with a copy of
elemConn.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in), contiguous :: elemConn(:,:)
procedure, public :: set_elem_Xg_vis
Replace sampled-surface visualization connectivity.
-
private pure subroutine set_elem_Xg_vis(this, elemConn)
Replace sampled-surface visualization connectivity with a copy of
elemConn.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this integer, intent(in), contiguous :: elemConn(:,:)
procedure, public :: set_half_ring
Construct an exact rational half-annulus.
-
private pure subroutine set_half_ring(this, center, radius1, radius2)
Construct an exact planar rational half-annulus.
Two quadratic quarter-arcs form each semicircular boundary and a linear radial direction connects them. The result has a
5 x 2control net in the xy plane atcenter(3). Use nonzero scales of the same sign and unequal absolute values for a regular half-annulus. A negative common sign rotates the template by ; opposite signs produce crossing radial lines.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this Surface replaced by the half-annulus.
real(kind=rk), intent(in), contiguous :: center(:) Common center; at least three finite components are required.
real(kind=rk), intent(in) :: radius1 Finite legacy first-boundary scale; represented radius
abs(radius1)/2.real(kind=rk), intent(in) :: radius2 Finite legacy second-boundary scale; represented radius
abs(radius2)/2.
procedure, public :: set_ring
Construct an exact rational annular surface.
-
private pure subroutine set_ring(this, center, radius1, radius2)
Construct an exact planar rational annulus.
Three quadratic rational arcs form each circular boundary and a linear radial direction connects them. The result has a
7 x 2control net in the xy plane atcenter(3). The two boundary radii areabs(radius1)andabs(radius2). For the named nondegenerate annulus, use nonzero scales of the same sign and unequal magnitudes (conventionally `0Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this Surface replaced by the annulus.
real(kind=rk), intent(in), contiguous :: center(:) Common center; at least three finite components are required.
real(kind=rk), intent(in) :: radius1 Finite signed scale of the first circular boundary.
real(kind=rk), intent(in) :: radius2 Finite signed scale of the second circular boundary.
procedure, public :: set_tetragon
Construct a bilinear tetragonal surface.
-
private pure subroutine set_tetragon(this, L, nc, Wc)
Construct an axis-aligned rectangular tensor-product surface.
The control net is uniformly distributed on
[0,L(1)] x [0,L(2)]in the planez=0; direction 1 varies fastest. The generated knot vectors follow the standardset(nc=...,Xc=...)policy.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this Surface replaced by the generated rectangle.
real(kind=rk), intent(in), contiguous :: L(:) Finite side lengths
[Lx,Ly].integer, intent(in), contiguous :: nc(:) Directional control counts
[nu,nv], both greater than one.real(kind=rk), intent(in), optional, contiguous :: Wc(:) Optional finite positive weights
[product(nc)].
procedure, public :: slice
Extract an exact isoparametric curve by fixing one parameter.
-
private pure function slice(this, dir, Xt) result(curve)
Extract an exact isoparametric curve by fixing parameter direction
dir. The remaining direction keeps its knots, degree, control ordering and wrapping. Rational controls are contracted homogeneously; no geometry is sampled. Interior knots use the right trace; an unwrapped upper endpoint uses the left trace. Source wrapping is applied, mapping the upper endpoint to the lower endpoint when enabled. Errors are returned on the curve, including an existing source diagnostic. Source geometry, parameters and samples remain unchanged.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir real(kind=rk), intent(in) :: Xt Return Value type(nurbs_curve)
procedure, public :: split => split_surface
Split a patch at an interior parameter, preserving both one-sided traces.
-
private pure subroutine split_surface(this, dir, Xt, left, right)
Split at a strictly interior parameter, retaining the original coordinates. Each output is a restriction with the appropriate one-sided boundary trace. Failure clears both outputs and reports the same diagnostic on each.
Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(in) :: this integer, intent(in) :: dir real(kind=rk), intent(in) :: Xt type(nurbs_surface), intent(out) :: left type(nurbs_surface), intent(out) :: right
procedure, public :: transform
Apply one affine map to control points and cached geometry.
-
private pure subroutine transform(this, linear, translation, center)
Apply one affine transformation to the surface in place.
Control points and an existing sampled-geometry cache are transformed by
The optional vectors
centerandtranslationrepresent and . Affine covariance follows from partition of unity, so the transformed control net represents the exact affine image of the original NURBS surface. Knots, weights, parameters, and connectivity are unchanged. A singular matrix remains an exact map but can reduce surface rank and invalidate an IGA parameterization.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: linear(:,:) Square linear map
[ncoord,ncoord].real(kind=rk), intent(in), optional, contiguous :: translation(:) Translation vector
[ncoord]; zero when absent.real(kind=rk), intent(in), optional, contiguous :: center(:) Transformation center
[ncoord]; the origin when absent.
procedure, public :: translate_Xc
Translate the control net by a physical-space vector.
-
private pure subroutine translate_Xc(this, vec)
Translate every control point by physical-space vector
vec.vecmust supply every stored coordinate. Cached samples are not changed. Extra entries are ignored and finiteness is not checked.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: vec(:)
procedure, public :: translate_Xg
Translate cached geometry points by a physical-space vector.
-
private pure subroutine translate_Xg(this, vec)
Translate every cached physical sample by vector
vec.vecmust supply every stored coordinate. Control points are not changed. Extra entries are ignored and finiteness is not checked.Arguments
Type Intent Optional Attributes Name class(nurbs_surface), intent(inout) :: this real(kind=rk), intent(in), contiguous :: vec(:)