static VALUE group_range_excl(VALUE self, VALUE ary) { int rv, i, len, **ranks; MPI_Group *grp, *newgrp; Data_Get_Struct(self, MPI_Group, grp); newgrp = ALLOC(MPI_Group); len = RARRAY(ary)->len; ranks = ALLOCA_N(int *, len); for (i = 0; i < len; i++) { int j; VALUE range; range = rb_ary_entry(ary, i); ranks[i] = ALLOCA_N(int, 3); for (j = 0; j < 3; j++) ranks[i][j] = FIX2INT(rb_ary_entry(range, j)); } /* Thank you, cdecl */ rv = MPI_Group_range_excl(*grp, len, (int (*)[3])ranks, newgrp); mpi_exception(rv); return group_new(newgrp); }
static VALUE group_difference(VALUE self, VALUE rgrp2) { int rv; MPI_Group *grp1, *grp2, *newgrp; Data_Get_Struct(self, MPI_Group, grp1); Data_Get_Struct(grp2, MPI_Group, grp2); newgrp = ALLOC(MPI_Group); rv = MPI_Group_difference(*grp1, *grp2, newgrp); mpi_exception(rv); return group_new(newgrp); }
Group *group_new(MixGroup *mixgroup, int x, int y, int height) { int most_right_x = 0; MixList *iterator; MixExtension *ext; Control *control; Group *group = malloc(sizeof(*group)); assert(group != NULL); group->group = mixgroup; group->groups = NULL; mix_foreach(iterator, mix_group_get_groups(mixgroup)) { group->groups = mix_list_prepend(group->groups, (void *) group_new(iterator->data, x, y+1, height-1)); }
static VALUE group_excl(VALUE self, VALUE ary) { int rv, i, len, *ranks; MPI_Group *grp, *newgrp; Data_Get_Struct(self, MPI_Group, grp); newgrp = ALLOC(MPI_Group); len = RARRAY(ary)->len; ranks = ALLOCA_N(int, len); for (i = 0; i < len; i++) ranks[i] = FIX2INT(rb_ary_entry(ary, i)); rv = MPI_Group_excl(*grp, len, ranks, newgrp); mpi_exception(rv); return group_new(newgrp); }
char * group_create(struct ctl_group *ctl) { struct group *g; if ((g = group_new()) == NULL) return "out of memory"; strlcpy(g->name, ctl->name, sizeof g->name); g->next = group_use(&default_group); if (RB_FIND(group_tree, &groups, g)) { free(g); return "group already there"; } RB_INSERT(group_tree, &groups, g); log_debug("group created: %s", g->name); return NULL; }