Make constraint handling tools available for users #1158
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #1152
Currently, there is a lot of nice functionality for working with dofs and constraints that are not available for users, without relying in clearly internal functions, such as
_local_facet_dofs_for_bc
(ref. e.g. if one should make a how-to from #1119).The aim of this PR is to make some of this available to users, in particular, the local dofs belonging to an entity are made available via an updated
BCValues
struct. Secondly, the logic for getting periodic dofs are included in a newPeriodicDofLocations
struct.Finally, the concept of a
DofLocation
is included more formally (we use this already, but this PR adds a separate type of this). For a nodal interpolation aDofLocation
has an actual coordinate (but abstractly doesn't have to). For vectorized interpolations, we can have multiple dofs associated with a singleDofLocation
.With the tools introduced, we have the following possibilities,
Currently, I haven't added exports or much documentation. Would be grateful for some feedback. My goal is allowing users build their own custom constraints more easily.
Brief summary of the internal changes in the code as a result of this
local_facet_dofs
andlocal_facet_dofs_offset
fields fromDirichlet
. (These were also used for nodal BCs, so same fields are there but renamed to describe what they do)local_facet_dofs
logic is now only for the first dof, and only when callingget_local_dof
the vector component for vectorized interpolations are used.PeriodicDirichlet
, everything now works by identifying dofs with the first component, all components are only added in the end. We also don't use a separate iterator when the rotation matrix is given, as we use the same strategy there.I moved the
PeriodicDofLocations
functionality intoperiodicity_utils.jl
, this can of course be included inConstraintHandler.jl
, however, I believe it would be easier to navigate if we could move all logic related to periodicity into a separate file as it is quite hard to navigate theConstraintHandler.jl
file.