Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lijas committed Nov 4, 2024
1 parent 4a16855 commit f831eed
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/src/devdocs/FEValues.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Ferrite.BCValues
## Internal utilities
```@docs
Ferrite.embedding_det
Ferrite.shape_value_type
Ferrite.shape_value_type(::AbstractValues)
Ferrite.shape_value_type(::FunctionValues)
Ferrite.shape_gradient_type
Ferrite.ValuesUpdateFlags
```
Expand Down
1 change: 1 addition & 0 deletions docs/src/devdocs/interpolations.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Ferrite.reference_shape_values!
Ferrite.reference_shape_gradients!
Ferrite.reference_shape_gradients_and_values!
Ferrite.reference_shape_hessians_gradients_and_values!
Ferrite.shape_value_type
```

### Required methods to implement for all subtypes of `Interpolation` to define a new finite element
Expand Down
53 changes: 53 additions & 0 deletions src/Dofs/DofRenumbering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ module DofOrder
ComponentWise(x=Int[]) = new(_check_target_blocks(x))
end

struct NodeWise # <: DofOrdering
end

"""
DofOrder.Ext{T}
Expand Down Expand Up @@ -224,7 +227,57 @@ function compute_renumber_permutation(dh::DofHandler, _, order::DofOrder.Compone
perm = invperm(iperm)
return perm
end
"""
Renumber to follow node ordering
"""
#=DofOrder.NodeWise
function compute_renumber_permutation(dh::DofHandler, _, order::DofOrder.NodeWise)
#Check
perm = zeros(Int, ndofs(dh))
flags = UpdateFlags(nodes=false, coords=false, dofs=true)
for sdh in dh.subdofhandlers
dof_ranges = [dof_range(sdh, f) for f in eachindex(sdh.field_names)]
global_idxs = [findfirst(x -> x === f, dh.field_names) for f in sdh.field_names]
for cell in CellIterator(dh, sdh.cellset, flags)
for node in cell.nodes
end
cdofs = celldofs(cell)
for (local_idx, global_idx) in pairs(global_idxs)
rng = dof_ranges[local_idx]
fdim = field_dims[global_idx]
component_offset = component_offsets[global_idx]
for (j, J) in pairs(rng)
comp = mod1(j, fdim) + component_offset
block = target_blocks[comp]
push!(dofs_for_blocks[block], cdofs[J])
end
end
end
end
@assert sum(length, dofs_for_blocks) == ndofs(dh)
# Construct the inverse permutation. Sorting the dofs for each field is necessary to
# make the permutation stable and keep internal ordering within each field, i.e. for
# dofs i and j, if i > j, then p(i) > p(j), and if i < j, then p(i) < p(j) where p() is
# the transformed dof number.
iperm = sort!(collect(popfirst!(dofs_for_blocks)))
sizehint!(iperm, ndofs(dh))
for dofs_for_block in dofs_for_blocks
append!(iperm, sort!(collect(dofs_for_block)))
end
# Construct permutation
perm = invperm(iperm)
return perm
end
function compute_renumber_permutation(dh::AbstractDofHandler, ::Union{ConstraintHandler,Nothing}, ::DofOrder.Ext{M}) where M
error("Renumbering extension based on package $M not available.")
end
=#
5 changes: 5 additions & 0 deletions src/interpolations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ n_components(::VectorInterpolation{vdim}) where {vdim} = vdim
# Number of components that are allowed to prescribe in e.g. Dirichlet BC
n_dbc_components(ip::Interpolation) = n_components(ip)

"""
shape_value_type(ip::Iterpolation, ::Type{T}) where T<:Number
Return the type of `shape_value(ip::Interpolation, ξ::Vec, ib::Int)`
"""
shape_value_type(::ScalarInterpolation, ::Type{T}) where {T <: Number} = T
shape_value_type(::VectorInterpolation{vdim}, ::Type{T}) where {vdim, T <: Number} = Vec{vdim, T}

Check warning on line 66 in src/interpolations.jl

View check run for this annotation

Codecov / codecov/patch

src/interpolations.jl#L65-L66

Added lines #L65 - L66 were not covered by tests
#shape_value_type(::MatrixInterpolation, T::Type) = Tensor #958
Expand Down

0 comments on commit f831eed

Please sign in to comment.