mirror of
https://github.com/JuliaFEM/JuliaFEM.jl.git
synced 2026-09-28 12:37:53 +00:00
73ec910589
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
54 lines
1.5 KiB
Julia
54 lines
1.5 KiB
Julia
# This file is a part of JuliaFEM.
|
|
# License is MIT: see https://github.com/JuliaFEM/jl/blob/master/LICENSE
|
|
|
|
"""
|
|
vandermonde_matrix(polynomial, coordinates)
|
|
|
|
Given some polynomial and coordinates points (1-3 dimensions), create a Vandermonde
|
|
matrix.
|
|
|
|
# Example
|
|
|
|
To genererate a Vandermonde matrix for a reference quadrangle `[-1.0, 1.0]^2` for
|
|
polynomial `p(u,v) = 1 + u + v + u*v`, one writes:
|
|
|
|
```julia
|
|
polynomial = :(1 + u + v + u*v)
|
|
coordinates = [(-1.0,-1.0), (1.0,-1.0), (1.0,1.0), (-1.0,1.0)]
|
|
V = vandermonde_matrix(polynomial, coordinates)
|
|
|
|
# output
|
|
|
|
[
|
|
1.0 -1.0 -1.0 1.0
|
|
1.0 1.0 -1.0 -1.0
|
|
1.0 1.0 1.0 1.0
|
|
1.0 -1.0 1.0 -1.0
|
|
]
|
|
|
|
```
|
|
|
|
# References
|
|
- Wikipedia contributors. (2018, August 1). Vandermonde matrix. In Wikipedia, The Free Encyclopedia. Retrieved 10:00, August 20, 2018, from https://en.wikipedia.org/w/index.php?title=Vandermonde_matrix&oldid=852930962
|
|
"""
|
|
function vandermonde_matrix(polynomial::Expr, coordinates::Vector{NTuple{D, T}}) where {D, T<:Number}
|
|
N = length(coordinates)
|
|
A = zeros(N, N)
|
|
first(polynomial.args) == :+ || error("Use only summation between terms of polynomial")
|
|
args = polynomial.args[2:end]
|
|
for i in 1:N
|
|
X = coordinates[i]
|
|
if D == 1
|
|
data = (:u => X[1],)
|
|
elseif D == 2
|
|
data = (:u => X[1], :v => X[2])
|
|
elseif D == 3
|
|
data = (:u => X[1], :v => X[2], :w => X[3])
|
|
end
|
|
for (j, term) in enumerate(args)
|
|
A[i,j] = subs(term, data)
|
|
end
|
|
end
|
|
return A
|
|
end
|