Commit ab806acd authored by Volker Springel's avatar Volker Springel

applied clang-formatter with our default style in (.clang-format)

parent 9fa6bfe2
---
Language: Cpp
BasedOnStyle: Google
BreakBeforeBraces: GNU
SpaceBeforeParens: Never
AllowShortLoopsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: false
AlignConsecutiveAssignments: true
ColumnLimit: 135
ReflowComments: true
SortUsingDeclarations: true
...
This diff is collapsed.
......@@ -35,32 +35,24 @@
* - 11.05.2018 Prepared file for public release -- Rainer Weinberger
*/
#ifndef ADD_BGGRID_H
#define ADD_BGGRID_H
#include "../main/allvars.h"
#ifdef ADDBACKGROUNDGRID
#define ADDBACKGROUNDGRIDMAX 256
#define FACTOR_MAX_BOX_SIZE 15.0
#define FACTOR_MIN_BOX_SIZE 2.0
#define ADDBACKGROUNDGRIDMAX 256
#define FACTOR_MAX_BOX_SIZE 15.0
#define FACTOR_MIN_BOX_SIZE 2.0
extern MyIDType IDNew;
int add_backgroundgrid(void);
void prepare_domain_backgroundgrid(void);
void calculate_weights();
void distribute_particles();
#endif /* #ifdef ADDBACKGROUNDGRID */
#endif /* ADD_BGGRID_H */
......@@ -28,30 +28,25 @@
* static void kernel_imported(void)
* void calculate_weights()
* int find_cells_evaluate(int target, int mode, int thread_id)
*
*
*
*
* \par Major modifications and contributions:
*
*
* - DD.MM.YYYY Description
* - 11.05.2018 Prepared file for public release -- Rainer Weinberger
*/
#include <mpi.h>
#include "../domain/domain.h"
#include "../main/allvars.h"
#include "../main/proto.h"
#include "../domain/domain.h"
#include "add_bggrid.h"
#ifdef ADDBACKGROUNDGRID
static int find_cells_evaluate(int target, int mode, int thread_id);
/*! \brief Local data structure for collecting particle/cell data that is sent
* to other processors if needed. Type called data_in and static
* pointers DataIn and DataGet needed by generic_comm_helpers2.
......@@ -66,7 +61,6 @@ typedef struct
static data_in *DataIn, *DataGet;
/*! \brief Routine that fills the relevant particle/cell data into the input
* structure defined above. Needed by generic_comm_helpers2.
*
......@@ -76,7 +70,7 @@ static data_in *DataIn, *DataGet;
*
* \return void
*/
static void particle2in(data_in * in, int i, int firstnode)
static void particle2in(data_in *in, int i, int firstnode)
{
in->Pos[0] = P[i].Pos[0];
in->Pos[1] = P[i].Pos[1];
......@@ -87,7 +81,6 @@ static void particle2in(data_in * in, int i, int firstnode)
in->Firstnode = firstnode;
}
/*! \brief Local data structure that holds results acquired on remote
* processors. Type called data_out and static pointers DataResult and
* DataOut needed by generic_comm_helpers2.
......@@ -99,7 +92,6 @@ typedef struct
static data_out *DataResult, *DataOut;
/*! \brief Routine to store or combine result data. Needed by
* generic_comm_helpers2.
*
......@@ -111,22 +103,20 @@ static data_out *DataResult, *DataOut;
*
* \return void
*/
static void out2particle(data_out * out, int i, int mode)
static void out2particle(data_out *out, int i, int mode)
{
if(mode == MODE_LOCAL_PARTICLES) /* initial store */
if(mode == MODE_LOCAL_PARTICLES) /* initial store */
{
SphP[i].Weight = out->Weight;
}
else /* combine */
else /* combine */
{
SphP[i].Weight += out->Weight;
}
}
#include "../utils/generic_comm_helpers2.h"
/*! \brief Routine that defines what to do with local particles.
*
* Calls the *_evaluate function in MODE_LOCAL_PARTICLES.
......@@ -161,7 +151,6 @@ static void kernel_local(void)
}
}
/*! \brief Routine that defines what to do with imported particles.
*
* Calls the *_evaluate function in MODE_IMPORTED_PARTICLES.
......@@ -187,7 +176,6 @@ static void kernel_imported(void)
}
}
/*! \brief Calculates SPH weights of each cell.
*
* \return void
......@@ -195,7 +183,7 @@ static void kernel_imported(void)
void calculate_weights()
{
domain_free();
domain_Decomposition(); /* do new domain decomposition, will also make a new chained-list of synchronized particles */
domain_Decomposition(); /* do new domain decomposition, will also make a new chained-list of synchronized particles */
ngb_treeallocate();
ngb_treebuild(NumGas);
......@@ -222,7 +210,6 @@ void calculate_weights()
mpi_printf("ADD BACKGROUND GRID: done\n");
}
/*! \brief finds cells and adds up weights in an SPH fashion
*
* \param[in] target Index of particle/cell
......@@ -249,7 +236,7 @@ int find_cells_evaluate(int target, int mode, int thread_id)
particle2in(&local, target, 0);
target_data = &local;
numnodes = 1;
numnodes = 1;
firstnode = NULL;
}
else
......@@ -259,13 +246,13 @@ int find_cells_evaluate(int target, int mode, int thread_id)
generic_get_numnodes(target, &numnodes, &firstnode);
}
pos = target_data->Pos;
h = target_data->Hsml;
h2 = h * h;
pos = target_data->Pos;
h = target_data->Hsml;
h2 = h * h;
hinv = 1.0 / h;
#ifndef TWODIMS
hinv3 = hinv * hinv * hinv;
#else /* #ifndef TWODIMS */
#else /* #ifndef TWODIMS */
hinv3 = hinv * hinv / boxSize_Z;
#endif /* #ifndef TWODIMS #else */
......@@ -310,5 +297,4 @@ int find_cells_evaluate(int target, int mode, int thread_id)
return 0;
}
#endif /* #ifdef ADDBACKGROUNDGRID */
......@@ -28,29 +28,24 @@
* static void kernel_imported(void)
* void distribute_particles(void)
* int find_cells_evaluate(int target, int mode, int thread_id)
*
*
*
*
* \par Major modifications and contributions:
*
*
* - DD.MM.YYYY Description
* - 11.05.2018 Prepared file for public release -- Rainer Weinberger
*/
#include <mpi.h>
#include "../main/allvars.h"
#include "../main/proto.h"
#include "add_bggrid.h"
#ifdef ADDBACKGROUNDGRID
static int find_cells_evaluate(int target, int mode, int thread_id);
/*! \brief Local data structure for collecting particle/cell data that is sent
* to other processors if needed. Type called data_in and static
* pointers DataIn and DataGet needed by generic_comm_helpers2.
......@@ -65,13 +60,12 @@ typedef struct
MyFloat Momentum[3];
#ifdef MHD
MyFloat B[3];
#endif /* #ifdef MHD */
#endif /* #ifdef MHD */
int Firstnode;
} data_in;
static data_in *DataIn, *DataGet;
/*! \brief Routine that fills the relevant particle/cell data into the input
* structure defined above. Needed by generic_comm_helpers2.
*
......@@ -81,7 +75,7 @@ static data_in *DataIn, *DataGet;
*
* \return void
*/
static void particle2in(data_in * in, int i, int firstnode)
static void particle2in(data_in *in, int i, int firstnode)
{
in->Pos[0] = P[i].Pos[0];
in->Pos[1] = P[i].Pos[1];
......@@ -89,8 +83,8 @@ static void particle2in(data_in * in, int i, int firstnode)
in->Hsml = SphP[i].Hsml;
in->Weight = SphP[i].Weight;
in->Mass = P[i].Mass;
in->Weight = SphP[i].Weight;
in->Mass = P[i].Mass;
in->InternalEnergy = SphP[i].Utherm * P[i].Mass;
int k;
......@@ -105,7 +99,6 @@ static void particle2in(data_in * in, int i, int firstnode)
in->Firstnode = firstnode;
}
/*! \brief Local data structure that holds results acquired on remote
* processors. Type called data_out and static pointers DataResult and
* DataOut needed by generic_comm_helpers2.
......@@ -117,7 +110,6 @@ typedef struct
static data_out *DataResult, *DataOut;
/*! \brief Routine to store or combine result data. Needed by
* generic_comm_helpers2.
*
......@@ -129,15 +121,10 @@ static data_out *DataResult, *DataOut;
*
* \return void
*/
static void out2particle(data_out * out, int i, int mode)
{
return;
}
static void out2particle(data_out *out, int i, int mode) { return; }
#include "../utils/generic_comm_helpers2.h"
/*! \brief Routine that defines what to do with local particles.
*
* Calls the *_evaluate function in MODE_LOCAL_PARTICLES.
......@@ -169,10 +156,8 @@ static void kernel_local(void)
find_cells_evaluate(i, MODE_LOCAL_PARTICLES, threadid);
}
}
}
/*! \brief Routine that defines what to do with imported particles.
*
* Calls the *_evaluate function in MODE_IMPORTED_PARTICLES.
......@@ -198,7 +183,6 @@ static void kernel_imported(void)
}
}
/*! \brief Main function to distribute hydro quantities over a kernel average.
*
* \return void
......@@ -233,7 +217,6 @@ void distribute_particles(void)
mpi_printf("ADD BACKGROUND GRID: done\n");
}
/*! \brief Distributes imported properties on neighbouring cells.
*
* \param[in] target Index of particle/cell.
......@@ -259,7 +242,7 @@ int find_cells_evaluate(int target, int mode, int thread_id)
particle2in(&local, target, 0);
target_data = &local;
numnodes = 1;
numnodes = 1;
firstnode = NULL;
}
else
......@@ -269,13 +252,13 @@ int find_cells_evaluate(int target, int mode, int thread_id)
generic_get_numnodes(target, &numnodes, &firstnode);
}
pos = target_data->Pos;
h = target_data->Hsml;
h2 = h * h;
pos = target_data->Pos;
h = target_data->Hsml;
h2 = h * h;
hinv = 1.0 / h;
#ifndef TWODIMS
#ifndef TWODIMS
hinv3 = hinv * hinv * hinv;
#else /* #ifndef TWODIMS */
#else /* #ifndef TWODIMS */
hinv3 = hinv * hinv / boxSize_Z;
#endif /* #ifndef TWODIMS #else */
......@@ -341,5 +324,4 @@ int find_cells_evaluate(int target, int mode, int thread_id)
return 0;
}
#endif /* #ifdef ADDBACKGROUNDGRID */
This diff is collapsed.
......@@ -20,11 +20,11 @@
* \file src/cooling/cooling_proto.h
* \date 05/2018
* \brief Header for cooling functions.
* \details
*
*
* \details
*
*
* \par Major modifications and contributions:
*
*
* - DD.MM.YYYY Description
* - 27.05.2018 Prepared file for public release -- Rainer Weinberger
*/
......@@ -33,17 +33,14 @@
#define INLINE_FUNC
#endif /* #ifndef INLINE_FUNC */
void SetOutputGasState(int i, double *ne_guess, double *nH0, double *coolrate);
double convert_u_to_temp(double u, double rho, double *ne_guess);
double CoolingRate(double logT, double rho, double *nelec);
double CoolingRateFromU(double u, double rho, double *ne_guess);
double DoCooling(double u_old, double rho, double dt, double *ne_guess);
double GetCoolingTime(double u_old, double rho, double *ne_guess);
void find_abundances_and_rates(double logT, double rho, double *ne_guess);
void InitCool(void);
void IonizeParamsUVB(void);
......
......@@ -20,24 +20,22 @@
* \file src/cooling/cooling_vars.h
* \date 05/2018
* \brief Variables for cooling.
* \details
*
*
* \details
*
*
* \par Major modifications and contributions:
*
*
* - DD.MM.YYYY Description
* - 27.05.2018 Prepared file for public release -- Rainer Weinberger
*/
#define NCOOLTAB 2000
#define SMALLNUM 1.0e-60
#define COOLLIM 0.1
#define HEATLIM 20.0
#define eV_to_K 11606.0
#define eV_to_erg 1.60184e-12
#define MAX_TABLESIZE 250 /* Max # of lines in TREECOOL */
#define NCOOLTAB 2000
#define SMALLNUM 1.0e-60
#define COOLLIM 0.1
#define HEATLIM 20.0
#define eV_to_K 11606.0
#define eV_to_erg 1.60184e-12
#define MAX_TABLESIZE 250 /* Max # of lines in TREECOOL */
/* data for gas state */
typedef struct
......@@ -48,11 +46,10 @@ typedef struct
double nH0, nHp, nHep, nHe0, nHepp;
double XH, yhelium;
double mhboltz;
double ethmin; /* minimum internal energy for neutral gas */
double ethmin; /* minimum internal energy for neutral gas */
double mu;
} GasState;
/* tabulated rates */
typedef struct
{
......@@ -61,16 +58,14 @@ typedef struct
double GammaeH0, GammaeHe0, GammaeHep;
} RateTable;
/* photo-ionization/heating rate table */
typedef struct
{
float variable; /* logz for UVB */
float gH0, gHe, gHep; /* photo-ionization rates */
float eH0, eHe, eHep; /* photo-heating rates */
float variable; /* logz for UVB */
float gH0, gHe, gHep; /* photo-ionization rates */
float eH0, eHe, eHep; /* photo-heating rates */
} PhotoTable;
/* current interpolated photo-ionization/heating rates */
typedef struct
{
......@@ -78,7 +73,6 @@ typedef struct
double gJH0, gJHep, gJHe0, epsH0, epsHep, epsHe0;
} PhotoCurrent;
/* cooling data */
typedef struct
{
......
This diff is collapsed.
......@@ -20,11 +20,11 @@
* \file src/debug_md5/Md5.h
* \date 05/2018
* \brief Header for implementation of MD5 checksums.
* \details
*
*
* \details
*
*
* \par Major modifications and contributions:
*
*
* - DD.MM.YYYY Description
* - 27.05.2018 Prepared file for public release -- Rainer Weinberger
*/
......@@ -74,17 +74,16 @@ typedef unsigned long int UINT4;
/* Data structure for MD5 (Message Digest) computation */
typedef struct
{
UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
UINT4 buf[4]; /* scratch buffer */
unsigned char in[64]; /* input buffer */
unsigned char digest[16]; /* actual digest after MD5Final call */
UINT4 i[2]; /* number of _bits_ handled mod 2^64 */
UINT4 buf[4]; /* scratch buffer */
unsigned char in[64]; /* input buffer */
unsigned char digest[16]; /* actual digest after MD5Final call */
} MD5_CTX;
void MD5Final(MD5_CTX * mdContext);
//void MD5Update(MD5_CTX * mdContext, unsigned char *inBuf, unsigned int inLen);
void MD5UpdateLong(MD5_CTX * mdContext, unsigned char *inBuf, unsigned long long inLenLong);
void MD5Init(MD5_CTX * mdContext);
void MD5Final(MD5_CTX *mdContext);
// void MD5Update(MD5_CTX * mdContext, unsigned char *inBuf, unsigned int inLen);
void MD5UpdateLong(MD5_CTX *mdContext, unsigned char *inBuf, unsigned long long inLenLong);
void MD5Init(MD5_CTX *mdContext);
/*
**********************************************************************
......
......@@ -22,22 +22,19 @@
* \brief Functions to calculate an MD5 checksum from a dataset.
* \details contains functions:
* void calc_memory_checksum(void *base, size_t bytes)
*
*
*
*
* \par Major modifications and contributions:
*
*
* - DD.MM.YYYY Description
* - 24.05.2018 Prepared file for public release -- Rainer Weinberger
*/
#include "../main/allvars.h"
#include "../main/proto.h"
#include "Md5.h"
/*! \brief Calculates a md5 checksum (on all MPI tasks) and prints it.
*
* \param[in] base Pointer to start of data.
......@@ -74,7 +71,6 @@ void calc_memory_checksum(void *base, size_t bytes)
}
}
#ifdef RESTART_DEBUG
/*! \brief Calculates md5 checksums of main data structures of a restart file.
*
......@@ -91,7 +87,7 @@ void log_restart_debug(void)
int i;
MD5Init(&sum);
MD5UpdateLong(&sum, (void *) P, NumPart * sizeof(struct particle_data));
MD5UpdateLong(&sum, (void *)P, NumPart * sizeof(struct particle_data));
MD5Final(&sum);
for(i = 0; i < 16; i++)
......@@ -100,7 +96,7 @@ void log_restart_debug(void)
MPI_Allreduce(u.val, uglob_P.val, 4, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
MD5Init(&sum);
MD5UpdateLong(&sum, (void *) SphP, NumGas * sizeof(struct sph_particle_data));
MD5UpdateLong(&sum, (void *)SphP, NumGas * sizeof(struct sph_particle_data));
MD5Final(&sum);
for(i = 0; i < 16; i++)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -20,27 +20,24 @@
* \file src/domain.h
* \date 05/2018
* \brief Header for domain decomposition.
* \details
*
*
* \details
*
*
* \par Major modifications and contributions:
*
*
* - DD.MM.YYYY Description
* - 28.05.2018 Prepared file for public release -- Rainer Weinberger
*/
#ifndef ALLVARS_H
#include "../main/allvars.h"
#endif /* #ifndef ALLVARS_H */
#ifndef DOMAIN_H
#define DOMAIN_H
#define MASK_ACTIVE_FLAG_IN_TYPE 127
#define SET_ACTIVE_FLAG_IN_TYPE 128
#define SET_ACTIVE_FLAG_IN_TYPE 128
enum domain_displace_mode
{
......@@ -50,19 +47,17 @@ enum domain_displace_mode
extern struct local_topnode_data
{
peanokey Size; /*!< number of Peano-Hilbert mesh-cells represented by top-level node */
peanokey StartKey; /*!< first Peano-Hilbert key in top-level node */
long long Count; /*!< counts the number of particles in this top-level node */
peanokey Size; /*!< number of Peano-Hilbert mesh-cells represented by top-level node */
peanokey StartKey; /*!< first Peano-Hilbert key in top-level node */
long long Count; /*!< counts the number of particles in this top-level node */
double Cost;
double SphCost;
int Daughter; /*!< index of first daughter cell (out of 8) of top-level node */
int Leaf; /*!< if the node is a leaf, this gives its number when all leaves are traversed in Peano-Hilbert order */
int Daughter; /*!< index of first daughter cell (out of 8) of top-level node */
int Leaf; /*!< if the node is a leaf, this gives its number when all leaves are traversed in Peano-Hilbert order */
int Parent;
int PIndex; /*!< first particle in node */
}
*topNodes, *branchNodes; /*!< points to the root node of the top-level tree */
int PIndex; /*!< first particle in node */