예제 #1
0
ih_box_cell_t *find_cell(ih_box_system_t *system,
    ih_box_coordinate_t *coordinate)
{
  assert(system);
  assert(coordinate);
  unsigned long cells_array_index;

  cells_array_index = get_cells_array_index(system, coordinate);
  return ih_container_array_find(system->cells, cells_array_index);
}
예제 #2
0
파일: system.c 프로젝트: clownfysh/cf
cf_inferno_box_cell_t *find_cell(cf_inferno_box_system_t *system,
    cf_inferno_box_coordinate_t *coordinate)
{
  assert(system);
  assert(coordinate);
  unsigned long cells_array_index;

  cells_array_index = get_cells_array_index(system, coordinate);
  return cf_x_case_array_find(system->cells, cells_array_index);
}
예제 #3
0
ih_core_bool_t create_cells(ih_box_system_t *system)
{
  assert(system);
  ih_core_bool_t success;
  ih_box_coordinate_t coordinate;
  ih_box_cell_t *cell;
  unsigned long cells_array_index;

  success = ih_core_bool_true;

  system->cells = ih_container_array_create(system->volume,
      ih_box_cell_compare, ih_box_cell_copy, ih_box_cell_destroy);
  if (system->cells) {
    for (coordinate.x = 0; coordinate.x < system->dimension_coordinate.x;
         coordinate.x++) {
      for (coordinate.y = 0; coordinate.y < system->dimension_coordinate.y;
           coordinate.y++) {
        for (coordinate.z = 0; coordinate.z < system->dimension_coordinate.z;
             coordinate.z++) {
          cell = ih_box_cell_create(system, &coordinate);
          if (cell) {
            cells_array_index = get_cells_array_index(system, &coordinate);
            ih_container_array_add(system->cells, cells_array_index, cell);
          } else {
            success = ih_core_bool_false;
            ih_audit_log_trace(system->log, "box", "ih_box_cell_create");
          }
        }
      }
    }
  } else {
    success = ih_core_bool_false;
    ih_audit_log_trace(system->log, "box", "ih_container_array_create");
  }

  return success;
}