Utilities
Utility types and functions for working with Gismo objects.
Knot Span
TinyGismo.centerPoint — Function
centerPoint(knotSpan::KnotSpan)returns the center point of a knot span in parametric coordinates.
TinyGismo.lowerCorner — Function
lowerCorner(knotSpan::KnotSpan)returns the lower corner point of a knot span in parametric coordinates.
TinyGismo.upperCorner — Function
upperCorner(knotSpan::KnotSpan)returns the upper corner point of a knot span in parametric coordinates.
Matrix and Vector Types
Gismo uses its own matrix and vector types for efficient computation and interfacing with C++.
Constructors
TinyGismo.gsMatrix — Type
gsMatrix{T}()
gsMatrix{T}(rows::Int, cols::Int)Construct a Gismo matrix with specified dimensions. If you don't specify a type, type constructions defaults to Float64.
Arguments
rows: Number of rowscols: Number of columns
Type Parameters
T: Element type (typicallyFloat64,Int32, orInt64)
Returns
A gsMatrix object
Details
gsMatrix is a parametric type used throughout Gismo for matrix operations. It's commonly used as output parameters in bang methods (methods ending with !).
Examples
# Create a matrix for output
out = gsMatrix{Float64}()
eval!(geometry, u, out)
# Create an integer matrix for active basis indices
active_out = gsMatrix{Int32}()
active!(basis, u, active_out)TinyGismo.gsVector — Type
gsVector{T}()
gsVector{T}(rows::Int)Construct a Gismo vector with specified length. If you don't specify a type, type constructions defaults to Float64.
Arguments
rows: Number of elements
Type Parameters
T: Element type (typicallyFloat64,Int32, orInt64)
Returns
A gsVector object
Details
gsVector is a parametric type used throughout Gismo for vector operations.
Examples
result = gsVector{Float64}(3)
closestPointTo(geometry, pt, result)Size and Dimension Queries
TinyGismo.size — Function
size(basis::BSplineBasis)
size(basis::KnotVector)
size(obj::Union{gsMatrix, gsVector})Get the number of basis functions, knotVector, matrix or vector.
Arguments
obj: The Object
Returns
The number of basis functions in the basis or entries in the matrix or vector
TinyGismo.rows — Function
rows(obj::Union{gsMatrix, gsVector})Get the number of rows in a matrix or vector.
Arguments
obj: A gsMatrix or gsVector object
Returns
The number of rows
TinyGismo.cols — Function
cols(obj::Union{gsMatrix, gsVector})Get the number of columns in a matrix or vector.
Arguments
obj: A gsMatrix or gsVector object
Returns
The number of columns (1 for vectors)
Conversion Functions
TinyGismo.toMatrix — Function
toMatrix(matrix::gsMatrix)Convert a gsMatrix to a Julia array.
Arguments
matrix: The gsMatrix
Returns
A Julia Matrix with the same dimensions and values
TinyGismo.toVector — Function
toVector(matrix::gsMatrix)Convert a single-column gsMatrix to a Julia vector.
Arguments
matrix: The gsMatrix (must have exactly one column)
Returns
A Julia Vector
Throws
RuntimeError if the matrix has more than one column
TinyGismo.toValue — Function
toValue(matrix::gsMatrix)Extract the single value from a 1×1 gsMatrix.
Arguments
matrix: The gsMatrix (must be 1×1)
Returns
The scalar value
Throws
RuntimeError if the matrix has more than one element
Element Access
TinyGismo.value — Function
value(matrix::gsMatrix, i::Int, j::Int)
value(vector::gsVector, i::Int)Get a matrix or vector element with bounds checking.
Arguments
matrix/vector: The gsMatrix or gsVectori: Row/element index (1-indexed)j: Column index (for matrices only, 1-indexed)
Returns
The value at the specified position
Throws
RuntimeError if indices are out of bounds
TinyGismo._value — Function
_value(matrix::gsMatrix, i::Int, j::Int)Get a matrix element without bounds checking (unsafe).
Arguments
matrix: The gsMatrixi: Row index (1-indexed)j: Column index (1-indexed)
Returns
The value at position (i, j)
Warning
This method does not perform bounds checking. Use value() for safe access.