Пример #1
0
PetscErrorCode MatPartitioningSetFromOptions_Scotch(MatPartitioning part)
{
    PetscErrorCode ierr;
    PetscTruth flag;
    char name[PETSC_MAX_PATH_LEN];
    int i;
    PetscReal r;

    const char *global[] = { "greedy", "gps", "gr_gps" };
    const char *local[] = { "kernighan-lin", "none" };

    PetscFunctionBegin;
    ierr = PetscOptionsHead("Set Scotch partitioning options");CHKERRQ(ierr);

    ierr = PetscOptionsEList("-mat_partitioning_scotch_global",
        "Global method to use", "MatPartitioningScotchSetGlobal", global, 3,
        global[0], &i, &flag);CHKERRQ(ierr);
    if (flag) {
      ierr = MatPartitioningScotchSetGlobal(part, (MPScotchGlobalType)i);CHKERRQ(ierr);
    }

    ierr = PetscOptionsEList("-mat_partitioning_scotch_local",
        "Local method to use", "MatPartitioningScotchSetLocal", local, 2,
        local[0], &i, &flag);CHKERRQ(ierr);
    if (flag) {
      ierr = MatPartitioningScotchSetLocal(part, (MPScotchLocalType)i);CHKERRQ(ierr);
    }

    flag = PETSC_FALSE;
    ierr = PetscOptionsTruth("-mat_partitioning_scotch_mapping", "Use mapping","MatPartitioningScotchSetMapping", flag,&flag,PETSC_NULL);CHKERRQ(ierr);
    if (flag) {
      ierr = MatPartitioningScotchSetMapping(part);CHKERRQ(ierr);
    }

    ierr = PetscOptionsString("-mat_partitioning_scotch_arch",
        "architecture file in scotch format", "MatPartitioningScotchSetArch",
        "archgraph.src", name, PETSC_MAX_PATH_LEN, &flag);CHKERRQ(ierr);
    if (flag)
        ierr = MatPartitioningScotchSetArch(part, name);CHKERRQ(ierr);

    ierr = PetscOptionsString("-mat_partitioning_scotch_hosts",
        "host list filename", "MatPartitioningScotchSetHostList",
        "host_list", name, PETSC_MAX_PATH_LEN, &flag);CHKERRQ(ierr);
    if (flag)
        ierr = MatPartitioningScotchSetHostList(part, name);CHKERRQ(ierr);

    ierr = PetscOptionsReal("-mat_partitioning_scotch_coarse_level",
        "coarse level", "MatPartitioningScotchSetCoarseLevel", 0, &r,
        &flag);CHKERRQ(ierr);
    if (flag)
        ierr = MatPartitioningScotchSetCoarseLevel(part, r);CHKERRQ(ierr);

    flag = PETSC_FALSE;
    ierr = PetscOptionsTruth("-mat_partitioning_scotch_mul", "Use coarse level","MatPartitioningScotchSetMultilevel", flag,&flag,PETSC_NULL);CHKERRQ(ierr);
    if (flag) {
      ierr = MatPartitioningScotchSetMultilevel(part);CHKERRQ(ierr);
    }

    ierr = PetscOptionsString("-mat_partitioning_scotch_strategy",
        "Scotch strategy string",
        "MatPartitioningScotchSetStrategy", "", name, PETSC_MAX_PATH_LEN,
        &flag);CHKERRQ(ierr);
    if (flag)
        ierr = MatPartitioningScotchSetStrategy(part, name);CHKERRQ(ierr);

    ierr = PetscOptionsTail();CHKERRQ(ierr);
    PetscFunctionReturn(0);
}
Пример #2
0
void PETSC_STDCALL   matpartitioningscotchsetmapping_(MatPartitioning part, int *__ierr ){
*__ierr = MatPartitioningScotchSetMapping(
	(MatPartitioning)PetscToPointer((part) ));
}