Skip to content
ForCADDocumentation

forcad Module

Public ForCAD API facade.

Applications should normally import symbols from this module rather than implementation modules:

use forcad, only : rk, nurbs_curve, nurbs_surface, nurbs_volume

Geometry coordinates are stored as X(i,d), where the first subscript is the flattened control-, sample-, or element-local index and the second is the physical coordinate. Tensor-product indices are flattened with the first parametric direction varying fastest. Public real data use rk.

Mathematical conventions

A rank- geometry maps a parameter vector to physical coordinates by

Here is a tensor-product B-spline basis, is a control point, and is its weight. Equal weights reduce to the polynomial B-spline basis. Curve, surface, and volume ranks are one, two, and three respectively. Degrees are polynomial degrees, not orders; spline order in direction is degree(d)+1.

Knot vectors are nondecreasing and use the complete NURBS representation, including repeated end knots and any knots outside the active interval. Parameter wrapping is an evaluation policy and is distinct from geometric periodicity of the control data.

Operations use the public structured diagnostic object err. An operation called while err%ok is false normally leaves the object unchanged; handle or reset that diagnostic before continuing that workflow. ansatz and ansatz_element also accept a caller-owned err of the same diagnostic type. Use it with private output arrays during parallel assembly to avoid writing shared diagnostics.

modify_Xc and modify_Wc accept scalar edits or complete arrays at fixed spline topology. They invalidate sampled points while retaining parameters; create() refreshes that grid. Invalid updates and sampling requests leave prior data intact. Other setters, fitting, and refinement retain their documented cache rules; rebuild connectivity after spline-space changes. Dense basis queries preserve samples and reuse cached grid or paired rows; cmp_elem computes IGA connectivity independently of visualization. cmp_Xg evaluates one parameter point or a batch without modifying caches; batch results contain one physical-coordinate row per parameter point.

The facade exports:

  • single-patch curve, surface, and volume types;
  • exact extrusion, revolution, and fixed-frame translational sweep, plus homogeneous global loft interpolation;
  • curve, surface, and volume multipatch containers;
  • selected grid, primitive-control-net, transformation, and dense-solve utilities.

Implementation modules expose additional low-level kernels. Applications should prefer this facade unless they intentionally need those contracts.