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

Use expressions instead of strings? #16

Closed ChrisRackauckas closed 6 years ago

ChrisRackauckas commented 6 years ago

Passing Julia expressions as strings into create_basis seems really odd. Is there a reason it's not just an expression?

ahojukka5 commented 6 years ago

Hmm. looks that strings is immediately parsed to expression. Does the string approach look odd in a sense that it's causing some particular problem and only expression as input argument should be used?

ChrisRackauckas commented 6 years ago

Well, strings have to be stack-allocated while symbols are immutable, so while the performance hit wouldn't be big it would create a lot of unnecessary small allocation which could in theory build up. And most APIs use symbols anyways. Also, symbols are immutable so they are pure so literals and constants which are symbols can propagate further in compiler optimizations which are happening down the line.