예제 #1
0
파일: nnc_info.c 프로젝트: Ensembles/ert
void nnc_info_add_nnc(nnc_info_type * nnc_info, int lgr_nr, int global_cell_number, int nnc_index) {
  nnc_info_assert_vector( nnc_info , lgr_nr );
  {
    nnc_vector_type * nnc_vector = nnc_info_get_vector( nnc_info , lgr_nr );
    nnc_vector_add_nnc( nnc_vector , global_cell_number , nnc_index);
  }
}
예제 #2
0
int main(int argc , char ** argv) {
    int lgr_nr = 100;
    nnc_vector_type * vector = nnc_vector_alloc( lgr_nr );

    test_assert_true( nnc_vector_is_instance( vector ));
    test_assert_int_equal( lgr_nr , nnc_vector_get_lgr_nr( vector ));

    nnc_vector_add_nnc( vector , 100 );
    nnc_vector_add_nnc( vector , 200 );
    nnc_vector_add_nnc( vector , 300 );

    nnc_vector_add_nnc( vector , 100 );
    nnc_vector_add_nnc( vector , 200 );
    nnc_vector_add_nnc( vector , 300 );


    {
        const int_vector_type * index_list = nnc_vector_get_index_list( vector );

        test_assert_int_equal( 3 , int_vector_size( index_list ));
        test_assert_int_equal( 100 , int_vector_iget( index_list , 0 ));
        test_assert_int_equal( 200 , int_vector_iget( index_list , 1 ));
        test_assert_int_equal( 300 , int_vector_iget( index_list , 2 ));
    }

    nnc_vector_free( vector );
    exit(0);
}