* \brief provides instances of all global variables.
*/
#include <stdio.h>
#include <gsl/gsl_rng.h>
#include "tags.h"
#include "allvars.h"
intSetMinTimeStepForActives=0;
intThisTask;/*!< the rank of the local processor */
intNTask;/*!< number of processors */
intPTask;/*!< smallest integer such that NTask <= 2^PTask */
intNumPart;/*!< number of particles on the LOCAL processor */
intN_gas;/*!< number of gas particles on the LOCAL processor */
#if defined(SFR) || defined(STELLAR_PROP)
intN_stars;/*!< number of stars particle on the LOCAL processor */
#endif
#ifdef MULTIPHASE
intN_sph;
intN_sticky;
intN_stickyflaged;
intN_dark;
intNumColPotLocal;/*!< local number of potentially collisional particles */
intNumColPot;/*!< total number of potentially collisional particles */
intNumColLocal;/*!< local number of collisions */
intNumCol;/*!< total number of collisions */
intNumNoColLocal;
intNumNoCol;
#endif
longlongNtype[6];/*!< total number of particles of each type */
intNtypeLocal[6];/*!< local number of particles of each type */
intNumForceUpdate;/*!< number of active particles on local processor in current timestep */
intNumSphUpdate;/*!< number of active SPH particles on local processor in current timestep */
#ifdef CHIMIE
intNumStUpdate;
#endif
doubleCPUThisRun;/*!< Sums the CPU time for the process (current submission only) */
#ifdef SPLIT_DOMAIN_USING_TIME
doubleCPU_Gravity;
#endif
intRestartFlag;/*!< taken from command line used to start code. 0 is normal start-up from
initial conditions, 1 is resuming a run from a set of restart files, while 2
marks a restart from a snapshot file. */
char*Exportflag;/*!< Buffer used for flagging whether a particle needs to be exported to another process */
int*Ngblist;/*!< Buffer to hold indices of neighbours retrieved by the neighbour search routines */
intTreeReconstructFlag;/*!< Signals that a new tree needs to be constructed */
#ifdef SFR
intRearrangeParticlesFlag;/*!< Signals that particles must be rearanged */
#endif
intFlag_FullStep;/*!< This flag signals that the current step involves all particles */
gsl_rng*random_generator;/*!< the employed random number generator of the GSL library */
doubleRndTable[RNDTABLE];/*!< Hold a table with random numbers, refreshed every timestep */
#ifdef SFR
doubleStarFormationRndTable[RNDTABLE];/*!< Hold a table with random numbers, refreshed every timestep */
#endif
#ifdef FEEDBACK_WIND
doubleFeedbackWindRndTable[RNDTABLE];/*!< Hold a table with random numbers, refreshed every timestep */
#endif
#ifdef CHIMIE
doubleChimieRndTable[RNDTABLE];/*!< Hold a table with random numbers, refreshed every timestep */
#endif
#ifdef CHIMIE_KINETIC_FEEDBACK
doubleChimieKineticFeedbackRndTable[RNDTABLE];/*!< Hold a table with random numbers, refreshed every timestep */
#endif
doubleDomainCorner[3];/*!< gives the lower left corner of simulation volume */
doubleDomainCenter[3];/*!< gives the center of simulation volume */
doubleDomainLen;/*!< gives the (maximum) side-length of simulation volume */
doubleDomainFac;/*!< factor used for converting particle coordinates to a Peano-Hilbert mesh covering the simulation volume */
intDomainMyStart;/*!< first domain mesh cell that resides on the local processor */
intDomainMyLast;/*!< last domain mesh cell that resides on the local processor */
int*DomainStartList;/*!< a table that lists the first domain mesh cell for all processors */
int*DomainEndList;/*!< a table that lists the last domain mesh cell for all processors */
double*DomainWork;/*!< a table that gives the total "work" due to the particles stored by each processor */
int*DomainCount;/*!< a table that gives the total number of particles held by each processor */
int*DomainCountSph;/*!< a table that gives the total number of SPH particles held by each processor */
int*DomainTask;/*!< this table gives for each leaf of the top-level tree the processor it was assigned to */
int*DomainNodeIndex;/*!< this table gives for each leaf of the top-level tree the corresponding node of the gravitational tree */
FLOAT*DomainTreeNodeLen;/*!< this table gives for each leaf of the top-level tree the side-length of the corresponding node of the gravitational tree */
FLOAT*DomainHmax;/*!< this table gives for each leaf of the top-level tree the maximum SPH smoothing length among the particles of the corresponding node of the gravitational tree */
structDomainNODE
*DomainMoment;/*!< this table stores for each node of the top-level tree corresponding node data from the gravitational tree */
peanokey*DomainKeyBuf;/*!< this points to a buffer used during the exchange of particle data */
peanokey*Key;/*!< a table used for storing Peano-Hilbert keys for particles */
peanokey*KeySorted;/*!< holds a sorted table of Peano-Hilbert keys for all particles, used to construct top-level tree */
intNTopnodes;/*!< total number of nodes in top-level tree */
intNTopleaves;/*!< number of leaves in top-level tree. Each leaf can be assigned to a different processor */
structtopnode_data
*TopNodes;/*!< points to the root node of the top-level tree */
doubleTimeOfLastTreeConstruction;/*!< holds what it says, only used in connection with FORCETEST */
/* variables for input/output, usually only used on process 0 */
charParameterFile[MAXLEN_FILENAME];/*!< file name of parameterfile used for starting the simulation */
FILE*FdInfo;/*!< file handle for info.txt log-file. */
FILE*FdLog;/*!< file handle for log.txt log-file. */
FILE*FdEnergy;/*!< file handle for energy.txt log-file. */
#ifdef SYSTEMSTATISTICS
FILE*FdSystem;
#endif
FILE*FdTimings;/*!< file handle for timings.txt log-file. */
FILE*FdCPU;/*!< file handle for cpu.txt log-file. */
#ifdef FORCETEST
FILE*FdForceTest;/*!< file handle for forcetest.txt log-file. */
#endif
#ifdef SFR
FILE*FdSfr;/*!< file handle for sfr.txt log-file. */
#endif
#ifdef CHIMIE
FILE*FdChimie;/*!< file handle for chimie log-file. */
#endif
#ifdef MULTIPHASE
FILE*FdPhase;/*!< file handle for phase.txt log-file. */
FILE*FdSticky;/*!< file handle for sticky.txt log-file. */
#endif
#ifdef AGN_ACCRETION
FILE*FdAccretion;/*!< file handle for accretion.txt log-file. */
#endif
#ifdef BONDI_ACCRETION
FILE*FdBondi;/*!< file handle for bondi.txt log-file. */
#endif
#ifdef BUBBLES
FILE*FdBubble;/*!< file handle for bubble.txt log-file. */
#endif
doubleDriftTable[DRIFT_TABLE_LENGTH];/*!< table for the cosmological drift factors */
doubleGravKickTable[DRIFT_TABLE_LENGTH];/*!< table for the cosmological kick factor for gravitational forces */
doubleHydroKickTable[DRIFT_TABLE_LENGTH];/*!< table for the cosmological kick factor for hydrodynmical forces */
#ifdef COSMICTIME
doubleCosmicTimeTable[COSMICTIME_TABLE_LENGTH];/*!< table for the computation of cosmic time */
#endif
void*CommBuffer;/*!< points to communication buffer, which is used in the domain decomposition, the
parallel tree-force computation, the SPH routines, etc. */
/*! This structure contains data which is the SAME for all tasks (mostly code parameters read from the
* parameter file). Holding this data in a structure is convenient for writing/reading the restart file, and
* it allows the introduction of new global variables in a simple way. The only thing to do is to introduce
* them into this structure.
*/
structglobal_data_all_processes
All;
/*! This structure holds all the information that is
* stored for each particle of the simulation.
*/
structparticle_data
*P,/*!< holds particle data on local processor */
*DomainPartBuf;/*!< buffer for particle data used in domain decomposition */
/* the following struture holds data that is stored for each SPH particle in addition to the collisionless
* variables.
*/
structsph_particle_data
*SphP,/*!< holds SPH particle data on local processor */
*DomainSphBuf;/*!< buffer for SPH particle data in domain decomposition */
#ifdef STELLAR_PROP
/* the following struture holds data that is stored for each SPH particle in addition to the collisionless
* variables.
*/
structst_particle_data
*StP,/*!< holds ST particle data on local processor */
*DomainStBuf;/*!< buffer for ST particle data in domain decomposition */
#endif
/* Variables for Tree
*/
intMaxNodes;/*!< maximum allowed number of internal nodes */
intNumnodestree;/*!< number of (internal) nodes in each tree */
structNODE
*Nodes_base,/*!< points to the actual memory allocted for the nodes */
*Nodes;/*!< this is a pointer used to access the nodes which is shifted such that Nodes[All.MaxPart]
gives the first allocated node */
int*Nextnode;/*!< gives next node in tree walk */
int*Father;/*!< gives parent node in tree */
structextNODE/*!< this structure holds additional tree-node information which is not needed in the actual gravity computation */
*Extnodes_base,/*!< points to the actual memory allocted for the extended node information */
*Extnodes;/*!< provides shifted access to extended node information, parallel to Nodes/Nodes_base */
/*! Header for the standard file format.
*/
structio_header
header;/*!< holds header for snapshot files */
#ifdef CHIMIE_EXTRAHEADER
/*! Header for the chimie part.
*/
structio_chimie_extraheader
chimie_extraheader;
#endif
charTab_IO_Labels[IO_NBLOCKS][4];/*<! This table holds four-byte character tags used for fileformat 2 */
/* global state of system, used for global statistics
*/
structstate_of_system
SysState;/*<! Structure for storing some global statistics about the simulation. */
/*! This structure contains data related to the energy budget.
These values are different for each task. It need to be stored
in the restart flag.
*/
structlocal_state_of_system
LocalSysState;/*<! Structure for storing some local statistics about the simulation. */
/* Various structures for communication
*/
structgravdata_in
*GravDataIn,/*!< holds particle data to be exported to other processors */
*GravDataGet,/*!< holds particle data imported from other processors */
*GravDataResult,/*!< holds the partial results computed for imported particles. Note: We use GravDataResult = GravDataGet, such that the result replaces the imported data */
*GravDataOut;/*!< holds partial results received from other processors. This will overwrite the GravDataIn array */
structgravdata_index
*GravDataIndexTable;/*!< the particles to be exported are grouped by task-number. This table allows the results to be disentangled again and to be assigned to the correct particle */
structdensdata_in
*DensDataIn,/*!< holds particle data for SPH density computation to be exported to other processors */
*DensDataGet;/*!< holds imported particle data for SPH density computation */
structdensdata_out
*DensDataResult,/*!< stores the locally computed SPH density results for imported particles */
*DensDataPartialResult;/*!< imported partial SPH density results from other processors */
structhydrodata_in
*HydroDataIn,/*!< holds particle data for SPH hydro-force computation to be exported to other processors */
*HydroDataGet;/*!< holds imported particle data for SPH hydro-force computation */
structhydrodata_out
*HydroDataResult,/*!< stores the locally computed SPH hydro results for imported particles */
*HydroDataPartialResult;/*!< imported partial SPH hydro-force results from other processors */
#ifdef MULTIPHASE
structstickydata_in
*StickyDataIn,
*StickyDataGet;
structstickydata_out
*StickyDataResult,
*StickyDataPartialResult;
structSticky_index*StickyIndex;
#endif
#ifdef CHIMIE
structchimiedata_in
*ChimieDataIn,/*!< holds particle data for Chimie computation to be exported to other processors */
*ChimieDataGet;/*!< holds imported particle data for Chimie computation */
structchimiedata_out
*ChimieDataResult,/*!< stores the locally computed Chimie results for imported particles */
*ChimieDataPartialResult;/*!< imported partial Chimie results from other processors */
structstarsdensdata_in
*StarsDensDataIn,/*!< holds particle data for SPH density computation to be exported to other processors */
*StarsDensDataGet;/*!< holds imported particle data for SPH density computation */
structstarsdensdata_out
*StarsDensDataResult,/*!< stores the locally computed SPH density results for imported particles */
*StarsDensDataPartialResult;/*!< imported partial SPH density results from other processors */