JuliaFEM / FEMBasis.jl

FEMBasis contains interpolation routines for finite element function spaces. Given ansatz and coordinates of domain, shape functions are calculated symbolically in a very general way to get efficient code. Shape functions can also be given directly and in that case partial derivatives are calculated automatically.
https://juliafem.github.io/FEMBasis.jl/latest
MIT License
14 stars 12 forks source link

"::Vec" Type declaration outdated? #42

Open thomaskroi1996 opened 2 months ago

thomaskroi1996 commented 2 months ago

Hello!

in lines 101 and 108 of create_basis.jl:

@inline function FEMBasis.eval_basis!(::Type{$name}, N::Vector{<:Number}, xi::Vec) @inline function FEMBasis.eval_dbasis!(::Type{$name}, dN::Vector{<:Vec{$D}}, xi::Vec)

the type declaration throws me errors, when trying to use a Vector for xi. Is this on purpose or is it simply a relict from an older version? Changing them to xi::Vector fixed the issue. Furthermore, in the documentation of JuliaFEM.jl this is done with xi as a tuple.

This code should reproduce the example, with Julia v.1.9.2 and FEMBasis 0.3.2 B = Quad4() N = zeros(1, length(B)) xi = [0.0, 0.0] #(or using (0.0, 0.0) as in JuliaFEM doc) eval_basis!(B, N, xi)

I am trying to use FEMBasis as if i were using it from JuliaFEM, i.e. with the help of JuliaFEM documentation. A related issue is that basis functions are not defined in JuliaFEM, does anybody know about this? using JuliaFEM Tri3() #not defined error

I don't know if it is useful to open a seperate issue, or if this unavailability of the basis functions are related to this package. They seem to be exported in JuliaFEM, but not defined.

Thank you for the help in advance!

ahojukka5 commented 2 months ago

Have you been trying using Tensors.jl? Using Vector seems to be a bad idea for xi, because we should use something that is allocated to stack, not heap. Like tuple, but Tensors.jl or StaticArrays.jl might be better choices. In general, these should work (and fixed if they don't):

xi = (0.0, 0.0)
eval_basis!(B, N, xi)
using Tensors
xi = Vec(0.0, 0.0)
eval_basis!(B, N, xi)
using StaticArrays
xi = @SVector [0.0, 0.0]
eval_basis!(B, N, xi)