Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

# [1.17.1] - 2026-05-20
- update_trafo! of L2GTransformer does not require item to be of type Int anymore
- CellFinder result type is always of type Ti (grid items index type)

# [1.17.0] - 2026-04-15
- new kwargs `not_in_domain_value = nothing` and `check_if_not_in_domain = isnothing(not_in_domain_value)` for grid interpolation.
This enables the user to interpolate values between grids which do not share the same domain. The value _outside_ the target domain has to be provided by the user.
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ExtendableGrids"
uuid = "cfc395e8-590f-11e8-1f13-43a2532b2fa8"
authors = ["Juergen Fuhrmann <juergen.fuhrmann@wias-berlin.de>", "Christian Merdon <christian.merdon@wias-berlin.de>", "Johannes Taraz <johannes.taraz@gmail.com>", "Patrick Jaap <patrick.jaap@wias-berlin.de>"]
version = "1.17.0"
version = "1.17.1"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
17 changes: 12 additions & 5 deletions src/cellfinder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ Upon return, xref contains the barycentric coordinates of the point in the seque
!!! warning
Currently implemented for simplex grids only.
"""
function gFindLocal!(xref, CF::CellFinder{Tv, Ti}, x; icellstart = 1, stay_in_cell = false, trybrute = true, eps = 1.0e-14) where {Tv, Ti}
function gFindLocal!(
xref,
CF::CellFinder{Tv, Ti},
x;
icellstart = Ti(1),
stay_in_cell = false,
trybrute = true,
eps = 1.0e-14
)::Ti where {Tv, Ti}
# works for convex domains and simplices only !
xCellFaces::Adjacency{Ti} = CF.xCellFaces
xFaceCells::Adjacency{Ti} = CF.xFaceCells
Expand All @@ -104,7 +112,7 @@ function gFindLocal!(xref, CF::CellFinder{Tv, Ti}, x; icellstart = 1, stay_in_ce
cx::Vector{Tv} = CF.cx
cEG::Int = 0
facetogo::Array{Array{Ti, 1}, 1} = CF.facetogo
icell::Int = icellstart
icell::Ti = icellstart
previous_cells::Array{Ti, 1} = CF.previous_cells
fill!(previous_cells, 0)
xreftest::Array{Tv, 1} = CF.xreftest
Expand Down Expand Up @@ -201,7 +209,7 @@ Upon return, xref contains the barycentric coordinates of the point in the seque
Currently implemented for simplex grids only.

"""
function gFindBruteForce!(xref, CF::CellFinder{Tv, Ti}, x; eps = 1.0e-14) where {Tv, Ti}
function gFindBruteForce!(xref, CF::CellFinder{Tv, Ti}, x; eps = 1.0e-14)::Ti where {Tv, Ti}

cx::Vector{Tv} = CF.cx
cEG::Int = 0
Expand All @@ -213,7 +221,7 @@ function gFindBruteForce!(xref, CF::CellFinder{Tv, Ti}, x; eps = 1.0e-14) where
invA::Matrix{Tv} = CF.invA
imin::Int = 0

for icell in 1:num_sources(CF.xgrid[CellNodes])
for icell::Ti in 1:num_sources(CF.xgrid[CellNodes])

# find current cell geometry index
cEG = 1
Expand Down Expand Up @@ -257,7 +265,6 @@ function gFindBruteForce!(xref, CF::CellFinder{Tv, Ti}, x; eps = 1.0e-14) where
return 0
end


"""
interpolate!(u_to,grid_to, u_from, grid_from;eps=1.0e-14,trybrute=true)

Expand Down
24 changes: 12 additions & 12 deletions src/l2gtransformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Transforms reference coordinates to global coordinates
"""
mutable struct L2GTransformer{Tv <: Real, Ti <: Integer, EG <: AbstractElementGeometry, CS <: AbstractCoordinateSystem}
citem::Int
citem::Ti
nonlinear::Bool # so that users know if derivatives of map change in every quadrature point of cell or not
Coords::Array{Tv, 2}
Nodes::Adjacency{Ti}
Expand All @@ -39,12 +39,12 @@ function L2GTransformer(EG::Union{Type{<:Tetrahedron3D}, Type{<:Parallelepiped3D
return L2GTransformer{Tv, Ti, EG, grid[CoordinateSystem]}(0, false, grid[Coordinates], grid[GridComponentNodes4AssemblyType(AT)], grid[GridComponentVolumes4AssemblyType(AT)], A, b, zeros(Tv, 3, 3), 0)
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Vertex0D, Cartesian1D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Vertex0D, Cartesian1D}, item) where {Ti}
T.b[1] = T.Coords[1, T.Nodes[1, item]]
return nothing
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Edge1D, Cartesian1D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Edge1D, Cartesian1D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand All @@ -54,7 +54,7 @@ function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Edge1D, Cartesian1
return nothing
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Edge1D, Cartesian2D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Edge1D, Cartesian2D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand All @@ -66,7 +66,7 @@ function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Edge1D, Cartesian2
return nothing
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Edge1D, Cartesian3D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Edge1D, Cartesian3D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand All @@ -80,7 +80,7 @@ function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Edge1D, Cartesian3
return nothing
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Triangle2D, Cartesian2D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Triangle2D, Cartesian2D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand All @@ -94,7 +94,8 @@ function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Triangle2D, Cartes
return nothing
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Parallelogram2D, Cartesian2D}, item::Int)

function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Parallelogram2D, Cartesian2D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand All @@ -108,7 +109,7 @@ function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Parallelogram2D, C
return nothing
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Triangle2D, Cartesian3D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Triangle2D, Cartesian3D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand All @@ -125,7 +126,7 @@ function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Triangle2D, Cartes
return nothing
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Parallelogram2D, Cartesian3D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Parallelogram2D, Cartesian3D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand All @@ -142,8 +143,7 @@ function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Parallelogram2D, C
return nothing
end


function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Tetrahedron3D, Cartesian3D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Tetrahedron3D, Cartesian3D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand All @@ -163,7 +163,7 @@ function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Tetrahedron3D, Car
return nothing
end

function update_trafo!(T::L2GTransformer{<:Real, <:Integer, <:Parallelepiped3D, Cartesian3D}, item::Int)
function update_trafo!(T::L2GTransformer{<:Real, Ti, <:Parallelepiped3D, Cartesian3D}, item) where {Ti}
if T.citem != item
T.citem = item
T.b[1] = T.Coords[1, T.Nodes[1, item]]
Expand Down
Loading