コード例 #1
0
ファイル: loadconn2.c プロジェクト: cburstedde/p4est
int
main (int argc, char **argv)
{
  sc_MPI_Comm         mpicomm;
  int                 mpiret, retval;
  int                 level;
  const char         *filename;
  p4est_connectivity_t *conn;
  sc_options_t       *opt;

  mpiret = sc_MPI_Init (&argc, &argv);
  SC_CHECK_MPI (mpiret);
  mpicomm = sc_MPI_COMM_WORLD;

  sc_init (sc_MPI_COMM_WORLD, 1, 1, NULL, SC_LP_DEFAULT);
  p4est_init (NULL, SC_LP_DEFAULT);

  opt = sc_options_new (argv[0]);
  sc_options_add_int (opt, 'l', "level", &level, 0,
                      "Upfront refinement level");
  retval = sc_options_parse (p4est_package_id, SC_LP_ERROR, opt, argc, argv);
  if (retval == -1 || retval + 1 != argc) {
    sc_options_print_usage (p4est_package_id, SC_LP_PRODUCTION, opt, NULL);
    sc_abort_collective ("Usage error");
  }
  filename = argv[retval];
  P4EST_LDEBUGF ("Loading %s\n", filename);
  conn = p4est_connectivity_load (filename, NULL);

  run_load (mpicomm, conn, level);

  p4est_connectivity_destroy (conn);
  sc_options_destroy (opt);

  sc_finalize ();

  mpiret = sc_MPI_Finalize ();
  SC_CHECK_MPI (mpiret);

  return 0;
}
コード例 #2
0
ファイル: bricks2.c プロジェクト: ChenShaoning/p4est
int
main (int argc, char **argv)
{
  MPI_Comm            mpicomm;
  int                 mpiret, retval;
  int                 rlevel, l;
  int                 periodic;
  sc_options_t       *opt;

  mpiret = MPI_Init (&argc, &argv);
  SC_CHECK_MPI (mpiret);
  mpicomm = MPI_COMM_WORLD;

  sc_init (MPI_COMM_WORLD, 1, 1, NULL, SC_LP_DEFAULT);
  p4est_init (NULL, SC_LP_DEFAULT);

  opt = sc_options_new (argv[0]);
  sc_options_add_int (opt, 'l', "level", &rlevel, 0,
                      "Upfront refinement level");
  sc_options_add_switch (opt, 'p', "periodic", &periodic,
                         "Periodic connectivity");
  retval = sc_options_parse (p4est_package_id, SC_LP_ERROR, opt, argc, argv);
  if (retval == -1 || retval < argc) {
    sc_options_print_usage (p4est_package_id, SC_LP_PRODUCTION, opt, NULL);
    sc_abort_collective ("Usage error");
  }

  for (l = 0; l <= rlevel; ++l) {
    run_bricks (mpicomm, periodic, l, rlevel);
  }

  sc_options_destroy (opt);

  sc_finalize ();

  mpiret = MPI_Finalize ();
  SC_CHECK_MPI (mpiret);

  return 0;
}