Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop Processing if COPYing From Undefined Source Array #4109

Merged
merged 5 commits into from
Aug 20, 2024

Commits on Aug 20, 2024

  1. Add New Status Verification Overload to FieldDataManager

    This overload includes more context and enables generating more
    descriptive diagnostic messages.
    bska committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    3637cf7 View commit details
    Browse the repository at this point in the history
  2. Lay Foundation for More Strict Array Operations

    This commit makes the backend implementations of ADD, MULTIPLY, &c
    capable of halting processing if we encounter any undefined source
    elements.  We nevertheless maintain the definition of "defined" as
    
        value::has_value()
    
    (from the value_status.hpp header), at least for the time being, as
    changing the definition requires making more parts of the array
    processing aware of the currently active section.
    
    The new helper function reject_undefined_operation() will throw an
    OpmInputError exception with (hopefully) enough context that fixing
    the input will be easier.
    
    While here, make the apply() function private to the FieldProps.cpp
    implementation file.  It was already marked 'static' and does not
    need access to any of the FieldProps data members.
    bska committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    851c8ea View commit details
    Browse the repository at this point in the history
  3. Stop Processing if COPYing From Undefined Source Array

    This commit adds defined value checking to the source array from
    which we're copying in a COPY operation--either with the COPY or
    with the COPYREG keywords.  We count the number of source array
    values which do not have the status of 'deck_value' and if this
    count is positive, then we throw an OpmInputError exception which
    halts further input processing.
    
    As an example of this behaviour, the (deliberately faulty) setup
    
        EQUALS
        -- SGL not defined prior to this point
         'SGL' 0.0 2* 2* 1 5 /
        /
    
        COPY
          SGL SWL 2* 2* 4 7 /
        /
    
    will generate an "Error" of the form
    
        Error: Problem with keyword COPY
        In USER_ERR_COPY_BOX_PARTIALLY_UNDEF.DATA line 195
        Copying from source array SGL in BOX (1-13, 1-22, 4-7)
        would generate an undefined result in 572 blocks of target array SWL.
    
    and stop input processing.
    bska committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    17e5b4c View commit details
    Browse the repository at this point in the history
  4. Add Existence Check for Array Operations

    For operations other than assignment (EQUALS keyword), this commit
    ensures that the array being mutated already exists in the input.
    In particular, this means that a request of the form
    
        ADD
          SGU 0.123 /
        /
    
    will halt input processing and generate an "Error" of the form
    
        Error: Problem with keyword ADD
        In USER_ERR_ADD.DATA line 202
        Target array SGU must already exist when operated upon in ADD.
    
    unless the 'SGU' array has already been assigned earlier.
    
    To this end, repurpose the second parameter to member function
    
        FieldProps::try_get<>()
    
    and make this a bitmask of flags instead of a single 'bool'.  The
    currently supported flags are 'AllowUnsupported' and 'MustExist'
    with the former representing the original 'bool' parameter and the
    second requesting that the property array must already exist for the
    request to succeed.
    bska committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    90be095 View commit details
    Browse the repository at this point in the history
  5. Address PR Review Comments

    In particular,
    
      1. Replace if/else chain by switch
      2. Replace 'well formed' with 'fully defined' in documentation
    bska committed Aug 20, 2024
    Configuration menu
    Copy the full SHA
    eb23b95 View commit details
    Browse the repository at this point in the history