From d7181b09b46e30d3df68e012a98a06761282e298 Mon Sep 17 00:00:00 2001 From: Olivier Cots Date: Mon, 22 Jun 2026 23:52:39 +0200 Subject: [PATCH 1/4] Consume AbstractTag/AbstractCache/make_coerce from CTBase.Core These three generic helpers moved into CTBase.Core. CTFlows.Common no longer defines them: it re-exports them from CTBase.Core so existing `Common.` call sites stay unchanged. Removes the now-duplicated files: - src/Common/abstract_tag.jl (AbstractTag already exists in CTBase.Core) - src/Common/abstract_cache.jl (AbstractCache moved to CTBase.Core) - src/Common/helpers.jl (make_coerce moved to CTBase.Core) Requires CTBase 0.21. Co-Authored-By: Claude Opus 4.8 --- src/Common/Common.jl | 10 +++++----- src/Common/abstract_cache.jl | 26 -------------------------- src/Common/abstract_tag.jl | 36 ------------------------------------ src/Common/helpers.jl | 34 ---------------------------------- 4 files changed, 5 insertions(+), 101 deletions(-) delete mode 100644 src/Common/abstract_cache.jl delete mode 100644 src/Common/abstract_tag.jl delete mode 100644 src/Common/helpers.jl diff --git a/src/Common/Common.jl b/src/Common/Common.jl index b79a4e59..264effde 100644 --- a/src/Common/Common.jl +++ b/src/Common/Common.jl @@ -14,22 +14,22 @@ module Common # External package imports # ============================================================================== -import Base: only import DocStringExtensions: TYPEDEF, TYPEDSIGNATURES import CTBase.Exceptions using ADTypes: ADTypes # ============================================================================== -# Sibling imports (temporary - will be removed after full refactoring) +# Re-exported from CTBase.Core (moved out of CTFlows) # ============================================================================== +# `AbstractTag`, `AbstractCache` and `make_coerce` now live in CTBase.Core. +# They are re-exported here so existing `Common.` call sites are unchanged. +import CTBase.Core: AbstractTag, AbstractCache, make_coerce + # ============================================================================== # Includes # ============================================================================== -include(joinpath(@__DIR__, "helpers.jl")) -include(joinpath(@__DIR__, "abstract_tag.jl")) -include(joinpath(@__DIR__, "abstract_cache.jl")) include(joinpath(@__DIR__, "ode_parameters.jl")) include(joinpath(@__DIR__, "default.jl")) include(joinpath(@__DIR__, "internal_norm.jl")) diff --git a/src/Common/abstract_cache.jl b/src/Common/abstract_cache.jl deleted file mode 100644 index d78c13b7..00000000 --- a/src/Common/abstract_cache.jl +++ /dev/null @@ -1,26 +0,0 @@ -""" -$(TYPEDEF) - -Abstract base type for automatic differentiation caches. - -Caches store pre-allocated buffers and prepared differentiation plans to avoid -repeated allocation during ODE integration. Concrete cache types are extension-specific -(e.g., `_DifferentiationInterfaceCache` from the `CTFlowsDifferentiationInterface` extension). - -# Example -\`\`\`julia-repl -julia> using CTFlows.Common - -julia> isabstracttype(Common.AbstractCache) -true -\`\`\` - -# Notes -- Caches are passed through `ODEParameters` during ODE integration -- The cache field defaults to `nothing` for systems that don't require AD -- Concrete cache types are defined in extensions that provide AD backends -- The RHS closure reads `cache(p)` to access the prepared cache - -See also: [`CTFlows.Common.ODEParameters`](@ref), [`CTFlows.Traits.AbstractADTrait`](@ref). -""" -abstract type AbstractCache end diff --git a/src/Common/abstract_tag.jl b/src/Common/abstract_tag.jl deleted file mode 100644 index 55459776..00000000 --- a/src/Common/abstract_tag.jl +++ /dev/null @@ -1,36 +0,0 @@ -""" -$(TYPEDEF) - -Abstract tag type for dispatch-based extension architecture. - -Tag types are used as dispatch markers to differentiate between implementations -provided by different package extensions. This pattern allows CTFlows to define -type stubs in the main package that are activated and implemented only when the -corresponding extension is loaded, avoiding direct dependencies while maintaining -extensibility. - -# Interface Requirements - -Concrete tag subtypes should: -- Be empty structs with no fields (pure markers) -- Be used as dispatch parameters in builder functions -- Correspond to a specific package extension (e.g., SciML, Plots) - -# Example -\`\`\`julia-repl -julia> using CTFlows.Integrators - -julia> SciMLTag <: Common.AbstractTag -true - -julia> # The tag is used as a dispatch parameter: -julia> # build_sciml_integrator(SciMLTag; mode=:strict) routes to the -julia> # CTFlowsSciMLIntegrator implementation when the extension is loaded -\`\`\` - -# Notes -- Tag types have no runtime cost (empty structs) -- They enable conditional compilation via Julia's extension system -- The pattern avoids hard dependencies on optional packages -""" -abstract type AbstractTag end \ No newline at end of file diff --git a/src/Common/helpers.jl b/src/Common/helpers.jl deleted file mode 100644 index 594eafdc..00000000 --- a/src/Common/helpers.jl +++ /dev/null @@ -1,34 +0,0 @@ -""" - make_coerce(x) -> coerce_fn - -Return a coercion function for the given shape. - -For scalars (`Number`), returns `only` which extracts a single element from a 1-element vector. -For arrays (`AbstractVector`, `AbstractMatrix`), returns `identity` which is a no-op. - -# Arguments -- `x`: A value whose type determines the coercion strategy. - -# Returns -- `Function`: A coercion function with signature `(y) -> coerced_y`. - -# Example -```julia-repl -julia> using CTFlows.Common - -julia> coerce_scalar = make_coerce(1.0) -julia> coerce_scalar([5.0]) -5.0 - -julia> coerce_vector = make_coerce([1.0, 2.0]) -julia> coerce_vector([3.0, 4.0]) -2-element Vector{Float64}: - 3.0 - 4.0 -``` - -See also: [`CTFlows.Systems.build_rhs`](@ref), [`CTFlows.Systems.build_oop_rhs`](@ref). -""" -make_coerce(::Number) = only -make_coerce(::AbstractVector) = identity -make_coerce(::AbstractMatrix) = identity \ No newline at end of file From 4ab6317066021a8e5e802fc143f6c711601b6c0c Mon Sep 17 00:00:00 2001 From: Olivier Cots Date: Mon, 22 Jun 2026 23:53:33 +0200 Subject: [PATCH 2/4] Migrate Strategies/Options/Orchestration from CTSolvers to CTBase The generic Strategies / Options / Orchestration modules moved from CTSolvers into CTBase (clean break, no re-export shims). Rewire all CTFlows references accordingly: - `CTSolvers.Strategies/Options/Orchestration.*` -> `CTBase.*` across Differentiation, Flows, Integrators, MultiPhase and the SciMLIntegrator ext. - `CTSolvers.value` / `CTSolvers.is_user` -> `CTBase.Options.value` / `.is_user`. - Bind CTBase in modules that use the `CTBase.Strategies.*` prefix (`using CTSolvers: CTSolvers` -> `using CTBase: CTBase`). Project.toml: - Bump compat: CTBase 0.20 -> 0.21, CTModels 0.11 -> 0.12. - Drop now-unused deps CTSolvers and CommonSolve (flagged stale by Aqua). Co-Authored-By: Claude Opus 4.8 --- Project.toml | 8 ++----- .../CTFlowsSciMLIntegrator.jl | 6 ++--- src/Differentiation/Differentiation.jl | 4 ++-- src/Differentiation/abstract_ad_backend.jl | 6 ++--- .../differentiation_interface.jl | 18 +++++++-------- src/Flows/Flows.jl | 4 +++- src/Flows/abstract_flow.jl | 6 ++--- src/Flows/building.jl | 4 ++-- src/Flows/flow_routing.jl | 22 +++++++++---------- src/Flows/registry.jl | 12 +++++----- src/Integrators/Integrators.jl | 4 ++-- src/Integrators/abstract_integrator.jl | 4 ++-- src/Integrators/sciml.jl | 20 ++++++++--------- src/MultiPhase/MultiPhase.jl | 4 ++-- 14 files changed, 60 insertions(+), 62 deletions(-) diff --git a/Project.toml b/Project.toml index 4b1ed02c..ba09a34c 100644 --- a/Project.toml +++ b/Project.toml @@ -7,8 +7,6 @@ authors = ["Olivier Cots "] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" CTBase = "54762871-cc72-4466-b8e8-f6c8b58076cd" CTModels = "34c4fa32-2049-4079-8329-de33c2a22e2d" -CTSolvers = "d3e8d392-8e4b-4d9b-8e92-d7d4e3650ef6" -CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" @@ -35,10 +33,8 @@ CTFlowsStaticArrays = ["StaticArrays"] [compat] ADTypes = "1" Aqua = "0.8" -CTBase = "0.20" -CTModels = "0.11" -CTSolvers = "0.4" -CommonSolve = "0.2" +CTBase = "0.21" +CTModels = "0.12" DiffEqBase = "6, 7" DifferentiationInterface = "0.7" DocStringExtensions = "0.9" diff --git a/ext/CTFlowsSciMLIntegrator/CTFlowsSciMLIntegrator.jl b/ext/CTFlowsSciMLIntegrator/CTFlowsSciMLIntegrator.jl index ca00efbe..1090b440 100644 --- a/ext/CTFlowsSciMLIntegrator/CTFlowsSciMLIntegrator.jl +++ b/ext/CTFlowsSciMLIntegrator/CTFlowsSciMLIntegrator.jl @@ -13,7 +13,7 @@ This extension provides: - `Integrators.build_problem` — converts CTFlows systems to `ODEProblem` - `Integrators.solve_problem` — solves an `ODEProblem` and returns a `SciMLIntegrationResult` -This is the backend layer intended to eventually migrate to CTSolvers. +This is the backend layer intended to eventually migrate to CTBase.Strategies. The user-facing `Flow(::AbstractODEFunction)` and `Flow(::AbstractODEProblem)` constructors live in the `CTFlowsSciMLFlows` extension. """ @@ -21,8 +21,8 @@ module CTFlowsSciMLIntegrator import DocStringExtensions: TYPEDEF, TYPEDSIGNATURES import CTBase.Exceptions -import CTSolvers.Strategies -import CTSolvers.Options +import CTBase.Strategies +import CTBase.Options using CTFlows: CTFlows using CTFlows.Common: Common diff --git a/src/Differentiation/Differentiation.jl b/src/Differentiation/Differentiation.jl index bc849794..a73dbcb9 100644 --- a/src/Differentiation/Differentiation.jl +++ b/src/Differentiation/Differentiation.jl @@ -22,7 +22,7 @@ The concrete strategy `DifferentiationInterface` wraps DifferentiationInterface. ## Dependencies - `ADTypes.jl` (hard dependency) — provides `AutoForwardDiff` type -- `CTSolvers.Strategies` (from CTSolvers) — strategy contract +- `CTBase.Strategies` — strategy contract - `CTBase.Exceptions` — `NotImplemented` for stub methods - `Common` (sibling) — `AbstractCache` type @@ -52,7 +52,7 @@ module Differentiation import DocStringExtensions: TYPEDEF, TYPEDSIGNATURES import CTBase.Exceptions -using CTSolvers: CTSolvers +import CTBase.Strategies using ADTypes: ADTypes # Hard dep — provides AutoForwardDiff # ============================================================================== diff --git a/src/Differentiation/abstract_ad_backend.jl b/src/Differentiation/abstract_ad_backend.jl index 46995454..5dbac370 100644 --- a/src/Differentiation/abstract_ad_backend.jl +++ b/src/Differentiation/abstract_ad_backend.jl @@ -12,8 +12,8 @@ scalar Hamiltonian function. Concrete backends (e.g., `DifferentiationInterface` implement the contract methods to provide actual gradient computation. # Notes - - `AbstractADBackend` subtypes `CTSolvers.Strategies.AbstractStrategy` — they are - first-class strategies in the CTSolvers ecosystem. + - `AbstractADBackend` subtypes `CTBase.Strategies.AbstractStrategy` — they are + first-class strategies in the CTBase.Strategies ecosystem. - The contract consists of two methods: `hamiltonian_gradient` and `variable_gradient`. - Gradient methods return **non-negated** partial derivatives; the RHS closures apply the signs (ṗ = -∂H/∂x, ṽ = -∂H/∂v). @@ -22,7 +22,7 @@ See also: [`CTFlows.Differentiation.DifferentiationInterface`](@ref), [`CTFlows.Differentiation.hamiltonian_gradient`](@ref), [`CTFlows.Differentiation.variable_gradient`](@ref). """ -abstract type AbstractADBackend <: CTSolvers.Strategies.AbstractStrategy end +abstract type AbstractADBackend <: CTBase.Strategies.AbstractStrategy end # ============================================================================== # Contract Methods diff --git a/src/Differentiation/differentiation_interface.jl b/src/Differentiation/differentiation_interface.jl index b95ffb47..31142a87 100644 --- a/src/Differentiation/differentiation_interface.jl +++ b/src/Differentiation/differentiation_interface.jl @@ -26,7 +26,7 @@ See also: [`CTFlows.Differentiation.AbstractADBackend`](@ref), [`CTFlows.Differentiation.variable_gradient`](@ref), [`CTFlows.Differentiation.prepare_cache`](@ref). """ -struct DifferentiationInterface{O<:CTSolvers.Strategies.StrategyOptions} <: +struct DifferentiationInterface{O<:CTBase.Strategies.StrategyOptions} <: AbstractADBackend options::O end @@ -44,12 +44,12 @@ Constructor for `DifferentiationInterface` with a specific backend. - `DifferentiationInterface`: A new backend strategy instance. """ function DifferentiationInterface(; mode::Symbol=:strict, kwargs...) - opts = CTSolvers.Strategies.build_strategy_options(DifferentiationInterface; mode=mode, kwargs...) + opts = CTBase.Strategies.build_strategy_options(DifferentiationInterface; mode=mode, kwargs...) return DifferentiationInterface{typeof(opts)}(opts) end # ============================================================================== -# CTSolvers.Strategies Contract +# CTBase.Strategies Contract # ============================================================================== """ @@ -57,14 +57,14 @@ $(TYPEDSIGNATURES) Return the strategy identifier for `DifferentiationInterface`. """ -CTSolvers.Strategies.id(::Type{<:DifferentiationInterface}) = :di +CTBase.Strategies.id(::Type{<:DifferentiationInterface}) = :di """ $(TYPEDSIGNATURES) Return a human-readable description of the `DifferentiationInterface` strategy. """ -CTSolvers.Strategies.description(::Type{<:DifferentiationInterface}) = +CTBase.Strategies.description(::Type{<:DifferentiationInterface}) = "AD backend wrapping DifferentiationInterface.jl backends (e.g., AutoForwardDiff)." """ @@ -72,9 +72,9 @@ $(TYPEDSIGNATURES) Return metadata defining `DifferentiationInterface` options and their specifications. """ -function CTSolvers.Strategies.metadata(::Type{<:DifferentiationInterface}) - return CTSolvers.Strategies.StrategyMetadata( - CTSolvers.Strategies.OptionDefinition(; +function CTBase.Strategies.metadata(::Type{<:DifferentiationInterface}) + return CTBase.Strategies.StrategyMetadata( + CTBase.Strategies.OptionDefinition(; name = :ad_backend, type = ADTypes.AbstractADType, default = Common.__ad_backend(), @@ -103,6 +103,6 @@ See also: [`CTFlows.Differentiation.ad_backend`](@ref), [`CTFlows.Systems.hamiltonian_vector_field`](@ref). """ ad_backend(backend::DifferentiationInterface) = - Base.get(CTSolvers.Strategies.options(backend), Val(:ad_backend)) + Base.get(CTBase.Strategies.options(backend), Val(:ad_backend)) diff --git a/src/Flows/Flows.jl b/src/Flows/Flows.jl index c7685e02..6fe80013 100644 --- a/src/Flows/Flows.jl +++ b/src/Flows/Flows.jl @@ -14,7 +14,9 @@ module Flows # 1. External-package imports (qualified, pollution-free) import DocStringExtensions: TYPEDEF, TYPEDSIGNATURES import CTBase.Exceptions -using CTSolvers: CTSolvers +import CTBase.Strategies +import CTBase.Options +import CTBase.Orchestration import CTModels # ============================================================================== diff --git a/src/Flows/abstract_flow.jl b/src/Flows/abstract_flow.jl index 1d433943..d4f26246 100644 --- a/src/Flows/abstract_flow.jl +++ b/src/Flows/abstract_flow.jl @@ -377,10 +377,10 @@ Silently does nothing when no user options are set. \`\`\` """ function _print_user_options(io::IO, integ::Integrators.AbstractIntegrator) - opts = CTSolvers.Strategies.options(integ) + opts = CTBase.Strategies.options(integ) user_opts = sort!( - [(k, CTSolvers.value(v)) for (k, v) in pairs(opts.options) - if CTSolvers.is_user(opts, k)]; + [(k, CTBase.Options.value(v)) for (k, v) in pairs(opts.options) + if CTBase.Options.is_user(opts, k)]; by = x -> string(x[1]), ) isempty(user_opts) && return diff --git a/src/Flows/building.jl b/src/Flows/building.jl index 615f554e..869872d1 100644 --- a/src/Flows/building.jl +++ b/src/Flows/building.jl @@ -6,7 +6,7 @@ High-level constructor for `Flow` from vector field data. This constructor builds a complete flow by: 1. Building a `VectorFieldSystem` from the vector field data 2. Building a `SciML` integrator with the given options -3. Routing options through the integrator's CTSolvers strategy +3. Routing options through the integrator's CTBase.Strategies strategy 4. Combining them into a callable `Flow` # Arguments @@ -40,7 +40,7 @@ High-level constructor for `HamiltonianFlow` from Hamiltonian vector field data. This constructor builds a complete Hamiltonian flow by: 1. Building a `HamiltonianVectorFieldSystem` from the Hamiltonian vector field data 2. Building a `SciML` integrator with the given options -3. Routing options through the integrator's CTSolvers strategy +3. Routing options through the integrator's CTBase.Strategies strategy 4. Combining them into a callable `HamiltonianFlow` # Arguments diff --git a/src/Flows/flow_routing.jl b/src/Flows/flow_routing.jl index f6b326fc..679eb8d4 100644 --- a/src/Flows/flow_routing.jl +++ b/src/Flows/flow_routing.jl @@ -4,7 +4,7 @@ $(TYPEDSIGNATURES) Return the strategy families used for option routing in flow construction. The returned `NamedTuple` maps family names to their abstract types, as expected -by [`CTSolvers.Orchestration.route_all_options`](@extref). +by [`CTBase.Orchestration.route_all_options`](@extref). # Returns - `NamedTuple`: `(backend, integrator)` mapped to their abstract types @@ -39,7 +39,7 @@ This constant identifies the strategy families used in flow construction: # Notes - Used by [`CTFlows.Flows._route_flow_options`](@ref) and [`CTFlows.Flows._build_flow_components`](@ref). -- Passed to [`CTSolvers.Orchestration.route_all_options`](@extref) and [`CTSolvers.Orchestration.resolve_method`](@extref). +- Passed to [`CTBase.Orchestration.route_all_options`](@extref) and [`CTBase.Orchestration.resolve_method`](@extref). See also: [`CTFlows.Flows._route_flow_options`](@ref), [`CTFlows.Flows._build_flow_components`](@ref), [`CTFlows.Flows._flow_families`](@ref). """ @@ -50,7 +50,7 @@ $(TYPEDSIGNATURES) Route all keyword options to the appropriate strategy families for flow construction. -This function wraps [`CTSolvers.Orchestration.route_all_options`](@extref) with the +This function wraps [`CTBase.Orchestration.route_all_options`](@extref) with the families specific to CTFlows flow construction. Options are routed to either the backend family (`:di`) or the integrator family (`:sciml`). @@ -80,13 +80,13 @@ routed = Flows._route_flow_options((; reltol=1e-8, ad_backend=ADTypes.AutoForwar - No action-level options are defined for flows (empty `OptionDefinition` array). See also: [`_flow_families`](@ref), [`_build_flow_components`](@ref), -[`CTSolvers.Orchestration.route_all_options`](@extref) +[`CTBase.Orchestration.route_all_options`](@extref) """ function _route_flow_options(kwargs) - return CTSolvers.Orchestration.route_all_options( + return CTBase.Orchestration.route_all_options( _FLOW_DESCRIPTION, _flow_families(), - CTSolvers.Options.OptionDefinition[], + CTBase.Options.OptionDefinition[], (; kwargs...), flow_registry(); source_mode = :description, @@ -99,7 +99,7 @@ $(TYPEDSIGNATURES) Build concrete strategy instances from routed options. Each strategy is constructed via -[`CTSolvers.Orchestration.build_strategy_from_resolved`](@extref) using the options +[`CTBase.Orchestration.build_strategy_from_resolved`](@extref) using the options that were routed to its family by [`_route_flow_options`](@ref). # Arguments @@ -118,18 +118,18 @@ components = Flows._build_flow_components(routed) ``` See also: [`_route_flow_options`](@ref), [`flow_registry`](@ref), -[`CTSolvers.Orchestration.build_strategy_from_resolved`](@extref) +[`CTBase.Orchestration.build_strategy_from_resolved`](@extref) """ function _build_flow_components(routed) families = _flow_families() - resolved = CTSolvers.Orchestration.resolve_method( + resolved = CTBase.Orchestration.resolve_method( _FLOW_DESCRIPTION, families, flow_registry() ) - backend = CTSolvers.Orchestration.build_strategy_from_resolved( + backend = CTBase.Orchestration.build_strategy_from_resolved( resolved, :backend, families, flow_registry(); routed.strategies.backend... ) - integrator = CTSolvers.Orchestration.build_strategy_from_resolved( + integrator = CTBase.Orchestration.build_strategy_from_resolved( resolved, :integrator, families, flow_registry(); routed.strategies.integrator... ) diff --git a/src/Flows/registry.jl b/src/Flows/registry.jl index a8d21016..9f5f91b2 100644 --- a/src/Flows/registry.jl +++ b/src/Flows/registry.jl @@ -9,16 +9,16 @@ types to their concrete implementations for flow construction: - `Integrators.AbstractIntegrator` → `Integrators.SciML` # Type -- `CTSolvers.Strategies.StrategyRegistry`: Registry mapping abstract types to concrete implementations. +- `CTBase.Strategies.StrategyRegistry`: Registry mapping abstract types to concrete implementations. # Notes -- Created at module load time via [`CTSolvers.Strategies.create_registry`](@extref). +- Created at module load time via [`CTBase.Strategies.create_registry`](@extref). - Used by [`CTFlows.Flows.flow_registry`](@ref) to provide the registry to routing functions. - The registry is cached for performance. -See also: [`CTFlows.Flows.flow_registry`](@ref), [`CTFlows.Flows._route_flow_options`](@ref), [`CTSolvers.Strategies.create_registry`](@extref). +See also: [`CTFlows.Flows.flow_registry`](@ref), [`CTFlows.Flows._route_flow_options`](@ref), [`CTBase.Strategies.create_registry`](@extref). """ -const _FLOW_REGISTRY = CTSolvers.Strategies.create_registry( +const _FLOW_REGISTRY = CTBase.Strategies.create_registry( Differentiation.AbstractADBackend => (Differentiation.DifferentiationInterface,), Integrators.AbstractIntegrator => (Integrators.SciML,), ) @@ -32,7 +32,7 @@ The registry maps abstract strategy families to their concrete implementations for automatic differentiation backends and ODE integrators. # Returns -- `CTSolvers.Strategies.StrategyRegistry`: Registry with `:di` (DifferentiationInterface) +- `CTBase.Strategies.StrategyRegistry`: Registry with `:di` (DifferentiationInterface) and `:sciml` (SciML) strategies registered. # Notes @@ -41,7 +41,7 @@ for automatic differentiation backends and ODE integrators. - The registry is precomputed and cached in `_FLOW_REGISTRY` for performance. See also: [`_route_flow_options`](@ref), [`_build_flow_components`](@ref), -[`CTSolvers.Strategies.create_registry`](@extref) +[`CTBase.Strategies.create_registry`](@extref) """ function flow_registry() return _FLOW_REGISTRY diff --git a/src/Integrators/Integrators.jl b/src/Integrators/Integrators.jl index eaa8dce0..629ed166 100644 --- a/src/Integrators/Integrators.jl +++ b/src/Integrators/Integrators.jl @@ -4,7 +4,7 @@ ODE integrator strategy types for CTFlows. This module defines the `AbstractIntegrator` type which inherits from -`CTSolvers.Strategies.AbstractStrategy`. +`CTBase.Strategies.AbstractStrategy`. """ module Integrators @@ -22,7 +22,7 @@ import CTBase.Exceptions import ..Common: Common import ..Configs: Configs import ..Systems: Systems -using CTSolvers: CTSolvers +using CTBase: CTBase # ============================================================================== # Include files diff --git a/src/Integrators/abstract_integrator.jl b/src/Integrators/abstract_integrator.jl index 77bc52df..fe275e0b 100644 --- a/src/Integrators/abstract_integrator.jl +++ b/src/Integrators/abstract_integrator.jl @@ -5,7 +5,7 @@ Abstract strategy for solving ODE Cauchy problems. An `AbstractIntegrator` is a strategy that solves an ODE problem over a time span. -This type inherits the CTSolvers strategy contract: +This type inherits the CTBase.Strategies strategy contract: # Type-Level Contract (Static Metadata) @@ -35,7 +35,7 @@ Additionally, for multi-phase trajectory support, subtypes should implement: See also: [`CTFlows.Flows.AbstractFlow`](@ref). """ -abstract type AbstractIntegrator <: CTSolvers.Strategies.AbstractStrategy end +abstract type AbstractIntegrator <: CTBase.Strategies.AbstractStrategy end """ $(TYPEDSIGNATURES) diff --git a/src/Integrators/sciml.jl b/src/Integrators/sciml.jl index e61c7bd4..4b2d27a8 100644 --- a/src/Integrators/sciml.jl +++ b/src/Integrators/sciml.jl @@ -25,9 +25,9 @@ Concrete subtypes should store strategy options and implement the required contr # Interface Requirements Subtypes must implement: -- `CTSolvers.Strategies.id(::Type{<:SubType})`: Return unique identifier -- `CTSolvers.Strategies.description(::Type{<:SubType})`: Return description -- `CTSolvers.Strategies.metadata(::Type{<:SubType})`: Return option metadata +- `CTBase.Strategies.id(::Type{<:SubType})`: Return unique identifier +- `CTBase.Strategies.description(::Type{<:SubType})`: Return description +- `CTBase.Strategies.metadata(::Type{<:SubType})`: Return option metadata # Example ```julia-repl @@ -47,7 +47,7 @@ $(TYPEDEF) Generic SciML ODE integrator strategy. Wraps any SciML algorithm (e.g. `Tsit5`, `Rodas4`) through a unified -`CTSolvers`-backed option system. The full implementation (metadata, builder +`CTBase.Strategies`-backed option system. The full implementation (metadata, builder and callable) is provided by the `CTFlowsSciMLIntegrator` package extension; this file declares the type and **stubs** that throw `ExtensionError` until the extension is loaded. @@ -58,11 +58,11 @@ To activate the extension, load any of: - `using DifferentialEquations` # Fields -- `options::CTSolvers.Strategies.StrategyOptions`: Validated option bundle. +- `options::CTBase.Strategies.StrategyOptions`: Validated option bundle. - `options_point::Dict{Symbol, Any}`: Pre-computed options for StateEndPointConfig. - `options_trajectory::Dict{Symbol, Any}`: Pre-computed options for StateTrajectoryConfig. """ -struct SciML{O<:CTSolvers.Strategies.StrategyOptions, OP<:Dict{Symbol, Any}, OT<:Dict{Symbol, Any}} <: AbstractSciMLIntegrator +struct SciML{O<:CTBase.Strategies.StrategyOptions, OP<:Dict{Symbol, Any}, OT<:Dict{Symbol, Any}} <: AbstractSciMLIntegrator options::O options_point::OP options_trajectory::OT @@ -77,14 +77,14 @@ $(TYPEDSIGNATURES) Return the unique identifier for SciML integrator. """ -CTSolvers.Strategies.id(::Type{<:SciML}) = :sciml +CTBase.Strategies.id(::Type{<:SciML}) = :sciml """ $(TYPEDSIGNATURES) Return the description for the SciML integrator. """ -function CTSolvers.Strategies.description(::Type{<:SciML}) +function CTBase.Strategies.description(::Type{<:SciML}) "SciML ODE integrator.\n" * "See: https://docs.sciml.ai/DiffEqDocs\n" * "Solver options: https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/" @@ -139,9 +139,9 @@ Real metadata implementation provided by the extension. # Throws - `CTBase.Exceptions.ExtensionError`: Always thrown by this stub implementation -See also: `SciML`, `CTSolvers.Strategies.StrategyMetadata`. +See also: `SciML`, `CTBase.Strategies.StrategyMetadata`. """ -function CTSolvers.Strategies.metadata(::Type{<:AbstractSciMLIntegrator}) +function CTBase.Strategies.metadata(::Type{<:AbstractSciMLIntegrator}) # Extension is missing throw( Exceptions.ExtensionError( diff --git a/src/MultiPhase/MultiPhase.jl b/src/MultiPhase/MultiPhase.jl index 6337a257..56a732e5 100644 --- a/src/MultiPhase/MultiPhase.jl +++ b/src/MultiPhase/MultiPhase.jl @@ -11,8 +11,8 @@ module MultiPhase # 1. External-package imports (qualified, pollution-free) import DocStringExtensions: TYPEDEF, TYPEDSIGNATURES import CTBase.Exceptions -import CTSolvers.Strategies -import CTSolvers.Options +import CTBase.Strategies +import CTBase.Options # ============================================================================== # Internal sibling-submodule imports From 6a29677289b335f27e38e59f89e18d4c71599d8b Mon Sep 17 00:00:00 2001 From: Olivier Cots Date: Mon, 22 Jun 2026 23:53:46 +0200 Subject: [PATCH 3/4] test: load ForwardDiff explicitly; rewire CTSolvers -> CTBase - Rewire test references to the moved modules: `CTSolvers.Strategies/Options` -> `CTBase.Strategies/Options`, and `import CTSolvers` -> `import CTBase`. - Add `import ForwardDiff` to the DI-dependent suites (differential_geometry, differentiation, the DifferentiationInterface extension test). With DifferentiationInterface 0.7, the AutoForwardDiff backend requires ForwardDiff to be loaded; these suites run before extensions/ (which used to load it), so they now load it themselves instead of relying on test order. Co-Authored-By: Claude Opus 4.8 --- .../suite/differential_geometry/test_ad_dg.jl | 1 + .../differential_geometry/test_macro_dg.jl | 1 + .../test_macro_helpers_dg.jl | 1 + .../differential_geometry/test_poisson_dg.jl | 1 + .../test_time_derivative_dg.jl | 1 + test/suite/differentiation/test_ad_backend.jl | 20 +++++++++---------- .../differentiation/test_arg_placement.jl | 7 ++++--- ...est_differentiation_interface_extension.jl | 1 + .../extensions/test_forwarddiff_extension.jl | 2 +- test/suite/extensions/test_sciml_extension.jl | 4 ++-- .../test_scimlbase_function_system.jl | 2 +- test/suite/flows/test_abstract_flow.jl | 8 ++++---- test/suite/flows/test_flow.jl | 8 ++++---- test/suite/flows/test_flow_routing.jl | 10 +++++----- .../integrators/test_abstract_integrator.jl | 12 +++++------ test/suite/integrators/test_sciml.jl | 12 +++++------ .../multiphase/test_calling_multiphase.jl | 4 ++-- test/suite/multiphase/test_concatenation.jl | 4 ++-- .../test_concatenation_heterogeneous.jl | 4 ++-- test/suite/multiphase/test_multiphase_flow.jl | 4 ++-- 20 files changed, 57 insertions(+), 50 deletions(-) diff --git a/test/suite/differential_geometry/test_ad_dg.jl b/test/suite/differential_geometry/test_ad_dg.jl index 285a198d..446d2743 100644 --- a/test/suite/differential_geometry/test_ad_dg.jl +++ b/test/suite/differential_geometry/test_ad_dg.jl @@ -1,6 +1,7 @@ module TestAdDG import Test +import ForwardDiff # ensure DI ForwardDiff extension is loaded (AutoForwardDiff backend) import CTBase.Exceptions import DifferentiationInterface import ADTypes diff --git a/test/suite/differential_geometry/test_macro_dg.jl b/test/suite/differential_geometry/test_macro_dg.jl index 6050a8f3..d1a2b2bf 100644 --- a/test/suite/differential_geometry/test_macro_dg.jl +++ b/test/suite/differential_geometry/test_macro_dg.jl @@ -1,6 +1,7 @@ module TestMacroDG import Test +import ForwardDiff # ensure DI ForwardDiff extension is loaded (AutoForwardDiff backend) import CTBase: CTBase # for Exceptions prefix in @Lie macro import CTBase.Exceptions import CTFlows: CTFlows diff --git a/test/suite/differential_geometry/test_macro_helpers_dg.jl b/test/suite/differential_geometry/test_macro_helpers_dg.jl index 784d3578..35566adb 100644 --- a/test/suite/differential_geometry/test_macro_helpers_dg.jl +++ b/test/suite/differential_geometry/test_macro_helpers_dg.jl @@ -1,6 +1,7 @@ module TestMacroHelpersDG import Test +import ForwardDiff # ensure DI ForwardDiff extension is loaded (AutoForwardDiff backend) import CTBase: CTBase # for Exceptions prefix in @Lie macro import CTBase.Exceptions import CTFlows: CTFlows diff --git a/test/suite/differential_geometry/test_poisson_dg.jl b/test/suite/differential_geometry/test_poisson_dg.jl index 11bd5190..9fc7a8e2 100644 --- a/test/suite/differential_geometry/test_poisson_dg.jl +++ b/test/suite/differential_geometry/test_poisson_dg.jl @@ -1,6 +1,7 @@ module TestPoissonDG import Test +import ForwardDiff # ensure DI ForwardDiff extension is loaded (AutoForwardDiff backend) import CTBase.Exceptions import DifferentiationInterface import ADTypes: ADTypes diff --git a/test/suite/differential_geometry/test_time_derivative_dg.jl b/test/suite/differential_geometry/test_time_derivative_dg.jl index 96f10c12..2b8e6e1d 100644 --- a/test/suite/differential_geometry/test_time_derivative_dg.jl +++ b/test/suite/differential_geometry/test_time_derivative_dg.jl @@ -1,6 +1,7 @@ module TestTimeDerivativeDG import Test +import ForwardDiff # ensure DI ForwardDiff extension is loaded (AutoForwardDiff backend) import CTBase.Exceptions import DifferentiationInterface import ADTypes: ADTypes diff --git a/test/suite/differentiation/test_ad_backend.jl b/test/suite/differentiation/test_ad_backend.jl index 64340218..668c88b6 100644 --- a/test/suite/differentiation/test_ad_backend.jl +++ b/test/suite/differentiation/test_ad_backend.jl @@ -9,7 +9,7 @@ import CTFlows.Differentiation import CTFlows.Data import CTFlows.Traits import CTBase.Exceptions -import CTSolvers +import CTBase import ADTypes const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true @@ -20,10 +20,10 @@ const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : # ============================================================================== struct FakeADBackend <: Differentiation.AbstractADBackend - options::CTSolvers.Strategies.StrategyOptions + options::CTBase.Strategies.StrategyOptions end -FakeADBackend() = FakeADBackend(CTSolvers.Strategies.StrategyOptions()) +FakeADBackend() = FakeADBackend(CTBase.Strategies.StrategyOptions()) # ============================================================================== # Fake Hamiltonian for Testing (at module top-level) @@ -45,7 +45,7 @@ function test_ad_backend() Test.@testset "Unit: AbstractADBackend abstract type" begin backend = FakeADBackend() Test.@test backend isa Differentiation.AbstractADBackend - Test.@test backend isa CTSolvers.Strategies.AbstractStrategy + Test.@test backend isa CTBase.Strategies.AbstractStrategy end Test.@testset "Unit: DifferentiationInterface construction" begin @@ -55,7 +55,7 @@ function test_ad_backend() Test.@test di isa Differentiation.AbstractADBackend # Default backend is AutoForwardDiff - metadata = CTSolvers.Strategies.metadata(Differentiation.DifferentiationInterface) + metadata = CTBase.Strategies.metadata(Differentiation.DifferentiationInterface) Test.@test metadata[:ad_backend].default === ADTypes.AutoForwardDiff() # Custom backend @@ -63,19 +63,19 @@ function test_ad_backend() Test.@test di_custom isa Differentiation.DifferentiationInterface end - Test.@testset "Unit: CTSolvers.Strategies contract" begin + Test.@testset "Unit: CTBase.Strategies contract" begin # id - Test.@test CTSolvers.Strategies.id(Differentiation.DifferentiationInterface) === + Test.@test CTBase.Strategies.id(Differentiation.DifferentiationInterface) === :di # description - desc = CTSolvers.Strategies.description(Differentiation.DifferentiationInterface) + desc = CTBase.Strategies.description(Differentiation.DifferentiationInterface) Test.@test desc isa String Test.@test !isempty(desc) # metadata - metadata = CTSolvers.Strategies.metadata(Differentiation.DifferentiationInterface) - Test.@test metadata isa CTSolvers.Strategies.StrategyMetadata + metadata = CTBase.Strategies.metadata(Differentiation.DifferentiationInterface) + Test.@test metadata isa CTBase.Strategies.StrategyMetadata Test.@test length(metadata) > 0 Test.@test :ad_backend in keys(metadata) end diff --git a/test/suite/differentiation/test_arg_placement.jl b/test/suite/differentiation/test_arg_placement.jl index 6cca2d0f..579a4335 100644 --- a/test/suite/differentiation/test_arg_placement.jl +++ b/test/suite/differentiation/test_arg_placement.jl @@ -5,12 +5,13 @@ Tests for Differentiation.differentiate and Differentiation.pushforward. module TestArgPlacement import Test +import ForwardDiff # ensure DI ForwardDiff extension is loaded (AutoForwardDiff backend) import DifferentiationInterface # activates CTFlowsDifferentiationInterface extension import CTFlows import CTFlows.Differentiation import CTFlows.Common import CTBase.Exceptions -import CTSolvers +import CTBase const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -20,9 +21,9 @@ const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : # ============================================================================== struct FakeBackendAP <: Differentiation.AbstractADBackend - options::CTSolvers.Strategies.StrategyOptions + options::CTBase.Strategies.StrategyOptions end -FakeBackendAP() = FakeBackendAP(CTSolvers.Strategies.StrategyOptions()) +FakeBackendAP() = FakeBackendAP(CTBase.Strategies.StrategyOptions()) # ============================================================================== # Helper — default backend (AutoForwardDiff via DI) diff --git a/test/suite/extensions/test_differentiation_interface_extension.jl b/test/suite/extensions/test_differentiation_interface_extension.jl index 2594a1c3..589883ae 100644 --- a/test/suite/extensions/test_differentiation_interface_extension.jl +++ b/test/suite/extensions/test_differentiation_interface_extension.jl @@ -5,6 +5,7 @@ Unit and integration tests for the CTFlowsDifferentiationInterface extension. module TestDifferentiationInterfaceExtension import Test +import ForwardDiff # ensure DI ForwardDiff extension is loaded (AutoForwardDiff backend) import CTFlows: CTFlows import CTFlows.Data: Data import CTFlows.Differentiation: Differentiation diff --git a/test/suite/extensions/test_forwarddiff_extension.jl b/test/suite/extensions/test_forwarddiff_extension.jl index 8ceb1086..9f5f38d1 100644 --- a/test/suite/extensions/test_forwarddiff_extension.jl +++ b/test/suite/extensions/test_forwarddiff_extension.jl @@ -8,7 +8,7 @@ import CTFlows.Systems: Systems import CTFlows.Integrators: Integrators import CTFlows.Trajectories: Trajectories import CTFlows.Flows: Flows -import CTSolvers.Strategies: Strategies +import CTBase.Strategies: Strategies using SciMLBase: SciMLBase, ODEProblem using OrdinaryDiffEqTsit5: OrdinaryDiffEqTsit5, Tsit5 diff --git a/test/suite/extensions/test_sciml_extension.jl b/test/suite/extensions/test_sciml_extension.jl index c65f74df..69720ccd 100644 --- a/test/suite/extensions/test_sciml_extension.jl +++ b/test/suite/extensions/test_sciml_extension.jl @@ -9,8 +9,8 @@ import CTFlows.Data: Data import CTFlows.Systems: Systems import CTFlows.Integrators: Integrators import CTFlows.Trajectories: Trajectories -import CTSolvers.Strategies: Strategies -import CTSolvers.Options: Options +import CTBase.Strategies: Strategies +import CTBase.Options: Options # Fake tag type for testing stub behavior struct FakeTag <: Common.AbstractTag end diff --git a/test/suite/extensions/test_scimlbase_function_system.jl b/test/suite/extensions/test_scimlbase_function_system.jl index f983b1d5..2d9b7e6e 100644 --- a/test/suite/extensions/test_scimlbase_function_system.jl +++ b/test/suite/extensions/test_scimlbase_function_system.jl @@ -9,7 +9,7 @@ import CTFlows.Systems: Systems import CTFlows.Integrators: Integrators import CTFlows.Flows: Flows import CTFlows.Trajectories: Trajectories -import CTSolvers.Strategies: Strategies +import CTBase.Strategies: Strategies # Fake tag type for testing stub behavior struct FakeTag <: Common.AbstractTag end diff --git a/test/suite/flows/test_abstract_flow.jl b/test/suite/flows/test_abstract_flow.jl index 60764167..c519bef9 100644 --- a/test/suite/flows/test_abstract_flow.jl +++ b/test/suite/flows/test_abstract_flow.jl @@ -9,7 +9,7 @@ import CTFlows.Configs import CTFlows.Traits import CTFlows.Integrators import CTFlows.Data -import CTSolvers +import CTBase const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -36,9 +36,9 @@ struct FakeIntegrator <: Integrators.AbstractIntegrator result::Any end -CTSolvers.Strategies.id(::Type{FakeIntegrator}) = :fake_integrator -CTSolvers.Strategies.metadata(::Type{FakeIntegrator}) = CTSolvers.Strategies.StrategyMetadata() -CTSolvers.Strategies.options(integ::FakeIntegrator) = CTSolvers.Strategies.StrategyOptions() +CTBase.Strategies.id(::Type{FakeIntegrator}) = :fake_integrator +CTBase.Strategies.metadata(::Type{FakeIntegrator}) = CTBase.Strategies.StrategyMetadata() +CTBase.Strategies.options(integ::FakeIntegrator) = CTBase.Strategies.StrategyOptions() """ Fake flow for testing the AbstractFlow contract. diff --git a/test/suite/flows/test_flow.jl b/test/suite/flows/test_flow.jl index bdaff33f..798e295c 100644 --- a/test/suite/flows/test_flow.jl +++ b/test/suite/flows/test_flow.jl @@ -7,7 +7,7 @@ import CTFlows.Integrators import CTFlows.Common import CTFlows.Configs import CTFlows.Traits -import CTSolvers +import CTBase const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -26,9 +26,9 @@ struct FakeIntegrator <: Integrators.AbstractIntegrator end # Minimal strategy contract implementation -CTSolvers.Strategies.id(::Type{FakeIntegrator}) = :fake_integrator -CTSolvers.Strategies.metadata(::Type{FakeIntegrator}) = CTSolvers.Strategies.StrategyMetadata() -CTSolvers.Strategies.options(integ::FakeIntegrator) = CTSolvers.Strategies.StrategyOptions() +CTBase.Strategies.id(::Type{FakeIntegrator}) = :fake_integrator +CTBase.Strategies.metadata(::Type{FakeIntegrator}) = CTBase.Strategies.StrategyMetadata() +CTBase.Strategies.options(integ::FakeIntegrator) = CTBase.Strategies.StrategyOptions() """ Fake flow for testing Flow contract without requiring SciML extension. diff --git a/test/suite/flows/test_flow_routing.jl b/test/suite/flows/test_flow_routing.jl index 1ab6a48d..6fb8dff6 100644 --- a/test/suite/flows/test_flow_routing.jl +++ b/test/suite/flows/test_flow_routing.jl @@ -1,5 +1,5 @@ """ -Unit and integration tests for flow routing via CTSolvers. +Unit and integration tests for flow routing via CTBase.Strategies. """ module TestFlowRouting @@ -13,7 +13,7 @@ import CTFlows.Data import CTFlows.Systems import CTFlows.Traits import CTFlows.Common -import CTSolvers +import CTBase import ADTypes using OrdinaryDiffEqTsit5 @@ -50,11 +50,11 @@ function test_flow_routing() Test.@testset "Unit: flow_registry" begin registry = Flows.flow_registry() - Test.@test registry isa CTSolvers.Strategies.StrategyRegistry + Test.@test registry isa CTBase.Strategies.StrategyRegistry # Check that strategies are registered - backend_ids = CTSolvers.Strategies.strategy_ids(Differentiation.AbstractADBackend, registry) + backend_ids = CTBase.Strategies.strategy_ids(Differentiation.AbstractADBackend, registry) Test.@test :di in backend_ids - integrator_ids = CTSolvers.Strategies.strategy_ids(Integrators.AbstractIntegrator, registry) + integrator_ids = CTBase.Strategies.strategy_ids(Integrators.AbstractIntegrator, registry) Test.@test :sciml in integrator_ids end diff --git a/test/suite/integrators/test_abstract_integrator.jl b/test/suite/integrators/test_abstract_integrator.jl index 20c52154..ba60b3f4 100644 --- a/test/suite/integrators/test_abstract_integrator.jl +++ b/test/suite/integrators/test_abstract_integrator.jl @@ -7,7 +7,7 @@ import CTFlows.Systems import CTFlows.Common import CTFlows.Configs import CTFlows.Traits -import CTSolvers: CTSolvers +import CTBase: CTBase const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -41,11 +41,11 @@ This minimal implementation provides all three required callable signatures to test routing and default behavior without full integrator complexity. """ struct FakeIntegrator <: Integrators.AbstractIntegrator - options::CTSolvers.Strategies.StrategyOptions + options::CTBase.Strategies.StrategyOptions end function FakeIntegrator() - return FakeIntegrator(CTSolvers.Strategies.StrategyOptions()) + return FakeIntegrator(CTBase.Strategies.StrategyOptions()) end # Implement the three required callable signatures @@ -66,11 +66,11 @@ end Minimal integrator that does not implement the contract (for error testing). """ struct MinimalIntegrator <: Integrators.AbstractIntegrator - options::CTSolvers.Strategies.StrategyOptions + options::CTBase.Strategies.StrategyOptions end function MinimalIntegrator() - return MinimalIntegrator(CTSolvers.Strategies.StrategyOptions()) + return MinimalIntegrator(CTBase.Strategies.StrategyOptions()) end # ============================================================================== @@ -87,7 +87,7 @@ function test_abstract_integrator() Test.@testset "Abstract Types" begin integ = FakeIntegrator() Test.@test integ isa Integrators.AbstractIntegrator - Test.@test integ isa CTSolvers.Strategies.AbstractStrategy + Test.@test integ isa CTBase.Strategies.AbstractStrategy minimal = MinimalIntegrator() Test.@test minimal isa Integrators.AbstractIntegrator diff --git a/test/suite/integrators/test_sciml.jl b/test/suite/integrators/test_sciml.jl index d6681b7b..b7dce15b 100644 --- a/test/suite/integrators/test_sciml.jl +++ b/test/suite/integrators/test_sciml.jl @@ -4,7 +4,7 @@ import Test import CTBase.Exceptions import CTFlows.Integrators import CTFlows.Common -import CTSolvers: CTSolvers +import CTBase: CTBase const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -29,7 +29,7 @@ end Fake SciML strategy for testing constructor stub. """ struct FakeSciML <: Integrators.AbstractSciMLIntegrator - options::CTSolvers.Strategies.StrategyOptions + options::CTBase.Strategies.StrategyOptions end # Fake constructor that throws ExtensionError @@ -66,11 +66,11 @@ function test_sciml() Test.@testset "AbstractStrategy Contract" begin Test.@testset "id returns :sciml" begin - Test.@test CTSolvers.Strategies.id(Integrators.SciML) === :sciml + Test.@test CTBase.Strategies.id(Integrators.SciML) === :sciml end Test.@testset "description returns non-empty string" begin - desc = CTSolvers.Strategies.description(Integrators.SciML) + desc = CTBase.Strategies.description(Integrators.SciML) Test.@test desc isa String Test.@test !isempty(desc) Test.@test occursin("SciML", desc) @@ -85,7 +85,7 @@ function test_sciml() Test.@testset "metadata throws ExtensionError" begin fake_integrator = FakeSciMLIntegrator("test") - Test.@test_throws Exceptions.ExtensionError CTSolvers.Strategies.metadata(typeof(fake_integrator)) + Test.@test_throws Exceptions.ExtensionError CTBase.Strategies.metadata(typeof(fake_integrator)) end Test.@testset "build_sciml_integrator throws ExtensionError" begin @@ -113,7 +113,7 @@ function test_sciml() Test.@testset "metadata error mentions OrdinaryDiffEqTsit5" begin fake_integrator = FakeSciMLIntegrator("test") try - CTSolvers.Strategies.metadata(typeof(fake_integrator)) + CTBase.Strategies.metadata(typeof(fake_integrator)) Test.@test false # Should not reach here catch err Test.@test err isa Exceptions.ExtensionError diff --git a/test/suite/multiphase/test_calling_multiphase.jl b/test/suite/multiphase/test_calling_multiphase.jl index 11739763..3ba2f7a8 100644 --- a/test/suite/multiphase/test_calling_multiphase.jl +++ b/test/suite/multiphase/test_calling_multiphase.jl @@ -58,8 +58,8 @@ struct MockIntegrationResult <: Integrators.AbstractIntegrationResult t::Vector{Float64} end -import CTSolvers.Strategies -import CTSolvers.Options +import CTBase.Strategies +import CTBase.Options Strategies.id(::Type{FakeIntegrator}) = :fake_integrator Strategies.metadata(::Type{FakeIntegrator}) = Strategies.StrategyMetadata() diff --git a/test/suite/multiphase/test_concatenation.jl b/test/suite/multiphase/test_concatenation.jl index 03ae11ce..8fd4e8b2 100644 --- a/test/suite/multiphase/test_concatenation.jl +++ b/test/suite/multiphase/test_concatenation.jl @@ -8,8 +8,8 @@ import CTFlows.Integrators import CTFlows.Flows import CTFlows.Common import CTFlows.Traits -import CTSolvers.Strategies -import CTSolvers.Options +import CTBase.Strategies +import CTBase.Options const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true diff --git a/test/suite/multiphase/test_concatenation_heterogeneous.jl b/test/suite/multiphase/test_concatenation_heterogeneous.jl index 862baf32..9858f225 100644 --- a/test/suite/multiphase/test_concatenation_heterogeneous.jl +++ b/test/suite/multiphase/test_concatenation_heterogeneous.jl @@ -7,8 +7,8 @@ import CTFlows.Systems import CTFlows.Integrators import CTFlows.Flows import CTFlows.Traits -import CTSolvers.Strategies -import CTSolvers.Options +import CTBase.Strategies +import CTBase.Options const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true diff --git a/test/suite/multiphase/test_multiphase_flow.jl b/test/suite/multiphase/test_multiphase_flow.jl index 5d7721ee..a6a8609e 100644 --- a/test/suite/multiphase/test_multiphase_flow.jl +++ b/test/suite/multiphase/test_multiphase_flow.jl @@ -27,8 +27,8 @@ struct FakeIntegrator <: Integrators.AbstractIntegrator result::Any end -import CTSolvers.Strategies -import CTSolvers.Options +import CTBase.Strategies +import CTBase.Options Strategies.id(::Type{FakeIntegrator}) = :fake_integrator Strategies.metadata(::Type{FakeIntegrator}) = Strategies.StrategyMetadata() From b822d7a2d17972e5d46c62e58a5b3fb829efc56a Mon Sep 17 00:00:00 2001 From: Olivier Cots Date: Tue, 23 Jun 2026 00:12:02 +0200 Subject: [PATCH 4/4] remove CTBase qualification --- src/Differentiation/abstract_ad_backend.jl | 2 +- .../differentiation_interface.jl | 16 ++++++++-------- src/Flows/abstract_flow.jl | 6 +++--- src/Flows/flow_routing.jl | 10 +++++----- src/Flows/registry.jl | 2 +- src/Integrators/Integrators.jl | 2 +- src/Integrators/abstract_integrator.jl | 2 +- src/Integrators/sciml.jl | 8 ++++---- test/suite/differentiation/test_ad_backend.jl | 19 ++++++++++--------- .../differentiation/test_arg_placement.jl | 6 +++--- test/suite/flows/test_abstract_flow.jl | 8 ++++---- test/suite/flows/test_flow.jl | 8 ++++---- test/suite/flows/test_flow_routing.jl | 8 ++++---- .../integrators/test_abstract_integrator.jl | 12 ++++++------ test/suite/integrators/test_sciml.jl | 12 ++++++------ 15 files changed, 61 insertions(+), 60 deletions(-) diff --git a/src/Differentiation/abstract_ad_backend.jl b/src/Differentiation/abstract_ad_backend.jl index 5dbac370..a15667b9 100644 --- a/src/Differentiation/abstract_ad_backend.jl +++ b/src/Differentiation/abstract_ad_backend.jl @@ -22,7 +22,7 @@ See also: [`CTFlows.Differentiation.DifferentiationInterface`](@ref), [`CTFlows.Differentiation.hamiltonian_gradient`](@ref), [`CTFlows.Differentiation.variable_gradient`](@ref). """ -abstract type AbstractADBackend <: CTBase.Strategies.AbstractStrategy end +abstract type AbstractADBackend <: Strategies.AbstractStrategy end # ============================================================================== # Contract Methods diff --git a/src/Differentiation/differentiation_interface.jl b/src/Differentiation/differentiation_interface.jl index 31142a87..93fef6b4 100644 --- a/src/Differentiation/differentiation_interface.jl +++ b/src/Differentiation/differentiation_interface.jl @@ -26,7 +26,7 @@ See also: [`CTFlows.Differentiation.AbstractADBackend`](@ref), [`CTFlows.Differentiation.variable_gradient`](@ref), [`CTFlows.Differentiation.prepare_cache`](@ref). """ -struct DifferentiationInterface{O<:CTBase.Strategies.StrategyOptions} <: +struct DifferentiationInterface{O<:Strategies.StrategyOptions} <: AbstractADBackend options::O end @@ -44,7 +44,7 @@ Constructor for `DifferentiationInterface` with a specific backend. - `DifferentiationInterface`: A new backend strategy instance. """ function DifferentiationInterface(; mode::Symbol=:strict, kwargs...) - opts = CTBase.Strategies.build_strategy_options(DifferentiationInterface; mode=mode, kwargs...) + opts = Strategies.build_strategy_options(DifferentiationInterface; mode=mode, kwargs...) return DifferentiationInterface{typeof(opts)}(opts) end @@ -57,14 +57,14 @@ $(TYPEDSIGNATURES) Return the strategy identifier for `DifferentiationInterface`. """ -CTBase.Strategies.id(::Type{<:DifferentiationInterface}) = :di +Strategies.id(::Type{<:DifferentiationInterface}) = :di """ $(TYPEDSIGNATURES) Return a human-readable description of the `DifferentiationInterface` strategy. """ -CTBase.Strategies.description(::Type{<:DifferentiationInterface}) = +Strategies.description(::Type{<:DifferentiationInterface}) = "AD backend wrapping DifferentiationInterface.jl backends (e.g., AutoForwardDiff)." """ @@ -72,9 +72,9 @@ $(TYPEDSIGNATURES) Return metadata defining `DifferentiationInterface` options and their specifications. """ -function CTBase.Strategies.metadata(::Type{<:DifferentiationInterface}) - return CTBase.Strategies.StrategyMetadata( - CTBase.Strategies.OptionDefinition(; +function Strategies.metadata(::Type{<:DifferentiationInterface}) + return Strategies.StrategyMetadata( + Strategies.OptionDefinition(; name = :ad_backend, type = ADTypes.AbstractADType, default = Common.__ad_backend(), @@ -103,6 +103,6 @@ See also: [`CTFlows.Differentiation.ad_backend`](@ref), [`CTFlows.Systems.hamiltonian_vector_field`](@ref). """ ad_backend(backend::DifferentiationInterface) = - Base.get(CTBase.Strategies.options(backend), Val(:ad_backend)) + Base.get(Strategies.options(backend), Val(:ad_backend)) diff --git a/src/Flows/abstract_flow.jl b/src/Flows/abstract_flow.jl index d4f26246..66f6c716 100644 --- a/src/Flows/abstract_flow.jl +++ b/src/Flows/abstract_flow.jl @@ -377,10 +377,10 @@ Silently does nothing when no user options are set. \`\`\` """ function _print_user_options(io::IO, integ::Integrators.AbstractIntegrator) - opts = CTBase.Strategies.options(integ) + opts = Strategies.options(integ) user_opts = sort!( - [(k, CTBase.Options.value(v)) for (k, v) in pairs(opts.options) - if CTBase.Options.is_user(opts, k)]; + [(k, Options.value(v)) for (k, v) in pairs(opts.options) + if Options.is_user(opts, k)]; by = x -> string(x[1]), ) isempty(user_opts) && return diff --git a/src/Flows/flow_routing.jl b/src/Flows/flow_routing.jl index 679eb8d4..d3693dba 100644 --- a/src/Flows/flow_routing.jl +++ b/src/Flows/flow_routing.jl @@ -83,10 +83,10 @@ See also: [`_flow_families`](@ref), [`_build_flow_components`](@ref), [`CTBase.Orchestration.route_all_options`](@extref) """ function _route_flow_options(kwargs) - return CTBase.Orchestration.route_all_options( + return Orchestration.route_all_options( _FLOW_DESCRIPTION, _flow_families(), - CTBase.Options.OptionDefinition[], + Options.OptionDefinition[], (; kwargs...), flow_registry(); source_mode = :description, @@ -122,14 +122,14 @@ See also: [`_route_flow_options`](@ref), [`flow_registry`](@ref), """ function _build_flow_components(routed) families = _flow_families() - resolved = CTBase.Orchestration.resolve_method( + resolved = Orchestration.resolve_method( _FLOW_DESCRIPTION, families, flow_registry() ) - backend = CTBase.Orchestration.build_strategy_from_resolved( + backend = Orchestration.build_strategy_from_resolved( resolved, :backend, families, flow_registry(); routed.strategies.backend... ) - integrator = CTBase.Orchestration.build_strategy_from_resolved( + integrator = Orchestration.build_strategy_from_resolved( resolved, :integrator, families, flow_registry(); routed.strategies.integrator... ) diff --git a/src/Flows/registry.jl b/src/Flows/registry.jl index 9f5f91b2..50f1b5b4 100644 --- a/src/Flows/registry.jl +++ b/src/Flows/registry.jl @@ -18,7 +18,7 @@ types to their concrete implementations for flow construction: See also: [`CTFlows.Flows.flow_registry`](@ref), [`CTFlows.Flows._route_flow_options`](@ref), [`CTBase.Strategies.create_registry`](@extref). """ -const _FLOW_REGISTRY = CTBase.Strategies.create_registry( +const _FLOW_REGISTRY = Strategies.create_registry( Differentiation.AbstractADBackend => (Differentiation.DifferentiationInterface,), Integrators.AbstractIntegrator => (Integrators.SciML,), ) diff --git a/src/Integrators/Integrators.jl b/src/Integrators/Integrators.jl index 629ed166..44a8df91 100644 --- a/src/Integrators/Integrators.jl +++ b/src/Integrators/Integrators.jl @@ -14,6 +14,7 @@ module Integrators import DocStringExtensions: TYPEDEF, TYPEDSIGNATURES import CTBase.Exceptions +import CTBase.Strategies # ============================================================================== # Internal sibling-submodule imports @@ -22,7 +23,6 @@ import CTBase.Exceptions import ..Common: Common import ..Configs: Configs import ..Systems: Systems -using CTBase: CTBase # ============================================================================== # Include files diff --git a/src/Integrators/abstract_integrator.jl b/src/Integrators/abstract_integrator.jl index fe275e0b..4450ca17 100644 --- a/src/Integrators/abstract_integrator.jl +++ b/src/Integrators/abstract_integrator.jl @@ -35,7 +35,7 @@ Additionally, for multi-phase trajectory support, subtypes should implement: See also: [`CTFlows.Flows.AbstractFlow`](@ref). """ -abstract type AbstractIntegrator <: CTBase.Strategies.AbstractStrategy end +abstract type AbstractIntegrator <: Strategies.AbstractStrategy end """ $(TYPEDSIGNATURES) diff --git a/src/Integrators/sciml.jl b/src/Integrators/sciml.jl index 4b2d27a8..784164eb 100644 --- a/src/Integrators/sciml.jl +++ b/src/Integrators/sciml.jl @@ -62,7 +62,7 @@ To activate the extension, load any of: - `options_point::Dict{Symbol, Any}`: Pre-computed options for StateEndPointConfig. - `options_trajectory::Dict{Symbol, Any}`: Pre-computed options for StateTrajectoryConfig. """ -struct SciML{O<:CTBase.Strategies.StrategyOptions, OP<:Dict{Symbol, Any}, OT<:Dict{Symbol, Any}} <: AbstractSciMLIntegrator +struct SciML{O<:Strategies.StrategyOptions, OP<:Dict{Symbol, Any}, OT<:Dict{Symbol, Any}} <: AbstractSciMLIntegrator options::O options_point::OP options_trajectory::OT @@ -77,14 +77,14 @@ $(TYPEDSIGNATURES) Return the unique identifier for SciML integrator. """ -CTBase.Strategies.id(::Type{<:SciML}) = :sciml +Strategies.id(::Type{<:SciML}) = :sciml """ $(TYPEDSIGNATURES) Return the description for the SciML integrator. """ -function CTBase.Strategies.description(::Type{<:SciML}) +function Strategies.description(::Type{<:SciML}) "SciML ODE integrator.\n" * "See: https://docs.sciml.ai/DiffEqDocs\n" * "Solver options: https://docs.sciml.ai/DiffEqDocs/stable/basics/common_solver_opts/" @@ -141,7 +141,7 @@ Real metadata implementation provided by the extension. See also: `SciML`, `CTBase.Strategies.StrategyMetadata`. """ -function CTBase.Strategies.metadata(::Type{<:AbstractSciMLIntegrator}) +function Strategies.metadata(::Type{<:AbstractSciMLIntegrator}) # Extension is missing throw( Exceptions.ExtensionError( diff --git a/test/suite/differentiation/test_ad_backend.jl b/test/suite/differentiation/test_ad_backend.jl index 668c88b6..1e7db656 100644 --- a/test/suite/differentiation/test_ad_backend.jl +++ b/test/suite/differentiation/test_ad_backend.jl @@ -9,7 +9,7 @@ import CTFlows.Differentiation import CTFlows.Data import CTFlows.Traits import CTBase.Exceptions -import CTBase +import CTBase.Strategies import ADTypes const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true @@ -20,10 +20,10 @@ const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : # ============================================================================== struct FakeADBackend <: Differentiation.AbstractADBackend - options::CTBase.Strategies.StrategyOptions + options::Strategies.StrategyOptions end -FakeADBackend() = FakeADBackend(CTBase.Strategies.StrategyOptions()) +FakeADBackend() = FakeADBackend(Strategies.StrategyOptions()) # ============================================================================== # Fake Hamiltonian for Testing (at module top-level) @@ -45,7 +45,7 @@ function test_ad_backend() Test.@testset "Unit: AbstractADBackend abstract type" begin backend = FakeADBackend() Test.@test backend isa Differentiation.AbstractADBackend - Test.@test backend isa CTBase.Strategies.AbstractStrategy + Test.@test backend isa Strategies.AbstractStrategy end Test.@testset "Unit: DifferentiationInterface construction" begin @@ -55,7 +55,7 @@ function test_ad_backend() Test.@test di isa Differentiation.AbstractADBackend # Default backend is AutoForwardDiff - metadata = CTBase.Strategies.metadata(Differentiation.DifferentiationInterface) + metadata = Strategies.metadata(Differentiation.DifferentiationInterface) Test.@test metadata[:ad_backend].default === ADTypes.AutoForwardDiff() # Custom backend @@ -65,17 +65,17 @@ function test_ad_backend() Test.@testset "Unit: CTBase.Strategies contract" begin # id - Test.@test CTBase.Strategies.id(Differentiation.DifferentiationInterface) === + Test.@test Strategies.id(Differentiation.DifferentiationInterface) === :di # description - desc = CTBase.Strategies.description(Differentiation.DifferentiationInterface) + desc = Strategies.description(Differentiation.DifferentiationInterface) Test.@test desc isa String Test.@test !isempty(desc) # metadata - metadata = CTBase.Strategies.metadata(Differentiation.DifferentiationInterface) - Test.@test metadata isa CTBase.Strategies.StrategyMetadata + metadata = Strategies.metadata(Differentiation.DifferentiationInterface) + Test.@test metadata isa Strategies.StrategyMetadata Test.@test length(metadata) > 0 Test.@test :ad_backend in keys(metadata) end @@ -131,3 +131,4 @@ end # module # CRITICAL: Redefine in outer scope for TestRunner test_ad_backend() = TestADBackend.test_ad_backend() + diff --git a/test/suite/differentiation/test_arg_placement.jl b/test/suite/differentiation/test_arg_placement.jl index 579a4335..106bf106 100644 --- a/test/suite/differentiation/test_arg_placement.jl +++ b/test/suite/differentiation/test_arg_placement.jl @@ -11,7 +11,7 @@ import CTFlows import CTFlows.Differentiation import CTFlows.Common import CTBase.Exceptions -import CTBase +import CTBase.Strategies const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -21,9 +21,9 @@ const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : # ============================================================================== struct FakeBackendAP <: Differentiation.AbstractADBackend - options::CTBase.Strategies.StrategyOptions + options::Strategies.StrategyOptions end -FakeBackendAP() = FakeBackendAP(CTBase.Strategies.StrategyOptions()) +FakeBackendAP() = FakeBackendAP(Strategies.StrategyOptions()) # ============================================================================== # Helper — default backend (AutoForwardDiff via DI) diff --git a/test/suite/flows/test_abstract_flow.jl b/test/suite/flows/test_abstract_flow.jl index c519bef9..6503d20b 100644 --- a/test/suite/flows/test_abstract_flow.jl +++ b/test/suite/flows/test_abstract_flow.jl @@ -2,6 +2,7 @@ module TestAbstractFlow import Test import CTBase.Exceptions +import CTBase.Strategies import CTFlows.Systems import CTFlows.Flows import CTFlows.Common @@ -9,7 +10,6 @@ import CTFlows.Configs import CTFlows.Traits import CTFlows.Integrators import CTFlows.Data -import CTBase const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -36,9 +36,9 @@ struct FakeIntegrator <: Integrators.AbstractIntegrator result::Any end -CTBase.Strategies.id(::Type{FakeIntegrator}) = :fake_integrator -CTBase.Strategies.metadata(::Type{FakeIntegrator}) = CTBase.Strategies.StrategyMetadata() -CTBase.Strategies.options(integ::FakeIntegrator) = CTBase.Strategies.StrategyOptions() +Strategies.id(::Type{FakeIntegrator}) = :fake_integrator +Strategies.metadata(::Type{FakeIntegrator}) = Strategies.StrategyMetadata() +Strategies.options(integ::FakeIntegrator) = Strategies.StrategyOptions() """ Fake flow for testing the AbstractFlow contract. diff --git a/test/suite/flows/test_flow.jl b/test/suite/flows/test_flow.jl index 798e295c..207c4587 100644 --- a/test/suite/flows/test_flow.jl +++ b/test/suite/flows/test_flow.jl @@ -7,7 +7,7 @@ import CTFlows.Integrators import CTFlows.Common import CTFlows.Configs import CTFlows.Traits -import CTBase +import CTBase.Strategies const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -26,9 +26,9 @@ struct FakeIntegrator <: Integrators.AbstractIntegrator end # Minimal strategy contract implementation -CTBase.Strategies.id(::Type{FakeIntegrator}) = :fake_integrator -CTBase.Strategies.metadata(::Type{FakeIntegrator}) = CTBase.Strategies.StrategyMetadata() -CTBase.Strategies.options(integ::FakeIntegrator) = CTBase.Strategies.StrategyOptions() +Strategies.id(::Type{FakeIntegrator}) = :fake_integrator +Strategies.metadata(::Type{FakeIntegrator}) = Strategies.StrategyMetadata() +Strategies.options(integ::FakeIntegrator) = Strategies.StrategyOptions() """ Fake flow for testing Flow contract without requiring SciML extension. diff --git a/test/suite/flows/test_flow_routing.jl b/test/suite/flows/test_flow_routing.jl index 6fb8dff6..5849d043 100644 --- a/test/suite/flows/test_flow_routing.jl +++ b/test/suite/flows/test_flow_routing.jl @@ -6,6 +6,7 @@ module TestFlowRouting import Test import CTBase.Exceptions +import CTBase.Strategies import CTFlows.Flows import CTFlows.Differentiation import CTFlows.Integrators @@ -13,7 +14,6 @@ import CTFlows.Data import CTFlows.Systems import CTFlows.Traits import CTFlows.Common -import CTBase import ADTypes using OrdinaryDiffEqTsit5 @@ -50,11 +50,11 @@ function test_flow_routing() Test.@testset "Unit: flow_registry" begin registry = Flows.flow_registry() - Test.@test registry isa CTBase.Strategies.StrategyRegistry + Test.@test registry isa Strategies.StrategyRegistry # Check that strategies are registered - backend_ids = CTBase.Strategies.strategy_ids(Differentiation.AbstractADBackend, registry) + backend_ids = Strategies.strategy_ids(Differentiation.AbstractADBackend, registry) Test.@test :di in backend_ids - integrator_ids = CTBase.Strategies.strategy_ids(Integrators.AbstractIntegrator, registry) + integrator_ids = Strategies.strategy_ids(Integrators.AbstractIntegrator, registry) Test.@test :sciml in integrator_ids end diff --git a/test/suite/integrators/test_abstract_integrator.jl b/test/suite/integrators/test_abstract_integrator.jl index ba60b3f4..7999679d 100644 --- a/test/suite/integrators/test_abstract_integrator.jl +++ b/test/suite/integrators/test_abstract_integrator.jl @@ -2,12 +2,12 @@ module TestAbstractIntegrator import Test import CTBase.Exceptions +import CTBase.Strategies import CTFlows.Integrators import CTFlows.Systems import CTFlows.Common import CTFlows.Configs import CTFlows.Traits -import CTBase: CTBase const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -41,11 +41,11 @@ This minimal implementation provides all three required callable signatures to test routing and default behavior without full integrator complexity. """ struct FakeIntegrator <: Integrators.AbstractIntegrator - options::CTBase.Strategies.StrategyOptions + options::Strategies.StrategyOptions end function FakeIntegrator() - return FakeIntegrator(CTBase.Strategies.StrategyOptions()) + return FakeIntegrator(Strategies.StrategyOptions()) end # Implement the three required callable signatures @@ -66,11 +66,11 @@ end Minimal integrator that does not implement the contract (for error testing). """ struct MinimalIntegrator <: Integrators.AbstractIntegrator - options::CTBase.Strategies.StrategyOptions + options::Strategies.StrategyOptions end function MinimalIntegrator() - return MinimalIntegrator(CTBase.Strategies.StrategyOptions()) + return MinimalIntegrator(Strategies.StrategyOptions()) end # ============================================================================== @@ -87,7 +87,7 @@ function test_abstract_integrator() Test.@testset "Abstract Types" begin integ = FakeIntegrator() Test.@test integ isa Integrators.AbstractIntegrator - Test.@test integ isa CTBase.Strategies.AbstractStrategy + Test.@test integ isa Strategies.AbstractStrategy minimal = MinimalIntegrator() Test.@test minimal isa Integrators.AbstractIntegrator diff --git a/test/suite/integrators/test_sciml.jl b/test/suite/integrators/test_sciml.jl index b7dce15b..92c7a48a 100644 --- a/test/suite/integrators/test_sciml.jl +++ b/test/suite/integrators/test_sciml.jl @@ -2,9 +2,9 @@ module TestSciML import Test import CTBase.Exceptions +import CTBase.Strategies import CTFlows.Integrators import CTFlows.Common -import CTBase: CTBase const VERBOSE = isdefined(Main, :TestOptions) ? Main.TestOptions.VERBOSE : true const SHOWTIMING = isdefined(Main, :TestOptions) ? Main.TestOptions.SHOWTIMING : true @@ -29,7 +29,7 @@ end Fake SciML strategy for testing constructor stub. """ struct FakeSciML <: Integrators.AbstractSciMLIntegrator - options::CTBase.Strategies.StrategyOptions + options::Strategies.StrategyOptions end # Fake constructor that throws ExtensionError @@ -66,11 +66,11 @@ function test_sciml() Test.@testset "AbstractStrategy Contract" begin Test.@testset "id returns :sciml" begin - Test.@test CTBase.Strategies.id(Integrators.SciML) === :sciml + Test.@test Strategies.id(Integrators.SciML) === :sciml end Test.@testset "description returns non-empty string" begin - desc = CTBase.Strategies.description(Integrators.SciML) + desc = Strategies.description(Integrators.SciML) Test.@test desc isa String Test.@test !isempty(desc) Test.@test occursin("SciML", desc) @@ -85,7 +85,7 @@ function test_sciml() Test.@testset "metadata throws ExtensionError" begin fake_integrator = FakeSciMLIntegrator("test") - Test.@test_throws Exceptions.ExtensionError CTBase.Strategies.metadata(typeof(fake_integrator)) + Test.@test_throws Exceptions.ExtensionError Strategies.metadata(typeof(fake_integrator)) end Test.@testset "build_sciml_integrator throws ExtensionError" begin @@ -113,7 +113,7 @@ function test_sciml() Test.@testset "metadata error mentions OrdinaryDiffEqTsit5" begin fake_integrator = FakeSciMLIntegrator("test") try - CTBase.Strategies.metadata(typeof(fake_integrator)) + Strategies.metadata(typeof(fake_integrator)) Test.@test false # Should not reach here catch err Test.@test err isa Exceptions.ExtensionError