Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tri3 -> Topology + Basis #30

Open
ahojukka5 opened this issue Aug 20, 2018 · 0 comments
Open

Tri3 -> Topology + Basis #30

ahojukka5 opened this issue Aug 20, 2018 · 0 comments

Comments

@ahojukka5
Copy link
Member

Currently, we define elements using style

element = Element(Tri3, [1, 2, 3])

and it is somewhat implicitly assumed that the basis for the element is a nodal basis, e.g. N(xi, eta) = (xi, eta, 1-xi-eta) in this particular case. We should extend this definition by explicitly giving a basis, which defaults to nodal basis. So we can have Tri3{CG}, Tri3{Morley}, Tri3{DKT} and so on. We could implement this several ways, here's couple options:

abstract type AbstractBasis end
struct CG <: AbstractBasis end
struct Morley <: AbstractBasis end
abstract type AbstractTopology end
struct Tet10{T<:AbstractBasis} <: AbstractTopology end
abstract type AbstractElement end

struct Element{T<:AbstractTopology} <: AbstractElement
    # rest of stuff ...
    topology :: T
end

Element(Tet10{CG}())

# output

Element{Tet10{CG}}(Tet10{CG}())

Other way is

struct Tet4 <: AbstractTopology end

struct Element2{T<:AbstractTopology, B<:AbstractBasis} <: AbstractElement
    # rest of stuff ...
    topology :: T
    basis :: B
end

Element2(Tet4(), CG())

# output

Element2{Tet4,CG}(Tet4(), CG())

I don't know which one is better or is there maybe third and better way to think this. Anyway we can do this change so that element = Element(Tri3, [1, 2, 3]) is still working and having CG basis as default one:

function Element2(::Type{T}, connectivity) where {T <: AbstractTopology}
    return Element2(T(), CG())
end

Element2(Tet4, [1, 2, 3, 4])

# output

Element2{Tet4,CG}(Tet4(), CG())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant