Skip to content

Commit

Permalink
Feature GMT: tweak example programs
Browse files Browse the repository at this point in the history
  • Loading branch information
cburstedde committed Feb 15, 2024
1 parent 2ae2d94 commit 85e3de9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 3 additions & 4 deletions example/gmt/gmt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ main (int argc, char **argv)
ue = usagerrf (opt, "maxlevel not between minlevel and %d",
P4EST_QMAXLEVEL);
}
if (g->synthetic >= 0 ? (g->latlongno >= 0 || g->sphere == 1)
: (g->latlongno >= 0 && g->sphere == 1)
if (g->synthetic >= 0 ? (g->latlongno >= 0 || g->sphere)
: (g->latlongno >= 0 && g->sphere)
) {
ue =
usagerrf (opt,
"set only one of the synthetic, sphere and latlong models");
}
if (g->synthetic < 0 && g->latlongno < 0 && g->sphere == 0) {
if (g->synthetic < 0 && g->latlongno < 0 && !g->sphere) {
ue =
usagerrf (opt,
"set one of the synthetic, sphere, and latlong models");
Expand All @@ -334,7 +334,6 @@ main (int argc, char **argv)

/* cleanup application model */
if (g->model != NULL) {
p4est_connectivity_destroy (g->model->conn);
p4est_gmt_model_destroy (g->model);
}

Expand Down
3 changes: 3 additions & 0 deletions example/gmt/gmt_models.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ static int
model_latlong_intersect (p4est_topidx_t which_tree, const double coord[4],
size_t m, void *vmodel)
{
#ifdef P4EST_ENABLE_DEBUG
p4est_gmt_model_t *model = (p4est_gmt_model_t *) vmodel;
#endif

P4EST_ASSERT (model != NULL);
P4EST_ASSERT (m < model->M);
Expand Down Expand Up @@ -453,5 +455,6 @@ p4est_gmt_model_destroy (p4est_gmt_model_t * model)
P4EST_FREE (model->model_data);
}
p4est_geometry_destroy (model->model_geom);
p4est_connectivity_destroy (model->conn);
P4EST_FREE (model);
}
3 changes: 2 additions & 1 deletion example/gmt/sphere_preprocessing.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,10 @@ main (int argc, char **argv)
mpiret = sc_MPI_Init (&argc, &argv);
SC_CHECK_MPI (mpiret);

/* default communicator used for logging */
/* default communicator and packages used for logging */
mpicomm = sc_MPI_COMM_WORLD;
sc_init (mpicomm, 1, 1, NULL, SC_LP_DEFAULT);
p4est_init (NULL, SC_LP_DEFAULT);

/* Get rank and number of processes */
mpiret = sc_MPI_Comm_size (mpicomm, &num_procs);
Expand Down

0 comments on commit 85e3de9

Please sign in to comment.