Skip to content

Commit

Permalink
Reverted Macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Barbone committed May 10, 2024
1 parent fb562b8 commit de9ae8f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 41 deletions.
23 changes: 0 additions & 23 deletions include/finufft_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,6 @@
#ifndef FINUFFT_OPTS_H
#define FINUFFT_OPTS_H

// Marco Barbone: 5.8.2024
// These are user-facing to that the user can reset to the default value
// TODO: the various options could be macros so that the user does not need to
// look up documentation to change to another value
// Question: would these be be enums?

#define FINUFFT_MODEORD_DEFAULT (0)
#define FINUFFT_CHKBND_DEFAULT (1)

#define FINUFFT_DEBUG_DEFAULT (0)
#define FINUFFT_SPREAD_DEBUG_DEFAULT (0)
#define FINUFFT_SHOWWARN_DEFAULT (1)

#define FINUFFT_NTHREADS_DEFAULT (0)
#define FINUFFT_FFTW_DEFAULT (FFTW_ESTIMATE)
#define FINUFFT_SPREAD_SORT_DEFAULT (2)
#define FINUFFT_SPREAD_KEREVALMETH_DEFAULT (1)
#define FINUFFT_SPREAD_KERPAD_DEFAULT (1)
#define FINUFFT_UPSAMPFAC_DEFAULT (0.0)
#define FINUFFT_SPREAD_THREAD_DEFAULT (0)
#define FINUFFT_MAXBATCHSIZE_DEFAULT (0)
#define FINUFFT_SPREAD_NTHR_ATOMIC_DEFAULT (-1)
#define FINUFFT_SPREAD_MAX_SP_SIZE_DEFAULT (0)

typedef struct finufft_opts{ // defaults see finufft.cpp:finufft_default_opts()
// sphinx tag (don't remove): @opts_start
Expand Down
42 changes: 24 additions & 18 deletions src/finufft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ int setup_spreader_for_nufft(finufft_spread_opts &spopts, FLT eps, finufft_opts
spopts.atomic_threshold = opts.spread_nthr_atomic;
if (opts.spread_max_sp_size>0) // overrides
spopts.max_subproblem_size = opts.spread_max_sp_size;
if (opts.chkbnds != FINUFFT_CHKBND_DEFAULT) {
if (opts.chkbnds != 1) {
fprintf(stderr, "chkbnds options is deprecated, please use the default value\n");
// if other error occurred before this, return that error otherwise return a warning
if (!ier) {
Expand Down Expand Up @@ -527,6 +527,12 @@ int* GRIDSIZE_FOR_FFTW(FINUFFT_PLAN p){
// (not namespaced since have safe names finufft{f}_* )
using namespace finufft::common; // accesses routines defined above


// Marco Barbone: 5.8.2024
// These are user-facing.
// The various options could be macros to follow c standard library conventions.
// Question: would these be enums?

// OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
void FINUFFT_DEFAULT_OPTS(finufft_opts *o)
// Sets default nufft opts (referenced by all language interfaces too).
Expand All @@ -536,23 +542,23 @@ void FINUFFT_DEFAULT_OPTS(finufft_opts *o)
// Sphinx sucks the below code block into the web docs, hence keep it clean...
{
// sphinx tag (don't remove): @defopts_start
o->modeord = FINUFFT_MODEORD_DEFAULT;
o->chkbnds = FINUFFT_CHKBND_DEFAULT;

o->debug = FINUFFT_DEBUG_DEFAULT;
o->spread_debug = FINUFFT_SPREAD_DEBUG_DEFAULT;
o->showwarn = FINUFFT_SHOWWARN_DEFAULT;

o->nthreads = FINUFFT_NTHREADS_DEFAULT;
o->fftw = FINUFFT_FFTW_DEFAULT;
o->spread_sort = FINUFFT_SPREAD_SORT_DEFAULT;
o->spread_kerevalmeth = FINUFFT_SPREAD_KEREVALMETH_DEFAULT;
o->spread_kerpad = FINUFFT_SPREAD_KERPAD_DEFAULT;
o->upsampfac = FINUFFT_UPSAMPFAC_DEFAULT;
o->spread_thread = FINUFFT_SPREAD_THREAD_DEFAULT;
o->maxbatchsize = FINUFFT_MAXBATCHSIZE_DEFAULT;
o->spread_nthr_atomic = FINUFFT_SPREAD_NTHR_ATOMIC_DEFAULT;
o->spread_max_sp_size = FINUFFT_SPREAD_MAX_SP_SIZE_DEFAULT;
o->modeord = 0;
o->chkbnds = 1;

o->debug = 0;
o->spread_debug = 0;
o->showwarn = 1;

o->nthreads = 0;
o->fftw = FFTW_ESTIMATE; //
o->spread_sort = 2;
o->spread_kerevalmeth = 1;
o->spread_kerpad = 1;
o->upsampfac = 0.0;
o->spread_thread = 0;
o->maxbatchsize = 0;
o->spread_nthr_atomic = -1;
o->spread_max_sp_size = 0;
// sphinx tag (don't remove): @defopts_end
}

Expand Down

0 comments on commit de9ae8f

Please sign in to comment.