-
Notifications
You must be signed in to change notification settings - Fork 92
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
Merging DofHandler
and MixedDofHandler
#624
Comments
Okay, now you may read. |
Regarding the name I like the idea of pushing seperate fields to the " |
I was thinking it should do this though, and would enable cell iteration over the subdofhandler directly, with all the same queries as you can do on the standard dofhandler. |
Thanks for writing this up Fredrik (and also for the hard work from Kim and Elias!). Several questions here.
for c in CellIterator(dh, subdomainhandler1)
# ...
end To concretize a bit on the data structures, I was thinking about something along these lines struct DomainHandler{IP <: Interpolation}
name::Symbol
ip::IP
end
struct SubDomainHandler{IP <: Interpolation}
name::Symbol
ip::IP
subdomain # view on cell array or array of cell indices?
end Note that |
Hmm, I dont see very much benefit with this I think 🤔 . The way we do it now feels more clear/direct:
|
|
So I guess either you pass around a cellset, or you pass around a subdofhandler. For the latter you can also query |
I'd vote for this as well |
Answering in order again.
|
Just like in the mixed dof handler now; you need to specify it for every subdomain you want it. |
Since we (I) want to store the parent dof handler we need something like: dh = NewDofHandler(grid)
# Domain 1: u
sdh1 = SubDofHandler(dh, set1)
add!(sdh1, :u)
# Domain 2: u and p
sdh2 = SubDofHandler(dh, set2)
add!(sdh2, :u)
add!(sdh2, :p)
close!(dh) i.e. pass the dofhandler to the subdofhandler constructor. At least you don't need the |
Actually, we could figure out the parent type also in the original suggestion, make it a mutable union with Another alternative spelling would be
which could also perhaps imply |
Very nice to see this progress!
This would be very nice and we could even allow struct FieldDomain
cellset::Set{Int}
fields::Vector{Field}
end where in |
Implementing the one liner is already possible with something along these lines:
where we should be able to do something similar for the @fredrikekre Assuming your |
Yes, even simpler: Edit 2nd comment: Misread |
Indeed. :) |
The subdofhandler design is in fact what the |
I see. Just as you wrote I also discovered the related code (but really missed the docs). I totally misunderstood Fredrik's answer, but now it makes sense. Thanks for elaborating on this Kim! This also explains my third question above, why we should have multiple fields per |
Looks like everyone is on track now then. I think the implementation plan above will be too confusing. Instead I suggest doing what @kimauth originally suggested: we adjust the MixedDofHandler to be the new thing. This can be done in individual PRs making it easy to review. Finally, we delete DofHandler, and rename MixedDofHandler. |
#625 aims to close the performance gap on several calls when having a FieldHandler on the full domain (i.e. what DofHandler functionality provides). |
#627 adds feature parity between the DofHandlers for high order dof distribution. |
This patch deletes the `DofHandler` implementation, replaces it with the `MixedDofHandler` implementation, and renames `MixedDofHandler` to `DofHandler`. The `MixedDofHandler` has more capabilities than the `DofHandler`, and since performance and functionality is now comparable it is not necessary to maintain two DoF handlers. Closes #624.
Background
Ferrite.jl has, for quite some time, maintained two different DoF handlers: the original
DofHandler
and theMixedDofHandler
. TheDofHandler
is limited to i) single element type (e.g. only triangles, or only quads) and ii) to uniform dof distribution (e.g. all fields live on all elements).MixedDofHandler
enables both these use cases, so functionality-wise it it is a superset ofDofHandler
. Naturally it would be good to only have a single DoF handler instead of maintaining two.Performance wise the
DofHandler
is generally better, since it doesn't have to deal with theUnion
element type (when combining different elements). A lot of work, mainly by @kimauth has been done to reduce the performance gap, and I think that we are now at a point where we can merge them into a new DoF handler that can support all usecases with good performance.DofHandler
interfaceSetup
Constraints
Assembly loop
MixedDofHandler
interface(I have never used this, so please correct me if the stuff below is incorrect or atypical.)
Setup
Constraints
The
add!(ch, fh, dbc)
method is a bit strange, since you can already specify the domain selection in theDirichlet
constructor. There is no need to be able to do it twice, IMO.Assembly loop
NewDofHandler
interfaceThese are my ideas for a new common interface that I have also briefly discussed with @kimauth and @lijas
Setup
Constraints
Assembly loop
This is mostly the same as the current
MixedDofHandler
, withFieldHandler
now calledSubDofHandler
. I don't really like the nameFieldHandler
because what it really is is a "region-handler". I think it makes sense to rename, and then also include the parent dofhandler as a field. Then the subdofhandlers can be drop-in replacement in most cases. In addition, we can put the concrete celltype as a type-paramter on the subdofhandler, which we can use to help the compiler when requestion cells from the union-vector.In addition (not shown above) the exact same interface as for the current
DofHandler
will be supported. In that case, when adding the first field, an internalSubDofHandler
will be set up. In this mode, e.g.dof_range
will work directly on the dofhandler, but it will error in the previous case (there you will be forced to call it on your subdofhandler).Implementation plan
Initially the plan was to simply remove
DofHandler
and then renameMixedDofHandler
toDofHandler
. However, I think the following might be easier to execute:NewDofHandler
fromMixedDofHandler
NewDofHandler
to new common interfaceNewDofHandler
andDofHandler
/MixedDofHandler
DofHandler
andMixedDofHandler
, renameNewDofHandler
toDofHandler
.The text was updated successfully, but these errors were encountered: