Пример #1
0
void test_create( const ecl_grid_type * grid , ecl_kw_type * fault_block_kw) {
  int k = 0;
  int i,j;
  
  for (j=0; j < ecl_grid_get_ny( grid ); j++) {
    for (i = 0; i < ecl_grid_get_nx( grid ); i++) {
      
      int g = ecl_grid_get_global_index3( grid , i,j,k);
      ecl_kw_iset_int( fault_block_kw , g , 9 );
    }
  }

  {
    fault_block_layer_type * layer = fault_block_layer_alloc( grid , k );
    test_assert_int_equal( 1 , fault_block_layer_get_next_id( layer ));
    fault_block_layer_scan_kw( layer , fault_block_kw);
    {
      fault_block_type * block = fault_block_layer_iget_block( layer , 0 );
      double x,y,z;
      ecl_grid_get_xyz3( grid , 4,4,k , &x, &y , &z );
      test_assert_double_equal( x , fault_block_get_xc( block ));
      test_assert_double_equal( y , fault_block_get_yc( block ));
    }
    
    fault_block_layer_free( layer );
  }
}
Пример #2
0
void test_create( const ecl_grid_type * grid , const ecl_kw_type * fault_block_kw) {
  test_assert_NULL( fault_block_layer_alloc( grid ,  -1 ));
  test_assert_NULL( fault_block_layer_alloc( grid ,  ecl_grid_get_nz( grid )));
  
  { 
    int k;
    for (k = 0; k < ecl_grid_get_nz( grid ); k++) {
      fault_block_layer_type * layer = fault_block_layer_alloc( grid , k);
      test_assert_true( fault_block_layer_is_instance( layer ));
      
      fault_block_layer_scan_kw( layer , fault_block_kw);
      {
        int max_block_id = fault_block_layer_get_max_id( layer ); 
        int block_id;

        for (block_id = 0; block_id <= max_block_id; block_id++) {
          if (fault_block_layer_has_block( layer , block_id)) {
            fault_block_type * block = fault_block_layer_get_block( layer , block_id );
            fault_block_get_xc( block );
            fault_block_get_yc( block );
          }
        }
      }
      
      {
        int index;
        for (index = 0; index < fault_block_layer_get_size( layer ); index++) {
          fault_block_type * block = fault_block_layer_iget_block( layer , index );
          fault_block_get_xc( block );
          fault_block_get_yc( block );
        }
      }
      
      fault_block_layer_free( layer );
    }
  }
}