Skip to content

Call check_grid when new grids are created #655

Open

Description

@fhagemann

SSD defines the function check_grid to check if a grid has the correct number of ticks required for the potential calculation, but never actually calls that function anywhere:

function check_grid(grid::CylindricalGrid{T})::Nothing where {T}
nr::Int, nφ::Int, nz::Int = size(grid)
@assert iseven(nz) "GridError: Field simulation algorithm in cylindrical coordinates needs an even number of grid points in z. This is not the case. #z-ticks = $(nz)."
@assert (iseven(nφ) || (nφ == 1)) "GridError: Field simulation algorithm in cylindrical coordinates needs an even number of grid points in φ or just one point (2D). This is not the case. #φ-ticks = $(nφ)."
return nothing
end
function check_grid(grid::CartesianGrid3D{T})::Nothing where {T}
nx::Int, ny::Int, nz::Int = size(grid)
@assert iseven(nx) "GridError: Field simulation algorithm in cartesian coordinates needs an even number of grid points in x. This is not the case. #x-ticks = $(nx)."
return nothing
end

We should make sure that this is called in relevant places (which could have saved some time in the past, e.g. here: #594 (comment) 😅)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions