Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hannorein committed Oct 25, 2023
1 parent 362a5de commit 844cce5
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions src/rebound.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@
#ifndef _MAIN_H
#define _MAIN_H

#ifndef _WIN32
#define REBOUND_RESTRICT restrict
#define DLLEXPORT
#else // _WIN32
#ifdef _WIN32
#define DLLEXPORT __declspec(dllexport)
#define REBOUND_RESTRICT
#define __restrict__
#else // Linux and MacOS
#define REBOUND_RESTRICT restrict
#define DLLEXPORT
#endif // _WIN32



#include <stdio.h>
#include <inttypes.h>
#include <stdint.h>
#include <signal.h>
#define _USE_MATH_DEFINES
#include <math.h>

#ifdef _WIN32
typedef struct timeval {
long tv_sec;
Expand All @@ -48,35 +52,26 @@ int asprintf(char **strp, const char *fmt, ...);
int rand_r (unsigned int *seed);
#define REB_RAND_MAX 4294967295 // UINT_MAX
#include <io.h>
#else // _WIN32
#else // Linux and MacOS
#define REB_RAND_MAX RAND_MAX
#include <sys/time.h>
#include <unistd.h>
#endif // _WIN32



#include <inttypes.h>
#include <stdint.h>
#ifndef _WIN32
#include <pthread.h>
#endif // _WIN32
#include <signal.h>
#define _USE_MATH_DEFINES
#include <math.h>

#ifdef AVX512
#include <immintrin.h>
#endif

#ifdef MPI
#include "mpi.h"
#endif // MPI
#endif

#ifndef GITHASH
#define GITHASH notavailable0000000000000000000000000001
#endif // GITHASH
#ifndef __GNUC__
# define __attribute__(x) /*DO NOTHING*/
#endif

// Global constants and variables
DLLEXPORT extern const char* reb_build_str; ///< Date and time build string.
DLLEXPORT extern const char* reb_version_str; ///< Version string.
DLLEXPORT extern const char* reb_githash_str; ///< Current git hash.
Expand All @@ -92,8 +87,9 @@ struct reb_display_data;
struct reb_treecell;
struct reb_variational_configuration;

// Particle structure
struct reb_particle {
double x;
double x; // Cartesian coordinates
double y;
double z;
double vx;
Expand All @@ -104,7 +100,7 @@ struct reb_particle {
double az;
double m; // mass
double r; // physical radius
double last_collision; // Last time the particle had a physical collision.
double last_collision; // Last time the particle had a physical collision.
struct reb_treecell* c; // Pointer to the cell the particle is currently in.
uint32_t hash; // Hash, can be used to identify particle.
void* ap; // This pointer allows REBOUNDx to add additional properties to the particle.
Expand Down Expand Up @@ -262,6 +258,10 @@ struct reb_integrator_whfast {
unsigned int recalculate_coordinates_but_not_synchronized_warning;
};

#ifndef __GNUC__
# define __attribute__(x) /*DO NOTHING*/
#endif

struct reb_particle_avx512{
#ifdef AVX512
__m512d m __attribute__ ((aligned (64)));
Expand Down Expand Up @@ -728,7 +728,6 @@ DLLEXPORT double reb_mod2pi(double f);
DLLEXPORT double reb_M_to_f(double e, double M); // True anomaly for a given eccentricity and mean anomaly
DLLEXPORT double reb_E_to_f(double e, double M); // True anomaly for a given eccentricity and eccentric anomaly
DLLEXPORT double reb_M_to_E(double e, double M); // Eccentric anomaly for a given eccentricity and mean anomaly
DLLEXPORT void reb_simulation_update_tree(struct reb_simulation* const r);


// Functions to add and initialize particles
Expand Down Expand Up @@ -1049,6 +1048,7 @@ struct reb_display_data {

// Functions needed internally or by python interface only.
DLLEXPORT void reb_simulation_init(struct reb_simulation* r); // Used internally and by python. Should not be called by the user.
DLLEXPORT void reb_simulation_update_tree(struct reb_simulation* const r);
DLLEXPORT int reb_simulation_get_next_message(struct reb_simulation* const r, char* const buf); // Get the next stored warning message. Used only if save_messages==1. Return value is 0 if no messages are present, 1 otherwise.
DLLEXPORT int reb_check_fp_contract(); // Returns 1 if floating point contraction are enabled. 0 otherwise.
DLLEXPORT char* reb_simulation_diff_char(struct reb_simulation* r1, struct reb_simulation* r2); // Return the difference between two simulations as a human readable difference. Returned pointer needs to be freed.
Expand Down

0 comments on commit 844cce5

Please sign in to comment.