Actual source code: ex13.c

  1: static char help[] = "Create a Plex Schwarz P surface with quads\n\n";

  3: #include <petscdmplex.h>

  5: int main(int argc, char **argv)
  6: {
  7:   DM             dm;
  8:   PetscInt       extent[3] = {1,1,1}, refine = 0, layers = 0, three;
  9:   PetscReal      thickness = 0.;
 10:   PetscBool      distribute = PETSC_TRUE;
 11:   DMBoundaryType periodic[3] = {DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE};
 12:   DMPlexTPSType  tps_type = DMPLEX_TPS_SCHWARZ_P;

 15:   PetscInitialize(&argc, &argv, NULL,help);
 16:   PetscOptionsBegin(PETSC_COMM_WORLD, NULL, "Schwarz P Example", NULL);
 17:   PetscOptionsIntArray("-extent", "Number of replicas for each of three dimensions", NULL, extent, (three=3, &three), NULL);
 18:   PetscOptionsInt("-refine", "Number of refinements", NULL, refine, &refine, NULL);
 19:   PetscOptionsEnumArray("-periodic", "Periodicity in each of three dimensions", NULL, DMBoundaryTypes, (PetscEnum*)periodic, (three=3, &three), NULL);
 20:   PetscOptionsBool("-distribute", "Distribute TPS manifold prior to refinement and extrusion", NULL, distribute, &distribute, NULL);
 21:   PetscOptionsInt("-layers", "Number of layers in volumetric extrusion (or zero to not extrude)", NULL, layers, &layers, NULL);
 22:   PetscOptionsReal("-thickness", "Thickness of volumetric extrusion", NULL, thickness, &thickness, NULL);
 23:   PetscOptionsEnum("-tps_type", "Type of triply-periodic surface", NULL, DMPlexTPSTypes, (PetscEnum)tps_type, (PetscEnum*)&tps_type, NULL);
 24:   PetscOptionsEnd();
 25:   DMPlexCreateTPSMesh(PETSC_COMM_WORLD, tps_type, extent, periodic, distribute, refine, layers, thickness, &dm);
 26:   PetscObjectSetName((PetscObject)dm, "TPS");
 27:   DMViewFromOptions(dm, NULL, "-dm_view");
 28:   DMDestroy(&dm);
 29:   PetscFinalize();
 30:   return 0;
 31: }

 33: /*TEST

 35:   test:
 36:     suffix: 0
 37:     args: -extent 1,2,3 -dm_view -refine 0
 38:   test:
 39:     suffix: 1
 40:     args: -extent 2,3,1 -dm_view -refine 1

 42:   test:
 43:     suffix: gyroid_0
 44:     args: -extent 1,2,3 -dm_view -refine 0 -tps_type gyroid
 45:   test:
 46:     suffix: gyroid_1
 47:     args: -extent 2,3,1 -dm_view -refine 1 -tps_type gyroid
 48:   test:
 49:     suffix: extrude_0
 50:     args: -extent 2,3,1 -dm_view -refine 0 -layers 3 -thickness .2
 51:   test:
 52:     suffix: extrude_1_dist
 53:     nsize: 2
 54:     args: -extent 2,1,1 -dm_view -refine 1 -layers 3 -thickness .2

 56: TEST*/