(regrid)
Free the underlying Fortran array to avoid memory leak.

    After calling ``destroy()`` on regrid or its fields, we cannot use the
    regrid method anymore, but the input and output data still exist.

    Parameters
    ----------
    regrid : ESMF.Regrid object
Free the underlying Fortran array to avoid memory leak.
Free the underlying Fortran array to avoid memory leak .
def esmf_regrid_finalize(regrid):
    '''
    Free the underlying Fortran array to avoid memory leak.

    After calling ``destroy()`` on regrid or its fields, we cannot use the
    regrid method anymore, but the input and output data still exist.

    Parameters
    ----------
    regrid : ESMF.Regrid object

    '''

    regrid.destroy()
    regrid.srcfield.destroy()
    regrid.dstfield.destroy()
    regrid.srcfield.grid.destroy()
    regrid.dstfield.grid.destroy()

    # double check
    assert regrid.finalized
    assert regrid.srcfield.finalized
    assert regrid.dstfield.finalized
    assert regrid.srcfield.grid.finalized
    assert regrid.dstfield.grid.finalized
def esmf_regrid_finalize ( regrid ) : regrid . destroy ( ) regrid . srcfield . destroy ( ) regrid . dstfield . destroy ( ) regrid . srcfield . grid . destroy ( ) regrid . dstfield . grid . destroy ( ) # double check assert regrid . finalized assert regrid . srcfield . finalized assert regrid . dstfield . finalized assert regrid . srcfield . grid . finalized assert regrid . dstfield . grid . finalized