GridapROMs.Utils

GridapROMs.Utils.ArrayContributionTuple — Type
const ArrayContributionTuple = ContributionTuple{<:ArrayContribution,S} where S

Specifically allows to deal with tuples of Jacobians in unsteady settings. Left unparameterized by element type for the same reason as ArrayContribution: eltype is not defined for it

source
GridapROMs.Utils.Bundle — Type
struct Bundle{A,B}
  linear::A
  nonlinear::B
end

Pair of a linear and a nonlinear quantity (residuals, Jacobians, domains, reduced contributions) of a problem split into its linear and nonlinear parts. Calling a Bundle of functions returns the sum of the two parts

source
GridapROMs.Utils.Contribution — Type
struct Contribution{V,T}
  values::Tuple{Vararg{V}}
  trians::Tuple{Vararg{T}}
end

Collection of values corresponding to a set of triangulations. Similarly to DomainContribution, the values can be accessed by indexing the corresponding triangulation.

source
GridapROMs.Utils.ContributionTuple — Type
struct ContributionTuple{A,T<:Tuple{Vararg{A}}}
  tuple::T
end

Concrete wrapper around a (possibly heterogeneous) tuple of Contributions (e.g. one per time derivative order in unsteady settings, as in ArrayContributionTuple). A is a common supertype of the elements of tuple, allowing e.g. different jacobian terms to have differently-shaped bases.

source
GridapROMs.Utils.CostTracker — Type
mutable struct CostTracker <: PerformanceTracker
  name::String
  time::Float64
  nallocs::Float64
  nruns::Int
end

Records the wall time (in seconds) and the memory allocations (in Mb) of nruns runs of an algorithm

source
GridapROMs.Utils.FEDomains — Type
struct FEDomains{A,B}
  domains_res::A
  domains_jac::B
end

Fields:

  • domains_res: triangulations relative to the residual (nothing by default)
  • domains_jac: triangulations relative to the Jacobian (nothing by default)
source
GridapROMs.Utils.OfflineCostTracker — Type
mutable struct OfflineCostTracker <: PerformanceTracker
  subspace::CostTracker
  jacobian::CostTracker
  residual::CostTracker
end

Costs of the offline phase of a RB method: construction of the reduced subspace, and hyper-reduction of the Jacobian and of the residual

source
GridapROMs.Utils.RBPerformanceTracker — Type
mutable struct RBPerformanceTracker <: PerformanceTracker
  verbose::Bool
  full_order::CostTracker
  reduced_order::CostTracker
  offline::OfflineCostTracker
  error::Any
end

Costs of the full order solver, of the online and offline phases of a RB solver, and error of the RB approximation (see rom_performance). When verbose, costs are printed as soon as they are recorded

source
GridapROMs.Utils.Speedup — Type
struct Speedup <: PerformanceTracker
  name::String
  speedup_time::Float64
  speedup_memory::Float64
end

Speedup in time and memory of one algorithm with respect to another. See compute_speedup

source
GridapROMs.Utils.collect_cell_matrix_for_trian — Method
function collect_cell_matrix_for_trian(
  trial::FESpace,
  test::FESpace,
  a::DomainContribution,
  strian::Triangulation
  ) -> Tuple{Vector{<:Any},Vector{<:Any},Vector{<:Any}}

Computes the cell-wise data needed to assemble a global sparse matrix for a given input triangulation strian

source
GridapROMs.Utils.collect_cell_vector_for_trian — Method
function collect_cell_vector_for_trian(
  test::FESpace,
  a::DomainContribution,
  strian::Triangulation
  ) -> Tuple{Vector{<:Any},Vector{<:Any}}

Computes the cell-wise data needed to assemble a global vector for a given input triangulation strian

source
GridapROMs.Utils.compute_error — Method
compute_error(sol::AbstractArray,sol_approx::AbstractArray,args...) -> Number

Computes the error between sol and sol_approx, by default in the Euclidean norm. A different norm (usually represented by a sparse matrix) can be provided as an argument.

source
GridapROMs.Utils.compute_relative_error — Method
compute_relative_error(sol::AbstractArray,sol_approx::AbstractArray,args...) -> Number

Computes the relative error between sol and sol_approx, by default in the Euclidean norm. A different norm (usually represented by a sparse matrix) can be provided as an argument.

source
GridapROMs.Utils.compute_speedup — Method
compute_speedup(t1::CostTracker,t2::CostTracker) -> Speedup

Computes the speedup the tracker t2 achieves with respect to t1, in time and in memory footprint

source
GridapROMs.Utils.contribution — Method
contribution(f,trians) -> Contribution

Constructor of a Contribution that allows do-block syntax. f is a function such that

values[i] = f(trians[i]) for i...

This constructor first builds the tuple of values, then builds the Contribution object from values and trians

source
GridapROMs.Utils.induced_norm — Method
induced_norm(v::AbstractVector[,X::AbstractMatrix]) -> Number
induced_norm(A::AbstractArray[,X::AbstractMatrix]) -> Number

Norm of v induced by the norm matrix X (Euclidean if not provided). For an array A, the mean of the (squared) norms of its columns

source
GridapROMs.Utils.set_fom_tracker! — Function
set_fom_tracker!(t::PerformanceTracker,stats::NamedTuple;kwargs...)

Overwrites the cost of the full order solver recorded in t with stats, the output of @timed

source
GridapROMs.Utils.set_jacobian_tracker! — Function
set_jacobian_tracker!(t::PerformanceTracker,stats::NamedTuple;kwargs...)

Overwrites the cost of the hyper-reduction of the Jacobian recorded in t with stats, the output of @timed

source
GridapROMs.Utils.set_residual_tracker! — Function
set_residual_tracker!(t::PerformanceTracker,stats::NamedTuple;kwargs...)

Overwrites the cost of the hyper-reduction of the residual recorded in t with stats, the output of @timed

source
GridapROMs.Utils.set_rom_tracker! — Function
set_rom_tracker!(t::PerformanceTracker,stats::NamedTuple;kwargs...)

Overwrites the cost of the online phase of the reduced solver recorded in t with stats, the output of @timed

source
GridapROMs.Utils.set_subspace_tracker! — Function
set_subspace_tracker!(t::PerformanceTracker,stats::NamedTuple;kwargs...)

Overwrites the cost of the construction of the reduced subspace recorded in t with stats, the output of @timed

source
GridapROMs.Utils.unwrap_and_setsize! — Method
unwrap_and_setsize!(a,b[,c]) -> AbstractArray

Resizes the cached array (or block of cached arrays) a to the size of b (or of b ⊗ c), and returns the underlying array

source
GridapROMs.Utils.update_rom_tracker! — Function
update_rom_tracker!(t::PerformanceTracker,stats::NamedTuple;kwargs...)

Adds stats, the output of @timed, to the cost of the online phase of the reduced solver recorded in t

source
GridapROMs.Utils.update_subspace_tracker! — Function
update_subspace_tracker!(t::PerformanceTracker,stats::NamedTuple;kwargs...)

Adds stats, the output of @timed, to the cost of the construction of the reduced subspace recorded in t

source
GridapROMs.Utils.update_tracker! — Method
update_tracker!(t::CostTracker,stats::NamedTuple;msg="")

Adds the time and allocations in stats, the output of @timed, to t. If msg is not empty, it is printed together with t

source