# ----- MAKE FILE machine definitions (AddOns settings) -----
# Mario A. Rodriguez-Meza, Ciudad de Mexico, 5.05.2023
#
#

#B Set of settings
#
#B Here switch on/off the AddOns´ modules

$(info )
$(info =====================================================)

# OCTREEGGGOMP
# For computing 3pcf using octree-ggg-omp
#   still is in development phase.
ifeq ($(USEGSL),1)
OCTREEGGGOMPON = 1
else
ifeq ($(COMPLEXLIBON),1)
OCTREEGGGOMPON = 1
else
$(info To compile with OCTREEGGGOMP needs USEGSL/COMPLEXLIBON = 1, deactivating...)
# Note:
#                           testing without GSL !!!!!!!!!!!!!!!!!!!!!!!
OCTREEGGGOMPON = 1
endif
endif

# KDTREEOMP
# For computing 3pcf using kdtree-omp method
KDTREEOMPON = 1

# KDTREEBOXOMP
# For computing 2pcf using kdtree-box-omp methods
KDTREEBOXOMPON = 1

# NEIGHBORBOXESOMP
# For computing 2pcf using neighbor-boxes-omp method
NEIGHBORBOXESOMPON = 1

# Gadget I/O
# For input data catalog in gadget format
GADGETIOON = 1

# CLASSLIB
# Several I/O routines from CLASS
#   collision with GSL library. Set it off
#ifeq ($(USEGSL),0)
CLASSLIBON = 1
#else
#$(info CLASSLIB collide with GSL library, needs USEGSL = 0, deactivating...)
#$(info or compile with USEGSL = 1 and GSLINTERNAL = 1, deactivating...)
#ifeq ($(GSLINTERNAL),0)
# testing without GSLINTERNAL (=0), only USEGSL=1
#CLASSLIBON = 0
#CLASSLIBON = 1
#else
#$(info CLASSLIB does not collide with internal GSL library, activating...)
#CLASSLIBON = 1
#endif
#endif

# PXD
# For cython interfacing...
ifeq ($(CLASSLIBON),1)
#$(info Note: to use the Cython inferface (python cballys module), switch OFF USEGSL)
#$(info Note: or switch ON USEGSL)
#$(info Note:           and switch ON GSLINTERNAL)
PXDON = 1
else
#$(info Note: to use the Cython inferface (python cballys module), switch OFF USEGSL)
#$(info or switch ON USEGSL and switch ON GSLINTERNAL)
$(info To compile with PXD needs CLASSLIBON = 1, deactivating...)
PXDON = 0
endif

# IOLIB
# Several additional I/O routines
IOLIBON = 1

# CFITSIOLIB
# internal cfitsio lib.
#   Default is 0,
#   means you have to install cfitsio library by your self
#   or ask administrator to have it for you.
#   If set to 1,
#   no collision of CFITSIO addon with python interface
CFITSIOLIBON = 1

# CFITSIO
# To IO fits format
# This addon requires IOLIBON = 1, check it...
ifeq ($(IOLIBON),1)
# default is OFF.
# When user knows where cfitsio lib/include directories live,
#   make respective changes in Makefile_machine file
#   and then set it ON
# there is collision with python interface, default is OFF,
#   turn it ON if necessary
#ifeq ($(CFITSIOLIBON),0)
#ifeq ($(CLASSLIBON),0)
#CFITSIOON = 1
#else
#$(info To compile with CFITSIO needs CLASSLIBON = 0, deactivating CFITSIO...)
# testing without internal cfitsio lib...
#CFITSIOON = 0
#CFITSIOON = 1
#endif
#else
CFITSIOON = 1
#endif
else
$(info To compile with CFITSIO needs IOLIBON = 1, deactivating...)
CFITSIOON = 0
endif

#E Set of settings


############################
#B Special behavior settings
# In some searching methods
#   it will be possible to set the following flags

# smoothing pivot
# remember to use "options=smooth-pivot" in some addons,
#   like BALLSOMP, OCTREEKKKOMP, KDTREEBOXOMP, KDTREEOMP, NEIGHBORBOXOMP, OCTREEBOXOMP,
#       OCTREESINCOSOMP, TREEOMPSINCOS
# note that SMOOTHPIVOTON collide with ORIGINALCB (used in neighbor boxes method)
#   needs that ORIGINALCBON = 0 see below...
SMOOTHPIVOTON = 1
ifeq ($(SMOOTHPIVOTON),1)
OPT2 += -DSMOOTHPIVOT
# Compute and add pivot neighbours. Only active if SMOOTHPIVOT is ON
#ADDPIVOTNEIGHBOURSON = 0
endif
#

############################
# Nothing to do below, unless it is explicitly asked for
############################

# WKAvg switch...
# Default is 0. If set to 0 will give tests OK (./run_tests_all; ./run_all_tests_public)
NOWKAvgON = 0

# NMultipoles switch (multipoles for counting).
# Default is 1
NMultipolesON = 1

# NONORMHIST switch (do not use normalization of histograms).
#   If activated histograms can be saved
#   normalizing with monopole of N.
# Default is 1
NONORMHISTON = 1

# POLARAXIS switch (set north pole as the axis of reference...)
#   this is for pixel catalogs on the unit sphere: (0,0,1)
POLARAXISON = 0

# No Limber aproximation
NOLIMBERON = 0

# To remove overcounting pairs:
OVERCOUNTINGON = 0

# NOSTANDARNORMHISTON switch
#   If activated histograms are saved without normalization
#   only for kdtree-omp and tree-omp-sincos searching methods
# Default is 0
NOSTANDARNORMHISTON = 0

# CMDLINE_DEFS_UNITSPHERE
# set of useful default values for the unit sphere
CMDLINE_DEFS_UNITSPHERE_ON = 1

#B for some addons will be useful this switches
DEFINEFLAGS =
#
TWOPCFON = 1
ifeq ($(TWOPCFON),1)
OPT2 += -DTWOPCF
endif
TPCFON = 1
ifeq ($(TPCFON),1)
OPT2 += -DTHREEPCFCONVERGENCE
OPT2 += -DTPCF
endif
#
#OPT2 += -DTHREEPCFSHEAR
#
PRUNEON = 1
ifeq ($(PRUNEON),1)
OPT2 += -DPRUNING
endif
#
# will give the two balls condition...
#   needs that ORIGINALCBON = 0 see below...
BALLS4SCANLEVON = 0
#
#ifeq ($(BALLS4SCANLEVON),1)
# used in octree-ggg-omp when NORMALHISTSCALE is on
# THETA control (activated with options=behavior-ball):
#   the fraction of a bin width (deltaR) by which it is ok to let the pairs miss the correct bin.
#   the default is to use 1 if deltaR <= 0.1, or 0.1/deltaR if deltaR > 0.1.
# logscale: goodTHETA = 0.1 / deltaR
# normal scale: goodTHETA = 0.1 * (rminHist + deltaR/2) / deltaR
# THETA = MIN(goodTHETA, 1.0)
#THETA = 0 # will give no behavior-ball, but check 1/0 divergence
#THETA = 1 # the bin will incorrect by 1 bin width
THETA = 1.25
DEFINEFLAGS += -DTHETA=$(THETA)
#endif
#
# used in octree-ggg-omp, also THETA is used here
NORMALHISTSCALEON = 0
#
#B several definitions from/to cute-box Makefile
_DEBUGON_ = 0
LOGBINON = 0
# this is to recover some tests results
ORIGINALCBON = 0
ifeq ($(LOGBINON),1)
DEFINEFLAGS += -D_LOGBIN_
endif
# neighbor-boxes-omp run faster with this option
DEFINEFLAGS += -DLOGBINCBON
ifeq ($(_DEBUGON_),1)
DEFINEFLAGS += -D_DEBUG_
endif
ifeq ($(ORIGINALCBON),1)
DEFINEFLAGS += -DORIGINALCB
else
ifeq ($(SMOOTHPIVOTON),1)
# defined above, independently
#DEFINEFLAGS += -DSMOOTHPIVOT
endif
ifeq ($(BALLS4SCANLEVON),1)
DEFINEFLAGS += -DBALLS4SCANLEV
endif
endif
#
ifeq ($(NORMALHISTSCALEON),1)
DEFINEFLAGS += -DNORMALHISTSCALE
endif
#
OPT2 += $(DEFINEFLAGS)
#E
#
# not used anymore
#OPT2 += -DMASKED
#
#E

#E
############################

############################
# Nothing to do below...
############################

############################
#B Addendum of some not important
#   modules/switches or that are in
#   development phase
#   and it is not for the public version
# Normally they will be switched OFF

# OCTREESMOOTHING
# some utils and definitions useful to smooth octree cells
OCTREESMOOTHINGON = 0

#B This causes division by zero in MainLoop calling using cballys...
# OCTREEKKKOMP
# For computing 3pcf using octree-kkk-omp
ifeq ($(DEFDIMENSION),3)
OCTREEKKKOMPON = 0
endif

# BALLSOMP
# For computing 3pcf using balls method
BALLSON = 0

# OCTREEKKKBALLS4OMP
# For computing 3pcf using octree-kkk-balls4-omp
#   is in development phase. Not included. Do not use.
# Needs BALLSON = 1 above
ifeq ($(OCTREESMOOTHINGON),1)
OCTREEKKKBALLS4OMPON = 0
else
$(info To compile with OCTREEKKKBALLS4OMP needs BALLSON = 1, deactivating...)
OCTREEKKKBALLS4OMPON = 0
endif

# OCTREEGGGCROSSOMP
# For computing cross-3pcf using octree-ggg_cross-omp
#   still in development phase.
ifeq ($(USEGSL),1)
OCTREEGGGCROSSOMPON = 0
else
ifeq ($(COMPLEXLIBON),1)
OCTREEGGGCROSSOMPON = 0
else
$(info To compile with OCTREEGGGCROSSOMP needs USEGSL/COMPLEXLIBON = 1, deactivating...)
# Note:
#                           testing without GSL !!!!!!!!!!!!!!!!!!!!!!!
#OCTREEGGGCROSSOMPON = 0
OCTREEGGGCROSSOMPON = 0
endif
endif

# DIRECTMETHOD
# For computing 3pcf using direct method
DIRECTMETHODON = 0

# OCTREEGGG
# For computing 3pcf using octree-ggg
#   still is in development phase.
ifeq ($(USEGSL),1)
OCTREEGGGON = 0
else
ifeq ($(COMPLEXLIBON),1)
OCTREEGGGON = 1
else
$(info To compile with OCTREEGGG needs USEGSL/COMPLEXLIBON = 1, deactivating...)
# Note:
#                           testing without GSL !!!!!!!!!!!!!!!!!!!!!!!
#OCTREEGGGON = 0
OCTREEGGGON = 1
endif
endif

# DIRECTMETHODSIMPLE
# For computing 3pcf using direct method simple
DIRECTMETHODSIMPLEON = 0

# DIRECTMETHODSIMPLE
# For computing 3pcf using direct method simple loopId
DIRECTMETHODSIMPLELOOPIDON = 0

# For complex math use only one: USEGSL or COMPLEXLIB
#   COMPLEXLIB is in development phase.
#   Not included. Do not use.
# COMPLEXLIB
# Library for complex computation
ifeq ($(USEGSL),0)
# default is OFF, turn it ON if necessary (OCTREEGGGOMP)
COMPLEXLIBON = 0
else
$(info Use only one: USEGSL or COMPLEXLIB, deactivating COMPLEXLIB...)
COMPLEXLIBON = 0
endif

# OCTREEGGGOMPTRIANGLES
# For computing 3pcf using octree-ggg-omp-triangles
#   is in development phase. Not included. Do not use.
ifeq ($(USEGSL),1)
OCTREEGGGOMPTRIANGLESON = 0
else
$(info To compile with OCTREEGGGOMPTRIANGLES needs USEGSL = 1, deactivating...)
OCTREEGGGOMPTRIANGLESON = 0
endif

# OCTREEBOXOMP
# For computing 2pcf using octree-box-omp methods
OCTREEBOXOMPON = 0

# KDTREECUTEBOX
# For computing 2pcf using cute-box methods
KDTREECUTEBOXON = 0

# OCTREEKKKBALLS4OMPTRIANGLES
# For computing 3pcf using octree-kkk-balls4-omp-triangles
#   is in development phase. Not included. Do not use.
# Needs BALLSON = 1 above
ifeq ($(BALLSON),1)
OCTREEKKKBALLS4OMPTRIANGLESON = 0
else
$(info To compile with OCTREEKKKBALLS4OMPTRIANGLES needs BALLSON = 1, deactivating...)
OCTREEKKKBALLS4OMPTRIANGLESON = 0
endif

# COSMOLIB
# For computing several cosmology functions
COSMOLIBON = 0

# SAVERESTORE
# For save/restore options
#   is in development phase. Do not use.
SAVERESTOREON = 0

#E
############################


############################
#B Addendum of some important
#   modules that will not be part
#       any longer of the public version
# Normally they will be switched OFF
############################

# TREEOMPSINCOS
# First developed searching engine
# For computing (2,3)pcf using tree-omp-sincos
TREEOMPSINCOSON = 0

# OCTREESINCOSOMP
# Move to main source directory
# For computing (2,3)pcf using octree-omp
OCTREESINCOSOMPON = 0

#E Addendum of some not important
#  no longer part of the public version
############################


$(info =====================================================)
