Skip to content

Weird control flow in gFindLocal #91

Description

@pjaap

In

if icell == previous_cells[end]
to some weird control flow with the boolean trybrute.

It appears in multiple mutually exclusive if clauses.

Probably the code should be like

        if icell == previous_cells[end]
            icell = xFaceCells[2, xCellFaces[facetogo[cEG][imin], icell]]
            if icell == 0
                if trybrute
                    return gFindBruteForce!(xref, CF, x; eps)
                else
                    @debug  "could not find point in any cell and ended up at boundary of domain (maybe x lies outside of the domain ?)"
                    return 0
                end
            end
        end

        if icell == previous_cells[end - 1]
            if trybrute
                return gFindBruteForce!(xref, CF, x; eps)
            else
                @debug  "could not find point in any cell and ended up at boundary of domain (maybe x lies outside of the domain ?)"
                return 0
            end
        end 

One can maybe put the duplicated if trybrute blocks in a local function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions