Skip to content

Commit

Permalink
More renames, thanks to @termi-official
Browse files Browse the repository at this point in the history
  • Loading branch information
KnutAM committed Jan 7, 2025
1 parent 6b26acb commit c27cad6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
20 changes: 10 additions & 10 deletions src/FEValues/FacetValues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,21 @@ getnormal(fv::FacetValues, qp::Int) = fv.normals[qp]

nfacets(fv::FacetValues) = length(fv.geo_mapping)

function set_current_facet!(fv::FacetValues, face_nr::Int)
# Checking face_nr before setting current_facet allows us to use @inbounds
function set_current_facet!(fv::FacetValues, facet_nr::Int)
# Checking facet_nr before setting current_facet allows us to use @inbounds
# when indexing by getcurrentfacet(fv) in other places!
checkbounds(Bool, 1:nfacets(fv), face_nr) || throw(ArgumentError("Face index out of range."))
fv.current_facet = face_nr
checkbounds(Bool, 1:nfacets(fv), facet_nr) || throw(ArgumentError("Facet nr is out of range."))
fv.current_facet = facet_nr
return
end

@inline function reinit!(fv::FacetValues, x::AbstractVector, face_nr::Int)
return reinit!(fv, nothing, x, face_nr)
@inline function reinit!(fv::FacetValues, x::AbstractVector, facet_nr::Int)
return reinit!(fv, nothing, x, facet_nr)
end

function reinit!(fv::FacetValues, cell::Union{AbstractCell, Nothing}, x::AbstractVector{Vec{dim, T}}, face_nr::Int) where {dim, T}
function reinit!(fv::FacetValues, cell::Union{AbstractCell, Nothing}, x::AbstractVector{Vec{dim, T}}, facet_nr::Int) where {dim, T}
check_reinit_sdim_consistency(:FacetValues, shape_gradient_type(fv), eltype(x))
set_current_facet!(fv, face_nr)
set_current_facet!(fv, facet_nr)
n_geom_basefuncs = getngeobasefunctions(fv)
if !checkbounds(Bool, x, 1:n_geom_basefuncs) || length(x) != n_geom_basefuncs
throw_incompatible_coord_length(length(x), n_geom_basefuncs)
Expand All @@ -139,11 +139,11 @@ function reinit!(fv::FacetValues, cell::Union{AbstractCell, Nothing}, x::Abstrac
throw(ArgumentError("The cell::AbstractCell input is required to reinit! non-identity function mappings"))
end

@inbounds for (q_point, w) in pairs(getweights(fv.fqr, face_nr))
@inbounds for (q_point, w) in pairs(getweights(fv.fqr, facet_nr))
mapping = calculate_mapping(geo_mapping, q_point, x)
J = getjacobian(mapping)
# See the `Ferrite.embedding_det` docstring for more background
weight_norm = weighted_normal(J, getrefshape(geo_mapping.ip), face_nr)
weight_norm = weighted_normal(J, getrefshape(geo_mapping.ip), facet_nr)
detJ = norm(weight_norm)
detJ > 0.0 || throw_detJ_not_pos(detJ)
@inbounds fv.detJdV[q_point] = detJ * w
Expand Down
6 changes: 3 additions & 3 deletions src/Grid/grid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ Returns all nodesets of the `grid`.
"""
getfacetset(grid::AbstractGrid, setname::String)
Returns all faces as `FacetIndex` in the set with name `setname`.
Returns all facets as `FacetIndex` in the set with name `setname`.
"""
@inline getfacetset(grid::AbstractGrid, setname::String) = grid.facetsets[setname]
"""
Expand Down Expand Up @@ -648,10 +648,10 @@ for INDEX in (:VertexIndex, :EdgeIndex, :FaceIndex, :FacetIndex)

Base.getindex(I::($INDEX), i::Int) = I.idx[i]

#To be able to do a,b = faceidx
#To be able to do, e.g., `a,b = facetidx`
Base.iterate(I::($INDEX), state::Int = 1) = (state == 3) ? nothing : (I[state], state + 1)

# Necessary to check if, e.g. `(cellid, faceidx) in faceset`
# Necessary to check if, e.g. `(cellid, facetnr) in facetset`
Base.isequal(x::$INDEX, y::$INDEX) = x.idx == y.idx
Base.isequal(x::Tuple{Int, Int}, y::$INDEX) = x[1] == y.idx[1] && x[2] == y.idx[2]
Base.isequal(y::$INDEX, x::Tuple{Int, Int}) = x[1] == y.idx[1] && x[2] == y.idx[2]
Expand Down

0 comments on commit c27cad6

Please sign in to comment.