Utilities

Utility types and functions for working with Gismo objects.

Knot Span

TinyGismo.centerPointFunction
centerPoint(knotSpan::KnotSpan)

returns the center point of a knot span in parametric coordinates.

source
TinyGismo.lowerCornerFunction
lowerCorner(knotSpan::KnotSpan)

returns the lower corner point of a knot span in parametric coordinates.

source
TinyGismo.upperCornerFunction
upperCorner(knotSpan::KnotSpan)

returns the upper corner point of a knot span in parametric coordinates.

source

Matrix and Vector Types

Gismo uses its own matrix and vector types for efficient computation and interfacing with C++.

Constructors

TinyGismo.gsMatrixType
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 rows
  • cols: Number of columns

Type Parameters

  • T: Element type (typically Float64, Int32, or Int64)

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)
source
TinyGismo.gsVectorType
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 (typically Float64, Int32, or Int64)

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)
source

Size and Dimension Queries

TinyGismo.sizeFunction
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

source
TinyGismo.rowsFunction
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

source
TinyGismo.colsFunction
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)

source

Conversion Functions

TinyGismo.toMatrixFunction
toMatrix(matrix::gsMatrix)

Convert a gsMatrix to a Julia array.

Arguments

  • matrix: The gsMatrix

Returns

A Julia Matrix with the same dimensions and values

source
TinyGismo.toVectorFunction
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

source
TinyGismo.toValueFunction
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

source

Element Access

TinyGismo.valueFunction
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 gsVector
  • i: 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

source
TinyGismo._valueFunction
_value(matrix::gsMatrix, i::Int, j::Int)

Get a matrix element without bounds checking (unsafe).

Arguments

  • matrix: The gsMatrix
  • i: 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.

source