Example #1
0
int main(int argc , char ** argv) {
    FILE * stream = util_fopen( argv[1] , "r");
    ecl_kw_type * gridhead_kw = ecl_kw_fscanf_alloc_grdecl_dynamic__( stream , SPECGRID_KW , false , ECL_INT_TYPE );
    ecl_kw_type * zcorn_kw    = ecl_kw_fscanf_alloc_grdecl_dynamic( stream , ZCORN_KW  , ECL_FLOAT_TYPE );
    ecl_kw_type * coord_kw    = ecl_kw_fscanf_alloc_grdecl_dynamic( stream , COORD_KW  , ECL_FLOAT_TYPE );
    ecl_kw_type * actnum_kw   = ecl_kw_fscanf_alloc_grdecl_dynamic( stream , ACTNUM_KW , ECL_INT_TYPE );

    {
        int nx = ecl_kw_iget_int( gridhead_kw , SPECGRID_NX_INDEX );
        int ny = ecl_kw_iget_int( gridhead_kw , SPECGRID_NY_INDEX );
        int nz = ecl_kw_iget_int( gridhead_kw , SPECGRID_NZ_INDEX );
        ecl_grid_type * ecl_grid = ecl_grid_alloc_GRDECL_kw( nx , ny , nz, zcorn_kw, coord_kw , actnum_kw , NULL );
        /* .... */
        ecl_grid_free( ecl_grid );
    }
    ecl_kw_free( gridhead_kw );
    ecl_kw_free( zcorn_kw );
    ecl_kw_free( actnum_kw );
    ecl_kw_free( coord_kw );
    fclose( stream );
}
Example #2
0
//--------------------------------------------------------------------------------------------------
/// Reads the property data requested into the \a reservoir, overwriting any previous 
/// properties with the same name.
//--------------------------------------------------------------------------------------------------
bool RifEclipseInputFileTools::readProperty(const QString& fileName, RigEclipseCaseData* caseData, const QString& eclipseKeyWord, const QString& resultName)
{
    CVF_ASSERT(caseData);

    if (!isValidDataKeyword(eclipseKeyWord)) return false;

    FILE* filePointer = util_fopen(fileName.toLatin1().data(), "r");
    if (!filePointer) return false;

    ecl_kw_type* eclipseKeywordData = ecl_kw_fscanf_alloc_grdecl_dynamic__(filePointer, eclipseKeyWord.toLatin1().data(), false, ecl_type_create_from_type(ECL_FLOAT_TYPE));
    bool isOk = false;
    if (eclipseKeywordData)
    {
        isOk = readDataFromKeyword(eclipseKeywordData, caseData, resultName);

        ecl_kw_free(eclipseKeywordData);
    }

    util_fclose(filePointer);

    return isOk;
}
ecl_kw_type * ecl_kw_fscanf_alloc_grdecl_dynamic( FILE * stream , const char * kw , ecl_type_enum ecl_type) {
  bool strict = true;
  return ecl_kw_fscanf_alloc_grdecl_dynamic__( stream , kw , strict , ecl_type );
}