Skip to content

Commit

Permalink
Feature GMT: whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ljcarlin committed Feb 4, 2024
1 parent 446b91a commit 4cc342b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
32 changes: 16 additions & 16 deletions example/gmt/gmt2.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
*/

/** \file gmt2.c
*
*
* Search based refinement. There are 3 models: synthetic, sphere and latlong.
*
*
* Usage of the sphere model follows the following pipeline.
* -# Prepare a csv file of geodesics, following the convention described
* in \ref sphere_preprocessing.c . Note that world-map datasets frequently
* come in .shp files. The raw line geodesic data can be extracted from
* these easily using the python geopandas library. However, there is
* these easily using the python geopandas library. However, there is
* currently only limited library support for .shp files in C.
* -# Run the preprocessing script as described in \ref sphere_preprocessing.c
* -# Run the sphere model:
* -# Run the sphere model:
* p4est_gmt --sphere -r <max refinement> -F <output of preprocessing>
*/

Expand Down Expand Up @@ -63,7 +63,7 @@ typedef struct global
global_t;

static int
setup_model (global_t *g)
setup_model (global_t * g)
{
/* this function populates the model on successful initialization */
P4EST_ASSERT (g->model == NULL);
Expand Down Expand Up @@ -109,22 +109,22 @@ setup_model (global_t *g)
}

static void
quad_init (p4est_t *p4est,
p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
quad_init (p4est_t * p4est,
p4est_topidx_t which_tree, p4est_quadrant_t * quadrant)
{
quadrant->p.user_int = 0;
}

static int
quad_refine (p4est_t *p4est,
p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
quad_refine (p4est_t * p4est,
p4est_topidx_t which_tree, p4est_quadrant_t * quadrant)
{
return quadrant->p.user_int;
}

static int
quad_point (p4est_t *p4est,
p4est_topidx_t which_tree, p4est_quadrant_t *quadrant,
quad_point (p4est_t * p4est,
p4est_topidx_t which_tree, p4est_quadrant_t * quadrant,
p4est_locidx_t local_num, void *point)
{
int result;
Expand Down Expand Up @@ -163,7 +163,7 @@ quad_point (p4est_t *p4est,
}

void
run_program (global_t *g)
run_program (global_t * g)
{
int refiter;
size_t zz;
Expand Down Expand Up @@ -220,7 +220,7 @@ run_program (global_t *g)
}

static int
usagerrf (sc_options_t *opt, const char *fmt, ...)
usagerrf (sc_options_t * opt, const char *fmt, ...)
{
va_list ap;
char msg[BUFSIZ];
Expand All @@ -236,7 +236,7 @@ usagerrf (sc_options_t *opt, const char *fmt, ...)
}

static int
usagerr (sc_options_t *opt, const char *msg)
usagerr (sc_options_t * opt, const char *msg)
{
return usagerrf (opt, "%s", msg);
}
Expand Down Expand Up @@ -277,9 +277,9 @@ main (int argc, char **argv)
"Choose specific latitude-longitude model");
sc_options_add_bool (opt, 'W', "sphere", &g->sphere, 0, "Use sphere model");
sc_options_add_string (opt, 'F', "in-filename", &g->input_filename, NULL,
"Choose model-specific input file name");
"Choose model-specific input file name");
sc_options_add_string (opt, 'O', "out-prefix", &g->output_prefix, NULL,
"Choose prefix for output file(s)");
"Choose prefix for output file(s)");

/* proceed in run-once loop for cleaner error checking */
ue = 0;
Expand Down
10 changes: 5 additions & 5 deletions example/gmt/gmt_models.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "gmt_models.h"

static void
model_set_geom (p4est_gmt_model_t *model,
model_set_geom (p4est_gmt_model_t * model,
const char *name, p4est_geometry_X_t X)
{
model->sgeom.name = name;
Expand Down Expand Up @@ -92,7 +92,7 @@ model_synth_intersect (p4est_topidx_t which_tree, const double coord[4],
}

static void
model_synth_geom_X (p4est_geometry_t *geom, p4est_topidx_t which_tree,
model_synth_geom_X (p4est_geometry_t * geom, p4est_topidx_t which_tree,
const double abc[3], double xyz[3])
{
/* In this model we have only one tree, the unit square. */
Expand Down Expand Up @@ -156,7 +156,7 @@ model_latlong_intersect (p4est_topidx_t which_tree, const double coord[4],
}

static void
model_latlong_geom_X (p4est_geometry_t *geom, p4est_topidx_t which_tree,
model_latlong_geom_X (p4est_geometry_t * geom, p4est_topidx_t which_tree,
const double abc[3], double xyz[3])
{
#if LATLONG_DATA_HAS_BEEN_PROGRAMMED
Expand All @@ -177,7 +177,7 @@ model_latlong_geom_X (p4est_geometry_t *geom, p4est_topidx_t which_tree,
}

p4est_gmt_model_t *
p4est_gmt_model_latlong_new (p4est_gmt_model_latlong_params_t *params)
p4est_gmt_model_latlong_new (p4est_gmt_model_latlong_params_t * params)
{
p4est_gmt_model_t *model = P4EST_ALLOC_ZERO (p4est_gmt_model_t, 1);

Expand Down Expand Up @@ -406,7 +406,7 @@ p4est_gmt_model_sphere_new (int resolution, const char *input,
}

void
p4est_gmt_model_destroy (p4est_gmt_model_t *model)
p4est_gmt_model_destroy (p4est_gmt_model_t * model)
{
if (model->destroy_data != NULL) {
/* only needed for non-trivial free code */
Expand Down
10 changes: 8 additions & 2 deletions example/gmt/gmt_models.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ p4est_gmt_model_latlong_params_t;
p4est_gmt_model_t *p4est_gmt_model_latlong_new
(p4est_gmt_model_latlong_params_t * params);

/** Represents a segment of a geodesic in the sphere model.
*
* Segments are restricted to lying on a single face of the cube-sphere.
* A segment is represented by its endpoints, given in tree-local
* reference coordinates.
*/
typedef struct p4est_gmt_sphere_geoseg
{
p4est_topidx_t which_tree;
Expand All @@ -81,13 +87,13 @@ typedef struct p4est_gmt_sphere_geoseg
p4est_gmt_sphere_geoseg_t;

/** Create a specific sphere model.
*
*
* The sphere model refines a spherical mesh based on geodesics. More
* specifically, squares in the mesh are recursively refined as long as they
* intersect a geodesic and have refinement level less than the desired
* resolution. An example application is refining a map of the globe based on
* coastlines.
*
*
* \warning Before running this function the preprocessing script
* \ref sphere_preprocessing.c must be called.
*
Expand Down

0 comments on commit 4cc342b

Please sign in to comment.