nurbs_volume Derived Type
- BSD 3-Clause
- 130 statements
type, public :: nurbs_volume
Mutable trivariate B-spline or NURBS volume mapping.
Initialize the object with set. Directional arrays use
entries 1, 2, and 3 for parameters , , and . Each
degree(d) is a polynomial degree; 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 samples a Cartesian product grid. Refinement is applied as one-dimensional homogeneous operators along a selected tensor direction. Physical IGA gradients, Hessians, and volume integration require exactly three physical coordinates and a nonsingular Jacobian.
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 or Jacobian; 109 iterative nonconvergence; and 110 unsupported trivariate IGES export.
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 volume.
-
private pure subroutine ansatz(this, ie, ig, Tgc, dTgc_dXg, dV, 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.
The volume must have exactly three physical coordinates. Element and local basis order agree with
cmp_elem.dVincludes tensor quadrature weight, all span maps, and the absolute physical Jacobian determinant. Gradients and optional Hessians are transformed to Cartesian coordinates; a singular Jacobian sets diagnostic code 108. Withstrict=.true., the Jacobian determinant must also be positive, so an orientation-reversing integration point is rejected instead of contributing positive measure. The check is local to the requested quadrature point and does not prove global injectivity between quadrature points.With ,
For Cartesian indices , the optional physical Hessian applies the inverse-map chain rule,
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_volume), intent(inout) :: this integer, intent(in) :: ie Active element and flattened tensor quadrature-point indices, both one-based.
integer, intent(in) :: ig Active element and flattened tensor quadrature-point indices, both one-based.
real(kind=rk), intent(out), allocatable, target :: Tgc(:) Local basis values
[nlocal]and physical gradients[nlocal,3].real(kind=rk), intent(out), allocatable, target :: dTgc_dXg(:,:) Local basis values
[nlocal]and physical gradients[nlocal,3].real(kind=rk), intent(out) :: dV Weighted differential volume contribution.
integer, intent(in), optional :: ngauss(3) Positive directional quadrature counts; defaults to
degree+1.real(kind=rk), intent(out), optional, allocatable, target :: d2Tgc_dXg2(:,:,:) Optional physical Hessians
[nlocal,3,3].logical, intent(in), optional :: strict Reject orientation reversal in addition to singularity.
type(debug), intent(out), optional :: err Caller-owned diagnostic; bypasses and preserves the object diagnostic.
real(kind=rk), intent(out), optional, allocatable, target :: Xg(:) Optional physical point
[3]and raw Jacobian[3,3], coordinate first.real(kind=rk), intent(out), optional, allocatable, target :: dXg_dXt(:,:) Optional physical point
[3]and raw Jacobian[3,3], coordinate first.real(kind=rk), intent(out), optional, allocatable, target :: dmeasure_dXc(:,:) Weighted measure derivatives for the active Euclidean controls and log weights.
real(kind=rk), intent(out), optional, allocatable, target :: dmeasure_dlogWc(:) Weighted measure derivatives for the active Euclidean 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, dV, 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 volume analysis element.
This batched counterpart of ansatz locates the three active knot spans and constructs the tensor Gauss rule once. The local-basis index varies fastest in
Tgc(nlocal,nquadrature)anddTgc_dXg(nlocal,3,nquadrature). Differential volumes are returned indV(nquadrature). Optional outputs have shapesXg(3,nquadrature)andd2Tgc_dXg2(nlocal,3,3,nquadrature).Allocatable outputs have
intent(inout)so repeated element calls reuse correctly shaped storage. The rational quotient, inverse-Jacobian gradient, Hessian chain rule, measure, and strict-orientation test are mathematically identical to ansatz. Any failure zeros the complete element result before settingerr.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in) :: ie One-based direction-1-fastest active element index.
real(kind=rk), intent(inout), allocatable :: Tgc(:,:) Reusable basis
[nlocal,nq], physical gradients[nlocal,3,nq], weighted measures[nq].real(kind=rk), intent(inout), allocatable :: dTgc_dXg(:,:,:) Reusable basis
[nlocal,nq], physical gradients[nlocal,3,nq], weighted measures[nq].real(kind=rk), intent(inout), allocatable :: dV(:) Reusable basis
[nlocal,nq], physical gradients[nlocal,3,nq], weighted measures[nq].integer, intent(in), optional :: ngauss(3) Positive directional quadrature counts; defaults to
degree+1.real(kind=rk), intent(inout), optional, allocatable, target :: Xg(:,:) Optional physical points
[3,nq]and physical Hessians[nlocal,3,3,nq].real(kind=rk), intent(inout), optional, allocatable, target :: d2Tgc_dXg2(:,:,:,:) Optional physical points
[3,nq]and physical Hessians[nlocal,3,3,nq].logical, intent(in), optional :: strict Reject orientation reversal in addition to singularity.
type(debug), intent(out), optional :: err Caller-owned diagnostic; bypasses and preserves the object diagnostic.
real(kind=rk), intent(inout), optional, allocatable, target :: dXg_dXt(:,:,:) Optional raw Jacobians
[3,3,nq], coordinate first, parameter direction second.real(kind=rk), intent(inout), optional, allocatable, target :: dmeasure_dXc(:,:,:) Weighted measure derivatives for the active Euclidean controls and log weights.
real(kind=rk), intent(inout), optional, allocatable, target :: dmeasure_dlogWc(:,:) Weighted measure derivatives for the active Euclidean controls and log weights.
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, res3, Xt1, Xt2, Xt3, Tgc, side)
Evaluate the dense volume basis on a tensor-product parameter grid. Explicit directional vectors take precedence over resolutions; every in-domain output row sums to one. No arguments reuse retained paired rows; omitted directions in a requested grid reuse sampled vectors. Parameters and counts are local to the query; sample caches remain unchanged. Invalid or unavailable directional parameters produce an empty result and a recoverable diagnostic.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this integer, intent(in), optional :: res1 Optional positive uniform-grid sizes in directions 1--3.
integer, intent(in), optional :: res2 Optional positive uniform-grid sizes in directions 1--3.
integer, intent(in), optional :: res3 Optional positive uniform-grid sizes in directions 1--3.
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(in), optional, contiguous :: Xt3(:) 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 volume basis at one parameter triple. Optional
elemselects and orders a local control subset.Xtmust have at least three finite entries; later entries are ignored. Invalid state or parameters return empty requested arrays and a recoverable diagnostic.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Parameter triple .
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,3]. 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_volume), intent(in) :: this integer, intent(in) :: ie type(nurbs_volume), 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_volume), intent(in) :: this type(nurbs_volume), intent(out), allocatable :: pieces(:) type(debug), intent(out), optional :: err
generic, public :: cmp_Xg => cmp_Xg_scalar, cmp_Xg_vector
Evaluate one point or paired parameter rows.
-
private pure function cmp_Xg_scalar(this, Xt, order, side) result(Xg)
Evaluate a point or mixed parametric derivative using the first three parameters. Later entries are ignored. Unset geometry, active diagnostics or invalid parameters return an allocated empty result without changing diagnostics.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 rows, returning
[npoint,ncoord]without changing caches. The first three columns must be finite; later columns are ignored. Strided input is accepted. Valid empty input returns[0,ncoord]; invalid input or unset geometry returns[0,0]without changing diagnostics.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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, (:,:)
procedure, public :: cmp_Xth_in_Xg
Build embedded active isoparametric grid surfaces.
-
private impure subroutine cmp_Xth_in_Xg(this, Xg, elemConn, res)
Build active isoparametric grid surfaces 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_volume), intent(inout) :: this real(kind=rk), intent(out), allocatable :: Xg(:,:) integer, intent(out), allocatable :: elemConn(:,:) integer, intent(in), optional :: res
procedure, public :: cmp_degree
Infer all degrees from knots and control-lattice dimensions.
-
private pure subroutine cmp_degree(this, dir)
Infer one or all polynomial degrees from stored spline dimensions.
When a control count is known, direction uses , where is the knot-vector size and the control count. Otherwise the leading multiplicity is interpreted as . Optional
dirrestricts the update to one direction.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in), optional :: dir
procedure, public :: cmp_degreeFace
Return tensor degrees retained on one volume face.
-
private pure function cmp_degreeFace(this, face) result(degree)
Return the tensor degree retained on one face.
Face numbering is
[w_min,w_max,v_min,v_max,u_min,u_max]. The normal-direction entry is zero; for example aw-face returns . Invalid input or an active diagnostic returns zeros.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: face Return Value integer, (3)
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 every stored layer; 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_volume), 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. Knot multiplicities determine overlap between adjacent rows. For verified periodic directions, apply cmp_dof_map before assembling independent cyclic degrees of freedom.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this Return Value integer, allocatable, (:,:)
procedure, public :: cmp_elemFace
Extract one face from an IGA element.
-
private pure function cmp_elemFace(this, elem, face) result(elemConn)
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: elem integer, intent(in) :: face Return Value integer, allocatable, (:)
procedure, public :: cmp_elemFace_Xc_vis
Extract one face from a control-lattice visualization cell.
-
private pure function cmp_elemFace_Xc_vis(this, elem, face) result(elemConn)
Extract one quadrilateral face from a control-lattice VTK cell.
elemselects a cell in the current default trilinear visualization connectivity, generated independently of stored connectivity overrides. Face numbering is[w_min,w_max,v_min,v_max,u_min,u_max]. The result has four global point indices, or is empty for invalid or unavailable state.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: elem integer, intent(in) :: face Return Value integer, allocatable, (:)
procedure, public :: cmp_elemFace_Xg_vis
Extract one face from a sampled-volume visualization cell.
-
private pure function cmp_elemFace_Xg_vis(this, elem, face) result(elemConn)
Extract one quadrilateral face from a sampled-volume VTK cell.
elemselects a cell in the current default trilinear visualization connectivity, generated independently of stored connectivity overrides. Face numbering is[w_min,w_max,v_min,v_max,u_min,u_max]. The result has four global point indices, or is empty for invalid or unavailable state.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: elem integer, intent(in) :: face Return Value integer, allocatable, (:)
procedure, public :: cmp_elem_Xc_vis
Build hexahedral connectivity for the control lattice.
-
private pure function cmp_elem_Xc_vis(this, p) result(elemConn)
Build structured hexahedral connectivity for the control lattice.
Optional
p=[p_1,p_2,p_3]selects visualization cell order; the default is trilinear. Numbering follows direction-1-fastest storage.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in), optional, contiguous :: p(:) Return Value integer, allocatable, (:,:)
procedure, public :: cmp_elem_Xg_vis
Build hexahedral connectivity for cached samples.
-
private pure function cmp_elem_Xg_vis(this, p) result(elemConn)
Build structured hexahedral connectivity for cached geometry samples.
Optional
p=[p_1,p_2,p_3]selects visualization cell order; the default is trilinear. Numbering follows direction-1-fastest storage.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in), optional, contiguous :: p(:) Return Value integer, allocatable, (:,:)
procedure, public :: cmp_elem_Xth
Build hexahedral connectivity for the parameter grid.
-
private pure function cmp_elem_Xth(this, p) result(elemConn)
Build hexahedral connectivity for the active parameter-span grid.
Vertices are triples of distinct active knots. Optional
pselects cell order and defaults to[1,1,1].Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 all directional control counts from knots and degree.
Each selected direction uses , where is the knot-vector size. Optional
dirmust be in 1 through 3.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in), optional :: dir
procedure, public :: cmp_volume
Integrate mapped volume with elementwise tensor Gauss quadrature.
-
private pure subroutine cmp_volume(this, volume, ngauss, strict, err)
Integrate physical volume over all nonzero knot-span cells. Each cell uses the same tensor Gauss rule, defaulting to
degree+1points per direction. This is an approximation for nonpolynomial maps. The local rational basis and scaled Jacobian frame are shared with IGA. Invalid quadrature points or Jacobians are omitted from the partial result and reported through the diagnostic. Reversed maps contribute positively unlessstrictis true. This does not certify injectivity. Caller-ownederris reset and leaves the object diagnostic untouched; without it an active object diagnostic returns zero. Caches are unchanged.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this real(kind=rk), intent(out) :: volume Accumulated nonnegative physical volume; partial on quadrature failure.
integer, intent(in), optional :: ngauss(3) Positive directional quadrature counts; defaults to
degree+1.logical, intent(in), optional :: strict Omit and diagnose orientation-reversed quadrature points.
type(debug), intent(out), optional, target :: err Caller-owned diagnostic for shared-geometry integration.
procedure, public :: create
Sample a tensor grid and cache parameters, points, and connectivity.
-
private pure subroutine create(this, res1, res2, res3, Xt1, Xt2, Xt3, Xt)
Sample and cache volume geometry.
Paired
Xtrows take precedence over all directional arguments. Otherwise explicit directional values override resolutions, with omitted directions reusing their stored vectors. Calling without arguments reevaluates the retained parameter grid. Rejected input preserves every existing cache.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in), optional :: res1 Positive directional grid sizes, overridden by explicit directional values.
integer, intent(in), optional :: res2 Positive directional grid sizes, overridden by explicit directional values.
integer, intent(in), optional :: res3 Positive directional grid sizes, overridden by explicit directional values.
real(kind=rk), intent(in), optional, contiguous :: Xt1(:) Directional grid values; omitted directions reuse the stored vectors.
real(kind=rk), intent(in), optional, contiguous :: Xt2(:) Directional grid values; omitted directions reuse the stored vectors.
real(kind=rk), intent(in), optional, contiguous :: Xt3(:) Directional grid values; omitted directions reuse the stored vectors.
real(kind=rk), intent(in), optional, contiguous :: Xt(:,:) Paired rows with at least three columns; later columns are retained but ignored.
generic, public :: derivative => derivative_vector, derivative_scalar
Evaluate first parametric derivatives.
-
private pure subroutine derivative_vector(this, res1, res2, res3, Xt1, Xt2, Xt3, 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. Flattened rows follow direction-1-fastest
ndgridordering; no arguments reuse retained paired rows directly. Parameters and counts are local to the query; sampled metadata and geometry are unchanged. Missing, empty, or nonfinite directional parameters and nonpositive resolutions produce an empty result and a recoverable diagnostic.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this integer, intent(in), optional :: res1 Optional positive uniform-grid sizes in directions 1--3.
integer, intent(in), optional :: res2 Optional positive uniform-grid sizes in directions 1--3.
integer, intent(in), optional :: res3 Optional positive uniform-grid sizes in directions 1--3.
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(in), optional, contiguous :: Xt3(:) Optional directional parameter vectors.
real(kind=rk), intent(out), allocatable :: dTgc(:,:,:) Parametric gradients
[ng_total,nc_total,3], 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 triple. Optional
elemselects and orders a local control subset.Xtmust have at least three finite entries; later entries are ignored. Invalid state or parameters return empty requested arrays and a recoverable diagnostic.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Parameter triple .
real(kind=rk), intent(out), allocatable :: dTgc(:,:) Selected parametric gradients
[nselected,3].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, res3, Xt1, Xt2, Xt3, 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,3*ncp,3], withd2Tgc(g,(a-1)*ncp+A,b)equal to . Pure and mixed derivatives are all available, with symmetry represented explicitly. Parameter selection and validation are the same as for the vector derivative overload. Sample caches remain unchanged.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this integer, intent(in), optional :: res1 integer, intent(in), optional :: res2 integer, intent(in), optional :: res3 real(kind=rk), intent(in), optional, contiguous :: Xt1(:) real(kind=rk), intent(in), optional, contiguous :: Xt2(:) real(kind=rk), intent(in), optional, contiguous :: Xt3(:) real(kind=rk), intent(out), allocatable :: d2Tgc(:,:,:) Packed Hessians
[ng_total,3*nc_total,3].real(kind=rk), intent(out), optional, allocatable :: dTgc(:,:,:) Optional first derivatives
[ng_total,nc_total,3].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 triple.
For
ncp=product(nc),d2Tgc((a-1)*ncp+A,b)stores . The output shape is[3*ncp,3]; all mixed entries are populated. Withelem, replacencpbysize(elem)andAby the position in that list. Rational normalization always includes the full active support.Xtmust have at least three finite entries; later entries are ignored. Invalid state or parameters return empty requested arrays and a recoverable diagnostic.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Parameter triple .
real(kind=rk), intent(out), allocatable :: d2Tgc(:,:) Packed Hessian
[3*nselected,3], in selected control order.real(kind=rk), intent(out), optional, allocatable :: dTgc(:,:) Optional selected first derivatives
[nselected,3].real(kind=rk), intent(out), optional, allocatable :: Tgc(:) Optional selected basis values
[nselected].integer, intent(in), optional :: elem(:) Optional global control IDs; preserves order/repeats and zeros invalid or inactive IDs.
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, res3, Xt1, Xt2, Xt3, side)
Compute one requested mixed derivative on a tensor grid of volume parameters. For
order=[k1,k2,k3], the dense matrix storesExplicit directional vectors take precedence over positive resolutions; omitted directions reuse sampled parameter vectors. With no directional arguments, retained paired rows are evaluated directly. Queries never change sampled parameters, sample counts, or cached geometry. Empty or nonfinite parameter vectors and unavailable directions produce an empty result and a recoverable diagnostic.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this integer, intent(in) :: order(3) Nonnegative mixed-derivative orders
[du,dv,dw].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.
integer, intent(in), optional :: res3 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.
real(kind=rk), intent(in), optional, contiguous :: Xt3(:) 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 volume parameter triple. 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 three-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_volume), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Parameter triple
[u,v,w].integer, intent(in) :: order(3) Nonnegative mixed-derivative orders
[du,dv,dw].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, Xt3, order, first_active, Dgc, side)
Compute active mixed derivatives on an explicit volume parameter grid. Grid points use . For local offsets , define
where . Then
Dgc(ell,g)is fororder=[k1,k2,k3]. 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_volume), 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.
real(kind=rk), intent(in), contiguous :: Xt3(:) Finite directional parameter vectors defining a Cartesian grid.
integer, intent(in) :: order(3) Nonnegative mixed-derivative orders
[du,dv,dw].integer, intent(out), allocatable :: first_active(:,:) First active control-point indices
[3,npoint].real(kind=rk), intent(out), allocatable :: Dgc(:,:) Local derivatives
[product(degree+1),product(grid sizes)].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 volume derivative. Local and global control indices use the same direction-1-fastest formulas as the vector overload, with one parameter triple.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout), target :: this real(kind=rk), intent(in), contiguous :: Xt(:) Finite parameter triple
[u,v,w].integer, intent(in) :: order(3) Nonnegative mixed-derivative orders
[du,dv,dw].integer, intent(out) :: first_active(3) 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 maps from old to elevated Euclidean flattened 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_volume), intent(inout), target :: this integer, intent(in) :: dir Elevated parameter direction, 1, 2, or 3.
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 lattice in legacy VTK format.
-
private impure subroutine export_Xc(this, filename, point_data, field_names, encoding)
Export the control lattice as legacy VTK hexahedral cells.
Stored visualization connectivity is used when available; otherwise trilinear connectivity is generated. Optional
point_datais point-associated data with matchingfield_names.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 volume samples in legacy VTK format.
-
private impure subroutine export_Xg(this, filename, point_data, field_names, encoding)
Export cached physical samples as legacy VTK hexahedral cells.
Call create before this operation. Stored visualization connectivity is used when available; otherwise trilinear connectivity is generated.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 volume 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 triples of distinct active knots and cells span adjacent values. The written coordinates are , not physical points.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 cells embedded in physical space.
-
private impure subroutine export_Xth_in_Xg(this, filename, res, encoding)
Export active isoparametric grid surfaces embedded in physical space.
Every distinct active knot in one direction defines a surface sampled over all active spans in the other directions. Optional
ressets the minimum directional sampling density and defaults to 10.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this character(len=*), intent(in) :: filename integer, intent(in), optional :: res character(len=*), intent(in), optional :: encoding
procedure, public :: export_iges
Report that trivariate IGES export is unsupported.
-
private impure subroutine export_iges(this, filename)
Report that direct IGES export of a trivariate NURBS is unsupported.
IGES entities 126 and 128 represent parametric curves and surfaces; this API does not approximate a volume or silently replace it by its boundary. A valid initialized volume and nonempty filename therefore produce diagnostic code 110 and no file. Use export_Xg for a VTK representation.
Format reference: U.S. National Bureau of Standards, Initial Graphics Exchange Specification (IGES), Version 4.0, NBSIR 88-3813 (1988), entities 126 and 128. NIST publication.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this Volume whose diagnostic state receives the recoverable error.
character(len=*), intent(in) :: filename Prospective output path; it must be nonempty.
procedure, public :: finalize
Release all owned and derived volume data while preserving diagnostics.
-
private pure elemental subroutine finalize(this)
Release all owned volume 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_volume), 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 volumes, unset weights, and active diagnostics produce an allocated empty result.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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_volume), 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 lattice.
The result has shape
[product(nc),ncoord]and uses direction-1-fastest ordering. An active diagnostic or unset lattice produces an allocated[0,0]result.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this Return Value real(kind=rk), allocatable, (:,:)
-
private pure function get_Xci(this, n) result(Xc)
Return one point from the flattened control lattice.
nis the one-based direction-1-fastest control index. Invalid or unavailable data produces an allocated empty result.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 for an invalid control or coordinate index and while the object has an active diagnostic.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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_volume), 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_volume), 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_volume), 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 through 3. 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_volume), 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 volume mapping 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_volume), 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 all polynomial degrees .
An active diagnostic produces zeros.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this Return Value integer, (3)
-
private pure elemental function get_degree_dir(this, dir) result(degree)
Return the polynomial degree in one parameter direction.
Valid directions are 1 through 3. Invalid input or an active diagnostic returns zero.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 without storing it; use set_elem to populate this compatibility cache.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this Return Value integer, allocatable, (:,:)
procedure, public :: get_elem_Xc_vis
Return control-lattice visualization connectivity.
-
private pure function get_elem_Xc_vis(this) result(elemConn)
Return an allocated copy of control-lattice visualization connectivity.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this Return Value integer, allocatable, (:,:)
procedure, public :: get_elem_Xg_vis
Return sampled-volume visualization connectivity.
-
private pure function get_elem_Xg_vis(this) result(elemConn)
Return an allocated copy of sampled-volume visualization connectivity.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this Return Value integer, allocatable, (:,:)
generic, public :: get_knot => get_knoti, get_knot_all
Query directional 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_volume), 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 through 3. Invalid input, unavailable knots, or an active diagnostic produces an allocated empty result.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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_volume), 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_volume), intent(in) :: this Return Value integer, (3)
-
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_volume), 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 three directional sample counts.
A Cartesian cache reports its three directional counts. A row-wise cache reports
[npoint,1,1]. The result is zero before sampling and while a diagnostic is active or geometry samples were invalidated by an edit.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this Return Value integer, (3)
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_volume), 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 volume direction. Invalid directions or an active diagnostic return
.false..Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 volume. 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_volume), intent(inout) :: this integer, intent(in) :: dir Refined parameter direction, 1, 2, or 3.
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_volume), intent(in) :: this Return Value logical
procedure, public :: is_valid
Report whether complete, internally consistent volume geometry is stored.
-
private pure function is_valid(this) result(ok)
Report whether the defining volume geometry is complete and consistent.
For directional degrees and control counts , every knot vector must satisfy . The flattened control lattice 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_volume), intent(in) :: this Volume 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 controls to parameterized volume data.
ndata=[n1,n2,n3]defines the rows used. A recognized Cartesian grid is solved by three directional banded normal-equation factorizations. If a directional factorization fails, three directional Householder QR solves preserve Kronecker structure without forming the 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 direction's sampled span. No absolute unit floor is used. Otherwise the firstproduct(ndata)rows use one banded tensor-product normal system, with a dense pivoted-QR fallback allocated only after Cholesky failure.The routine fits a polynomial tensor-product B-spline model. A volume 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 three 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_volume), intent(inout) :: this real(kind=rk), intent(in), contiguous :: Xt(:,:) Parameter triples
[at least product(ndata),3].real(kind=rk), intent(in), contiguous :: Xdata(:,:) Data coordinates
[at least product(ndata),ncoord].integer, intent(in) :: ndata(3) Directional data counts
[3], 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 volume control points and positive rational weights.
Banded normal equations update controls and log-weights. 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 three 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_volume), intent(inout) :: this real(kind=rk), intent(in), contiguous :: Xt(:,:) Parameter triples
[at least product(ndata),3].real(kind=rk), intent(in), contiguous :: Xdata(:,:) Data coordinates
[at least product(ndata),ncoord].integer, intent(in) :: ndata(3) Directional data counts
[3].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
Edit one weight or the complete weight vector.
-
private pure subroutine modify_Wc_scalar(this, W, num)
Replace one positive weight; polynomial volumes begin with implicit unit weights.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this real(kind=rk), intent(in) :: W integer, intent(in) :: num -
private pure subroutine modify_Wc_all(this, Wc)
Replace all weights atomically without changing the control lattice or knots.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this real(kind=rk), intent(in) :: Wc(:)
generic, public :: modify_Xc => modify_Xc_scalar, modify_Xc_all
Edit one coordinate or the complete control array.
-
private pure subroutine modify_Xc_scalar(this, X, num, dir)
Edit one finite coordinate without scanning or copying the control lattice. Successful edits discard physical samples while retaining their parameters for a subsequent
create()call.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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)
Replace all finite control coordinates atomically at the current shape.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 using a scale-safe Euclidean distance. Only min(query size,physical dimension) coordinates participate; extra returned coordinates are zero-padded. Ties retain the first sample. Missing caches, active diagnostics, empty queries or nonfinite participating coordinates return zero outputs and id=0. Sampling limits search accuracy.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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(3) 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)
Compute a bounded continuous nearest-point candidate without sampling caches. Span-aware seeds initialize a safeguarded Newton/Gauss-Newton search; a finite in-domain initial_Xt bypasses that search. Parameters are scaled internally to [0,1]. A successful result is a local stationary candidate, not a certificate of the global nearest point or a zero-distance inverse. At discontinuities, a left trace uses the representable parameter below the knot so nearest_Xg agrees with cmp_Xg(nearest_Xt). Invalid inputs return zero outputs; numerical or convergence failures retain a valid candidate when available. maxit=0 retains the seed and reports code109. Caller-owned err bypasses and preserves this%err.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this real(kind=rk), intent(in), contiguous :: point_Xg(:) Finite query with at least every stored physical coordinate; extras are ignored.
real(kind=rk), intent(in) :: tol Finite nonnegative parameter tolerance.
integer, intent(in) :: maxit Nonnegative iteration limit.
real(kind=rk), intent(out) :: nearest_Xt(3) real(kind=rk), intent(out), optional :: nearest_Xg(:) Must match the stored physical dimension when present.
real(kind=rk), intent(in), optional :: initial_Xt(:) Optional finite three-entry initial parameter inside the literal active domain.
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 three coordinates and cache the mapped volume.
Columns 1--3 of
Xare independently mapped from their data ranges to the three active knot intervals. For direction ,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,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 hexahedral topology.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this Initialized volume whose sampled geometry cache is replaced.
real(kind=rk), intent(in), contiguous :: X(:,:) Ordering data
[npoint,ncolumn]; columns 1--3 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_volume), 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_volume), intent(inout) :: this integer, intent(in) :: dir Modified parameter direction, 1 through 3.
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)
Rescale the complete selected knot vector to the finite interval
[a,b]. The geometry is unchanged under affine parameter correspondence; each derivative in this direction gains the inverse domain-scale factor.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: dir real(kind=rk), intent(in) :: a real(kind=rk), intent(in) :: b Return Value type(nurbs_volume)
-
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_volume), intent(in) :: this integer, intent(in) :: axes(:) Return Value type(nurbs_volume)
procedure, public :: restrict
Extract an independent bounded patch on one parameter interval.
-
private pure function restrict(this, dir, a, b) result(patch)
Extract the exact bounded patch on the literal interval
[a,b]. Parameters and degrees are unchanged; only the selected direction is clamped and stops wrapping. At discontinuous cuts the patch keeps the interior one-sided traces. Geometry is independently owned and unsampled.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: dir real(kind=rk), intent(in) :: a Finite ordered bounds inside the original active interval; no modulo mapping.
real(kind=rk), intent(in) :: b Finite ordered bounds inside the original active interval; no modulo mapping.
Return Value type(nurbs_volume)
procedure, public :: reverse
Reverse one parameter direction without changing its active interval.
-
private pure function reverse(this, dir) result(patch)
Reverse a parameter direction, including exterior knots and control layers. On continuous spans V_rev(u)=V(lo+hi-u). At a discontinuity the new right trace is the original left trace. Wrapping and explicit weights remain.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: dir Return Value type(nurbs_volume)
procedure, public :: rotate_Xc
Rotate control points in three-dimensional physical 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_volume), 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 physical 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_volume), 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 volume geometry or initialize a fitting space.
-
private pure subroutine set1(this, knot1, knot2, knot3, Xc, Wc, degree, wrap_parameters)
Replace the volume 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 triple. 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_volume), 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 :: knot3(:) Complete knot vector in direction 3.
real(kind=rk), intent(in), contiguous :: Xc(:,:) Flattened control lattice
[product(nc),ncoord].real(kind=rk), intent(in), optional, contiguous :: Wc(:) Optional positive flattened weights
[product(nc)].integer, intent(in), optional, contiguous :: degree(:) Optional polynomial degrees
[3].logical, intent(in), optional, contiguous :: wrap_parameters(:) Optional modulo evaluation flags
[3]. -
private pure subroutine set2(this, Xth_dir1, Xth_dir2, Xth_dir3, degree, continuity1, continuity2, continuity3, Xc, Wc)
Construct all spline directions from breakpoints and continuities. Directional continuity arrays are converted to knot multiplicities by
compute_knot_vector. Optional controls and weights 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. All generated knot vectors are validated before object state changes. IfXcis absent, any previous control lattice is released and the result is a tensor-product spline space for subsequent fitting, not complete volume geometry. Optional weights are retained only when explicitly supplied.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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.
real(kind=rk), intent(in), contiguous :: Xth_dir3(:) Finite, strictly increasing breakpoints in direction 3.
integer, intent(in), contiguous :: degree(:) Polynomial degrees
[3].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.integer, intent(in), contiguous :: continuity3(:) One value per direction-3 breakpoint in
-1:degree(3); the upper value omits it.real(kind=rk), intent(in), optional, contiguous :: Xc(:,:) Optional flattened control lattice
[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 volume on . Directional degrees are
nc(1:3)-1; endpoint knots are fully clamped.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in), contiguous :: nc(:) Control-point counts
[3].real(kind=rk), intent(in), contiguous :: Xc(:,:) Direction-1-fastest control lattice
[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 volume on . Interior knots are uniformly spaced and simple in each direction.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in), contiguous :: degree(:) Polynomial degrees
[3], each smaller thannc.integer, intent(in), contiguous :: nc(:) Directional control-point counts
[3].real(kind=rk), intent(in), contiguous :: Xc(:,:) Direction-1-fastest control lattice
[product(nc),ncoord].real(kind=rk), intent(in), optional, contiguous :: Wc(:) Optional positive weights
[product(nc)].
procedure, public :: set_C
Construct the predefined C-shaped volume.
-
private pure subroutine set_C(this, center, radius1, radius2, length)
Construct an exact rational C-shaped annular extrusion.
Two quadratic rational arcs span 240 degrees in direction 1, direction 2 joins the circular boundaries, and direction 3 is a linear extrusion. The control net has shape
5 x 2 x 2. For a regular C-shaped annular volume, use nonzero radius scales of the same sign and unequal magnitudes, together with a nonzero length. A common negative radius sign rotates the template by ; opposite signs make radial lines cross the axis.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this Volume replaced by the C-shaped extrusion.
real(kind=rk), intent(in), contiguous :: center(:) Base center; at least three finite components are required.
real(kind=rk), intent(in) :: radius1 Finite signed scale of the first cylindrical boundary.
real(kind=rk), intent(in) :: radius2 Finite signed scale of the second cylindrical boundary.
real(kind=rk), intent(in) :: length Finite signed extrusion length; use a nonzero value for a nondegenerate volume.
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-lattice dimensions.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in), contiguous :: elemConn(:,:)
procedure, public :: set_elem_Xc_vis
Replace control-lattice visualization connectivity.
-
private pure subroutine set_elem_Xc_vis(this, elemConn)
Replace control-lattice visualization connectivity with a copy of
elemConn.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in), contiguous :: elemConn(:,:)
procedure, public :: set_elem_Xg_vis
Replace sampled-volume visualization connectivity.
-
private pure subroutine set_elem_Xg_vis(this, elemConn)
Replace sampled-volume visualization connectivity with a copy of
elemConn.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this integer, intent(in), contiguous :: elemConn(:,:)
procedure, public :: set_half_ring
Construct an exact rational half-annular volume.
-
private pure subroutine set_half_ring(this, center, radius1, radius2, length)
Construct an exact rational half-annular extrusion.
Two quadratic quarter-arcs form each semicircular boundary, direction 2 joins the boundaries, and direction 3 is a linear extrusion. The control net has shape
5 x 2 x 2. For a regular half-annular volume, use nonzero radius scales of the same sign and unequal absolute values, together with a nonzero length. A negative common radius sign rotates the template by ; opposite signs create crossing radial lines.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this Volume replaced by the half-annular extrusion.
real(kind=rk), intent(in), contiguous :: center(:) Base 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.real(kind=rk), intent(in) :: length Finite signed extrusion length; use a nonzero value for a nondegenerate volume.
procedure, public :: set_hexahedron
Construct a trilinear hexahedral volume.
-
private pure subroutine set_hexahedron(this, L, nc, Wc)
Construct an axis-aligned hexahedral tensor-product volume.
The control net is uniformly distributed on
[0,L(1)] x [0,L(2)] x [0,L(3)]; direction 1 varies fastest. Generated knot vectors follow the standardset(nc=...,Xc=...)policy.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this Volume replaced by the generated hexahedron.
real(kind=rk), intent(in), contiguous :: L(:) Finite side lengths
[Lx,Ly,Lz].integer, intent(in), contiguous :: nc(:) Directional control counts
[nu,nv,nw], all greater than one.real(kind=rk), intent(in), optional, contiguous :: Wc(:) Optional finite positive weights
[product(nc)].
procedure, public :: set_ring
Construct an exact rational annular volume.
-
private pure subroutine set_ring(this, center, radius1, radius2, length)
Construct an exact rational annular extrusion.
The first direction contains a three-arc exact circle, the second joins two circular boundaries linearly, and the third extrudes from
center(3)tocenter(3)+length. The control net has shape7 x 2 x 2. Boundary radii areabs(radius1)andabs(radius2). For a regular annular volume, use nonzero radius scales of the same sign and unequal magnitudes, and a nonzero length. Opposite radius signs make corresponding radial lines cross the axis. Zero length collapses the third direction.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(inout) :: this Volume replaced by the annular extrusion.
real(kind=rk), intent(in), contiguous :: center(:) Base center; at least three finite components are required.
real(kind=rk), intent(in) :: radius1 Finite signed scale of the first cylindrical boundary.
real(kind=rk), intent(in) :: radius2 Finite signed scale of the second cylindrical boundary.
real(kind=rk), intent(in) :: length Finite signed extrusion length; use a nonzero value for a nondegenerate volume.
procedure, public :: slice
Extract an exact unsampled surface at one fixed parameter.
-
private pure function slice(this, dir, Xt) result(surface)
Extract the exact isoparametric surface at fixed
Xtin directiondir. Retained parameters keep their original order, knots, degrees and wrapping. Homogeneous control contraction supports interior and unclamped boundary traces without sampling. Polynomial sources produce polynomial surfaces. The source is unchanged; failures belong to the returned surface diagnostic.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: dir Fixed parameter direction, from one through three.
real(kind=rk), intent(in) :: Xt Finite parameter; the source direction's wrapping policy applies.
Return Value type(nurbs_surface)
procedure, public :: split => split_volume
Split into two bounded patches at one interior parameter.
-
private pure subroutine split_volume(this, dir, Xt, left, right)
Split at a strictly interior literal parameter; a failure empties both outputs. The left patch keeps the trace from below and the right patch from above.
Arguments
Type Intent Optional Attributes Name class(nurbs_volume), intent(in) :: this integer, intent(in) :: dir real(kind=rk), intent(in) :: Xt type(nurbs_volume), intent(out) :: left type(nurbs_volume), 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 volume 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 lattice represents the exact affine image of the original NURBS volume. Knots, weights, parameters, and connectivity are unchanged. A singular matrix remains an exact map but generally invalidates the volume as a regular IGA parameterization.Arguments
Type Intent Optional Attributes Name class(nurbs_volume), 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 lattice 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_volume), 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_volume), intent(inout) :: this real(kind=rk), intent(in), contiguous :: vec(:)