feat: Consolidate FEMBase.jl into JuliaFEM (Phase 1 complete)

MAJOR MILESTONE: FEMBase + FEMBasis fully consolidated, JuliaFEM loads!

Consolidated files:
- src/elements/ (3 files): elements.jl, elements_lagrange.jl, integrate.jl
- src/fields/ (1 file): fields.jl (DCTI, DVTI, DCTV, DVTV, etc.)
- src/sparse/ (1 file): sparse.jl (SparseMatrixCOO, SparseVectorCOO)
- src/assembly/ (2 files): problems.jl, assembly.jl
- src/solvers/ (1 file): solvers_base.jl
- src/analysis.jl, src/core_types.jl (Node, IP, IntegrationPoint)

Changes to JuliaFEM.jl:
- Added dependencies: Tensors, Calculus
- Removed @reexport using FEMBase (now consolidated)
- Added 20+ include statements for consolidated files
- Include order: fields → core_types → fembase_compat → sparse → elements

Compatibility layer:
- Created fembase_compat.jl: Minimal FEMBase submodule for vendor packages
- Temporarily disabled vendor-specific Mortar2D functions in solvers_modal.jl

Bug fixes:
- Changed i == 1 → isequal(i, 1) in integrate.jl (== operator overridden by fields)
- Resolved all FEMBasis. namespace references throughout codebase

Result:
- ✅ JuliaFEM loads successfully on Julia 1.12.1
- ✅ 134 exported symbols (was 171 with separate FEMBase)
- ✅ Core types accessible: Seg2, Quad4, Problem, AbstractProblem, etc.
- ⚠️  Vendor packages show FEMBase cache warnings (expected, harmless)

TODO:
- Re-enable Mortar2D functions after vendor consolidation
- Field system == operator override needs redesign (Phase 4)
- Continue Phase 2: Consolidate remaining vendor packages
This commit is contained in:
Jukka Aho
2025-11-08 09:39:16 +02:00
parent d3fc55f13e
commit 73ec910589
31 changed files with 2228 additions and 55 deletions
+53
View File
@@ -0,0 +1,53 @@
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/FEMBase.jl/blob/master/LICENSE
mutable struct LinearSystem{Tv, Ti<:Integer}
M :: SparseMatrixCSC{Tv, Ti}
K :: SparseMatrixCSC{Tv, Ti}
Kg :: SparseMatrixCSC{Tv, Ti}
C1 :: SparseMatrixCSC{Tv, Ti}
C2 :: SparseMatrixCSC{Tv, Ti}
D :: SparseMatrixCSC{Tv, Ti}
f :: SparseVector{Tv, Ti}
fg :: SparseVector{Tv, Ti}
g :: SparseVector{Tv, Ti}
u :: SparseVector{Tv, Ti}
la :: SparseVector{Tv, Ti}
dim :: Int
end
function LinearSystem(dim::Int)
return LinearSystem(spzeros(dim, dim), spzeros(dim, dim),
spzeros(dim, dim), spzeros(dim, dim),
spzeros(dim, dim), spzeros(dim, dim),
spzeros(dim), spzeros(dim), spzeros(dim),
spzeros(dim), spzeros(dim), dim)
end
abstract type AbstractLinearSystemSolver end
function solve!(::LinearSystem, ::Solver) where Solver<:AbstractLinearSystemSolver
@info("This is a placeholder function for solving linear systems. To solve " *
"linear systems, you must define a function " *
"solve!(system::LinearSystem, solver::$Solver)")
end
function can_solve(::LinearSystem, ::Solver) where Solver<:AbstractLinearSystemSolver
return (true, "OK")
end
function solve!(ls::LinearSystem, solvers::Vector{S}) where S<:AbstractLinearSystemSolver
for solver in solvers
Solver = typeof(solver)
cansolve, msg = can_solve(ls, solver)
if !cansolve
@info("Solver $Solver cannot solve linear system: $msg")
continue
end
timeit("solve linear system using solver $Solver") do
solve!(ls, solver)
end
return
end
error("Failed to solve linear system.")
end