Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JordiManyer committed Aug 25, 2024
1 parent 9da2e8f commit 5075621
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Adaptivity/MacroFEs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ function Base.getindex(a::FineToCoarseIndices,cid::Integer)
(a.cid_to_fcells[cid],a.cid_to_fids[cid])
end

# Note for developpers:
# We use FineToCoarseArray to represent many data-structures, from quadrature points to
# finite-element basis. For performance reasons, we sometimes want to keep a copy of the
# coarse data (but not always!). For instance:
# - for quad points, we want to keep the coarse points. Otherwise, we woudl have to
# recompute them for every cell when the CompositeQuadrature is used with other
# gridap basis.
# - for finite-element basis, we do NOT want to generate the coarse basis, otherwise
# we would be creating it many times (when it should never be used). In this case, we
# create it on the go (see getindex! specialisations).
# All in all, this is why coarse_data can be of type Nothing.
struct FineToCoarseArray{T,A,B,C} <: AbstractVector{T}
rrule :: A
coarse_data :: B
Expand Down
6 changes: 6 additions & 0 deletions src/Adaptivity/RefinementRules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ struct RefinementRule{P,A<:DiscreteModel,B,C}
p2c_cache :: Tuple
end

# Note for devs:
# The reason why we are saving both the cell maps and the inverse cell maps is to avoid recomputing
# them when needed. This is needed for performance when the RefinementRule is used for MacroFEs.
# Also, in the case the ref_grid comes from a CartesianGrid, we save the cell maps as
# AffineMaps, which are more efficient than the default linear_combinations.

function RefinementRule(
T::RefinementRuleType,poly::Polytope,ref_grid::DiscreteModel;
cell_maps=get_cell_map(ref_grid)
Expand Down

0 comments on commit 5075621

Please sign in to comment.