From dbef61e11c76d1c705f04712b5b1c5e3aa29dd4a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 25 Nov 2025 14:26:46 +0100 Subject: [PATCH 001/174] added .DS_Store to .gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index ab9fc0910f..b7db7e943e 100644 --- a/.gitignore +++ b/.gitignore @@ -455,3 +455,6 @@ packages/dist # standard directory for a virtualenv env/ + +# macOS +.DS_Store From d00f9ae9f9eae60a67d95b965ddce633f8c6c0cb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 25 Nov 2025 15:48:57 +0100 Subject: [PATCH 002/174] added tidymess and started interface.py --- src/amuse_tidymess/interface.py | 721 ++++ src/amuse_tidymess/src/tidymess/README | 19 + .../examples/earth_moon/earth_moon.ic | 24 + .../examples/earth_moon/earth_moon.par | 72 + .../examples/exoplanet_hd80606b/hd80606b.ic | 21 + .../examples/exoplanet_hd80606b/hd80606b.par | 72 + .../examples/heartbeat_star_koi54/koi54.ic | 22 + .../examples/heartbeat_star_koi54/koi54.par | 72 + .../examples/sun_earth_moon/sun_earth_moon.ic | 22 + .../sun_earth_moon/sun_earth_moon.par | 72 + .../src/tidymess/integrator/include/Banner.h | 22 + .../src/tidymess/integrator/include/Body.h | 76 + .../src/tidymess/integrator/include/Breakup.h | 44 + .../tidymess/integrator/include/Collision.h | 49 + .../integrator/include/Evolver_base.h | 70 + .../integrator/include/Evolver_creep.h | 22 + .../integrator/include/Evolver_creep_col.h | 24 + .../integrator/include/Evolver_creep_col_mb.h | 24 + .../integrator/include/Evolver_creep_col_pn.h | 24 + .../include/Evolver_creep_col_pn_mb.h | 24 + .../integrator/include/Evolver_creep_mb.h | 22 + .../integrator/include/Evolver_creep_pn.h | 22 + .../integrator/include/Evolver_creep_pn_mb.h | 22 + .../integrator/include/Evolver_direct.h | 21 + .../integrator/include/Evolver_direct_col.h | 22 + .../include/Evolver_direct_col_mb.h | 22 + .../include/Evolver_direct_col_pn.h | 22 + .../include/Evolver_direct_col_pn_mb.h | 22 + .../integrator/include/Evolver_direct_mb.h | 21 + .../integrator/include/Evolver_direct_pn.h | 21 + .../integrator/include/Evolver_direct_pn_mb.h | 21 + .../integrator/include/Evolver_equilibrium.h | 22 + .../include/Evolver_equilibrium_col.h | 23 + .../include/Evolver_equilibrium_col_mb.h | 23 + .../include/Evolver_equilibrium_col_pn.h | 23 + .../include/Evolver_equilibrium_col_pn_mb.h | 23 + .../include/Evolver_equilibrium_mb.h | 22 + .../include/Evolver_equilibrium_pn.h | 22 + .../include/Evolver_equilibrium_pn_mb.h | 22 + .../integrator/include/Evolver_linear.h | 22 + .../integrator/include/Evolver_linear_col.h | 23 + .../include/Evolver_linear_col_mb.h | 23 + .../include/Evolver_linear_col_pn.h | 23 + .../include/Evolver_linear_col_pn_mb.h | 23 + .../integrator/include/Evolver_linear_mb.h | 22 + .../integrator/include/Evolver_linear_pn.h | 22 + .../integrator/include/Evolver_linear_pn_mb.h | 22 + .../integrator/include/Evolver_nbody.h | 20 + .../integrator/include/Evolver_nbody_base.h | 19 + .../integrator/include/Evolver_nbody_col.h | 22 + .../integrator/include/Evolver_nbody_col_pn.h | 22 + .../integrator/include/Evolver_nbody_pn.h | 20 + .../integrator/include/Evolver_shape_base.h | 32 + .../src/tidymess/integrator/include/Force.h | 154 + .../tidymess/integrator/include/Initializer.h | 174 + .../src/tidymess/integrator/include/Orbit.h | 42 + .../src/tidymess/integrator/include/Output.h | 106 + .../src/tidymess/integrator/include/Shape.h | 77 + .../src/tidymess/integrator/include/Spin.h | 43 + .../src/tidymess/integrator/include/Tidy.h | 234 ++ .../src/tidymess/integrator/include/Timer.h | 25 + .../integrator/include/Timestep_adapt.h | 30 + .../include/Timestep_adapt_weight.h | 31 + .../integrator/include/Timestep_base.h | 55 + .../integrator/include/Timestep_const.h | 28 + .../integrator/include/Timestep_direct.h | 33 + .../include/Timestep_direct_weight.h | 34 + .../src/tidymess/integrator/include/Units.h | 86 + .../src/tidymess/integrator/src/Banner.cpp | 54 + .../src/tidymess/integrator/src/Body.cpp | 258 ++ .../src/tidymess/integrator/src/Breakup.cpp | 81 + .../src/tidymess/integrator/src/Collision.cpp | 477 +++ .../tidymess/integrator/src/Evolver_base.cpp | 74 + .../tidymess/integrator/src/Evolver_creep.cpp | 173 + .../integrator/src/Evolver_creep_col.cpp | 273 ++ .../integrator/src/Evolver_creep_col_mb.cpp | 277 ++ .../integrator/src/Evolver_creep_col_pn.cpp | 277 ++ .../src/Evolver_creep_col_pn_mb.cpp | 281 ++ .../integrator/src/Evolver_creep_mb.cpp | 175 + .../integrator/src/Evolver_creep_pn.cpp | 175 + .../integrator/src/Evolver_creep_pn_mb.cpp | 177 + .../integrator/src/Evolver_direct.cpp | 106 + .../integrator/src/Evolver_direct_col.cpp | 181 + .../integrator/src/Evolver_direct_col_mb.cpp | 199 ++ .../integrator/src/Evolver_direct_col_pn.cpp | 181 + .../src/Evolver_direct_col_pn_mb.cpp | 199 ++ .../integrator/src/Evolver_direct_mb.cpp | 115 + .../integrator/src/Evolver_direct_pn.cpp | 106 + .../integrator/src/Evolver_direct_pn_mb.cpp | 115 + .../integrator/src/Evolver_equilibrium.cpp | 164 + .../src/Evolver_equilibrium_col.cpp | 271 ++ .../src/Evolver_equilibrium_col_mb.cpp | 278 ++ .../src/Evolver_equilibrium_col_pn.cpp | 281 ++ .../src/Evolver_equilibrium_col_pn_mb.cpp | 286 ++ .../integrator/src/Evolver_equilibrium_mb.cpp | 167 + .../integrator/src/Evolver_equilibrium_pn.cpp | 167 + .../src/Evolver_equilibrium_pn_mb.cpp | 171 + .../integrator/src/Evolver_linear.cpp | 150 + .../integrator/src/Evolver_linear_col.cpp | 245 ++ .../integrator/src/Evolver_linear_col_mb.cpp | 249 ++ .../integrator/src/Evolver_linear_col_pn.cpp | 249 ++ .../src/Evolver_linear_col_pn_mb.cpp | 253 ++ .../integrator/src/Evolver_linear_mb.cpp | 151 + .../integrator/src/Evolver_linear_pn.cpp | 152 + .../integrator/src/Evolver_linear_pn_mb.cpp | 154 + .../tidymess/integrator/src/Evolver_nbody.cpp | 61 + .../integrator/src/Evolver_nbody_base.cpp | 22 + .../integrator/src/Evolver_nbody_col.cpp | 112 + .../integrator/src/Evolver_nbody_col_pn.cpp | 127 + .../integrator/src/Evolver_nbody_pn.cpp | 76 + .../integrator/src/Evolver_shape_base.cpp | 29 + .../src/tidymess/integrator/src/Force.cpp | 3062 ++++++++++++++++ .../tidymess/integrator/src/Initializer.cpp | 3112 +++++++++++++++++ .../src/tidymess/integrator/src/Orbit.cpp | 212 ++ .../src/tidymess/integrator/src/Output.cpp | 2415 +++++++++++++ .../src/tidymess/integrator/src/Shape.cpp | 860 +++++ .../src/tidymess/integrator/src/Spin.cpp | 177 + .../src/tidymess/integrator/src/Tidy.cpp | 589 ++++ .../src/tidymess/integrator/src/Timer.cpp | 41 + .../integrator/src/Timestep_adapt.cpp | 53 + .../integrator/src/Timestep_adapt_weight.cpp | 154 + .../tidymess/integrator/src/Timestep_base.cpp | 76 + .../integrator/src/Timestep_const.cpp | 14 + .../integrator/src/Timestep_direct.cpp | 95 + .../integrator/src/Timestep_direct_weight.cpp | 206 ++ .../src/tidymess/integrator/src/Units.cpp | 485 +++ .../src/tidymess/integrator/src/tidymess.cpp | 502 +++ src/amuse_tidymess/src/tidymess/makefile | 33 + src/amuse_tidymess/src/tidymess/tidymess.ic | 20 + src/amuse_tidymess/src/tidymess/tidymess.par | 72 + 130 files changed, 23328 insertions(+) create mode 100644 src/amuse_tidymess/interface.py create mode 100644 src/amuse_tidymess/src/tidymess/README create mode 100755 src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.ic create mode 100755 src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.par create mode 100755 src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.ic create mode 100755 src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.par create mode 100755 src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.ic create mode 100755 src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.par create mode 100755 src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.ic create mode 100755 src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.par create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Banner.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Body.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Breakup.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Collision.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_base.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_mb.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn_mb.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_base.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_pn.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_shape_base.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Force.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Initializer.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Orbit.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Output.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Shape.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Spin.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Tidy.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Timer.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt_weight.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_base.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_const.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct_weight.h create mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Units.h create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Banner.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Body.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Breakup.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Collision.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_base.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn_mb.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_mb.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn_mb.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_base.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_pn.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_shape_base.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Force.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Initializer.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Orbit.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Output.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Shape.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Spin.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Tidy.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Timer.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt_weight.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_base.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_const.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct.cpp create mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct_weight.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Units.cpp create mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/tidymess.cpp create mode 100755 src/amuse_tidymess/src/tidymess/makefile create mode 100755 src/amuse_tidymess/src/tidymess/tidymess.ic create mode 100755 src/amuse_tidymess/src/tidymess/tidymess.par diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py new file mode 100644 index 0000000000..0c9f26062c --- /dev/null +++ b/src/amuse_tidymess/interface.py @@ -0,0 +1,721 @@ +from amuse.community import * +from amuse.community.interface.gd import GravitationalDynamics +from amuse.community.interface.gd import GravitationalDynamicsInterface +from amuse.community.interface.gd import GravityFieldInterface +from amuse.community.interface.gd import GravityFieldCode + +# *** This script, together with the defaults in +# *** GravitationalDynamicsInterface, will be used to generate both +# *** the header file interface.h and the stub interface.cc. Since +# *** interface.cc has been hand-coded to implement the details, +# *** MAKE SURE TO SAVE IT SOMEWHERE, as build.py can overwrite it! + +class ph4Interface(CodeInterface, + LiteratureReferencesMixIn, + GravitationalDynamicsInterface, + StoppingConditionInterface, + GravityFieldInterface): + """ + Parallel, GPU-accelerated, N-body integration module with block + time steps, using a 4th-order Hermite integration scheme. + + .. [#] ADS:2018araa.book.....P (Portegies Zwart, S. & McMillan, S.L.W., 2018) + """ + + # Interface specification. + + include_headers = ['ph4_worker.h', 'stopcond.h'] + + MODE_GPU = 'gpu' + MODE_CPU = 'cpu' + + def __init__(self, mode = MODE_CPU, **options): + CodeInterface.__init__( + self, + name_of_the_worker=self.name_of_the_muse_worker(mode), + **options + ) + LiteratureReferencesMixIn.__init__(self) + + # Interface functions: + @legacy_function + def new_particle(): + """ + Define a new particle in the stellar dynamics code. The + particle is initialized with the provided mass, radius, + position and velocity. This function returns an index that + can be used to refer to this particle. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter('index_of_the_particle', dtype='int32', + direction=function.OUT, description = + """ + An index assigned to the newly created particle. + This index is supposed to be a local index for the code + (and not valid in other instances of the code or in other codes) + """, + unit = INDEX + ) + + function.addParameter('mass', dtype='float64', direction=function.IN, + description = "The mass of the particle", + unit = nbody_system.mass) + function.addParameter('x', dtype='float64', direction=function.IN, + description = "The initial position vector of the particle", + unit = nbody_system.length) + function.addParameter('y', dtype='float64', direction=function.IN, + description = "The initial position vector of the particle", + unit = nbody_system.length) + function.addParameter('z', dtype='float64', direction=function.IN, + description = "The initial position vector of the particle", + unit = nbody_system.length) + function.addParameter('vx', dtype='float64', direction=function.IN, + description = "The initial velocity vector of the particle", + unit = nbody_system.speed) + function.addParameter('vy', dtype='float64', direction=function.IN, + description = "The initial velocity vector of the particle", + unit = nbody_system.speed) + function.addParameter('vz', dtype='float64', direction=function.IN, + description = "The initial velocity vector of the particle", + unit = nbody_system.speed) + function.addParameter('radius', dtype='float64', direction=function.IN, + description = "The radius of the particle", + default = -1, unit = nbody_system.length) + function.addParameter('id', dtype='int32', direction=function.IN, + description = "Identifier of the particle, " + +"option for restoring state after loading", + default = -1, unit = NO_UNIT) + function.result_type = 'int32' + function.result_doc = """ 0 - OK + particle was created and added to the model + -1 - ERROR + particle could not be created""" + return function + + @legacy_function + def get_particle_timestep(): + """ + Retrieve the timestep of a particle. + """ + function = LegacyFunctionSpecification() + function.addParameter('index_of_the_particle', + dtype='int32', + direction=function.IN, + description = "Index of the particle to get the timestep from. This index must have been returned by an earlier call to :meth:`new_particle`") + function.addParameter('timestep', + dtype='float64', + unit=nbody_system.time, + direction=function.OUT, + description = "The current timestep of the particle") + function.result_type = 'int32' + function.can_handle_array = True + return function + + def name_of_the_muse_worker(self, mode): + if mode == self.MODE_CPU: + return 'ph4_worker' + elif mode == self.MODE_GPU: + return 'ph4_sapporo_worker' + else: + return 'ph4_worker' + + # Inheritance from GravitationalDynamicsInterface means that + # functions in the standard interface don't need to be defined. + # See interface.py.2 for a laboriously hand-coded version written + # before I discovered this fact! (Steve McMillan, 10/10) + + # Additional functions defined here will be reflected in + # interface.h and must be provided in interface.cc in order for + # ph4_worker to build. + + # The following functions aren't defined in the default interface: + @legacy_function + def set_time(): + """ + Set the model time. Should use set_begin_time! + """ + function = LegacyFunctionSpecification() + function.addParameter('time', dtype='float64', direction=function.IN, + description = "The model time to start at", unit = nbody_system.time) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + Time value was changed + -2 - ERROR + The code does not support setting the time + """ + return function + + @legacy_function + def set_eta(): + """ + Set the current accuracy parameter. + """ + function = LegacyFunctionSpecification() + function.addParameter('eta', dtype='float64', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_eta(): + """ + Get the current accuracy parameter. + """ + function = LegacyFunctionSpecification() + function.addParameter('eta', dtype='float64', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_gpu(): + """ + Set use_gpu. + """ + function = LegacyFunctionSpecification() + function.addParameter('gpu', dtype='int32', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_gpu(): + """ + Get use_gpu. + """ + function = LegacyFunctionSpecification() + function.addParameter('gpu', dtype='int32', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_gpu_id(): + """ + Set gpu_id. + """ + function = LegacyFunctionSpecification() + function.addParameter('gpu_id', dtype='int32', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_gpu_id(): + """ + Get gpu_id. + """ + function = LegacyFunctionSpecification() + function.addParameter('gpu_id', dtype='int32', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_manage_encounters(): + """ + Set the value of manage_encounters. + """ + function = LegacyFunctionSpecification() + function.addParameter('manage_encounters', dtype='int32', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_manage_encounters(): + """ + Get the value of manage_encounters. + """ + function = LegacyFunctionSpecification() + function.addParameter('manage_encounters', dtype='int32', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_zero_step_mode(): + """ + Set the value of zero_step_mode. + """ + function = LegacyFunctionSpecification() + function.addParameter('zero_step_mode', dtype='int32', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_zero_step_mode(): + """ + Get the value of zero_step_mode. + """ + function = LegacyFunctionSpecification() + function.addParameter('zero_step_mode', dtype='int32', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_force_sync(): + """ + Set the value of force_sync. + """ + function = LegacyFunctionSpecification() + function.addParameter('force_sync', dtype='int32', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_force_sync(): + """ + Get the value of force_sync. + """ + function = LegacyFunctionSpecification() + function.addParameter('force_sync', dtype='int32', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_sync_time(): + """ + Set the value of sync_time. + """ + function = LegacyFunctionSpecification() + function.addParameter('sync_time', dtype='float64', + direction=function.IN, unit = nbody_system.time) + function.result_type = 'int32' + return function + + @legacy_function + def get_sync_time(): + """ + Get the value of sync_time. + """ + function = LegacyFunctionSpecification() + function.addParameter('sync_time', dtype='float64', + direction=function.OUT, unit = nbody_system.time) + function.result_type = 'int32' + return function + + @legacy_function + def set_block_steps(): + """ + Set the value of block_steps. + """ + function = LegacyFunctionSpecification() + function.addParameter('set_block_steps', dtype='int32', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_block_steps(): + """ + Get the value of block_steps. + """ + function = LegacyFunctionSpecification() + function.addParameter('get_block_steps', dtype='int32', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_total_steps(): + """ + Set the value of total_steps. + """ + function = LegacyFunctionSpecification() + function.addParameter('set_total_steps', dtype='int32', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_total_steps(): + """ + Get the value of total_steps. + """ + function = LegacyFunctionSpecification() + function.addParameter('get_total_steps', dtype='int32', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def get_number_of_particles_updated(): + """ + Return the number of particles added or deleted during the last evolve. + """ + function = LegacyFunctionSpecification() + function.addParameter('index', dtype='int32', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def get_id_of_updated_particle(): + """ + Return the number of particles added or deleted during the last evolve. + """ + function = LegacyFunctionSpecification() + function.addParameter('index_of_update', dtype='int32', + direction=function.IN, + description = 'index in the updated particles list') + function.addParameter('index_of_particle', dtype='int32', + direction=function.OUT) + function.addParameter('kind_of_update', dtype='int32', + direction=function.OUT, + description = 'kind of update (2, addition), (1, deletion)') + function.can_handle_array = True + function.result_type = 'int32' + return function + + @legacy_function + def get_binary_energy(): + """ + Return the total energy in all binaries. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'binary_energy', + dtype='float64', + direction=function.OUT, + unit = nbody_system.energy + ) + function.result_type = 'int32' + return function + + @legacy_function + def set_initial_timestep_fac(): + """ + Set the current accuracy parameter. + """ + function = LegacyFunctionSpecification() + function.addParameter('initial_timestep_fac', dtype='float64', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_initial_timestep_fac(): + """ + Get the current accuracy parameter. + """ + function = LegacyFunctionSpecification() + function.addParameter('initial_timestep_fac', dtype='float64', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_initial_timestep_limit(): + """ + Set the current accuracy parameter. + """ + function = LegacyFunctionSpecification() + function.addParameter('initial_timestep_limit', dtype='float64', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_initial_timestep_limit(): + """ + Get the current accuracy parameter. + """ + function = LegacyFunctionSpecification() + function.addParameter('initial_timestep_limit', dtype='float64', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def set_initial_timestep_median(): + """ + Set the current accuracy parameter. + """ + function = LegacyFunctionSpecification() + function.addParameter('initial_timestep_median', dtype='float64', + direction=function.IN) + function.result_type = 'int32' + return function + + @legacy_function + def get_initial_timestep_median(): + """ + Get the current accuracy parameter. + """ + function = LegacyFunctionSpecification() + function.addParameter('initial_timestep_median', dtype='float64', + direction=function.OUT) + function.result_type = 'int32' + return function + + @legacy_function + def recompute_timesteps(): + """ + Force recomputation of all timesteps (assume a synchronized system), + """ + function = LegacyFunctionSpecification() + function.result_type = 'int32' + return function + + +class ph4(GravitationalDynamics,GravityFieldCode): + + # The actual module. + + def __init__(self, convert_nbody = None, **keyword_arguments): + legacy_interface = ph4Interface(**keyword_arguments) + + self.stopping_conditions = StoppingConditions(self) + + GravitationalDynamics.__init__(self, + legacy_interface, + convert_nbody, + **keyword_arguments) + + def define_state(self, handler): + GravitationalDynamics.define_state(self, handler) + handler.add_method('RUN', 'get_particle_timestep') + GravityFieldCode.define_state(self, handler) + + handler.add_method('EDIT', 'set_state') + handler.add_method('EDIT', 'set_velocity') + handler.add_method('EDIT', 'set_mass') + handler.add_method('EDIT', 'set_position') + handler.add_method('CHANGED','before_get_parameter') + + handler.add_transition('RUN', 'CHANGED', 'set_state', False) + handler.add_transition('RUN', 'CHANGED', 'set_velocity', False) + handler.add_transition('RUN', 'CHANGED', 'set_mass', False) + handler.add_transition('RUN', 'CHANGED', 'set_position', False) + handler.add_transition('CHANGED', 'RUN', 'synchronize_model') + handler.add_method('CHANGED', 'get_state') + handler.add_method('CHANGED', 'get_mass') + handler.add_method('CHANGED', 'get_position') + handler.add_method('CHANGED', 'get_velocity') + handler.add_method('CHANGED', 'get_particle_timestep') + + self.stopping_conditions.define_state(handler) + + def define_parameters(self, handler): + + # Set/get parameters specific to the module, not part of the + # standard interface. Accessors used here must be defined + # above and reflected in interface.cc. Python access is + # (e.g.) + # + # ph4.parameters.timestep_parameter = xxx + + handler.add_method_parameter( + "get_eta", # getter name in interface.cc + "set_eta", # setter name in interface.cc + "timestep_parameter", # python parameter name + "timestep parameter", # description + default_value = 0.14 + ) + + handler.add_method_parameter( + "get_eps2", # already defined in standard interface + "set_eps2", # already defined in standard interface + "epsilon_squared", + "smoothing parameter for gravity calculations", + default_value = 0.0 | nbody_system.length * nbody_system.length + ) + + handler.add_method_parameter( + "get_gpu", # getter name in interface.cc + "set_gpu", # setter name in interface.cc + "use_gpu", # python parameter name + "use GPU", # description + default_value = 1 + ) + + handler.add_method_parameter( + "get_gpu_id", # getter name in interface.cc + "set_gpu_id", # setter name in interface.cc + "gpu_id", # python parameter name + "GPU ID", # description + default_value = -1 + ) + + handler.add_method_parameter( + "get_manage_encounters", # getter name in interface.cc + "set_manage_encounters", # setter name in interface.cc + "manage_encounters", # python parameter name + "manage close encounters", # description + default_value = 4 + ) + + handler.add_method_parameter( + "get_begin_time", + "set_begin_time", + "begin_time", + "model time at which to start the simulation", + default_value = 0.0 | nbody_system.time + ) + + handler.add_method_parameter( + "get_sync_time", + "set_sync_time", + "sync_time", + "last model synchronization time", + default_value = 0.0 | nbody_system.time + ) + + handler.add_method_parameter( + "get_zero_step_mode", + "set_zero_step_mode", + "zero_step_mode", + "force evolve_model to take zero-length steps", + default_value = 0 + ) + + handler.add_method_parameter( + "get_force_sync", + "set_force_sync", + "force_sync", + "force evolve_model to sync at specified time", + default_value = 0 + ) + + handler.add_method_parameter( + "get_block_steps", + "set_block_steps", + "block_steps", + "number of block steps", + default_value = 0 + ) + + handler.add_method_parameter( + "get_total_steps", + "set_total_steps", + "total_steps", + "total number of steps", + default_value = 0 + ) + + handler.add_method_parameter( + "get_initial_timestep_fac", # getter name in interface.cc + "set_initial_timestep_fac", # setter name in interface.cc + "initial_timestep_fac", # python parameter name + "initial timestep factor", # description + default_value = 0.0625 + ) + + handler.add_method_parameter( + "get_initial_timestep_limit", # getter name in interface.cc + "set_initial_timestep_limit", # setter name in interface.cc + "initial_timestep_limit", # python parameter name + "initial timestep limit", # description + default_value = 0.03125 + ) + + handler.add_method_parameter( + "get_initial_timestep_median", # getter name in interface.cc + "set_initial_timestep_median", # setter name in interface.cc + "initial_timestep_median", # python parameter name + "initial timestep median factor", # description + default_value = 8.0 + ) + + self.stopping_conditions.define_parameters(handler) + + def update_particle_set(self): + """ + update the particle set after changes in the code + + this implementation needs to move to the + amuse.datamodel.incode_storage module, as + it uses a lot of internal methods and info! + + """ + number_of_updated_particles = self.get_number_of_particles_updated() + + if number_of_updated_particles == 0: + return + + indices_in_update_list = list(range(number_of_updated_particles)) + particle_indices, updates \ + = self.get_id_of_updated_particle(indices_in_update_list) + + incode_storage = self.particles._private.attribute_storage + + indices_to_remove = [] + indices_to_add = [] + for index, status in zip(particle_indices, updates): + if status == 1: # deletion + indices_to_remove.append(index) + elif status == 2: # addition + indices_to_add.append(index) + + print('') + print("indices_to_remove:", indices_to_remove) + print("indices_to_add:", indices_to_add) + + if len(indices_to_remove) > 0: + incode_storage._remove_indices(indices_to_remove) + if len(indices_to_add) > 0: + incode_storage._add_indices(indices_to_add) + + def define_methods(self, handler): + GravitationalDynamics.define_methods(self, handler) + + # Turn interface functions into methods. + handler.add_method( + "new_particle", + ( + nbody_system.mass, + nbody_system.length, + nbody_system.length, + nbody_system.length, + nbody_system.speed, + nbody_system.speed, + nbody_system.speed, + nbody_system.length, + handler.NO_UNIT + ), + ( + handler.INDEX, + handler.ERROR_CODE + ) + ) + + handler.add_method( + "set_eps2", + ( + nbody_system.length * nbody_system.length + ), + ( + handler.ERROR_CODE + ) + ) + + handler.add_method( + "get_eps2", + (), + ( + nbody_system.length * nbody_system.length, + handler.ERROR_CODE + ) + ) + + self.stopping_conditions.define_methods(handler) + + def define_particle_sets(self, handler): + GravitationalDynamics.define_particle_sets(self, handler) + + handler.add_getter('particles', 'get_particle_timestep', + names = ('timestep',)) + handler.add_getter('particles', 'get_potential', + names=('potential_in_code',)) + + self.stopping_conditions.define_particle_set(handler) + + +Ph4 = ph4 diff --git a/src/amuse_tidymess/src/tidymess/README b/src/amuse_tidymess/src/tidymess/README new file mode 100644 index 0000000000..18aa7fbfe5 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/README @@ -0,0 +1,19 @@ +Welcome to TIDYMESS! + +- TIDYMESS is a C++ code. +- It was developed and tested within the Ubuntu and Mac environments. + +- Simpy open a terminal, enter the tidymess directory, and compile the code using "make clean" and "make". +- The compilation will produce the executable (tidymess.exe) and the "build" folder inside the "integrator" folder. +- If there are compilation errors due to bugs within the code, please contact us with the error message. + +- By typing "./tidymess.exe -h" or "./tidymess.exe --help" some documentation is presented on how to run the code. +- A simulation is defined by specifying two files: parameter file (e.g. tidymess.par) and initial condition file (e.g. tidymess.ic). +- We provide a few examples in the "examples" folder, which can be used to get you on your way with TIDYMESS. + +Boa Sorte! + + +Tjarda Boekholt and Alexandre Correia +Oct. 2022 + diff --git a/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.ic b/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.ic new file mode 100755 index 0000000000..aa786c264b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.ic @@ -0,0 +1,24 @@ +Name Earth Moon + +mass[kg] 5.9724e24 0.07346e24 +R[km] 6371. 1737.4 +xi 0.3308 0.394 + +kf 0.933 0 +tau[s] 180 0 + +lod[day] 1.0 27.322 +obl[deg] 0.0 0.0 +psi[deg] 0.0 0.0 + +database: IMCCE INPOP19a +reference plane: Geocentric, equatorial, J2000 +Epoque: 2021-06-21T21:43:31.044 + +a[km] 0.3844e6 +e 0.0 +I 0 +O 0 +w 0 +M 0 + diff --git a/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.par b/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.par new file mode 100755 index 0000000000..866727e431 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.par @@ -0,0 +1,72 @@ +//-------------------------------------------------------------------------------------------------- +// Simulation parameters +//-------------------------------------------------------------------------------------------------- + +to_continue = 0 // 0=new simulation, 1=continue simulation +max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. + +//-------------------------------------------------------------------------------------------------- +// Physical model parameters +//-------------------------------------------------------------------------------------------------- + +tidal_model = 4 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess +pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn +B_braking = 0 // Magnetic braking. 0=off, 1=on + +collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace +roche_limit = 0 // 0=off, 1=flag, 2=exception +breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception + +//-------------------------------------------------------------------------------------------------- +// Unit system +//-------------------------------------------------------------------------------------------------- + +mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] +length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] +time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] +speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] + +speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. + +//-------------------------------------------------------------------------------------------------- +// Initial condition parameters +//-------------------------------------------------------------------------------------------------- + +file_ic = earth_moon.ic // initial condition file + +orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian +spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit + +initial_shape = 0 // 0=sphere, 1=equilibrium +num_body = 0 // 0=all, num_body+1=number of bodies to include + +//-------------------------------------------------------------------------------------------------- +// Output parameters +//-------------------------------------------------------------------------------------------------- + +snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval +n_snapshot = 1e2 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) + +output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. +overwrite = 1 // overwrite existing files: 0=no, 1=yes + +output_format = 0 // 0=file per body, 1=file per snapshot, 2=single file +output_info = 1 // 0=time-varying quantities, 1=all quantities +output_coor = 0 // 0=cartesian inertial + +output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' +output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes + +//-------------------------------------------------------------------------------------------------- +// Integration parameters +//-------------------------------------------------------------------------------------------------- + +t_begin = 0 // begin time in units given by time_unit +t_end = 1e3 // final time in units given by time_unit + +dt_mode = 2 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt +dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) +eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) + +n_iter = 1 // Number of iterations to improve reversibility (default=1) + diff --git a/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.ic b/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.ic new file mode 100755 index 0000000000..25d1e732e5 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.ic @@ -0,0 +1,21 @@ +Name Star Planet + +mass[kg] 2.0088092e+30 7.7459434e+27 +R[km] 702455.0 68488.3446 +xi 0.070 0.25 + +kf 0.0 0.5 +tau[yr] 0 1e-2 + +lod[day] 24.47 0.5 +obl[deg] 0.0 0.0 +psi[deg] 0.0 0.0 + +a[AU] 0.455 +e 0.9330 +I 0 +O 0 +w 0 +M 0 + + diff --git a/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.par b/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.par new file mode 100755 index 0000000000..39e9236f53 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.par @@ -0,0 +1,72 @@ +//-------------------------------------------------------------------------------------------------- +// Simulation parameters +//-------------------------------------------------------------------------------------------------- + +to_continue = 0 // 0=new simulation, 1=continue simulation +max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. + +//-------------------------------------------------------------------------------------------------- +// Physical model parameters +//-------------------------------------------------------------------------------------------------- + +tidal_model = 4 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess +pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn +B_braking = 0 // Magnetic braking. 0=off, 1=on + +collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace +roche_limit = 0 // 0=off, 1=flag, 2=exception +breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception + +//-------------------------------------------------------------------------------------------------- +// Unit system +//-------------------------------------------------------------------------------------------------- + +mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] +length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] +time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] +speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] + +speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. + +//-------------------------------------------------------------------------------------------------- +// Initial condition parameters +//-------------------------------------------------------------------------------------------------- + +file_ic = hd80606b.ic // initial condition file + +orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian +spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit + +initial_shape = 0 // 0=sphere, 1=equilibrium +num_body = 0 // 0=all, num_body+1=number of bodies to include + +//-------------------------------------------------------------------------------------------------- +// Output parameters +//-------------------------------------------------------------------------------------------------- + +snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval +n_snapshot = 1e4 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) + +output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. +overwrite = 1 // overwrite existing files: 0=no, 1=yes + +output_format = 0 // 0=file per body, 1=file per snapshot, 2=single file +output_info = 1 // 0=time-varying quantities, 1=all quantities +output_coor = 0 // 0=cartesian inertial + +output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' +output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes + +//-------------------------------------------------------------------------------------------------- +// Integration parameters +//-------------------------------------------------------------------------------------------------- + +t_begin = 0 // begin time in units given by time_unit +t_end = 1e4 // final time in units given by time_unit + +dt_mode = 2 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt +dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) +eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) + +n_iter = 1 // Number of iterations to improve reversibility (default=1) + diff --git a/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.ic b/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.ic new file mode 100755 index 0000000000..b6fdd325b3 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.ic @@ -0,0 +1,22 @@ +Name Primary Secondary + +mass[MSun] 2.33 2.39 +R[RSun] 2.20 2.33 +xi 0.052 0.052 + +kf 0.012 0.012 +tau[yr] 0.0001 0.0001 + +lod[day] 0.728862612579 2.55101914403 +obl[deg] 0.0 0.0 +psi[deg] 0.0 0.0 + +a[AU] 0.3956 +e 0.8335 +I[deg] 5.50 +O[deg] 0 +w[deg] 36.70 +M[deg] 180 + +# Reference: Welsh et al. (2011) + diff --git a/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.par b/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.par new file mode 100755 index 0000000000..15bd075c8f --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.par @@ -0,0 +1,72 @@ +//-------------------------------------------------------------------------------------------------- +// Simulation parameters +//-------------------------------------------------------------------------------------------------- + +to_continue = 0 // 0=new simulation, 1=continue simulation +max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. + +//-------------------------------------------------------------------------------------------------- +// Physical model parameters +//-------------------------------------------------------------------------------------------------- + +tidal_model = 3 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess +pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn +B_braking = 0 // Magnetic braking. 0=off, 1=on + +collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace +roche_limit = 0 // 0=off, 1=flag, 2=exception +breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception + +//-------------------------------------------------------------------------------------------------- +// Unit system +//-------------------------------------------------------------------------------------------------- + +mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] +length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] +time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] +speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] + +speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. + +//-------------------------------------------------------------------------------------------------- +// Initial condition parameters +//-------------------------------------------------------------------------------------------------- + +file_ic = koi54.ic // initial condition file + +orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian +spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit + +initial_shape = 1 // 0=sphere, 1=equilibrium +num_body = 0 // 0=all, num_body+1=number of bodies to include + +//-------------------------------------------------------------------------------------------------- +// Output parameters +//-------------------------------------------------------------------------------------------------- + +snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval +n_snapshot = 2e2 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) + +output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. +overwrite = 1 // overwrite existing files: 0=no, 1=yes + +output_format = 0 // 0=file per body, 1=file per snapshot, 2=single file +output_info = 1 // 0=time-varying quantities, 1=all quantities +output_coor = 0 // 0=cartesian inertial + +output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' +output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes + +//-------------------------------------------------------------------------------------------------- +// Integration parameters +//-------------------------------------------------------------------------------------------------- + +t_begin = 0 // begin time in units given by time_unit +t_end = 20 // final time in units given by time_unit + +dt_mode = 2 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt +dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) +eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) + +n_iter = 1 // Number of iterations to improve reversibility (default=1) + diff --git a/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.ic b/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.ic new file mode 100755 index 0000000000..c2cd48a4a4 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.ic @@ -0,0 +1,22 @@ +Name Earth Moon Sun + +mass[kg] 5.9724e24 0.07346e24 1.989e30 +R[km] 6371. 1737.4 695700. +xi 0.3308 0.394 0.070 + +kf 0.933 0 0 +tau[s] 1 0 0 + +lod[hour] 5.0 0.0 0.0 +obl[deg] 0.0 0.0 0.0 +psi[deg] 0.0 0.0 0.0 + +a[km] 22298.5 149598073. +e 0.01 0.0 +I 0 10 +O 0 0 +w 0 0 +M 0 0 + +Adopted from Touma & Wisdom (1998) and Williams (2016). + diff --git a/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.par b/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.par new file mode 100755 index 0000000000..4a95a57da3 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.par @@ -0,0 +1,72 @@ +//-------------------------------------------------------------------------------------------------- +// Simulation parameters +//-------------------------------------------------------------------------------------------------- + +to_continue = 0 // 0=new simulation, 1=continue simulation +max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. + +//-------------------------------------------------------------------------------------------------- +// Physical model parameters +//-------------------------------------------------------------------------------------------------- + +tidal_model = 4 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess +pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn +B_braking = 0 // Magnetic braking. 0=off, 1=on + +collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace +roche_limit = 0 // 0=off, 1=flag, 2=exception +breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception + +//-------------------------------------------------------------------------------------------------- +// Unit system +//-------------------------------------------------------------------------------------------------- + +mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] +length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] +time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] +speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] + +speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. + +//-------------------------------------------------------------------------------------------------- +// Initial condition parameters +//-------------------------------------------------------------------------------------------------- + +file_ic = sun_earth_moon.ic // initial condition file + +orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian +spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit + +initial_shape = 0 // 0=sphere, 1=equilibrium +num_body = 0 // 0=all, num_body+1=number of bodies to include + +//-------------------------------------------------------------------------------------------------- +// Output parameters +//-------------------------------------------------------------------------------------------------- + +snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval +n_snapshot = 1e2 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) + +output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. +overwrite = 1 // overwrite existing files: 0=no, 1=yes + +output_format = 0 // 0=file per body, 1=file per snapshot, 2=single file +output_info = 1 // 0=time-varying quantities, 1=all quantities +output_coor = 0 // 0=cartesian inertial + +output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' +output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes + +//-------------------------------------------------------------------------------------------------- +// Integration parameters +//-------------------------------------------------------------------------------------------------- + +t_begin = 0 // begin time in units given by time_unit +t_end = 1e2 // final time in units given by time_unit + +dt_mode = 2 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt +dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) +eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) + +n_iter = 1 // Number of iterations to improve reversibility (default=1) + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Banner.h b/src/amuse_tidymess/src/tidymess/integrator/include/Banner.h new file mode 100644 index 0000000000..9a25f9bb3b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Banner.h @@ -0,0 +1,22 @@ +#include +using namespace std; + +#ifndef __Banner_h +#define __Banner_h + +class Banner { + public: + + void print_banner(); + + void print_intro(bool to_continue); + void print_outro(string output_dir); + + void print_reference(); + void print_stars(); + + void print_header(); +}; + +#endif + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Body.h b/src/amuse_tidymess/src/tidymess/integrator/include/Body.h new file mode 100755 index 0000000000..b2206ea593 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Body.h @@ -0,0 +1,76 @@ +#include +#include +#include +using namespace std; + +#ifndef __Body_h +#define __Body_h + +class Body { + public: + + // Initializers + Body(); + + Body(double m, double R, double xi, double kf, double tau, double a_mb, double wx, double wy, double wz, double x, double y, double z, double vx, double vy, double vz); + Body(double m, double R, double xi, double kf, double tau, double a_mb, array w, array r, array v); + Body(array &d); + + void setup(array &d); + void set_id(int id); + void set_name(string name); + + void reset(); + void update_aux_properties(); + + // Tag + int id; + string name; + + int particle_type; // 0 = test-particle, 1 = point-particle, 2 = rigid sphere, 3 = deformable ellipsoid + + // Internal properties + double m, R, xi; + double kf, tau; + double a_mb; + + double R3, R5, R5_3, kf_R5, kf_R5_3; + double rho, tau_inv; + + double roche_factor, roche_factor3; + + // Orbital properties + array r, v; + array a; + + array r_prev; + array vv; + + // Spin properties + array L, w; + array T; + + array L_prev, w_prev; + array K; + + // Shape properties + array I_p, I_n, I, I_inv; + array I_e_r, dI_e_r, I_e_w, I_e, dI_e, dI_n; + + array I_e_rh, I_e_prev, I_n_prev, I_e_prev_bu; + array J_n, J, J_inv; + + // Integration variables + bool isLinear; + double expo, expoh, dt_rot, dth_rot; + + bool isLinear_1; + double expo_1, expoh_1, dt_rot_1, dth_rot_1; + + bool isLinear_2; + double expo_2, expoh_2, dt_rot_2, dth_rot_2; +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Breakup.h b/src/amuse_tidymess/src/tidymess/integrator/include/Breakup.h new file mode 100755 index 0000000000..2be0dd144b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Breakup.h @@ -0,0 +1,44 @@ +#include +using namespace std; + +#include +#include +#include +#include +#include + +#include "Body.h" + +#ifndef __Breakup_h +#define __Breakup_h + +class Breakup { + public: + + // Variables and structures + bool to_detect; + int mode; + + vector breakup_id; + int N_breakup; + + // Initializers + Breakup(); + + // Getters and Setters + void set_breakup_mode(int breakup_mode); + void setup(); + + int get_N_breakup(); + vector get_breakup_indices(); + + // Handlers + bool detect_breakup(vector &bodies); + + // Printer + void print_id(); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Collision.h b/src/amuse_tidymess/src/tidymess/integrator/include/Collision.h new file mode 100755 index 0000000000..7b0285cba7 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Collision.h @@ -0,0 +1,49 @@ +#include +using namespace std; + +#include +#include +#include +#include + +#include "Body.h" + +#ifndef __Collision_h +#define __Collision_h + +class Collision { + public: + + // Variables and structures + int collision_mode, roche_mode; + bool to_detect_collision, to_detect_roche; + + vector< vector > chain_id, chain_index; + int Ng; + + // Initializers + Collision(); + + // Getters and Setters + void set_collision_mode(int collision_mode); + void set_roche_mode(int roche_mode); + + void setup(); + + // Handlers + void process_collision_chains(vector< array > &cindex); + void convert_id_to_index(vector &bodies); + + void replace_test_body(vector &bodies, int i, int Ns, vector &index_sec); + void replace_point_body(vector &bodies, int i, int Ns, vector &index_sec); + void replace_tidal_body(vector &bodies, int i, int Ns, vector &index_sec); + + void replace(vector &bodies, vector< array > &cindex); + + // Printer + void print_indices(vector< array > &cindex); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_base.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_base.h new file mode 100644 index 0000000000..cec63112d9 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_base.h @@ -0,0 +1,70 @@ +#include "Force.h" + +#include "Timestep_base.h" + +#include "Timestep_const.h" +#include "Timestep_adapt.h" +#include "Timestep_direct.h" +#include "Timestep_adapt_weight.h" +#include "Timestep_direct_weight.h" + +#include "Orbit.h" +#include "Spin.h" +#include "Shape.h" + +#ifndef __Evolver_base_h +#define __Evolver_base_h + +class Evolver_base { + public: + + // Variables and Objects + Orbit orbit; + Spin spin; + Shape shape; + + double dt_step; + double w1, w2, w3; + int n_iter; + int num_integration_step; + + int collision_mode, roche_mode; + bool collision_flag, roche_flag; + + // Initializers + Evolver_base(); + + void assign_vectors(vector &bodies, Force *force); + + void set_n_iter(int n_iter); + int get_n_iter(); + + void reset_aux(vector &bodies); + + void set_collision_mode(int collision_mode); + void set_roche_mode(int roche_mode); + + // Get diagnostics + array get_center_of_mass(vector &bodies); + array get_center_of_mass_velocity(vector &bodies); + array get_orbital_angular_momentum(vector &bodies); + double get_orbital_kinetic_energy(vector &bodies); + + virtual array get_spin_angular_momentum(vector &bodies) = 0; + virtual double get_spin_kinetic_energy(vector &bodies) = 0; + virtual double get_potential_energy(vector &bodies) = 0; + virtual array get_angular_momentum(vector &bodies) = 0; + virtual double get_energy(vector &bodies) = 0; + + // Evolve function + virtual void initialize(vector &bodies, Force *force) = 0; + + virtual void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) = 0; + virtual void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) = 0; + + bool stopping_condition_time(double t0, double t1, int dt_sgn); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep.h new file mode 100644 index 0000000000..0d4b25a3ee --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_creep_h +#define __Evolver_creep_h + +class Evolver_creep : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dth); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col.h new file mode 100644 index 0000000000..206c60aa29 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col.h @@ -0,0 +1,24 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_creep_col_h +#define __Evolver_creep_col_h + +class Evolver_creep_col : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void sync_step(vector &bodies, Force *force, double dth); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_mb.h new file mode 100644 index 0000000000..8f46af13df --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_mb.h @@ -0,0 +1,24 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_creep_col_mb_h +#define __Evolver_creep_col_mb_h + +class Evolver_creep_col_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void sync_step(vector &bodies, Force *force, double dth); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn.h new file mode 100644 index 0000000000..1436a2fe43 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn.h @@ -0,0 +1,24 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_creep_col_pn_h +#define __Evolver_creep_col_pn_h + +class Evolver_creep_col_pn : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void sync_step(vector &bodies, Force *force, double dth); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn_mb.h new file mode 100644 index 0000000000..65a82b77e1 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn_mb.h @@ -0,0 +1,24 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_creep_col_pn_mb_h +#define __Evolver_creep_col_pn_mb_h + +class Evolver_creep_col_pn_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void sync_step(vector &bodies, Force *force, double dth); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_mb.h new file mode 100644 index 0000000000..41a4971fa5 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_mb.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_creep_mb_h +#define __Evolver_creep_mb_h + +class Evolver_creep_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dth); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn.h new file mode 100644 index 0000000000..ac73877a96 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_creep_pn_h +#define __Evolver_creep_pn_h + +class Evolver_creep_pn : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dth); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn_mb.h new file mode 100644 index 0000000000..90169c7f94 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn_mb.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_creep_pn_mb_h +#define __Evolver_creep_pn_mb_h + +class Evolver_creep_pn_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dth); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct.h new file mode 100644 index 0000000000..8fceda6b29 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct.h @@ -0,0 +1,21 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_direct_h +#define __Evolver_direct_h + +class Evolver_direct : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col.h new file mode 100644 index 0000000000..9e0002f645 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_direct_col_h +#define __Evolver_direct_col_h + +class Evolver_direct_col : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_mb.h new file mode 100644 index 0000000000..2d2429f912 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_mb.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_direct_col_mb_h +#define __Evolver_direct_col_mb_h + +class Evolver_direct_col_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn.h new file mode 100644 index 0000000000..6738b1a1ba --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_direct_col_pn_h +#define __Evolver_direct_col_pn_h + +class Evolver_direct_col_pn : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn_mb.h new file mode 100644 index 0000000000..67dab7ded7 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn_mb.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_direct_col_pn_mb_h +#define __Evolver_direct_col_pn_mb_h + +class Evolver_direct_col_pn_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_mb.h new file mode 100644 index 0000000000..798ed74906 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_mb.h @@ -0,0 +1,21 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_direct_mb_h +#define __Evolver_direct_mb_h + +class Evolver_direct_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn.h new file mode 100644 index 0000000000..632ce97398 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn.h @@ -0,0 +1,21 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_direct_pn_h +#define __Evolver_direct_pn_h + +class Evolver_direct_pn : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn_mb.h new file mode 100644 index 0000000000..6a1e4f47d7 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn_mb.h @@ -0,0 +1,21 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_direct_pn_mb_h +#define __Evolver_direct_pn_mb_h + +class Evolver_direct_pn_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium.h new file mode 100644 index 0000000000..ed02a61600 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_equilibrium_h +#define __Evolver_equilibrium_h + +class Evolver_equilibrium : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col.h new file mode 100644 index 0000000000..f4dde32b9f --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col.h @@ -0,0 +1,23 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_equilibrium_col_h +#define __Evolver_equilibrium_col_h + +class Evolver_equilibrium_col : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_mb.h new file mode 100644 index 0000000000..17ebce22cb --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_mb.h @@ -0,0 +1,23 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_equilibrium_col_mb_h +#define __Evolver_equilibrium_col_mb_h + +class Evolver_equilibrium_col_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn.h new file mode 100644 index 0000000000..f0108c3fd9 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn.h @@ -0,0 +1,23 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_equilibrium_col_pn_h +#define __Evolver_equilibrium_col_pn_h + +class Evolver_equilibrium_col_pn : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn_mb.h new file mode 100644 index 0000000000..b7988a7c06 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn_mb.h @@ -0,0 +1,23 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_equilibrium_col_pn_mb_h +#define __Evolver_equilibrium_col_pn_mb_h + +class Evolver_equilibrium_col_pn_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_mb.h new file mode 100644 index 0000000000..e13ec496e3 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_mb.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_equilibrium_mb_h +#define __Evolver_equilibrium_mb_h + +class Evolver_equilibrium_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn.h new file mode 100644 index 0000000000..34e3ac4a76 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_equilibrium_pn_h +#define __Evolver_equilibrium_pn_h + +class Evolver_equilibrium_pn : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn_mb.h new file mode 100644 index 0000000000..62729b224b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn_mb.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_equilibrium_pn_mb_h +#define __Evolver_equilibrium_pn_mb_h + +class Evolver_equilibrium_pn_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear.h new file mode 100644 index 0000000000..3ea264c5ed --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_linear_h +#define __Evolver_linear_h + +class Evolver_linear : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dt); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col.h new file mode 100644 index 0000000000..34f838ee82 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col.h @@ -0,0 +1,23 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_linear_col_h +#define __Evolver_linear_col_h + +class Evolver_linear_col : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dt); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_mb.h new file mode 100644 index 0000000000..5abcd65f22 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_mb.h @@ -0,0 +1,23 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_linear_col_mb_h +#define __Evolver_linear_col_mb_h + +class Evolver_linear_col_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dt); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn.h new file mode 100644 index 0000000000..a0906ad679 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn.h @@ -0,0 +1,23 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_linear_col_pn_h +#define __Evolver_linear_col_pn_h + +class Evolver_linear_col_pn : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dt); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn_mb.h new file mode 100644 index 0000000000..698b1509bc --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn_mb.h @@ -0,0 +1,23 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_linear_col_pn_mb_h +#define __Evolver_linear_col_pn_mb_h + +class Evolver_linear_col_pn_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dt); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_mb.h new file mode 100644 index 0000000000..e5724880ad --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_mb.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_linear_mb_h +#define __Evolver_linear_mb_h + +class Evolver_linear_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dt); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn.h new file mode 100644 index 0000000000..0a06e67536 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_linear_pn_h +#define __Evolver_linear_pn_h + +class Evolver_linear_pn : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dt); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn_mb.h new file mode 100644 index 0000000000..0b29af7fc2 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn_mb.h @@ -0,0 +1,22 @@ +#include "Evolver_shape_base.h" + +#ifndef __Evolver_linear_pn_mb_h +#define __Evolver_linear_pn_mb_h + +class Evolver_linear_pn_mb : public Evolver_shape_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void sync_step(vector &bodies, Force *force, double dt); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody.h new file mode 100755 index 0000000000..d5702f192b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody.h @@ -0,0 +1,20 @@ +#include "Evolver_nbody_base.h" + +#ifndef __Evolver_nbody_h +#define __Evolver_nbody_h + +class Evolver_nbody : public Evolver_nbody_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_base.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_base.h new file mode 100644 index 0000000000..ffa51ae490 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_base.h @@ -0,0 +1,19 @@ +#include "Evolver_base.h" + +#ifndef __Evolver_nbody_base_h +#define __Evolver_nbody_base_h + +class Evolver_nbody_base : public Evolver_base { + public: + + // Get diagnostics + array get_spin_angular_momentum(vector &bodies); + double get_spin_kinetic_energy(vector &bodies); + double get_potential_energy(vector &bodies); + array get_angular_momentum(vector &bodies); + double get_energy(vector &bodies); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col.h new file mode 100644 index 0000000000..8deb4d2100 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col.h @@ -0,0 +1,22 @@ +#include "Evolver_nbody_base.h" + +#ifndef __Evolver_nbody_col_h +#define __Evolver_nbody_col_h + +class Evolver_nbody_col : public Evolver_nbody_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col_pn.h new file mode 100644 index 0000000000..e830cf24da --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col_pn.h @@ -0,0 +1,22 @@ +#include "Evolver_nbody_base.h" + +#ifndef __Evolver_nbody_col_pn_h +#define __Evolver_nbody_col_pn_h + +class Evolver_nbody_col_pn : public Evolver_nbody_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); + + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_pn.h new file mode 100644 index 0000000000..df784e3fd9 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_pn.h @@ -0,0 +1,20 @@ +#include "Evolver_nbody_base.h" + +#ifndef __Evolver_nbody_pn_h +#define __Evolver_nbody_pn_h + +class Evolver_nbody_pn : public Evolver_nbody_base { + public: + + // Evolve function + void leapfrog_step(vector &bodies, double dt, Force *force); + void mclachlan_step(vector &bodies, double dt, Force *force); + + void initialize(vector &bodies, Force *force); + void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); + void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_shape_base.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_shape_base.h new file mode 100644 index 0000000000..9b05a6191a --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_shape_base.h @@ -0,0 +1,32 @@ +#include "Force.h" + +#include "Timestep_base.h" + +#include "Timestep_const.h" +#include "Timestep_adapt.h" +#include "Timestep_adapt_weight.h" +#include "Timestep_direct_weight.h" + +#include "Evolver_base.h" + +#include "Orbit.h" +#include "Spin.h" +#include "Shape.h" + +#ifndef __Evolver_shape_base_h +#define __Evolver_shape_base_h + +class Evolver_shape_base : public Evolver_base { + public: + + // Get diagnostics + array get_spin_angular_momentum(vector &bodies); + double get_spin_kinetic_energy(vector &bodies); + double get_potential_energy(vector &bodies); + array get_angular_momentum(vector &bodies); + double get_energy(vector &bodies); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Force.h b/src/amuse_tidymess/src/tidymess/integrator/include/Force.h new file mode 100755 index 0000000000..8c1d19bdae --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Force.h @@ -0,0 +1,154 @@ +#include +using namespace std; + +#include +#include +#include +#include + +#include "Body.h" + +#ifndef __Force_h +#define __Force_h + +class Force { + public: + + // Variables + int pn_order; + double c, c_2, c_4, c_5; + + bool collision_detected; + vector< array > index_collisions; + + bool roche_detected; + vector< array > index_roche; + + vector dr2_vec, dr_3_vec; + + // Initializers + Force(); + Force(int pn_order, double c); + + void set_default_settings(); + + // Setters + void set_pn_order(int pn_order); + void set_speed_of_light(double c); + + // Collision checker + void check_for_collisions(Body &bi, Body &bj, double &dr_1); + void check_for_collisions(Body &bi, Body &bj, double &dr_3, double &dr2); + + void check_for_roche(Body &bi, Body &bj, double &dr_1); + void check_for_roche(Body &bi, Body &bj, double &dr_3, double &dr2); + + void reset_collisions(); + void reset_roche(); + + // Precalculation functions + + void precalc_sep_vec(Body &bi, Body &bj, array &dr); + void precalc_sep_vec_norm(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr_3); + void precalc_sep_vec_norm_load(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr2, double &dr_3); + void precalc_sep_vec_norm_save(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr2, double &dr_3); + void precalc_sep_mag(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3); + + void precalc_pn(Body &bi, Body &bj, bool &use_vv, array &drn, double &dr_1, double &vivi, double &vjvj, double &vivj, double &drnvi, double &drnvj, double &dv2, array &dv, double &drnvidrnvi, double &drnvjdrnvj, double &bimdr_1, double &bjmdr_1); + + void precalc_tidal(double &dr2, double &dr_3, double &dr_1, double &dr_2, double &dr_4, double &dr_5, array &dr, array &drn, double &dyndyn, double &dzndzn, double &dxndyn, double &dxndzn, double &dyndzn); + + // Force functions + + void calculate_nbody_force(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3, array &ai, array &aj); + void calculate_nbody_force_load(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3, array &ai, array &aj); + + void calculate_pn_force(Body &bi, Body &bj, double &dr2, double &dr_1, double &dr_2, double &dr_3, double &dr_4, array &dr, array &drn, double &dv2, array &dv, array &ai_pn, array &aj_pn, bool use_vv); + + void calculate_tidal_force(Body &bi, Body &bj, double &dr2, double &dr_3, double &dr_1, double &dr_2, double &dr_4, double &dr_5, array &dr, array &drn, array &ai_tidal, array &aj_tidal, array &hij, array &hji, bool use_J); + + void calculate_tidal_h(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J); + void calculate_tidal_h_load(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J, double &dr2, double &dr_3); + void calculate_tidal_h_save(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J, double &dr2, double &dr_3); + + // Torque functions + + void calculate_torque(Body &bi, Body &bj, array &dr, array &hij, array &hji); + + // Inertia tensor functions + + void calculate_deformation_tensor(Body &bi, Body &bj, array &drn, double &dr_3); + + // Acceleration updaters + + void update_acceleration(vector &bodies); + void update_acceleration_pn(vector &bodies, bool use_vv); + void update_acceleration_tidal(vector &bodies, bool use_J); + void update_acceleration_col(vector &bodies); + void update_acceleration_pn_col(vector &bodies, bool use_vv); + void update_acceleration_tidal_col(vector &bodies, bool use_J); + void update_acceleration_tidal_pn(vector &bodies, bool use_vv, bool use_J); + void update_acceleration_tidal_pn_col(vector &bodies, bool use_vv, bool use_J); + + void update_acceleration_save(vector &bodies); + void update_acceleration_pn_save(vector &bodies, bool use_vv); + void update_acceleration_tidal_save(vector &bodies, bool use_J); + void update_acceleration_col_save(vector &bodies); + void update_acceleration_pn_col_save(vector &bodies, bool use_vv); + void update_acceleration_tidal_col_save(vector &bodies, bool use_J); + void update_acceleration_tidal_pn_save(vector &bodies, bool use_vv, bool use_J); + void update_acceleration_tidal_pn_col_save(vector &bodies, bool use_vv, bool use_J); + + void update_acceleration_load(vector &bodies); + void update_acceleration_pn_load(vector &bodies, bool use_vv); + void update_acceleration_tidal_load(vector &bodies, bool use_J); + void update_acceleration_col_load(vector &bodies); + void update_acceleration_pn_col_load(vector &bodies, bool use_vv); + void update_acceleration_tidal_col_load(vector &bodies, bool use_J); + void update_acceleration_tidal_pn_load(vector &bodies, bool use_vv, bool use_J); + void update_acceleration_tidal_pn_col_load(vector &bodies, bool use_vv, bool use_J); + + // Acceleration and torque updaters + + void update_acceleration_and_torque(vector &bodies, bool use_J); + void update_acceleration_and_torque_pn(vector &bodies, bool use_vv, bool use_J); + void update_acceleration_and_torque_col(vector &bodies, bool use_J); + void update_acceleration_and_torque_pn_col(vector &bodies, bool use_vv, bool use_J); + + void update_acceleration_and_torque_save(vector &bodies, bool use_J); + void update_acceleration_and_torque_pn_save(vector &bodies, bool use_vv, bool use_J); + void update_acceleration_and_torque_col_save(vector &bodies, bool use_J); + void update_acceleration_and_torque_pn_col_save(vector &bodies, bool use_vv, bool use_J); + + void update_acceleration_and_torque_load(vector &bodies, bool use_J); + void update_acceleration_and_torque_pn_load(vector &bodies, bool use_vv, bool use_J); + void update_acceleration_and_torque_col_load(vector &bodies, bool use_J); + void update_acceleration_and_torque_pn_col_load(vector &bodies, bool use_vv, bool use_J); + + void update_acceleration_and_torque_and_deformation_tensor(vector &bodies, bool use_J); + void update_acceleration_and_torque_and_deformation_tensor_col(vector &bodies, bool use_J); + void update_acceleration_and_torque_pn_and_deformation_tensor(vector &bodies, bool use_vv, bool use_J); + void update_acceleration_and_torque_pn_and_deformation_tensor_col(vector &bodies, bool use_vv, bool use_J); + + // Torque updaters + + void update_torque(vector &bodies, bool use_J); + void update_torque_save(vector &bodies, bool use_J); + void update_torque_load(vector &bodies, bool use_J); + + // Deformation updaters + + void update_tidal_deformation(vector &bodies); + void update_tidal_deformation_save(vector &bodies); + void update_tidal_deformation_load(vector &bodies); + + void update_centrifugal_deformation(vector &bodies); + + void update_equilibrium_tensor(vector &bodies); + void update_equilibrium_tensor_and_memorize(vector &bodies); + + void update_deformation_tensor(vector &bodies, bool use_J); +}; + +#endif + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Initializer.h b/src/amuse_tidymess/src/tidymess/integrator/include/Initializer.h new file mode 100755 index 0000000000..bd53b7684b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Initializer.h @@ -0,0 +1,174 @@ +#include +using namespace std; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Units.h" +#include "Banner.h" + +#ifndef __Initializer_h +#define __Initializer_h + +class Initializer { + public: + + // Simulation parameters + + bool to_continue; // 0=new simulation, 1=continue simulation + double max_cpu_time; // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. + + // Physical model parameters + + int tidal_model; // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default) + int pn_order; // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn + int magnetic_braking; // Magnetic braking. 0=off, 1=on + + int collisions; // 0=off, 1=flag, 2=exception, 3=replace + int roche_limit; // 0=off, 1=flag, 2=exception + int breakup_speed; // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception + + // Unit system + + string mass_unit; // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] + string length_unit; // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [AU], [pc] + string time_unit; // Unit of time for 1) t_begin, t_end and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] + string speed_unit; // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [AU/day], [AU/yr], [AU/year], [pc/Myr] + + double speed_of_light; // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. + + // Initial condition parameters + + string file_ic; // initial condition file + + int orbit_coor; // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian + int spin_coor; // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit + + int initial_shape; // 0=sphere, 1=equilibrium (future, 2=specified in initial condition) + int num_body; // 0=all, num_body+1=number of bodies to include + + // Output parameters + + int snapshot_mode; // 0=linear interval (default), 1=logarithmic interval, 2=variable interval + int n_snapshot; // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) + + string output_dir; // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. + int overwrite; // overwrite existing files: 0=no, 1=yes + + int output_format; // 0=file per body, 1=file per snapshot, 2=single file + int output_info; // 0=time-varying quantities, 1=all quantities + int output_coor; // 0=cartesian inertial + + int output_diag; // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' + int output_terminal; // Display progress of simulation in terminal window. 0=no, 1=yes + + // Integration parameters + + double t_begin; // begin time in units given by time_unit + double t_end; // final time in units given by time_unit + + int dt_mode; // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt + double dt_const; // constant time step in units given by time_unit (only used if dt_mode=0) + double eta; // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) + + int n_iter; // Number of iterations to improve reversibility (default=1) + + // Program parameters + + string file_par; // Name of setup file with parameters. Set to "none" if no setup file is required. + + bool toSetOutputDir; // Boolean for copying output dir from initial condition file + string file_out; // Initial condition file without the extension + + // Program variables + + Units units; + bool physical_units; // boolean for using physical units or N-body units + + Banner banner; + + // Snapshot variables + + int N; + vector< array > data_ic; + vector id; + vector name; + + // Constructor + Initializer(); + void set_to_default_values(); + + double get_Cm(); + double get_Cr(); + double get_Cv(); + double get_Ct(); + + // Readme + void display_version(); + void display_help(); + void display_readme(); + void display_parameters(); + void display_units(); + void display_ic_args(); + + // Argument parser + void parse_arguments(int argc, char* argv[]); + bool validate_command_line_args(int argc, vector &args); + bool validate_setup_file_args(int argc, vector &args); + bool check_valid_argument(string &str); + bool check_valid_value(string &str, string &str_val); + void process_args(int argc, vector &args); + + void print_arguments_as_setup_file(); + void print_arguments_as_setup_file(ofstream &fo); + void print_initial_condition_args(); + + int check_var(vector< vector > &data, vector &var, vector &unit, int numLine, string x); + + bool validate_initial_condition_cartesian(vector< vector > &data, vector &var, vector &unit, int numLine); + bool validate_initial_condition_elliptical(vector< vector > &data, vector &var, vector &unit, int numLine); + bool validate_initial_condition_spin(vector< vector > &data, vector &var, vector &unit, int numLine); + + void determine_physical_units(vector &var, vector &unit); + bool validate_units_internal_properties(vector &var, vector &unit); + bool validate_units_orbital_cartesian(vector &var, vector &unit); + bool validate_units_orbital_elliptical(vector &var, vector &unit); + bool validate_units_spin(vector &var, vector &unit); + + // Aux functions + inline bool check_file_exists(const std::string& path); + bool check_dir_exists(string &dir); + vector get_words(string line); + vector< vector > read_file(string file_in); + + // Initial condition functions + vector rotZrotX(double anglez, double anglex, vector vin); + + void convert_spin_vectors_to_inertial(); + void convert_spin_vectors_from_elliptical_body0abs(); + void convert_spin_vectors_from_elliptical_body0rel(); + + double mean_to_eccentric_anomaly(double MA, double e); + double eccentric_to_true_anomaly(double EA, double e); + double convert_mean_to_true_anomaly(double MA, double ecc); + + vector get_relative_posvel_from_orbital_elements(double m1, double m2, double a, double ecc, double inc, double O, double w, double TA, double G); + + void move_to_center(); + void move_to_center(int Nenc); + + void convert_astrocentric_elements_to_cartesian_coordinates(); + void convert_jacobian_elements_to_cartesian_coordinates(); +}; + +#endif + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Orbit.h b/src/amuse_tidymess/src/tidymess/integrator/include/Orbit.h new file mode 100755 index 0000000000..95eaaeff85 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Orbit.h @@ -0,0 +1,42 @@ +#include +using namespace std; + +#include +#include +#include + +#include "Body.h" + +#ifndef __Orbit_h +#define __Orbit_h + +class Orbit { + public: + + // Initializers + Orbit(); + + void drift_r(vector &bodies, double dt); + + void kick_v(vector &bodies, double dt); + void kick_vv(vector &bodies, double dt); + + void memorize_r(vector &bodies); + void swap_r_and_r_prev(vector &bodies); + + void init_vv(vector &bodies); + void swap_v_and_vv(vector &bodies); + + // Diagnostics + double get_kinetic_energy(vector &bodies); + double get_potential_energy(vector &bodies); + double get_potential_energy_nbody(vector &bodies); + + array get_center_of_mass(vector &bodies); + array get_center_of_mass_velocity(vector &bodies); + array get_angular_momentum(vector &bodies); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Output.h b/src/amuse_tidymess/src/tidymess/integrator/include/Output.h new file mode 100755 index 0000000000..b1faed907a --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Output.h @@ -0,0 +1,106 @@ +#include +using namespace std; + +#include +#include +#include +#include + +#include "Body.h" +#include "Initializer.h" +#include "Units.h" + +#ifndef __Output_h +#define __Output_h + +class Output { + public: + + int format; + int info; + int coor; + string dir; + bool overwrite; + + Units units; + bool physical_units; + string time_unit_output; + string mass_unit_output; + string length_unit_output; + string speed_unit_output; + string frequency_unit_output; + string angular_momentum_unit_output; + string energy_unit_output; + string inertia_unit_output; + + int tidal_model; + + string file_out; + string file_parbu; + + int output_class; + + bool firstWrite; + bool firstWriteDiag; + int file_counter; + int bin_number; + + int n_width; + + // Constructor + Output(); + + // Functions + void set_format(int output_format); + void set_info(int output_info); + void set_coor(int output_coor); + void set_dir(string output_dir); + void set_overwrite(int overwrite); + + void set_units(bool physical_units, string mass_unit, string length_unit, string time_unit, string speed_unit); + void set_conversion_factors(double Cm, double Cr, double Cv, double Ct); + void convert_time_to_frequency_unit(string time_unit); + void construct_angular_momentum_unit(string mass_unit, string length_unit, string speed_unit); + void construct_energy_unit(string mass_unit, string speed_unit); + void construct_inertia_unit(string mass_unit, string length_unit); + + void set_tidal_model(int tidal_model); + + void set_file_out(string fo); + + void determine_output_mode(); + + void write_snapshot(double t, double tcpu, vector &bodies); + void create_output_file(string outputFile, bool isFirstWrite); + + // Writers + void write_snapshot_to_file(double t, double tcpu, vector &bodies); + void write_snapshot_to_file_compact(double t, double tcpu, vector &bodies); + void write_new_snapshot_file(double t, double tcpu, vector &bodies); + void write_new_snapshot_file_compact(double t, double tcpu, vector &bodies); + void write_snapshot_per_body(double t, double tcpu, vector &bodies); + void write_snapshot_per_body_compact(double t, double tcpu, vector &bodies); + + void write_snapshot_to_file_nbody(double t, double tcpu, vector &bodies); + void write_snapshot_to_file_compact_nbody(double t, double tcpu, vector &bodies); + void write_new_snapshot_file_nbody(double t, double tcpu, vector &bodies); + void write_new_snapshot_file_compact_nbody(double t, double tcpu, vector &bodies); + void write_snapshot_per_body_nbody(double t, double tcpu, vector &bodies); + void write_snapshot_per_body_compact_nbody(double t, double tcpu, vector &bodies); + + void save_to_binary(double &t, int &N, double &tcpu, double &dt_prev, int &num_integration_steps, int &collision_flag, int &roche_flag, int &breakup_flag, vector &bodies, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot); + void read_binary_backup(double &t, int &N, double &tcpu, double &dt_prev, int &num_integration_steps, vector &bodies, int &collision_flag, int &roche_flag, int &breakup_flag, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot); + void read_from_binary(double &t, int &N, double &tcpu, double &dt_prev, int &num_integration_steps, vector &bodies, string &bin_name, bool &myfirstWrite, bool &myfirstWriteDiag, int &myfile_counter, int &mybin_number, int &collision_flag, int &roche_flag, int &breakup_flag, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot); + + // Diagnostics log + void write_log(int argc, char* argv[], double t, double tcpu, int &num_integration_steps, int N0, int N1, double dr, double dv, double dLx, double dLy, double dLz, double dLx_rel, double dLy_rel, double dLz_rel, double dL_abs, double dL_rel, double dE_abs, double dE_rel, double x0, int outcome_type, int collision_flag, int roche_flag, int breakup_flag); + void print_log(int argc, char* argv[], double t, double tcpu, int &num_integration_steps, int N0, int N1, double dr, double dv, double dLx, double dLy, double dLz, double dLx_rel, double dLy_rel, double dLz_rel, double dL_abs, double dL_rel, double dE_abs, double dE_rel, double x0, int outcome_type, int collision_flag, int roche_flag, int breakup_flag); + + void write_diag(double &t, double &t_cpu, int &num_integration_steps, int &N, array &r0, array &v0, array &L0_orb, array &L0_spin, double &Ekin0_orb, double Epot0, double &Ekin0_spin); + + void backup_file(string f1); + void copy_file(string f1, string f2); +}; + +#endif + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Shape.h b/src/amuse_tidymess/src/tidymess/integrator/include/Shape.h new file mode 100755 index 0000000000..41ea0606be --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Shape.h @@ -0,0 +1,77 @@ +#include +using namespace std; + +#include +#include +#include +#include + +#include "Body.h" + +#ifndef __Shape_h +#define __Shape_h + +class Shape { + double f_lim; + + public: + + // Initializers + Shape(); + + void set_permanent_shape(vector &bodies); + void set_to_spherical_shape(vector &bodies); + void set_to_equilibrium_shape(vector &bodies); + void set_to_equilibrium_shape_with_J(vector &bodies); + void set_to_linear_shape(vector &bodies); + void init_J(vector &bodies); + + void calc_expos(vector &bodies, double dt); + void copy_expos_to_1(vector &bodies); + void copy_expos_to_2(vector &bodies); + void revert_expos_1(vector &bodies); + void revert_expos_2(vector &bodies); + + // Calculators + void calculate_I_inv(vector &bodies); + void calculate_I_inv_and_w(vector &bodies); + + void calculate_J_inv_and_w(vector &bodies); + void calculate_w_with_J(vector &bodies); + + void calculate_I_inv_and_w_with_K(vector &bodies); + void calculate_J_inv_and_w_with_K(vector &bodies); + + // Evolvers + void kick_linear(vector &bodies); + void kick_linear_J(vector &bodies); + void kick_linear_discrete(vector &bodies, double dt); + void kick_linear_discrete_J(vector &bodies, double dt); + + void kick_direct(vector &bodies, double dt); + void kick_direct_J(vector &bodies, double dt); + + void deform_and_rotate(vector &bodies, double dt); + void deform_and_rotate_half(vector &bodies, double dt); + + void deform_and_rotate_J(vector &bodies, double dt); + void deform_and_rotate_J_half(vector &bodies, double dt); + + void rotate_tensor(array &q, array &A, array &B); + + void copy_I_e_r_to_I_e_rh(vector &bodies); + void copy_I_to_J(vector &bodies); + + void memorize_I(vector &bodies); + void reset_I(vector &bodies); + + void memorize_J(vector &bodies); + void reset_J(vector &bodies); + + void backup_I_e(vector &bodies); + void set_I_e_prev_to_backup(vector &bodies); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Spin.h b/src/amuse_tidymess/src/tidymess/integrator/include/Spin.h new file mode 100755 index 0000000000..a56410aa08 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Spin.h @@ -0,0 +1,43 @@ +#include +using namespace std; + +#include +#include +#include + +#include "Body.h" + +#ifndef __Spin_h +#define __Spin_h + +class Spin { + public: + + // Initializers + Spin(); + + // Calculators + void calculate_w(vector &bodies); + void calculate_w_with_J(vector &bodies); + void calculate_w_with_K(vector &bodies); + + void calculate_L(vector &bodies); + void init_K(vector &bodies); + + void memorize_w(vector &bodies); + void reset_w(vector &bodies); + + void kick_L(vector &bodies, double dt); + void kick_K(vector &bodies, double dt); + + void kick_L_mb(vector &bodies, double dt); + void kick_K_mb(vector &bodies, double dt); + + // Diagnostics + double get_kinetic_energy(vector &bodies); + array get_angular_momentum(vector &bodies); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Tidy.h b/src/amuse_tidymess/src/tidymess/integrator/include/Tidy.h new file mode 100755 index 0000000000..7ef779ab7a --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Tidy.h @@ -0,0 +1,234 @@ +#include "Force.h" + +#include "Orbit.h" +#include "Spin.h" +#include "Shape.h" + +#include "Timestep_base.h" + +#include "Timestep_const.h" +#include "Timestep_adapt.h" +#include "Timestep_direct.h" +#include "Timestep_adapt_weight.h" +#include "Timestep_direct_weight.h" + +#include "Evolver_base.h" + +#include "Evolver_nbody.h" +#include "Evolver_nbody_col.h" +#include "Evolver_nbody_pn.h" +#include "Evolver_nbody_col_pn.h" + +#include "Evolver_equilibrium.h" +#include "Evolver_equilibrium_col.h" +#include "Evolver_equilibrium_pn.h" +#include "Evolver_equilibrium_mb.h" +#include "Evolver_equilibrium_col_pn.h" +#include "Evolver_equilibrium_col_mb.h" +#include "Evolver_equilibrium_pn_mb.h" +#include "Evolver_equilibrium_col_pn_mb.h" + +#include "Evolver_linear.h" +#include "Evolver_linear_col.h" +#include "Evolver_linear_pn.h" +#include "Evolver_linear_mb.h" +#include "Evolver_linear_col_pn.h" +#include "Evolver_linear_col_mb.h" +#include "Evolver_linear_pn_mb.h" +#include "Evolver_linear_col_pn_mb.h" + +#include "Evolver_direct.h" +#include "Evolver_direct_col.h" +#include "Evolver_direct_pn.h" +#include "Evolver_direct_mb.h" +#include "Evolver_direct_col_pn.h" +#include "Evolver_direct_col_mb.h" +#include "Evolver_direct_pn_mb.h" +#include "Evolver_direct_col_pn_mb.h" + +#include "Evolver_creep.h" +#include "Evolver_creep_col.h" +#include "Evolver_creep_pn.h" +#include "Evolver_creep_mb.h" +#include "Evolver_creep_col_pn.h" +#include "Evolver_creep_col_mb.h" +#include "Evolver_creep_pn_mb.h" +#include "Evolver_creep_col_pn_mb.h" + +#ifndef __Tidy_h +#define __Tidy_h + +class Tidy { + public: + + // User parameters + double t; + vector bodies; + + int tidal_model; + + int collision_mode, roche_mode, encounter_mode; + + int pn_order; + double speed_of_light; + + int magnetic_braking; + + int dt_mode; + double dt_const, eta, dt_prev; + int num_integration_step; + + int n_iter; + int dt_sgn; + + // Setters and Getters + void set_model_time(double t); + double get_model_time(); + + void set_particles(vector &bodies); + void set_particles(vector< array > &d); + void set_particles(vector &name, vector &id, vector< array > &d); + vector get_particles(); + + void set_tidal_model(int tidal_model); + int get_tidal_model(); + + void set_collision_mode(int collision_mode); + int get_collision_mode(); + + void set_roche_mode(int roche_mode); + int get_roche_mode(); + + void set_encounter_mode(); + int get_encounter_mode(); + + void set_pn_order(int pn_order); + int get_pn_order(); + + void set_speed_of_light(double c); + double get_speed_of_light(); + + void set_magnetic_braking(int b); + int get_magnetic_braking(); + + void set_dt_mode(int dt_mode); + double get_dt_mode(); + + void set_dt_const(double dt_const); + double get_dt_const(); + + void set_eta(double eta); + double get_eta(); + + void set_dt_prev(double dt_prev); + double get_dt_prev(); + + void set_n_iter(int n_iter); + int get_n_iter(); + + void set_num_integration_step(int num_integration_step); + int get_num_integration_step(); + + void set_dt_sgn(int dt_sgn); + + // Constructor/Destructor + Tidy(); + ~Tidy(); + + // Timesteppers and integrators + Timestep_const timestep_const; + Timestep_adapt timestep_adapt; + Timestep_direct timestep_direct; + Timestep_adapt_weight timestep_adapt_weight; + Timestep_direct_weight timestep_direct_weight; + + Evolver_nbody evolver_nbody; + Evolver_nbody_col evolver_nbody_col; + Evolver_nbody_pn evolver_nbody_pn; + Evolver_nbody_col_pn evolver_nbody_col_pn; + + Evolver_equilibrium evolver_equilibrium; + Evolver_equilibrium_col evolver_equilibrium_col; + Evolver_equilibrium_pn evolver_equilibrium_pn; + Evolver_equilibrium_mb evolver_equilibrium_mb; + Evolver_equilibrium_col_pn evolver_equilibrium_col_pn; + Evolver_equilibrium_col_mb evolver_equilibrium_col_mb; + Evolver_equilibrium_pn_mb evolver_equilibrium_pn_mb; + Evolver_equilibrium_col_pn_mb evolver_equilibrium_col_pn_mb; + + Evolver_linear evolver_linear; + Evolver_linear_col evolver_linear_col; + Evolver_linear_pn evolver_linear_pn; + Evolver_linear_mb evolver_linear_mb; + Evolver_linear_col_pn evolver_linear_col_pn; + Evolver_linear_col_mb evolver_linear_col_mb; + Evolver_linear_pn_mb evolver_linear_pn_mb; + Evolver_linear_col_pn_mb evolver_linear_col_pn_mb; + + Evolver_direct evolver_direct; + Evolver_direct_col evolver_direct_col; + Evolver_direct_pn evolver_direct_pn; + Evolver_direct_mb evolver_direct_mb; + Evolver_direct_col_pn evolver_direct_col_pn; + Evolver_direct_col_mb evolver_direct_col_mb; + Evolver_direct_pn_mb evolver_direct_pn_mb; + Evolver_direct_col_pn_mb evolver_direct_col_pn_mb; + + Evolver_creep evolver_creep; + Evolver_creep_col evolver_creep_col; + Evolver_creep_pn evolver_creep_pn; + Evolver_creep_mb evolver_creep_mb; + Evolver_creep_col_pn evolver_creep_col_pn; + Evolver_creep_col_mb evolver_creep_col_mb; + Evolver_creep_pn_mb evolver_creep_pn_mb; + Evolver_creep_col_pn_mb evolver_creep_col_pn_mb; + + // Pointers to objects to be used + Force *force_ptr; + Timestep_base *timestep_ptr; + Evolver_base *evolver_ptr; + + // Committers + void commit_parameters(); + void commit_particles(); + void set_pointers(); + void upload_parameters(); + void initialize(); + + // Collision handling + bool is_collision_detected(); + vector< array > get_collision_indices(); + bool get_collision_flag(); + + bool is_roche_detected(); + vector< array > get_roche_indices(); + bool get_roche_flag(); + + // Shape handling + Force force; + Spin spin; + Shape shape; + + void set_to_spherical_shape(); + void set_to_equilibrium_shape(); + void update_angular_momentum(); + + // Get diagnostics + array get_center_of_mass(); + array get_center_of_mass_velocity(); + array get_orbital_angular_momentum(); + array get_spin_angular_momentum(); + double get_orbital_kinetic_energy(); + double get_spin_kinetic_energy(); + double get_potential_energy(); + array get_angular_momentum(); + double get_energy(); + + // Top level evolve function + void evolve_model(double t_end); + void evolve_model(int N_step); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timer.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timer.h new file mode 100755 index 0000000000..7af5207fd9 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Timer.h @@ -0,0 +1,25 @@ +#include + +#ifndef __Timer_h +#define __Timer_h + +class Timer { + + double t_cpu; + struct timeval Tvalue; + struct timezone dummy; + bool timerStarted; + + public: + + Timer(); + + void start(); + double read(); + void stop(); + double get(); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt.h new file mode 100644 index 0000000000..c2cc9c994b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt.h @@ -0,0 +1,30 @@ +#include +using namespace std; + +#include +#include +#include +#include +#include +#include + +#include "Body.h" +#include "Timestep_base.h" + +#ifndef __Timestep_adapt_h +#define __Timestep_adapt_h + +class Timestep_adapt : public Timestep_base { + public: + + // Calculators + void calculate_shared_adaptive_minimum_timestep_orbital(vector &bodies); + + void initialize(vector &bodies); + double get_timestep(vector &bodies); +}; + +#endif + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt_weight.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt_weight.h new file mode 100644 index 0000000000..2773cfc53a --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt_weight.h @@ -0,0 +1,31 @@ +#include +using namespace std; + +#include +#include +#include +#include +#include +#include + +#include "Body.h" +#include "Timestep_base.h" + +#ifndef __Timestep_adapt_weight_h +#define __Timestep_adapt_weight_h + +class Timestep_adapt_weight : public Timestep_base { + public: + + // Calculators + void calculate_shared_adaptive_weighted_timestep_orbital(vector &bodies); + void calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(vector &bodies); + + void initialize(vector &bodies); + double get_timestep(vector &bodies); +}; + +#endif + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_base.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_base.h new file mode 100644 index 0000000000..54ea5d6561 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_base.h @@ -0,0 +1,55 @@ +#include +using namespace std; + +#include +#include +#include +#include +#include +#include + +#include "Body.h" + +#ifndef __Timestep_base_h +#define __Timestep_base_h + +class Timestep_base { + public: + + // Variables + double dt_const; + double eta, eta2; + + double h, h2, dh, h_spin, h_shape; + double dt_prev, dt_next; + double fp_bound, fm_bound, fp2_bound, fm2_bound; + double alpha; + int dt_sgn; + + // Initializer + Timestep_base(); + + void set_default_values(); + + // Setters and Getters + void set_dt_const(double dt_const); + double get_dt_const(); + + void set_eta(double eta); + double get_eta(); + + void commit(); + void set_dt_sgn(double t0, double t1); + void set_dt_sgn(int dt_sgn); + + void set_dt_prev(double dt_prev); + + // Calculators + virtual void initialize(vector &bodies) = 0; + virtual double get_timestep(vector &bodies) = 0; +}; + +#endif + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_const.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_const.h new file mode 100644 index 0000000000..f721517e13 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_const.h @@ -0,0 +1,28 @@ +#include +using namespace std; + +#include +#include +#include +#include +#include +#include + +#include "Body.h" +#include "Timestep_base.h" + +#ifndef __Timestep_const_h +#define __Timestep_const_h + +class Timestep_const : public Timestep_base { + public: + + // Calculators + void initialize(vector &bodies); + double get_timestep(vector &bodies); +}; + +#endif + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct.h new file mode 100644 index 0000000000..1b35cfd78d --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct.h @@ -0,0 +1,33 @@ +#include +using namespace std; + +#include +#include +#include +#include +#include +#include + +#include "Body.h" +#include "Timestep_base.h" + +#ifndef __Timestep_direct_h +#define __Timestep_direct_h + +class Timestep_direct : public Timestep_base { + public: + + // Calculators + void calculate_shared_adaptive_minimum_timestep_orbital(vector &bodies); + + void calculate_minimum_timestep_spin(vector &bodies); + void calculate_minimum_timestep_shape(vector &bodies); + + void initialize(vector &bodies); + double get_timestep(vector &bodies); +}; + +#endif + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct_weight.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct_weight.h new file mode 100644 index 0000000000..c1c14235ef --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct_weight.h @@ -0,0 +1,34 @@ +#include +using namespace std; + +#include +#include +#include +#include +#include +#include + +#include "Body.h" +#include "Timestep_base.h" + +#ifndef __Timestep_direct_weight_h +#define __Timestep_direct_weight_h + +class Timestep_direct_weight : public Timestep_base { + public: + + // Calculators + void calculate_shared_adaptive_weighted_timestep_orbital(vector &bodies); + void calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(vector &bodies); + + void calculate_minimum_timestep_spin(vector &bodies); + void calculate_minimum_timestep_shape(vector &bodies); + + void initialize(vector &bodies); + double get_timestep(vector &bodies); +}; + +#endif + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Units.h b/src/amuse_tidymess/src/tidymess/integrator/include/Units.h new file mode 100755 index 0000000000..d7a55e34b5 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/include/Units.h @@ -0,0 +1,86 @@ +#include +using namespace std; + +#include +#include +#include + +#ifndef __Units_h +#define __Units_h + +class Units { + bool physical_units; + + public: + + // Constants + double c_m_s, c_km_s, c_AU_yr, c_two_pi_AU_yr; + double G_standard; + + // Time: s, hr, day, yr, Myr, Gyr + double s_to_yr, min_to_yr, hr_to_yr, day_to_yr, Myr_to_yr, Gyr_to_yr; + double yr_to_s, yr_to_min, yr_to_hr, yr_to_day, yr_to_Myr, yr_to_Gyr; + + // Length: m, km, Rsun/RSun, AU, pc + double m_to_AU, km_to_AU, Rsun_to_AU, pc_to_AU; + double AU_to_m, AU_to_km, AU_to_Rsun, AU_to_pc; + + double km_in_m, Rsun_in_m, AU_in_m, pc_in_m; + + // Mass: g, kg, Mearth/MEarth, Mjupiter/MJupiter/Mjup/MJup, Msun/MSun + double g_to_Msun, kg_to_Msun, Mearth_to_Msun, Mjupiter_to_Msun; + double Msun_to_g, Msun_to_kg, Msun_to_Mearth, Msun_to_Mjupiter; + + double GMjupiter_in_m_s, GMearth_in_m_s, GMjupiter_in_AU_yr, GMearth_in_AU_yr; + double Mjupiter_in_Msun, Mearth_in_Msun, Msun_in_kg, Msun_in_g; + + // Velocity: m/s, km/s, km/hr, AU/day, pc/Myr + double m_s_to_AU_yr, km_s_to_AU_yr, km_hr_to_AU_yr, AU_day_to_AU_yr, pc_Myr_to_AU_yr; + double AU_yr_to_m_s, AU_yr_to_km_s, AU_yr_to_km_hr, AU_yr_to_AU_day, AU_yr_to_pc_Myr; + + // Angles: deg, rad + double rad_to_deg, deg_to_rad; + + // G=4pi <-> G=1 conversion + double yr_to_yr_two_pi, yr_two_pi_to_yr; + double AU_yr_to_two_pi_AU_yr, two_pi_AU_yr_to_AU_yr; + + // Conversion factors to dimensionless units + double Cm, Cr, Cv, Ct; + + Units(); + + void set_physical_units(bool physical_units); + + bool validate_mass_unit(string u); + bool validate_length_unit(string u); + bool validate_time_unit(string u); + bool validate_speed_unit(string u); + bool validate_angular_unit(string u); + + double convert_mass_to_standard(double value, string unit); + double convert_length_to_standard(double value, string unit); + double convert_time_to_standard(double value, string unit); + double convert_speed_to_standard(double value, string unit); + double convert_angle_to_standard(double value, string unit); + + double convert_time_from_standard_to_code(double value); + double convert_speed_from_standard_to_code(double value); + double convert_frequency_from_standard_to_code(double value); + + double convert_time_from_code_to_output(double value, string unit); + double convert_frequency_from_code_to_output(double value, string unit); + double convert_mass_from_code_to_output(double value, string unit); + double convert_length_from_code_to_output(double value, string unit); + double convert_speed_from_code_to_output(double value, string unit); + double convert_angular_momentum_from_code_to_output(double value, string unit); + double convert_energy_from_code_to_output(double value, string unit); + double convert_inertia_from_code_to_output(double value, string unit); + + vector split_units(string &u); + void print_units(); +}; + +#endif + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Banner.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Banner.cpp new file mode 100644 index 0000000000..ec93f1836b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Banner.cpp @@ -0,0 +1,54 @@ +#include "Banner.h" + +void Banner::print_banner() { + cout << " _____ ___ ____ __ __ __ __ _____ ____ ____ " << endl; + cout << " |_ _||_ _|| _ \\\\ \\ / /| \\/ || ____|/ ___|/ ___| " << endl; + cout << " | | | | | | | |\\ V / | |\\/| || _| \\___ \\\\___ \\ " << endl; + cout << " | | | | | |_| | | | | | | || |___ ___) |___) | " << endl; + cout << " |_| |___||____/ |_| |_| |_||_____||____/|____/ " << endl; +} + +void Banner::print_intro(bool to_continue) { + cout << endl; + if(to_continue) { + cout << "Continuing simulation ..." << endl; + } + else { + cout << "Starting new simulation ..." << endl; + } + cout << " " << endl; +} + +void Banner::print_outro(string output_dir) { + cout << endl; + cout << "Simulation finished!" << endl; + cout << "Output files available in directory: " << output_dir << endl; +} + +void Banner::print_reference() { + cout << endl; + cout << "Citation: Boekholt, T. C. N. and Correia, A. C. M. " << endl; + cout << " Monthly Notices of the Royal Astronomical Society " << endl; + cout << " Volume 503, Issue 1, pp.xxxx-yyyy, November 2022 " << endl; +} + +void Banner::print_stars() { + cout << endl; + cout << "**************************************************************" << endl; +} + +void Banner::print_header() { + cout << " " << endl; + cout << "***************************************************************************" << endl; + cout << "*** TIDYMESS 1.0 - TIdal DYnamics of Multi-body ExtraSolar Systems ***" << endl; + cout << "*** Authors : Tjarda C. N. Boekholt and Alexandre C. M. Correia ***" << endl; + cout << "*** Contact : tjardaboekholt@gmail.com, acm.correia@gmail.com ***" << endl; + cout << "*** Citation : Boekholt, T. C. N. and Correia, A. C. M. ***" << endl; + cout << "*** Monthly Notices of the Royal Astronomical Society ***" << endl; + cout << "*** Volume 503, Issue 1, pp.xxxx-yyyy, November 2021 ***" << endl; + cout << "***************************************************************************" << endl; + cout << " " << endl; +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Body.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Body.cpp new file mode 100755 index 0000000000..a63f4cc331 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Body.cpp @@ -0,0 +1,258 @@ +#include "Body.h" + +// Initializers +Body::Body() { + this->reset(); +} + +Body::Body(double m, double R, double xi, double kf, double tau, double a_mb, double wx, double wy, double wz, double x, double y, double z, double vx, double vy, double vz) { + this->reset(); + + // Internal properties + this->m = m; + this->R = R; + this->xi = xi; + + this->kf = kf; + this->tau = tau; + + this->a_mb = a_mb; + + // Orbital properties + this->r[0] = x; + this->r[1] = y; + this->r[2] = z; + + this->v[0] = vx; + this->v[1] = vy; + this->v[2] = vz; + + // Spin properties + this->w[0] = wx; + this->w[1] = wy; + this->w[2] = wz; + + // Aux properties + this->update_aux_properties(); +} +Body::Body(double m, double R, double xi, double kf, double tau, double a_mb, array w, array r, array v) { + this->reset(); + + // Internal properties + this->m = m; + this->R = R; + this->xi = xi; + + this->kf = kf; + this->tau = tau; + + this->a_mb = a_mb; + + // Orbital properties + for(int k=0; k<3; k++) { + this->r[k] = r[k]; + this->v[k] = v[k]; + } + + // Spin properties + for(int k=0; k<3; k++) { + this->w[k] = w[k]; + } + + // Aux properties + this->update_aux_properties(); +} +Body::Body(array &d) { + this->reset(); + + // Internal properties + this->m = d[0]; + this->R = d[1]; + this->xi = d[2]; + + this->kf = d[3]; + this->tau = d[4]; + + this->a_mb = d[5]; + + // Spin properties + this->w[0] = d[6]; + this->w[1] = d[7]; + this->w[2] = d[8]; + + // Orbital properties + this->r[0] = d[9]; + this->r[1] = d[10]; + this->r[2] = d[11]; + + this->v[0] = d[12]; + this->v[1] = d[13]; + this->v[2] = d[14]; + + // Aux properties + this->update_aux_properties(); +} + +void Body::setup(array &d) { + this->reset(); + + // Internal properties + this->m = d[0]; + this->R = d[1]; + this->xi = d[2]; + + this->kf = d[3]; + this->tau = d[4]; + + this->a_mb = d[5]; + + // Spin properties + this->w[0] = d[6]; + this->w[1] = d[7]; + this->w[2] = d[8]; + + // Orbital properties + this->r[0] = d[9]; + this->r[1] = d[10]; + this->r[2] = d[11]; + + this->v[0] = d[12]; + this->v[1] = d[13]; + this->v[2] = d[14]; + + // Aux properties + this->update_aux_properties(); +} +void Body::set_id(int id) { + this->id = id; +} +void Body::set_name(string name) { + this->name = name; +} + +void Body::reset() { + // Tag + this->id = 0; + this->name = "0"; + + this->particle_type = 3; + + // Internal properties + this->m = 0.; + this->R = 0.; + this->xi = 0.; + this->kf = 0.; + this->tau = 0.; + this->a_mb = 0.; + + this->R3 = 0.; + this->R5 = 0.; + this->R5_3 = 0.; + this->kf_R5 = 0.; + this->kf_R5_3 = 0.; + this->tau_inv = 0.; + this->rho = 0.; + + this->roche_factor = 2.44; // fluid body + this->roche_factor3 = this->roche_factor*this->roche_factor*this->roche_factor; + + // Orbital properties + for(int i=0; i<3; i++) { + this->r[i] = 0.; + this->v[i] = 0.; + this->a[i] = 0.; + + this->r_prev[i] = 0.; + this->vv[i] = 0.; + } + + // Spin properties + for(int i=0; i<3; i++) { + this->L[i] = 0.; + this->w[i] = 0.; + this->T[i] = 0.; + + this->L_prev[i] = 0.; + this->w_prev[i] = 0.; + this->K[i] = 0.; + } + + // Shape properties + for(int i=0; i<6; i++) { + this->I_p[i] = 0; + this->I_n[i] = 0; + this->I[i] = 0; + this->I_inv[i] = 0; + this->I_e_r[i] = 0; + this->dI_e_r[i] = 0; + this->I_e_w[i] = 0; + this->I_e[i] = 0; + this->dI_e[i] = 0; + this->dI_n[i] = 0; + + this->I_e_rh[i] = 0; + this->I_e_prev[i] = 0; + this->I_n_prev[i] = 0; + this->I_e_prev_bu[i] = 0; + + this->J_n[i] = 0; + this->J[i] = 0; + this->J_inv[i] = 0; + } + + // Integration variables + this->isLinear = false; + + this->expo = 0; + this->expoh = 0; + this->dt_rot = 0; + this->dth_rot = 0; + + this->isLinear_1 = false; + this->expo_1 = 0; + this->expoh_1 = 0; + this->dt_rot_1 = 0; + this->dth_rot_1 = 0; + + this->isLinear_2 = false; + this->expo_2 = 0; + this->expoh_2 = 0; + this->dt_rot_2 = 0; + this->dth_rot_2 = 0; +} + +void Body::update_aux_properties() { + this->R3 = pow(this->R, 3.); + this->R5 = pow(this->R, 5.); + this->R5_3 = this->R5 / 3.; + this->kf_R5 = this->kf*this->R5; + this->kf_R5_3 = this->kf*this->R5_3; + + if(this->tau > 0) this->tau_inv = 1./this->tau; + + double V = 4./3*M_PI * this->R3; + if(V > 0) this->rho = this->m / V; + + for(int k=0; k<3; k++) { + this->vv[k] = v[k]; + } + + if(this->m <= 0) { + this->particle_type = 0; + } + else { + if(this->R <= 0 || this->xi <= 0) { + this->particle_type = 1; + } + else { + if(this->kf <= 0) { + this->particle_type = 2; + } + else { + this->particle_type = 3; + } + } + } +} + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Breakup.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Breakup.cpp new file mode 100755 index 0000000000..a070af17e3 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Breakup.cpp @@ -0,0 +1,81 @@ +#include "Breakup.h" + +// Initializers +Breakup::Breakup() { + this->mode = 0; + setup(); + + breakup_id.clear(); + N_breakup = 0; +} + +// Getters and Setters +void Breakup::setup() { + to_detect = false; + + if(mode > 0) { + to_detect = true; + } +} + +void Breakup::set_breakup_mode(int breakup_mode) { + switch(breakup_mode) { + case 0: + this->mode = 0; + break; + case 1: + this->mode = 1; + break; + case 2: + this->mode = 2; + break; + default: + cerr << "Invalid breakup mode: " << breakup_mode << endl; + exit(1); + break; + } +} + +int Breakup::get_N_breakup() { + return N_breakup; +} +vector Breakup::get_breakup_indices() { + return breakup_id; +} + +// Handlers +bool Breakup::detect_breakup(vector &bodies) { + N_breakup = 0; + breakup_id.clear(); + + for(vector::iterator b = bodies.begin(); b != bodies.end()-1; ++b) { + if(b->particle_type >= 2) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + double Re = 1.5 * b->R; + double w2_breakup = b->m / (Re*Re*Re); + if(w2 > w2_breakup) { + int id = b-bodies.begin(); + breakup_id.push_back(id); + N_breakup++; + } + } + } + + bool detection = false; + if(N_breakup > 0) detection = true; + + return detection; +} + +// Printer +void Breakup::print_id() { + int Nc = breakup_id.size(); + for(int i=0; icollision_mode = 0; + this->roche_mode = 0; + setup(); +} + +// Getters and Setters +void Collision::set_collision_mode(int collision_mode) { + switch(collision_mode) { + case 0: + this->collision_mode = 0; + break; + case 1: + this->collision_mode = 1; + break; + case 2: + this->collision_mode = 2; + break; + case 3: + this->collision_mode = 3; + break; + default: + cerr << "Invalid collision mode: " << collision_mode << endl; + exit(1); + break; + } +} +void Collision::set_roche_mode(int roche_mode) { + switch(roche_mode) { + case 0: + this->roche_mode = 0; + break; + case 1: + this->roche_mode = 1; + break; + case 2: + this->roche_mode = 2; + break; + default: + cerr << "Invalid roche mode: " << roche_mode << endl; + exit(1); + break; + } +} + +void Collision::setup() { + if(collision_mode > 0) { + to_detect_collision = true; + } + else { + to_detect_collision = false; + } + + if(roche_mode > 0) { + to_detect_roche = true; + } + else { + to_detect_roche = false; + } +} + +// Handlers +void Collision::process_collision_chains(vector< array > &cindex) { + int Nc = cindex.size(); + + chain_id.clear(); + + vector couple(2); + couple[0] = cindex[0][0]; + couple[1] = cindex[0][1]; + + chain_id.push_back(couple); + + for(int i=1; i &bodies) { + this->Ng = this->chain_id.size(); + this->chain_index.clear(); + + // Get chains and ids of collision partners + int N = bodies.size(); + for(int i=0; i mychain(Ns, 0); + + for(int j=0; jchain_index.push_back(mychain); + } +} + +void Collision::replace_test_body(vector &bodies, int i, int Ns, vector &index_sec) { + // Get center of mass quantities + + double Mcm = 0; + array rcm = {}; + array vcm = {}; + + for(int j=0; j Rmax) { + Rmax = bodies[chain_index[i][j]].R; + index_max = j; + } + } + + // Derive new internal properties based on assumptions + + // New radius is largest radius + double Rcm = Rmax; + + // Update primary collision partner + bodies[chain_index[i][index_max]].m = Mcm; + bodies[chain_index[i][index_max]].R = Rcm; + + for(int k=0; k<3; k++) { + bodies[chain_index[i][index_max]].r[k] = rcm[k]; + bodies[chain_index[i][index_max]].v[k] = vcm[k]; + } + + // Set auxiliary quantities + bodies[chain_index[i][index_max]].update_aux_properties(); + + // Book keep indices of secondary collision partners + for(int j=0; j &bodies, int i, int Ns, vector &index_sec) { + // Get center of mass quantities + + double Mcm = 0; + array rcm = {}; + array vcm = {}; + + for(int j=0; j Mmax) { + Mmax = bodies[chain_index[i][j]].m; + index_max = j; + } + } + + // Derive new internal properties based on assumptions + + // New radius based on constancy of density + double Rcm = 0; + + if(bodies[chain_index[i][index_max]].R > 0) { + double rho = bodies[chain_index[i][index_max]].rho; + if(rho <= 0) { + bodies[chain_index[i][index_max]].update_aux_properties(); + rho = bodies[chain_index[i][index_max]].rho; + } + Rcm = pow(3*Mcm / rho / (4*M_PI), 1./3); + } + + // Update primary collision partner + bodies[chain_index[i][index_max]].m = Mcm; + bodies[chain_index[i][index_max]].R = Rcm; + + for(int k=0; k<3; k++) { + bodies[chain_index[i][index_max]].r[k] = rcm[k]; + bodies[chain_index[i][index_max]].v[k] = vcm[k]; + } + + // Set auxiliary quantities + bodies[chain_index[i][index_max]].update_aux_properties(); + + // Book keep indices of secondary collision partners + for(int j=0; j &bodies, int i, int Ns, vector &index_sec) { + // Get center of mass quantities + + double Mcm = 0; + array rcm = {}; + array vcm = {}; + + for(int j=0; j Lorb = {}; + array Lspin = {}; + + for(int j=0; j 0) { + double Lx_orb = bodies[q].m*(bodies[q].r[1]*bodies[q].v[2] - bodies[q].r[2]*bodies[q].v[1]); + double Ly_orb = bodies[q].m*(bodies[q].r[2]*bodies[q].v[0] - bodies[q].r[0]*bodies[q].v[2]); + double Lz_orb = bodies[q].m*(bodies[q].r[0]*bodies[q].v[1] - bodies[q].r[1]*bodies[q].v[0]); + + Lorb[0] += Lx_orb; + Lorb[1] += Ly_orb; + Lorb[2] += Lz_orb; + } + if(bodies[q].particle_type >= 2) { + double Lx_spin = 0; + double Ly_spin = 0; + double Lz_spin = 0; + + Lx_spin = bodies[q].I[0]*bodies[q].w[0] + bodies[q].I[1]*bodies[q].w[1] + bodies[q].I[2]*bodies[q].w[2]; + Ly_spin = bodies[q].I[1]*bodies[q].w[0] + bodies[q].I[3]*bodies[q].w[1] + bodies[q].I[4]*bodies[q].w[2]; + Lz_spin = bodies[q].I[2]*bodies[q].w[0] + bodies[q].I[4]*bodies[q].w[1] + bodies[q].I[5]*bodies[q].w[2]; + + Lspin[0] += Lx_spin; + Lspin[1] += Ly_spin; + Lspin[2] += Lz_spin; + } + } + + array Ltot = {}; + + for(int k=0; k<3; k++) { + Ltot[k] += Lorb[k] + Lspin[k]; + } + + // Get new spin angular momentum + + array Lorb_new = {}; + + Lorb_new[0] = Mcm*(rcm[1]*vcm[2] - rcm[2]*vcm[1]); + Lorb_new[1] = Mcm*(rcm[2]*vcm[0] - rcm[0]*vcm[2]); + Lorb_new[2] = Mcm*(rcm[0]*vcm[1] - rcm[1]*vcm[0]); + + array Lspin_new = {}; + + for(int k=0; k<3; k++) { + Lspin_new[k] = Ltot[k]-Lorb_new[k]; + } + + // Identify most massive collision partner + + int index_max = 0; + double Mmax = 0; + + for(int j=0; j Mmax) { + Mmax = bodies[chain_index[i][j]].m; + index_max = j; + } + } + + // Derive new internal properties based on assumptions + + // New radius + double Rcm = 0; + + if(bodies[chain_index[i][index_max]].R > 0) { + double rho = bodies[chain_index[i][index_max]].rho; + if(rho <= 0) { + bodies[chain_index[i][index_max]].update_aux_properties(); + rho = bodies[chain_index[i][index_max]].rho; + } + Rcm = pow(3*Mcm / rho / (4*M_PI), 1./3); + } + + // Assume xi remains unchanged + // Assume kf remains unchanged + // Assume tau remains unchanged + // Assume a_mb remains unchanged + + // Shape: assume sphere after collision has relaxed + double Imag = bodies[chain_index[i][index_max]].xi * Mcm * Rcm * Rcm; + + array Icm_p = {}; + Icm_p.fill(0); + Icm_p[0] = Imag; + Icm_p[3] = Imag; + Icm_p[5] = Imag; + + array Icm_n = {}; + Icm_n.fill(0); + + array Icm = {}; + for(int k=0; k<6; k++) { + Icm[k] = Icm_p[k] + Icm_n[k]; + } + + array Icm_inv = {}; + if(Imag > 0) { + Icm_inv.fill(0); + Icm_inv[0] = 1./Imag; + Icm_inv[3] = 1./Imag; + Icm_inv[5] = 1./Imag; + } + + // Spin + array wcm = {}; + + wcm[0] = Icm_inv[0]*Lspin_new[0] + Icm_inv[1]*Lspin_new[1] + Icm_inv[2]*Lspin_new[2]; + wcm[1] = Icm_inv[1]*Lspin_new[0] + Icm_inv[3]*Lspin_new[1] + Icm_inv[4]*Lspin_new[2]; + wcm[2] = Icm_inv[2]*Lspin_new[0] + Icm_inv[4]*Lspin_new[1] + Icm_inv[5]*Lspin_new[2]; + + // Update primary collision partner + bodies[chain_index[i][index_max]].m = Mcm; + bodies[chain_index[i][index_max]].R = Rcm; + + for(int k=0; k<6; k++) { + bodies[chain_index[i][index_max]].I_p[k] = Icm_p[k]; + bodies[chain_index[i][index_max]].I_n[k] = Icm_n[k]; + bodies[chain_index[i][index_max]].I[k] = Icm[k]; + bodies[chain_index[i][index_max]].I_inv[k] = Icm_inv[k]; + } + + for(int k=0; k<3; k++) { + bodies[chain_index[i][index_max]].w[k] = wcm[k]; + bodies[chain_index[i][index_max]].L[k] = Lspin_new[k]; + } + + for(int k=0; k<3; k++) { + bodies[chain_index[i][index_max]].r[k] = rcm[k]; + bodies[chain_index[i][index_max]].v[k] = vcm[k]; + } + + // Set auxiliary quantities + bodies[chain_index[i][index_max]].update_aux_properties(); + + // Book keep indices of secondary collision partners + for(int j=0; j &bodies, vector< array > &cindex) { + process_collision_chains(cindex); + convert_id_to_index(bodies); + + vector index_sec; + + for(int i=0; i= 2 ) { + collision_type = 2; + break; + } + else if( bodies[chain_index[i][j]].particle_type == 1 ) { + collision_type = 1; + } + } + + if(collision_type == 0) { + replace_test_body(bodies, i, Ns, index_sec); + } + else if(collision_type == 1) { + replace_point_body(bodies, i, Ns, index_sec); + } + else { + replace_tidal_body(bodies, i, Ns, index_sec); + } + } + + // Remove merger components + std::sort(index_sec.begin(), index_sec.end(), std::greater()); + + for(int i=0; i > &cindex) { + int Nc = cindex.size(); + for(int i=0; i Evolver_base::get_center_of_mass(vector &bodies) { + return orbit.get_center_of_mass(bodies); +} +array Evolver_base::get_center_of_mass_velocity(vector &bodies) { + return orbit.get_center_of_mass_velocity(bodies); +} +array Evolver_base::get_orbital_angular_momentum(vector &bodies) { + return orbit.get_angular_momentum(bodies); +} +double Evolver_base::get_orbital_kinetic_energy(vector &bodies) { + return orbit.get_kinetic_energy(bodies); +} + +void Evolver_base::assign_vectors(vector &bodies, Force *force) { + int N = bodies.size(); + int Np = 0.5*N*(N-1); // this only works for N < few k in terms of memory + force->dr2_vec.assign(Np, 0); + force->dr_3_vec.assign(Np, 0); +} + +void Evolver_base::set_n_iter(int n_iter) { + this->n_iter = n_iter; +} +int Evolver_base::get_n_iter() { + return n_iter; +} + +void Evolver_base::reset_aux(vector &bodies) { + orbit.init_vv(bodies); + spin.init_K(bodies); + shape.init_J(bodies); +} + +void Evolver_base::set_collision_mode(int collision_mode) { + this->collision_mode = collision_mode; +} +void Evolver_base::set_roche_mode(int roche_mode) { + this->roche_mode = roche_mode; +} + +bool Evolver_base::stopping_condition_time(double t0, double t1, int dt_sgn) { + bool toContinue = true; + if(dt_sgn == 1) { + if(t0 >= t1) toContinue = false; + } + else { + if(t0 <= t1) toContinue = false; + } + return toContinue; +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep.cpp new file mode 100644 index 0000000000..2cc2c2468a --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep.cpp @@ -0,0 +1,173 @@ +#include "Evolver_creep.h" + +// Evolve function +void Evolver_creep::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_torque_load(bodies, true); + + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} + +void Evolver_creep::sync_step(vector &bodies, Force *force, double dth) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.memorize_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_creep::mclachlan_step(vector &bodies, double dt, Force *force) { + shape.calc_expos(bodies, w1*dt); + shape.copy_expos_to_1(bodies); + + leapfrog_step(bodies, w1*dt, force); + + shape.calc_expos(bodies, w2*dt); + shape.copy_expos_to_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.calc_expos(bodies, w3*dt); + + leapfrog_step(bodies, w3*dt, force); + + shape.revert_expos_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.revert_expos_1(bodies); + + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_creep::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_creep::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_creep::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col.cpp new file mode 100644 index 0000000000..d69a4a0d6f --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col.cpp @@ -0,0 +1,273 @@ +#include "Evolver_creep_col.h" + +// Evolve function +void Evolver_creep_col::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_torque_load(bodies, true); + + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} +void Evolver_creep_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_torque_load(bodies, true); + + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_col_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} + +void Evolver_creep_col::sync_step(vector &bodies, Force *force, double dth) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.memorize_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_creep_col::mclachlan_step(vector &bodies, double dt, Force *force) { + shape.calc_expos(bodies, w1*dt); + shape.copy_expos_to_1(bodies); + + leapfrog_step(bodies, w1*dt, force); + + shape.calc_expos(bodies, w2*dt); + shape.copy_expos_to_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.calc_expos(bodies, w3*dt); + + leapfrog_step(bodies, w3*dt, force); + + shape.revert_expos_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.revert_expos_1(bodies); + + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_creep_col::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_creep_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_creep_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_mb.cpp new file mode 100644 index 0000000000..5c42ad4447 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_mb.cpp @@ -0,0 +1,277 @@ +#include "Evolver_creep_col_mb.h" + +// Evolve function +void Evolver_creep_col_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_torque_load(bodies, true); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} +void Evolver_creep_col_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_torque_load(bodies, true); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_col_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} + +void Evolver_creep_col_mb::sync_step(vector &bodies, Force *force, double dth) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.memorize_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_creep_col_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + shape.calc_expos(bodies, w1*dt); + shape.copy_expos_to_1(bodies); + + leapfrog_step(bodies, w1*dt, force); + + shape.calc_expos(bodies, w2*dt); + shape.copy_expos_to_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.calc_expos(bodies, w3*dt); + + leapfrog_step(bodies, w3*dt, force); + + shape.revert_expos_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.revert_expos_1(bodies); + + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_creep_col_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_creep_col_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_creep_col_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn.cpp new file mode 100644 index 0000000000..c1d5d0fa47 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn.cpp @@ -0,0 +1,277 @@ +#include "Evolver_creep_col_pn.h" + +// Evolve function +void Evolver_creep_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, true); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} +void Evolver_creep_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, true); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_col_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} + +void Evolver_creep_col_pn::sync_step(vector &bodies, Force *force, double dth) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.memorize_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_creep_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + shape.calc_expos(bodies, w1*dt); + shape.copy_expos_to_1(bodies); + + leapfrog_step(bodies, w1*dt, force); + + shape.calc_expos(bodies, w2*dt); + shape.copy_expos_to_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.calc_expos(bodies, w3*dt); + + leapfrog_step(bodies, w3*dt, force); + + shape.revert_expos_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.revert_expos_1(bodies); + + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_creep_col_pn::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_creep_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_creep_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn_mb.cpp new file mode 100644 index 0000000000..643f9f4a77 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn_mb.cpp @@ -0,0 +1,281 @@ +#include "Evolver_creep_col_pn_mb.h" + +// Evolve function +void Evolver_creep_col_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, true); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} +void Evolver_creep_col_pn_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, true); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_col_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} + +void Evolver_creep_col_pn_mb::sync_step(vector &bodies, Force *force, double dth) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.memorize_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_creep_col_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + shape.calc_expos(bodies, w1*dt); + shape.copy_expos_to_1(bodies); + + leapfrog_step(bodies, w1*dt, force); + + shape.calc_expos(bodies, w2*dt); + shape.copy_expos_to_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.calc_expos(bodies, w3*dt); + + leapfrog_step(bodies, w3*dt, force); + + shape.revert_expos_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.revert_expos_1(bodies); + + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_creep_col_pn_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_creep_col_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_creep_col_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_mb.cpp new file mode 100644 index 0000000000..516b983b26 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_mb.cpp @@ -0,0 +1,175 @@ +#include "Evolver_creep_mb.h" + +// Evolve function +void Evolver_creep_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_torque_load(bodies, true); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} + +void Evolver_creep_mb::sync_step(vector &bodies, Force *force, double dth) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.memorize_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_creep_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + shape.calc_expos(bodies, w1*dt); + shape.copy_expos_to_1(bodies); + + leapfrog_step(bodies, w1*dt, force); + + shape.calc_expos(bodies, w2*dt); + shape.copy_expos_to_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.calc_expos(bodies, w3*dt); + + leapfrog_step(bodies, w3*dt, force); + + shape.revert_expos_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.revert_expos_1(bodies); + + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_creep_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_creep_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_creep_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn.cpp new file mode 100644 index 0000000000..3fb8a916b9 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn.cpp @@ -0,0 +1,175 @@ +#include "Evolver_creep_pn.h" + +// Evolve function +void Evolver_creep_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, true); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} + +void Evolver_creep_pn::sync_step(vector &bodies, Force *force, double dth) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.memorize_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_creep_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + shape.calc_expos(bodies, w1*dt); + shape.copy_expos_to_1(bodies); + + leapfrog_step(bodies, w1*dt, force); + + shape.calc_expos(bodies, w2*dt); + shape.copy_expos_to_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.calc_expos(bodies, w3*dt); + + leapfrog_step(bodies, w3*dt, force); + + shape.revert_expos_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.revert_expos_1(bodies); + + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_creep_pn::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_creep_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_creep_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn_mb.cpp new file mode 100644 index 0000000000..28eeb041df --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn_mb.cpp @@ -0,0 +1,177 @@ +#include "Evolver_creep_pn_mb.h" + +// Evolve function +void Evolver_creep_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.memorize_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + shape.calculate_J_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_J(bodies); + shape.deform_and_rotate_J_half(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, true); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.memorize_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.reset_I(bodies); + shape.deform_and_rotate_half(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dth); +} + +void Evolver_creep_pn_mb::sync_step(vector &bodies, Force *force, double dth) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.memorize_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + shape.reset_I(bodies); + + shape.deform_and_rotate_half(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_creep_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + shape.calc_expos(bodies, w1*dt); + shape.copy_expos_to_1(bodies); + + leapfrog_step(bodies, w1*dt, force); + + shape.calc_expos(bodies, w2*dt); + shape.copy_expos_to_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.calc_expos(bodies, w3*dt); + + leapfrog_step(bodies, w3*dt, force); + + shape.revert_expos_2(bodies); + + leapfrog_step(bodies, w2*dt, force); + + shape.revert_expos_1(bodies); + + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_creep_pn_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_creep_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_creep_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct.cpp new file mode 100644 index 0000000000..f60b9833d8 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct.cpp @@ -0,0 +1,106 @@ +#include "Evolver_direct.h" + +// Evolve function + +void Evolver_direct::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + spin.kick_L(bodies, dt); + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); +} + +void Evolver_direct::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_direct::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); +} +void Evolver_direct::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_direct::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col.cpp new file mode 100644 index 0000000000..2acdcc109d --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col.cpp @@ -0,0 +1,181 @@ +#include "Evolver_direct_col.h" + +// Evolve function + +void Evolver_direct_col::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + spin.kick_L(bodies, dt); + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); +} +void Evolver_direct_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor_col(bodies, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + spin.kick_L(bodies, dt); + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); +} + +void Evolver_direct_col::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_direct_col::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); +} +void Evolver_direct_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_direct_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_mb.cpp new file mode 100644 index 0000000000..f18e4fb8a8 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_mb.cpp @@ -0,0 +1,199 @@ +#include "Evolver_direct_col_mb.h" + +// Evolve function + +void Evolver_direct_col_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + shape.kick_direct_J(bodies, dth); +} +void Evolver_direct_col_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor_col(bodies, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + shape.kick_direct_J(bodies, dth); +} + +void Evolver_direct_col_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_direct_col_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); +} +void Evolver_direct_col_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_direct_col_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn.cpp new file mode 100644 index 0000000000..92026f1f1c --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn.cpp @@ -0,0 +1,181 @@ +#include "Evolver_direct_col_pn.h" + +// Evolve function + +void Evolver_direct_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, true, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + spin.kick_L(bodies, dt); + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); +} +void Evolver_direct_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor_col(bodies, true, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + spin.kick_L(bodies, dt); + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); +} + +void Evolver_direct_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_direct_col_pn::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); +} +void Evolver_direct_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_direct_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn_mb.cpp new file mode 100644 index 0000000000..914e53eae2 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn_mb.cpp @@ -0,0 +1,199 @@ +#include "Evolver_direct_col_pn_mb.h" + +// Evolve function + +void Evolver_direct_col_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, true, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + shape.kick_direct_J(bodies, dth); +} +void Evolver_direct_col_pn_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor_col(bodies, true, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + shape.kick_direct_J(bodies, dth); +} + +void Evolver_direct_col_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_direct_col_pn_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); +} +void Evolver_direct_col_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_direct_col_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_mb.cpp new file mode 100644 index 0000000000..727e0b72eb --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_mb.cpp @@ -0,0 +1,115 @@ +#include "Evolver_direct_mb.h" + +// Evolve function + +void Evolver_direct_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + shape.kick_direct_J(bodies, dth); +} + +void Evolver_direct_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_direct_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); +} +void Evolver_direct_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_direct_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn.cpp new file mode 100644 index 0000000000..c7623813cf --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn.cpp @@ -0,0 +1,106 @@ +#include "Evolver_direct_pn.h" + +// Evolve function + +void Evolver_direct_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, true, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + spin.kick_L(bodies, dt); + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + spin.kick_K(bodies, dth); + shape.kick_direct_J(bodies, dth); +} + +void Evolver_direct_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_direct_pn::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); +} +void Evolver_direct_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_direct_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn_mb.cpp new file mode 100644 index 0000000000..b23d619fc4 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn_mb.cpp @@ -0,0 +1,115 @@ +#include "Evolver_direct_pn_mb.h" + +// Evolve function + +void Evolver_direct_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.kick_direct_J(bodies, dth); + + shape.calculate_J_inv_and_w_with_K(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, true, true); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, true); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.kick_direct(bodies, dt); + + orbit.drift_r(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + shape.kick_direct_J(bodies, dth); +} + +void Evolver_direct_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_direct_pn_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_deformation_tensor(bodies, false); +} +void Evolver_direct_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_direct_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium.cpp new file mode 100755 index 0000000000..b68cb77465 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium.cpp @@ -0,0 +1,164 @@ +#include "Evolver_equilibrium.h" + +// Evolve function +void Evolver_equilibrium::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + orbit.drift_r(bodies, dth); +} + +void Evolver_equilibrium::sync_step(vector &bodies, Force *force) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + shape.calculate_I_inv_and_w(bodies); +} + +void Evolver_equilibrium::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_equilibrium::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_equilibrium::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } + + sync_step(bodies, force); +} +void Evolver_equilibrium::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } + + sync_step(bodies, force); +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col.cpp new file mode 100644 index 0000000000..da30dcf522 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col.cpp @@ -0,0 +1,271 @@ +#include "Evolver_equilibrium_col.h" + +// Evolve function +void Evolver_equilibrium_col::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + orbit.drift_r(bodies, dth); +} +void Evolver_equilibrium_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_col_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + orbit.drift_r(bodies, dth); +} +void Evolver_equilibrium_col::sync_step(vector &bodies, Force *force) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + shape.calculate_I_inv_and_w(bodies); +} + +void Evolver_equilibrium_col::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_equilibrium_col::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_equilibrium_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } + + sync_step(bodies, force); +} +void Evolver_equilibrium_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } + + sync_step(bodies, force); +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_mb.cpp new file mode 100644 index 0000000000..e2d31fa2e2 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_mb.cpp @@ -0,0 +1,278 @@ +#include "Evolver_equilibrium_col_mb.h" + +// Evolve function +void Evolver_equilibrium_col_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + orbit.drift_r(bodies, dth); +} +void Evolver_equilibrium_col_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_col_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + orbit.drift_r(bodies, dth); +} + +void Evolver_equilibrium_col_mb::sync_step(vector &bodies, Force *force) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + shape.calculate_I_inv_and_w(bodies); +} + +void Evolver_equilibrium_col_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_equilibrium_col_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_equilibrium_col_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } + + sync_step(bodies, force); +} +void Evolver_equilibrium_col_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } + + sync_step(bodies, force); +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn.cpp new file mode 100644 index 0000000000..d5101fe8ff --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn.cpp @@ -0,0 +1,281 @@ +#include "Evolver_equilibrium_col_pn.h" + +// Evolve function +void Evolver_equilibrium_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + orbit.drift_r(bodies, dth); +} +void Evolver_equilibrium_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_col_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + orbit.drift_r(bodies, dth); +} + +void Evolver_equilibrium_col_pn::sync_step(vector &bodies, Force *force) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + shape.calculate_I_inv_and_w(bodies); +} + +void Evolver_equilibrium_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_equilibrium_col_pn::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_equilibrium_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } + + sync_step(bodies, force); +} +void Evolver_equilibrium_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } + + sync_step(bodies, force); +} + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn_mb.cpp new file mode 100644 index 0000000000..ceb0c2d8af --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn_mb.cpp @@ -0,0 +1,286 @@ +#include "Evolver_equilibrium_col_pn_mb.h" + +// Evolve function +void Evolver_equilibrium_col_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + orbit.drift_r(bodies, dth); +} +void Evolver_equilibrium_col_pn_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_col_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + orbit.drift_r(bodies, dth); +} + +void Evolver_equilibrium_col_pn_mb::sync_step(vector &bodies, Force *force) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + shape.calculate_I_inv_and_w(bodies); +} + +void Evolver_equilibrium_col_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_equilibrium_col_pn_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_equilibrium_col_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } + + sync_step(bodies, force); +} +void Evolver_equilibrium_col_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } + + sync_step(bodies, force); +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_mb.cpp new file mode 100644 index 0000000000..5120700cf5 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_mb.cpp @@ -0,0 +1,167 @@ +#include "Evolver_equilibrium_mb.h" + +// Evolve function +void Evolver_equilibrium_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + orbit.drift_r(bodies, dth); +} + +void Evolver_equilibrium_mb::sync_step(vector &bodies, Force *force) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + shape.calculate_I_inv_and_w(bodies); +} + +void Evolver_equilibrium_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_equilibrium_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_equilibrium_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } + + sync_step(bodies, force); +} +void Evolver_equilibrium_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } + + sync_step(bodies, force); +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn.cpp new file mode 100644 index 0000000000..28bf58f5ff --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn.cpp @@ -0,0 +1,167 @@ +#include "Evolver_equilibrium_pn.h" + +// Evolve function +void Evolver_equilibrium_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + orbit.drift_r(bodies, dth); +} + +void Evolver_equilibrium_pn::sync_step(vector &bodies, Force *force) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + shape.calculate_I_inv_and_w(bodies); +} + +void Evolver_equilibrium_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_equilibrium_pn::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_equilibrium_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } + + sync_step(bodies, force); +} +void Evolver_equilibrium_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } + + sync_step(bodies, force); +} + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn_mb.cpp new file mode 100644 index 0000000000..0a274763e3 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn_mb.cpp @@ -0,0 +1,171 @@ +#include "Evolver_equilibrium_pn_mb.h" + +// Evolve function +void Evolver_equilibrium_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + spin.kick_K_mb(bodies, dth); + + orbit.drift_r(bodies, dth); +} + +void Evolver_equilibrium_pn_mb::sync_step(vector &bodies, Force *force) { + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_to_equilibrium_shape(bodies); + } + + shape.calculate_I_inv_and_w(bodies); +} + +void Evolver_equilibrium_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_equilibrium_pn_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_equilibrium_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } + + sync_step(bodies, force); +} +void Evolver_equilibrium_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } + + sync_step(bodies, force); +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear.cpp new file mode 100644 index 0000000000..de5d7c5f3e --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear.cpp @@ -0,0 +1,150 @@ +#include "Evolver_linear.h" + +// Evolve function +void Evolver_linear::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} + +void Evolver_linear::sync_step(vector &bodies, Force *force, double dt) { + double dth = 0.5*dt; + + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_linear::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_linear::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_linear::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_linear::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col.cpp new file mode 100644 index 0000000000..10287b9450 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col.cpp @@ -0,0 +1,245 @@ +#include "Evolver_linear_col.h" + +// Evolve function +void Evolver_linear_col::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} +void Evolver_linear_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_torque_load(bodies, false); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_col_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} + +void Evolver_linear_col::sync_step(vector &bodies, Force *force, double dt) { + double dth = 0.5*dt; + + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_linear_col::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_linear_col::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_linear_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_linear_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_mb.cpp new file mode 100644 index 0000000000..9c16f34748 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_mb.cpp @@ -0,0 +1,249 @@ +#include "Evolver_linear_col_mb.h" + +// Evolve function +void Evolver_linear_col_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_torque_load(bodies, false); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} +void Evolver_linear_col_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_torque_load(bodies, false); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_col_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} + +void Evolver_linear_col_mb::sync_step(vector &bodies, Force *force, double dt) { + double dth = 0.5*dt; + + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_linear_col_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_linear_col_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_linear_col_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_linear_col_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn.cpp new file mode 100644 index 0000000000..8dc3125cee --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn.cpp @@ -0,0 +1,249 @@ +#include "Evolver_linear_col_pn.h" + +// Evolve function +void Evolver_linear_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} +void Evolver_linear_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_col_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} + +void Evolver_linear_col_pn::sync_step(vector &bodies, Force *force, double dt) { + double dth = 0.5*dt; + + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_linear_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_linear_col_pn::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_linear_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_linear_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn_mb.cpp new file mode 100644 index 0000000000..9a75d6a49a --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn_mb.cpp @@ -0,0 +1,253 @@ +#include "Evolver_linear_col_pn_mb.h" + +// Evolve function +void Evolver_linear_col_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} +void Evolver_linear_col_pn_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_col_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} + +void Evolver_linear_col_pn_mb::sync_step(vector &bodies, Force *force, double dt) { + double dth = 0.5*dt; + + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_linear_col_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_linear_col_pn_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_linear_col_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_linear_col_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_mb.cpp new file mode 100644 index 0000000000..6ba3c862af --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_mb.cpp @@ -0,0 +1,151 @@ +#include "Evolver_linear_mb.h" + +// Evolve function +void Evolver_linear_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_torque_load(bodies, false); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_load(bodies, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} + +void Evolver_linear_mb::sync_step(vector &bodies, Force *force, double dt) { + double dth = 0.5*dt; + + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_linear_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_linear_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque(bodies, false); +} +void Evolver_linear_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_linear_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn.cpp new file mode 100644 index 0000000000..146edc7a72 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn.cpp @@ -0,0 +1,152 @@ +#include "Evolver_linear_pn.h" + +// Evolve function +void Evolver_linear_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} + +void Evolver_linear_pn::sync_step(vector &bodies, Force *force, double dt) { + double dth = 0.5*dt; + + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_linear_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_linear_pn::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_linear_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_linear_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn_mb.cpp new file mode 100644 index 0000000000..13d1f03e4c --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn_mb.cpp @@ -0,0 +1,154 @@ +#include "Evolver_linear_pn_mb.h" + +// Evolve function +void Evolver_linear_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + + orbit.drift_r(bodies, dth); + + force->update_tidal_deformation_save(bodies); + force->update_equilibrium_tensor_and_memorize(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + force->update_acceleration_and_torque_pn_load(bodies, false, false); + + orbit.kick_vv(bodies, dth); + + spin.kick_K_mb(bodies, dth); + spin.kick_K(bodies, dth); + + shape.calculate_I_inv_and_w_with_K(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + spin.memorize_w(bodies); + shape.backup_I_e(bodies); + + force->update_acceleration_and_torque_pn_load(bodies, true, false); + + orbit.kick_v(bodies, dt); + + spin.kick_L(bodies, dt); + spin.kick_L_mb(bodies, dt); + + orbit.drift_r(bodies, dth); + + sync_step(bodies, force, dt_step); +} + +void Evolver_linear_pn_mb::sync_step(vector &bodies, Force *force, double dt) { + double dth = 0.5*dt; + + force->update_tidal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + shape.set_I_e_prev_to_backup(bodies); + + shape.kick_linear_discrete(bodies, dth); + + shape.calculate_I_inv_and_w(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + + for(int n=0; nupdate_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + spin.reset_w(bodies); + + shape.kick_linear_discrete(bodies, dth); + } + + shape.calculate_I_inv_and_w(bodies); + + reset_aux(bodies); +} + +void Evolver_linear_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_linear_pn_mb::initialize(vector &bodies, Force *force) { + shape.calculate_I_inv_and_w(bodies); + + force->update_tidal_deformation(bodies); + force->update_centrifugal_deformation(bodies); + force->update_equilibrium_tensor(bodies); + + force->update_acceleration_and_torque_pn(bodies, false, false); +} +void Evolver_linear_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_linear_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody.cpp new file mode 100755 index 0000000000..d9deafa6de --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody.cpp @@ -0,0 +1,61 @@ +#include "Evolver_nbody.h" + +// Evolve function +void Evolver_nbody::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + orbit.drift_r(bodies, dth); + force->update_acceleration(bodies); + orbit.kick_v(bodies, dt); + orbit.drift_r(bodies, dth); +} +void Evolver_nbody::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_nbody::initialize(vector &bodies, Force *force) { + force->update_acceleration(bodies); +} +void Evolver_nbody::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_nbody::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_base.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_base.cpp new file mode 100644 index 0000000000..e5f581679f --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_base.cpp @@ -0,0 +1,22 @@ +#include "Evolver_nbody_base.h" + +// Get diagnostics +array Evolver_nbody_base::get_spin_angular_momentum(vector &bodies) { + array L = {}; + return L; +} +double Evolver_nbody_base::get_spin_kinetic_energy(vector &bodies) { + return 0; +} +double Evolver_nbody_base::get_potential_energy(vector &bodies) { + return orbit.get_potential_energy_nbody(bodies); +} +array Evolver_nbody_base::get_angular_momentum(vector &bodies) { + return orbit.get_angular_momentum(bodies); +} +double Evolver_nbody_base::get_energy(vector &bodies) { + double EK = get_orbital_kinetic_energy(bodies); + double EP = get_potential_energy(bodies); + return EK + EP; +} + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col.cpp new file mode 100644 index 0000000000..190543954d --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col.cpp @@ -0,0 +1,112 @@ +#include "Evolver_nbody_col.h" + +// Evolve function +void Evolver_nbody_col::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + orbit.drift_r(bodies, dth); + force->update_acceleration(bodies); + orbit.kick_v(bodies, dt); + orbit.drift_r(bodies, dth); +} +void Evolver_nbody_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + orbit.drift_r(bodies, dth); + force->update_acceleration_col(bodies); + orbit.kick_v(bodies, dt); + orbit.drift_r(bodies, dth); +} +void Evolver_nbody_col::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_nbody_col::initialize(vector &bodies, Force *force) { + force->update_acceleration(bodies); +} +void Evolver_nbody_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + +void Evolver_nbody_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col_pn.cpp new file mode 100644 index 0000000000..20f8b6b57e --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col_pn.cpp @@ -0,0 +1,127 @@ +#include "Evolver_nbody_col_pn.h" + +// Evolve function +void Evolver_nbody_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + orbit.drift_r(bodies, dth); + force->update_acceleration_pn_save(bodies, false); + orbit.kick_vv(bodies, dth); + force->update_acceleration_pn_load(bodies, true); + orbit.kick_v(bodies, dt); + force->update_acceleration_pn_load(bodies, false); + orbit.kick_vv(bodies, dth); + orbit.drift_r(bodies, dth); +} +void Evolver_nbody_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + orbit.drift_r(bodies, dth); + force->update_acceleration_pn_save(bodies, false); + orbit.kick_vv(bodies, dth); + force->update_acceleration_pn_col_load(bodies, true); + orbit.kick_v(bodies, dt); + force->update_acceleration_pn_load(bodies, false); + orbit.kick_vv(bodies, dth); + orbit.drift_r(bodies, dth); +} +void Evolver_nbody_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step_with_collisions(bodies, w1*dt, force); +} + +void Evolver_nbody_col_pn::initialize(vector &bodies, Force *force) { + force->update_acceleration_pn(bodies, false); +} +void Evolver_nbody_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} +void Evolver_nbody_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + if(force->collision_detected) { + collision_flag = true; + } + if(force->roche_detected) { + roche_flag = true; + } + + if(force->collision_detected) { + if(collision_mode >= 2) { + break; + } + } + if(force->roche_detected) { + if(roche_mode >= 2) { + break; + } + } + } +} + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_pn.cpp new file mode 100644 index 0000000000..ae32a685c9 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_pn.cpp @@ -0,0 +1,76 @@ +#include "Evolver_nbody_pn.h" + +// Evolve function +void Evolver_nbody_pn::leapfrog_step(vector &bodies, double dt, Force *force) { + double dth = 0.5*dt; + orbit.drift_r(bodies, dth); + force->update_acceleration_pn_save(bodies, false); + orbit.kick_vv(bodies, dth); + force->update_acceleration_pn_load(bodies, true); + orbit.kick_v(bodies, dt); + force->update_acceleration_pn_load(bodies, false); + orbit.kick_vv(bodies, dth); + orbit.drift_r(bodies, dth); +} +void Evolver_nbody_pn::mclachlan_step(vector &bodies, double dt, Force *force) { + leapfrog_step(bodies, w1*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w3*dt, force); + leapfrog_step(bodies, w2*dt, force); + leapfrog_step(bodies, w1*dt, force); +} + +void Evolver_nbody_pn::initialize(vector &bodies, Force *force) { + force->update_acceleration_pn(bodies, false); +} +void Evolver_nbody_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { + bool toContinue = true; + + num_integration_step = 0; + + while(toContinue) { + reset_aux(bodies); + + //---------------------------------------------- + + dt_step = timestep->get_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + + //---------------------------------------------- + + toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); + } +} +void Evolver_nbody_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { + num_integration_step = 0; + + for(int i=0; iget_timestep(bodies); + + //---------------------------------------------- + + mclachlan_step(bodies, dt_step, force); + + //---------------------------------------------- + + t += dt_step; + num_integration_step++; + } +} + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_shape_base.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_shape_base.cpp new file mode 100644 index 0000000000..36fd07ba1b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_shape_base.cpp @@ -0,0 +1,29 @@ +#include "Evolver_shape_base.h" + +// Get diagnostics +array Evolver_shape_base::get_spin_angular_momentum(vector &bodies) { + return spin.get_angular_momentum(bodies); +} +double Evolver_shape_base::get_spin_kinetic_energy(vector &bodies) { + return spin.get_kinetic_energy(bodies); +} +double Evolver_shape_base::get_potential_energy(vector &bodies) { + return orbit.get_potential_energy(bodies); +} +array Evolver_shape_base::get_angular_momentum(vector &bodies) { + array Lorbit = get_orbital_angular_momentum(bodies); + array Lspin = get_spin_angular_momentum(bodies); + array Ltot = {}; + for(int k=0; k<3; k++) { + Ltot[k] = Lorbit[k] + Lspin[k]; + } + return Ltot; +} +double Evolver_shape_base::get_energy(vector &bodies) { + double EK_orbit = get_orbital_kinetic_energy(bodies); + double EK_spin = get_spin_kinetic_energy(bodies); + double EP = get_potential_energy(bodies); + double E = EK_orbit + EK_spin + EP; + return E; +} + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Force.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Force.cpp new file mode 100755 index 0000000000..baa79772b0 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Force.cpp @@ -0,0 +1,3062 @@ +#include "Force.h" + +// Initializers + +Force::Force() { + this->set_default_settings(); +} + +Force::Force(int pn_order, double c) { + this->set_default_settings(); + + this->pn_order = pn_order; + this->c = c; + this->set_speed_of_light(this->c); +} + +void Force::set_default_settings() { + this->pn_order = 0; + + this->c = 1e100; + this->set_speed_of_light(this->c); + + collision_detected = false; + index_collisions.clear(); + + roche_detected = false; + index_roche.clear(); +} + +// Setters + +void Force::set_pn_order(int pn_order) { + this->pn_order = pn_order; +} +void Force::set_speed_of_light(double c) { + this->c = c; + this->c_2 = 1./(this->c*this->c); + this->c_4 = this->c_2*this->c_2; + this->c_5 = this->c_4/this->c; +} + +// Collision checker + +void Force::check_for_collisions(Body &bi, Body &bj, double &dr_1) { + double Rsum = bi.R+bj.R; + double fcol_R = Rsum*dr_1; + + if(fcol_R > 1) { + this->collision_detected = true; + + array couple; + couple[0] = bi.id; + couple[1] = bj.id; + + this->index_collisions.push_back(couple); + } +} +void Force::check_for_collisions(Body &bi, Body &bj, double &dr_3, double &dr2) { + double dr_1 = dr_3*dr2; + this->check_for_collisions(bi, bj, dr_1); +} + +void Force::check_for_roche(Body &bi, Body &bj, double &dr_1) { + bool is_roche = false; + + if(bi.rho > 0 && bj.m > 0) { + double C = bi.roche_factor; + double m = bi.m; + double r = bi.R; + double M = bj.m; + + double d = C * r * pow(M/m, 1./3); + double f = d*dr_1; + + if(f > 1) { + this->roche_detected = true; + + array couple; + couple[0] = bi.id; + couple[1] = bj.id; + + this->index_roche.push_back(couple); + + is_roche = true; + } + } + + if(!is_roche) { + if(bj.rho > 0 && bi.m > 0) { + double C = bj.roche_factor; + double m = bj.m; + double r = bj.R; + double M = bi.m; + + double d = C * r * pow(M/m, 1./3); + double f = d*dr_1; + + if(f > 1) { + this->roche_detected = true; + + array couple; + couple[0] = bi.id; + couple[1] = bj.id; + + this->index_roche.push_back(couple); + + is_roche = true; + } + } + } +} +void Force::check_for_roche(Body &bi, Body &bj, double &dr_3, double &dr2) { + double dr_1 = dr_3*dr2; + this->check_for_roche(bi, bj, dr_1); +} + +void Force::reset_collisions() { + this->collision_detected = false; + this->index_collisions.clear(); +} +void Force::reset_roche() { + this->roche_detected = false; + this->index_roche.clear(); +} + +// Force functions + +void Force::precalc_sep_vec(Body &bi, Body &bj, array &dr) { + for(int k=0; k<3; k++) { + dr[k] = bi.r[k]-bj.r[k]; + } +} +void Force::precalc_sep_mag(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3) { + precalc_sep_vec(bi, bj, dr); + dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + dr_3 = 1./sqrt(dr2*dr2*dr2); +} +void Force::precalc_sep_vec_norm(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr_3) { + double dr2; + + precalc_sep_mag(bi, bj, dr, dr2, dr_3); + + double dr_1 = dr2*dr_3; + dr_4 = dr_3*dr_1; + + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } +} +void Force::precalc_sep_vec_norm_load(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr2, double &dr_3) { + precalc_sep_vec(bi, bj, dr); + + double dr_1 = dr2*dr_3; + dr_4 = dr_3*dr_1; + + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } +} +void Force::precalc_sep_vec_norm_save(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr2, double &dr_3) { + precalc_sep_mag(bi, bj, dr, dr2, dr_3); + + double dr_1 = dr2*dr_3; + dr_4 = dr_3*dr_1; + + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } +} + +void Force::precalc_pn(Body &bi, Body &bj, bool &use_vv, array &drn, double &dr_1, double &vivi, double &vjvj, double &vivj, double &drnvi, double &drnvj, double &dv2, array &dv, double &drnvidrnvi, double &drnvjdrnvj, double &bimdr_1, double &bjmdr_1) { + if(use_vv) { + for(int k=0; k<3; k++) dv[k] = bi.vv[k]-bj.vv[k]; + vivi = inner_product(bi.vv.begin(), bi.vv.end(), bi.vv.begin(), 0.); + vjvj = inner_product(bj.vv.begin(), bj.vv.end(), bj.vv.begin(), 0.); + vivj = inner_product(bi.vv.begin(), bi.vv.end(), bj.vv.begin(), 0.); + drnvi = inner_product(drn.begin(), drn.end(), bi.vv.begin(), 0.); + drnvj = inner_product(drn.begin(), drn.end(), bj.vv.begin(), 0.); + } + else { + for(int k=0; k<3; k++) dv[k] = bi.v[k]-bj.v[k]; + vivi = inner_product(bi.v.begin(), bi.v.end(), bi.v.begin(), 0.); + vjvj = inner_product(bj.v.begin(), bj.v.end(), bj.v.begin(), 0.); + vivj = inner_product(bi.v.begin(), bi.v.end(), bj.v.begin(), 0.); + drnvi = inner_product(drn.begin(), drn.end(), bi.v.begin(), 0.); + drnvj = inner_product(drn.begin(), drn.end(), bj.v.begin(), 0.); + } + + dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); + + drnvidrnvi = drnvi*drnvi; + drnvjdrnvj = drnvj*drnvj; + + bimdr_1 = bi.m*dr_1; + bjmdr_1 = bj.m*dr_1; +} +void Force::precalc_tidal(double &dr2, double &dr_3, double &dr_1, double &dr_2, double &dr_4, double &dr_5, array &dr, array &drn, double &dyndyn, double &dzndzn, double &dxndyn, double &dxndzn, double &dyndzn) { + dr_1 = dr2*dr_3; + dr_2 = dr_1*dr_1; + dr_4 = dr_2*dr_2; + dr_5 = dr_3*dr_2; + + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } + + dyndyn = 0.5*(drn[1]*drn[1] - 0.2); + dzndzn = 0.5*(drn[2]*drn[2] - 0.2); + dxndyn = drn[0]*drn[1]; + dxndzn = drn[0]*drn[2]; + dyndzn = drn[1]*drn[2]; +} + +void Force::calculate_nbody_force(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3, array &ai, array &aj) { + bool calc_done = false; + + if(bj.particle_type > 0) { + precalc_sep_mag(bi, bj, dr, dr2, dr_3); + calc_done = true; + + double amag = bj.m*dr_3; + + for(int k=0; k<3; k++) { + ai[k] = -amag*dr[k]; + } + } + else { + for(int k=0; k<3; k++) { + ai[k] = 0; + } + } + + if(bi.particle_type > 0) { + if(calc_done == false) { + precalc_sep_mag(bi, bj, dr, dr2, dr_3); + calc_done = true; + } + + double amag = bi.m*dr_3; + + for(int k=0; k<3; k++) { + aj[k] = amag*dr[k]; + } + } + else { + for(int k=0; k<3; k++) { + aj[k] = 0; + } + } +} +void Force::calculate_nbody_force_load(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3, array &ai, array &aj) { + bool calc_done = false; + + if(bj.particle_type > 0) { + precalc_sep_vec(bi, bj, dr); + calc_done = true; + + double amag = bj.m*dr_3; + + for(int k=0; k<3; k++) { + ai[k] = -amag*dr[k]; + } + } + else { + for(int k=0; k<3; k++) { + ai[k] = 0; + } + } + + if(bi.particle_type > 0) { + if(calc_done == false) { + precalc_sep_vec(bi, bj, dr); + calc_done = true; + } + + double amag = bi.m*dr_3; + + for(int k=0; k<3; k++) { + aj[k] = amag*dr[k]; + } + } + else { + for(int k=0; k<3; k++) { + aj[k] = 0; + } + } +} + +void Force::calculate_pn_force(Body &bi, Body &bj, double &dr2, double &dr_1, double &dr_2, double &dr_3, double &dr_4, array &dr, array &drn, double &dv2, array &dv, array &ai_pn, array &aj_pn, bool use_vv) { + bool calc_done = false; + + double vivi, vjvj, vivj, drnvi, drnvj, drnvidrnvi, drnvjdrnvj, bimdr_1, bjmdr_1; + + if(bj.particle_type > 0) { + precalc_pn(bi, bj, use_vv, drn, dr_1, vivi, vjvj, vivj, drnvi, drnvj, dv2, dv, drnvidrnvi, drnvjdrnvj, bimdr_1, bjmdr_1); + calc_done = true; + + // 1 PN + array ai_1pn = {}; + + double A = bj.m*dr_2; + double B = -vivi - 2*vjvj + 4*vivj + 1.5*drnvjdrnvj + 5*bimdr_1 + 4*bjmdr_1; + double C = 4*drnvi - 3*drnvj; + + for(int k=0; k<3; k++) { + ai_1pn[k] = A*(B*drn[k] + C*dv[k]); + } + + // 2 PN + array ai_2pn = {}; + + if(pn_order > 1) { + A = bj.m*dr_2; + B = vivi*drnvj + 4*vjvj*drnvi - 5*vjvj*drnvj - 4*vivj*drnvi + 4*vivj*drnvj - 6*drnvi*drnvjdrnvj + 4.5*drnvjdrnvj*drnvj + + bimdr_1*(-15.75*drnvi + 13.75*drnvj) + bjmdr_1*(-2*drnvi - 2*drnvj); + C = -2*vjvj*vjvj + 4*vjvj*vivj - 2*vivj*vivj + 1.5*vivi*drnvjdrnvj + 4.5*vjvj*drnvjdrnvj - 6*vivj*drnvjdrnvj - 1.875*drnvjdrnvj*drnvjdrnvj + + bjmdr_1*(4*vjvj - 8*vivj + 2*drnvidrnvi - 4*drnvi*drnvj - 6*drnvjdrnvj) + + bimdr_1*(-3.75*vivi + 1.25*vjvj - 2.5*vivj + 19.5*drnvidrnvi - 39.*drnvi*drnvj + 8.5*drnvjdrnvj); + double D = bj.m*dr_4*(-14.25*bi.m*bi.m - 9*bj.m*bj.m - 34.5*bi.m*bj.m); + + for(int k=0; k<3; k++) { + ai_2pn[k] = A*( B*dv[k] + C*drn[k]) + D*drn[k]; + } + } + + // 2.5 PN + array ai_25pn = {}; + + if(pn_order > 2) { + A = 0.8*bi.m*bj.m*dr_3; + B = -dv2 + 2*bimdr_1 - 8*bjmdr_1; + C = (3*dv2 - 6*bimdr_1 + (17.+1./3)*bjmdr_1)*(drnvi - drnvj); + for(int k=0; k<3; k++) { + ai_25pn[k] = A*( B*dv[k] + C*drn[k] ); + } + } + + for(int k=0; k<3; k++) { + ai_pn[k] = ai_1pn[k]*c_2 + ai_2pn[k]*c_4 + ai_25pn[k]*c_5; + } + } + else { + for(int k=0; k<3; k++) { + ai_pn[k] = 0; + } + } + + if(bi.particle_type > 0) { + if(calc_done == false) { + precalc_pn(bi, bj, use_vv, drn, dr_1, vivi, vjvj, vivj, drnvi, drnvj, dv2, dv, drnvidrnvi, drnvjdrnvj, bimdr_1, bjmdr_1); + calc_done = true; + } + + // 1 PN + array aj_1pn = {}; + + double A = bi.m*dr_2; + double B = -vjvj - 2*vivi + 4*vivj + 1.5*drnvidrnvi + 5*bjmdr_1 + 4*bimdr_1; + double C = 4*-drnvj - 3*-drnvi; + + for(int k=0; k<3; k++) { + aj_1pn[k] = A*(B*-drn[k] + C*-dv[k] ); + } + + // 2 PN + array aj_2pn = {}; + + if(pn_order > 1) { + A = bi.m*dr_2; + B = vjvj*-drnvi + 4*vivi*-drnvj - 5*vivi*-drnvi - 4*vivj*-drnvj + 4*vivj*-drnvi - 6*-drnvj*drnvidrnvi + 4.5*drnvidrnvi*-drnvi + + bjmdr_1*(-15.75*-drnvj + 13.75*-drnvi) + bimdr_1*(-2*-drnvj - 2*-drnvi); + C = -2*vivi*vivi + 4*vivi*vivj - 2*vivj*vivj + 1.5*vjvj*drnvidrnvi + 4.5*vivi*drnvidrnvi - 6*vivj*drnvidrnvi - 1.875*drnvidrnvi*drnvidrnvi + + bimdr_1*(4*vivi - 8*vivj + 2*drnvjdrnvj - 4*-drnvj*-drnvi - 6*drnvidrnvi) + + bjmdr_1*(-3.75*vjvj + 1.25*vivi - 2.5*vivj + 19.5*drnvjdrnvj - 39.*-drnvj*-drnvi + 8.5*drnvidrnvi); + double D = bi.m*dr_4*(-14.25*bj.m*bj.m - 9*bi.m*bi.m - 34.5*bj.m*bi.m); + + for(int k=0; k<3; k++) { + aj_2pn[k] = A*( B*-dv[k] + C*-drn[k]) + D*-drn[k]; + } + } + + // 2.5 PN + array aj_25pn = {}; + + if(pn_order > 2) { + A = 0.8*bi.m*bj.m*dr_3; + B = -dv2 + 2*bjmdr_1 - 8*bimdr_1; + C = (3*dv2 - 6*bjmdr_1 + (17.+1./3)*bimdr_1)*(-drnvj - -drnvi); + for(int k=0; k<3; k++) { + aj_25pn[k] = A*( B*-dv[k] + C*-drn[k] ); + } + } + + for(int k=0; k<3; k++) { + aj_pn[k] = aj_1pn[k]*c_2 + aj_2pn[k]*c_4 + aj_25pn[k]*c_5; + } + } + else { + for(int k=0; k<3; k++) { + aj_pn[k] = 0; + } + } +} + +void Force::calculate_tidal_force(Body &bi, Body &bj, double &dr2, double &dr_3, double &dr_1, double &dr_2, double &dr_4, double &dr_5, array &dr, array &drn, array &ai_tidal, array &aj_tidal, array &hij, array &hji, bool use_J) { + bool calc_done = false; + + double dyndyn, dzndzn, dxndyn, dxndzn, dyndzn; + array bi_I, bj_I; + array gij = {}; + array gji = {}; + double gmag, A; + + if(bj.particle_type == 3) { + precalc_tidal(dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, dyndyn, dzndzn, dxndyn, dxndzn, dyndzn); + A = -3*dr_4; + calc_done = true; + + if(use_J) { + for(int k=0; k<6; k++) { + bj_I[k] = bj.J[k]; + } + } + else { + for(int k=0; k<6; k++) { + bj_I[k] = bj.I[k]; + } + } + + gmag = 15*dr_5 * ( (bj_I[3]-bj_I[0])*dyndyn + (bj_I[5]-bj_I[0])*dzndzn + bj_I[1]*dxndyn + bj_I[2]*dxndzn + bj_I[4]*dyndzn ); + + for(int k=0; k<3; k++) { + gij[k] = gmag*dr[k]; + } + + hij[0] = A * ( bj_I[2]*drn[2] + bj_I[1]*drn[1] ); + hij[1] = A * ( (bj_I[3]-bj_I[0])*drn[1] + bj_I[1]*drn[0] + bj_I[4]*drn[2] ); + hij[2] = A * ( (bj_I[5]-bj_I[0])*drn[2] + bj_I[2]*drn[0] + bj_I[4]*drn[1] ); + } + else { + for(int k=0; k<3; k++) { + gij[k] = 0; + hij[k] = 0; + } + } + + if(bi.particle_type == 3) { + if(calc_done == false) { + precalc_tidal(dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, dyndyn, dzndzn, dxndyn, dxndzn, dyndzn); + A = -3*dr_4; + calc_done = true; + } + + if(use_J) { + for(int k=0; k<6; k++) { + bi_I[k] = bi.J[k]; + } + } + else { + for(int k=0; k<6; k++) { + bi_I[k] = bi.I[k]; + } + } + + gmag = 15*dr_5 * ( (bi_I[3]-bi_I[0])*dyndyn + (bi_I[5]-bi_I[0])*dzndzn + bi_I[1]*dxndyn + bi_I[2]*dxndzn + bi_I[4]*dyndzn ); + + for(int k=0; k<3; k++) { + gji[k] = gmag*dr[k]; + } + + hji[0] = A * ( bi_I[2]*drn[2] + bi_I[1]*drn[1] ); + hji[1] = A * ( (bi_I[3]-bi_I[0])*drn[1] + bi_I[1]*drn[0] + bi_I[4]*drn[2] ); + hji[2] = A * ( (bi_I[5]-bi_I[0])*drn[2] + bi_I[2]*drn[0] + bi_I[4]*drn[1] ); + } + else { + for(int k=0; k<3; k++) { + gji[k] = 0; + hji[k] = 0; + } + } + + if(bi.particle_type > 0 && bj.particle_type > 0) { + for(int k=0; k<3; k++) { + double F = bi.m*gij[k] + bi.m*hij[k] + bj.m*gji[k] + bj.m*hji[k]; + ai_tidal[k] = F / bi.m; + aj_tidal[k] = -F / bj.m; + } + } + else { + if(bi.particle_type > 0) { + for(int k=0; k<3; k++) { + double acc = gji[k] + hji[k]; + ai_tidal[k] = 0; + aj_tidal[k] = -acc; + } + } + else if(bj.particle_type > 0) { + for(int k=0; k<3; k++) { + double acc = gij[k] + hij[k]; + ai_tidal[k] = acc; + aj_tidal[k] = 0; + } + } + else { + for(int k=0; k<3; k++) { + ai_tidal[k] = 0; + aj_tidal[k] = 0; + } + } + } + + for(int k=0; k<3; k++) { + hij[k] *= bi.m; + hji[k] *= bj.m; + } +} + +void Force::calculate_tidal_h(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J) { + bool calc_done = false; + + array drn; + array bi_I, bj_I; + double A, dr_4, dr_3; + + if(bj.particle_type == 3) { + precalc_sep_vec_norm(bi, bj, dr, drn, dr_4, dr_3); + A = -3*dr_4; + calc_done = true; + + if(use_J) { + for(int k=0; k<6; k++) { + bj_I[k] = bj.J[k]; + } + } + else { + for(int k=0; k<6; k++) { + bj_I[k] = bj.I[k]; + } + } + + hij[0] = A * ( bj_I[2]*drn[2] + bj_I[1]*drn[1] ); + hij[1] = A * ( (bj_I[3]-bj_I[0])*drn[1] + bj_I[1]*drn[0] + bj_I[4]*drn[2] ); + hij[2] = A * ( (bj_I[5]-bj_I[0])*drn[2] + bj_I[2]*drn[0] + bj_I[4]*drn[1] ); + } + else { + for(int k=0; k<3; k++) { + hij[k] = 0; + } + } + + if(bi.particle_type == 3) { + if(calc_done == false) { + precalc_sep_vec_norm(bi, bj, dr, drn, dr_4, dr_3); + A = -3*dr_4; + calc_done = true; + } + + if(use_J) { + for(int k=0; k<6; k++) { + bi_I[k] = bi.J[k]; + } + } + else { + for(int k=0; k<6; k++) { + bi_I[k] = bi.I[k]; + } + } + + hji[0] = A * ( bi_I[2]*drn[2] + bi_I[1]*drn[1] ); + hji[1] = A * ( (bi_I[3]-bi_I[0])*drn[1] + bi_I[1]*drn[0] + bi_I[4]*drn[2] ); + hji[2] = A * ( (bi_I[5]-bi_I[0])*drn[2] + bi_I[2]*drn[0] + bi_I[4]*drn[1] ); + } + else { + for(int k=0; k<3; k++) { + hji[k] = 0; + } + } + + for(int k=0; k<3; k++) { + hij[k] *= bi.m; + hji[k] *= bj.m; + } +} +void Force::calculate_tidal_h_load(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J, double &dr2, double &dr_3) { + bool calc_done = false; + + array drn; + array bi_I, bj_I; + double A, dr_4; + + if(bj.particle_type == 3) { + precalc_sep_vec_norm_load(bi, bj, dr, drn, dr_4, dr2, dr_3); + A = -3*dr_4; + calc_done = true; + + if(use_J) { + for(int k=0; k<6; k++) { + bj_I[k] = bj.J[k]; + } + } + else { + for(int k=0; k<6; k++) { + bj_I[k] = bj.I[k]; + } + } + + hij[0] = A * ( bj_I[2]*drn[2] + bj_I[1]*drn[1] ); + hij[1] = A * ( (bj_I[3]-bj_I[0])*drn[1] + bj_I[1]*drn[0] + bj_I[4]*drn[2] ); + hij[2] = A * ( (bj_I[5]-bj_I[0])*drn[2] + bj_I[2]*drn[0] + bj_I[4]*drn[1] ); + } + else { + for(int k=0; k<3; k++) { + hij[k] = 0; + } + } + + if(bi.particle_type == 3) { + if(calc_done == false) { + precalc_sep_vec_norm_load(bi, bj, dr, drn, dr_4, dr2, dr_3); + A = -3*dr_4; + calc_done = true; + } + + if(use_J) { + for(int k=0; k<6; k++) { + bi_I[k] = bi.J[k]; + } + } + else { + for(int k=0; k<6; k++) { + bi_I[k] = bi.I[k]; + } + } + + hji[0] = A * ( bi_I[2]*drn[2] + bi_I[1]*drn[1] ); + hji[1] = A * ( (bi_I[3]-bi_I[0])*drn[1] + bi_I[1]*drn[0] + bi_I[4]*drn[2] ); + hji[2] = A * ( (bi_I[5]-bi_I[0])*drn[2] + bi_I[2]*drn[0] + bi_I[4]*drn[1] ); + } + else { + for(int k=0; k<3; k++) { + hji[k] = 0; + } + } + + for(int k=0; k<3; k++) { + hij[k] *= bi.m; + hji[k] *= bj.m; + } +} +void Force::calculate_tidal_h_save(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J, double &dr2, double &dr_3) { + bool calc_done = false; + + array drn; + array bi_I, bj_I; + double A, dr_4; + + if(bi.particle_type > 0 || bj.particle_type > 0) { + precalc_sep_vec_norm_save(bi, bj, dr, drn, dr_4, dr2, dr_3); + A = -3*dr_4; + calc_done = true; + } + + if(bj.particle_type == 3) { + if(calc_done == false) { + precalc_sep_vec_norm_save(bi, bj, dr, drn, dr_4, dr2, dr_3); + A = -3*dr_4; + calc_done = true; + } + + if(use_J) { + for(int k=0; k<6; k++) { + bj_I[k] = bj.J[k]; + } + } + else { + for(int k=0; k<6; k++) { + bj_I[k] = bj.I[k]; + } + } + + hij[0] = A * ( bj_I[2]*drn[2] + bj_I[1]*drn[1] ); + hij[1] = A * ( (bj_I[3]-bj_I[0])*drn[1] + bj_I[1]*drn[0] + bj_I[4]*drn[2] ); + hij[2] = A * ( (bj_I[5]-bj_I[0])*drn[2] + bj_I[2]*drn[0] + bj_I[4]*drn[1] ); + } + else { + for(int k=0; k<3; k++) { + hij[k] = 0; + } + } + + if(bi.particle_type == 3) { + if(calc_done == false) { + precalc_sep_vec_norm_save(bi, bj, dr, drn, dr_4, dr2, dr_3); + A = -3*dr_4; + calc_done = true; + } + + if(use_J) { + for(int k=0; k<6; k++) { + bi_I[k] = bi.J[k]; + } + } + else { + for(int k=0; k<6; k++) { + bi_I[k] = bi.I[k]; + } + } + + hji[0] = A * ( bi_I[2]*drn[2] + bi_I[1]*drn[1] ); + hji[1] = A * ( (bi_I[3]-bi_I[0])*drn[1] + bi_I[1]*drn[0] + bi_I[4]*drn[2] ); + hji[2] = A * ( (bi_I[5]-bi_I[0])*drn[2] + bi_I[2]*drn[0] + bi_I[4]*drn[1] ); + } + else { + for(int k=0; k<3; k++) { + hji[k] = 0; + } + } + + for(int k=0; k<3; k++) { + hij[k] *= bi.m; + hji[k] *= bj.m; + } +} + +// Torque functions + +void Force::calculate_torque(Body &bi, Body &bj, array &dr, array &hij, array &hji) { + if(bi.particle_type == 3) { + bi.T[0] += -dr[1]*hji[2] + dr[2]*hji[1]; + bi.T[1] += -dr[2]*hji[0] + dr[0]*hji[2]; + bi.T[2] += -dr[0]*hji[1] + dr[1]*hji[0]; + } + if(bj.particle_type == 3) { + bj.T[0] += -dr[1]*hij[2] + dr[2]*hij[1]; + bj.T[1] += -dr[2]*hij[0] + dr[0]*hij[2]; + bj.T[2] += -dr[0]*hij[1] + dr[1]*hij[0]; + } +} + +// Inertia tensor functions + +void Force::calculate_deformation_tensor(Body &bi, Body &bj, array &drn, double &dr_3) { + bool calc_done = false; + + double third, Xi, Xj, dr_4; + array Ie_tidal = {}; + array dr = {}; + + if(bi.particle_type == 3 && bj.particle_type > 0) { + third = 1./3; + + Ie_tidal[0] = (drn[0]*drn[0]-third); + Ie_tidal[3] = (drn[1]*drn[1]-third); + Ie_tidal[1] = drn[0]*drn[1]; + Ie_tidal[2] = drn[0]*drn[2]; + Ie_tidal[4] = drn[1]*drn[2]; + + calc_done = true; + + Xi = -bj.m*bi.kf_R5*dr_3; + + for(int k=0; k<5; k++) { + bi.I_e_r[k] += Xi*Ie_tidal[k]; + } + } + + if(bj.particle_type == 3 && bi.particle_type > 0) { + if(calc_done == false) { + third = 1./3; + + Ie_tidal[0] = (drn[0]*drn[0]-third); + Ie_tidal[3] = (drn[1]*drn[1]-third); + Ie_tidal[1] = drn[0]*drn[1]; + Ie_tidal[2] = drn[0]*drn[2]; + Ie_tidal[4] = drn[1]*drn[2]; + + calc_done = true; + } + + Xj = -bi.m*bj.kf_R5*dr_3; + + for(int k=0; k<5; k++) { + bj.I_e_r[k] += Xj*Ie_tidal[k]; + } + } +} + +// Acceleration updaters + +void Force::update_acceleration(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k]; + bj->a[k] += aj[k]; + } + } + } +} + +void Force::update_acceleration_pn(vector &bodies, bool use_vv) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_pn + double dr_1 = dr2*dr_3; + double dr_2 = dr_1*dr_1; + double dr_4 = dr_2*dr_2; + array drn = {}; + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } + + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_pn[k]; + } + } + } +} + +void Force::update_acceleration_tidal(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + } + } +} + +void Force::update_acceleration_col(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k]; + bj->a[k] += aj[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + + +void Force::update_acceleration_pn_col(vector &bodies, bool use_vv) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_pn + double dr_1 = dr2*dr_3; + double dr_2 = dr_1*dr_1; + double dr_4 = dr_2*dr_2; + array drn = {}; + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } + + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_pn[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_tidal_col(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_tidal_pn(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + } + } +} + +void Force::update_acceleration_tidal_pn_col(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_and_torque(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_acceleration_and_torque_pn(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_acceleration_and_torque_col(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + reset_collisions(); + reset_roche(); + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_and_torque_pn_col(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + reset_collisions(); + reset_roche(); + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_and_torque_and_deformation_tensor(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + b->I_e_r.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Tidal deformation + calculate_deformation_tensor(*bi, *bj, drn, dr_3); + } + } +} + +void Force::update_acceleration_and_torque_and_deformation_tensor_col(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + b->I_e_r.fill(0); + } + + reset_collisions(); + reset_roche(); + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Tidal deformation + calculate_deformation_tensor(*bi, *bj, drn, dr_3); + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_and_torque_pn_and_deformation_tensor(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + b->I_e_r.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Tidal deformation + calculate_deformation_tensor(*bi, *bj, drn, dr_3); + } + } +} +void Force::update_acceleration_and_torque_pn_and_deformation_tensor_col(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + b->I_e_r.fill(0); + } + + reset_collisions(); + reset_roche(); + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Tidal deformation + calculate_deformation_tensor(*bi, *bj, drn, dr_3); + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_load(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k]; + bj->a[k] += aj[k]; + } + } + } +} + +void Force::update_acceleration_pn_load(vector &bodies, bool use_vv) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_pn + double dr_1 = dr2*dr_3; + double dr_2 = dr_1*dr_1; + double dr_4 = dr_2*dr_2; + array drn = {}; + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } + + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_pn[k]; + } + } + } +} + +void Force::update_acceleration_tidal_load(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + } + } +} + +void Force::update_acceleration_col_load(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k]; + bj->a[k] += aj[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_pn_col_load(vector &bodies, bool use_vv) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_pn + double dr_1 = dr2*dr_3; + double dr_2 = dr_1*dr_1; + double dr_4 = dr_2*dr_2; + array drn = {}; + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } + + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_pn[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_tidal_col_load(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_tidal_pn_load(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + } + } +} + +void Force::update_acceleration_tidal_pn_col_load(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_and_torque_load(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_acceleration_and_torque_pn_load(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_acceleration_and_torque_col_load(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_and_torque_pn_col_load(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // Load + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // f + array dr = {}; + array ai = {}; + array aj = {}; + + calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_save(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k]; + bj->a[k] += aj[k]; + } + } + } +} + +void Force::update_acceleration_pn_save(vector &bodies, bool use_vv) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_pn + double dr_1 = dr2*dr_3; + double dr_2 = dr_1*dr_1; + double dr_4 = dr_2*dr_2; + array drn = {}; + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } + + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_pn[k]; + } + } + } +} + +void Force::update_acceleration_tidal_save(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + } + } +} + +void Force::update_acceleration_col_save(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k]; + bj->a[k] += aj[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_pn_col_save(vector &bodies, bool use_vv) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_pn + double dr_1 = dr2*dr_3; + double dr_2 = dr_1*dr_1; + double dr_4 = dr_2*dr_2; + array drn = {}; + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } + + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_pn[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_tidal_col_save(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_tidal_pn_save(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + } + } +} + +void Force::update_acceleration_tidal_pn_col_save(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_and_torque_save(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_acceleration_and_torque_pn_save(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_acceleration_and_torque_col_save(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k]; + bj->a[k] += aj[k] + aj_tidal[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_acceleration_and_torque_pn_col_save(vector &bodies, bool use_vv, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->a.fill(0); + b->T.fill(0); + } + + reset_collisions(); + reset_roche(); + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // f + array dr = {}; + double dr2, dr_3; + array ai = {}; + array aj = {}; + + calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // f_tidal + array drn = {}; + double dr_1, dr_2, dr_4, dr_5; + array ai_tidal = {}; + array aj_tidal = {}; + array hij = {}; + array hji = {}; + + calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); + + // f_pn + double dv2; + array dv = {}; + array ai_pn = {}; + array aj_pn = {}; + + calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); + + // Acceleration + for(int k=0; k<3; k++) { + bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; + bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; + } + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + + // Check for collisions + check_for_collisions(*bi, *bj, dr_3, dr2); + + // Check for Roche limit + check_for_roche(*bi, *bj, dr_3, dr2); + } + } +} + +void Force::update_torque(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->T.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // Tidal h function + array dr; + array hij, hji; + + calculate_tidal_h(*bi, *bj, dr, hij, hji, use_J); + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_torque_load(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->T.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + // Tidal h function + array dr; + array hij, hji; + + calculate_tidal_h_load(*bi, *bj, dr, hij, hji, use_J, dr2, dr_3); + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_torque_save(vector &bodies, bool use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->T.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + // Tidal h function + array dr; + array hij, hji; + double dr2, dr_3; + + calculate_tidal_h_save(*bi, *bj, dr, hij, hji, use_J, dr2, dr_3); + + // Save + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + cnt++; + + // Torques + calculate_torque(*bi, *bj, dr, hij, hji); + } + } +} + +void Force::update_tidal_deformation(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->I_e_r.fill(0); + } + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + bool calc_done = false; + + double third, Xi, Xj, dr_4, dr_3; + array Ie_tidal = {}; + array dr = {}; + array drn = {}; + + if(bi->particle_type == 3 && bj->particle_type > 0) { + third = 1./3; + + precalc_sep_vec_norm(*bi, *bj, dr, drn, dr_4, dr_3); + + Ie_tidal[0] = (drn[0]*drn[0]-third); + Ie_tidal[3] = (drn[1]*drn[1]-third); + Ie_tidal[1] = drn[0]*drn[1]; + Ie_tidal[2] = drn[0]*drn[2]; + Ie_tidal[4] = drn[1]*drn[2]; + + calc_done = true; + + Xi = -bj->m*bi->kf_R5*dr_3; + + for(int k=0; k<5; k++) { + bi->I_e_r[k] += Xi*Ie_tidal[k]; + } + } + + if(bj->particle_type == 3 && bi->particle_type > 0) { + if(calc_done == false) { + third = 1./3; + + precalc_sep_vec_norm(*bi, *bj, dr, drn, dr_4, dr_3); + + Ie_tidal[0] = (drn[0]*drn[0]-third); + Ie_tidal[3] = (drn[1]*drn[1]-third); + Ie_tidal[1] = drn[0]*drn[1]; + Ie_tidal[2] = drn[0]*drn[2]; + Ie_tidal[4] = drn[1]*drn[2]; + + calc_done = true; + } + + Xj = -bi->m*bj->kf_R5*dr_3; + + for(int k=0; k<5; k++) { + bj->I_e_r[k] += Xj*Ie_tidal[k]; + } + } + } + } +} + +void Force::update_centrifugal_deformation(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + double w00 = b->w[0]*b->w[0]; + double w11 = b->w[1]*b->w[1]; + double w22 = b->w[2]*b->w[2]; + + double w2 = w00 + w11 + w22; + double w23 = w2/3; + + b->I_e_w[0] = b->kf_R5_3*(w00 - w23); + b->I_e_w[3] = b->kf_R5_3*(w11 - w23); + b->I_e_w[1] = b->kf_R5_3*b->w[0]*b->w[1]; + b->I_e_w[2] = b->kf_R5_3*b->w[0]*b->w[2]; + b->I_e_w[4] = b->kf_R5_3*b->w[1]*b->w[2]; + } + } +} + +void Force::update_equilibrium_tensor(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + for(int i=0; i<5; i++) { + b->I_e[i] = b->I_e_r[i] + b->I_e_w[i]; + } + } + } +} + +void Force::update_equilibrium_tensor_and_memorize(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + for(int i=0; i<5; i++) { + b->I_e_prev[i] = b->I_e[i]; + b->I_e[i] = b->I_e_r[i] + b->I_e_w[i]; + } + } + } +} + +void Force::update_deformation_tensor(vector &bodies, bool use_J) { + if(use_J) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + b->dI_n[0] = 2*b->J_n[2]*b->w[1] - 2*b->J_n[1]*b->w[2] + (b->I_e[0]-b->J_n[0])*b->tau_inv; + b->dI_n[3] = -2*b->J_n[4]*b->w[0] + 2*b->J_n[1]*b->w[2] + (b->I_e[3]-b->J_n[3])*b->tau_inv; + b->dI_n[1] = -b->J_n[2]*b->w[0] + b->J_n[4]*b->w[1] + (b->J_n[0]-b->J_n[3])*b->w[2] + (b->I_e[1]-b->J_n[1])*b->tau_inv; + b->dI_n[2] = b->J_n[1]*b->w[0] - (2*b->J_n[0]+b->J_n[3])*b->w[1] - b->J_n[4]*b->w[2] + (b->I_e[2]-b->J_n[2])*b->tau_inv; + b->dI_n[4] = (b->J_n[0]+2*b->J_n[3])*b->w[0] - b->J_n[1]*b->w[1] + b->J_n[2]*b->w[2] + (b->I_e[4]-b->J_n[4])*b->tau_inv; + } + } + } + else { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + b->dI_n[0] = 2*b->I_n[2]*b->w[1] - 2*b->I_n[1]*b->w[2] + (b->I_e[0]-b->I_n[0])*b->tau_inv; + b->dI_n[3] = -2*b->I_n[4]*b->w[0] + 2*b->I_n[1]*b->w[2] + (b->I_e[3]-b->I_n[3])*b->tau_inv; + b->dI_n[1] = -b->I_n[2]*b->w[0] + b->I_n[4]*b->w[1] + (b->I_n[0]-b->I_n[3])*b->w[2] + (b->I_e[1]-b->I_n[1])*b->tau_inv; + b->dI_n[2] = b->I_n[1]*b->w[0] - (2*b->I_n[0]+b->I_n[3])*b->w[1] - b->I_n[4]*b->w[2] + (b->I_e[2]-b->I_n[2])*b->tau_inv; + b->dI_n[4] = (b->I_n[0]+2*b->I_n[3])*b->w[0] - b->I_n[1]*b->w[1] + b->I_n[2]*b->w[2] + (b->I_e[4]-b->I_n[4])*b->tau_inv; + } + } + } +} + +void Force::update_tidal_deformation_load(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->I_e_r.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + bool calc_done = false; + + double third, Xi, Xj, dr_4; + array Ie_tidal = {}; + array dr = {}; + array drn = {}; + + double dr2 = dr2_vec[cnt]; + double dr_3 = dr_3_vec[cnt]; + cnt++; + + if(bi->particle_type == 3 && bj->particle_type > 0) { + third = 1./3; + + precalc_sep_vec_norm_load(*bi, *bj, dr, drn, dr_4, dr2, dr_3); + + Ie_tidal[0] = (drn[0]*drn[0]-third); + Ie_tidal[3] = (drn[1]*drn[1]-third); + Ie_tidal[1] = drn[0]*drn[1]; + Ie_tidal[2] = drn[0]*drn[2]; + Ie_tidal[4] = drn[1]*drn[2]; + + calc_done = true; + + Xi = -bj->m*bi->kf_R5*dr_3; + + for(int k=0; k<5; k++) { + bi->I_e_r[k] += Xi*Ie_tidal[k]; + } + } + + if(bj->particle_type == 3 && bi->particle_type > 0) { + if(calc_done == false) { + third = 1./3; + + precalc_sep_vec_norm_load(*bi, *bj, dr, drn, dr_4, dr2, dr_3); + + Ie_tidal[0] = (drn[0]*drn[0]-third); + Ie_tidal[3] = (drn[1]*drn[1]-third); + Ie_tidal[1] = drn[0]*drn[1]; + Ie_tidal[2] = drn[0]*drn[2]; + Ie_tidal[4] = drn[1]*drn[2]; + + calc_done = true; + } + + Xj = -bi->m*bj->kf_R5*dr_3; + + for(int k=0; k<5; k++) { + bj->I_e_r[k] += Xj*Ie_tidal[k]; + } + } + } + } +} + +void Force::update_tidal_deformation_save(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->I_e_r.fill(0); + } + + int cnt = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + bool calc_done = false; + + double third, Xi, Xj, dr_4, dr2, dr_3; + array Ie_tidal = {}; + array dr = {}; + array drn = {}; + + if(bi->particle_type == 3 && bj->particle_type > 0) { + third = 1./3; + + precalc_sep_vec_norm_save(*bi, *bj, dr, drn, dr_4, dr2, dr_3); + + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + + Ie_tidal[0] = (drn[0]*drn[0]-third); + Ie_tidal[3] = (drn[1]*drn[1]-third); + Ie_tidal[1] = drn[0]*drn[1]; + Ie_tidal[2] = drn[0]*drn[2]; + Ie_tidal[4] = drn[1]*drn[2]; + + calc_done = true; + + Xi = -bj->m*bi->kf_R5*dr_3; + + for(int k=0; k<5; k++) { + bi->I_e_r[k] += Xi*Ie_tidal[k]; + } + } + + if(bj->particle_type == 3 && bi->particle_type > 0) { + if(calc_done == false) { + third = 1./3; + + precalc_sep_vec_norm_save(*bi, *bj, dr, drn, dr_4, dr2, dr_3); + + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + + Ie_tidal[0] = (drn[0]*drn[0]-third); + Ie_tidal[3] = (drn[1]*drn[1]-third); + Ie_tidal[1] = drn[0]*drn[1]; + Ie_tidal[2] = drn[0]*drn[2]; + Ie_tidal[4] = drn[1]*drn[2]; + + calc_done = true; + } + + Xj = -bi->m*bj->kf_R5*dr_3; + + for(int k=0; k<5; k++) { + bj->I_e_r[k] += Xj*Ie_tidal[k]; + } + } + + if(calc_done == false) { + precalc_sep_vec_norm_save(*bi, *bj, dr, drn, dr_4, dr2, dr_3); + + dr2_vec[cnt] = dr2; + dr_3_vec[cnt] = dr_3; + } + + cnt++; + } + } +} + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Initializer.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Initializer.cpp new file mode 100755 index 0000000000..70bda5546e --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Initializer.cpp @@ -0,0 +1,3112 @@ +#include "Initializer.h" + +// Constructor +Initializer::Initializer() { + set_to_default_values(); +} + +void Initializer::set_to_default_values() { + // Simulation parameters + + to_continue = false; // 0=new simulation, 1=continue simulation + max_cpu_time = 0; // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. + + // Physical model parameters + + tidal_model = 4; // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default) + pn_order = 0; // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn + magnetic_braking = 0; // Magnetic braking. 0=off, 1=on + + collisions = 0; // 0=off, 1=flag, 2=exception, 3=replace + roche_limit = 0; // 0=off, 1=flag, 2=exception + breakup_speed = 0; // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception + + // Unit system + + mass_unit = "[Msun]"; // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] + length_unit = "[au]"; // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] + time_unit = "[yr]"; // Unit of time for 1) t_begin, t_end and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] + speed_unit = "[au/yr]"; // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] + + speed_of_light = 0; // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. + + // Initial condition parameters + + file_ic = "tidymess.ic"; // initial condition file + + orbit_coor = 1; // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian + spin_coor = 2; // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit + + initial_shape = 0; // 0=sphere, 1=equilibrium (future, 2=specified in initial condition) + num_body = 0; // 0=all, num_body+1=number of bodies to include + + // Output parameters + + snapshot_mode = 0; // 0=linear interval (default), 1=logarithmic interval, 2=variable interval + n_snapshot = 100; // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) + + output_dir = "data/"; // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. + overwrite = 1; // overwrite existing files: 0=no, 1=yes + + output_format = 0; // 0=file per body, 1=file per snapshot, 2=single file + output_info = 1; // 0=time-varying quantities, 1=all quantities + output_coor = 0; // 0=cartesian inertial + + output_diag = 0; // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' + output_terminal = 1; // Display progress of simulation in terminal window. 0=no, 1=yes + + // Integration parameters + + t_begin = 0; // begin time in units given by time_unit + t_end = 1e2; // final time in units given by time_unit + + dt_mode = 2; // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt + dt_const = 0.015625; // constant time step in units given by time_unit (only used if dt_mode=0) + eta = 0.0625; // accuracy parameter; timestep multiplication factor, default=0.125 (only used if dt_mode>0) + + n_iter = 1; // Number of iterations to improve reversibility (default=1) + + // Program parameters + + file_par = "tidymess.par"; // Name of setup file with parameters. Set to "none" if no setup file is required. + + toSetOutputDir = false; // Boolean for copying output dir from initial condition file + + Units units; + physical_units = true; // boolean for using physical units or N-body units + + Banner banner; + + // Snapshot variables + + N = 0; + data_ic.clear(); + id.clear(); + name.clear(); +} + +double Initializer::get_Cm() { + return units.Cm; +} +double Initializer::get_Cr() { + return units.Cr; +} +double Initializer::get_Cv() { + return units.Cv; +} +double Initializer::get_Ct() { + return units.Ct; +} + +// Readme +void Initializer::display_version() { + banner.print_header(); +} +void Initializer::display_help() { + cout << " " << endl; + display_readme(); + cout << " " << endl; +} +void Initializer::display_readme() { + display_version(); + + cout << "To run TIDYMESS successfully, please make sure to have " << endl; + cout << " 1) a proper initial condition file (e.g. tidymess.ic), and " << endl; + cout << " 2) a valid setup file (e.g. tidymess.par) and/or command line arguments." << endl; + cout << " " << endl; + cout << "Then run ./tidymess.exe, which by default will look for tidymess.par. " << endl; + cout << "User specified parameter files can be used by ./tidymess.exe -f name_of_par_file." << endl; + cout << "The initial condition file is specified in the setup file, or on the command line." << endl; + cout << " " << endl; + cout << "The default output directory is 'data/', but this can be changed by setting the output_dir parameter." << endl; + cout << "When set to '/' or left blank, then a folder will be created with the name of the initial condition file." << endl; + cout << " " << endl; + cout << "For more info, run ./tidymess.exe with the following flags:" << endl; + cout << "--parameters or -p to see the list of simulation parameters." << endl; + cout << "--ic to see an overview of properties to be assigned to the bodies in the initial condition file." << endl; + cout << "--units or -u to see the list of recognized units in TIDYMESS." << endl; + cout << " " << endl; + cout << "Please see the examples folder for TIDYMESS tutorials." << endl; + cout << endl; +} +void Initializer::display_parameters() { + cout << " " << endl; + cout << "Parameters to be specified in the setup file (e.g. tidymess.par)." << endl; + cout << "They can also be set manually in the command line. In that case, add '--' in front and remove '=' (e.g. --t_begin 0)" << endl; + cout << "If a value is defined in both the setup file and command line, then TIDYMESS adopts the command line value." << endl; + cout << "The values below are the default values. " << endl; + cout << " " << endl; + print_arguments_as_setup_file(); + cout << " " << endl; +} +void Initializer::display_units() { + cout << " " << endl; + cout << "The following units are recognized by TIDYMESS, and should be used in the" << endl; + cout << "parameter setup file (e.g. tidymess.par) and initial condition file (e.g. tidymess.ic)." << endl; + cout << " " << endl; + units.print_units(); + cout << " " << endl; +} +void Initializer::display_ic_args() { + cout << " " << endl; + print_initial_condition_args(); + cout << " " << endl; + cout << "Use the -u or --units flag to see the list of recognized units in TIDYMESS." << endl; + cout << " " << endl; +} + +// Argument parser +void Initializer::parse_arguments(int argc, char* argv[]) { + // Convert command line arguments to strings + vector args(argv+1, argv+argc); + argc = args.size(); + + // Check for support flags + if(argc > 0) { + for(int i=0; i > setup_line = read_file(file_par); + + vector args_f; + int numLine = setup_line.size(); + for(int i=0; i= 3 && setup_line[i][1] == "=") { + args_f.push_back("--"+setup_line[i][0]); + args_f.push_back(setup_line[i][2]); + } + } + int argc_f = args_f.size(); + + bool valid_setup_file_args = validate_setup_file_args(argc_f, args_f); + if(!valid_setup_file_args) { + exit(1); + } + + // Process setup file arguments + process_args(argc_f, args_f); + } + + // Override setup file args with command line args + process_args(argc, args); + + // Extract initial condition file name without extension and paths + string f1 = file_ic; + string f2 = ""; + + int N_str = f1.length(); + for(int k=0; k > data = read_file(file_ic); + + vector var, unit; + int numLine = data.size(); + for(int i=0; i= 2) { + int num_tau = check_var(data, var, unit, numLine, "tau"); + if(num_tau == 0) { + exit(1); + } + else if(num_tau != N) { + cerr << "Missing data in the initial condition table: tau" << endl; + exit(1); + } + } + + if(collisions > 0 || roche_limit > 0 || breakup_speed > 0) { + int num_R = check_var(data, var, unit, numLine, "R"); + if(num_R == 0) { + exit(1); + } + else if(num_R != N) { + cerr << "Missing data in the initial condition table: R" << endl; + exit(1); + } + } + + if(magnetic_braking == 1) { + int num_a_mb = check_var(data, var, unit, numLine, "a_mb"); + if(num_a_mb == 0) { + exit(1); + } + else if(num_a_mb != N) { + cerr << "Missing data in the initial condition table: a_mb" << endl; + exit(1); + } + } + + // Validate Post-Newtonian parameters + if(pn_order > 0) { + if(physical_units) { + speed_of_light = 299792.458; // c = 299792.458 km/s + speed_of_light = units.convert_speed_to_standard(speed_of_light, "[km/s]"); + } + else { + if(speed_of_light == 0) { + speed_of_light = 1e100; + } + } + } + + // Validate units + bool valid_units = validate_units_internal_properties(var, unit); + if(!valid_units) { + exit(1); + } + + if(orbit_coor == 0) { // Cartesian coordinates + valid_units = validate_units_orbital_cartesian(var, unit); + if(!valid_units) { + exit(1); + } + } + else { // Elliptical coordinates + valid_units = validate_units_orbital_elliptical(var, unit); + if(!valid_units) { + exit(1); + } + } + + // If spin properties are specified in the initial conditions, validate them. + // If no spin properties are specified, TIDYMESS assumes no initial spin. + bool valid_spin = validate_initial_condition_spin(data, var, unit, numLine); + if(!valid_spin) { + exit(1); + } + + // Make sure simulation time is not zero + double t_sim = t_end - t_begin; + if(t_sim == 0) { + cerr << "t_begin = " << t_begin << endl; + cerr << "t_end = " << t_end << endl; + cerr << "Please set the end time to a different value than the begin time." << endl; + exit(1); + } + + // Set units of time integration parameters + t_begin = units.convert_time_to_standard(t_begin, time_unit); + t_end = units.convert_time_to_standard(t_end, time_unit); + dt_const = units.convert_time_to_standard(dt_const, time_unit); + + // Process initial conditions and store in data_ic container + data_ic.clear(); + for(int i=0; i dd = {}; + data_ic.push_back(dd); + } + + // Upload internal properties in standard units + for(int i=0; i 0) { + for(int i=0; i= 1+num_body) { + data_ic.erase (data_ic.begin()+N-1-i); + } + } + N = data_ic.size(); + + // move to center + move_to_center(); + } +} +bool Initializer::validate_command_line_args(int argc, vector &args) { + vector arg_validated(argc, false); + + for(int i=0; i 1) { + if(str.at(0) == '-' && str.at(1) == '-') { + str.erase(str.begin()+0, str.begin()+2); + bool isValid = check_valid_argument(str); + if(!isValid) { + cerr << " " << endl; + cerr << "Unrecognized command line argument: " << args[i] << endl; + cerr << " " << endl; + return false; + } + arg_validated[i] = true; + + if(i+1 < argc) { + string str_val = args[i+1]; + isValid = check_valid_value(str, str_val); + if(!isValid) { + cerr << " " << endl; + cerr << "Invalid command line value: " << args[i] << " " << args[i+1] << endl; + cerr << " " << endl; + return false; + } + arg_validated[i+1] = true; + } + else { + if(str == "output_dir") { + ; + } + else { + cerr << " " << endl; + cerr << "Please specify a value after: " << args[i] << endl; + cerr << " " << endl; + return false; + } + } + } + else if(str == "-f") { + str.erase(str.begin()+0, str.begin()+1); + bool isValid = check_valid_argument(str); + if(!isValid) { + cerr << " " << endl; + cerr << "Unrecognized command line argument: " << args[i] << endl; + cerr << " " << endl; + return false; + } + arg_validated[i] = true; + + if(i+1 < argc) { + string str_val = args[i+1]; + isValid = check_valid_value(str, str_val); + if(!isValid) { + cerr << " " << endl; + cerr << "Invalid command line value: " << args[i] << " " << args[i+1] << endl; + cerr << " " << endl; + return false; + } + arg_validated[i+1] = true; + } + else { + cerr << " " << endl; + cerr << "Please specify a value after: " << args[i] << endl; + cerr << " " << endl; + return false; + } + } + } + } + + for(int i=0; i &args) { + vector arg_validated(argc, false); + + bool ignoring = false; + + for(int i=0; i 1) { + if(str.at(0) == '-' && str.at(1) == '-') { + str.erase(str.begin()+0, str.begin()+2); + bool isValid = check_valid_argument(str); + if(!isValid) { + cerr << " " << endl; + cerr << "Warning: ignoring line in parameter setup file starting with: " << str << endl; + ignoring = true; + } + else { + if(i+1 < argc) { + string str_val = args[i+1]; + isValid = check_valid_value(str, str_val); + if(!isValid) { + cerr << " " << endl; + cerr << "Invalid value in parameter setup file: " << args[i] << " " << args[i+1] << endl; + cerr << " " << endl; + return false; + } + arg_validated[i+1] = true; + } + else { + if(str == "output_dir") { + ; + } + else { + cerr << " " << endl; + cerr << "Please specify a value after: " << args[i] << endl; + cerr << " " << endl; + return false; + } + } + + } + arg_validated[i] = true; + } + } + } + + if(ignoring) cerr << " " << endl; + + return true; +} +bool Initializer::check_valid_argument(string &str) { + if(str == "to_continue") { + return true; + } + else if(str == "max_cpu_time") { + return true; + } + else if(str == "file_par" || str == "f") { + return true; + } + else if(str == "file_ic") { + return true; + } + else if(str == "orbit_coor") { + return true; + } + else if(str == "num_body") { + return true; + } + else if(str == "output_format") { + return true; + } + else if(str == "output_info") { + return true; + } + else if(str == "output_coor") { + return true; + } + else if(str == "output_dir") { + return true; + } + else if(str == "overwrite") { + return true; + } + else if(str == "output_diag") { + return true; + } + else if(str == "output_terminal") { + return true; + } + else if(str == "mass_unit") { + return true; + } + else if(str == "length_unit") { + return true; + } + else if(str == "time_unit") { + return true; + } + else if(str == "speed_unit") { + return true; + } + else if(str == "t_begin") { + return true; + } + else if(str == "t_end") { + return true; + } + else if(str == "dt_mode") { + return true; + } + else if(str == "dt_const") { + return true; + } + else if(str == "eta") { + return true; + } + else if(str == "snapshot_mode") { + return true; + } + else if(str == "n_snapshot") { + return true; + } + else if(str == "tidal_model") { + return true; + } + else if(str == "initial_shape") { + return true; + } + else if(str == "spin_coor") { + return true; + } + else if(str == "pn_order") { + return true; + } + else if(str == "speed_of_light") { + return true; + } + else if(str == "B_braking") { + return true; + } + else if(str == "collisions") { + return true; + } + else if(str == "roche_limit") { + return true; + } + else if(str == "breakup_speed") { + return true; + } + else if(str == "n_iter") { + return true; + } + return false; +} +bool Initializer::check_valid_value(string &str, string &str_val) { + if(str == "to_continue") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "max_cpu_time") { + try { + size_t offset = 0; + double t = stod(str_val, &offset); + if(offset == str_val.length()) { + if(t >= 0) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "file_par" || str == "f") { + //string f = str_val; + //if(f == "none" || f == "None") return true; + //else { + // bool f_exist = check_file_exists(f); + // if(f_exist) return true; + // else { + //cerr << "Cannot open " << f << "!" << endl; + //return false; + // } + //} + return true; + } + else if(str == "file_ic") { + string f = str_val; + //bool f_exist = check_file_exists(f); + //if(f_exist) return true; + //else { + //cerr << "Cannot open " << f << "!" << endl; + //return false; + //} + return true; + } + else if(str == "orbit_coor") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "num_body") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + if(num >= 0) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "output_format") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "output_info") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "output_coor") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "output_dir") { + return true; + } + else if(str == "overwrite") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "output_diag") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "output_terminal") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "mass_unit") { + string u = str_val; + bool valid_u = units.validate_mass_unit(u); + if(valid_u) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "length_unit") { + string u = str_val; + bool valid_u = units.validate_length_unit(u); + if(valid_u) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "time_unit") { + string u = str_val; + bool valid_u = units.validate_time_unit(u); + if(valid_u) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "speed_unit") { + string u = str_val; + bool valid_u = units.validate_speed_unit(u); + if(valid_u) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "t_begin") { + try { + size_t offset = 0; + double t = stod(str_val, &offset); + if(offset == str_val.length()) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "t_end") { + try { + size_t offset = 0; + double t = stod(str_val, &offset); + if(offset == str_val.length()) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "dt_mode") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "dt_const") { + try { + size_t offset = 0; + double t = stod(str_val, &offset); + if(offset == str_val.length()) { + if(t > 0) return true; + else { + if(dt_mode > 0) return true; + else cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "eta") { + try { + size_t offset = 0; + double t = stod(str_val, &offset); + if(offset == str_val.length()) { + if(t > 0) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "snapshot_mode") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "n_snapshot") { + try { + size_t offset = 0; + + double numd = stod(str_val, &offset); + int num = (int)numd; + + if(offset == str_val.length()) { + if(num > 0) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "tidal_model") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + case 3: + return true; + case 4: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "initial_shape") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "spin_coor") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "pn_order") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + case 25: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "speed_of_light") { + try { + size_t offset = 0; + double t = stod(str_val, &offset); + if(offset == str_val.length()) { + if(t >= 0) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + + } + else if(str == "B_braking") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "collisions") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + case 3: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "roche_limit") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "breakup_speed") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + switch(num) { + case 0: + return true; + case 1: + return true; + case 2: + return true; + default: + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else if(str == "n_iter") { + try { + size_t offset = 0; + int num = stoi(str_val, &offset); + if(offset == str_val.length()) { + if(num >= 0) return true; + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + else { + cerr << "Please specify a valid value after: " << str << endl; + } + } + catch(exception &e) { + cerr << "Please specify a valid value after: " << str << endl; + } + } + + cerr << "Type \"./tidymess.exe -p\" or \"./tidymess.exe --parameters\" for an overview of input parameters and values" << endl; + return false; +} +void Initializer::process_args(int argc, vector &args) { + for(int i=0; i 1) { + if(str.at(0) == '-' && str.at(1) == '-') { + str.erase(str.begin()+0, str.begin()+2); + if(str == "to_continue") { + to_continue = stoi(args[i+1]); + } + else if(str == "max_cpu_time") { + max_cpu_time = stod(args[i+1]); + } + else if(str == "file_ic") { + file_ic = args[i+1]; + } + else if(str == "orbit_coor") { + orbit_coor = stoi(args[i+1]); + } + else if(str == "num_body") { + num_body = stoi(args[i+1]); + } + else if(str == "output_format") { + output_format = stoi(args[i+1]); + } + else if(str == "output_info") { + output_info = stoi(args[i+1]); + } + else if(str == "output_coor") { + output_coor = stoi(args[i+1]); + } + else if(str == "output_dir") { + if(i+1 < argc) { + string dir = args[i+1]; + + if(dir == "/" || dir == "//") { + output_dir = ""; + toSetOutputDir = true; + } + else if(dir.at(0) == '-') { + output_dir = ""; + toSetOutputDir = true; + } + else { + output_dir = dir; + toSetOutputDir = false; + } + } + else { + output_dir = ""; + toSetOutputDir = true; + } + } + else if(str == "overwrite") { + overwrite = stoi(args[i+1]); + } + else if(str == "output_diag") { + output_diag = stoi(args[i+1]); + } + else if(str == "output_terminal") { + output_terminal = stoi(args[i+1]); + } + else if(str == "mass_unit") { + mass_unit = args[i+1]; + } + else if(str == "length_unit") { + length_unit = args[i+1]; + } + else if(str == "time_unit") { + time_unit = args[i+1]; + } + else if(str == "speed_unit") { + speed_unit = args[i+1]; + } + else if(str == "t_begin") { + t_begin = stod(args[i+1]); + } + else if(str == "t_end") { + t_end = stod(args[i+1]); + } + else if(str == "dt_mode") { + dt_mode = stoi(args[i+1]); + } + else if(str == "dt_const") { + dt_const = stod(args[i+1]); + } + else if(str == "eta") { + eta = stod(args[i+1]); + } + else if(str == "snapshot_mode") { + snapshot_mode = stoi(args[i+1]); + } + else if(str == "n_snapshot") { + double numd = stod(args[i+1]); + int num = (int)numd; + n_snapshot = num; + } + else if(str == "tidal_model") { + tidal_model = stoi(args[i+1]); + } + else if(str == "initial_shape") { + initial_shape = stoi(args[i+1]); + } + else if(str == "spin_coor") { + spin_coor = stoi(args[i+1]); + } + else if(str == "pn_order") { + pn_order = stoi(args[i+1]); + } + else if(str == "speed_of_light") { + speed_of_light = stod(args[i+1]); + } + else if(str == "B_braking") { + magnetic_braking = stoi(args[i+1]); + } + else if(str == "collisions") { + collisions = stoi(args[i+1]); + } + else if(str == "roche_limit") { + roche_limit = stoi(args[i+1]); + } + else if(str == "breakup_speed") { + breakup_speed = stoi(args[i+1]); + } + else if(str == "n_iter") { + n_iter = stoi(args[i+1]); + } + } + } + } +} + +void Initializer::print_arguments_as_setup_file() { + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "// Simulation parameters" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "" << endl; + cout << "to_continue\t= " << to_continue << "\t\t// 0=new simulation, 1=continue simulation" << endl; + cout << "max_cpu_time\t= " << max_cpu_time << "\t\t// Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit." << endl; + cout << "" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "// Physical model parameters" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "" << endl; + cout << "tidal_model\t= " << tidal_model << "\t\t// 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default)" << endl; + cout << "pn_order\t= " << pn_order << "\t\t// Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn" << endl; + cout << "B_braking\t= " << magnetic_braking << "\t\t// Magnetic braking. 0=off, 1=on" << endl; + cout << "" << endl; + cout << "collisions\t= " << collisions << "\t\t// 0=off, 1=flag, 2=exception, 3=replace" << endl; + cout << "roche_limit\t= " << roche_limit << "\t\t// 0=off, 1=flag, 2=exception" << endl; + cout << "breakup_speed\t= " << breakup_speed << "\t\t// Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception" << endl; + cout << "" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "// Unit system" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "" << endl; + cout << "mass_unit\t= " << mass_unit << "\t// Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun]" << endl; + cout << "length_unit\t= " << length_unit << "\t\t// Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc]" << endl; + cout << "time_unit\t= " << time_unit << "\t\t// Unit of time for 1) t_begin, t_end and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr]" << endl; + cout << "speed_unit\t= " << speed_unit << "\t// Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr]" << endl; + cout << "" << endl; + cout << "speed_of_light\t= " << speed_of_light << "\t\t// Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c." << endl; + cout << "" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "// Initial condition parameters" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "" << endl; + cout << "file_ic\t = " << file_ic << "\t// initial condition file" << endl; + cout << "" << endl; + cout << "orbit_coor\t= " << orbit_coor << "\t\t// 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian" << endl; + cout << "spin_coor\t= " << spin_coor << "\t\t// 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit" << endl; + cout << "" << endl; + cout << "initial_shape\t= " << initial_shape << "\t\t// 0=sphere, 1=equilibrium" << endl; + cout << "num_body\t= " << num_body << "\t\t// 0=all, num_body+1=number of bodies to include" << endl; + cout << "" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "// Output parameters" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "" << endl; + cout << "snapshot_mode\t = " << snapshot_mode << "\t\t// 0=linear interval (default), 1=logarithmic interval, 2=variable interval" << endl; + cout << "n_snapshot\t = " << n_snapshot << "\t\t// Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable)" << endl; + cout << "" << endl; + cout << "output_dir\t= " << output_dir << "\t\t// Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension." << endl; + cout << "overwrite\t= " << overwrite << "\t\t// overwrite existing files: 0=no, 1=yes" << endl; + cout << "" << endl; + cout << "output_format\t= " << output_format << "\t\t// 0=file per body, 1=file per snapshot, 2=single file" << endl; + cout << "output_info\t= " << output_info << "\t\t// 0=time-varying quantities, 1=all quantities" << endl; + cout << "output_coor\t= " << output_coor << "\t\t// 0=cartesian inertial" << endl; + cout << "" << endl; + cout << "output_diag\t= " << output_diag << "\t\t// 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag'" << endl; + cout << "output_terminal\t= " << output_terminal << "\t\t// Display progress of simulation in terminal window. 0=no, 1=yes" << endl; + cout << "" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "// Integration parameters" << endl; + cout << "//--------------------------------------------------------------------------------------------------" << endl; + cout << "" << endl; + cout << "t_begin\t = " << t_begin << "\t\t// begin time in units given by time_unit" << endl; + cout << "t_end\t\t= " << t_end << "\t\t// final time in units given by time_unit" << endl; + cout << "" << endl; + cout << "dt_mode\t\t= " << dt_mode << "\t\t// 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt" << endl; + cout << "dt_const\t= " << dt_const << "\t// constant time step in units given by time_unit (only used if dt_mode=0)" << endl; + cout << "eta\t\t= " << eta << "\t\t// accuracy parameter; timestep multiplication factor, default=0.125 (only used if dt_mode>0)" << endl; + cout << "" << endl; + cout << "n_iter\t\t= " << n_iter << "\t\t// Number of iterations to improve reversibility (default=1)" << endl; +} +void Initializer::print_arguments_as_setup_file(ofstream &fo) { + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "// Simulation parameters" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "" << endl; + fo << "to_continue\t= " << to_continue << "\t\t// 0=new simulation, 1=continue simulation" << endl; + fo << "max_cpu_time\t= " << max_cpu_time << "\t\t// Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit." << endl; + fo << "" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "// Physical model parameters" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "" << endl; + fo << "tidal_model\t= " << tidal_model << "\t\t// 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default)" << endl; + fo << "pn_order\t= " << pn_order << "\t\t// Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn" << endl; + fo << "B_braking\t= " << magnetic_braking << "\t\t// Magnetic braking. 0=off, 1=on" << endl; + fo << "" << endl; + fo << "collisions\t= " << collisions << "\t\t// 0=off, 1=flag, 2=exception, 3=replace" << endl; + fo << "roche_limit\t= " << roche_limit << "\t\t// 0=off, 1=flag, 2=exception" << endl; + fo << "breakup_speed\t= " << breakup_speed << "\t\t// Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception" << endl; + fo << "" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "// Unit system" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "" << endl; + fo << "mass_unit\t= " << mass_unit << "\t// Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun]" << endl; + fo << "length_unit\t= " << length_unit << "\t\t// Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc]" << endl; + fo << "time_unit\t= " << time_unit << "\t\t// Unit of time for 1) t_begin, t_end and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr]" << endl; + fo << "speed_unit\t= " << speed_unit << "\t// Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr]" << endl; + fo << "" << endl; + fo << "speed_of_light\t= " << speed_of_light << "\t\t// Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c." << endl; + fo << "" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "// Initial condition parameters" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "" << endl; + fo << "file_ic\t = " << file_ic << "\t// initial condition file" << endl; + fo << "" << endl; + fo << "orbit_coor\t= " << orbit_coor << "\t\t// 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian" << endl; + fo << "spin_coor\t= " << spin_coor << "\t\t// 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit" << endl; + fo << "" << endl; + fo << "initial_shape\t= " << initial_shape << "\t\t// 0=sphere, 1=equilibrium" << endl; + fo << "num_body\t= " << num_body << "\t\t// 0=all, num_body+1=number of bodies to include" << endl; + fo << "" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "// Output parameters" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "" << endl; + fo << "snapshot_mode\t = " << snapshot_mode << "\t\t// 0=linear interval (default), 1=logarithmic interval, 2=variable interval" << endl; + fo << "n_snapshot\t = " << n_snapshot << "\t\t// Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable)" << endl; + fo << "" << endl; + fo << "output_dir\t= " << output_dir << "\t\t// Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension." << endl; + fo << "overwrite\t= " << overwrite << "\t\t// overwrite existing files: 0=no, 1=yes" << endl; + fo << "" << endl; + fo << "output_format\t= " << output_format << "\t\t// 0=file per body, 1=file per snapshot, 2=single file" << endl; + fo << "output_info\t= " << output_info << "\t\t// 0=time-varying quantities, 1=all quantities" << endl; + fo << "output_coor\t= " << output_coor << "\t\t// 0=cartesian inertial" << endl; + fo << "" << endl; + fo << "output_diag\t= " << output_diag << "\t\t// 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag'" << endl; + fo << "output_terminal\t= " << output_terminal << "\t\t// Display progress of simulation in terminal window. 0=no, 1=yes" << endl; + fo << "" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "// Integration parameters" << endl; + fo << "//--------------------------------------------------------------------------------------------------" << endl; + fo << "" << endl; + fo << "t_begin\t = " << t_begin << "\t\t// begin time in units given by time_unit" << endl; + fo << "t_end\t\t= " << t_end << "\t\t// final time in units given by time_unit" << endl; + fo << "" << endl; + fo << "dt_mode\t\t= " << dt_mode << "\t\t// 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt" << endl; + fo << "dt_const\t= " << dt_const << "\t// constant time step in units given by time_unit (only used if dt_mode=0)" << endl; + fo << "eta\t\t= " << eta << "\t\t// accuracy parameter; timestep multiplication factor, default=0.125 (only used if dt_mode>0)" << endl; + fo << "" << endl; + fo << "n_iter\t\t= " << n_iter << "\t\t// Number of iterations to improve reversibility (default=1)" << endl; +} +void Initializer::print_initial_condition_args() { + cout << "Overview of properties to be assigned to the bodies in the initial condition file:" << endl; + cout << " " << endl; + cout << "- Internal properties" << endl; + cout << "mass = mass" << endl; + cout << "R = radius" << endl; + cout << "xi = moment of inertia factor" << endl; + cout << " " << endl; + cout << "- Tidal response parameters" << endl; + cout << "kf = Fluid Love number for potential" << endl; + cout << "tau = Fluid relaxation time" << endl; + cout << " " << endl; + cout << "- Other physics" << endl; + cout << "a_mb = magnetic braking coefficient" << endl; + cout << " " << endl; + cout << "- Spin coordinates" << endl; + cout << "lod = length of day" << endl; + cout << "obl = obliquity" << endl; + cout << "psi = precession angle" << endl; + cout << " " << endl; + cout << "- Orbital coordinates: Cartesian " << endl; + cout << "x = position along x-axis" << endl; + cout << "y = position along y-axis " << endl; + cout << "z = position along z-axis " << endl; + cout << "vx = velocity along x-axis " << endl; + cout << "vy = velocity along y-axis " << endl; + cout << "vz = velocity along z-axis " << endl; + cout << " " << endl; + cout << "- Orbital coordinates: Elliptical " << endl; + cout << "a = semimajor axis" << endl; + cout << "e = eccentricity" << endl; + cout << "I = inclination" << endl; + cout << "O = longitude of ascending node" << endl; + cout << "w = argument of pericenter" << endl; + cout << "M = mean anomaly" << endl; +} + +int Initializer::check_var(vector< vector > &data, vector &var, vector &unit, int numLine, string x) { + int num_x = 0; + bool found_x = false; + for(int i=0; i > &data, vector &var, vector &unit, int numLine) { + int num_x = check_var(data, var, unit, numLine, "x"); + if(num_x == 0) { + return false; + } + else if(num_x != N) { + cerr << "Inconsistency in the initial condition table: x" << endl; + return false; + } + + int num_y = check_var(data, var, unit, numLine, "y"); + if(num_y == 0) { + return false; + } + else if(num_y != N) { + cerr << "Inconsistency in the initial condition table: y" << endl; + return false; + } + + int num_z = check_var(data, var, unit, numLine, "z"); + if(num_z == 0) { + return false; + } + else if(num_z != N) { + cerr << "Inconsistency in the initial condition table: z" << endl; + return false; + } + + int num_vx = check_var(data, var, unit, numLine, "vx"); + if(num_vx == 0) { + return false; + } + else if(num_vx != N) { + cerr << "Inconsistency in the initial condition table: vx" << endl; + return false; + } + + int num_vy = check_var(data, var, unit, numLine, "vy"); + if(num_vy == 0) { + return false; + } + else if(num_vy != N) { + cerr << "Inconsistency in the initial condition table: vy" << endl; + return false; + } + + int num_vz = check_var(data, var, unit, numLine, "vz"); + if(num_vz == 0) { + return false; + } + else if(num_vz != N) { + cerr << "Inconsistency in the initial condition table: vz" << endl; + return false; + } + + return true; +} +bool Initializer::validate_initial_condition_elliptical(vector< vector > &data, vector &var, vector &unit, int numLine) { + int num_a = check_var(data, var, unit, numLine, "a"); + if(num_a == 0) { + return false; + } + else if(num_a != N-1) { + cerr << "Inconsistency in the initial condition table: a" << endl; + return false; + } + + int num_e = check_var(data, var, unit, numLine, "e"); + if(num_e == 0) { + return false; + } + else if(num_e != N-1) { + cerr << "Inconsistency in the initial condition table: e" << endl; + return false; + } + + int num_I = check_var(data, var, unit, numLine, "I"); + if(num_I == 0) { + return false; + } + else if(num_I != N-1) { + cerr << "Inconsistency in the initial condition table: I" << endl; + return false; + } + + int num_O = check_var(data, var, unit, numLine, "O"); + if(num_O == 0) { + return false; + } + else if(num_O != N-1) { + cerr << "Inconsistency in the initial condition table: O" << endl; + return false; + } + + int num_w = check_var(data, var, unit, numLine, "w"); + if(num_w == 0) { + return false; + } + else if(num_w != N-1) { + cerr << "Inconsistency in the initial condition table: w" << endl; + return false; + } + + int num_M = check_var(data, var, unit, numLine, "M"); + if(num_M == 0) { + return false; + } + else if(num_M != N-1) { + cerr << "Inconsistency in the initial condition table: M" << endl; + return false; + } + + return true; +} +bool Initializer::validate_initial_condition_spin(vector< vector > &data, vector &var, vector &unit, int numLine) { + int num_lod = 0; + bool found_lod = false; + for(int i=0; i &var, vector &unit) { + int numLine = var.size(); + + for(int i=0; i &var, vector &unit) { + int numLine = var.size(); + + for(int i=0; i &var, vector &unit) { + int numLine = var.size(); + + vector rs; + rs.push_back("x"); + rs.push_back("y"); + rs.push_back("z"); + + for(int k=0; k<3; k++) { + for(int i=0; i vs; + vs.push_back("vx"); + vs.push_back("vy"); + vs.push_back("vz"); + + for(int k=0; k<3; k++) { + for(int i=0; i &var, vector &unit) { + int numLine = var.size(); + + for(int i=0; i angles; + angles.push_back("I"); + angles.push_back("O"); + angles.push_back("w"); + angles.push_back("M"); + + for(int k=0; k<4; k++) { + for(int i=0; i &var, vector &unit) { + int numLine = var.size(); + + for(int i=0; i angles; + angles.push_back("obl"); + angles.push_back("psi"); + + for(int k=0; k<2; k++) { + for(int i=0; i Initializer::get_words(string line) { + istringstream iss(line); + vector results; + copy(istream_iterator(iss), istream_iterator(), back_inserter(results)); + return results; +} +vector< vector > Initializer::read_file(string file_in) { + // Check if regular file + bool file_exist = check_file_exists(file_in); + if(!file_exist) { + exit(1); + } + + // Read file + vector< vector > data; + + ifstream str; + str.open(file_in.c_str()); + if(!str) { + cerr << "Cannot open " << file_in << "!" << endl; + exit(1); + } + else { + string line; + while(!str.eof()) { + getline(str, line); + vector words = get_words(line); + if(words.size() > 0) { + data.push_back(words); + } + } + str.close(); + } + + return data; +} + +// Coordinate transformation functions + +vector Initializer::rotZrotX(double anglez, double anglex, vector vin) { + double sz = sin(anglez); + double sx = sin(anglex); + double cz = cos(anglez); + double cx = cos(anglex); + + double rin = cx*vin[1]-sx*vin[2]; + + vector vec(3); + vec[0] = cz*vin[0]-sz*rin; + vec[1] = sz*vin[0]+cz*rin; + vec[2] = sx*vin[1]+cx*vin[2]; + + return vec; +} + +void Initializer::convert_spin_vectors_to_inertial() { + for(int i=0; i w_vec(3); + w_vec[0] = 0; + w_vec[1] = 0; + w_vec[2] = wmag; + + w_vec = rotZrotX(psi, obl, w_vec); + + data_ic[i][6] = w_vec[0]; + data_ic[i][7] = w_vec[1]; + data_ic[i][8] = w_vec[2]; + } + } +} +void Initializer::convert_spin_vectors_from_elliptical_body0abs() { + double P = data_ic[0][6]; + double obl = data_ic[0][7]; + double psi = data_ic[0][8]; + + if(P == 0) { + data_ic[0][6] = 0.; + data_ic[0][7] = 0.; + data_ic[0][8] = 0.; + } + else if(P < 0) { + cerr << " " << endl; + cerr << "Negative length of day detected: " << data_ic[0][6] << endl; + cerr << " " << endl; + exit(1); + } + else { + double wmag = 2*M_PI/P; + + vector spinvec(3); + spinvec[0] = 0; + spinvec[1] = 0; + spinvec[2] = wmag; + + vector spinvec3 = rotZrotX(psi, obl, spinvec); + + for(int k=0; k<3; k++) { + data_ic[0][6+k] = spinvec3[k]; + } + } + + for(int i=1; i spinvec(3); + spinvec[0] = 0; + spinvec[1] = 0; + spinvec[2] = wmag; + + double inc = data_ic[i][11]; + double O = data_ic[i][12]; + + vector spinvec2 = rotZrotX(psi-O, obl, spinvec); + vector spinvec3 = rotZrotX(O, inc, spinvec2); + + for(int k=0; k<3; k++) { + data_ic[i][6+k] = spinvec3[k]; + } + } + } +} +void Initializer::convert_spin_vectors_from_elliptical_body0rel() { + double P = data_ic[0][6]; + double obl = data_ic[0][7]; + double psi = data_ic[0][8]; + + double inc = data_ic[1][11]; + double O = data_ic[1][12]; + + if(P == 0) { + data_ic[0][6] = 0.; + data_ic[0][7] = 0.; + data_ic[0][8] = 0.; + } + else if(P < 0) { + cerr << " " << endl; + cerr << "Negative length of day detected: " << data_ic[0][6] << endl; + cerr << " " << endl; + exit(1); + } + else { + double wmag = 2*M_PI/P; + + vector spinvec(3); + spinvec[0] = 0; + spinvec[1] = 0; + spinvec[2] = wmag; + + vector spinvec2 = rotZrotX(psi-O, obl, spinvec); + vector spinvec3 = rotZrotX(O, inc, spinvec2); + + for(int k=0; k<3; k++) { + data_ic[0][6+k] = spinvec3[k]; + } + } + + for(int i=1; i spinvec(3); + spinvec[0] = 0; + spinvec[1] = 0; + spinvec[2] = wmag; + + inc = data_ic[i][11]; + O = data_ic[i][12]; + + vector spinvec2 = rotZrotX(psi-O, obl, spinvec); + vector spinvec3 = rotZrotX(O, inc, spinvec2); + + for(int k=0; k<3; k++) { + data_ic[i][6+k] = spinvec3[k]; + } + } + } +} + +double Initializer::mean_to_eccentric_anomaly(double MA, double e) { + double delta = 1e-14; + + int maxIter = 10000; + int cntIter = 0; + + double EA = MA; + double diff = 1.; + + if(e > 0.4) { + while(diff > delta && cntIter < maxIter) { + double EA0 = EA; + EA = EA0 + (MA + e*sin(EA0) - EA0) / (1. - e*cos(EA0)); + diff = abs(EA-EA0); + cntIter += 1; + } + } + else { + while(diff > delta && cntIter < maxIter) { + double EA0 = EA; + EA = MA + e*sin(EA0); + diff = abs(EA-EA0); + cntIter += 1; + } + } + + return EA; +} +double Initializer::eccentric_to_true_anomaly(double EA, double e) { + double TA = 2. * atan2(sqrt(1.+e)*sin(EA/2.), sqrt(1.-e)*cos(EA/2.)); + return TA; +} +double Initializer::convert_mean_to_true_anomaly(double MA, double ecc) { + double EA = mean_to_eccentric_anomaly(MA, ecc); + double TA = eccentric_to_true_anomaly(EA, ecc); + if(TA < 0) TA += 2*M_PI; + else if(TA >= 2*M_PI) TA -= 2*M_PI; + return TA; +} + +// This implementation is based on orbital_elements.py from the +// AMUSE software framework ( https://amusecode.github.io/ ). +vector Initializer::get_relative_posvel_from_orbital_elements(double m1, double m2, double a, double ecc, double inc, double O, double w, double TA, double G) { + double cos_TA = cos(TA); + double sin_TA = sin(TA); + + double cos_inc = cos(inc); + double sin_inc = sin(inc); + + double cos_w = cos(w); + double sin_w = sin(w); + + double cos_O = cos(O); + double sin_O = sin(O); + + // alpha is a unit vector directed along the line of node + vector alpha(3); + alpha[0] = ( cos_O*cos_w - sin_O*sin_w*cos_inc ); + alpha[1] = ( sin_O*cos_w + cos_O*sin_w*cos_inc ); + alpha[2] = sin_w*sin_inc; + + // beta is a unit vector perpendicular to alpha and the orbital angular momentum vector + vector beta(3); + beta[0] = ( - cos_O*sin_w - sin_O*cos_w*cos_inc ); + beta[1] = ( - sin_O*sin_w + cos_O*cos_w*cos_inc ); + beta[2] = cos_w*sin_inc; + + // Relative position and velocity + double r = a*(1. - ecc*ecc) / (1. + ecc*cos_TA); + + vector dr(3); + dr[0] = r*cos_TA*alpha[0] + r*sin_TA*beta[0]; + dr[1] = r*cos_TA*alpha[1] + r*sin_TA*beta[1]; + dr[2] = r*cos_TA*alpha[2] + r*sin_TA*beta[2]; + + double mu = G*(m1 + m2); + + double dv_aux = 0; + if(a != 0) { + dv_aux = sqrt( mu / (a*(1. - ecc*ecc)) ); + } + + vector dv(3); + dv[0] = -1. * dv_aux * sin_TA * alpha[0] + dv_aux*(ecc + cos_TA)*beta[0]; + dv[1] = -1. * dv_aux * sin_TA * alpha[1] + dv_aux*(ecc + cos_TA)*beta[1]; + dv[2] = -1. * dv_aux * sin_TA * alpha[2] + dv_aux*(ecc + cos_TA)*beta[2]; + + vector posvel(6); + posvel[0] = dr[0]; + posvel[1] = dr[1]; + posvel[2] = dr[2]; + posvel[3] = dv[0]; + posvel[4] = dv[1]; + posvel[5] = dv[2]; + + return posvel; +} +void Initializer::move_to_center() { + double M = 0; + vector rcm(3,0); + vector vcm(3,0); + for(int i=0; i rcm(3,0); + vector vcm(3,0); + for(int i=0; i posvel = get_relative_posvel_from_orbital_elements(data_ic[0][0], data_ic[i][0], data_ic[i][9], data_ic[i][10], data_ic[i][11], data_ic[i][12], data_ic[i][13], data_ic[i][14], G); + for(int k=0; k<3; k++) { + data_ic[i][9+k] = posvel[k]; + data_ic[i][12+k] = posvel[3+k]; + } + } + + move_to_center(); +} +void Initializer::convert_jacobian_elements_to_cartesian_coordinates() { + double G = 1; // N-body units + if(physical_units) G = units.G_standard; // Gravitational constant in units of MSun, AU and yr + + for(int k=0; k<3; k++) { + data_ic[0][9+k] = 0; + data_ic[0][12+k] = 0; + } + + double TA = convert_mean_to_true_anomaly(data_ic[1][14], data_ic[1][10]); + data_ic[1][14] = TA; + + vector posvel = get_relative_posvel_from_orbital_elements(data_ic[0][0], data_ic[1][0], data_ic[1][9], data_ic[1][10], data_ic[1][11], data_ic[1][12], data_ic[1][13], data_ic[1][14], G); + for(int k=0; k<3; k++) { + data_ic[1][9+k] = posvel[k]; + data_ic[1][12+k] = posvel[3+k]; + } + + int Nenc = 2; + double Menc = data_ic[0][0] + data_ic[1][0]; + move_to_center(Nenc); + + for(int i=2; i posvel = get_relative_posvel_from_orbital_elements(Menc, data_ic[i][0], data_ic[i][9], data_ic[i][10], data_ic[i][11], data_ic[i][12], data_ic[i][13], data_ic[i][14], G); + for(int k=0; k<3; k++) { + data_ic[i][9+k] = posvel[k]; + data_ic[i][12+k] = posvel[3+k]; + } + + Nenc++; + Menc += data_ic[i][0]; + move_to_center(Nenc); + } + + move_to_center(); +} + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Orbit.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Orbit.cpp new file mode 100755 index 0000000000..dccc9e6405 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Orbit.cpp @@ -0,0 +1,212 @@ +#include "Orbit.h" + +// Initializers +Orbit::Orbit() { + ; +} + +void Orbit::drift_r(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + b->r[k] += b->v[k]*dt; + } + } +} + +void Orbit::kick_v(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + b->v[k] += b->a[k]*dt; + } + } +} +void Orbit::kick_vv(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + b->vv[k] += b->a[k]*dt; + } + } +} + +void Orbit::memorize_r(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + b->r_prev[k] = b->r[k]; + } + } +} +void Orbit::swap_r_and_r_prev(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + double d = b->r_prev[k]; + b->r_prev[k] = b->r[k]; + b->r[k] = d; + } + } +} + +void Orbit::init_vv(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + b->vv[k] = b->v[k]; + } + } +} +void Orbit::swap_v_and_vv(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + double dummy = b->v[k]; + b->v[k] = b->vv[k]; + b->vv[k] = dummy; + } + } +} + +// Diagnostics +double Orbit::get_kinetic_energy(vector &bodies) { + double EK = 0; + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type > 0) { + double v2 = inner_product(b->v.begin(), b->v.end(), b->v.begin(), 0.); + EK += 0.5*b->m*v2; + } + } + return EK; +} +double Orbit::get_potential_energy(vector &bodies) { + double EP = 0; + + array dr, drn; + array J; + + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + + if(bi->particle_type > 0) { + + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + if(bj->particle_type > 0) { + + for(int k=0; k<3; k++) { + dr[k] = bi->r[k]-bj->r[k]; + } + + double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + double dr_3 = 1./sqrt(dr2*dr2*dr2); + double dr_1 = dr_3*dr2; + + double EP1 = -bi->m*bj->m*dr_1; + + EP += EP1; + + if(bi->particle_type >= 2 || bj->particle_type >= 2) { + + for(int k=0; k<3; k++) { + drn[k] = dr[k]*dr_1; + } + + for(int k=0; k<6; k++) { + J[k] = bi->m*bj->I[k] + bj->m*bi->I[k]; + } + + double dxJdx = drn[0]*(drn[0]*J[0] + drn[1]*J[1] + drn[2]*J[2]); + double dyJdy = drn[1]*(drn[0]*J[1] + drn[1]*J[3] + drn[2]*J[4]); + double dzJdz = drn[2]*(drn[0]*J[2] + drn[1]*J[4] + drn[2]*J[5]); + + double EP2 = 1.5*dr_3*(dxJdx + dyJdy + dzJdz - (J[0]+J[3]+J[5])/3.); + + EP += EP2; + } + + } + } + + } + } + + return EP; +} +double Orbit::get_potential_energy_nbody(vector &bodies) { + double EP = 0; + + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + + if(bi->particle_type > 0) { + + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + if(bj->particle_type > 0) { + + array dr = {}; + for(int k=0; k<3; k++) { + dr[k] = bi->r[k]-bj->r[k]; + } + + double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + double dr_1 = 1./sqrt(dr2); + + double EP1 = -bi->m*bj->m*dr_1; + + EP += EP1; + } + + } + + } + + } + + return EP; +} + +array Orbit::get_center_of_mass(vector &bodies) { + array r = {}; + int N = bodies.size(); + double M = 0.; + for(int i=0; i 0) { + M += bodies[i].m; + for(int k=0; k<3; k++) { + r[k] += bodies[i].m*bodies[i].r[k]; + } + } + } + for(int k=0; k<3; k++) { + r[k] /= M; + } + return r; +} +array Orbit::get_center_of_mass_velocity(vector &bodies) { + array v = {}; + int N = bodies.size(); + double M = 0.; + for(int i=0; i 0) { + M += bodies[i].m; + for(int k=0; k<3; k++) { + v[k] += bodies[i].m*bodies[i].v[k]; + } + } + } + for(int k=0; k<3; k++) { + v[k] /= M; + } + return v; +} +array Orbit::get_angular_momentum(vector &bodies) { + array L = {}; + int N = bodies.size(); + for(int i=0; i 0) { + double Lx = bodies[i].r[1]*bodies[i].v[2] - bodies[i].r[2]*bodies[i].v[1]; + double Ly = bodies[i].r[2]*bodies[i].v[0] - bodies[i].r[0]*bodies[i].v[2]; + double Lz = bodies[i].r[0]*bodies[i].v[1] - bodies[i].r[1]*bodies[i].v[0]; + L[0] += bodies[i].m*Lx; + L[1] += bodies[i].m*Ly; + L[2] += bodies[i].m*Lz; + } + } + return L; +} + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Output.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Output.cpp new file mode 100755 index 0000000000..9ee49fa3ed --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Output.cpp @@ -0,0 +1,2415 @@ +#include "Output.h" + +// Constructor +Output::Output() { + format = 0; + info = 0; + coor = 0; + dir = "data/"; + overwrite = true; + + physical_units = false; + time_unit_output = ""; + mass_unit_output = ""; + length_unit_output = ""; + speed_unit_output = ""; + frequency_unit_output = ""; + angular_momentum_unit_output = ""; + energy_unit_output = ""; + inertia_unit_output = ""; + + tidal_model = 4; + + file_out = "outfile"; + file_parbu = ""; + + output_class = 0; + + firstWrite = true; + firstWriteDiag = true; + file_counter = 0; + bin_number = 0; + + n_width = 25; +} + +// Functions +void Output::set_format(int output_format) { + this->format = output_format; +} +void Output::set_info(int output_info) { + this->info = output_info; +} +void Output::set_coor(int output_coor) { + this->coor = output_coor; +} +void Output::set_dir(string output_dir) { + this->dir = output_dir; + + int N_str = this->dir.length(); + if(this->dir.at(N_str-1) != '/') { + string s = "/"; + this->dir = this->dir + s; + } +} +void Output::set_overwrite(int overwrite) { + switch(overwrite) { + case 0: + this->overwrite = false; + break; + case 1: + this->overwrite = true; + break; + } +} + +void Output::set_units(bool physical_units, string mass_unit, string length_unit, string time_unit, string speed_unit) { + this->physical_units = physical_units; + + if(physical_units) { + time_unit_output = time_unit; + mass_unit_output = mass_unit; + length_unit_output = length_unit; + speed_unit_output = speed_unit; + convert_time_to_frequency_unit(time_unit); + construct_angular_momentum_unit(mass_unit, length_unit, speed_unit); + construct_energy_unit(mass_unit, speed_unit); + construct_inertia_unit(mass_unit, length_unit); + } +} +void Output::set_conversion_factors(double Cm, double Cr, double Cv, double Ct) { + units.Cm = Cm; + units.Cr = Cr; + units.Cv = Cv; + units.Ct = Ct; +} +void Output::convert_time_to_frequency_unit(string time_unit) { + if(time_unit == "") frequency_unit_output = ""; + else if(time_unit == "[]") frequency_unit_output = "[]"; + else { + string s1 = "["; + string s2 = "1/"; + int n = time_unit.length(); + string s3 = time_unit.substr(1, n); + + frequency_unit_output = s1 + s2 + s3; + } +} +void Output::construct_angular_momentum_unit(string mass_unit, string length_unit, string speed_unit) { + if(mass_unit == "" || mass_unit == "[]") angular_momentum_unit_output = ""; + else { + string s1 = "["; + + int n = mass_unit.length(); + string sm = mass_unit.substr(1, n-2); + + n = length_unit.length(); + string sr = length_unit.substr(1, n-2); + + n = speed_unit.length(); + string sv = speed_unit.substr(1, n-1); + + angular_momentum_unit_output = s1 + sm + " " + sr + " " + sv; + } +} +void Output::construct_energy_unit(string mass_unit, string speed_unit) { + if(mass_unit == "" || mass_unit == "[]") energy_unit_output = ""; + else { + string s1 = "["; + + int n = mass_unit.length(); + string sm = mass_unit.substr(1, n-2); + + n = speed_unit.length(); + string sv = speed_unit.substr(1, n-2); + + string s2 = "]"; + + energy_unit_output = s1 + sm + " " + sv + " " + sv + s2; + } +} +void Output::construct_inertia_unit(string mass_unit, string length_unit) { + if(mass_unit == "" || mass_unit == "[]") inertia_unit_output = ""; + else { + string s1 = "["; + + int n = mass_unit.length(); + string sm = mass_unit.substr(1, n-2); + + n = length_unit.length(); + string sr = length_unit.substr(1, n-2); + + string s2 = "]"; + + inertia_unit_output = s1 + sm + " " + sr + " " + sr + s2; + } +} + +void Output::set_tidal_model(int tidal_model) { + this->tidal_model = tidal_model; +} + +void Output::set_file_out(string fo) { + this->file_out = dir + fo; +} + +void Output::determine_output_mode() { + if(format == 0) { + output_class = 0; + } + else if(format == 1) { + output_class = 1; + } + else if(format == 2) { + output_class = 2; + } + else { + cerr << endl; + cerr << "Invalid output_format: " << format << endl; + cerr << "Choose from [0=file_per_body, 1=file_per_snapshot, 2=single_file]." << endl; + cerr << endl; + exit(1); + } + + if(info == 0) { + output_class = output_class*10 + 0; + } + else if(info == 1) { + output_class = output_class*10 + 1; + } + else { + cerr << endl; + cerr << "Invalid output_info: " << info << endl; + cerr << "Choose from [0=time-varying quantities, 1=all]." << endl; + cerr << endl; + exit(1); + } + + if(coor == 0) { + output_class = output_class*10 + 0; + } + else { + cerr << endl; + cerr << "Invalid output_coor: " << info << endl; + cerr << "Choose from [0=Cartesian]." << endl; + cerr << endl; + exit(1); + } + + if(tidal_model == 0) { + output_class = output_class*10 + 0; + } + else { + output_class = output_class*10 + 1; + } +} + +void Output::write_snapshot(double t, double tcpu, vector &bodies) { + switch(output_class) { + + //0 0=file per body + 0=time-varying quantities + 0=cartesian inertial + N-body + //100 0=file per body + 1=all quantities + 0=cartesian inertial + N-body + + //1000 1=file per snapshot + 0=time-varying quantities + 0=cartesian inertial + N-body + //1100 1=file per snapshot + 1=all quantities + 0=cartesian inertial + N-body + + //2000 2=single file + 0=time-varying quantities + 0=cartesian inertial + N-body + //2100 2=single file + 1=all quantities + 0=cartesian inertial + N-body + + //1 0=file per body + 0=time-varying quantities + 0=cartesian inertial + Tidal + //101 0=file per body + 1=all quantities + 0=cartesian inertial + Tidal + + //1001 1=file per snapshot + 0=time-varying quantities + 0=cartesian inertial + Tidal + //1101 1=file per snapshot + 1=all quantities + 0=cartesian inertial + Tidal + + //2001 2=single file + 0=time-varying quantities + 0=cartesian inertial + Tidal + //2101 2=single file + 1=all quantities + 0=cartesian inertial + Tidal + + case 0: + write_snapshot_per_body_compact_nbody(t, tcpu, bodies); + break; + case 100: + write_snapshot_per_body_nbody(t, tcpu, bodies); + break; + + case 1000: + write_new_snapshot_file_compact_nbody(t, tcpu, bodies); + break; + case 1100: + write_new_snapshot_file_nbody(t, tcpu, bodies); + break; + + case 2000: + write_snapshot_to_file_compact_nbody(t, tcpu, bodies); + break; + case 2100: + write_snapshot_to_file_nbody(t, tcpu, bodies); + break; + + case 1: + write_snapshot_per_body_compact(t, tcpu, bodies); + break; + case 101: + write_snapshot_per_body(t, tcpu, bodies); + break; + + case 1001: + write_new_snapshot_file_compact(t, tcpu, bodies); + break; + case 1101: + write_new_snapshot_file(t, tcpu, bodies); + break; + + case 2001: + write_snapshot_to_file_compact(t, tcpu, bodies); + break; + case 2101: + write_snapshot_to_file(t, tcpu, bodies); + break; + } +} +void Output::create_output_file(string outputFile, bool isFirstWrite) { + // Check if file already exists + std::ifstream reader(outputFile); + bool exist = reader.good(); + reader.close(); + + if(exist == false) { + // Create the file + ofstream writer; + writer.open(outputFile, ios::out); + writer.close(); + } + else { + if(!overwrite) { + cerr << " " << endl; + cerr << outputFile << " already exists!" << endl; + cerr << " " << endl; + exit(1); + } + else if(isFirstWrite && overwrite) { + ofstream writer; + writer.open(outputFile, ios::out); + writer.close(); + } + } +} + +// Writers +void Output::write_snapshot_to_file(double t, double tcpu, vector &bodies) { + string outputFile = file_out + ".run"; + + create_output_file(outputFile, firstWrite); + + ofstream writer; + writer.open(outputFile, ios::app); + + if (!writer) { + cerr << endl; + cerr << "Cannot open output file: " << outputFile << endl; + cerr << endl; + exit(1); + } + + int N = bodies.size(); + + writer << setprecision(16); + writer << scientific; + + writer << units.convert_time_from_code_to_output(t, time_unit_output) << " " << N << " " << tcpu << endl; + for(int i=0; i &bodies) { + string outputFile = file_out + ".run"; + + create_output_file(outputFile, firstWrite); + + ofstream writer; + writer.open(outputFile, ios::app); + + if (!writer) { + cerr << endl; + cerr << "Cannot open output file: " << outputFile << endl; + cerr << endl; + exit(1); + } + + int N = bodies.size(); + + writer << setprecision(16); + writer << scientific; + + writer << units.convert_time_from_code_to_output(t, time_unit_output) << " " << N << " " << tcpu << endl; + for(int i=0; i &bodies) { + string outputFile = file_out + ".s" + to_string(file_counter); + + firstWrite = true; + create_output_file(outputFile, firstWrite); + + ofstream writer; + writer.open(outputFile, ios::app); + + if (!writer) { + cerr << "Cannot open output file: " << outputFile << endl; + exit(1); + } + + int N = bodies.size(); + + writer << setprecision(16); + writer << scientific; + + string s = "# t"; + writer << s + time_unit_output << " = "; + writer << units.convert_time_from_code_to_output(t, time_unit_output) << endl; + + writer << "# N = " << N << endl; + writer << "# tcpu[s] = " << tcpu << endl; + + if(firstWrite) { + s = "# "; + writer << s; + + writer << std::left; + + s = "name"; + writer << setw(n_width-2) << s; + s = "id"; + writer << setw(n_width) << s; + + writer << std::right; + + s = "mass"; + writer << setw(n_width) << s + mass_unit_output; + s = "R"; + writer << setw(n_width) << s + length_unit_output; + s = "xi"; + writer << setw(n_width) << s; + + s = "kf"; + writer << setw(n_width) << s; + s = "tau"; + writer << setw(n_width) << s + time_unit_output; + + s = "a_mb"; + writer << setw(n_width) << s + time_unit_output; + + s = "Ixx"; + writer << setw(n_width) << s + inertia_unit_output; + s = "Ixy"; + writer << setw(n_width) << s + inertia_unit_output; + s = "Ixz"; + writer << setw(n_width) << s + inertia_unit_output; + s = "Iyy"; + writer << setw(n_width) << s + inertia_unit_output; + s = "Iyz"; + writer << setw(n_width) << s + inertia_unit_output; + s = "Izz"; + writer << setw(n_width) << s + inertia_unit_output; + + s = "wx"; + writer << setw(n_width) << s + frequency_unit_output; + s = "wy"; + writer << setw(n_width) << s + frequency_unit_output; + s = "wz"; + writer << setw(n_width) << s + frequency_unit_output; + + s = "x"; + writer << setw(n_width) << s + length_unit_output; + s = "y"; + writer << setw(n_width) << s + length_unit_output; + s = "z"; + writer << setw(n_width) << s + length_unit_output; + + s = "vx"; + writer << setw(n_width) << s + speed_unit_output; + s = "vy"; + writer << setw(n_width) << s + speed_unit_output; + s = "vz"; + writer << setw(n_width) << s + speed_unit_output; + + writer << endl; + } + + for(int i=0; i &bodies) { + string outputFile = file_out + ".s" + to_string(file_counter); + + firstWrite = true; + create_output_file(outputFile, firstWrite); + + ofstream writer; + writer.open(outputFile, ios::app); + + if (!writer) { + cerr << "Cannot open output file: " << outputFile << endl; + exit(1); + } + + int N = bodies.size(); + + writer << setprecision(16); + writer << scientific; + + string s = "# t"; + writer << s + time_unit_output << " = "; + writer << units.convert_time_from_code_to_output(t, time_unit_output) << endl; + + writer << "# N = " << N << endl; + writer << "# tcpu[s] = " << tcpu << endl; + + if(firstWrite) { + s = "#"; + writer << s; + + s = "Ixx"; + writer << setw(n_width-1) << s + inertia_unit_output; + s = "Ixy"; + writer << setw(n_width) << s + inertia_unit_output; + s = "Ixz"; + writer << setw(n_width) << s + inertia_unit_output; + s = "Iyy"; + writer << setw(n_width) << s + inertia_unit_output; + s = "Iyz"; + writer << setw(n_width) << s + inertia_unit_output; + + s = "wx"; + writer << setw(n_width) << s + frequency_unit_output; + s = "wy"; + writer << setw(n_width) << s + frequency_unit_output; + s = "wz"; + writer << setw(n_width) << s + frequency_unit_output; + + s = "x"; + writer << setw(n_width) << s + length_unit_output; + s = "y"; + writer << setw(n_width) << s + length_unit_output; + s = "z"; + writer << setw(n_width) << s + length_unit_output; + + s = "vx"; + writer << setw(n_width) << s + speed_unit_output; + s = "vy"; + writer << setw(n_width) << s + speed_unit_output; + s = "vz"; + writer << setw(n_width) << s + speed_unit_output; + + writer << endl; + } + + for(int i=0; i &bodies) { + int N = bodies.size(); + for(int i=0; i &bodies) { + int N = bodies.size(); + for(int i=0; i &bodies) { + string outputFile = file_out + ".run"; + + create_output_file(outputFile, firstWrite); + + ofstream writer; + writer.open(outputFile, ios::app); + + if (!writer) { + cerr << endl; + cerr << "Cannot open output file: " << outputFile << endl; + cerr << endl; + exit(1); + } + + int N = bodies.size(); + + writer << setprecision(16); + writer << scientific; + + writer << units.convert_time_from_code_to_output(t, time_unit_output) << " " << N << " " << tcpu << endl; + for(int i=0; i &bodies) { + string outputFile = file_out + ".run"; + + create_output_file(outputFile, firstWrite); + + ofstream writer; + writer.open(outputFile, ios::app); + + if (!writer) { + cerr << endl; + cerr << "Cannot open output file: " << outputFile << endl; + cerr << endl; + exit(1); + } + + int N = bodies.size(); + + writer << setprecision(16); + writer << scientific; + + writer << units.convert_time_from_code_to_output(t, time_unit_output) << " " << N << " " << tcpu << endl; + for(int i=0; i &bodies) { + string outputFile = file_out + ".s" + to_string(file_counter); + + firstWrite = true; + create_output_file(outputFile, firstWrite); + + ofstream writer; + writer.open(outputFile, ios::app); + + if (!writer) { + cerr << "Cannot open output file: " << outputFile << endl; + exit(1); + } + + int N = bodies.size(); + + writer << setprecision(16); + writer << scientific; + + string s = "# t"; + writer << s + time_unit_output << " = "; + writer << units.convert_time_from_code_to_output(t, time_unit_output) << endl; + + writer << "# N = " << N << endl; + writer << "# tcpu[s] = " << tcpu << endl; + + if(firstWrite) { + s = "# "; + writer << s; + + writer << std::left; + + s = "name"; + writer << setw(n_width-2) << s; + s = "id"; + writer << setw(n_width) << s; + + writer << std::right; + + s = "mass"; + writer << setw(n_width) << s + mass_unit_output; + s = "R"; + writer << setw(n_width) << s + length_unit_output; + + s = "x"; + writer << setw(n_width) << s + length_unit_output; + s = "y"; + writer << setw(n_width) << s + length_unit_output; + s = "z"; + writer << setw(n_width) << s + length_unit_output; + + s = "vx"; + writer << setw(n_width) << s + speed_unit_output; + s = "vy"; + writer << setw(n_width) << s + speed_unit_output; + s = "vz"; + writer << setw(n_width) << s + speed_unit_output; + + writer << endl; + } + + for(int i=0; i &bodies) { + string outputFile = file_out + ".s" + to_string(file_counter); + + firstWrite = true; + create_output_file(outputFile, firstWrite); + + ofstream writer; + writer.open(outputFile, ios::app); + + if (!writer) { + cerr << "Cannot open output file: " << outputFile << endl; + exit(1); + } + + int N = bodies.size(); + + writer << setprecision(16); + writer << scientific; + + string s = "# t"; + writer << s + time_unit_output << " = "; + writer << units.convert_time_from_code_to_output(t, time_unit_output) << endl; + + writer << "# N = " << N << endl; + writer << "# tcpu[s] = " << tcpu << endl; + + if(firstWrite) { + s = "# "; + writer << s; + + s = "x"; + writer << setw(n_width-2) << s + length_unit_output; + s = "y"; + writer << setw(n_width) << s + length_unit_output; + s = "z"; + writer << setw(n_width) << s + length_unit_output; + + s = "vx"; + writer << setw(n_width) << s + speed_unit_output; + s = "vy"; + writer << setw(n_width) << s + speed_unit_output; + s = "vz"; + writer << setw(n_width) << s + speed_unit_output; + + writer << endl; + } + + for(int i=0; i &bodies) { + int N = bodies.size(); + for(int i=0; i &bodies) { + int N = bodies.size(); + for(int i=0; i &bodies, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot) { + string bin_name = file_out + ".bin" + to_string(bin_number); + bin_number = (bin_number + 1) % 2; + + fstream fb(bin_name, ios::in | ios::out | ios::binary | ios::trunc); + + // header + fb.write((char*)&t, sizeof (double)); + fb.write((char*)&N, sizeof (int)); + fb.write((char*)&tcpu, sizeof (double)); + fb.write((char*)&dt_prev, sizeof (double)); + fb.write((char*)&num_integration_steps, sizeof (int)); + + fb.write((char*)&collision_flag, sizeof (int)); + fb.write((char*)&roche_flag, sizeof (int)); + fb.write((char*)&breakup_flag, sizeof (int)); + + fb.write((char*)&dt_snapshot, sizeof (double)); + fb.write((char*)&dt0_log, sizeof (double)); + fb.write((char*)&fmul_log, sizeof (double)); + + fb.write((char*)&num_snapshot, sizeof (int)); + + // id + vector id(N); + for(int i=0; i m(N), R(N), xi(N); + for(int i=0; i kf(N), tau(N); + for(int i=0; i a_mb(N); + for(int i=0; i Ixx(N), Ixy(N), Ixz(N), Iyy(N), Iyz(N), Izz(N); + for(int i=0; i Ixx_p(N), Ixy_p(N), Ixz_p(N), Iyy_p(N), Iyz_p(N), Izz_p(N); + for(int i=0; i Ixx_n(N), Ixy_n(N), Ixz_n(N), Iyy_n(N), Iyz_n(N), Izz_n(N); + for(int i=0; i Ixx_inv(N), Ixy_inv(N), Ixz_inv(N), Iyy_inv(N), Iyz_inv(N), Izz_inv(N); + for(int i=0; i Ixx_e_r(N), Ixy_e_r(N), Ixz_e_r(N), Iyy_e_r(N), Iyz_e_r(N), Izz_e_r(N); + for(int i=0; i dIxx_e_r(N), dIxy_e_r(N), dIxz_e_r(N), dIyy_e_r(N), dIyz_e_r(N), dIzz_e_r(N); + for(int i=0; i Ixx_e_w(N), Ixy_e_w(N), Ixz_e_w(N), Iyy_e_w(N), Iyz_e_w(N), Izz_e_w(N); + for(int i=0; i Ixx_e(N), Ixy_e(N), Ixz_e(N), Iyy_e(N), Iyz_e(N), Izz_e(N); + for(int i=0; i dIxx_e(N), dIxy_e(N), dIxz_e(N), dIyy_e(N), dIyz_e(N), dIzz_e(N); + for(int i=0; i dIxx_n(N), dIxy_n(N), dIxz_n(N), dIyy_n(N), dIyz_n(N), dIzz_n(N); + for(int i=0; i Ixx_e_prev(N), Ixy_e_prev(N), Ixz_e_prev(N), Iyy_e_prev(N), Iyz_e_prev(N), Izz_e_prev(N); + for(int i=0; i Ixx_n_prev(N), Ixy_n_prev(N), Ixz_n_prev(N), Iyy_n_prev(N), Iyz_n_prev(N), Izz_n_prev(N); + for(int i=0; i Ixx_e_prev_bu(N), Ixy_e_prev_bu(N), Ixz_e_prev_bu(N), Iyy_e_prev_bu(N), Iyz_e_prev_bu(N), Izz_e_prev_bu(N); + for(int i=0; i Ixx_e_rh(N), Ixy_e_rh(N), Ixz_e_rh(N), Iyy_e_rh(N), Iyz_e_rh(N), Izz_e_rh(N); + for(int i=0; i wx(N), wy(N), wz(N); + vector Lx(N), Ly(N), Lz(N); + + for(int i=0; i Tx(N), Ty(N), Tz(N); + + for(int i=0; i x(N), y(N), z(N); + vector vx(N), vy(N), vz(N); + + for(int i=0; i ax(N), ay(N), az(N); + + for(int i=0; i R5(N), R5_3(N), kf_R5(N), kf_R5_3(N), tau_inv(N); + for(int i=0; i vvx(N), vvy(N), vvz(N); + + for(int i=0; i Jxx_n(N), Jxy_n(N), Jxz_n(N), Jyy_n(N), Jyz_n(N), Jzz_n(N); + for(int i=0; i Jxx(N), Jxy(N), Jxz(N), Jyy(N), Jyz(N), Jzz(N); + for(int i=0; i Jxx_inv(N), Jxy_inv(N), Jxz_inv(N), Jyy_inv(N), Jyz_inv(N), Jzz_inv(N); + for(int i=0; i Kx(N), Ky(N), Kz(N); + + for(int i=0; i &bodies, int &collision_flag, int &roche_flag, int &breakup_flag, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot) { + string bin0_name = file_out + ".bin0"; + + bool isComplete0; + double t0, tcpu0, dt_prev0; + int N0; + vector bodies0; + bool firstWrite0; + bool firstWriteDiag0; + int file_counter0; + int bin_number0; + int num_integration_steps0, num_snapshot0; + int collision_flag0, roche_flag0, breakup_flag0; + double dt_snapshot0, dt0_log0, fmul_log0; + + try { + read_from_binary(t0, N0, tcpu0, dt_prev0, num_integration_steps0, bodies0, bin0_name, firstWrite0, firstWriteDiag0, file_counter0, bin_number0, collision_flag0, roche_flag0, breakup_flag0, dt_snapshot0, dt0_log0, fmul_log0, num_snapshot0); + isComplete0 = true; + } + catch(const std::exception&) { + isComplete0 = false; + } + + string bin1_name = file_out + ".bin1"; + + bool isComplete1; + double t1, tcpu1, dt_prev1; + int N1; + vector bodies1; + bool firstWrite1; + bool firstWriteDiag1; + int file_counter1; + int bin_number1; + int num_integration_steps1, num_snapshot1; + int collision_flag1, roche_flag1, breakup_flag1; + double dt_snapshot1, dt0_log1, fmul_log1; + + try { + read_from_binary(t1, N1, tcpu1, dt_prev1, num_integration_steps1, bodies1, bin1_name, firstWrite1, firstWriteDiag1, file_counter1, bin_number1, collision_flag1, roche_flag1, breakup_flag1, dt_snapshot1, dt0_log1, fmul_log1, num_snapshot1); + isComplete1 = true; + } + catch(const std::exception&) { + isComplete1 = false; + } + + if(isComplete0) { + if(isComplete1) { + if(t1 > t0) { + t = t1; + N = N1; + tcpu = tcpu1; + dt_prev = dt_prev1; + bodies = bodies1; + firstWrite = firstWrite1; + firstWriteDiag = firstWriteDiag1; + file_counter = file_counter1; + bin_number = bin_number1; + num_integration_steps = num_integration_steps1; + collision_flag = collision_flag1; + roche_flag = roche_flag1; + breakup_flag = breakup_flag1; + dt_snapshot = dt_snapshot1; + dt0_log = dt0_log1; + fmul_log = fmul_log1; + num_snapshot = num_snapshot1; + } + else { + t = t0; + N = N0; + tcpu = tcpu0; + dt_prev = dt_prev0; + bodies = bodies0; + firstWrite = firstWrite0; + firstWriteDiag = firstWriteDiag0; + file_counter = file_counter0; + bin_number = bin_number0; + num_integration_steps = num_integration_steps0; + collision_flag = collision_flag0; + roche_flag = roche_flag0; + breakup_flag = breakup_flag0; + dt_snapshot = dt_snapshot0; + dt0_log = dt0_log0; + fmul_log = fmul_log0; + num_snapshot = num_snapshot0; + } + } + else { + t = t0; + N = N0; + tcpu = tcpu0; + dt_prev = dt_prev0; + bodies = bodies0; + firstWrite = firstWrite0; + firstWriteDiag = firstWriteDiag0; + file_counter = file_counter0; + bin_number = bin_number0; + num_integration_steps = num_integration_steps0; + collision_flag = collision_flag0; + roche_flag = roche_flag0; + breakup_flag = breakup_flag0; + dt_snapshot = dt_snapshot0; + dt0_log = dt0_log0; + fmul_log = fmul_log0; + num_snapshot = num_snapshot0; + } + } + else { + if(isComplete1) { + t = t1; + N = N1; + tcpu = tcpu1; + dt_prev = dt_prev1; + bodies = bodies1; + firstWrite = firstWrite1; + firstWriteDiag = firstWriteDiag1; + file_counter = file_counter1; + bin_number = bin_number1; + num_integration_steps = num_integration_steps1; + collision_flag = collision_flag1; + roche_flag = roche_flag1; + breakup_flag = breakup_flag1; + dt_snapshot = dt_snapshot1; + dt0_log = dt0_log1; + fmul_log = fmul_log1; + num_snapshot = num_snapshot1; + } + else { + cerr << " " << endl; + cerr << "Incomplete/invalid binary files: cannot continue simulation." << endl; + cerr << " " << endl; + exit(1); + } + } +} +void Output::read_from_binary(double &t, int &N, double &tcpu, double &dt_prev, int &num_integration_steps, vector &bodies, string &bin_name, bool &myfirstWrite, bool &myfirstWriteDiag, int &myfile_counter, int &mybin_number, int &collision_flag, int &roche_flag, int &breakup_flag, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot) { + fstream fb(bin_name, ios::in | ios::out | ios::binary); + + // header + fb.read((char*)&t, sizeof (double)); + fb.read((char*)&N, sizeof (int)); + fb.read((char*)&tcpu, sizeof (double)); + fb.read((char*)&dt_prev, sizeof (double)); + fb.read((char*)&num_integration_steps, sizeof (int)); + + fb.read((char*)&collision_flag, sizeof (int)); + fb.read((char*)&roche_flag, sizeof (int)); + fb.read((char*)&breakup_flag, sizeof (int)); + + fb.read((char*)&dt_snapshot, sizeof (double)); + fb.read((char*)&dt0_log, sizeof (double)); + fb.read((char*)&fmul_log, sizeof (double)); + + fb.read((char*)&num_snapshot, sizeof (int)); + + bodies.resize(N); + + // id + vector id(N); + fb.read((char*)&id[0], sizeof (int)*N); + + for(int i=0; i m(N), R(N), xi(N); + fb.read((char*)&m[0], sizeof (double)*N); + fb.read((char*)&R[0], sizeof (double)*N); + fb.read((char*)&xi[0], sizeof (double)*N); + + for(int i=0; i kf(N), tau(N); + fb.read((char*)&kf[0], sizeof (double)*N); + fb.read((char*)&tau[0], sizeof (double)*N); + + for(int i=0; i a_mb(N); + fb.read((char*)&a_mb[0], sizeof (double)*N); + + for(int i=0; i Ixx(N), Ixy(N), Ixz(N), Iyy(N), Iyz(N), Izz(N); + + fb.read((char*)&Ixx[0], sizeof (double)*N); + fb.read((char*)&Ixy[0], sizeof (double)*N); + fb.read((char*)&Ixz[0], sizeof (double)*N); + fb.read((char*)&Iyy[0], sizeof (double)*N); + fb.read((char*)&Iyz[0], sizeof (double)*N); + fb.read((char*)&Izz[0], sizeof (double)*N); + + for(int i=0; i Ixx_p(N), Ixy_p(N), Ixz_p(N), Iyy_p(N), Iyz_p(N), Izz_p(N); + + fb.read((char*)&Ixx_p[0], sizeof (double)*N); + fb.read((char*)&Ixy_p[0], sizeof (double)*N); + fb.read((char*)&Ixz_p[0], sizeof (double)*N); + fb.read((char*)&Iyy_p[0], sizeof (double)*N); + fb.read((char*)&Iyz_p[0], sizeof (double)*N); + fb.read((char*)&Izz_p[0], sizeof (double)*N); + + for(int i=0; i Ixx_n(N), Ixy_n(N), Ixz_n(N), Iyy_n(N), Iyz_n(N), Izz_n(N); + + fb.read((char*)&Ixx_n[0], sizeof (double)*N); + fb.read((char*)&Ixy_n[0], sizeof (double)*N); + fb.read((char*)&Ixz_n[0], sizeof (double)*N); + fb.read((char*)&Iyy_n[0], sizeof (double)*N); + fb.read((char*)&Iyz_n[0], sizeof (double)*N); + fb.read((char*)&Izz_n[0], sizeof (double)*N); + + for(int i=0; i Ixx_inv(N), Ixy_inv(N), Ixz_inv(N), Iyy_inv(N), Iyz_inv(N), Izz_inv(N); + + fb.read((char*)&Ixx_inv[0], sizeof (double)*N); + fb.read((char*)&Ixy_inv[0], sizeof (double)*N); + fb.read((char*)&Ixz_inv[0], sizeof (double)*N); + fb.read((char*)&Iyy_inv[0], sizeof (double)*N); + fb.read((char*)&Iyz_inv[0], sizeof (double)*N); + fb.read((char*)&Izz_inv[0], sizeof (double)*N); + + for(int i=0; i Ixx_e_r(N), Ixy_e_r(N), Ixz_e_r(N), Iyy_e_r(N), Iyz_e_r(N), Izz_e_r(N); + + fb.read((char*)&Ixx_e_r[0], sizeof (double)*N); + fb.read((char*)&Ixy_e_r[0], sizeof (double)*N); + fb.read((char*)&Ixz_e_r[0], sizeof (double)*N); + fb.read((char*)&Iyy_e_r[0], sizeof (double)*N); + fb.read((char*)&Iyz_e_r[0], sizeof (double)*N); + fb.read((char*)&Izz_e_r[0], sizeof (double)*N); + + for(int i=0; i dIxx_e_r(N), dIxy_e_r(N), dIxz_e_r(N), dIyy_e_r(N), dIyz_e_r(N), dIzz_e_r(N); + + fb.read((char*)&dIxx_e_r[0], sizeof (double)*N); + fb.read((char*)&dIxy_e_r[0], sizeof (double)*N); + fb.read((char*)&dIxz_e_r[0], sizeof (double)*N); + fb.read((char*)&dIyy_e_r[0], sizeof (double)*N); + fb.read((char*)&dIyz_e_r[0], sizeof (double)*N); + fb.read((char*)&dIzz_e_r[0], sizeof (double)*N); + + for(int i=0; i Ixx_e_w(N), Ixy_e_w(N), Ixz_e_w(N), Iyy_e_w(N), Iyz_e_w(N), Izz_e_w(N); + + fb.read((char*)&Ixx_e_w[0], sizeof (double)*N); + fb.read((char*)&Ixy_e_w[0], sizeof (double)*N); + fb.read((char*)&Ixz_e_w[0], sizeof (double)*N); + fb.read((char*)&Iyy_e_w[0], sizeof (double)*N); + fb.read((char*)&Iyz_e_w[0], sizeof (double)*N); + fb.read((char*)&Izz_e_w[0], sizeof (double)*N); + + for(int i=0; i Ixx_e(N), Ixy_e(N), Ixz_e(N), Iyy_e(N), Iyz_e(N), Izz_e(N); + + fb.read((char*)&Ixx_e[0], sizeof (double)*N); + fb.read((char*)&Ixy_e[0], sizeof (double)*N); + fb.read((char*)&Ixz_e[0], sizeof (double)*N); + fb.read((char*)&Iyy_e[0], sizeof (double)*N); + fb.read((char*)&Iyz_e[0], sizeof (double)*N); + fb.read((char*)&Izz_e[0], sizeof (double)*N); + + for(int i=0; i dIxx_e(N), dIxy_e(N), dIxz_e(N), dIyy_e(N), dIyz_e(N), dIzz_e(N); + + fb.read((char*)&dIxx_e[0], sizeof (double)*N); + fb.read((char*)&dIxy_e[0], sizeof (double)*N); + fb.read((char*)&dIxz_e[0], sizeof (double)*N); + fb.read((char*)&dIyy_e[0], sizeof (double)*N); + fb.read((char*)&dIyz_e[0], sizeof (double)*N); + fb.read((char*)&dIzz_e[0], sizeof (double)*N); + + for(int i=0; i dIxx_n(N), dIxy_n(N), dIxz_n(N), dIyy_n(N), dIyz_n(N), dIzz_n(N); + + fb.read((char*)&dIxx_n[0], sizeof (double)*N); + fb.read((char*)&dIxy_n[0], sizeof (double)*N); + fb.read((char*)&dIxz_n[0], sizeof (double)*N); + fb.read((char*)&dIyy_n[0], sizeof (double)*N); + fb.read((char*)&dIyz_n[0], sizeof (double)*N); + fb.read((char*)&dIzz_n[0], sizeof (double)*N); + + for(int i=0; i Ixx_e_prev(N), Ixy_e_prev(N), Ixz_e_prev(N), Iyy_e_prev(N), Iyz_e_prev(N), Izz_e_prev(N); + + fb.read((char*)&Ixx_e_prev[0], sizeof (double)*N); + fb.read((char*)&Ixy_e_prev[0], sizeof (double)*N); + fb.read((char*)&Ixz_e_prev[0], sizeof (double)*N); + fb.read((char*)&Iyy_e_prev[0], sizeof (double)*N); + fb.read((char*)&Iyz_e_prev[0], sizeof (double)*N); + fb.read((char*)&Izz_e_prev[0], sizeof (double)*N); + + for(int i=0; i Ixx_n_prev(N), Ixy_n_prev(N), Ixz_n_prev(N), Iyy_n_prev(N), Iyz_n_prev(N), Izz_n_prev(N); + + fb.read((char*)&Ixx_n_prev[0], sizeof (double)*N); + fb.read((char*)&Ixy_n_prev[0], sizeof (double)*N); + fb.read((char*)&Ixz_n_prev[0], sizeof (double)*N); + fb.read((char*)&Iyy_n_prev[0], sizeof (double)*N); + fb.read((char*)&Iyz_n_prev[0], sizeof (double)*N); + fb.read((char*)&Izz_n_prev[0], sizeof (double)*N); + + for(int i=0; i Ixx_e_prev_bu(N), Ixy_e_prev_bu(N), Ixz_e_prev_bu(N), Iyy_e_prev_bu(N), Iyz_e_prev_bu(N), Izz_e_prev_bu(N); + + fb.read((char*)&Ixx_e_prev_bu[0], sizeof (double)*N); + fb.read((char*)&Ixy_e_prev_bu[0], sizeof (double)*N); + fb.read((char*)&Ixz_e_prev_bu[0], sizeof (double)*N); + fb.read((char*)&Iyy_e_prev_bu[0], sizeof (double)*N); + fb.read((char*)&Iyz_e_prev_bu[0], sizeof (double)*N); + fb.read((char*)&Izz_e_prev_bu[0], sizeof (double)*N); + + for(int i=0; i Ixx_e_rh(N), Ixy_e_rh(N), Ixz_e_rh(N), Iyy_e_rh(N), Iyz_e_rh(N), Izz_e_rh(N); + + fb.read((char*)&Ixx_e_rh[0], sizeof (double)*N); + fb.read((char*)&Ixy_e_rh[0], sizeof (double)*N); + fb.read((char*)&Ixz_e_rh[0], sizeof (double)*N); + fb.read((char*)&Iyy_e_rh[0], sizeof (double)*N); + fb.read((char*)&Iyz_e_rh[0], sizeof (double)*N); + fb.read((char*)&Izz_e_rh[0], sizeof (double)*N); + + for(int i=0; i wx(N), wy(N), wz(N); + vector Lx(N), Ly(N), Lz(N); + + fb.read((char*)&wx[0], sizeof (double)*N); + fb.read((char*)&wy[0], sizeof (double)*N); + fb.read((char*)&wz[0], sizeof (double)*N); + fb.read((char*)&Lx[0], sizeof (double)*N); + fb.read((char*)&Ly[0], sizeof (double)*N); + fb.read((char*)&Lz[0], sizeof (double)*N); + + for(int i=0; i Tx(N), Ty(N), Tz(N); + + fb.read((char*)&Tx[0], sizeof (double)*N); + fb.read((char*)&Ty[0], sizeof (double)*N); + fb.read((char*)&Tz[0], sizeof (double)*N); + + for(int i=0; i x(N), y(N), z(N); + vector vx(N), vy(N), vz(N); + + fb.read((char*)&x[0], sizeof (double)*N); + fb.read((char*)&y[0], sizeof (double)*N); + fb.read((char*)&z[0], sizeof (double)*N); + fb.read((char*)&vx[0], sizeof (double)*N); + fb.read((char*)&vy[0], sizeof (double)*N); + fb.read((char*)&vz[0], sizeof (double)*N); + + for(int i=0; i ax(N), ay(N), az(N); + + fb.read((char*)&ax[0], sizeof (double)*N); + fb.read((char*)&ay[0], sizeof (double)*N); + fb.read((char*)&az[0], sizeof (double)*N); + + for(int i=0; i R5(N), R5_3(N), kf_R5(N), kf_R5_3(N), tau_inv(N); + fb.read((char*)&R5[0], sizeof (double)*N); + fb.read((char*)&R5_3[0], sizeof (double)*N); + fb.read((char*)&kf_R5[0], sizeof (double)*N); + fb.read((char*)&kf_R5_3[0], sizeof (double)*N); + fb.read((char*)&tau_inv[0], sizeof (double)*N); + + for(int i=0; i vvx(N), vvy(N), vvz(N); + + fb.read((char*)&vvx[0], sizeof (double)*N); + fb.read((char*)&vvy[0], sizeof (double)*N); + fb.read((char*)&vvz[0], sizeof (double)*N); + + for(int i=0; i Jxx_n(N), Jxy_n(N), Jxz_n(N), Jyy_n(N), Jyz_n(N), Jzz_n(N); + + fb.read((char*)&Jxx_n[0], sizeof (double)*N); + fb.read((char*)&Jxy_n[0], sizeof (double)*N); + fb.read((char*)&Jxz_n[0], sizeof (double)*N); + fb.read((char*)&Jyy_n[0], sizeof (double)*N); + fb.read((char*)&Jyz_n[0], sizeof (double)*N); + fb.read((char*)&Jzz_n[0], sizeof (double)*N); + + for(int i=0; i Jxx(N), Jxy(N), Jxz(N), Jyy(N), Jyz(N), Jzz(N); + + fb.read((char*)&Jxx[0], sizeof (double)*N); + fb.read((char*)&Jxy[0], sizeof (double)*N); + fb.read((char*)&Jxz[0], sizeof (double)*N); + fb.read((char*)&Jyy[0], sizeof (double)*N); + fb.read((char*)&Jyz[0], sizeof (double)*N); + fb.read((char*)&Jzz[0], sizeof (double)*N); + + for(int i=0; i Jxx_inv(N), Jxy_inv(N), Jxz_inv(N), Jyy_inv(N), Jyz_inv(N), Jzz_inv(N); + + fb.read((char*)&Jxx_inv[0], sizeof (double)*N); + fb.read((char*)&Jxy_inv[0], sizeof (double)*N); + fb.read((char*)&Jxz_inv[0], sizeof (double)*N); + fb.read((char*)&Jyy_inv[0], sizeof (double)*N); + fb.read((char*)&Jyz_inv[0], sizeof (double)*N); + fb.read((char*)&Jzz_inv[0], sizeof (double)*N); + + for(int i=0; i Kx(N), Ky(N), Kz(N); + + fb.read((char*)&Kx[0], sizeof (double)*N); + fb.read((char*)&Ky[0], sizeof (double)*N); + fb.read((char*)&Kz[0], sizeof (double)*N); + + for(int i=0; i &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + double I0 = b->xi*b->m*b->R*b->R; + b->I_p.fill(0); + b->I_p[0] = I0; + b->I_p[3] = I0; + b->I_p[5] = I0; + } +} +void Shape::set_to_spherical_shape(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->I_n.fill(0); + for(int k=0; k<6; k++) { + b->I[k] = b->I_p[k] + b->I_n[k]; + } + } +} +void Shape::set_to_equilibrium_shape(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<5; k++) { + b->I_n[k] = b->I_e[k]; + b->I[k] = b->I_p[k] + b->I_n[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + b->I[5] = b->I_p[5] + b->I_n[5]; + } +} +void Shape::set_to_equilibrium_shape_with_J(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<5; k++) { + b->J_n[k] = b->I_e[k]; + b->J[k] = b->I_p[k] + b->J_n[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + b->J[5] = b->I_p[5] + b->J_n[5]; + } +} +void Shape::set_to_linear_shape(vector &bodies) { + kick_linear(bodies); +} +void Shape::init_J(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->J_n[k] = b->I_n[k]; + b->J[k] = b->I[k]; + } + } +} + +void Shape::calc_expos(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3 && b->tau > 0) { + double dt_abs = abs(dt); + + double f_ratio = dt*b->tau_inv; + double f_ratio_abs = dt_abs*b->tau_inv; + + double fh_ratio = 0.5*f_ratio; + double fh_ratio_abs = 0.5*f_ratio_abs; + + double expoh_abs = exp(-fh_ratio_abs); + double expo_abs = expoh_abs*expoh_abs; + + if(f_ratio_abs < f_lim) { + double expoh = (dt > 0) ? expoh_abs : 1./expoh_abs; + + double expo = expoh*expoh; + + int dt_sgn = dt/dt_abs; + + double dt_step = b->tau*(1-expo_abs); + dt_step *= dt_sgn; + + double dth_step = b->tau*(1-expoh_abs); + dth_step *= dt_sgn; + + b->expo = expo; + b->expoh = expoh; + b->dt_rot = dt_step; + b->dth_rot = dth_step; + b->isLinear = false; + } + else { + double dth_step = b->tau*(1-expoh_abs); + double dt_step = b->tau*(1-expo_abs); + + b->dt_rot = dt_step; + b->dth_rot = dth_step; + b->isLinear = true; + } + } + } +} +void Shape::copy_expos_to_1(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->expo_1 = b->expo; + b->expoh_1 = b->expoh; + b->dt_rot_1 = b->dt_rot; + b->dth_rot_1 = b->dth_rot; + b->isLinear_1 = b->isLinear; + } +} +void Shape::copy_expos_to_2(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->expo_2 = b->expo; + b->expoh_2 = b->expoh; + b->dt_rot_2 = b->dt_rot; + b->dth_rot_2 = b->dth_rot; + b->isLinear_2 = b->isLinear; + } +} +void Shape::revert_expos_1(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->expo = b->expo_1; + b->expoh = b->expoh_1; + b->dt_rot = b->dt_rot_1; + b->dth_rot = b->dth_rot_1; + b->isLinear = b->isLinear_1; + } +} +void Shape::revert_expos_2(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + b->expo = b->expo_2; + b->expoh = b->expoh_2; + b->dt_rot = b->dt_rot_2; + b->dth_rot = b->dth_rot_2; + b->isLinear = b->isLinear_2; + } +} + +// Calculators +void Shape::calculate_I_inv(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + double I11 = b->I[1]*b->I[1]; + double I22 = b->I[2]*b->I[2]; + double I44 = b->I[4]*b->I[4]; + + double I24 = b->I[2]*b->I[4]; + double I35 = b->I[3]*b->I[5]; + + double D = 1./(b->I[0]*I35 + 2*b->I[1]*I24 - b->I[0]*I44 - b->I[3]*I22 - b->I[5]*I11); + + b->I_inv[0] = D * (I35-I44); + b->I_inv[1] = D * (I24-b->I[1]*b->I[5]); + b->I_inv[2] = D * (b->I[1]*b->I[4]-b->I[3]*b->I[2]); + b->I_inv[3] = D * (b->I[0]*b->I[5]-I22); + b->I_inv[4] = D * (b->I[1]*b->I[2]-b->I[0]*b->I[4]); + b->I_inv[5] = D * (b->I[0]*b->I[3]-I11); + } + else if(b->particle_type == 2) { + b->I_inv[0] = 1./b->I[0]; + b->I_inv[1] = 0; + b->I_inv[2] = 0; + b->I_inv[3] = 1./b->I[3]; + b->I_inv[4] = 0; + b->I_inv[5] = 1./b->I[5]; + } + } +} +void Shape::calculate_I_inv_and_w(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + double I11 = b->I[1]*b->I[1]; + double I22 = b->I[2]*b->I[2]; + double I44 = b->I[4]*b->I[4]; + + double I24 = b->I[2]*b->I[4]; + double I35 = b->I[3]*b->I[5]; + + double D = 1./(b->I[0]*I35 + 2*b->I[1]*I24 - b->I[0]*I44 - b->I[3]*I22 - b->I[5]*I11); + + b->I_inv[0] = D * (I35-I44); + b->I_inv[1] = D * (I24-b->I[1]*b->I[5]); + b->I_inv[2] = D * (b->I[1]*b->I[4]-b->I[3]*b->I[2]); + b->I_inv[3] = D * (b->I[0]*b->I[5]-I22); + b->I_inv[4] = D * (b->I[1]*b->I[2]-b->I[0]*b->I[4]); + b->I_inv[5] = D * (b->I[0]*b->I[3]-I11); + + b->w[0] = b->I_inv[0]*b->L[0] + b->I_inv[1]*b->L[1] + b->I_inv[2]*b->L[2]; + b->w[1] = b->I_inv[1]*b->L[0] + b->I_inv[3]*b->L[1] + b->I_inv[4]*b->L[2]; + b->w[2] = b->I_inv[2]*b->L[0] + b->I_inv[4]*b->L[1] + b->I_inv[5]*b->L[2]; + } + else if(b->particle_type == 2) { + b->I_inv[0] = 1./b->I[0]; + b->I_inv[1] = 0; + b->I_inv[2] = 0; + b->I_inv[3] = 1./b->I[3]; + b->I_inv[4] = 0; + b->I_inv[5] = 1./b->I[5]; + + b->w[0] = b->I_inv[0]*b->L[0] + b->I_inv[1]*b->L[1] + b->I_inv[2]*b->L[2]; + b->w[1] = b->I_inv[1]*b->L[0] + b->I_inv[3]*b->L[1] + b->I_inv[4]*b->L[2]; + b->w[2] = b->I_inv[2]*b->L[0] + b->I_inv[4]*b->L[1] + b->I_inv[5]*b->L[2]; + } + } +} + +void Shape::calculate_J_inv_and_w(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + double I11 = b->J[1]*b->J[1]; + double I22 = b->J[2]*b->J[2]; + double I44 = b->J[4]*b->J[4]; + + double I24 = b->J[2]*b->J[4]; + double I35 = b->J[3]*b->J[5]; + + double D = 1./(b->J[0]*I35 + 2*b->J[1]*I24 - b->J[0]*I44 - b->J[3]*I22 - b->J[5]*I11); + + b->J_inv[0] = D * (I35-I44); + b->J_inv[1] = D * (I24-b->J[1]*b->J[5]); + b->J_inv[2] = D * (b->J[1]*b->J[4]-b->J[3]*b->J[2]); + b->J_inv[3] = D * (b->J[0]*b->J[5]-I22); + b->J_inv[4] = D * (b->J[1]*b->J[2]-b->J[0]*b->J[4]); + b->J_inv[5] = D * (b->J[0]*b->J[3]-I11); + + b->w[0] = b->J_inv[0]*b->L[0] + b->J_inv[1]*b->L[1] + b->J_inv[2]*b->L[2]; + b->w[1] = b->J_inv[1]*b->L[0] + b->J_inv[3]*b->L[1] + b->J_inv[4]*b->L[2]; + b->w[2] = b->J_inv[2]*b->L[0] + b->J_inv[4]*b->L[1] + b->J_inv[5]*b->L[2]; + } + else if(b->particle_type == 2) { + b->J_inv[0] = 1./b->J[0]; + b->J_inv[1] = 0; + b->J_inv[2] = 0; + b->J_inv[3] = 1./b->J[3]; + b->J_inv[4] = 0; + b->J_inv[5] = 1./b->J[5]; + + b->w[0] = b->J_inv[0]*b->L[0] + b->J_inv[1]*b->L[1] + b->J_inv[2]*b->L[2]; + b->w[1] = b->J_inv[1]*b->L[0] + b->J_inv[3]*b->L[1] + b->J_inv[4]*b->L[2]; + b->w[2] = b->J_inv[2]*b->L[0] + b->J_inv[4]*b->L[1] + b->J_inv[5]*b->L[2]; + } + } +} + +void Shape::calculate_I_inv_and_w_with_K(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + double I11 = b->I[1]*b->I[1]; + double I22 = b->I[2]*b->I[2]; + double I44 = b->I[4]*b->I[4]; + + double I24 = b->I[2]*b->I[4]; + double I35 = b->I[3]*b->I[5]; + + double D = 1./(b->I[0]*I35 + 2*b->I[1]*I24 - b->I[0]*I44 - b->I[3]*I22 - b->I[5]*I11); + + b->I_inv[0] = D * (I35-I44); + b->I_inv[1] = D * (I24-b->I[1]*b->I[5]); + b->I_inv[2] = D * (b->I[1]*b->I[4]-b->I[3]*b->I[2]); + b->I_inv[3] = D * (b->I[0]*b->I[5]-I22); + b->I_inv[4] = D * (b->I[1]*b->I[2]-b->I[0]*b->I[4]); + b->I_inv[5] = D * (b->I[0]*b->I[3]-I11); + + b->w[0] = b->I_inv[0]*b->K[0] + b->I_inv[1]*b->K[1] + b->I_inv[2]*b->K[2]; + b->w[1] = b->I_inv[1]*b->K[0] + b->I_inv[3]*b->K[1] + b->I_inv[4]*b->K[2]; + b->w[2] = b->I_inv[2]*b->K[0] + b->I_inv[4]*b->K[1] + b->I_inv[5]*b->K[2]; + } + else if(b->particle_type == 2) { + b->I_inv[0] = 1./b->I[0]; + b->I_inv[1] = 0; + b->I_inv[2] = 0; + b->I_inv[3] = 1./b->I[3]; + b->I_inv[4] = 0; + b->I_inv[5] = 1./b->I[5]; + + b->w[0] = b->I_inv[0]*b->K[0] + b->I_inv[1]*b->K[1] + b->I_inv[2]*b->K[2]; + b->w[1] = b->I_inv[1]*b->K[0] + b->I_inv[3]*b->K[1] + b->I_inv[4]*b->K[2]; + b->w[2] = b->I_inv[2]*b->K[0] + b->I_inv[4]*b->K[1] + b->I_inv[5]*b->K[2]; + } + } +} +void Shape::calculate_J_inv_and_w_with_K(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + double I11 = b->J[1]*b->J[1]; + double I22 = b->J[2]*b->J[2]; + double I44 = b->J[4]*b->J[4]; + + double I24 = b->J[2]*b->J[4]; + double I35 = b->J[3]*b->J[5]; + + double D = 1./(b->J[0]*I35 + 2*b->J[1]*I24 - b->J[0]*I44 - b->J[3]*I22 - b->J[5]*I11); + + b->J_inv[0] = D * (I35-I44); + b->J_inv[1] = D * (I24-b->J[1]*b->J[5]); + b->J_inv[2] = D * (b->J[1]*b->J[4]-b->J[3]*b->J[2]); + b->J_inv[3] = D * (b->J[0]*b->J[5]-I22); + b->J_inv[4] = D * (b->J[1]*b->J[2]-b->J[0]*b->J[4]); + b->J_inv[5] = D * (b->J[0]*b->J[3]-I11); + + b->w[0] = b->J_inv[0]*b->K[0] + b->J_inv[1]*b->K[1] + b->J_inv[2]*b->K[2]; + b->w[1] = b->J_inv[1]*b->K[0] + b->J_inv[3]*b->K[1] + b->J_inv[4]*b->K[2]; + b->w[2] = b->J_inv[2]*b->K[0] + b->J_inv[4]*b->K[1] + b->J_inv[5]*b->K[2]; + } + else if(b->particle_type == 2) { + b->J_inv[0] = 1./b->J[0]; + b->J_inv[1] = 0; + b->J_inv[2] = 0; + b->J_inv[3] = 1./b->J[3]; + b->J_inv[4] = 0; + b->J_inv[5] = 1./b->J[5]; + + b->w[0] = b->J_inv[0]*b->K[0] + b->J_inv[1]*b->K[1] + b->J_inv[2]*b->K[2]; + b->w[1] = b->J_inv[1]*b->K[0] + b->J_inv[3]*b->K[1] + b->J_inv[4]*b->K[2]; + b->w[2] = b->J_inv[2]*b->K[0] + b->J_inv[4]*b->K[1] + b->J_inv[5]*b->K[2]; + } + } +} + +// Evolvers +void Shape::kick_linear(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + b->I_n[0] = b->I_e[0] + b->tau*( 2*b->I_e[2]*b->w[1] - 2*b->I_e[1]*b->w[2] - b->dI_e[0] ); + b->I_n[3] = b->I_e[3] + b->tau*(-2*b->I_e[4]*b->w[0] + 2*b->I_e[1]*b->w[2] - b->dI_e[3] ); + b->I_n[1] = b->I_e[1] + b->tau*( -b->I_e[2]*b->w[0] + b->I_e[4]*b->w[1] + (b->I_e[0]-b->I_e[3])*b->w[2] - b->dI_e[1]); + b->I_n[2] = b->I_e[2] + b->tau*( b->I_e[1]*b->w[0] - (2*b->I_e[0]+b->I_e[3])*b->w[1] - b->I_e[4]*b->w[2] - b->dI_e[2] ); + b->I_n[4] = b->I_e[4] + b->tau*( (b->I_e[0]+2*b->I_e[3])*b->w[0] - b->I_e[1]*b->w[1] + b->I_e[2]*b->w[2] - b->dI_e[4] ); + + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + + for(int i=0; i<6; i++) { + b->I[i] = b->I_p[i] + b->I_n[i]; + } + } + } +} +void Shape::kick_linear_J(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + b->J_n[0] = b->I_e[0] + b->tau*( 2*b->I_e[2]*b->w[1] - 2*b->I_e[1]*b->w[2] - b->dI_e[0] ); + b->J_n[3] = b->I_e[3] + b->tau*(-2*b->I_e[4]*b->w[0] + 2*b->I_e[1]*b->w[2] - b->dI_e[3] ); + b->J_n[1] = b->I_e[1] + b->tau*( -b->I_e[2]*b->w[0] + b->I_e[4]*b->w[1] + (b->I_e[0]-b->I_e[3])*b->w[2] - b->dI_e[1]); + b->J_n[2] = b->I_e[2] + b->tau*( b->I_e[1]*b->w[0] - (2*b->I_e[0]+b->I_e[3])*b->w[1] - b->I_e[4]*b->w[2] - b->dI_e[2] ); + b->J_n[4] = b->I_e[4] + b->tau*( (b->I_e[0]+2*b->I_e[3])*b->w[0] - b->I_e[1]*b->w[1] + b->I_e[2]*b->w[2] - b->dI_e[4] ); + + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + + for(int i=0; i<6; i++) { + b->J[i] = b->I_p[i] + b->J_n[i]; + } + } + } +} + +void Shape::kick_linear_discrete(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + for(int k=0; k<5; k++) { + b->dI_e[k] = (b->I_e[k]-b->I_e_prev[k]) / dt; + } + + b->I_n[0] = b->I_e[0] + b->tau*( 2*b->I_e[2]*b->w[1] - 2*b->I_e[1]*b->w[2] - b->dI_e[0] ); + b->I_n[3] = b->I_e[3] + b->tau*(-2*b->I_e[4]*b->w[0] + 2*b->I_e[1]*b->w[2] - b->dI_e[3] ); + b->I_n[1] = b->I_e[1] + b->tau*( -b->I_e[2]*b->w[0] + b->I_e[4]*b->w[1] + (b->I_e[0]-b->I_e[3])*b->w[2] - b->dI_e[1]); + b->I_n[2] = b->I_e[2] + b->tau*( b->I_e[1]*b->w[0] - (2*b->I_e[0]+b->I_e[3])*b->w[1] - b->I_e[4]*b->w[2] - b->dI_e[2] ); + b->I_n[4] = b->I_e[4] + b->tau*( (b->I_e[0]+2*b->I_e[3])*b->w[0] - b->I_e[1]*b->w[1] + b->I_e[2]*b->w[2] - b->dI_e[4] ); + + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + + for(int i=0; i<6; i++) { + b->I[i] = b->I_p[i] + b->I_n[i]; + } + } + } +} +void Shape::kick_linear_discrete_J(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + for(int k=0; k<5; k++) { + b->dI_e[k] = (b->I_e[k]-b->I_e_prev[k]) / dt; + } + + b->J_n[0] = b->I_e[0] + b->tau*( 2*b->I_e[2]*b->w[1] - 2*b->I_e[1]*b->w[2] - b->dI_e[0] ); + b->J_n[3] = b->I_e[3] + b->tau*(-2*b->I_e[4]*b->w[0] + 2*b->I_e[1]*b->w[2] - b->dI_e[3] ); + b->J_n[1] = b->I_e[1] + b->tau*( -b->I_e[2]*b->w[0] + b->I_e[4]*b->w[1] + (b->I_e[0]-b->I_e[3])*b->w[2] - b->dI_e[1]); + b->J_n[2] = b->I_e[2] + b->tau*( b->I_e[1]*b->w[0] - (2*b->I_e[0]+b->I_e[3])*b->w[1] - b->I_e[4]*b->w[2] - b->dI_e[2] ); + b->J_n[4] = b->I_e[4] + b->tau*( (b->I_e[0]+2*b->I_e[3])*b->w[0] - b->I_e[1]*b->w[1] + b->I_e[2]*b->w[2] - b->dI_e[4] ); + + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + + for(int i=0; i<6; i++) { + b->J[i] = b->I_p[i] + b->J_n[i]; + } + } + } +} + +void Shape::kick_direct(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + for(int k=0; k<5; k++) { + b->I_n[k] += b->dI_n[k]*dt; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + + for(int k=0; k<6; k++) { + b->I[k] = b->I_p[k] + b->I_n[k]; + } + } + } +} +void Shape::kick_direct_J(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + for(int k=0; k<5; k++) { + b->J_n[k] += b->dI_n[k]*dt; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + + for(int k=0; k<6; k++) { + b->J[k] = b->I_p[k] + b->J_n[k]; + } + } + } +} + +void Shape::deform_and_rotate(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + if(b->tau > 0) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + double w = sqrt(w2); + + double dt_step = b->dt_rot; + + double wdt = 0.5*w*dt_step; + double cosa = cos(wdt); + double sina = sin(wdt); + + array q0 = {}; + q0[0] = 1.; + + if(w > 0) { + double w_1 = 1/w; + + q0[0] = cosa; + q0[1] = sina*b->w[0]*w_1; + q0[2] = sina*b->w[1]*w_1; + q0[3] = sina*b->w[2]*w_1; + } + + if(b->isLinear) { + for(int k=0; k<5; k++) { + double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; + b->I_n[k] = b->I_e[k] - b->tau*dIe; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + + array I2 = {}; + rotate_tensor(q0, b->I_n, I2); + for(int k=0; k<5; k++) { + b->I_n[k] = I2[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + } + else { + double expo = b->expo; + + if(dt < 0) { + array I1 = {}; + rotate_tensor(q0, b->I_n, I1); + for(int k=0; k<5; k++) { + b->I_n[k] = I1[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + } + + for(int k=0; k<5; k++) { + double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; + b->I_n[k] = b->I_e[k] + (b->I_n[k] - b->I_e_prev[k])*expo - b->tau*dIe*(1-expo); + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + + if(dt > 0) { + array I2 = {}; + rotate_tensor(q0, b->I_n, I2); + for(int k=0; k<5; k++) { + b->I_n[k] = I2[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + } + } + } + else { + for(int k=0; k<5; k++) { + b->I_n[k] = b->I_e[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + } + + for(int k=0; k<6; k++) { + b->I[k] = b->I_p[k] + b->I_n[k]; + } + } + } +} +void Shape::deform_and_rotate_half(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + if(b->tau > 0) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + double w = sqrt(w2); + + double dt_step = b->dth_rot; + + double wdt = 0.5*w*dt_step; + double cosa = cos(wdt); + double sina = sin(wdt); + + array q0 = {}; + q0[0] = 1.; + + if(w > 0) { + double w_1 = 1/w; + + q0[0] = cosa; + q0[1] = sina*b->w[0]*w_1; + q0[2] = sina*b->w[1]*w_1; + q0[3] = sina*b->w[2]*w_1; + } + + if(b->isLinear) { + for(int k=0; k<5; k++) { + double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; + b->I_n[k] = b->I_e[k] - b->tau*dIe; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + + array I2 = {}; + rotate_tensor(q0, b->I_n, I2); + for(int k=0; k<5; k++) { + b->I_n[k] = I2[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + } + else { + double expo = b->expoh; + + if(dt < 0) { + array I1 = {}; + rotate_tensor(q0, b->I_n, I1); + for(int k=0; k<5; k++) { + b->I_n[k] = I1[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + } + + for(int k=0; k<5; k++) { + double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; + b->I_n[k] = b->I_e[k] + (b->I_n[k] - b->I_e_prev[k])*expo - b->tau*dIe*(1-expo); + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + + if(dt > 0) { + array I2 = {}; + rotate_tensor(q0, b->I_n, I2); + for(int k=0; k<5; k++) { + b->I_n[k] = I2[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + } + } + } + else { + for(int k=0; k<5; k++) { + b->I_n[k] = b->I_e[k]; + } + b->I_n[5] = -(b->I_n[0]+b->I_n[3]); + } + + for(int k=0; k<6; k++) { + b->I[k] = b->I_p[k] + b->I_n[k]; + } + } + } +} + +void Shape::deform_and_rotate_J(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + if(b->tau > 0) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + double w = sqrt(w2); + + double dt_step = b->dt_rot; + + double wdt = 0.5*w*dt_step; + double cosa = cos(wdt); + double sina = sin(wdt); + + array q0 = {}; + q0[0] = 1.; + + if(w > 0) { + double w_1 = 1/w; + + q0[0] = cosa; + q0[1] = sina*b->w[0]*w_1; + q0[2] = sina*b->w[1]*w_1; + q0[3] = sina*b->w[2]*w_1; + } + + if(b->isLinear) { + for(int k=0; k<5; k++) { + double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; + b->J_n[k] = b->I_e[k] - b->tau*dIe; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + + array I2 = {}; + rotate_tensor(q0, b->J_n, I2); + for(int k=0; k<5; k++) { + b->J_n[k] = I2[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + } + else { + double expo = b->expo; + + if(dt < 0) { + array I1 = {}; + rotate_tensor(q0, b->J_n, I1); + for(int k=0; k<5; k++) { + b->J_n[k] = I1[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + } + + for(int k=0; k<5; k++) { + double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; + b->J_n[k] = b->I_e[k] + (b->J_n[k] - b->I_e_prev[k])*expo - b->tau*dIe*(1-expo); + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + + if(dt > 0) { + array I2 = {}; + rotate_tensor(q0, b->J_n, I2); + for(int k=0; k<5; k++) { + b->J_n[k] = I2[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + } + } + } + else { + for(int k=0; k<5; k++) { + b->J_n[k] = b->I_e[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + } + + for(int k=0; k<6; k++) { + b->J[k] = b->I_p[k] + b->J_n[k]; + } + } + } +} +void Shape::deform_and_rotate_J_half(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + if(b->tau > 0) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + double w = sqrt(w2); + + double dt_step = b->dth_rot; + + double wdt = 0.5*w*dt_step; + double cosa = cos(wdt); + double sina = sin(wdt); + + array q0 = {}; + q0[0] = 1.; + + if(w > 0) { + double w_1 = 1/w; + + q0[0] = cosa; + q0[1] = sina*b->w[0]*w_1; + q0[2] = sina*b->w[1]*w_1; + q0[3] = sina*b->w[2]*w_1; + } + + if(b->isLinear) { + for(int k=0; k<5; k++) { + double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; + b->J_n[k] = b->I_e[k] - b->tau*dIe; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + + array I2 = {}; + rotate_tensor(q0, b->J_n, I2); + for(int k=0; k<5; k++) { + b->J_n[k] = I2[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + } + else { + double expo = b->expoh; + + if(dt < 0) { + array I1 = {}; + rotate_tensor(q0, b->J_n, I1); + for(int k=0; k<5; k++) { + b->J_n[k] = I1[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + } + + for(int k=0; k<5; k++) { + double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; + b->J_n[k] = b->I_e[k] + (b->J_n[k] - b->I_e_prev[k])*expo - b->tau*dIe*(1-expo); + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + + if(dt > 0) { + array I2 = {}; + rotate_tensor(q0, b->J_n, I2); + for(int k=0; k<5; k++) { + b->J_n[k] = I2[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + } + } + } + else { + for(int k=0; k<5; k++) { + b->J_n[k] = b->I_e[k]; + } + b->J_n[5] = -(b->J_n[0]+b->J_n[3]); + } + + for(int k=0; k<6; k++) { + b->J[k] = b->I_p[k] + b->J_n[k]; + } + } + } +} + +void Shape::rotate_tensor(array &q, array &A, array &B) { + // Quaternion to Rotation matrix + double q00 = q[0] * q[0]; + double q11 = q[1] * q[1]; + double q22 = q[2] * q[2]; + double q33 = q[3] * q[3]; + double q01 = q[0] * q[1]; + double q02 = q[0] * q[2]; + double q03 = q[0] * q[3]; + double q12 = q[1] * q[2]; + double q13 = q[1] * q[3]; + double q23 = q[2] * q[3]; + + double r00 = 2 * (q00 + q11) - 1; + double r01 = 2 * (q12 - q03); + double r02 = 2 * (q13 + q02); + + double r10 = 2 * (q12 + q03); + double r11 = 2 * (q00 + q22) - 1; + double r12 = 2 * (q23 - q01); + + double r20 = 2 * (q13 - q02); + double r21 = 2 * (q23 + q01); + double r22 = 2 * (q00 + q33) - 1; + + // RA + double x00 = r00*A[0]+r01*A[1]+r02*A[2]; + double x01 = r00*A[1]+r01*A[3]+r02*A[4]; + double x02 = r00*A[2]+r01*A[4]+r02*A[5]; + + double x10 = r10*A[0]+r11*A[1]+r12*A[2]; + double x11 = r10*A[1]+r11*A[3]+r12*A[4]; + double x12 = r10*A[2]+r11*A[4]+r12*A[5]; + + // RAR^T + B[0] = x00*r00+x01*r01+x02*r02; + B[1] = x00*r10+x01*r11+x02*r12; + B[2] = x00*r20+x01*r21+x02*r22; + B[3] = x10*r10+x11*r11+x12*r12; + B[4] = x10*r20+x11*r21+x12*r22; +} + +void Shape::copy_I_e_r_to_I_e_rh(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->I_e_rh[k] = b->I_e_r[k]; + } + } +} + +void Shape::copy_I_to_J(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->J_n[k] = b->I_n[k]; + b->J[k] = b->I[k]; + } + } +} + +void Shape::memorize_I(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->I_n_prev[k] = b->I_n[k]; + } + } +} +void Shape::reset_I(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->I_n[k] = b->I_n_prev[k]; + b->I[k] = b->I_p[k] + b->I_n[k]; + } + } +} + +void Shape::memorize_J(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->I_n_prev[k] = b->J_n[k]; + } + } +} +void Shape::reset_J(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->J_n[k] = b->I_n_prev[k]; + b->J[k] = b->I_p[k] + b->J_n[k]; + } + } +} + +void Shape::backup_I_e(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->I_e_prev_bu[k] = b->I_e[k]; + } + } +} +void Shape::set_I_e_prev_to_backup(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<6; k++) { + b->I_e_prev[k] = b->I_e_prev_bu[k]; + } + } +} + + + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Spin.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Spin.cpp new file mode 100755 index 0000000000..3e8ce9a38b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Spin.cpp @@ -0,0 +1,177 @@ +#include "Spin.h" + +// Initializers +Spin::Spin() { + ; +} + +// Calculators +void Spin::calculate_w(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + b->w[0] = b->I_inv[0]*b->L[0] + b->I_inv[1]*b->L[1] + b->I_inv[2]*b->L[2]; + b->w[1] = b->I_inv[1]*b->L[0] + b->I_inv[3]*b->L[1] + b->I_inv[4]*b->L[2]; + b->w[2] = b->I_inv[2]*b->L[0] + b->I_inv[4]*b->L[1] + b->I_inv[5]*b->L[2]; + } + else { + b->w[0] = 0; + b->w[1] = 0; + b->w[2] = 0; + } + } +} +void Spin::calculate_w_with_J(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + b->w[0] = b->J_inv[0]*b->L[0] + b->J_inv[1]*b->L[1] + b->J_inv[2]*b->L[2]; + b->w[1] = b->J_inv[1]*b->L[0] + b->J_inv[3]*b->L[1] + b->J_inv[4]*b->L[2]; + b->w[2] = b->J_inv[2]*b->L[0] + b->J_inv[4]*b->L[1] + b->J_inv[5]*b->L[2]; + } + else { + b->w[0] = 0; + b->w[1] = 0; + b->w[2] = 0; + } + } +} +void Spin::calculate_w_with_K(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + b->w[0] = b->I_inv[0]*b->K[0] + b->I_inv[1]*b->K[1] + b->I_inv[2]*b->K[2]; + b->w[1] = b->I_inv[1]*b->K[0] + b->I_inv[3]*b->K[1] + b->I_inv[4]*b->K[2]; + b->w[2] = b->I_inv[2]*b->K[0] + b->I_inv[4]*b->K[1] + b->I_inv[5]*b->K[2]; + } + else { + b->w[0] = 0; + b->w[1] = 0; + b->w[2] = 0; + } + } +} + +void Spin::calculate_L(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + b->L[0] = b->I[0]*b->w[0]+b->I[1]*b->w[1]+b->I[2]*b->w[2]; + b->L[1] = b->I[1]*b->w[0]+b->I[3]*b->w[1]+b->I[4]*b->w[2]; + b->L[2] = b->I[2]*b->w[0]+b->I[4]*b->w[1]+b->I[5]*b->w[2]; + } + else { + b->L[0] = 0; + b->L[1] = 0; + b->L[2] = 0; + } + } +} +void Spin::init_K(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + b->K[k] = b->L[k]; + } + } +} + +void Spin::memorize_w(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + b->w_prev[k] = b->w[k]; + } + } +} +void Spin::reset_w(vector &bodies) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + for(int k=0; k<3; k++) { + b->w[k] = b->w_prev[k]; + } + } +} + +void Spin::kick_L(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + for(int k=0; k<3; k++) { + b->L[k] += b->T[k]*dt; + } + } + } +} +void Spin::kick_K(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + for(int k=0; k<3; k++) { + b->K[k] += b->T[k]*dt; + } + } + } +} + +void Spin::kick_L_mb(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + if(b->a_mb > 0) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + + //double expo = exp(-b->a_mb * w2 * dt); + //for(int k=0; k<3; k++) { + // b->L[k] = b->L[k] * expo; + //} + + double x = b->a_mb * w2 * dt; + for(int k=0; k<3; k++) { + b->L[k] = b->L[k] * (1-x); + } + } + } + } +} +void Spin::kick_K_mb(vector &bodies, double dt) { + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + if(b->a_mb > 0) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + + //double expo = exp(-b->a_mb * w2 * dt); + //for(int k=0; k<3; k++) { + // b->K[k] = b->K[k] * expo; + //} + + double x = b->a_mb * w2 * dt; + for(int k=0; k<3; k++) { + b->K[k] = b->K[k] * (1-x); + } + } + } + } +} + +// Diagnostics +double Spin::get_kinetic_energy(vector &bodies) { + double E = 0; + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + double dwxIdwx = b->w[0]*(b->w[0]*b->I[0] + b->w[1]*b->I[1] + b->w[2]*b->I[2]); + double dwyIdwy = b->w[1]*(b->w[0]*b->I[1] + b->w[1]*b->I[3] + b->w[2]*b->I[4]); + double dwzIdwz = b->w[2]*(b->w[0]*b->I[2] + b->w[1]*b->I[4] + b->w[2]*b->I[5]); + double myE = 0.5 * (dwxIdwx + dwyIdwy + dwzIdwz); + E += myE; + } + } + return E; +} + +array Spin::get_angular_momentum(vector &bodies) { + array L = {}; + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type >= 2) { + double Lx = b->I[0]*b->w[0] + b->I[1]*b->w[1] + b->I[2]*b->w[2]; + double Ly = b->I[1]*b->w[0] + b->I[3]*b->w[1] + b->I[4]*b->w[2]; + double Lz = b->I[2]*b->w[0] + b->I[4]*b->w[1] + b->I[5]*b->w[2]; + L[0] += Lx; + L[1] += Ly; + L[2] += Lz; + } + } + return L; +} + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Tidy.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Tidy.cpp new file mode 100755 index 0000000000..bb39797631 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Tidy.cpp @@ -0,0 +1,589 @@ +#include "Tidy.h" + +// Setters and Getters +void Tidy::set_model_time(double t) { + this->t = t; +} +double Tidy::get_model_time() { + return t; +} + +void Tidy::set_particles(vector &bodies) { + this->bodies.clear(); + this->bodies = bodies; +} +void Tidy::set_particles(vector< array > &d) { + this->bodies.clear(); + + int N = d.size(); + this->bodies.resize(N); + + for(int i=0; i &name, vector &id, vector< array > &d) { + this->bodies.clear(); + + int N = d.size(); + this->bodies.resize(N); + + for(int i=0; i Tidy::get_particles() { + return this->bodies; +} + +void Tidy::set_tidal_model(int tidal_model) { + this->tidal_model = tidal_model; +} +int Tidy::get_tidal_model() { + return tidal_model; +} + +void Tidy::set_collision_mode(int collision_mode) { + this->collision_mode = collision_mode; +} +int Tidy::get_collision_mode() { + return collision_mode; +} + +void Tidy::set_roche_mode(int roche_mode) { + this->roche_mode = roche_mode; +} +int Tidy::get_roche_mode() { + return roche_mode; +} + +void Tidy::set_encounter_mode() { + encounter_mode = 0; + if(collision_mode > 0 || roche_mode > 0) encounter_mode = 1; +} +int Tidy::get_encounter_mode() { + return encounter_mode; +} + +void Tidy::set_pn_order(int pn_order) { + this->pn_order = pn_order; +} +int Tidy::get_pn_order() { + return pn_order; +} + +void Tidy::set_speed_of_light(double c) { + this->speed_of_light = c; +} +double Tidy::get_speed_of_light() { + return speed_of_light; +} + +void Tidy::set_magnetic_braking(int b) { + this->magnetic_braking = b; +} +int Tidy::get_magnetic_braking() { + return magnetic_braking; +} + +void Tidy::set_dt_mode(int dt_mode) { + this->dt_mode = dt_mode; +} +double Tidy::get_dt_mode() { + return dt_mode; +} + +void Tidy::set_dt_const(double dt_const) { + this->dt_const = dt_const; +} +double Tidy::get_dt_const() { + return dt_const; +} + +void Tidy::set_eta(double eta) { + this->eta = eta; +} +double Tidy::get_eta() { + return eta; +} + +void Tidy::set_dt_prev(double dt_prev) { + timestep_ptr->set_dt_prev(dt_prev); + this->dt_prev = timestep_ptr->dt_prev; +} +double Tidy::get_dt_prev() { + this->dt_prev = timestep_ptr->dt_prev; + return dt_prev; +} + +void Tidy::set_n_iter(int n_iter) { + this->n_iter = n_iter; +} +int Tidy::get_n_iter() { + this->n_iter = evolver_ptr->n_iter; + return this->n_iter; +} + +void Tidy::set_num_integration_step(int num_integration_step) { + this->num_integration_step = num_integration_step; +} +int Tidy::get_num_integration_step() { + return num_integration_step; +} + +void Tidy::set_dt_sgn(int dt_sgn) { + this->dt_sgn = dt_sgn; + timestep_ptr->set_dt_sgn(this->dt_sgn); +} + +// Initializers +Tidy::Tidy() { + t = 0.; + bodies.clear(); + + tidal_model = 0; + + collision_mode = 0; + roche_mode = 0; + encounter_mode = 0; + + pn_order = 0; + speed_of_light = 1e100; + + magnetic_braking = 0; + + dt_mode = 1; + dt_const = 0.015625; + eta = 0.0625; + num_integration_step = 0; + + n_iter = 1; +} +Tidy::~Tidy() { + ; +} + +// Committers +void Tidy::commit_parameters() { + set_encounter_mode(); + set_pointers(); + upload_parameters(); + initialize(); + this->dt_prev = timestep_ptr->dt_prev; +} +void Tidy::commit_particles() { + int N = bodies.size(); + for(int i=0; iinitialize(bodies, force_ptr); + } + else { + commit_parameters(); + } +} +void Tidy::set_pointers() { + force_ptr = &force; + + switch(dt_mode) { + case 0: + timestep_ptr = ×tep_const; + break; + case 1: + if(this->tidal_model == 3) { + timestep_ptr = ×tep_direct; + } + else { + timestep_ptr = ×tep_adapt; + } + break; + default: + if(this->tidal_model == 3) { + timestep_ptr = ×tep_direct_weight; + } + else { + timestep_ptr = ×tep_adapt_weight; + } + break; + } + + switch(tidal_model) { + case 0: + switch(encounter_mode) { + case 0: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_nbody; + break; + default: + evolver_ptr = &evolver_nbody; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_nbody_pn; + break; + default: + evolver_ptr = &evolver_nbody_pn; + break; + } + break; + } + break; + default: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_nbody_col; + break; + default: + evolver_ptr = &evolver_nbody_col; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_nbody_col_pn; + break; + default: + evolver_ptr = &evolver_nbody_col_pn; + break; + } + break; + } + break; + } + break; + case 1: + switch(encounter_mode) { + case 0: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_equilibrium; + break; + default: + evolver_ptr = &evolver_equilibrium_mb; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_equilibrium_pn; + break; + default: + evolver_ptr = &evolver_equilibrium_pn_mb; + break; + } + break; + } + break; + default: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_equilibrium_col; + break; + default: + evolver_ptr = &evolver_equilibrium_col_mb; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_equilibrium_col_pn; + break; + default: + evolver_ptr = &evolver_equilibrium_col_pn_mb; + break; + } + break; + } + break; + } + break; + case 2: + switch(encounter_mode) { + case 0: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_linear; + break; + default: + evolver_ptr = &evolver_linear_mb; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_linear_pn; + break; + default: + evolver_ptr = &evolver_linear_pn_mb; + break; + } + break; + } + break; + default: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_linear_col; + break; + default: + evolver_ptr = &evolver_linear_col_mb; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_linear_col_pn; + break; + default: + evolver_ptr = &evolver_linear_col_pn_mb; + break; + } + break; + } + break; + } + break; + case 3: + switch(encounter_mode) { + case 0: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_direct; + break; + default: + evolver_ptr = &evolver_direct_mb; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_direct_pn; + break; + default: + evolver_ptr = &evolver_direct_pn_mb; + break; + } + break; + } + break; + default: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_direct_col; + break; + default: + evolver_ptr = &evolver_direct_col_mb; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_direct_col_pn; + break; + default: + evolver_ptr = &evolver_direct_col_pn_mb; + break; + } + break; + } + break; + } + break; + default: + switch(encounter_mode) { + case 0: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_creep; + break; + default: + evolver_ptr = &evolver_creep_mb; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_creep_pn; + break; + default: + evolver_ptr = &evolver_creep_pn_mb; + break; + } + break; + } + break; + default: + switch(pn_order) { + case 0: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_creep_col; + break; + default: + evolver_ptr = &evolver_creep_col_mb; + break; + } + break; + default: + switch(magnetic_braking) { + case 0: + evolver_ptr = &evolver_creep_col_pn; + break; + default: + evolver_ptr = &evolver_creep_col_pn_mb; + break; + } + break; + } + break; + } + break; + } +} + +void Tidy::upload_parameters() { + force_ptr->set_pn_order(pn_order); + force_ptr->set_speed_of_light(speed_of_light); + + timestep_ptr->set_dt_const(dt_const); + timestep_ptr->set_eta(eta); + + evolver_ptr->set_n_iter(n_iter); + + evolver_ptr->set_collision_mode(collision_mode); + evolver_ptr->set_roche_mode(roche_mode); +} +void Tidy::initialize() { + evolver_ptr->initialize(bodies, force_ptr); + timestep_ptr->initialize(bodies); +} + +// Collision handling +bool Tidy::is_collision_detected() { + return force_ptr->collision_detected; +} +vector< array > Tidy::get_collision_indices() { + return force_ptr->index_collisions; +} +bool Tidy::get_collision_flag() { + return evolver_ptr->collision_flag; +} + +bool Tidy::is_roche_detected() { + return force_ptr->roche_detected; +} +vector< array > Tidy::get_roche_indices() { + return force_ptr->index_roche; +} +bool Tidy::get_roche_flag() { + return evolver_ptr->roche_flag; +} + +// Shape handling +void Tidy::set_to_spherical_shape() { + shape.set_permanent_shape(bodies); + shape.set_to_spherical_shape(bodies); + shape.calculate_I_inv(bodies); +} +void Tidy::set_to_equilibrium_shape() { + force.update_tidal_deformation(bodies); + force.update_centrifugal_deformation(bodies); + force.update_equilibrium_tensor(bodies); + + shape.set_permanent_shape(bodies); + shape.set_to_equilibrium_shape(bodies); + shape.calculate_I_inv(bodies); +} +void Tidy::update_angular_momentum() { + spin.calculate_L(bodies); + spin.init_K(bodies); + shape.init_J(bodies); +} + +// Get diagnostics +array Tidy::get_center_of_mass() { + return evolver_ptr->get_center_of_mass(bodies); +} +array Tidy::get_center_of_mass_velocity() { + return evolver_ptr->get_center_of_mass_velocity(bodies); +} +array Tidy::get_orbital_angular_momentum() { + return evolver_ptr->get_orbital_angular_momentum(bodies); +} +array Tidy::get_spin_angular_momentum() { + return evolver_ptr->get_spin_angular_momentum(bodies); +} +double Tidy::get_orbital_kinetic_energy() { + return evolver_ptr->get_orbital_kinetic_energy(bodies); +} +double Tidy::get_spin_kinetic_energy() { + return evolver_ptr->get_spin_kinetic_energy(bodies); +} +double Tidy::get_potential_energy() { + return evolver_ptr->get_potential_energy(bodies); +} +array Tidy::get_angular_momentum() { + return evolver_ptr->get_angular_momentum(bodies); +} +double Tidy::get_energy() { + return evolver_ptr->get_energy(bodies); +} + +// Top level evolve functions +void Tidy::evolve_model(double t_end) { + evolver_ptr->assign_vectors(bodies, force_ptr); + timestep_ptr->set_dt_sgn(dt_sgn); + + evolver_ptr->evolve_model(t, t_end, bodies, force_ptr, timestep_ptr); + + num_integration_step += evolver_ptr->num_integration_step; +} +void Tidy::evolve_model(int N_step) { + evolver_ptr->assign_vectors(bodies, force_ptr); + timestep_ptr->set_dt_sgn(dt_sgn); + + evolver_ptr->evolve_model(t, N_step, bodies, force_ptr, timestep_ptr); + + num_integration_step += evolver_ptr->num_integration_step; +} + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timer.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timer.cpp new file mode 100755 index 0000000000..759de9ac7e --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Timer.cpp @@ -0,0 +1,41 @@ +#include "Timer.h" + +Timer::Timer() { + t_cpu = 0; + timerStarted = false; +} +void Timer::start() { + gettimeofday(&Tvalue,&dummy); + timerStarted = true; +} +void Timer::stop() { + if(timerStarted == false) t_cpu = 0; + else { + struct timeval Tvalue2; + struct timezone dummy2; + gettimeofday(&Tvalue2,&dummy2); + double startTime = ((double) Tvalue.tv_sec +1.e-6*((double) Tvalue.tv_usec)); + double endTime = ((double) Tvalue2.tv_sec +1.e-6*((double) Tvalue2.tv_usec)); + t_cpu = endTime-startTime; + timerStarted = false; + } +} +double Timer::read() { + if(timerStarted == false) t_cpu = 0; + else { + struct timeval Tvalue2; + struct timezone dummy2; + gettimeofday(&Tvalue2,&dummy2); + double startTime = ((double) Tvalue.tv_sec +1.e-6*((double) Tvalue.tv_usec)); + double endTime = ((double) Tvalue2.tv_sec +1.e-6*((double) Tvalue2.tv_usec)); + t_cpu = endTime-startTime; + } + return t_cpu; +} +double Timer::get() { + return t_cpu; +} + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt.cpp new file mode 100644 index 0000000000..9d71d4b8b4 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt.cpp @@ -0,0 +1,53 @@ +#include "Timestep_adapt.h" + +// Calculators +void Timestep_adapt::calculate_shared_adaptive_minimum_timestep_orbital(vector &bodies) { + this->h = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + if(bi->particle_type > 0 || bj->particle_type > 0) { + + double mu = bi->m + bj->m; + + array dr, dv; + + for(int k=0; k<3; k++) { + dr[k] = bi->r[k] - bj->r[k]; + dv[k] = bi->v[k] - bj->v[k]; + } + + double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); + + double dr4 = dr2*dr2; + + double dt1_4 = mu*mu/(dr4*dr2); + double dt2_4 = dv2*dv2/dr4; + + double P_4 = max(dt1_4, dt2_4); + + if(P_4 > this->h) this->h = P_4; + } + } + } + + this->h = 1./sqrt(sqrt(this->h)); +} + +void Timestep_adapt::initialize(vector &bodies) { + ; +} +double Timestep_adapt::get_timestep(vector &bodies) { + calculate_shared_adaptive_minimum_timestep_orbital(bodies); + h *= eta; + h *= dt_sgn; + return h; +} + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt_weight.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt_weight.cpp new file mode 100644 index 0000000000..d26d1882b3 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt_weight.cpp @@ -0,0 +1,154 @@ +#include "Timestep_adapt_weight.h" + +// Calculators +void Timestep_adapt_weight::calculate_shared_adaptive_weighted_timestep_orbital(vector &bodies) { + double wsum = 0; + double wh2sum = 0; + + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + if(bi->particle_type > 0 || bj->particle_type > 0) { + + double mu = bi->m + bj->m; + + array dr, dv; + + for(int k=0; k<3; k++) { + dr[k] = bi->r[k] - bj->r[k]; + dv[k] = bi->v[k] - bj->v[k]; + } + + double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); + + double dr4 = dr2*dr2; + + double dt1_4 = mu*mu/(dr4*dr2); + double dt2_4 = dv2*dv2/dr4; + + //--------------------------------------------------------------- + + double P_4 = dt1_4 + dt2_4; + double P_2 = sqrt(P_4); + double P_8 = P_4*P_4; + double P_10 = P_8*P_2; + + //--------------------------------------------------------------- + + double wh2 = P_8; + double w = P_10; + + //--------------------------------------------------------------- + + wsum += w; + wh2sum += wh2; + } + } + } + + this->h2 = eta2 * wh2sum/wsum; +} +void Timestep_adapt_weight::calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(vector &bodies) { + double h_8 = 0; + double h_10 = 0; + double h_9_dh = 0; + double h_11_dh = 0; + + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + if(bi->particle_type > 0 || bj->particle_type > 0) { + + double mu = bi->m + bj->m; + + array dr, dv, da; + + for(int k=0; k<3; k++) { + dr[k] = bj->r[k] - bi->r[k]; + dv[k] = bj->v[k] - bi->v[k]; + da[k] = bj->a[k] - bi->a[k]; + } + + double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); + + double rdotv = inner_product(dr.begin(), dr.end(), dv.begin(), 0.); + double vdota = inner_product(dv.begin(), dv.end(), da.begin(), 0.); + + //------------------------------------------ + + double h_4_ra = mu*mu/(dr2*dr2*dr2); + + double h_1_dh_ra = 1.5*rdotv/dr2; + double h_5_dh_ra = h_4_ra * h_1_dh_ra; + + //------------------------------------------ + + double h_2_rv = dv2/dr2; + double h_4_rv = h_2_rv*h_2_rv; + + double h_3_dh_rv = (rdotv * h_2_rv - vdota) / dr2; + double h_5_dh_rv = h_2_rv * h_3_dh_rv; + + //------------------------------------------ + + double T_4 = h_4_ra + h_4_rv; + + double T_8 = T_4*T_4; + double T_2 = sqrt(T_4); + double T_10 = T_8*T_2; + + double T_5_dT = h_5_dh_ra + h_5_dh_rv; + + double T_9_dT = T_4 * T_5_dT; + double T_11_dT = T_2 * T_9_dT; + + //------------------------------------------ + + h_8 += T_8; + h_10 += T_10; + + h_9_dh += T_9_dT; + h_11_dh += T_11_dT; + } + } + } + + double T = sqrt(h_8 / h_10); + double dT = 0.5 / T * ( (2-alpha)*h_9_dh/h_10 - h_8/(h_10*h_10)*-alpha*h_11_dh ); + + T *= eta; + dT *= eta; + + this->h = T; + this->dh = dT; +} + +void Timestep_adapt_weight::initialize(vector &bodies) { + calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(bodies); + + if(dt_sgn > 0) { + this->dt_prev = this->h / (1+0.5*this->dh); + } + else { + this->dt_prev = this->h / (1-0.5*this->dh); + } + + this->dt_prev *= dt_sgn; +} +double Timestep_adapt_weight::get_timestep(vector &bodies) { + calculate_shared_adaptive_weighted_timestep_orbital(bodies); + + this->dt_next = this->h2 / this->dt_prev; + + double f2 = this->dt_next*this->dt_next / this->h2; + if(f2 > this->fp2_bound) this->dt_next = dt_sgn * sqrt(this->h2); + else if(f2 < this->fm2_bound) this->dt_next = dt_sgn * sqrt(this->h2); + + this->dt_prev = this->dt_next; + + return this->dt_next; +} + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_base.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_base.cpp new file mode 100644 index 0000000000..98bcfcb3d3 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_base.cpp @@ -0,0 +1,76 @@ +#include "Timestep_base.h" + +// Initializer +Timestep_base::Timestep_base() { + set_default_values(); +} + +void Timestep_base::set_default_values() { + this->dt_const = 0.015625; + this->eta = 0.0625; + this->eta2 = this->eta*this->eta; + + this->h = 0; + this->h2 = 0; + this->dh = 0; + this->h_spin = 0; + this->h_shape = 0; + + this->dt_prev = 0; + this->dt_next = 0; + + this->fp_bound = 4; + this->fm_bound = 0.25; + this->fp2_bound = this->fp_bound*this->fp_bound; + this->fm2_bound = this->fm_bound*this->fm_bound; + this->alpha = 10; + this->dt_sgn = 1; +} + +// Setters and Getters +void Timestep_base::set_dt_const(double dt_const) { + this->dt_const = dt_const; +} +double Timestep_base::get_dt_const() { + return dt_const; +} + +void Timestep_base::set_eta(double eta) { + this->eta = eta; + this->eta2 = this->eta*this->eta; +} +double Timestep_base::get_eta() { + return eta; +} + +void Timestep_base::commit() { + dt_const = abs(dt_const); + + if(dt_sgn > 0) { + if(dt_prev < 0) dt_prev = abs(dt_prev); + } + else { + if(dt_prev > 0) dt_prev = -dt_prev; + } +} + +void Timestep_base::set_dt_sgn(double t0, double t1) { + dt_sgn = (t1 >= t0) ? 1 : -1; + commit(); +} +void Timestep_base::set_dt_sgn(int dt_sgn) { + this->dt_sgn = dt_sgn; + commit(); +} + +void Timestep_base::set_dt_prev(double dt_prev) { + this->dt_prev = abs(dt_prev); + + if(this->dt_sgn < 0) { + this->dt_prev *= -1; + } +} + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_const.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_const.cpp new file mode 100644 index 0000000000..494fd3687b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_const.cpp @@ -0,0 +1,14 @@ +#include "Timestep_const.h" + +// Calculators +void Timestep_const::initialize(vector &bodies) { + ; +} +double Timestep_const::get_timestep(vector &bodies) { + return dt_sgn*dt_const; +} + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct.cpp new file mode 100644 index 0000000000..0bcae19fa5 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct.cpp @@ -0,0 +1,95 @@ +#include "Timestep_direct.h" + +// Calculators +void Timestep_direct::calculate_shared_adaptive_minimum_timestep_orbital(vector &bodies) { + this->h = 0; + + // O(N^2) operations + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + if(bi->particle_type > 0 || bj->particle_type > 0) { + + double mu = bi->m + bj->m; + + array dr, dv; + + for(int k=0; k<3; k++) { + dr[k] = bi->r[k] - bj->r[k]; + dv[k] = bi->v[k] - bj->v[k]; + } + + double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); + + double dr4 = dr2*dr2; + + double dt1_4 = mu*mu/(dr4*dr2); + double dt2_4 = dv2*dv2/dr4; + + double P_4 = max(dt1_4, dt2_4); + + if(P_4 > this->h) this->h = P_4; + } + } + } + + this->h = 1./sqrt(this->h); +} + +void Timestep_direct::calculate_minimum_timestep_spin(vector &bodies) { + h_spin = 0.; + + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + if(w2 > h_spin) { + h_spin = w2; + } + } + } + + if(h_spin == 0) { + h_spin = 1e100; + } + else { + h_spin = 1/h_spin; + } +} +void Timestep_direct::calculate_minimum_timestep_shape(vector &bodies) { + h_shape = 1e100; + + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + if(b->tau > 0) { + if(b->tau < h_shape) { + h_shape = b->tau; + } + } + } + } + + h_shape = h_shape*h_shape; +} + +void Timestep_direct::initialize(vector &bodies) { + ; +} +double Timestep_direct::get_timestep(vector &bodies) { + calculate_shared_adaptive_minimum_timestep_orbital(bodies); + calculate_minimum_timestep_spin(bodies); + calculate_minimum_timestep_shape(bodies); + + h = min(min(h_spin, h_shape), h); + h = sqrt(h); + + h *= eta; + h *= dt_sgn; + + return h; +} + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct_weight.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct_weight.cpp new file mode 100644 index 0000000000..210dd9f6ba --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct_weight.cpp @@ -0,0 +1,206 @@ +#include "Timestep_direct_weight.h" + +// Calculators +void Timestep_direct_weight::calculate_shared_adaptive_weighted_timestep_orbital(vector &bodies) { + double wsum = 0; + double wh2sum = 0; + + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + if(bi->particle_type > 0 || bj->particle_type > 0) { + + double mu = bi->m + bj->m; + + array dr, dv; + + for(int k=0; k<3; k++) { + dr[k] = bi->r[k] - bj->r[k]; + dv[k] = bi->v[k] - bj->v[k]; + } + + double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); + + double dr4 = dr2*dr2; + + double dt1_4 = mu*mu/(dr4*dr2); + double dt2_4 = dv2*dv2/dr4; + + //--------------------------------------------------------------- + + double P_4 = dt1_4 + dt2_4; + double P_2 = sqrt(P_4); + double P_8 = P_4*P_4; + double P_10 = P_8*P_2; + + //--------------------------------------------------------------- + + double wh2 = P_8; + double w = P_10; + + //--------------------------------------------------------------- + + wsum += w; + wh2sum += wh2; + } + } + } + + this->h2 = eta2 * wh2sum/wsum; +} +void Timestep_direct_weight::calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(vector &bodies) { + double h_8 = 0; + double h_10 = 0; + double h_9_dh = 0; + double h_11_dh = 0; + + for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { + for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { + + if(bi->particle_type > 0 || bj->particle_type > 0) { + + double mu = bi->m + bj->m; + + array dr, dv, da; + + for(int k=0; k<3; k++) { + dr[k] = bj->r[k] - bi->r[k]; + dv[k] = bj->v[k] - bi->v[k]; + da[k] = bj->a[k] - bi->a[k]; + } + + double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); + double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); + + double rdotv = inner_product(dr.begin(), dr.end(), dv.begin(), 0.); + double vdota = inner_product(dv.begin(), dv.end(), da.begin(), 0.); + + //------------------------------------------ + + double h_4_ra = mu*mu/(dr2*dr2*dr2); + + double h_1_dh_ra = 1.5*rdotv/dr2; + double h_5_dh_ra = h_4_ra * h_1_dh_ra; + + //------------------------------------------ + + double h_2_rv = dv2/dr2; + double h_4_rv = h_2_rv*h_2_rv; + + double h_3_dh_rv = (rdotv * h_2_rv - vdota) / dr2; + double h_5_dh_rv = h_2_rv * h_3_dh_rv; + + //------------------------------------------ + + double T_4 = h_4_ra + h_4_rv; + + double T_8 = T_4*T_4; + double T_2 = sqrt(T_4); + double T_10 = T_8*T_2; + + double T_5_dT = h_5_dh_ra + h_5_dh_rv; + + double T_9_dT = T_4 * T_5_dT; + double T_11_dT = T_2 * T_9_dT; + + //------------------------------------------ + + h_8 += T_8; + h_10 += T_10; + + h_9_dh += T_9_dT; + h_11_dh += T_11_dT; + } + } + } + + double T = sqrt(h_8 / h_10); + double dT = 0.5 / T * ( (2-alpha)*h_9_dh/h_10 - h_8/(h_10*h_10)*-alpha*h_11_dh ); + + T *= eta; + dT *= eta; + + this->h = T; + this->dh = dT; +} + +void Timestep_direct_weight::calculate_minimum_timestep_spin(vector &bodies) { + h_spin = 0.; + + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); + if(w2 > h_spin) { + h_spin = w2; + } + } + } + + if(h_spin == 0) { + h_spin = 1e100; + } + else { + h_spin = 1/h_spin; + } +} +void Timestep_direct_weight::calculate_minimum_timestep_shape(vector &bodies) { + h_shape = 1e100; + + for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { + if(b->particle_type == 3) { + if(b->tau > 0) { + if(b->tau < h_shape) { + h_shape = b->tau; + } + } + } + } + + h_shape = h_shape*h_shape; +} + +void Timestep_direct_weight::initialize(vector &bodies) { + calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(bodies); + + if(dt_sgn > 0) { + this->dt_prev = this->h / (1+0.5*this->dh); + } + else { + this->dt_prev = this->h / (1-0.5*this->dh); + } + + double dt2_prev = this->dt_prev * this->dt_prev; + + calculate_minimum_timestep_spin(bodies); + calculate_minimum_timestep_shape(bodies); + + double dt2_min = eta2 * min(h_spin, h_shape); + dt2_prev = min(dt2_prev, dt2_min); + + this->dt_prev = sqrt( dt2_prev ); + this->dt_prev *= dt_sgn; +} +double Timestep_direct_weight::get_timestep(vector &bodies) { + calculate_shared_adaptive_weighted_timestep_orbital(bodies); + calculate_minimum_timestep_spin(bodies); + calculate_minimum_timestep_shape(bodies); + + double dt2_min = eta2 * min(h_spin, h_shape); + this->h2 = min(this->h2, dt2_min); + + this->dt_next = this->h2 / this->dt_prev; + + double f2 = this->dt_next*this->dt_next / this->h2; + if(f2 > this->fp2_bound) this->dt_next = dt_sgn * sqrt(this->h2); + else if(f2 < this->fm2_bound) this->dt_next = dt_sgn * sqrt(this->h2); + + this->dt_prev = this->dt_next; + + return this->dt_next; +} + + + + + diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Units.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Units.cpp new file mode 100755 index 0000000000..028327f33b --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/integrator/src/Units.cpp @@ -0,0 +1,485 @@ +#include "Units.h" + +Units::Units() { + // Constants + c_m_s = 299792458; + + c_km_s = c_m_s / 1.e3; + c_AU_yr = c_m_s * m_s_to_AU_yr; + c_two_pi_AU_yr = c_AU_yr * AU_yr_to_two_pi_AU_yr; + + G_standard = 39.47841760435743; //39.48524924651484; // Gravitational constant in units of MSun, AU and yr + + // Time: s, min, hr, day, yr, Myr, Gyr + s_to_yr = 1./60/60/24/365.25; + min_to_yr = 1./60/24/365.25; + hr_to_yr = 1./24/365.25; + day_to_yr = 1./365.25; + Myr_to_yr = 1.e6; + Gyr_to_yr = 1.e9; + + yr_to_s = 1./s_to_yr; + yr_to_min = 1./min_to_yr; + yr_to_hr = 1./hr_to_yr; + yr_to_day = 1./day_to_yr; + yr_to_Myr = 1./Myr_to_yr; + yr_to_Gyr = 1./Gyr_to_yr; + + // Length: m, km, Rsun/RSun, AU, pc + km_in_m = 1.e3; + Rsun_in_m = 6.957e8; + AU_in_m = 149597870700; + pc_in_m = 180*60*60*AU_in_m / M_PI; + + m_to_AU = 1/AU_in_m; + km_to_AU = 1e3/AU_in_m; + Rsun_to_AU = Rsun_in_m/AU_in_m; + pc_to_AU = pc_in_m/AU_in_m; + + AU_to_m = 1./m_to_AU; + AU_to_km = 1./km_to_AU; + AU_to_Rsun = 1./Rsun_to_AU; + AU_to_pc = 1./pc_to_AU; + + // Mass: g, kg, Mearth/MEarth, Mjupiter/MJupiter/Mjup/MJup, Msun/MSun + + GMjupiter_in_m_s = 1.2668653e17; // m^3 s^-2 + GMearth_in_m_s = 3.986004e14; // m^3 s^-2 + + GMjupiter_in_AU_yr = GMjupiter_in_m_s * pow(AU_in_m, -3) * pow(s_to_yr, -2); // AU^3 yr^-2 + GMearth_in_AU_yr = GMearth_in_m_s * pow(AU_in_m, -3) * pow(s_to_yr, -2); // AU^3 yr^-2 + + Mjupiter_in_Msun = GMjupiter_in_AU_yr / (4*M_PI*M_PI); + Mearth_in_Msun = GMearth_in_AU_yr / (4*M_PI*M_PI); + + Msun_in_kg = 1.98847e30; + Msun_in_g = Msun_in_kg*1.e3; + + g_to_Msun = 1./Msun_in_g; + kg_to_Msun = 1./Msun_in_kg; + Mearth_to_Msun = Mearth_in_Msun; + Mjupiter_to_Msun = Mjupiter_in_Msun; + + Msun_to_g = 1./g_to_Msun; + Msun_to_kg = 1./kg_to_Msun; + Msun_to_Mearth = 1./Mearth_to_Msun; + Msun_to_Mjupiter = 1./Mjupiter_to_Msun; + + // Velocity: m/s, km/s, km/hr, AU/day, pc/Myr + m_s_to_AU_yr = m_to_AU / s_to_yr; + km_s_to_AU_yr = km_to_AU / s_to_yr; + km_hr_to_AU_yr = km_to_AU / hr_to_yr; + AU_day_to_AU_yr = 1. / day_to_yr; + pc_Myr_to_AU_yr = pc_to_AU / Myr_to_yr; + + AU_yr_to_m_s = 1./m_s_to_AU_yr; + AU_yr_to_km_s = 1./km_s_to_AU_yr; + AU_yr_to_km_hr = 1./km_hr_to_AU_yr; + AU_yr_to_AU_day = 1./AU_day_to_AU_yr; + AU_yr_to_pc_Myr = 1./pc_Myr_to_AU_yr; + + // Angles: deg, rad + rad_to_deg = 1. / M_PI * 180; + deg_to_rad = 1. / 180 * M_PI; + + // G=4pi <-> G=1 conversion + yr_to_yr_two_pi = 2*M_PI; + yr_two_pi_to_yr = 1./yr_to_yr_two_pi; + + AU_yr_to_two_pi_AU_yr = 1./(2*M_PI); + two_pi_AU_yr_to_AU_yr = 1./AU_yr_to_two_pi_AU_yr; + + // Conversion factors to dimensionless units + Cm = 1.; + Cr = 1.; + Cv = 1.; + Ct = 1.; + + physical_units = true; +} + +void Units::set_physical_units(bool physical_units) { + this->physical_units = physical_units; +} + +bool Units::validate_mass_unit(string u) { + if(u == "" || u == "[]") return true; + else if(u == "[g]") return true; + else if(u == "[kg]") return true; + else if(u == "[Mearth]" || u == "[MEarth]") return true; + else if(u == "[Mjupiter]" || u == "[MJupiter]") return true; + else if(u == "[Mjup]" || u == "[MJup]") return true; + else if(u == "[Msun]" || u == "[MSun]") return true; + return false; +} +bool Units::validate_length_unit(string u) { + if(u == "" || u == "[]") return true; + else if(u == "[m]") return true; + else if(u == "[km]") return true; + else if(u == "[Rsun]" || u == "[RSun]") return true; + else if(u == "[AU]" || u == "[au]") return true; + else if(u == "[parsec]" || u == "[pc]") return true; + return false; +} +bool Units::validate_time_unit(string u) { + if(u == "" || u == "[]") return true; + else if(u == "[s]") return true; + else if(u == "[hour]" || u == "[hr]") return true; + else if(u == "[day]") return true; + else if(u == "[year]" || u == "[yr]") return true; + else if(u == "[Myr]") return true; + else if(u == "[Gyr]") return true; + return false; +} +bool Units::validate_speed_unit(string u) { + if(u == "" || u == "[]") return true; + else if(u == "[m/s]") return true; + else if(u == "[km/s]") return true; + else if(u == "[km/hr]" || u == "[km/hour]") return true; + else if(u == "[AU/day]" || u == "[au/day]") return true; + else if(u == "[AU/yr]" || u == "[AU/year]") return true; + else if(u == "[au/yr]" || u == "[au/year]") return true; + else if(u == "[pc/Myr]") return true; + return false; +} +bool Units::validate_angular_unit(string u) { + if(u == "" || u == "[]") return true; + else if(u == "[deg]") return true; + else if(u == "[rad]") return true; + return false; +} + +double Units::convert_mass_to_standard(double value, string unit) { + if(physical_units) { + if(unit == "[g]") return value * g_to_Msun; + else if(unit == "[kg]") return value * kg_to_Msun; + else if(unit == "[Mearth]" || unit == "[MEarth]") return value * Mearth_to_Msun; + else if(unit == "[Mjupiter]" || unit == "[MJupiter]") return value * Mjupiter_to_Msun; + else if(unit == "[Mjup]" || unit == "[MJup]") return value * Mjupiter_to_Msun; + else if(unit == "[Msun]" || unit == "[MSun]") return value; + } + return value; +} +double Units::convert_length_to_standard(double value, string unit) { + if(physical_units) { + if(unit == "[m]") return value * m_to_AU; + else if(unit == "[km]") return value * km_to_AU; + else if(unit == "[Rsun]" || unit == "[RSun]") return value * Rsun_to_AU; + else if(unit == "[AU]" || unit == "[au]") return value; + else if(unit == "[parsec]" || unit == "[pc]") return value * pc_to_AU; + } + return value; +} +double Units::convert_time_to_standard(double value, string unit) { + if(physical_units) { + if(unit == "[s]") return value * s_to_yr; + else if(unit == "[hour]" || unit == "[hr]") return value * hr_to_yr; + else if(unit == "[day]") return value * day_to_yr; + else if(unit == "[year]" || unit == "[yr]") return value; + else if(unit == "[Myr]") return value * Myr_to_yr; + else if(unit == "[Gyr]") return value * Gyr_to_yr; + } + return value; +} +double Units::convert_speed_to_standard(double value, string unit) { + if(physical_units) { + if(unit == "[m/s]") return value * m_s_to_AU_yr; + else if(unit == "[km/s]") return value * km_s_to_AU_yr; + else if(unit == "[km/hr]" || unit == "[km/hour]") return value * km_hr_to_AU_yr; + else if(unit == "[AU/day]" || unit == "[au/day]") return value * AU_day_to_AU_yr; + else if(unit == "[AU/yr]" || unit == "[AU/year]") return value; + else if(unit == "[au/yr]" || unit == "[au/year]") return value; + else if(unit == "[pc/Myr]") return value * pc_Myr_to_AU_yr; + } + return value; +} +double Units::convert_angle_to_standard(double value, string unit) { + if(unit == "" || unit == "[]") return value * deg_to_rad; + else if(unit == "[deg]") return value * deg_to_rad; + else if(unit == "[rad]") return value; + return value; +} + +double Units::convert_time_from_standard_to_code(double value) { + if(physical_units) { + return value * yr_to_yr_two_pi; + } + return value; +} +double Units::convert_speed_from_standard_to_code(double value) { + if(physical_units) { + return value * AU_yr_to_two_pi_AU_yr; + } + return value; +} +double Units::convert_frequency_from_standard_to_code(double value) { + if(physical_units) { + return value / yr_to_yr_two_pi; + } + return value; +} + +double Units::convert_time_from_code_to_output(double value, string unit) { + if(physical_units) { + double val_G1_nodim = value; + double val_G1_dim = Ct * val_G1_nodim; + double val_standard = yr_two_pi_to_yr * val_G1_dim; + if(unit == "[s]") return val_standard * yr_to_s; + else if(unit == "[hour]" || unit == "[hr]") return val_standard * yr_to_hr; + else if(unit == "[day]") return val_standard * yr_to_day; + else if(unit == "[year]" || unit == "[yr]") return val_standard; + else if(unit == "[Myr]") return val_standard * yr_to_Myr; + else if(unit == "[Gyr]") return val_standard * yr_to_Gyr; + } + return value; +} +double Units::convert_frequency_from_code_to_output(double value, string unit) { + if(physical_units) { + double val_G1_nodim = value; + double val_G1_dim = val_G1_nodim / Ct; + double val_standard = val_G1_dim / yr_two_pi_to_yr; + if(unit == "[1/s]") return val_standard / yr_to_s; + else if(unit == "[1/hour]" || unit == "[1/hr]") return val_standard / yr_to_hr; + else if(unit == "[1/day]") return val_standard / yr_to_day; + else if(unit == "[1/year]" || unit == "[1/yr]") return val_standard; + else if(unit == "[1/Myr]") return val_standard / yr_to_Myr; + else if(unit == "[1/Gyr]") return val_standard / yr_to_Gyr; + } + return value; +} +double Units::convert_mass_from_code_to_output(double value, string unit) { + if(physical_units) { + double val_G1_nodim = value; + double val_G1_dim = Cm * val_G1_nodim; + double val_standard = val_G1_dim; + if(unit == "[g]") return val_standard * Msun_to_g; + else if(unit == "[kg]") return val_standard * Msun_to_kg; + else if(unit == "[Mearth]" || unit == "[MEarth]") return val_standard * Msun_to_Mearth; + else if(unit == "[Mjupiter]" || unit == "[MJupiter]") return val_standard * Msun_to_Mjupiter; + else if(unit == "[Mjup]" || unit == "[MJup]") return val_standard * Msun_to_Mjupiter; + else if(unit == "[Msun]" || unit == "[MSun]") return val_standard; + } + return value; +} +double Units::convert_length_from_code_to_output(double value, string unit) { + if(physical_units) { + double val_G1_nodim = value; + double val_G1_dim = Cr * val_G1_nodim; + double val_standard = val_G1_dim; + if(unit == "[m]") return val_standard * AU_to_m; + else if(unit == "[km]") return val_standard * AU_to_km; + else if(unit == "[Rsun]" || unit == "[RSun]") return val_standard * AU_to_Rsun; + else if(unit == "[AU]" || unit == "[au]") return val_standard; + else if(unit == "[parsec]" || unit == "[pc]") return val_standard * AU_to_pc; + } + return value; +} +double Units::convert_speed_from_code_to_output(double value, string unit) { + if(physical_units) { + double val_G1_nodim = value; + double val_G1_dim = Cv * val_G1_nodim; + double val_standard = two_pi_AU_yr_to_AU_yr * val_G1_dim; + if(unit == "[m/s]") return val_standard * AU_yr_to_m_s; + else if(unit == "[km/s]") return val_standard * AU_yr_to_km_s; + else if(unit == "[km/hr]" || unit == "[km/hour]") return val_standard * AU_yr_to_km_hr; + else if(unit == "[AU/day]" || unit == "[au/day]") return val_standard * AU_yr_to_AU_day; + else if(unit == "[AU/yr]" || unit == "[AU/year]") return val_standard; + else if(unit == "[au/yr]" || unit == "[au/year]") return val_standard; + else if(unit == "[pc/Myr]") return val_standard * AU_yr_to_pc_Myr; + } + return value; +} +double Units::convert_angular_momentum_from_code_to_output(double value, string unit) { + if(physical_units) { + double val_G1_nodim = value; + double val_G1_dim = Cm*Cr*Cv * val_G1_nodim; + double val_standard = two_pi_AU_yr_to_AU_yr * val_G1_dim; + + vector str = split_units(unit); + + for(int i=0; i str = split_units(unit); + + for(int i=0; i str = split_units(unit); + + for(int i=0; i Units::split_units(string &u) { + vector v; + + vector ind; + ind.push_back(-1); + + int N_str = u.length(); + for(int k=0; k 0) { + switch(init.initial_shape) { + case 0: + tidymess.set_to_spherical_shape(); + break; + case 1: + tidymess.set_to_equilibrium_shape(); + break; + } + + tidymess.update_angular_momentum(); + } + + tidymess.commit_parameters(); + + // Set up collision detection + Collision collision; + + collision.set_collision_mode(init.collisions); + collision.set_roche_mode(init.roche_limit); + collision.setup(); + + // Set up rotational breakup detection + Breakup breakup; + + breakup.set_breakup_mode(init.breakup_speed); + breakup.setup(); + + // Set up output + Output output; + + output.set_dir(init.output_dir); + output.set_overwrite(init.overwrite); + output.set_file_out(init.file_out); + + output.set_format(init.output_format); + output.set_info(init.output_info); + output.set_coor(init.output_coor); + + output.set_units(init.physical_units, init.mass_unit, init.length_unit, init.time_unit, init.speed_unit); + output.set_conversion_factors(init.get_Cm(), init.get_Cr(), init.get_Cv(), init.get_Ct()); + + output.set_tidal_model(init.tidal_model); + output.determine_output_mode(); + + // Set up simulation and diagnostics + double t = tidymess.get_model_time(); + double t_end = init.t_end; + + int snapshot_mode = init.snapshot_mode; + int N_snapshot = init.n_snapshot; + + vector bodies = tidymess.get_particles(); + int N_init = bodies.size(); + + //--------------------------------------------------------------------- + + bool dt_pos; + int dt_sgn; + if(t_end > t) { + dt_pos = true; + dt_sgn = 1; + } + else { + dt_pos = false; + dt_sgn = -1; + } + + tidymess.set_dt_sgn(dt_sgn); + + int num_snapshot = 0; + int num_integration_step = 0; + + double t_begin = t; + double dt_snapshot = 0; + + double dt0_log = 0; + double fmul_log = 0; + + if(snapshot_mode == 0) { + double t_sim = t_end - t_begin; + dt_snapshot = t_sim / N_snapshot; + } + else if(snapshot_mode == 1) { + double t_sim = abs(t_end - t_begin); + + double dt_ratio = 1000; + fmul_log = pow(10., log10(dt_ratio)/N_snapshot); + + double S = 0; + for(int i=0; i r0 = tidymess.get_center_of_mass(); + array v0 = tidymess.get_center_of_mass_velocity(); + array L0_orb = tidymess.get_orbital_angular_momentum(); + array L0_spin = tidymess.get_spin_angular_momentum(); + double Ekin0_orb = tidymess.get_orbital_kinetic_energy(); + double Ekin0_spin = tidymess.get_spin_kinetic_energy(); + double Epot0 = tidymess.get_potential_energy(); + + //--------------------------------------------------------------------- + + int N; + double tcpu_offset, t_cpu; + + double dt_prev = tidymess.get_dt_prev(); + + int collision_flag = 0; + int roche_flag = 0; + int breakup_flag = 0; + + if(init.to_continue) { + double t_bin; + int N_bin; + double tcpu_bin; + double dt_prev_bin; + vector bodies_bin; + int num_snapshot_bin; + int num_integration_step_bin; + int collision_flag_bin, roche_flag_bin, breakup_flag_bin; + double dt_snapshot_bin, dt0_log_bin, fmul_log_bin; + + output.read_binary_backup(t_bin, N_bin, tcpu_bin, dt_prev_bin, num_integration_step_bin, bodies_bin, collision_flag_bin, roche_flag_bin, breakup_flag_bin, dt_snapshot_bin, dt0_log_bin, fmul_log_bin, num_snapshot_bin); + + t = t_bin; + N = N_bin; + tcpu_offset = tcpu_bin; + dt_prev = dt_prev_bin; + num_snapshot = num_snapshot_bin; + num_integration_step = num_integration_step_bin; + collision_flag = collision_flag_bin; + roche_flag = roche_flag_bin; + breakup_flag = breakup_flag_bin; + dt_snapshot = dt_snapshot_bin; + dt0_log = dt0_log_bin; + fmul_log = fmul_log_bin; + + bodies.clear(); + for(int i=0; i t_end) { + t = t_end; + num_snapshot--; + } + } + else { + if(t < t_end) { + t = t_end; + num_snapshot--; + } + } + + tidymess.evolve_model(t); + } + else if(snapshot_mode == 1) { + double dt = dt_sgn * dt0_log * pow(fmul_log, num_snapshot-1); + t += dt; + + if(dt_pos) { + if(t > t_end) { + t = t_end; + num_snapshot--; + } + } + else { + if(t < t_end) { + t = t_end; + num_snapshot--; + } + } + + tidymess.evolve_model(t); + } + else { + tidymess.evolve_model(N_snapshot); + } + + t = tidymess.get_model_time(); + bodies = tidymess.get_particles(); + + // Store a snapshot + t_cpu = tcpu_offset + timer.read(); + output.write_snapshot(t, t_cpu, bodies); + + // Save snapshot to binary file + N = bodies.size(); + dt_prev = tidymess.get_dt_prev(); + num_integration_step = tidymess.get_num_integration_step(); + + output.save_to_binary(t, N, t_cpu, dt_prev, num_integration_step, collision_flag, roche_flag, breakup_flag, bodies, dt_snapshot, dt0_log, fmul_log, num_snapshot); + + // Store diagnostics + if(init.output_diag) { + array r1 = tidymess.get_center_of_mass(); + array v1 = tidymess.get_center_of_mass_velocity(); + array L1_orb = tidymess.get_orbital_angular_momentum(); + array L1_spin = tidymess.get_spin_angular_momentum(); + double Ekin1_orb = tidymess.get_orbital_kinetic_energy(); + double Ekin1_spin = tidymess.get_spin_kinetic_energy(); + double Epot1 = tidymess.get_potential_energy(); + + output.write_diag(t, t_cpu, num_integration_step, N, r1, v1, L1_orb, L1_spin, Ekin1_orb, Epot1, Ekin1_spin); + } + + if(init.output_terminal) { + cout << "Simulation progress:\t"; + cout << scientific<< setw(12) << setprecision(6) << 100*t/t_end << " %"; + cout << "\tCPU time:\t"; + cout << scientific<< setw(12) << setprecision(6) << t_cpu << " [s]"; + cout << "\tETA:\t"; + cout << scientific << setw(12) << setprecision(6) << (t_end-t) * t_cpu/(t-init.t_begin) << " [s]" << endl; + } + + // Stopping condition end time + if(dt_pos) { + if(t >= t_end) { + stopping_condition_type = 0; + break; + } + } + else { + if(t <= t_end) { + stopping_condition_type = 0; + break; + } + } + + // Collision handling + if(collision.to_detect_collision) { + collision_flag = tidymess.get_collision_flag(); + + if(tidymess.is_collision_detected() == true) { + if(collision.collision_mode == 1) { + cout << "Collision detected. Ignoring it. " << endl; + } + else if(collision.collision_mode == 2) { // exception = End program + stopping_condition_type = 2; + + cout << "Collision detected. Ending simulation." << endl; + break; + } + else if(collision.collision_mode == 3) { // sticky sphere approximation + cout << "Collision detected. Replace by center of mass particle." << endl; + + vector< array > cindex = tidymess.get_collision_indices(); + collision.replace(bodies, cindex); + + tidymess.set_particles(bodies); + tidymess.commit_particles(); + + t_cpu = tcpu_offset + timer.read(); + output.write_snapshot(t, t_cpu, bodies); + + if(bodies.size() == 1) { + stopping_condition_type = 4; + + cout << "Only one body left. Ending simulation." << endl; + break; + } + } + } + } + + // Roche limit handling + if(collision.to_detect_roche) { + roche_flag = tidymess.get_roche_flag(); + + if(tidymess.is_roche_detected() == true) { + if(collision.roche_mode == 1) { + cout << "Roche limit breached. Ignoring it. " << endl; + } + else if(collision.roche_mode == 2) { + stopping_condition_type = 3; + + cout << "Roche limit breached. Ending simulation." << endl; + break; + } + } + } + + // Breakup speed handling + if(breakup.to_detect) { + bool rotational_breakup = breakup.detect_breakup(bodies); + if(rotational_breakup) { + breakup_flag = 1; + + if(breakup.mode == 1) { + cout << "Rotational breakup detected. Ignoring it. " << endl; + } + else if(breakup.mode == 2) { + stopping_condition_type = 5; + + cout << "Rotational breakup detected. Ending simulation." << endl; + break; + } + } + } + + // Maximum CPU running time + if(check_max_cpu) { + if(t_cpu > max_cpu_time) { + stopping_condition_type = 1; + + cout << "t_cpu = " << t_cpu << " [s]" << endl; + cout << "max_cpu_time = " << max_cpu_time << " [s]" << endl; + cout << "Halting simulation!" << endl; + break; + } + } + } + + //--------------------------------------------------------------------- + + // Save snapshot to binary file + N = bodies.size(); + t_cpu = tcpu_offset + timer.read(); + dt_prev = tidymess.get_dt_prev(); + num_integration_step = tidymess.get_num_integration_step(); + + output.save_to_binary(t, N, t_cpu, dt_prev, num_integration_step, collision_flag, roche_flag, breakup_flag, bodies, dt_snapshot, dt0_log, fmul_log, num_snapshot); + + // Clean up + timer.stop(); + + // Final log data + int N_final = bodies.size(); + + array r1 = tidymess.get_center_of_mass(); + array v1 = tidymess.get_center_of_mass_velocity(); + array L1_orb = tidymess.get_orbital_angular_momentum(); + array L1_spin = tidymess.get_spin_angular_momentum(); + double Ekin1_orb = tidymess.get_orbital_kinetic_energy(); + double Ekin1_spin = tidymess.get_spin_kinetic_energy(); + double Epot1 = tidymess.get_potential_energy(); + + if(init.output_diag) { + output.write_diag(t, t_cpu, num_integration_step, N, r1, v1, L1_orb, L1_spin, Ekin1_orb, Epot1, Ekin1_spin); + } + + double dr = sqrt(pow(r1[0]-r0[0], 2) + pow(r1[1]-r0[1], 2) + pow(r1[2]-r0[2], 2)); + double dv = sqrt(pow(v1[0]-v0[0], 2) + pow(v1[1]-v0[1], 2) + pow(v1[2]-v0[2], 2)); + + vector L0(3); + L0[0] = L0_orb[0] + L0_spin[0]; + L0[1] = L0_orb[1] + L0_spin[1]; + L0[2] = L0_orb[2] + L0_spin[2]; + + vector L1(3); + L1[0] = L1_orb[0] + L1_spin[0]; + L1[1] = L1_orb[1] + L1_spin[1]; + L1[2] = L1_orb[2] + L1_spin[2]; + + double dLx = L1[0]-L0[0]; + double dLy = L1[1]-L0[1]; + double dLz = L1[2]-L0[2]; + + double L0mag = sqrt(L0[0]*L0[0] + L0[1]*L0[1] + L0[2]*L0[2]); + double L1mag = sqrt(L1[0]*L1[0] + L1[1]*L1[1] + L1[2]*L1[2]); + double dLmag = sqrt(dLx*dLx + dLy*dLy + dLz*dLz); + + double dLx_rel = dLx; + double dLy_rel = dLy; + double dLz_rel = dLz; + if(L0[0] != 0) dLx_rel /= L0[0]; + if(L0[1] != 0) dLy_rel /= L0[1]; + if(L0[2] != 0) dLz_rel /= L0[2]; + + double dL_rel = dLmag; + if(L0mag != 0) dL_rel /= (L0mag); + + double Etot0 = Ekin0_orb + Epot0 + Ekin0_spin; + double Etot1 = Ekin1_orb + Epot1 + Ekin1_spin; + + double dE_abs = Etot1-Etot0; + double dE_rel = dE_abs; + if(Etot0 != 0) dE_rel /= Etot0; + + banner.print_outro(init.output_dir); + + output.write_log(argc, argv, t, t_cpu, num_integration_step, N_init, N_final, dr, dv, dLx, dLy, dLz, dLx_rel, dLy_rel, dLz_rel, dLmag, dL_rel, dE_abs, dE_rel, bodies[0].r[0], stopping_condition_type, collision_flag, roche_flag, breakup_flag); + output.print_log(argc, argv, t, t_cpu, num_integration_step, N_init, N_final, dr, dv, dLx, dLy, dLz, dLx_rel, dLy_rel, dLz_rel, dLmag, dL_rel, dE_abs, dE_rel, bodies[0].r[0], stopping_condition_type, collision_flag, roche_flag, breakup_flag); + + banner.print_stars(); + banner.print_banner(); + banner.print_reference(); + banner.print_stars(); + cout << endl; + + return 1; +} + + diff --git a/src/amuse_tidymess/src/tidymess/makefile b/src/amuse_tidymess/src/tidymess/makefile new file mode 100755 index 0000000000..617e253eca --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/makefile @@ -0,0 +1,33 @@ +INT_DIR := integrator + +SRC_DIR := $(INT_DIR)/src +INC_DIR := $(INT_DIR)/include +OBJ_DIR := $(INT_DIR)/build +BIN_DIR := . + +SRC := $(wildcard $(SRC_DIR)/*.cpp) +OBJ := $(SRC:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o) + +CODE = tidymess.exe + +CC := g++ +CFLAGS := -Ofast + +.PHONY: all clean + +all: $(CODE) + +tidymess.exe: $(OBJ) | $(BIN_DIR) + $(CC) $(CFLAGS) $^ -o $@ $(INC_DIR:%=-I%) + +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR) + $(CC) $(CFLAGS) -c $< -o $@ $(INC_DIR:%=-I%) + +$(BIN_DIR) $(OBJ_DIR): + mkdir -p $@ + +clean: + @$(RM) -rv $(OBJ_DIR) $(CODE) + +-include $(OBJ:.o=.d) + diff --git a/src/amuse_tidymess/src/tidymess/tidymess.ic b/src/amuse_tidymess/src/tidymess/tidymess.ic new file mode 100755 index 0000000000..9419e4428d --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/tidymess.ic @@ -0,0 +1,20 @@ +Name Earth Moon + +mass[kg] 5.9724e24 0.07346e24 +R[km] 6371. 1737.4 +xi 0.3308 0.394 + +kf 0.933 0 +tau[s] 180 0 + +lod[day] 1.0 27.322 +obl[deg] 0.0 0.0 +psi[deg] 0.0 0.0 + +a[km] 0.3844e6 +e 0.0 +I 0 +O 0 +w 0 +M 0 + diff --git a/src/amuse_tidymess/src/tidymess/tidymess.par b/src/amuse_tidymess/src/tidymess/tidymess.par new file mode 100755 index 0000000000..ef86c69be2 --- /dev/null +++ b/src/amuse_tidymess/src/tidymess/tidymess.par @@ -0,0 +1,72 @@ +//-------------------------------------------------------------------------------------------------- +// Simulation parameters +//-------------------------------------------------------------------------------------------------- + +to_continue = 0 // 0=new simulation, 1=continue simulation +max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. + +//-------------------------------------------------------------------------------------------------- +// Physical model parameters +//-------------------------------------------------------------------------------------------------- + +tidal_model = 0 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess +pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn +B_braking = 0 // Magnetic braking. 0=off, 1=on + +collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace +roche_limit = 0 // 0=off, 1=flag, 2=exception +breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception + +//-------------------------------------------------------------------------------------------------- +// Unit system +//-------------------------------------------------------------------------------------------------- + +mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] +length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] +time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] +speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] + +speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. + +//-------------------------------------------------------------------------------------------------- +// Initial condition parameters +//-------------------------------------------------------------------------------------------------- + +file_ic = tidymess.ic // initial condition file + +orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian +spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit + +initial_shape = 0 // 0=sphere, 1=equilibrium +num_body = 0 // 0=all, num_body+1=number of bodies to include + +//-------------------------------------------------------------------------------------------------- +// Output parameters +//-------------------------------------------------------------------------------------------------- + +snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval +n_snapshot = 1e2 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) + +output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. +overwrite = 1 // overwrite existing files: 0=no, 1=yes + +output_format = 2 // 0=file per body, 1=file per snapshot, 2=single file +output_info = 1 // 0=time-varying quantities, 1=all quantities +output_coor = 0 // 0=cartesian inertial + +output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' +output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes + +//-------------------------------------------------------------------------------------------------- +// Integration parameters +//-------------------------------------------------------------------------------------------------- + +t_begin = 0 // begin time in units given by time_unit +t_end = 1e2 // final time in units given by time_unit + +dt_mode = 1 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt +dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) +eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) + +n_iter = 1 // Number of iterations to improve reversibility (default=1) + From 30296f86a5f9c9fd1826aa1ac08a7e38c3e0ea7f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Dec 2025 14:57:21 +0100 Subject: [PATCH 003/174] update tidymess interface --- src/amuse_tidymess/interface.py | 1342 +++++++++++++++++++------------ 1 file changed, 839 insertions(+), 503 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 0c9f26062c..9a9519e32b 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1,721 +1,1057 @@ -from amuse.community import * from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravitationalDynamicsInterface from amuse.community.interface.gd import GravityFieldInterface from amuse.community.interface.gd import GravityFieldCode +from amuse.community.interface.stopping_conditions import StoppingConditions, StoppingConditionInterface +from amuse.rfi.core import CodeInterface, legacy_function, LegacyFunctionSpecification +from amuse.support.interface import MethodWithUnitsDefinition +from amuse.support.literature import LiteratureReferencesMixIn +from amuse.units import nbody_system -# *** This script, together with the defaults in -# *** GravitationalDynamicsInterface, will be used to generate both -# *** the header file interface.h and the stub interface.cc. Since -# *** interface.cc has been hand-coded to implement the details, -# *** MAKE SURE TO SAVE IT SOMEWHERE, as build.py can overwrite it! - -class ph4Interface(CodeInterface, - LiteratureReferencesMixIn, - GravitationalDynamicsInterface, - StoppingConditionInterface, - GravityFieldInterface): +class TidyMessInterface( + CodeInterface, + LiteratureReferencesMixIn, + GravitationalDynamicsInterface, + StoppingConditionInterface, + GravityFieldInterface +): """ - Parallel, GPU-accelerated, N-body integration module with block - time steps, using a 4th-order Hermite integration scheme. - .. [#] ADS:2018araa.book.....P (Portegies Zwart, S. & McMillan, S.L.W., 2018) """ - # Interface specification. + include_headers = ['tidymess_worker.h', 'stopcond.h'] - include_headers = ['ph4_worker.h', 'stopcond.h'] - MODE_GPU = 'gpu' - MODE_CPU = 'cpu' - - def __init__(self, mode = MODE_CPU, **options): + def __init__(self, **options): CodeInterface.__init__( - self, - name_of_the_worker=self.name_of_the_muse_worker(mode), - **options + self, name_of_the_worker='tidymess_worker', **options ) LiteratureReferencesMixIn.__init__(self) - # Interface functions: + @legacy_function def new_particle(): - """ - Define a new particle in the stellar dynamics code. The - particle is initialized with the provided mass, radius, - position and velocity. This function returns an index that - can be used to refer to this particle. - """ + ''' + Define a new particle in the stellar dynamics code. The particle is + initialized with the provided mass, radius, position, velocity, moment + of inertia factor, fluid love number, fluid relaxation time, spin, and + magnetic breaking coefficient. This function returns an index that can + be used to refer to this particle. + ''' function = LegacyFunctionSpecification() function.can_handle_array = True - function.addParameter('index_of_the_particle', dtype='int32', - direction=function.OUT, description = - """ - An index assigned to the newly created particle. - This index is supposed to be a local index for the code - (and not valid in other instances of the code or in other codes) - """, - unit = INDEX + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.OUT, + description=( + 'An index assigned to the newly created particle. ' + 'This index is supposed to be a local index for the code ' + '(and not valid in other instances of the code or in other codes)' + ), + unit = MethodWithUnitsDefinition.INDEX ) - - function.addParameter('mass', dtype='float64', direction=function.IN, - description = "The mass of the particle", - unit = nbody_system.mass) - function.addParameter('x', dtype='float64', direction=function.IN, - description = "The initial position vector of the particle", - unit = nbody_system.length) - function.addParameter('y', dtype='float64', direction=function.IN, - description = "The initial position vector of the particle", - unit = nbody_system.length) - function.addParameter('z', dtype='float64', direction=function.IN, - description = "The initial position vector of the particle", - unit = nbody_system.length) - function.addParameter('vx', dtype='float64', direction=function.IN, - description = "The initial velocity vector of the particle", - unit = nbody_system.speed) - function.addParameter('vy', dtype='float64', direction=function.IN, - description = "The initial velocity vector of the particle", - unit = nbody_system.speed) - function.addParameter('vz', dtype='float64', direction=function.IN, - description = "The initial velocity vector of the particle", - unit = nbody_system.speed) - function.addParameter('radius', dtype='float64', direction=function.IN, - description = "The radius of the particle", - default = -1, unit = nbody_system.length) - function.addParameter('id', dtype='int32', direction=function.IN, - description = "Identifier of the particle, " - +"option for restoring state after loading", - default = -1, unit = NO_UNIT) + function.addParameter( + 'mass', + dtype='float64', + direction=function.IN, + description='The mass of the particle', + unit=nbody_system.mass + ) + function.addParameter( + 'x', + dtype='float64', + direction=function.IN, + description='The initial position vector of the particle', + unit=nbody_system.length + ) + function.addParameter( + 'y', + dtype='float64', + direction=function.IN, + description='The initial position vector of the particle', + unit=nbody_system.length + ) + function.addParameter( + 'z', + dtype='float64', + direction=function.IN, + description='The initial position vector of the particle', + unit=nbody_system.length + ) + function.addParameter( + 'vx', + dtype='float64', + direction=function.IN, + description='The initial velocity vector of the particle', + unit=nbody_system.speed + ) + function.addParameter( + 'vy', + dtype='float64', + direction=function.IN, + description='The initial velocity vector of the particle', + unit=nbody_system.speed + ) + function.addParameter( + 'vz', + dtype='float64', direction=function.IN, + description='The initial velocity vector of the particle', + unit=nbody_system.speed + ) + function.addParameter( + 'radius', + dtype='float64', + direction=function.IN, + description='The radius of the particle', + default=-1, # what is this default + unit=nbody_system.length + ) + function.addParameter( + 'xi', + dtype='float64', + direction=function.IN, + description='Moment of inertia factor', + default=0 + ) + function.addParameter( + 'kf', + dtype='float64', + direction=function.IN, + description='Fluid Love number from potential', + default=0 + ) + function.addParameter( + 'tau', + dtype='float64', + direction=function.IN, + description='Fluid relaxation time', + default=0 + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.IN, + description='Spin', + default=0 + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.IN, + description='Spin', + default=0 + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.IN, + description='Spin', + default=0 + ) + function.addParameter( + 'a_mb', + dtype='float64', + direction=function.IN, + description='Magnetic braking coefficient', + default=0 + ) + function.addParameter( + 'id', + dtype='int32', + direction=function.IN, + description=( + 'Identifier of the particle, ' + 'option for restoring state after loading' + ), + default=-1, + unit=MethodWithUnitsDefinition.NO_UNIT + ) function.result_type = 'int32' - function.result_doc = """ 0 - OK - particle was created and added to the model + function.result_doc = '''\ + 0 - OK + particle was created and added to the model -1 - ERROR - particle could not be created""" + particle could not be created + ''' + return function - + + @legacy_function - def get_particle_timestep(): - """ - Retrieve the timestep of a particle. - """ + def get_spin(): + ''' + Retrieve the spin vector of a particle. Spin is a vector + property, this function has 3 OUT arguments. + ''' function = LegacyFunctionSpecification() - function.addParameter('index_of_the_particle', - dtype='int32', - direction=function.IN, - description = "Index of the particle to get the timestep from. This index must have been returned by an earlier call to :meth:`new_particle`") - function.addParameter('timestep', - dtype='float64', - unit=nbody_system.time, - direction=function.OUT, - description = "The current timestep of the particle") + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + 'Index of the particle to get the state from. This index must ' + 'have been returned by an earlier call to :meth:`new_particle`' + ) + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.OUT, + description='The current spin vector of the particle' + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.OUT, + description='The current spin vector of the particle' + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.OUT, + description='The current spin vector of the particle' + ) function.result_type = 'int32' function.can_handle_array = True + function.result_doc = '''\ + 0 - OK + current value was retrieved + -1 - ERROR + particle could not be found + -2 - ERROR + not yet implemented + ''' + return function - - def name_of_the_muse_worker(self, mode): - if mode == self.MODE_CPU: - return 'ph4_worker' - elif mode == self.MODE_GPU: - return 'ph4_sapporo_worker' - else: - return 'ph4_worker' - - # Inheritance from GravitationalDynamicsInterface means that - # functions in the standard interface don't need to be defined. - # See interface.py.2 for a laboriously hand-coded version written - # before I discovered this fact! (Steve McMillan, 10/10) - - # Additional functions defined here will be reflected in - # interface.h and must be provided in interface.cc in order for - # ph4_worker to build. - - # The following functions aren't defined in the default interface: + + @legacy_function - def set_time(): - """ - Set the model time. Should use set_begin_time! - """ + def set_spin(): + ''' + Update the spin of a particle. + ''' function = LegacyFunctionSpecification() - function.addParameter('time', dtype='float64', direction=function.IN, - description = "The model time to start at", unit = nbody_system.time) + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + 'Index of the particle for which the state is to be updated. ' + 'This index must have been returned by an earlier call to ' + ':meth:`new_particle`' + ) + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.IN, + description='The new spin vector of the particle' + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.IN, + description='The new spin vector of the particle' + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.IN, + description='The new spin vector of the particle' + ) function.result_type = 'int32' - function.result_doc = """ - 0 - OK - Time value was changed + function.can_handle_array = True + function.result_doc = '''\ + 0 - OK + particle was found in the model and the information was set + -1 - ERROR + particle could not be found -2 - ERROR - The code does not support setting the time - """ + code does not support updating of a particle + ''' + return function - + + @legacy_function - def set_eta(): - """ - Set the current accuracy parameter. - """ + def set_tidal_model(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('eta', dtype='float64', - direction=function.IN) + function.addParameter( + 'tidal_model', + dtype='int32', + direction=function.IN, + description=( + '0=none, 1=conservative, 2=linear, ' + '3=creep direct, 4=creep tidymess (default)' + ) + ) function.result_type = 'int32' + function.result_doc = '''''' return function + @legacy_function - def get_eta(): - """ - Get the current accuracy parameter. - """ + def get_tidal_model(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('eta', dtype='float64', - direction=function.OUT) + function.addParameter( + 'tidal_model', + dtype='int32', + direction=function.OUT, + description=( + '0=none, 1=conservative, 2=linear, ' + '3=creep direct, 4=creep tidymess (default)' + ) + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def set_gpu(): - """ - Set use_gpu. - """ + def set_pn_order(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('gpu', dtype='int32', - direction=function.IN) + function.addParameter( + 'pn_order', + dtype='int32', + direction=function.IN, + description='Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_gpu(): - """ - Get use_gpu. - """ + def get_pn_order(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('gpu', dtype='int32', - direction=function.OUT) + function.addParameter( + 'pn_order', + dtype='int32', + direction=function.OUT, + description='Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def set_gpu_id(): - """ - Set gpu_id. - """ + def set_magnetic_braking(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('gpu_id', dtype='int32', - direction=function.IN) + function.addParameter( + 'magnetic_braking', + dtype='int32', + direction=function.IN, + description='Magnetic braking. 0=off, 1=on' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_gpu_id(): - """ - Get gpu_id. - """ + def get_magnetic_braking(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('gpu_id', dtype='int32', - direction=function.OUT) + function.addParameter( + 'magnetic_braking', + dtype='int32', + direction=function.OUT, + description='Magnetic braking. 0=off, 1=on' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def set_manage_encounters(): - """ - Set the value of manage_encounters. - """ + def set_speed_of_light(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('manage_encounters', dtype='int32', - direction=function.IN) + function.addParameter( + 'speed_of_light', + dtype='float64', + direction=function.IN, + description='') function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_manage_encounters(): - """ - Get the value of manage_encounters. - """ + def get_speed_of_light(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('manage_encounters', dtype='int32', - direction=function.OUT) + function.addParameter( + 'speed_of_light', + dtype='float64', + direction=function.OUT, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def set_zero_step_mode(): - """ - Set the value of zero_step_mode. - """ + def set_dt_mode(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('zero_step_mode', dtype='int32', - direction=function.IN) + function.addParameter( + 'dt_mode', + dtype='int32', + direction=function.IN, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_zero_step_mode(): - """ - Get the value of zero_step_mode. - """ + def get_dt_mode(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('zero_step_mode', dtype='int32', - direction=function.OUT) + function.addParameter( + 'dt_mode', + dtype='int32', + direction=function.OUT, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def set_force_sync(): - """ - Set the value of force_sync. - """ + def set_dt_const(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('force_sync', dtype='int32', - direction=function.IN) + function.addParameter( + 'dt_const', + dtype='float64', + direction=function.IN, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_force_sync(): - """ - Get the value of force_sync. - """ + def get_dt_const(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('force_sync', dtype='int32', - direction=function.OUT) + function.addParameter( + 'dt_const', + dtype='float64', + direction=function.OUT, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def set_sync_time(): - """ - Set the value of sync_time. - """ + def get_time_step(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('sync_time', dtype='float64', - direction=function.IN, unit = nbody_system.time) + function.addParameter( + 'time_step', + dtype='float64', + direction=function.OUT, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_sync_time(): - """ - Get the value of sync_time. - """ + def set_eta(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('sync_time', dtype='float64', - direction=function.OUT, unit = nbody_system.time) + function.addParameter( + 'eta', + dtype='float64', + direction=function.IN, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def set_block_steps(): - """ - Set the value of block_steps. - """ + def get_eta(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('set_block_steps', dtype='int32', - direction=function.IN) + function.addParameter( + 'eta', + dtype='float64', + direction=function.OUT, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_block_steps(): - """ - Get the value of block_steps. - """ + def set_n_iter(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('get_block_steps', dtype='int32', - direction=function.OUT) + function.addParameter( + 'n_iter', + dtype='int32', + direction=function.IN, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def set_total_steps(): - """ - Set the value of total_steps. - """ + def get_n_iter(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('set_total_steps', dtype='int32', - direction=function.IN) + function.addParameter( + 'n_iter', + dtype='int32', + direction=function.OUT, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_total_steps(): - """ - Get the value of total_steps. - """ + def set_collision_mode(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('get_total_steps', dtype='int32', - direction=function.OUT) + function.addParameter( + 'collision_mode', + dtype='int32', + direction=function.IN, + description='0=off, 1=flag, 2=exception, 3=replace' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_number_of_particles_updated(): - """ - Return the number of particles added or deleted during the last evolve. - """ + def get_collision_mode(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('index', dtype='int32', - direction=function.OUT) + function.addParameter( + 'collision_mode', + dtype='int32', + direction=function.OUT, + description='0=off, 1=flag, 2=exception, 3=replace') function.result_type = 'int32' + function.result_doc = '''''' + return function - + + @legacy_function - def get_id_of_updated_particle(): - """ - Return the number of particles added or deleted during the last evolve. - """ + def set_roche_mode(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('index_of_update', dtype='int32', - direction=function.IN, - description = 'index in the updated particles list') - function.addParameter('index_of_particle', dtype='int32', - direction=function.OUT) - function.addParameter('kind_of_update', dtype='int32', - direction=function.OUT, - description = 'kind of update (2, addition), (1, deletion)') - function.can_handle_array = True + function.addParameter( + 'roche_mode', + dtype='int32', + direction=function.IN, + description='0=off, 1=flag, 2=exception' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_binary_energy(): - """ - Return the total energy in all binaries. - """ + def get_roche_mode(): + ''' + ''' function = LegacyFunctionSpecification() function.addParameter( - 'binary_energy', - dtype='float64', + 'roche_mode', + dtype='int32', direction=function.OUT, - unit = nbody_system.energy + description='0=off, 1=flag, 2=exception' ) function.result_type = 'int32' - return function + function.result_doc = '''''' - @legacy_function - def set_initial_timestep_fac(): - """ - Set the current accuracy parameter. - """ - function = LegacyFunctionSpecification() - function.addParameter('initial_timestep_fac', dtype='float64', - direction=function.IN) - function.result_type = 'int32' return function + @legacy_function - def get_initial_timestep_fac(): - """ - Get the current accuracy parameter. - """ + def set_breakup_mode(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('initial_timestep_fac', dtype='float64', - direction=function.OUT) + function.addParameter( + 'breakup_mode', + dtype='int32', + direction=function.IN, + description=( + 'Centrifugal breakup speed detection. ' + '0=off, 1=flag, 2=exception' + ) + ) function.result_type = 'int32' + function.result_doc = '''''' + return function - + + @legacy_function - def set_initial_timestep_limit(): - """ - Set the current accuracy parameter. - """ + def get_breakup_mode(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('initial_timestep_limit', dtype='float64', - direction=function.IN) + function.addParameter( + 'breakup_mode', + dtype='int32', + direction=function.OUT, + description=( + 'Centrifugal breakup speed detection. ' + '0=off, 1=flag, 2=exception' + ) + ) function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_initial_timestep_limit(): - """ - Get the current accuracy parameter. - """ + def get_num_integration_step(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('initial_timestep_limit', dtype='float64', - direction=function.OUT) + function.addParameter( + 'num_integration_step', + dtype='int32', + direction=function.OUT, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function - + + @legacy_function - def set_initial_timestep_median(): - """ - Set the current accuracy parameter. - """ + def detect_collision(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('initial_timestep_median', dtype='float64', - direction=function.IN) + function.addParameter( + 'collision_flag', + dtype='int32', + direction=function.OUT, + description='' + ) + function.addParameter( + 'n_collisions', + dtype='int32', + direction=function.OUT, + description='' + ) + function.addParameter( + 'index1', + dtype='int32', + direction=function.OUT, + description='' + ) + function.addParameter( + 'index2', + dtype='int32', + direction=function.OUT, + description='' + ) + #function.addParameter( + # 'indices_of_colliding_particles', dtype='int32', direction=function.OUT, + # description="") function.result_type = 'int32' + function.result_doc = '''''' + return function + @legacy_function - def get_initial_timestep_median(): - """ - Get the current accuracy parameter. - """ + def convert_spin_vectors_to_inertial(): + ''' + ''' function = LegacyFunctionSpecification() - function.addParameter('initial_timestep_median', dtype='float64', - direction=function.OUT) + function.addParameter( + 'lod', + dtype='float64', + direction=function.IN, + description='' + ) + function.addParameter( + 'obl', + dtype='float64', + direction=function.IN, + description='' + ) + function.addParameter( + 'psi', + dtype='float64', + direction=function.IN, + description='' + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.OUT, + description='' + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.OUT, + description='' + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.OUT, + description='' + ) function.result_type = 'int32' + function.result_doc = '''''' + return function - + + @legacy_function - def recompute_timesteps(): - """ - Force recomputation of all timesteps (assume a synchronized system), - """ + def merge_collided_particles(): + ''' + ''' function = LegacyFunctionSpecification() + function.addParameter( + 'number_of_particles', + dtype='int32', + direction=function.OUT, + description=( + 'should be equivalent to collision ' + 'handling when collision_mode==3' + ) + ) function.result_type = 'int32' + function.result_doc = '''''' + return function -class ph4(GravitationalDynamics,GravityFieldCode): +class TidyMess(GravitationalDynamics, GravityFieldCode): + + def __init__(self, convert_nbody=None, **options): - # The actual module. + legacy_interface = TidyMessInterface(**options) - def __init__(self, convert_nbody = None, **keyword_arguments): - legacy_interface = ph4Interface(**keyword_arguments) + GravitationalDynamics.__init__( + self, + legacy_interface, + convert_nbody, + **options + ) + # should this be here or before? self.stopping_conditions = StoppingConditions(self) - - GravitationalDynamics.__init__(self, - legacy_interface, - convert_nbody, - **keyword_arguments) - + + def define_state(self, handler): GravitationalDynamics.define_state(self, handler) - handler.add_method('RUN', 'get_particle_timestep') - GravityFieldCode.define_state(self, handler) - - handler.add_method('EDIT', 'set_state') - handler.add_method('EDIT', 'set_velocity') - handler.add_method('EDIT', 'set_mass') - handler.add_method('EDIT', 'set_position') - handler.add_method('CHANGED','before_get_parameter') - - handler.add_transition('RUN', 'CHANGED', 'set_state', False) - handler.add_transition('RUN', 'CHANGED', 'set_velocity', False) - handler.add_transition('RUN', 'CHANGED', 'set_mass', False) - handler.add_transition('RUN', 'CHANGED', 'set_position', False) - handler.add_transition('CHANGED', 'RUN', 'synchronize_model') - handler.add_method('CHANGED', 'get_state') - handler.add_method('CHANGED', 'get_mass') - handler.add_method('CHANGED', 'get_position') - handler.add_method('CHANGED', 'get_velocity') - handler.add_method('CHANGED', 'get_particle_timestep') - + handler.add_method('RUN', 'get_spin') + handler.add_transition('RUN', 'UPDATE', 'set_spin', False) + handler.add_method('UPDATE', 'set_spin') + self.stopping_conditions.define_state(handler) - def define_parameters(self, handler): - # Set/get parameters specific to the module, not part of the - # standard interface. Accessors used here must be defined - # above and reflected in interface.cc. Python access is - # (e.g.) - # - # ph4.parameters.timestep_parameter = xxx + def define_methods(self, handler): - handler.add_method_parameter( - "get_eta", # getter name in interface.cc - "set_eta", # setter name in interface.cc - "timestep_parameter", # python parameter name - "timestep parameter", # description - default_value = 0.14 + GravitationalDynamics.define_methods(self, handler) + + # Turn interface functions into methods. + handler.add_method( + 'new_particle', + ( + nbody_system.mass, + nbody_system.length, + nbody_system.length, + nbody_system.length, + nbody_system.speed, + nbody_system.speed, + nbody_system.speed, + nbody_system.length, # radius + + handler.NO_UNIT, # xi, moment of inertia factor + handler.NO_UNIT, # kf, fluid Love number for potential + nbody_system.time, # tau, fluid relaxation time + 1/nbody_system.time, # wx + 1/nbody_system.time, # wy + 1/nbody_system.time, # wz + + handler.NO_UNIT, # a_mb, magnetic braking coefficient + ), + ( + handler.INDEX, + handler.ERROR_CODE + ) + ) + handler.add_method( + 'get_num_integration_step', + (), + ( + handler.INDEX, + handler.ERROR_CODE + ) + ) + handler.add_method( + 'detect_collision', + (), + ( + handler.INDEX, + handler.INDEX, + handler.INDEX, + handler.INDEX, + handler.ERROR_CODE + ) + ) + handler.add_method( + 'get_dt_const', + (), + ( + nbody_system.time, + handler.ERROR_CODE + ) ) - handler.add_method_parameter( - "get_eps2", # already defined in standard interface - "set_eps2", # already defined in standard interface - "epsilon_squared", - "smoothing parameter for gravity calculations", - default_value = 0.0 | nbody_system.length * nbody_system.length + handler.add_method( + 'convert_spin_vectors_to_inertial', + ( + nbody_system.time, + handler.NO_UNIT, + handler.NO_UNIT, + ), + ( + 1/nbody_system.time, # wx + 1/nbody_system.time, # wy + 1/nbody_system.time, # wz + handler.ERROR_CODE + ) ) - handler.add_method_parameter( - "get_gpu", # getter name in interface.cc - "set_gpu", # setter name in interface.cc - "use_gpu", # python parameter name - "use GPU", # description - default_value = 1 + handler.add_method( + 'set_spin', + ( + handler.NO_UNIT, + 1/nbody_system.time, + 1/nbody_system.time, + 1/nbody_system.time, + ), + ( + handler.ERROR_CODE + ) ) - - handler.add_method_parameter( - "get_gpu_id", # getter name in interface.cc - "set_gpu_id", # setter name in interface.cc - "gpu_id", # python parameter name - "GPU ID", # description - default_value = -1 + handler.add_method( + 'get_spin', + ( + handler.NO_UNIT, + ), + ( + 1/nbody_system.time, + 1/nbody_system.time, + 1/nbody_system.time, + handler.ERROR_CODE + ) ) - + + self.stopping_conditions.define_methods(handler) + + + def define_parameters(self, handler): + # Set/get parameters specific to the module, not part of the + # standard interface. Accessors used here must be defined + # above and reflected in interface.cc. Python access is + # (e.g.) + # + # TidyMess.parameters.timestep_parameter = xxx + # handler.add_method_parameter( - "get_manage_encounters", # getter name in interface.cc - "set_manage_encounters", # setter name in interface.cc - "manage_encounters", # python parameter name - "manage close encounters", # description - default_value = 4 + 'get_tidal_model', + 'set_tidal_model', + 'tidal_model', + '0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default)', + default_value=4, + is_vector=False, + must_set_before_get=False, ) - + handler.add_method_parameter( - "get_begin_time", - "set_begin_time", - "begin_time", - "model time at which to start the simulation", - default_value = 0.0 | nbody_system.time + 'get_pn_order', + 'set_pn_order', + 'pn_order', + 'Post-Newtonian order: 0=none (default), 1=1pn, 2=1+2pn, 25=1+2+2.5pn', + default_value=0, + is_vector=False, + must_set_before_get=False, ) handler.add_method_parameter( - "get_sync_time", - "set_sync_time", - "sync_time", - "last model synchronization time", - default_value = 0.0 | nbody_system.time + 'get_magnetic_braking', + 'set_magnetic_braking', + 'magnetic_braking', + 'Magnetic braking. 0=off (default), 1=on', + default_value=0, + is_vector=False, + must_set_before_get=False, ) handler.add_method_parameter( - "get_zero_step_mode", - "set_zero_step_mode", - "zero_step_mode", - "force evolve_model to take zero-length steps", - default_value = 0 + 'get_speed_of_light', + 'set_speed_of_light', + 'speed_of_light', + '', + default_value=1e100, + is_vector=False, + must_set_before_get=False, ) handler.add_method_parameter( - "get_force_sync", - "set_force_sync", - "force_sync", - "force evolve_model to sync at specified time", - default_value = 0 + 'get_dt_mode', + 'set_dt_mode', + 'dt_mode', + '0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt', + default_value=1, # of 2? + is_vector=False, + must_set_before_get=False, ) handler.add_method_parameter( - "get_block_steps", - "set_block_steps", - "block_steps", - "number of block steps", - default_value = 0 + 'get_eta', + 'set_eta', + 'eta', + 'accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0)', + default_value=0.0625, + is_vector=False, + must_set_before_get=False, ) handler.add_method_parameter( - "get_total_steps", - "set_total_steps", - "total_steps", - "total number of steps", - default_value = 0 + 'get_n_iter', + 'set_n_iter', + 'n_iter', + 'Number of iterations to improve reversibility (default=1)', + default_value=1, + is_vector=False, + must_set_before_get=False, ) handler.add_method_parameter( - "get_initial_timestep_fac", # getter name in interface.cc - "set_initial_timestep_fac", # setter name in interface.cc - "initial_timestep_fac", # python parameter name - "initial timestep factor", # description - default_value = 0.0625 + 'get_collision_mode', + 'set_collision_mode', + 'collision_mode', + '0=off (default), 1=flag, 2=exception, 3=replace', + default_value=0, + is_vector=False, + must_set_before_get=False, ) handler.add_method_parameter( - "get_initial_timestep_limit", # getter name in interface.cc - "set_initial_timestep_limit", # setter name in interface.cc - "initial_timestep_limit", # python parameter name - "initial timestep limit", # description - default_value = 0.03125 + 'get_roche_mode', + 'set_roche_mode', + 'roche_mode', + '0=off, 1=flag, 2=exception', + default_value=0, + is_vector=False, + must_set_before_get=False, ) handler.add_method_parameter( - "get_initial_timestep_median", # getter name in interface.cc - "set_initial_timestep_median", # setter name in interface.cc - "initial_timestep_median", # python parameter name - "initial timestep median factor", # description - default_value = 8.0 + 'get_breakup_mode', + 'set_breakup_mode', + 'breakup_mode', + 'Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception', + default_value=0, + is_vector=False, + must_set_before_get=False, ) self.stopping_conditions.define_parameters(handler) - - def update_particle_set(self): - """ - update the particle set after changes in the code - - this implementation needs to move to the - amuse.datamodel.incode_storage module, as - it uses a lot of internal methods and info! - - """ - number_of_updated_particles = self.get_number_of_particles_updated() - - if number_of_updated_particles == 0: - return - - indices_in_update_list = list(range(number_of_updated_particles)) - particle_indices, updates \ - = self.get_id_of_updated_particle(indices_in_update_list) - - incode_storage = self.particles._private.attribute_storage - - indices_to_remove = [] - indices_to_add = [] - for index, status in zip(particle_indices, updates): - if status == 1: # deletion - indices_to_remove.append(index) - elif status == 2: # addition - indices_to_add.append(index) - - print('') - print("indices_to_remove:", indices_to_remove) - print("indices_to_add:", indices_to_add) - - if len(indices_to_remove) > 0: - incode_storage._remove_indices(indices_to_remove) - if len(indices_to_add) > 0: - incode_storage._add_indices(indices_to_add) - - def define_methods(self, handler): - GravitationalDynamics.define_methods(self, handler) - # Turn interface functions into methods. - handler.add_method( - "new_particle", - ( - nbody_system.mass, - nbody_system.length, - nbody_system.length, - nbody_system.length, - nbody_system.speed, - nbody_system.speed, - nbody_system.speed, - nbody_system.length, - handler.NO_UNIT - ), - ( - handler.INDEX, - handler.ERROR_CODE - ) - ) - - handler.add_method( - "set_eps2", - ( - nbody_system.length * nbody_system.length - ), - ( - handler.ERROR_CODE - ) - ) - - handler.add_method( - "get_eps2", - (), - ( - nbody_system.length * nbody_system.length, - handler.ERROR_CODE - ) - ) - - self.stopping_conditions.define_methods(handler) def define_particle_sets(self, handler): - GravitationalDynamics.define_particle_sets(self, handler) - - handler.add_getter('particles', 'get_particle_timestep', - names = ('timestep',)) - handler.add_getter('particles', 'get_potential', - names=('potential_in_code',)) - - self.stopping_conditions.define_particle_set(handler) - - -Ph4 = ph4 + handler.define_set('particles', 'index_of_the_particle') + handler.set_new('particles', 'new_particle') + handler.set_delete('particles', 'delete_particle') + handler.add_setter('particles', 'set_state') + handler.add_getter('particles', 'get_state') + handler.add_setter('particles', 'set_mass') + handler.add_getter('particles', 'get_mass', names=('mass',)) + handler.add_setter('particles', 'set_position') + handler.add_getter('particles', 'get_position') + handler.add_setter('particles', 'set_velocity') + handler.add_getter('particles', 'get_velocity') + handler.add_setter('particles', 'set_spin') + handler.add_getter('particles', 'get_spin') + handler.add_setter('particles', 'set_radius') + handler.add_getter('particles', 'get_radius') + handler.add_query( + 'particles', 'get_indices_of_colliding_particles', + public_name='select_colliding_particles' + ) From d190a18f4f8320fcf67db38043c5ca4abbd0663a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Dec 2025 15:02:56 +0100 Subject: [PATCH 004/174] TidyMess Makefile as well as __init__.py --- src/amuse_tidymess/Makefile | 81 ++++++++++++++++++++++++++++++++++ src/amuse_tidymess/__init__.py | 1 + 2 files changed, 82 insertions(+) create mode 100644 src/amuse_tidymess/Makefile create mode 100644 src/amuse_tidymess/__init__.py diff --git a/src/amuse_tidymess/Makefile b/src/amuse_tidymess/Makefile new file mode 100644 index 0000000000..114fa71db0 --- /dev/null +++ b/src/amuse_tidymess/Makefile @@ -0,0 +1,81 @@ +ifneq (,$(filter-out clean distclean, $(MAKECMDGOALS))) +include support/config.mk +endif + + +# Detecting dependencies +support/config.mk: + cd support && ./configure + + +# Downloading the code +VERSION = 4f97bfe11e8c638fdda744ca288e57565efe718a + +tidymess.tar.gz: + $(DOWNLOAD) https://github.com/tidymess-code/tidymess/archive/$(VERSION).tar.gz >$@ + +src/tidymess: tidymess.tar.gz + tar xf $< + mv tidymess-$(VERSION) src/tidymess + +# Building the code into a static library +DEPFLAGS += $(STOPCOND_CFLAGS) +CFLAGS += $(DEPFLAGS) + +LDLIBS += -lm $(STOPCOND_LIBS) + +CODELIB = src/libtidymess.a + +.PHONY: $(CODELIB) +$(CODELIB): | src + $(MAKE) -C src -j $(CPU_COUNT) all + + +# Building the workers +tidymess_worker.h: interface.py + amusifier --type=h interface.py tidymessInterface -o $@ + +tidymess_worker.cc: interface.py + amusifier --type=c interface.py tidymessInterface -o $@ + +tidymess_worker.o: tidymess_worker.cc tidymess_worker.h + $(MPICXX) -c -o $@ $(CFLAGS) $< + +tidymess_worker: interface.o tidymess_worker.o $(CODELIB) + $(MPICXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) + + +interface.o: interface.cc tidymess_worker.h + $(MPICXX) -o $@ -c -I src/tidymess/integrator/include $(CFLAGS) $< + + +# Which packages contain which workers? +amuse-tidymess_contains: tidymess_worker + + +# Building and installing packages +develop-%: %_contains + support/shared/uninstall.sh $* + python -m pip install -e packages/$* + +install-%: %_contains + support/shared/uninstall.sh $* + python -m pip install packages/$* + +package-%: %_contains + python3 -m pip install -vv --no-cache-dir --no-deps --no-build-isolation --prefix ${PREFIX} packages/$* + +test-%: + cd packages/$* && pytest + + +# Cleaning up +.PHONY: clean +clean: + $(MAKE) -C src clean + rm -rf *.o *worker* + +.PHONY: distclean +distclean: clean + rm -f support/config.mk support/config.log support/config.status + rm -rf support/autom4te.cache diff --git a/src/amuse_tidymess/__init__.py b/src/amuse_tidymess/__init__.py new file mode 100644 index 0000000000..70fc18e269 --- /dev/null +++ b/src/amuse_tidymess/__init__.py @@ -0,0 +1 @@ +from .interface import TidyMess From 175f05d564c43aa8089a20d4aef293e2b338059b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Dec 2025 15:04:26 +0100 Subject: [PATCH 005/174] added TidyMess test folder and test file --- src/amuse_tidymess/tests/test_tidymess.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/amuse_tidymess/tests/test_tidymess.py diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py new file mode 100644 index 0000000000..a8d760deef --- /dev/null +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -0,0 +1,12 @@ +from amuse.support.testing.amusetest import TestWithMPI + +from amuse.community.tidymess.interface import tidymessInterface, tidymess + +class tidymessInterfaceTests(TestWithMPI): + + def test_echo_int(self): + instance = tidymessInterface() + result,error = instance.echo_int(12) + self.assertEquals(error, 0) + self.assertEquals(result, 12) + instance.stop() From 750f8c8a75160fcd6d420dfc67362abed16d4404 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Dec 2025 15:06:33 +0100 Subject: [PATCH 006/174] added inner Makefile for TidyMess responsible for compiling the TidyMess code --- src/amuse_tidymess/src/Makefile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/amuse_tidymess/src/Makefile diff --git a/src/amuse_tidymess/src/Makefile b/src/amuse_tidymess/src/Makefile new file mode 100644 index 0000000000..e2c6d96b4b --- /dev/null +++ b/src/amuse_tidymess/src/Makefile @@ -0,0 +1,28 @@ +CFLAGS += -Wall -g +CXXFLAGS += $(CFLAGS) + +CODELIB := libtidymess.a + +SRCDIR := tidymess/integrator/src +INCDIR := tidymess/integrator/include + +SRC := $(wildcard $(SRCDIR)/*.cpp) +CODEOBJS := $(SRC:$(SRCDIR)/%.cpp=%.o) + + +all: $(CODELIB) + + +clean: + rm -f *.o *.a + +distclean: clean + +$(CODELIB): $(CODEOBJS) + rm -f $@ + $(AR) -ruv $@ $(CODEOBJS) + $(RANLIB) $@ + +%.o: $(SRCDIR)/%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ -I$(INCDIR) $< + From d643e10a725e7755566a70efb91222ef2dcf28be Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 3 Dec 2025 17:02:44 +0100 Subject: [PATCH 007/174] added interface.cc to amuse_tidymess --- src/amuse_tidymess/interface.cc | 495 ++++++++++++++++++++++++++++++++ 1 file changed, 495 insertions(+) create mode 100644 src/amuse_tidymess/interface.cc diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc new file mode 100644 index 0000000000..dd17258c19 --- /dev/null +++ b/src/amuse_tidymess/interface.cc @@ -0,0 +1,495 @@ +#include "worker_code.h" + +#include + +// AMUSE STOPPING CONDITIONS SUPPORT +#include +#include + +using namespace std; + +#include "src/Timer.h" +#include "src/Banner.h" + +#include "src/Initializer.h" +#include "src/Output.h" + +#include "src/Tidy.h" + +#include "src/Collision.h" +#include "src/Breakup.h" + +static Tidy tidymess; +static Initializer init; +static Collision collision; +static Breakup breakup; +static vector bodies = tidymess.get_particles(); + +int highest_index = 0; +static double begin_time = 0; + + +int get_ind_from_index(int index_of_the_particle) { + // find the position in bodies of the Body with a given index + vector bodies = tidymess.get_particles(); + int ind; + int i; + for (i=0; i 0) { + switch(init.initial_shape) { + case 0: + tidymess.set_to_spherical_shape(); + break; + case 1: + tidymess.set_to_equilibrium_shape(); + break; + } + tidymess.update_angular_momentum(); + } + return 0;} + +int determine_dt_sgn(double t_end) { // copied from tidymess.cpp + bool dt_pos; + int dt_sgn; + if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems + dt_pos = true; + dt_sgn = 1; + } + else { + dt_pos = false; + dt_sgn = -1; + } + tidymess.set_dt_sgn(dt_sgn); + return 0;} + +// tidymess-specific setters & getters + +int get_tidal_model(int * tidal_model){ + *tidal_model = tidymess.get_tidal_model(); + return 0;} +int set_tidal_model(int tidal_model){ + tidymess.set_tidal_model(tidal_model); + set_shapes_and_momenta(); + return 0;} + +int get_pn_order(int * pn_order){ + *pn_order = tidymess.get_pn_order(); + return 0;} +int set_pn_order(int pn_order){ + tidymess.set_pn_order(pn_order); + return 0;} + +int get_magnetic_braking(int * magnetic_braking){ + *magnetic_braking = tidymess.get_magnetic_braking(); + return 0;} +int set_magnetic_braking(int magnetic_braking){ + tidymess.set_magnetic_braking(magnetic_braking); + return 0;} + +int get_speed_of_light(double * speed_of_light){ + *speed_of_light = tidymess.get_speed_of_light(); + return 0;} +int set_speed_of_light(double speed_of_light){ + tidymess.set_speed_of_light(speed_of_light); + return 0;} + +int get_dt_mode(int * dt_mode){ + *dt_mode = tidymess.get_dt_mode(); + return 0;} +int set_dt_mode(int dt_mode){ + tidymess.set_dt_mode(dt_mode); + return 0;} + +int get_dt_const(double * dt_const){ + *dt_const = tidymess.get_dt_const(); + return 0;} +int set_dt_const(double dt_const){ + tidymess.set_dt_const(dt_const); + return 0;} + +int get_eta(double * eta){ + *eta = tidymess.get_eta(); + return 0;} +int set_eta(double eta){ + tidymess.set_eta(eta); + return 0;} + +int get_n_iter(int * n_iter){ + *n_iter = tidymess.get_n_iter(); + return 0;} +int set_n_iter(int n_iter){ + tidymess.set_n_iter(n_iter); + return 0;} + +int get_collision_mode(int * collision_mode){ + *collision_mode = tidymess.get_collision_mode(); + // maybe check if Tidy and Collision have the same value set + return 0;} +int set_collision_mode(int collision_mode){ + tidymess.set_collision_mode(collision_mode); + collision.set_collision_mode(collision_mode); + collision.setup(); + return 0;} + +int get_roche_mode(int * roche_mode){ + *roche_mode = collision.roche_mode; // doesn't appear in Tidy + return 0;} +int set_roche_mode(int roche_mode){ + collision.set_roche_mode(roche_mode); // doesn't appear in Tidy + collision.setup(); + return 0;} + +int get_breakup_mode(int * breakup_mode){ + *breakup_mode = breakup.mode; /// niet in Tidy + return 0;} +int set_breakup_mode(int breakup_mode){ + breakup.set_breakup_mode(breakup_mode); + breakup.setup(); + return 0;} + +int get_num_integration_step(int * num_integration_step) { + *num_integration_step = tidymess.get_num_integration_step(); + return 0;} + + +// For CommonCodeInterface +// https://github.com/amusecode/amuse/blob/main/src/amuse/community/interface/common.py + +int initialize_code(){ + // """ + // Run the initialization for the code, called before + // any other call on the code (so before any parameters + // are set or particles are defined in the code). + // """ + + //initialize_stopping_conditions(); + + // AMUSE STOPPING CONDITIONS SUPPORT + //set_support_for_condition(COLLISION_DETECTION); + return 0;} + +int cleanup_code(){ + // """ + // Run the cleanup for the code, called + // just before stopping the code. No functions + // should be called after this code. + // """ + return 0;} + +int commit_parameters(){ + // """ + // Perform initialization in the code dependent on the + // values of the parameters. + // Called after the parameters have been set or updated. + // """ + return 0;} +int recommit_parameters(){ + // """ + // Perform initialization actions after parameters + // have been updated (after commit_parameters and + // particles have been loaded). + // """ + return 0;} + + +// For GravitationalDynamicsInterface +// https://github.com/amusecode/amuse/blob/main/src/amuse/community/interface/gd.py + +int new_particle(int * index_of_the_particle, double mass, double x, + double y, double z, double vx, double vy, double vz, double radius, + double xi, double kf, double tau, double wx, double wy, double wz, double a_mb){ + // """ + // Define a new particle in the stellar dynamics code. The particle is + // initialized with the provided mass, radius, position and velocity. This + // function returns an index that can be used to refer to this particle. + // """ + + vector bodies = tidymess.get_particles(); + + Body newbody = {mass, radius, xi, kf, tau, a_mb, wx, wy, wz, x, y, z, vx, vy, vz}; + *index_of_the_particle = highest_index; + newbody.set_id(highest_index); + highest_index++; + + bodies.push_back(newbody); + tidymess.set_particles(bodies); + + tidymess.commit_parameters(); + + return 0;} + +int delete_particle(int index_of_the_particle){ + vector bodies = tidymess.get_particles(); + int ind = get_ind_from_index(index_of_the_particle); + bodies.erase(bodies.begin()+ind); + tidymess.set_particles(bodies); + return 0;} + +// setters & getters + +int set_state(int index_of_the_particle, double mass, double x, double y, + double z, double vx, double vy, double vz, double radius){ + vector bodies = tidymess.get_particles(); + int ind = get_ind_from_index(index_of_the_particle); + bodies[ind].m = mass; + bodies[ind].R = radius; + bodies[ind].r = {x, y, z}; + bodies[ind].v = {vx, vy, vz}; + tidymess.set_particles(bodies); + return 0;} +int get_state(int index_of_the_particle, double * mass, double * x, + double * y, double * z, double * vx, double * vy, double * vz, + double * radius){ + vector bodies = tidymess.get_particles(); + Body body = bodies[get_ind_from_index(index_of_the_particle)]; + *mass = body.m; + *x = body.r[0]; + *y = body.r[1]; + *z = body.r[2]; + *vx = body.v[0]; + *vy = body.v[1]; + *vz = body.v[2]; + *radius = body.R; + return 0;} + +int get_mass(int index_of_the_particle, double * mass){ + vector bodies = tidymess.get_particles(); + *mass = bodies[get_ind_from_index(index_of_the_particle)].m; + return 0;} +int set_mass(int index_of_the_particle, double mass){ + vector bodies = tidymess.get_particles(); + bodies[get_ind_from_index(index_of_the_particle)].m = mass; + tidymess.set_particles(bodies); + return 0;} + +int get_radius(int index_of_the_particle, double * radius){ + vector bodies = tidymess.get_particles(); + *radius = bodies[get_ind_from_index(index_of_the_particle)].R; + return 0;} +int set_radius(int index_of_the_particle, double radius){ + vector bodies = tidymess.get_particles(); + bodies[get_ind_from_index(index_of_the_particle)].R = radius; + tidymess.set_particles(bodies); + return 0;} + +int get_position(int index_of_the_particle, double * x, double * y, + double * z){ + vector bodies = tidymess.get_particles(); + array position = bodies[get_ind_from_index(index_of_the_particle)].r; + *x = position[0]; + *y = position[1]; + *z = position[2]; + return 0;} +int set_position(int index_of_the_particle, double x, double y, double z){ + vector bodies = tidymess.get_particles(); + bodies[get_ind_from_index(index_of_the_particle)].r = {x, y, z}; + tidymess.set_particles(bodies); + return 0;} + +int get_velocity(int index_of_the_particle, double * vx, double * vy, + double * vz){ + vector bodies = tidymess.get_particles(); + array velocity = bodies[get_ind_from_index(index_of_the_particle)].v; + *vx = velocity[0]; + *vy = velocity[1]; + *vz = velocity[2]; + return 0;} +int set_velocity(int index_of_the_particle, double vx, double vy, + double vz){ + vector bodies = tidymess.get_particles(); + bodies[get_ind_from_index(index_of_the_particle)].v = {vx, vy, vz}; + tidymess.set_particles(bodies); + return 0;} + +int get_spin(int index_of_the_particle, double * wx, double * wy, + double * wz){ + vector bodies = tidymess.get_particles(); + array spin = bodies[get_ind_from_index(index_of_the_particle)].w; + *wx = spin[0]; + *wy = spin[1]; + *wz = spin[2]; + return 0;} +int set_spin(int index_of_the_particle, double wx, double wy, + double wz){ + vector bodies = tidymess.get_particles(); + bodies[get_ind_from_index(index_of_the_particle)].w = {wx, wy, wz}; + tidymess.set_particles(bodies); + return 0;} + +int get_acceleration(int index_of_the_particle, double * ax, double * ay, + double * az){ + return 0;} +int set_acceleration(int index_of_the_particle, double ax, double ay, + double az){ + return 0;} + +int get_eps2(double * epsilon_squared){ + return 0;} +int set_eps2(double epsilon_squared){ + return 0;} + +int get_potential(int index_of_the_particle, double * potential){ + return 0;} + +int get_kinetic_energy(double * kinetic_energy){ + return 0;} +int get_potential_energy(double * potential_energy){ + return 0;} + +int get_time(double * time){ + *time = tidymess.get_model_time(); + return 0;} + +int get_begin_time(double * time){ + *time = begin_time; + return 0;} +int set_begin_time(double time){ + begin_time = time; + return 0;} + +int get_time_step(double * time_step){ + *time_step = tidymess.get_dt_const(); + if (tidymess.get_dt_mode() > 0) { + *time_step = tidymess.get_dt_prev(); + } + return 0;} + +int get_total_mass(double * mass){ + vector bodies = tidymess.get_particles(); + *mass = 0.0; + for (int i = 0; i< bodies.size(); i++) { + *mass += bodies[i].m; + } + return 0;} + +int get_total_radius(double * radius){ + vector bodies = tidymess.get_particles(); + *radius = 0.0; + for (int i = 0; i< bodies.size(); i++) { + *radius += bodies[i].R; + } + return 0;} + +int get_center_of_mass_position(double * x, double * y, double * z){ + array position = tidymess.get_center_of_mass(); + *x = position[0]; + *y = position[1]; + *z = position[2]; + return 0;} +int get_center_of_mass_velocity(double * vx, double * vy, double * vz){ + array velocity = tidymess.get_center_of_mass_velocity(); + *vx = velocity[0]; + *vy = velocity[1]; + *vz = velocity[2]; + return 0;} + +int get_number_of_particles(int * number_of_particles){ + vector bodies = tidymess.get_particles(); + *number_of_particles = bodies.size(); + return 0;} + +int get_index_of_first_particle(int * index_of_the_particle){ + Body body = tidymess.get_particles()[0]; + *index_of_the_particle = body.id; + return 0;} +int get_index_of_next_particle(int index_of_the_particle, + int * index_of_the_next_particle){ + vector bodies = tidymess.get_particles(); + Body body = bodies[get_ind_from_index(index_of_the_particle)+1]; + *index_of_the_next_particle = body.id; + return 0;} + + +// evolving + +int evolve_model(double time){ + // Evolve the model until the given time, or until a stopping condition is set. + + tidymess.commit_parameters(); // has to be called sometime before evolving + determine_dt_sgn(time); + + tidymess.evolve_model(time); + return 0;} + +int commit_particles(){ + return 0;} +int recommit_particles(){ + return 0;} + +int synchronize_model(){ + return 0;} + +int get_potential_at_point(double eps, double x, double y, double z, + double * phi, int npoints){ + return 0;} + +int get_gravity_at_point(double eps, double x, double y, double z, + double * ax, double * ay, double * az, int npoints){ + return 0;} + + +// compute spin vector (largely copied from Initializer) +int convert_spin_vectors_to_inertial(double P, double obl, double psi, double * wx, double * wy, double * wz) { + + if(P == 0) { + *wx = 0.; + *wy = 0.; + *wz = 0.; + } + else { + double wmag = 2*M_PI/P; + + vector w_vec(3); + w_vec[0] = 0; + w_vec[1] = 0; + w_vec[2] = wmag; + + w_vec = init.rotZrotX(psi, obl, w_vec); + + *wx = w_vec[0]; + *wy = w_vec[1]; + *wz = w_vec[2]; + } + return 0;} + + +// collision detection + +int detect_collision(int * collision_flag, int * n_collisions, int * index1, int * index2) { + // Collision handling + *collision_flag = tidymess.get_collision_flag(); + vector< array > collided_indices = tidymess.get_collision_indices(); + *n_collisions = collided_indices.size(); + *index1 = 0; + *index2 = 0; + + if (collided_indices.size() > 0) { + array collided_index = collided_indices[0]; + *index1 = collided_index[0]; + *index2 = collided_index[1]; + } + + return 0;} + +int merge_collided_particles(int * number_of_particles) { + vector< array > cindex = tidymess.get_collision_indices(); + collision.replace(bodies, cindex); + + tidymess.set_particles(bodies); + tidymess.commit_particles(); + + vector bodies = tidymess.get_particles(); + *number_of_particles = bodies.size(); + return 0;} + + + + From 4a6908e18fd7cff97e02dcd01b1195cf8bd38c80 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Dec 2025 16:38:45 +0100 Subject: [PATCH 008/174] added TidyMess and TidyMessInterface in amuse/src/amuse/community --- src/amuse/community/tidymess/__init__.py | 1 + src/amuse/community/tidymess/interface.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 src/amuse/community/tidymess/__init__.py create mode 100644 src/amuse/community/tidymess/interface.py diff --git a/src/amuse/community/tidymess/__init__.py b/src/amuse/community/tidymess/__init__.py new file mode 100644 index 0000000000..70fc18e269 --- /dev/null +++ b/src/amuse/community/tidymess/__init__.py @@ -0,0 +1 @@ +from .interface import TidyMess diff --git a/src/amuse/community/tidymess/interface.py b/src/amuse/community/tidymess/interface.py new file mode 100644 index 0000000000..abe890731d --- /dev/null +++ b/src/amuse/community/tidymess/interface.py @@ -0,0 +1,5 @@ +from amuse.support.import_helper import load_code + + +TidyMessInterface = load_code("tidymess", "TidyMessInterface") +TidyMess = load_code("tidymess", "TidyMess") From 599e91e9d187fd454b1ba1ed3e26ada3f54c8fab Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Dec 2025 16:55:05 +0100 Subject: [PATCH 009/174] rm tidymess package --- src/amuse_tidymess/src/tidymess/README | 19 - .../examples/earth_moon/earth_moon.ic | 24 - .../examples/earth_moon/earth_moon.par | 72 - .../examples/exoplanet_hd80606b/hd80606b.ic | 21 - .../examples/exoplanet_hd80606b/hd80606b.par | 72 - .../examples/heartbeat_star_koi54/koi54.ic | 22 - .../examples/heartbeat_star_koi54/koi54.par | 72 - .../examples/sun_earth_moon/sun_earth_moon.ic | 22 - .../sun_earth_moon/sun_earth_moon.par | 72 - .../src/tidymess/integrator/include/Banner.h | 22 - .../src/tidymess/integrator/include/Body.h | 76 - .../src/tidymess/integrator/include/Breakup.h | 44 - .../tidymess/integrator/include/Collision.h | 49 - .../integrator/include/Evolver_base.h | 70 - .../integrator/include/Evolver_creep.h | 22 - .../integrator/include/Evolver_creep_col.h | 24 - .../integrator/include/Evolver_creep_col_mb.h | 24 - .../integrator/include/Evolver_creep_col_pn.h | 24 - .../include/Evolver_creep_col_pn_mb.h | 24 - .../integrator/include/Evolver_creep_mb.h | 22 - .../integrator/include/Evolver_creep_pn.h | 22 - .../integrator/include/Evolver_creep_pn_mb.h | 22 - .../integrator/include/Evolver_direct.h | 21 - .../integrator/include/Evolver_direct_col.h | 22 - .../include/Evolver_direct_col_mb.h | 22 - .../include/Evolver_direct_col_pn.h | 22 - .../include/Evolver_direct_col_pn_mb.h | 22 - .../integrator/include/Evolver_direct_mb.h | 21 - .../integrator/include/Evolver_direct_pn.h | 21 - .../integrator/include/Evolver_direct_pn_mb.h | 21 - .../integrator/include/Evolver_equilibrium.h | 22 - .../include/Evolver_equilibrium_col.h | 23 - .../include/Evolver_equilibrium_col_mb.h | 23 - .../include/Evolver_equilibrium_col_pn.h | 23 - .../include/Evolver_equilibrium_col_pn_mb.h | 23 - .../include/Evolver_equilibrium_mb.h | 22 - .../include/Evolver_equilibrium_pn.h | 22 - .../include/Evolver_equilibrium_pn_mb.h | 22 - .../integrator/include/Evolver_linear.h | 22 - .../integrator/include/Evolver_linear_col.h | 23 - .../include/Evolver_linear_col_mb.h | 23 - .../include/Evolver_linear_col_pn.h | 23 - .../include/Evolver_linear_col_pn_mb.h | 23 - .../integrator/include/Evolver_linear_mb.h | 22 - .../integrator/include/Evolver_linear_pn.h | 22 - .../integrator/include/Evolver_linear_pn_mb.h | 22 - .../integrator/include/Evolver_nbody.h | 20 - .../integrator/include/Evolver_nbody_base.h | 19 - .../integrator/include/Evolver_nbody_col.h | 22 - .../integrator/include/Evolver_nbody_col_pn.h | 22 - .../integrator/include/Evolver_nbody_pn.h | 20 - .../integrator/include/Evolver_shape_base.h | 32 - .../src/tidymess/integrator/include/Force.h | 154 - .../tidymess/integrator/include/Initializer.h | 174 - .../src/tidymess/integrator/include/Orbit.h | 42 - .../src/tidymess/integrator/include/Output.h | 106 - .../src/tidymess/integrator/include/Shape.h | 77 - .../src/tidymess/integrator/include/Spin.h | 43 - .../src/tidymess/integrator/include/Tidy.h | 234 -- .../src/tidymess/integrator/include/Timer.h | 25 - .../integrator/include/Timestep_adapt.h | 30 - .../include/Timestep_adapt_weight.h | 31 - .../integrator/include/Timestep_base.h | 55 - .../integrator/include/Timestep_const.h | 28 - .../integrator/include/Timestep_direct.h | 33 - .../include/Timestep_direct_weight.h | 34 - .../src/tidymess/integrator/include/Units.h | 86 - .../src/tidymess/integrator/src/Banner.cpp | 54 - .../src/tidymess/integrator/src/Body.cpp | 258 -- .../src/tidymess/integrator/src/Breakup.cpp | 81 - .../src/tidymess/integrator/src/Collision.cpp | 477 --- .../tidymess/integrator/src/Evolver_base.cpp | 74 - .../tidymess/integrator/src/Evolver_creep.cpp | 173 - .../integrator/src/Evolver_creep_col.cpp | 273 -- .../integrator/src/Evolver_creep_col_mb.cpp | 277 -- .../integrator/src/Evolver_creep_col_pn.cpp | 277 -- .../src/Evolver_creep_col_pn_mb.cpp | 281 -- .../integrator/src/Evolver_creep_mb.cpp | 175 - .../integrator/src/Evolver_creep_pn.cpp | 175 - .../integrator/src/Evolver_creep_pn_mb.cpp | 177 - .../integrator/src/Evolver_direct.cpp | 106 - .../integrator/src/Evolver_direct_col.cpp | 181 - .../integrator/src/Evolver_direct_col_mb.cpp | 199 -- .../integrator/src/Evolver_direct_col_pn.cpp | 181 - .../src/Evolver_direct_col_pn_mb.cpp | 199 -- .../integrator/src/Evolver_direct_mb.cpp | 115 - .../integrator/src/Evolver_direct_pn.cpp | 106 - .../integrator/src/Evolver_direct_pn_mb.cpp | 115 - .../integrator/src/Evolver_equilibrium.cpp | 164 - .../src/Evolver_equilibrium_col.cpp | 271 -- .../src/Evolver_equilibrium_col_mb.cpp | 278 -- .../src/Evolver_equilibrium_col_pn.cpp | 281 -- .../src/Evolver_equilibrium_col_pn_mb.cpp | 286 -- .../integrator/src/Evolver_equilibrium_mb.cpp | 167 - .../integrator/src/Evolver_equilibrium_pn.cpp | 167 - .../src/Evolver_equilibrium_pn_mb.cpp | 171 - .../integrator/src/Evolver_linear.cpp | 150 - .../integrator/src/Evolver_linear_col.cpp | 245 -- .../integrator/src/Evolver_linear_col_mb.cpp | 249 -- .../integrator/src/Evolver_linear_col_pn.cpp | 249 -- .../src/Evolver_linear_col_pn_mb.cpp | 253 -- .../integrator/src/Evolver_linear_mb.cpp | 151 - .../integrator/src/Evolver_linear_pn.cpp | 152 - .../integrator/src/Evolver_linear_pn_mb.cpp | 154 - .../tidymess/integrator/src/Evolver_nbody.cpp | 61 - .../integrator/src/Evolver_nbody_base.cpp | 22 - .../integrator/src/Evolver_nbody_col.cpp | 112 - .../integrator/src/Evolver_nbody_col_pn.cpp | 127 - .../integrator/src/Evolver_nbody_pn.cpp | 76 - .../integrator/src/Evolver_shape_base.cpp | 29 - .../src/tidymess/integrator/src/Force.cpp | 3062 ---------------- .../tidymess/integrator/src/Initializer.cpp | 3112 ----------------- .../src/tidymess/integrator/src/Orbit.cpp | 212 -- .../src/tidymess/integrator/src/Output.cpp | 2415 ------------- .../src/tidymess/integrator/src/Shape.cpp | 860 ----- .../src/tidymess/integrator/src/Spin.cpp | 177 - .../src/tidymess/integrator/src/Tidy.cpp | 589 ---- .../src/tidymess/integrator/src/Timer.cpp | 41 - .../integrator/src/Timestep_adapt.cpp | 53 - .../integrator/src/Timestep_adapt_weight.cpp | 154 - .../tidymess/integrator/src/Timestep_base.cpp | 76 - .../integrator/src/Timestep_const.cpp | 14 - .../integrator/src/Timestep_direct.cpp | 95 - .../integrator/src/Timestep_direct_weight.cpp | 206 -- .../src/tidymess/integrator/src/Units.cpp | 485 --- .../src/tidymess/integrator/src/tidymess.cpp | 502 --- src/amuse_tidymess/src/tidymess/makefile | 33 - src/amuse_tidymess/src/tidymess/tidymess.ic | 20 - src/amuse_tidymess/src/tidymess/tidymess.par | 72 - 129 files changed, 22607 deletions(-) delete mode 100644 src/amuse_tidymess/src/tidymess/README delete mode 100755 src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.ic delete mode 100755 src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.par delete mode 100755 src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.ic delete mode 100755 src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.par delete mode 100755 src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.ic delete mode 100755 src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.par delete mode 100755 src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.ic delete mode 100755 src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.par delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Banner.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Body.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Breakup.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Collision.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_base.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_mb.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn_mb.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_base.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_pn.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Evolver_shape_base.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Force.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Initializer.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Orbit.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Output.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Shape.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Spin.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Tidy.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Timer.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt_weight.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_base.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_const.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct_weight.h delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/include/Units.h delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Banner.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Body.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Breakup.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Collision.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_base.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn_mb.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_mb.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn_mb.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_base.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_pn.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Evolver_shape_base.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Force.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Initializer.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Orbit.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Output.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Shape.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Spin.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Tidy.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Timer.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt_weight.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_base.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_const.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct.cpp delete mode 100644 src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct_weight.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/Units.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/integrator/src/tidymess.cpp delete mode 100755 src/amuse_tidymess/src/tidymess/makefile delete mode 100755 src/amuse_tidymess/src/tidymess/tidymess.ic delete mode 100755 src/amuse_tidymess/src/tidymess/tidymess.par diff --git a/src/amuse_tidymess/src/tidymess/README b/src/amuse_tidymess/src/tidymess/README deleted file mode 100644 index 18aa7fbfe5..0000000000 --- a/src/amuse_tidymess/src/tidymess/README +++ /dev/null @@ -1,19 +0,0 @@ -Welcome to TIDYMESS! - -- TIDYMESS is a C++ code. -- It was developed and tested within the Ubuntu and Mac environments. - -- Simpy open a terminal, enter the tidymess directory, and compile the code using "make clean" and "make". -- The compilation will produce the executable (tidymess.exe) and the "build" folder inside the "integrator" folder. -- If there are compilation errors due to bugs within the code, please contact us with the error message. - -- By typing "./tidymess.exe -h" or "./tidymess.exe --help" some documentation is presented on how to run the code. -- A simulation is defined by specifying two files: parameter file (e.g. tidymess.par) and initial condition file (e.g. tidymess.ic). -- We provide a few examples in the "examples" folder, which can be used to get you on your way with TIDYMESS. - -Boa Sorte! - - -Tjarda Boekholt and Alexandre Correia -Oct. 2022 - diff --git a/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.ic b/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.ic deleted file mode 100755 index aa786c264b..0000000000 --- a/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.ic +++ /dev/null @@ -1,24 +0,0 @@ -Name Earth Moon - -mass[kg] 5.9724e24 0.07346e24 -R[km] 6371. 1737.4 -xi 0.3308 0.394 - -kf 0.933 0 -tau[s] 180 0 - -lod[day] 1.0 27.322 -obl[deg] 0.0 0.0 -psi[deg] 0.0 0.0 - -database: IMCCE INPOP19a -reference plane: Geocentric, equatorial, J2000 -Epoque: 2021-06-21T21:43:31.044 - -a[km] 0.3844e6 -e 0.0 -I 0 -O 0 -w 0 -M 0 - diff --git a/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.par b/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.par deleted file mode 100755 index 866727e431..0000000000 --- a/src/amuse_tidymess/src/tidymess/examples/earth_moon/earth_moon.par +++ /dev/null @@ -1,72 +0,0 @@ -//-------------------------------------------------------------------------------------------------- -// Simulation parameters -//-------------------------------------------------------------------------------------------------- - -to_continue = 0 // 0=new simulation, 1=continue simulation -max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. - -//-------------------------------------------------------------------------------------------------- -// Physical model parameters -//-------------------------------------------------------------------------------------------------- - -tidal_model = 4 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess -pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn -B_braking = 0 // Magnetic braking. 0=off, 1=on - -collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace -roche_limit = 0 // 0=off, 1=flag, 2=exception -breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception - -//-------------------------------------------------------------------------------------------------- -// Unit system -//-------------------------------------------------------------------------------------------------- - -mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] -length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] -time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] -speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] - -speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. - -//-------------------------------------------------------------------------------------------------- -// Initial condition parameters -//-------------------------------------------------------------------------------------------------- - -file_ic = earth_moon.ic // initial condition file - -orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian -spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit - -initial_shape = 0 // 0=sphere, 1=equilibrium -num_body = 0 // 0=all, num_body+1=number of bodies to include - -//-------------------------------------------------------------------------------------------------- -// Output parameters -//-------------------------------------------------------------------------------------------------- - -snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval -n_snapshot = 1e2 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) - -output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. -overwrite = 1 // overwrite existing files: 0=no, 1=yes - -output_format = 0 // 0=file per body, 1=file per snapshot, 2=single file -output_info = 1 // 0=time-varying quantities, 1=all quantities -output_coor = 0 // 0=cartesian inertial - -output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' -output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes - -//-------------------------------------------------------------------------------------------------- -// Integration parameters -//-------------------------------------------------------------------------------------------------- - -t_begin = 0 // begin time in units given by time_unit -t_end = 1e3 // final time in units given by time_unit - -dt_mode = 2 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt -dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) -eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) - -n_iter = 1 // Number of iterations to improve reversibility (default=1) - diff --git a/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.ic b/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.ic deleted file mode 100755 index 25d1e732e5..0000000000 --- a/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.ic +++ /dev/null @@ -1,21 +0,0 @@ -Name Star Planet - -mass[kg] 2.0088092e+30 7.7459434e+27 -R[km] 702455.0 68488.3446 -xi 0.070 0.25 - -kf 0.0 0.5 -tau[yr] 0 1e-2 - -lod[day] 24.47 0.5 -obl[deg] 0.0 0.0 -psi[deg] 0.0 0.0 - -a[AU] 0.455 -e 0.9330 -I 0 -O 0 -w 0 -M 0 - - diff --git a/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.par b/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.par deleted file mode 100755 index 39e9236f53..0000000000 --- a/src/amuse_tidymess/src/tidymess/examples/exoplanet_hd80606b/hd80606b.par +++ /dev/null @@ -1,72 +0,0 @@ -//-------------------------------------------------------------------------------------------------- -// Simulation parameters -//-------------------------------------------------------------------------------------------------- - -to_continue = 0 // 0=new simulation, 1=continue simulation -max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. - -//-------------------------------------------------------------------------------------------------- -// Physical model parameters -//-------------------------------------------------------------------------------------------------- - -tidal_model = 4 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess -pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn -B_braking = 0 // Magnetic braking. 0=off, 1=on - -collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace -roche_limit = 0 // 0=off, 1=flag, 2=exception -breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception - -//-------------------------------------------------------------------------------------------------- -// Unit system -//-------------------------------------------------------------------------------------------------- - -mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] -length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] -time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] -speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] - -speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. - -//-------------------------------------------------------------------------------------------------- -// Initial condition parameters -//-------------------------------------------------------------------------------------------------- - -file_ic = hd80606b.ic // initial condition file - -orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian -spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit - -initial_shape = 0 // 0=sphere, 1=equilibrium -num_body = 0 // 0=all, num_body+1=number of bodies to include - -//-------------------------------------------------------------------------------------------------- -// Output parameters -//-------------------------------------------------------------------------------------------------- - -snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval -n_snapshot = 1e4 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) - -output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. -overwrite = 1 // overwrite existing files: 0=no, 1=yes - -output_format = 0 // 0=file per body, 1=file per snapshot, 2=single file -output_info = 1 // 0=time-varying quantities, 1=all quantities -output_coor = 0 // 0=cartesian inertial - -output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' -output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes - -//-------------------------------------------------------------------------------------------------- -// Integration parameters -//-------------------------------------------------------------------------------------------------- - -t_begin = 0 // begin time in units given by time_unit -t_end = 1e4 // final time in units given by time_unit - -dt_mode = 2 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt -dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) -eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) - -n_iter = 1 // Number of iterations to improve reversibility (default=1) - diff --git a/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.ic b/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.ic deleted file mode 100755 index b6fdd325b3..0000000000 --- a/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.ic +++ /dev/null @@ -1,22 +0,0 @@ -Name Primary Secondary - -mass[MSun] 2.33 2.39 -R[RSun] 2.20 2.33 -xi 0.052 0.052 - -kf 0.012 0.012 -tau[yr] 0.0001 0.0001 - -lod[day] 0.728862612579 2.55101914403 -obl[deg] 0.0 0.0 -psi[deg] 0.0 0.0 - -a[AU] 0.3956 -e 0.8335 -I[deg] 5.50 -O[deg] 0 -w[deg] 36.70 -M[deg] 180 - -# Reference: Welsh et al. (2011) - diff --git a/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.par b/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.par deleted file mode 100755 index 15bd075c8f..0000000000 --- a/src/amuse_tidymess/src/tidymess/examples/heartbeat_star_koi54/koi54.par +++ /dev/null @@ -1,72 +0,0 @@ -//-------------------------------------------------------------------------------------------------- -// Simulation parameters -//-------------------------------------------------------------------------------------------------- - -to_continue = 0 // 0=new simulation, 1=continue simulation -max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. - -//-------------------------------------------------------------------------------------------------- -// Physical model parameters -//-------------------------------------------------------------------------------------------------- - -tidal_model = 3 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess -pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn -B_braking = 0 // Magnetic braking. 0=off, 1=on - -collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace -roche_limit = 0 // 0=off, 1=flag, 2=exception -breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception - -//-------------------------------------------------------------------------------------------------- -// Unit system -//-------------------------------------------------------------------------------------------------- - -mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] -length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] -time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] -speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] - -speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. - -//-------------------------------------------------------------------------------------------------- -// Initial condition parameters -//-------------------------------------------------------------------------------------------------- - -file_ic = koi54.ic // initial condition file - -orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian -spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit - -initial_shape = 1 // 0=sphere, 1=equilibrium -num_body = 0 // 0=all, num_body+1=number of bodies to include - -//-------------------------------------------------------------------------------------------------- -// Output parameters -//-------------------------------------------------------------------------------------------------- - -snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval -n_snapshot = 2e2 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) - -output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. -overwrite = 1 // overwrite existing files: 0=no, 1=yes - -output_format = 0 // 0=file per body, 1=file per snapshot, 2=single file -output_info = 1 // 0=time-varying quantities, 1=all quantities -output_coor = 0 // 0=cartesian inertial - -output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' -output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes - -//-------------------------------------------------------------------------------------------------- -// Integration parameters -//-------------------------------------------------------------------------------------------------- - -t_begin = 0 // begin time in units given by time_unit -t_end = 20 // final time in units given by time_unit - -dt_mode = 2 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt -dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) -eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) - -n_iter = 1 // Number of iterations to improve reversibility (default=1) - diff --git a/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.ic b/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.ic deleted file mode 100755 index c2cd48a4a4..0000000000 --- a/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.ic +++ /dev/null @@ -1,22 +0,0 @@ -Name Earth Moon Sun - -mass[kg] 5.9724e24 0.07346e24 1.989e30 -R[km] 6371. 1737.4 695700. -xi 0.3308 0.394 0.070 - -kf 0.933 0 0 -tau[s] 1 0 0 - -lod[hour] 5.0 0.0 0.0 -obl[deg] 0.0 0.0 0.0 -psi[deg] 0.0 0.0 0.0 - -a[km] 22298.5 149598073. -e 0.01 0.0 -I 0 10 -O 0 0 -w 0 0 -M 0 0 - -Adopted from Touma & Wisdom (1998) and Williams (2016). - diff --git a/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.par b/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.par deleted file mode 100755 index 4a95a57da3..0000000000 --- a/src/amuse_tidymess/src/tidymess/examples/sun_earth_moon/sun_earth_moon.par +++ /dev/null @@ -1,72 +0,0 @@ -//-------------------------------------------------------------------------------------------------- -// Simulation parameters -//-------------------------------------------------------------------------------------------------- - -to_continue = 0 // 0=new simulation, 1=continue simulation -max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. - -//-------------------------------------------------------------------------------------------------- -// Physical model parameters -//-------------------------------------------------------------------------------------------------- - -tidal_model = 4 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess -pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn -B_braking = 0 // Magnetic braking. 0=off, 1=on - -collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace -roche_limit = 0 // 0=off, 1=flag, 2=exception -breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception - -//-------------------------------------------------------------------------------------------------- -// Unit system -//-------------------------------------------------------------------------------------------------- - -mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] -length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] -time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] -speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] - -speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. - -//-------------------------------------------------------------------------------------------------- -// Initial condition parameters -//-------------------------------------------------------------------------------------------------- - -file_ic = sun_earth_moon.ic // initial condition file - -orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian -spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit - -initial_shape = 0 // 0=sphere, 1=equilibrium -num_body = 0 // 0=all, num_body+1=number of bodies to include - -//-------------------------------------------------------------------------------------------------- -// Output parameters -//-------------------------------------------------------------------------------------------------- - -snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval -n_snapshot = 1e2 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) - -output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. -overwrite = 1 // overwrite existing files: 0=no, 1=yes - -output_format = 0 // 0=file per body, 1=file per snapshot, 2=single file -output_info = 1 // 0=time-varying quantities, 1=all quantities -output_coor = 0 // 0=cartesian inertial - -output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' -output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes - -//-------------------------------------------------------------------------------------------------- -// Integration parameters -//-------------------------------------------------------------------------------------------------- - -t_begin = 0 // begin time in units given by time_unit -t_end = 1e2 // final time in units given by time_unit - -dt_mode = 2 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt -dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) -eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) - -n_iter = 1 // Number of iterations to improve reversibility (default=1) - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Banner.h b/src/amuse_tidymess/src/tidymess/integrator/include/Banner.h deleted file mode 100644 index 9a25f9bb3b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Banner.h +++ /dev/null @@ -1,22 +0,0 @@ -#include -using namespace std; - -#ifndef __Banner_h -#define __Banner_h - -class Banner { - public: - - void print_banner(); - - void print_intro(bool to_continue); - void print_outro(string output_dir); - - void print_reference(); - void print_stars(); - - void print_header(); -}; - -#endif - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Body.h b/src/amuse_tidymess/src/tidymess/integrator/include/Body.h deleted file mode 100755 index b2206ea593..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Body.h +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include -#include -using namespace std; - -#ifndef __Body_h -#define __Body_h - -class Body { - public: - - // Initializers - Body(); - - Body(double m, double R, double xi, double kf, double tau, double a_mb, double wx, double wy, double wz, double x, double y, double z, double vx, double vy, double vz); - Body(double m, double R, double xi, double kf, double tau, double a_mb, array w, array r, array v); - Body(array &d); - - void setup(array &d); - void set_id(int id); - void set_name(string name); - - void reset(); - void update_aux_properties(); - - // Tag - int id; - string name; - - int particle_type; // 0 = test-particle, 1 = point-particle, 2 = rigid sphere, 3 = deformable ellipsoid - - // Internal properties - double m, R, xi; - double kf, tau; - double a_mb; - - double R3, R5, R5_3, kf_R5, kf_R5_3; - double rho, tau_inv; - - double roche_factor, roche_factor3; - - // Orbital properties - array r, v; - array a; - - array r_prev; - array vv; - - // Spin properties - array L, w; - array T; - - array L_prev, w_prev; - array K; - - // Shape properties - array I_p, I_n, I, I_inv; - array I_e_r, dI_e_r, I_e_w, I_e, dI_e, dI_n; - - array I_e_rh, I_e_prev, I_n_prev, I_e_prev_bu; - array J_n, J, J_inv; - - // Integration variables - bool isLinear; - double expo, expoh, dt_rot, dth_rot; - - bool isLinear_1; - double expo_1, expoh_1, dt_rot_1, dth_rot_1; - - bool isLinear_2; - double expo_2, expoh_2, dt_rot_2, dth_rot_2; -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Breakup.h b/src/amuse_tidymess/src/tidymess/integrator/include/Breakup.h deleted file mode 100755 index 2be0dd144b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Breakup.h +++ /dev/null @@ -1,44 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include -#include - -#include "Body.h" - -#ifndef __Breakup_h -#define __Breakup_h - -class Breakup { - public: - - // Variables and structures - bool to_detect; - int mode; - - vector breakup_id; - int N_breakup; - - // Initializers - Breakup(); - - // Getters and Setters - void set_breakup_mode(int breakup_mode); - void setup(); - - int get_N_breakup(); - vector get_breakup_indices(); - - // Handlers - bool detect_breakup(vector &bodies); - - // Printer - void print_id(); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Collision.h b/src/amuse_tidymess/src/tidymess/integrator/include/Collision.h deleted file mode 100755 index 7b0285cba7..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Collision.h +++ /dev/null @@ -1,49 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include - -#include "Body.h" - -#ifndef __Collision_h -#define __Collision_h - -class Collision { - public: - - // Variables and structures - int collision_mode, roche_mode; - bool to_detect_collision, to_detect_roche; - - vector< vector > chain_id, chain_index; - int Ng; - - // Initializers - Collision(); - - // Getters and Setters - void set_collision_mode(int collision_mode); - void set_roche_mode(int roche_mode); - - void setup(); - - // Handlers - void process_collision_chains(vector< array > &cindex); - void convert_id_to_index(vector &bodies); - - void replace_test_body(vector &bodies, int i, int Ns, vector &index_sec); - void replace_point_body(vector &bodies, int i, int Ns, vector &index_sec); - void replace_tidal_body(vector &bodies, int i, int Ns, vector &index_sec); - - void replace(vector &bodies, vector< array > &cindex); - - // Printer - void print_indices(vector< array > &cindex); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_base.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_base.h deleted file mode 100644 index cec63112d9..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_base.h +++ /dev/null @@ -1,70 +0,0 @@ -#include "Force.h" - -#include "Timestep_base.h" - -#include "Timestep_const.h" -#include "Timestep_adapt.h" -#include "Timestep_direct.h" -#include "Timestep_adapt_weight.h" -#include "Timestep_direct_weight.h" - -#include "Orbit.h" -#include "Spin.h" -#include "Shape.h" - -#ifndef __Evolver_base_h -#define __Evolver_base_h - -class Evolver_base { - public: - - // Variables and Objects - Orbit orbit; - Spin spin; - Shape shape; - - double dt_step; - double w1, w2, w3; - int n_iter; - int num_integration_step; - - int collision_mode, roche_mode; - bool collision_flag, roche_flag; - - // Initializers - Evolver_base(); - - void assign_vectors(vector &bodies, Force *force); - - void set_n_iter(int n_iter); - int get_n_iter(); - - void reset_aux(vector &bodies); - - void set_collision_mode(int collision_mode); - void set_roche_mode(int roche_mode); - - // Get diagnostics - array get_center_of_mass(vector &bodies); - array get_center_of_mass_velocity(vector &bodies); - array get_orbital_angular_momentum(vector &bodies); - double get_orbital_kinetic_energy(vector &bodies); - - virtual array get_spin_angular_momentum(vector &bodies) = 0; - virtual double get_spin_kinetic_energy(vector &bodies) = 0; - virtual double get_potential_energy(vector &bodies) = 0; - virtual array get_angular_momentum(vector &bodies) = 0; - virtual double get_energy(vector &bodies) = 0; - - // Evolve function - virtual void initialize(vector &bodies, Force *force) = 0; - - virtual void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) = 0; - virtual void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) = 0; - - bool stopping_condition_time(double t0, double t1, int dt_sgn); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep.h deleted file mode 100644 index 0d4b25a3ee..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_creep_h -#define __Evolver_creep_h - -class Evolver_creep : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dth); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col.h deleted file mode 100644 index 206c60aa29..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col.h +++ /dev/null @@ -1,24 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_creep_col_h -#define __Evolver_creep_col_h - -class Evolver_creep_col : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void sync_step(vector &bodies, Force *force, double dth); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_mb.h deleted file mode 100644 index 8f46af13df..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_mb.h +++ /dev/null @@ -1,24 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_creep_col_mb_h -#define __Evolver_creep_col_mb_h - -class Evolver_creep_col_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void sync_step(vector &bodies, Force *force, double dth); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn.h deleted file mode 100644 index 1436a2fe43..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn.h +++ /dev/null @@ -1,24 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_creep_col_pn_h -#define __Evolver_creep_col_pn_h - -class Evolver_creep_col_pn : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void sync_step(vector &bodies, Force *force, double dth); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn_mb.h deleted file mode 100644 index 65a82b77e1..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_col_pn_mb.h +++ /dev/null @@ -1,24 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_creep_col_pn_mb_h -#define __Evolver_creep_col_pn_mb_h - -class Evolver_creep_col_pn_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void sync_step(vector &bodies, Force *force, double dth); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_mb.h deleted file mode 100644 index 41a4971fa5..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_mb.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_creep_mb_h -#define __Evolver_creep_mb_h - -class Evolver_creep_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dth); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn.h deleted file mode 100644 index ac73877a96..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_creep_pn_h -#define __Evolver_creep_pn_h - -class Evolver_creep_pn : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dth); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn_mb.h deleted file mode 100644 index 90169c7f94..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_creep_pn_mb.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_creep_pn_mb_h -#define __Evolver_creep_pn_mb_h - -class Evolver_creep_pn_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dth); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct.h deleted file mode 100644 index 8fceda6b29..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct.h +++ /dev/null @@ -1,21 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_direct_h -#define __Evolver_direct_h - -class Evolver_direct : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col.h deleted file mode 100644 index 9e0002f645..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_direct_col_h -#define __Evolver_direct_col_h - -class Evolver_direct_col : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_mb.h deleted file mode 100644 index 2d2429f912..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_mb.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_direct_col_mb_h -#define __Evolver_direct_col_mb_h - -class Evolver_direct_col_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn.h deleted file mode 100644 index 6738b1a1ba..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_direct_col_pn_h -#define __Evolver_direct_col_pn_h - -class Evolver_direct_col_pn : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn_mb.h deleted file mode 100644 index 67dab7ded7..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_col_pn_mb.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_direct_col_pn_mb_h -#define __Evolver_direct_col_pn_mb_h - -class Evolver_direct_col_pn_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_mb.h deleted file mode 100644 index 798ed74906..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_mb.h +++ /dev/null @@ -1,21 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_direct_mb_h -#define __Evolver_direct_mb_h - -class Evolver_direct_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn.h deleted file mode 100644 index 632ce97398..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn.h +++ /dev/null @@ -1,21 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_direct_pn_h -#define __Evolver_direct_pn_h - -class Evolver_direct_pn : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn_mb.h deleted file mode 100644 index 6a1e4f47d7..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_direct_pn_mb.h +++ /dev/null @@ -1,21 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_direct_pn_mb_h -#define __Evolver_direct_pn_mb_h - -class Evolver_direct_pn_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium.h deleted file mode 100644 index ed02a61600..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_equilibrium_h -#define __Evolver_equilibrium_h - -class Evolver_equilibrium : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col.h deleted file mode 100644 index f4dde32b9f..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_equilibrium_col_h -#define __Evolver_equilibrium_col_h - -class Evolver_equilibrium_col : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_mb.h deleted file mode 100644 index 17ebce22cb..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_mb.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_equilibrium_col_mb_h -#define __Evolver_equilibrium_col_mb_h - -class Evolver_equilibrium_col_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn.h deleted file mode 100644 index f0108c3fd9..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_equilibrium_col_pn_h -#define __Evolver_equilibrium_col_pn_h - -class Evolver_equilibrium_col_pn : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn_mb.h deleted file mode 100644 index b7988a7c06..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_col_pn_mb.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_equilibrium_col_pn_mb_h -#define __Evolver_equilibrium_col_pn_mb_h - -class Evolver_equilibrium_col_pn_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_mb.h deleted file mode 100644 index e13ec496e3..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_mb.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_equilibrium_mb_h -#define __Evolver_equilibrium_mb_h - -class Evolver_equilibrium_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn.h deleted file mode 100644 index 34e3ac4a76..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_equilibrium_pn_h -#define __Evolver_equilibrium_pn_h - -class Evolver_equilibrium_pn : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn_mb.h deleted file mode 100644 index 62729b224b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_equilibrium_pn_mb.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_equilibrium_pn_mb_h -#define __Evolver_equilibrium_pn_mb_h - -class Evolver_equilibrium_pn_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear.h deleted file mode 100644 index 3ea264c5ed..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_linear_h -#define __Evolver_linear_h - -class Evolver_linear : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dt); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col.h deleted file mode 100644 index 34f838ee82..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_linear_col_h -#define __Evolver_linear_col_h - -class Evolver_linear_col : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dt); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_mb.h deleted file mode 100644 index 5abcd65f22..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_mb.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_linear_col_mb_h -#define __Evolver_linear_col_mb_h - -class Evolver_linear_col_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dt); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn.h deleted file mode 100644 index a0906ad679..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_linear_col_pn_h -#define __Evolver_linear_col_pn_h - -class Evolver_linear_col_pn : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dt); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn_mb.h deleted file mode 100644 index 698b1509bc..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_col_pn_mb.h +++ /dev/null @@ -1,23 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_linear_col_pn_mb_h -#define __Evolver_linear_col_pn_mb_h - -class Evolver_linear_col_pn_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dt); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_mb.h deleted file mode 100644 index e5724880ad..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_mb.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_linear_mb_h -#define __Evolver_linear_mb_h - -class Evolver_linear_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dt); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn.h deleted file mode 100644 index 0a06e67536..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_linear_pn_h -#define __Evolver_linear_pn_h - -class Evolver_linear_pn : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dt); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn_mb.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn_mb.h deleted file mode 100644 index 0b29af7fc2..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_linear_pn_mb.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_shape_base.h" - -#ifndef __Evolver_linear_pn_mb_h -#define __Evolver_linear_pn_mb_h - -class Evolver_linear_pn_mb : public Evolver_shape_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void sync_step(vector &bodies, Force *force, double dt); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody.h deleted file mode 100755 index d5702f192b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody.h +++ /dev/null @@ -1,20 +0,0 @@ -#include "Evolver_nbody_base.h" - -#ifndef __Evolver_nbody_h -#define __Evolver_nbody_h - -class Evolver_nbody : public Evolver_nbody_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_base.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_base.h deleted file mode 100644 index ffa51ae490..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_base.h +++ /dev/null @@ -1,19 +0,0 @@ -#include "Evolver_base.h" - -#ifndef __Evolver_nbody_base_h -#define __Evolver_nbody_base_h - -class Evolver_nbody_base : public Evolver_base { - public: - - // Get diagnostics - array get_spin_angular_momentum(vector &bodies); - double get_spin_kinetic_energy(vector &bodies); - double get_potential_energy(vector &bodies); - array get_angular_momentum(vector &bodies); - double get_energy(vector &bodies); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col.h deleted file mode 100644 index 8deb4d2100..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_nbody_base.h" - -#ifndef __Evolver_nbody_col_h -#define __Evolver_nbody_col_h - -class Evolver_nbody_col : public Evolver_nbody_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col_pn.h deleted file mode 100644 index e830cf24da..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_col_pn.h +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_nbody_base.h" - -#ifndef __Evolver_nbody_col_pn_h -#define __Evolver_nbody_col_pn_h - -class Evolver_nbody_col_pn : public Evolver_nbody_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void leapfrog_step_with_collisions(vector &bodies, double dt, Force *force); - - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_pn.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_pn.h deleted file mode 100644 index df784e3fd9..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_nbody_pn.h +++ /dev/null @@ -1,20 +0,0 @@ -#include "Evolver_nbody_base.h" - -#ifndef __Evolver_nbody_pn_h -#define __Evolver_nbody_pn_h - -class Evolver_nbody_pn : public Evolver_nbody_base { - public: - - // Evolve function - void leapfrog_step(vector &bodies, double dt, Force *force); - void mclachlan_step(vector &bodies, double dt, Force *force); - - void initialize(vector &bodies, Force *force); - void evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep); - void evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_shape_base.h b/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_shape_base.h deleted file mode 100644 index 9b05a6191a..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Evolver_shape_base.h +++ /dev/null @@ -1,32 +0,0 @@ -#include "Force.h" - -#include "Timestep_base.h" - -#include "Timestep_const.h" -#include "Timestep_adapt.h" -#include "Timestep_adapt_weight.h" -#include "Timestep_direct_weight.h" - -#include "Evolver_base.h" - -#include "Orbit.h" -#include "Spin.h" -#include "Shape.h" - -#ifndef __Evolver_shape_base_h -#define __Evolver_shape_base_h - -class Evolver_shape_base : public Evolver_base { - public: - - // Get diagnostics - array get_spin_angular_momentum(vector &bodies); - double get_spin_kinetic_energy(vector &bodies); - double get_potential_energy(vector &bodies); - array get_angular_momentum(vector &bodies); - double get_energy(vector &bodies); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Force.h b/src/amuse_tidymess/src/tidymess/integrator/include/Force.h deleted file mode 100755 index 8c1d19bdae..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Force.h +++ /dev/null @@ -1,154 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include - -#include "Body.h" - -#ifndef __Force_h -#define __Force_h - -class Force { - public: - - // Variables - int pn_order; - double c, c_2, c_4, c_5; - - bool collision_detected; - vector< array > index_collisions; - - bool roche_detected; - vector< array > index_roche; - - vector dr2_vec, dr_3_vec; - - // Initializers - Force(); - Force(int pn_order, double c); - - void set_default_settings(); - - // Setters - void set_pn_order(int pn_order); - void set_speed_of_light(double c); - - // Collision checker - void check_for_collisions(Body &bi, Body &bj, double &dr_1); - void check_for_collisions(Body &bi, Body &bj, double &dr_3, double &dr2); - - void check_for_roche(Body &bi, Body &bj, double &dr_1); - void check_for_roche(Body &bi, Body &bj, double &dr_3, double &dr2); - - void reset_collisions(); - void reset_roche(); - - // Precalculation functions - - void precalc_sep_vec(Body &bi, Body &bj, array &dr); - void precalc_sep_vec_norm(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr_3); - void precalc_sep_vec_norm_load(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr2, double &dr_3); - void precalc_sep_vec_norm_save(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr2, double &dr_3); - void precalc_sep_mag(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3); - - void precalc_pn(Body &bi, Body &bj, bool &use_vv, array &drn, double &dr_1, double &vivi, double &vjvj, double &vivj, double &drnvi, double &drnvj, double &dv2, array &dv, double &drnvidrnvi, double &drnvjdrnvj, double &bimdr_1, double &bjmdr_1); - - void precalc_tidal(double &dr2, double &dr_3, double &dr_1, double &dr_2, double &dr_4, double &dr_5, array &dr, array &drn, double &dyndyn, double &dzndzn, double &dxndyn, double &dxndzn, double &dyndzn); - - // Force functions - - void calculate_nbody_force(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3, array &ai, array &aj); - void calculate_nbody_force_load(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3, array &ai, array &aj); - - void calculate_pn_force(Body &bi, Body &bj, double &dr2, double &dr_1, double &dr_2, double &dr_3, double &dr_4, array &dr, array &drn, double &dv2, array &dv, array &ai_pn, array &aj_pn, bool use_vv); - - void calculate_tidal_force(Body &bi, Body &bj, double &dr2, double &dr_3, double &dr_1, double &dr_2, double &dr_4, double &dr_5, array &dr, array &drn, array &ai_tidal, array &aj_tidal, array &hij, array &hji, bool use_J); - - void calculate_tidal_h(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J); - void calculate_tidal_h_load(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J, double &dr2, double &dr_3); - void calculate_tidal_h_save(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J, double &dr2, double &dr_3); - - // Torque functions - - void calculate_torque(Body &bi, Body &bj, array &dr, array &hij, array &hji); - - // Inertia tensor functions - - void calculate_deformation_tensor(Body &bi, Body &bj, array &drn, double &dr_3); - - // Acceleration updaters - - void update_acceleration(vector &bodies); - void update_acceleration_pn(vector &bodies, bool use_vv); - void update_acceleration_tidal(vector &bodies, bool use_J); - void update_acceleration_col(vector &bodies); - void update_acceleration_pn_col(vector &bodies, bool use_vv); - void update_acceleration_tidal_col(vector &bodies, bool use_J); - void update_acceleration_tidal_pn(vector &bodies, bool use_vv, bool use_J); - void update_acceleration_tidal_pn_col(vector &bodies, bool use_vv, bool use_J); - - void update_acceleration_save(vector &bodies); - void update_acceleration_pn_save(vector &bodies, bool use_vv); - void update_acceleration_tidal_save(vector &bodies, bool use_J); - void update_acceleration_col_save(vector &bodies); - void update_acceleration_pn_col_save(vector &bodies, bool use_vv); - void update_acceleration_tidal_col_save(vector &bodies, bool use_J); - void update_acceleration_tidal_pn_save(vector &bodies, bool use_vv, bool use_J); - void update_acceleration_tidal_pn_col_save(vector &bodies, bool use_vv, bool use_J); - - void update_acceleration_load(vector &bodies); - void update_acceleration_pn_load(vector &bodies, bool use_vv); - void update_acceleration_tidal_load(vector &bodies, bool use_J); - void update_acceleration_col_load(vector &bodies); - void update_acceleration_pn_col_load(vector &bodies, bool use_vv); - void update_acceleration_tidal_col_load(vector &bodies, bool use_J); - void update_acceleration_tidal_pn_load(vector &bodies, bool use_vv, bool use_J); - void update_acceleration_tidal_pn_col_load(vector &bodies, bool use_vv, bool use_J); - - // Acceleration and torque updaters - - void update_acceleration_and_torque(vector &bodies, bool use_J); - void update_acceleration_and_torque_pn(vector &bodies, bool use_vv, bool use_J); - void update_acceleration_and_torque_col(vector &bodies, bool use_J); - void update_acceleration_and_torque_pn_col(vector &bodies, bool use_vv, bool use_J); - - void update_acceleration_and_torque_save(vector &bodies, bool use_J); - void update_acceleration_and_torque_pn_save(vector &bodies, bool use_vv, bool use_J); - void update_acceleration_and_torque_col_save(vector &bodies, bool use_J); - void update_acceleration_and_torque_pn_col_save(vector &bodies, bool use_vv, bool use_J); - - void update_acceleration_and_torque_load(vector &bodies, bool use_J); - void update_acceleration_and_torque_pn_load(vector &bodies, bool use_vv, bool use_J); - void update_acceleration_and_torque_col_load(vector &bodies, bool use_J); - void update_acceleration_and_torque_pn_col_load(vector &bodies, bool use_vv, bool use_J); - - void update_acceleration_and_torque_and_deformation_tensor(vector &bodies, bool use_J); - void update_acceleration_and_torque_and_deformation_tensor_col(vector &bodies, bool use_J); - void update_acceleration_and_torque_pn_and_deformation_tensor(vector &bodies, bool use_vv, bool use_J); - void update_acceleration_and_torque_pn_and_deformation_tensor_col(vector &bodies, bool use_vv, bool use_J); - - // Torque updaters - - void update_torque(vector &bodies, bool use_J); - void update_torque_save(vector &bodies, bool use_J); - void update_torque_load(vector &bodies, bool use_J); - - // Deformation updaters - - void update_tidal_deformation(vector &bodies); - void update_tidal_deformation_save(vector &bodies); - void update_tidal_deformation_load(vector &bodies); - - void update_centrifugal_deformation(vector &bodies); - - void update_equilibrium_tensor(vector &bodies); - void update_equilibrium_tensor_and_memorize(vector &bodies); - - void update_deformation_tensor(vector &bodies, bool use_J); -}; - -#endif - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Initializer.h b/src/amuse_tidymess/src/tidymess/integrator/include/Initializer.h deleted file mode 100755 index bd53b7684b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Initializer.h +++ /dev/null @@ -1,174 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Units.h" -#include "Banner.h" - -#ifndef __Initializer_h -#define __Initializer_h - -class Initializer { - public: - - // Simulation parameters - - bool to_continue; // 0=new simulation, 1=continue simulation - double max_cpu_time; // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. - - // Physical model parameters - - int tidal_model; // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default) - int pn_order; // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn - int magnetic_braking; // Magnetic braking. 0=off, 1=on - - int collisions; // 0=off, 1=flag, 2=exception, 3=replace - int roche_limit; // 0=off, 1=flag, 2=exception - int breakup_speed; // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception - - // Unit system - - string mass_unit; // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] - string length_unit; // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [AU], [pc] - string time_unit; // Unit of time for 1) t_begin, t_end and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] - string speed_unit; // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [AU/day], [AU/yr], [AU/year], [pc/Myr] - - double speed_of_light; // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. - - // Initial condition parameters - - string file_ic; // initial condition file - - int orbit_coor; // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian - int spin_coor; // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit - - int initial_shape; // 0=sphere, 1=equilibrium (future, 2=specified in initial condition) - int num_body; // 0=all, num_body+1=number of bodies to include - - // Output parameters - - int snapshot_mode; // 0=linear interval (default), 1=logarithmic interval, 2=variable interval - int n_snapshot; // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) - - string output_dir; // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. - int overwrite; // overwrite existing files: 0=no, 1=yes - - int output_format; // 0=file per body, 1=file per snapshot, 2=single file - int output_info; // 0=time-varying quantities, 1=all quantities - int output_coor; // 0=cartesian inertial - - int output_diag; // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' - int output_terminal; // Display progress of simulation in terminal window. 0=no, 1=yes - - // Integration parameters - - double t_begin; // begin time in units given by time_unit - double t_end; // final time in units given by time_unit - - int dt_mode; // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt - double dt_const; // constant time step in units given by time_unit (only used if dt_mode=0) - double eta; // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) - - int n_iter; // Number of iterations to improve reversibility (default=1) - - // Program parameters - - string file_par; // Name of setup file with parameters. Set to "none" if no setup file is required. - - bool toSetOutputDir; // Boolean for copying output dir from initial condition file - string file_out; // Initial condition file without the extension - - // Program variables - - Units units; - bool physical_units; // boolean for using physical units or N-body units - - Banner banner; - - // Snapshot variables - - int N; - vector< array > data_ic; - vector id; - vector name; - - // Constructor - Initializer(); - void set_to_default_values(); - - double get_Cm(); - double get_Cr(); - double get_Cv(); - double get_Ct(); - - // Readme - void display_version(); - void display_help(); - void display_readme(); - void display_parameters(); - void display_units(); - void display_ic_args(); - - // Argument parser - void parse_arguments(int argc, char* argv[]); - bool validate_command_line_args(int argc, vector &args); - bool validate_setup_file_args(int argc, vector &args); - bool check_valid_argument(string &str); - bool check_valid_value(string &str, string &str_val); - void process_args(int argc, vector &args); - - void print_arguments_as_setup_file(); - void print_arguments_as_setup_file(ofstream &fo); - void print_initial_condition_args(); - - int check_var(vector< vector > &data, vector &var, vector &unit, int numLine, string x); - - bool validate_initial_condition_cartesian(vector< vector > &data, vector &var, vector &unit, int numLine); - bool validate_initial_condition_elliptical(vector< vector > &data, vector &var, vector &unit, int numLine); - bool validate_initial_condition_spin(vector< vector > &data, vector &var, vector &unit, int numLine); - - void determine_physical_units(vector &var, vector &unit); - bool validate_units_internal_properties(vector &var, vector &unit); - bool validate_units_orbital_cartesian(vector &var, vector &unit); - bool validate_units_orbital_elliptical(vector &var, vector &unit); - bool validate_units_spin(vector &var, vector &unit); - - // Aux functions - inline bool check_file_exists(const std::string& path); - bool check_dir_exists(string &dir); - vector get_words(string line); - vector< vector > read_file(string file_in); - - // Initial condition functions - vector rotZrotX(double anglez, double anglex, vector vin); - - void convert_spin_vectors_to_inertial(); - void convert_spin_vectors_from_elliptical_body0abs(); - void convert_spin_vectors_from_elliptical_body0rel(); - - double mean_to_eccentric_anomaly(double MA, double e); - double eccentric_to_true_anomaly(double EA, double e); - double convert_mean_to_true_anomaly(double MA, double ecc); - - vector get_relative_posvel_from_orbital_elements(double m1, double m2, double a, double ecc, double inc, double O, double w, double TA, double G); - - void move_to_center(); - void move_to_center(int Nenc); - - void convert_astrocentric_elements_to_cartesian_coordinates(); - void convert_jacobian_elements_to_cartesian_coordinates(); -}; - -#endif - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Orbit.h b/src/amuse_tidymess/src/tidymess/integrator/include/Orbit.h deleted file mode 100755 index 95eaaeff85..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Orbit.h +++ /dev/null @@ -1,42 +0,0 @@ -#include -using namespace std; - -#include -#include -#include - -#include "Body.h" - -#ifndef __Orbit_h -#define __Orbit_h - -class Orbit { - public: - - // Initializers - Orbit(); - - void drift_r(vector &bodies, double dt); - - void kick_v(vector &bodies, double dt); - void kick_vv(vector &bodies, double dt); - - void memorize_r(vector &bodies); - void swap_r_and_r_prev(vector &bodies); - - void init_vv(vector &bodies); - void swap_v_and_vv(vector &bodies); - - // Diagnostics - double get_kinetic_energy(vector &bodies); - double get_potential_energy(vector &bodies); - double get_potential_energy_nbody(vector &bodies); - - array get_center_of_mass(vector &bodies); - array get_center_of_mass_velocity(vector &bodies); - array get_angular_momentum(vector &bodies); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Output.h b/src/amuse_tidymess/src/tidymess/integrator/include/Output.h deleted file mode 100755 index b1faed907a..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Output.h +++ /dev/null @@ -1,106 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include - -#include "Body.h" -#include "Initializer.h" -#include "Units.h" - -#ifndef __Output_h -#define __Output_h - -class Output { - public: - - int format; - int info; - int coor; - string dir; - bool overwrite; - - Units units; - bool physical_units; - string time_unit_output; - string mass_unit_output; - string length_unit_output; - string speed_unit_output; - string frequency_unit_output; - string angular_momentum_unit_output; - string energy_unit_output; - string inertia_unit_output; - - int tidal_model; - - string file_out; - string file_parbu; - - int output_class; - - bool firstWrite; - bool firstWriteDiag; - int file_counter; - int bin_number; - - int n_width; - - // Constructor - Output(); - - // Functions - void set_format(int output_format); - void set_info(int output_info); - void set_coor(int output_coor); - void set_dir(string output_dir); - void set_overwrite(int overwrite); - - void set_units(bool physical_units, string mass_unit, string length_unit, string time_unit, string speed_unit); - void set_conversion_factors(double Cm, double Cr, double Cv, double Ct); - void convert_time_to_frequency_unit(string time_unit); - void construct_angular_momentum_unit(string mass_unit, string length_unit, string speed_unit); - void construct_energy_unit(string mass_unit, string speed_unit); - void construct_inertia_unit(string mass_unit, string length_unit); - - void set_tidal_model(int tidal_model); - - void set_file_out(string fo); - - void determine_output_mode(); - - void write_snapshot(double t, double tcpu, vector &bodies); - void create_output_file(string outputFile, bool isFirstWrite); - - // Writers - void write_snapshot_to_file(double t, double tcpu, vector &bodies); - void write_snapshot_to_file_compact(double t, double tcpu, vector &bodies); - void write_new_snapshot_file(double t, double tcpu, vector &bodies); - void write_new_snapshot_file_compact(double t, double tcpu, vector &bodies); - void write_snapshot_per_body(double t, double tcpu, vector &bodies); - void write_snapshot_per_body_compact(double t, double tcpu, vector &bodies); - - void write_snapshot_to_file_nbody(double t, double tcpu, vector &bodies); - void write_snapshot_to_file_compact_nbody(double t, double tcpu, vector &bodies); - void write_new_snapshot_file_nbody(double t, double tcpu, vector &bodies); - void write_new_snapshot_file_compact_nbody(double t, double tcpu, vector &bodies); - void write_snapshot_per_body_nbody(double t, double tcpu, vector &bodies); - void write_snapshot_per_body_compact_nbody(double t, double tcpu, vector &bodies); - - void save_to_binary(double &t, int &N, double &tcpu, double &dt_prev, int &num_integration_steps, int &collision_flag, int &roche_flag, int &breakup_flag, vector &bodies, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot); - void read_binary_backup(double &t, int &N, double &tcpu, double &dt_prev, int &num_integration_steps, vector &bodies, int &collision_flag, int &roche_flag, int &breakup_flag, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot); - void read_from_binary(double &t, int &N, double &tcpu, double &dt_prev, int &num_integration_steps, vector &bodies, string &bin_name, bool &myfirstWrite, bool &myfirstWriteDiag, int &myfile_counter, int &mybin_number, int &collision_flag, int &roche_flag, int &breakup_flag, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot); - - // Diagnostics log - void write_log(int argc, char* argv[], double t, double tcpu, int &num_integration_steps, int N0, int N1, double dr, double dv, double dLx, double dLy, double dLz, double dLx_rel, double dLy_rel, double dLz_rel, double dL_abs, double dL_rel, double dE_abs, double dE_rel, double x0, int outcome_type, int collision_flag, int roche_flag, int breakup_flag); - void print_log(int argc, char* argv[], double t, double tcpu, int &num_integration_steps, int N0, int N1, double dr, double dv, double dLx, double dLy, double dLz, double dLx_rel, double dLy_rel, double dLz_rel, double dL_abs, double dL_rel, double dE_abs, double dE_rel, double x0, int outcome_type, int collision_flag, int roche_flag, int breakup_flag); - - void write_diag(double &t, double &t_cpu, int &num_integration_steps, int &N, array &r0, array &v0, array &L0_orb, array &L0_spin, double &Ekin0_orb, double Epot0, double &Ekin0_spin); - - void backup_file(string f1); - void copy_file(string f1, string f2); -}; - -#endif - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Shape.h b/src/amuse_tidymess/src/tidymess/integrator/include/Shape.h deleted file mode 100755 index 41ea0606be..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Shape.h +++ /dev/null @@ -1,77 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include - -#include "Body.h" - -#ifndef __Shape_h -#define __Shape_h - -class Shape { - double f_lim; - - public: - - // Initializers - Shape(); - - void set_permanent_shape(vector &bodies); - void set_to_spherical_shape(vector &bodies); - void set_to_equilibrium_shape(vector &bodies); - void set_to_equilibrium_shape_with_J(vector &bodies); - void set_to_linear_shape(vector &bodies); - void init_J(vector &bodies); - - void calc_expos(vector &bodies, double dt); - void copy_expos_to_1(vector &bodies); - void copy_expos_to_2(vector &bodies); - void revert_expos_1(vector &bodies); - void revert_expos_2(vector &bodies); - - // Calculators - void calculate_I_inv(vector &bodies); - void calculate_I_inv_and_w(vector &bodies); - - void calculate_J_inv_and_w(vector &bodies); - void calculate_w_with_J(vector &bodies); - - void calculate_I_inv_and_w_with_K(vector &bodies); - void calculate_J_inv_and_w_with_K(vector &bodies); - - // Evolvers - void kick_linear(vector &bodies); - void kick_linear_J(vector &bodies); - void kick_linear_discrete(vector &bodies, double dt); - void kick_linear_discrete_J(vector &bodies, double dt); - - void kick_direct(vector &bodies, double dt); - void kick_direct_J(vector &bodies, double dt); - - void deform_and_rotate(vector &bodies, double dt); - void deform_and_rotate_half(vector &bodies, double dt); - - void deform_and_rotate_J(vector &bodies, double dt); - void deform_and_rotate_J_half(vector &bodies, double dt); - - void rotate_tensor(array &q, array &A, array &B); - - void copy_I_e_r_to_I_e_rh(vector &bodies); - void copy_I_to_J(vector &bodies); - - void memorize_I(vector &bodies); - void reset_I(vector &bodies); - - void memorize_J(vector &bodies); - void reset_J(vector &bodies); - - void backup_I_e(vector &bodies); - void set_I_e_prev_to_backup(vector &bodies); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Spin.h b/src/amuse_tidymess/src/tidymess/integrator/include/Spin.h deleted file mode 100755 index a56410aa08..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Spin.h +++ /dev/null @@ -1,43 +0,0 @@ -#include -using namespace std; - -#include -#include -#include - -#include "Body.h" - -#ifndef __Spin_h -#define __Spin_h - -class Spin { - public: - - // Initializers - Spin(); - - // Calculators - void calculate_w(vector &bodies); - void calculate_w_with_J(vector &bodies); - void calculate_w_with_K(vector &bodies); - - void calculate_L(vector &bodies); - void init_K(vector &bodies); - - void memorize_w(vector &bodies); - void reset_w(vector &bodies); - - void kick_L(vector &bodies, double dt); - void kick_K(vector &bodies, double dt); - - void kick_L_mb(vector &bodies, double dt); - void kick_K_mb(vector &bodies, double dt); - - // Diagnostics - double get_kinetic_energy(vector &bodies); - array get_angular_momentum(vector &bodies); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Tidy.h b/src/amuse_tidymess/src/tidymess/integrator/include/Tidy.h deleted file mode 100755 index 7ef779ab7a..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Tidy.h +++ /dev/null @@ -1,234 +0,0 @@ -#include "Force.h" - -#include "Orbit.h" -#include "Spin.h" -#include "Shape.h" - -#include "Timestep_base.h" - -#include "Timestep_const.h" -#include "Timestep_adapt.h" -#include "Timestep_direct.h" -#include "Timestep_adapt_weight.h" -#include "Timestep_direct_weight.h" - -#include "Evolver_base.h" - -#include "Evolver_nbody.h" -#include "Evolver_nbody_col.h" -#include "Evolver_nbody_pn.h" -#include "Evolver_nbody_col_pn.h" - -#include "Evolver_equilibrium.h" -#include "Evolver_equilibrium_col.h" -#include "Evolver_equilibrium_pn.h" -#include "Evolver_equilibrium_mb.h" -#include "Evolver_equilibrium_col_pn.h" -#include "Evolver_equilibrium_col_mb.h" -#include "Evolver_equilibrium_pn_mb.h" -#include "Evolver_equilibrium_col_pn_mb.h" - -#include "Evolver_linear.h" -#include "Evolver_linear_col.h" -#include "Evolver_linear_pn.h" -#include "Evolver_linear_mb.h" -#include "Evolver_linear_col_pn.h" -#include "Evolver_linear_col_mb.h" -#include "Evolver_linear_pn_mb.h" -#include "Evolver_linear_col_pn_mb.h" - -#include "Evolver_direct.h" -#include "Evolver_direct_col.h" -#include "Evolver_direct_pn.h" -#include "Evolver_direct_mb.h" -#include "Evolver_direct_col_pn.h" -#include "Evolver_direct_col_mb.h" -#include "Evolver_direct_pn_mb.h" -#include "Evolver_direct_col_pn_mb.h" - -#include "Evolver_creep.h" -#include "Evolver_creep_col.h" -#include "Evolver_creep_pn.h" -#include "Evolver_creep_mb.h" -#include "Evolver_creep_col_pn.h" -#include "Evolver_creep_col_mb.h" -#include "Evolver_creep_pn_mb.h" -#include "Evolver_creep_col_pn_mb.h" - -#ifndef __Tidy_h -#define __Tidy_h - -class Tidy { - public: - - // User parameters - double t; - vector bodies; - - int tidal_model; - - int collision_mode, roche_mode, encounter_mode; - - int pn_order; - double speed_of_light; - - int magnetic_braking; - - int dt_mode; - double dt_const, eta, dt_prev; - int num_integration_step; - - int n_iter; - int dt_sgn; - - // Setters and Getters - void set_model_time(double t); - double get_model_time(); - - void set_particles(vector &bodies); - void set_particles(vector< array > &d); - void set_particles(vector &name, vector &id, vector< array > &d); - vector get_particles(); - - void set_tidal_model(int tidal_model); - int get_tidal_model(); - - void set_collision_mode(int collision_mode); - int get_collision_mode(); - - void set_roche_mode(int roche_mode); - int get_roche_mode(); - - void set_encounter_mode(); - int get_encounter_mode(); - - void set_pn_order(int pn_order); - int get_pn_order(); - - void set_speed_of_light(double c); - double get_speed_of_light(); - - void set_magnetic_braking(int b); - int get_magnetic_braking(); - - void set_dt_mode(int dt_mode); - double get_dt_mode(); - - void set_dt_const(double dt_const); - double get_dt_const(); - - void set_eta(double eta); - double get_eta(); - - void set_dt_prev(double dt_prev); - double get_dt_prev(); - - void set_n_iter(int n_iter); - int get_n_iter(); - - void set_num_integration_step(int num_integration_step); - int get_num_integration_step(); - - void set_dt_sgn(int dt_sgn); - - // Constructor/Destructor - Tidy(); - ~Tidy(); - - // Timesteppers and integrators - Timestep_const timestep_const; - Timestep_adapt timestep_adapt; - Timestep_direct timestep_direct; - Timestep_adapt_weight timestep_adapt_weight; - Timestep_direct_weight timestep_direct_weight; - - Evolver_nbody evolver_nbody; - Evolver_nbody_col evolver_nbody_col; - Evolver_nbody_pn evolver_nbody_pn; - Evolver_nbody_col_pn evolver_nbody_col_pn; - - Evolver_equilibrium evolver_equilibrium; - Evolver_equilibrium_col evolver_equilibrium_col; - Evolver_equilibrium_pn evolver_equilibrium_pn; - Evolver_equilibrium_mb evolver_equilibrium_mb; - Evolver_equilibrium_col_pn evolver_equilibrium_col_pn; - Evolver_equilibrium_col_mb evolver_equilibrium_col_mb; - Evolver_equilibrium_pn_mb evolver_equilibrium_pn_mb; - Evolver_equilibrium_col_pn_mb evolver_equilibrium_col_pn_mb; - - Evolver_linear evolver_linear; - Evolver_linear_col evolver_linear_col; - Evolver_linear_pn evolver_linear_pn; - Evolver_linear_mb evolver_linear_mb; - Evolver_linear_col_pn evolver_linear_col_pn; - Evolver_linear_col_mb evolver_linear_col_mb; - Evolver_linear_pn_mb evolver_linear_pn_mb; - Evolver_linear_col_pn_mb evolver_linear_col_pn_mb; - - Evolver_direct evolver_direct; - Evolver_direct_col evolver_direct_col; - Evolver_direct_pn evolver_direct_pn; - Evolver_direct_mb evolver_direct_mb; - Evolver_direct_col_pn evolver_direct_col_pn; - Evolver_direct_col_mb evolver_direct_col_mb; - Evolver_direct_pn_mb evolver_direct_pn_mb; - Evolver_direct_col_pn_mb evolver_direct_col_pn_mb; - - Evolver_creep evolver_creep; - Evolver_creep_col evolver_creep_col; - Evolver_creep_pn evolver_creep_pn; - Evolver_creep_mb evolver_creep_mb; - Evolver_creep_col_pn evolver_creep_col_pn; - Evolver_creep_col_mb evolver_creep_col_mb; - Evolver_creep_pn_mb evolver_creep_pn_mb; - Evolver_creep_col_pn_mb evolver_creep_col_pn_mb; - - // Pointers to objects to be used - Force *force_ptr; - Timestep_base *timestep_ptr; - Evolver_base *evolver_ptr; - - // Committers - void commit_parameters(); - void commit_particles(); - void set_pointers(); - void upload_parameters(); - void initialize(); - - // Collision handling - bool is_collision_detected(); - vector< array > get_collision_indices(); - bool get_collision_flag(); - - bool is_roche_detected(); - vector< array > get_roche_indices(); - bool get_roche_flag(); - - // Shape handling - Force force; - Spin spin; - Shape shape; - - void set_to_spherical_shape(); - void set_to_equilibrium_shape(); - void update_angular_momentum(); - - // Get diagnostics - array get_center_of_mass(); - array get_center_of_mass_velocity(); - array get_orbital_angular_momentum(); - array get_spin_angular_momentum(); - double get_orbital_kinetic_energy(); - double get_spin_kinetic_energy(); - double get_potential_energy(); - array get_angular_momentum(); - double get_energy(); - - // Top level evolve function - void evolve_model(double t_end); - void evolve_model(int N_step); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timer.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timer.h deleted file mode 100755 index 7af5207fd9..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Timer.h +++ /dev/null @@ -1,25 +0,0 @@ -#include - -#ifndef __Timer_h -#define __Timer_h - -class Timer { - - double t_cpu; - struct timeval Tvalue; - struct timezone dummy; - bool timerStarted; - - public: - - Timer(); - - void start(); - double read(); - void stop(); - double get(); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt.h deleted file mode 100644 index c2cc9c994b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt.h +++ /dev/null @@ -1,30 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include -#include -#include - -#include "Body.h" -#include "Timestep_base.h" - -#ifndef __Timestep_adapt_h -#define __Timestep_adapt_h - -class Timestep_adapt : public Timestep_base { - public: - - // Calculators - void calculate_shared_adaptive_minimum_timestep_orbital(vector &bodies); - - void initialize(vector &bodies); - double get_timestep(vector &bodies); -}; - -#endif - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt_weight.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt_weight.h deleted file mode 100644 index 2773cfc53a..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_adapt_weight.h +++ /dev/null @@ -1,31 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include -#include -#include - -#include "Body.h" -#include "Timestep_base.h" - -#ifndef __Timestep_adapt_weight_h -#define __Timestep_adapt_weight_h - -class Timestep_adapt_weight : public Timestep_base { - public: - - // Calculators - void calculate_shared_adaptive_weighted_timestep_orbital(vector &bodies); - void calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(vector &bodies); - - void initialize(vector &bodies); - double get_timestep(vector &bodies); -}; - -#endif - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_base.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_base.h deleted file mode 100644 index 54ea5d6561..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_base.h +++ /dev/null @@ -1,55 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include -#include -#include - -#include "Body.h" - -#ifndef __Timestep_base_h -#define __Timestep_base_h - -class Timestep_base { - public: - - // Variables - double dt_const; - double eta, eta2; - - double h, h2, dh, h_spin, h_shape; - double dt_prev, dt_next; - double fp_bound, fm_bound, fp2_bound, fm2_bound; - double alpha; - int dt_sgn; - - // Initializer - Timestep_base(); - - void set_default_values(); - - // Setters and Getters - void set_dt_const(double dt_const); - double get_dt_const(); - - void set_eta(double eta); - double get_eta(); - - void commit(); - void set_dt_sgn(double t0, double t1); - void set_dt_sgn(int dt_sgn); - - void set_dt_prev(double dt_prev); - - // Calculators - virtual void initialize(vector &bodies) = 0; - virtual double get_timestep(vector &bodies) = 0; -}; - -#endif - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_const.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_const.h deleted file mode 100644 index f721517e13..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_const.h +++ /dev/null @@ -1,28 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include -#include -#include - -#include "Body.h" -#include "Timestep_base.h" - -#ifndef __Timestep_const_h -#define __Timestep_const_h - -class Timestep_const : public Timestep_base { - public: - - // Calculators - void initialize(vector &bodies); - double get_timestep(vector &bodies); -}; - -#endif - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct.h deleted file mode 100644 index 1b35cfd78d..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct.h +++ /dev/null @@ -1,33 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include -#include -#include - -#include "Body.h" -#include "Timestep_base.h" - -#ifndef __Timestep_direct_h -#define __Timestep_direct_h - -class Timestep_direct : public Timestep_base { - public: - - // Calculators - void calculate_shared_adaptive_minimum_timestep_orbital(vector &bodies); - - void calculate_minimum_timestep_spin(vector &bodies); - void calculate_minimum_timestep_shape(vector &bodies); - - void initialize(vector &bodies); - double get_timestep(vector &bodies); -}; - -#endif - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct_weight.h b/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct_weight.h deleted file mode 100644 index c1c14235ef..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Timestep_direct_weight.h +++ /dev/null @@ -1,34 +0,0 @@ -#include -using namespace std; - -#include -#include -#include -#include -#include -#include - -#include "Body.h" -#include "Timestep_base.h" - -#ifndef __Timestep_direct_weight_h -#define __Timestep_direct_weight_h - -class Timestep_direct_weight : public Timestep_base { - public: - - // Calculators - void calculate_shared_adaptive_weighted_timestep_orbital(vector &bodies); - void calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(vector &bodies); - - void calculate_minimum_timestep_spin(vector &bodies); - void calculate_minimum_timestep_shape(vector &bodies); - - void initialize(vector &bodies); - double get_timestep(vector &bodies); -}; - -#endif - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/include/Units.h b/src/amuse_tidymess/src/tidymess/integrator/include/Units.h deleted file mode 100755 index d7a55e34b5..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/include/Units.h +++ /dev/null @@ -1,86 +0,0 @@ -#include -using namespace std; - -#include -#include -#include - -#ifndef __Units_h -#define __Units_h - -class Units { - bool physical_units; - - public: - - // Constants - double c_m_s, c_km_s, c_AU_yr, c_two_pi_AU_yr; - double G_standard; - - // Time: s, hr, day, yr, Myr, Gyr - double s_to_yr, min_to_yr, hr_to_yr, day_to_yr, Myr_to_yr, Gyr_to_yr; - double yr_to_s, yr_to_min, yr_to_hr, yr_to_day, yr_to_Myr, yr_to_Gyr; - - // Length: m, km, Rsun/RSun, AU, pc - double m_to_AU, km_to_AU, Rsun_to_AU, pc_to_AU; - double AU_to_m, AU_to_km, AU_to_Rsun, AU_to_pc; - - double km_in_m, Rsun_in_m, AU_in_m, pc_in_m; - - // Mass: g, kg, Mearth/MEarth, Mjupiter/MJupiter/Mjup/MJup, Msun/MSun - double g_to_Msun, kg_to_Msun, Mearth_to_Msun, Mjupiter_to_Msun; - double Msun_to_g, Msun_to_kg, Msun_to_Mearth, Msun_to_Mjupiter; - - double GMjupiter_in_m_s, GMearth_in_m_s, GMjupiter_in_AU_yr, GMearth_in_AU_yr; - double Mjupiter_in_Msun, Mearth_in_Msun, Msun_in_kg, Msun_in_g; - - // Velocity: m/s, km/s, km/hr, AU/day, pc/Myr - double m_s_to_AU_yr, km_s_to_AU_yr, km_hr_to_AU_yr, AU_day_to_AU_yr, pc_Myr_to_AU_yr; - double AU_yr_to_m_s, AU_yr_to_km_s, AU_yr_to_km_hr, AU_yr_to_AU_day, AU_yr_to_pc_Myr; - - // Angles: deg, rad - double rad_to_deg, deg_to_rad; - - // G=4pi <-> G=1 conversion - double yr_to_yr_two_pi, yr_two_pi_to_yr; - double AU_yr_to_two_pi_AU_yr, two_pi_AU_yr_to_AU_yr; - - // Conversion factors to dimensionless units - double Cm, Cr, Cv, Ct; - - Units(); - - void set_physical_units(bool physical_units); - - bool validate_mass_unit(string u); - bool validate_length_unit(string u); - bool validate_time_unit(string u); - bool validate_speed_unit(string u); - bool validate_angular_unit(string u); - - double convert_mass_to_standard(double value, string unit); - double convert_length_to_standard(double value, string unit); - double convert_time_to_standard(double value, string unit); - double convert_speed_to_standard(double value, string unit); - double convert_angle_to_standard(double value, string unit); - - double convert_time_from_standard_to_code(double value); - double convert_speed_from_standard_to_code(double value); - double convert_frequency_from_standard_to_code(double value); - - double convert_time_from_code_to_output(double value, string unit); - double convert_frequency_from_code_to_output(double value, string unit); - double convert_mass_from_code_to_output(double value, string unit); - double convert_length_from_code_to_output(double value, string unit); - double convert_speed_from_code_to_output(double value, string unit); - double convert_angular_momentum_from_code_to_output(double value, string unit); - double convert_energy_from_code_to_output(double value, string unit); - double convert_inertia_from_code_to_output(double value, string unit); - - vector split_units(string &u); - void print_units(); -}; - -#endif - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Banner.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Banner.cpp deleted file mode 100644 index ec93f1836b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Banner.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#include "Banner.h" - -void Banner::print_banner() { - cout << " _____ ___ ____ __ __ __ __ _____ ____ ____ " << endl; - cout << " |_ _||_ _|| _ \\\\ \\ / /| \\/ || ____|/ ___|/ ___| " << endl; - cout << " | | | | | | | |\\ V / | |\\/| || _| \\___ \\\\___ \\ " << endl; - cout << " | | | | | |_| | | | | | | || |___ ___) |___) | " << endl; - cout << " |_| |___||____/ |_| |_| |_||_____||____/|____/ " << endl; -} - -void Banner::print_intro(bool to_continue) { - cout << endl; - if(to_continue) { - cout << "Continuing simulation ..." << endl; - } - else { - cout << "Starting new simulation ..." << endl; - } - cout << " " << endl; -} - -void Banner::print_outro(string output_dir) { - cout << endl; - cout << "Simulation finished!" << endl; - cout << "Output files available in directory: " << output_dir << endl; -} - -void Banner::print_reference() { - cout << endl; - cout << "Citation: Boekholt, T. C. N. and Correia, A. C. M. " << endl; - cout << " Monthly Notices of the Royal Astronomical Society " << endl; - cout << " Volume 503, Issue 1, pp.xxxx-yyyy, November 2022 " << endl; -} - -void Banner::print_stars() { - cout << endl; - cout << "**************************************************************" << endl; -} - -void Banner::print_header() { - cout << " " << endl; - cout << "***************************************************************************" << endl; - cout << "*** TIDYMESS 1.0 - TIdal DYnamics of Multi-body ExtraSolar Systems ***" << endl; - cout << "*** Authors : Tjarda C. N. Boekholt and Alexandre C. M. Correia ***" << endl; - cout << "*** Contact : tjardaboekholt@gmail.com, acm.correia@gmail.com ***" << endl; - cout << "*** Citation : Boekholt, T. C. N. and Correia, A. C. M. ***" << endl; - cout << "*** Monthly Notices of the Royal Astronomical Society ***" << endl; - cout << "*** Volume 503, Issue 1, pp.xxxx-yyyy, November 2021 ***" << endl; - cout << "***************************************************************************" << endl; - cout << " " << endl; -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Body.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Body.cpp deleted file mode 100755 index a63f4cc331..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Body.cpp +++ /dev/null @@ -1,258 +0,0 @@ -#include "Body.h" - -// Initializers -Body::Body() { - this->reset(); -} - -Body::Body(double m, double R, double xi, double kf, double tau, double a_mb, double wx, double wy, double wz, double x, double y, double z, double vx, double vy, double vz) { - this->reset(); - - // Internal properties - this->m = m; - this->R = R; - this->xi = xi; - - this->kf = kf; - this->tau = tau; - - this->a_mb = a_mb; - - // Orbital properties - this->r[0] = x; - this->r[1] = y; - this->r[2] = z; - - this->v[0] = vx; - this->v[1] = vy; - this->v[2] = vz; - - // Spin properties - this->w[0] = wx; - this->w[1] = wy; - this->w[2] = wz; - - // Aux properties - this->update_aux_properties(); -} -Body::Body(double m, double R, double xi, double kf, double tau, double a_mb, array w, array r, array v) { - this->reset(); - - // Internal properties - this->m = m; - this->R = R; - this->xi = xi; - - this->kf = kf; - this->tau = tau; - - this->a_mb = a_mb; - - // Orbital properties - for(int k=0; k<3; k++) { - this->r[k] = r[k]; - this->v[k] = v[k]; - } - - // Spin properties - for(int k=0; k<3; k++) { - this->w[k] = w[k]; - } - - // Aux properties - this->update_aux_properties(); -} -Body::Body(array &d) { - this->reset(); - - // Internal properties - this->m = d[0]; - this->R = d[1]; - this->xi = d[2]; - - this->kf = d[3]; - this->tau = d[4]; - - this->a_mb = d[5]; - - // Spin properties - this->w[0] = d[6]; - this->w[1] = d[7]; - this->w[2] = d[8]; - - // Orbital properties - this->r[0] = d[9]; - this->r[1] = d[10]; - this->r[2] = d[11]; - - this->v[0] = d[12]; - this->v[1] = d[13]; - this->v[2] = d[14]; - - // Aux properties - this->update_aux_properties(); -} - -void Body::setup(array &d) { - this->reset(); - - // Internal properties - this->m = d[0]; - this->R = d[1]; - this->xi = d[2]; - - this->kf = d[3]; - this->tau = d[4]; - - this->a_mb = d[5]; - - // Spin properties - this->w[0] = d[6]; - this->w[1] = d[7]; - this->w[2] = d[8]; - - // Orbital properties - this->r[0] = d[9]; - this->r[1] = d[10]; - this->r[2] = d[11]; - - this->v[0] = d[12]; - this->v[1] = d[13]; - this->v[2] = d[14]; - - // Aux properties - this->update_aux_properties(); -} -void Body::set_id(int id) { - this->id = id; -} -void Body::set_name(string name) { - this->name = name; -} - -void Body::reset() { - // Tag - this->id = 0; - this->name = "0"; - - this->particle_type = 3; - - // Internal properties - this->m = 0.; - this->R = 0.; - this->xi = 0.; - this->kf = 0.; - this->tau = 0.; - this->a_mb = 0.; - - this->R3 = 0.; - this->R5 = 0.; - this->R5_3 = 0.; - this->kf_R5 = 0.; - this->kf_R5_3 = 0.; - this->tau_inv = 0.; - this->rho = 0.; - - this->roche_factor = 2.44; // fluid body - this->roche_factor3 = this->roche_factor*this->roche_factor*this->roche_factor; - - // Orbital properties - for(int i=0; i<3; i++) { - this->r[i] = 0.; - this->v[i] = 0.; - this->a[i] = 0.; - - this->r_prev[i] = 0.; - this->vv[i] = 0.; - } - - // Spin properties - for(int i=0; i<3; i++) { - this->L[i] = 0.; - this->w[i] = 0.; - this->T[i] = 0.; - - this->L_prev[i] = 0.; - this->w_prev[i] = 0.; - this->K[i] = 0.; - } - - // Shape properties - for(int i=0; i<6; i++) { - this->I_p[i] = 0; - this->I_n[i] = 0; - this->I[i] = 0; - this->I_inv[i] = 0; - this->I_e_r[i] = 0; - this->dI_e_r[i] = 0; - this->I_e_w[i] = 0; - this->I_e[i] = 0; - this->dI_e[i] = 0; - this->dI_n[i] = 0; - - this->I_e_rh[i] = 0; - this->I_e_prev[i] = 0; - this->I_n_prev[i] = 0; - this->I_e_prev_bu[i] = 0; - - this->J_n[i] = 0; - this->J[i] = 0; - this->J_inv[i] = 0; - } - - // Integration variables - this->isLinear = false; - - this->expo = 0; - this->expoh = 0; - this->dt_rot = 0; - this->dth_rot = 0; - - this->isLinear_1 = false; - this->expo_1 = 0; - this->expoh_1 = 0; - this->dt_rot_1 = 0; - this->dth_rot_1 = 0; - - this->isLinear_2 = false; - this->expo_2 = 0; - this->expoh_2 = 0; - this->dt_rot_2 = 0; - this->dth_rot_2 = 0; -} - -void Body::update_aux_properties() { - this->R3 = pow(this->R, 3.); - this->R5 = pow(this->R, 5.); - this->R5_3 = this->R5 / 3.; - this->kf_R5 = this->kf*this->R5; - this->kf_R5_3 = this->kf*this->R5_3; - - if(this->tau > 0) this->tau_inv = 1./this->tau; - - double V = 4./3*M_PI * this->R3; - if(V > 0) this->rho = this->m / V; - - for(int k=0; k<3; k++) { - this->vv[k] = v[k]; - } - - if(this->m <= 0) { - this->particle_type = 0; - } - else { - if(this->R <= 0 || this->xi <= 0) { - this->particle_type = 1; - } - else { - if(this->kf <= 0) { - this->particle_type = 2; - } - else { - this->particle_type = 3; - } - } - } -} - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Breakup.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Breakup.cpp deleted file mode 100755 index a070af17e3..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Breakup.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "Breakup.h" - -// Initializers -Breakup::Breakup() { - this->mode = 0; - setup(); - - breakup_id.clear(); - N_breakup = 0; -} - -// Getters and Setters -void Breakup::setup() { - to_detect = false; - - if(mode > 0) { - to_detect = true; - } -} - -void Breakup::set_breakup_mode(int breakup_mode) { - switch(breakup_mode) { - case 0: - this->mode = 0; - break; - case 1: - this->mode = 1; - break; - case 2: - this->mode = 2; - break; - default: - cerr << "Invalid breakup mode: " << breakup_mode << endl; - exit(1); - break; - } -} - -int Breakup::get_N_breakup() { - return N_breakup; -} -vector Breakup::get_breakup_indices() { - return breakup_id; -} - -// Handlers -bool Breakup::detect_breakup(vector &bodies) { - N_breakup = 0; - breakup_id.clear(); - - for(vector::iterator b = bodies.begin(); b != bodies.end()-1; ++b) { - if(b->particle_type >= 2) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - double Re = 1.5 * b->R; - double w2_breakup = b->m / (Re*Re*Re); - if(w2 > w2_breakup) { - int id = b-bodies.begin(); - breakup_id.push_back(id); - N_breakup++; - } - } - } - - bool detection = false; - if(N_breakup > 0) detection = true; - - return detection; -} - -// Printer -void Breakup::print_id() { - int Nc = breakup_id.size(); - for(int i=0; icollision_mode = 0; - this->roche_mode = 0; - setup(); -} - -// Getters and Setters -void Collision::set_collision_mode(int collision_mode) { - switch(collision_mode) { - case 0: - this->collision_mode = 0; - break; - case 1: - this->collision_mode = 1; - break; - case 2: - this->collision_mode = 2; - break; - case 3: - this->collision_mode = 3; - break; - default: - cerr << "Invalid collision mode: " << collision_mode << endl; - exit(1); - break; - } -} -void Collision::set_roche_mode(int roche_mode) { - switch(roche_mode) { - case 0: - this->roche_mode = 0; - break; - case 1: - this->roche_mode = 1; - break; - case 2: - this->roche_mode = 2; - break; - default: - cerr << "Invalid roche mode: " << roche_mode << endl; - exit(1); - break; - } -} - -void Collision::setup() { - if(collision_mode > 0) { - to_detect_collision = true; - } - else { - to_detect_collision = false; - } - - if(roche_mode > 0) { - to_detect_roche = true; - } - else { - to_detect_roche = false; - } -} - -// Handlers -void Collision::process_collision_chains(vector< array > &cindex) { - int Nc = cindex.size(); - - chain_id.clear(); - - vector couple(2); - couple[0] = cindex[0][0]; - couple[1] = cindex[0][1]; - - chain_id.push_back(couple); - - for(int i=1; i &bodies) { - this->Ng = this->chain_id.size(); - this->chain_index.clear(); - - // Get chains and ids of collision partners - int N = bodies.size(); - for(int i=0; i mychain(Ns, 0); - - for(int j=0; jchain_index.push_back(mychain); - } -} - -void Collision::replace_test_body(vector &bodies, int i, int Ns, vector &index_sec) { - // Get center of mass quantities - - double Mcm = 0; - array rcm = {}; - array vcm = {}; - - for(int j=0; j Rmax) { - Rmax = bodies[chain_index[i][j]].R; - index_max = j; - } - } - - // Derive new internal properties based on assumptions - - // New radius is largest radius - double Rcm = Rmax; - - // Update primary collision partner - bodies[chain_index[i][index_max]].m = Mcm; - bodies[chain_index[i][index_max]].R = Rcm; - - for(int k=0; k<3; k++) { - bodies[chain_index[i][index_max]].r[k] = rcm[k]; - bodies[chain_index[i][index_max]].v[k] = vcm[k]; - } - - // Set auxiliary quantities - bodies[chain_index[i][index_max]].update_aux_properties(); - - // Book keep indices of secondary collision partners - for(int j=0; j &bodies, int i, int Ns, vector &index_sec) { - // Get center of mass quantities - - double Mcm = 0; - array rcm = {}; - array vcm = {}; - - for(int j=0; j Mmax) { - Mmax = bodies[chain_index[i][j]].m; - index_max = j; - } - } - - // Derive new internal properties based on assumptions - - // New radius based on constancy of density - double Rcm = 0; - - if(bodies[chain_index[i][index_max]].R > 0) { - double rho = bodies[chain_index[i][index_max]].rho; - if(rho <= 0) { - bodies[chain_index[i][index_max]].update_aux_properties(); - rho = bodies[chain_index[i][index_max]].rho; - } - Rcm = pow(3*Mcm / rho / (4*M_PI), 1./3); - } - - // Update primary collision partner - bodies[chain_index[i][index_max]].m = Mcm; - bodies[chain_index[i][index_max]].R = Rcm; - - for(int k=0; k<3; k++) { - bodies[chain_index[i][index_max]].r[k] = rcm[k]; - bodies[chain_index[i][index_max]].v[k] = vcm[k]; - } - - // Set auxiliary quantities - bodies[chain_index[i][index_max]].update_aux_properties(); - - // Book keep indices of secondary collision partners - for(int j=0; j &bodies, int i, int Ns, vector &index_sec) { - // Get center of mass quantities - - double Mcm = 0; - array rcm = {}; - array vcm = {}; - - for(int j=0; j Lorb = {}; - array Lspin = {}; - - for(int j=0; j 0) { - double Lx_orb = bodies[q].m*(bodies[q].r[1]*bodies[q].v[2] - bodies[q].r[2]*bodies[q].v[1]); - double Ly_orb = bodies[q].m*(bodies[q].r[2]*bodies[q].v[0] - bodies[q].r[0]*bodies[q].v[2]); - double Lz_orb = bodies[q].m*(bodies[q].r[0]*bodies[q].v[1] - bodies[q].r[1]*bodies[q].v[0]); - - Lorb[0] += Lx_orb; - Lorb[1] += Ly_orb; - Lorb[2] += Lz_orb; - } - if(bodies[q].particle_type >= 2) { - double Lx_spin = 0; - double Ly_spin = 0; - double Lz_spin = 0; - - Lx_spin = bodies[q].I[0]*bodies[q].w[0] + bodies[q].I[1]*bodies[q].w[1] + bodies[q].I[2]*bodies[q].w[2]; - Ly_spin = bodies[q].I[1]*bodies[q].w[0] + bodies[q].I[3]*bodies[q].w[1] + bodies[q].I[4]*bodies[q].w[2]; - Lz_spin = bodies[q].I[2]*bodies[q].w[0] + bodies[q].I[4]*bodies[q].w[1] + bodies[q].I[5]*bodies[q].w[2]; - - Lspin[0] += Lx_spin; - Lspin[1] += Ly_spin; - Lspin[2] += Lz_spin; - } - } - - array Ltot = {}; - - for(int k=0; k<3; k++) { - Ltot[k] += Lorb[k] + Lspin[k]; - } - - // Get new spin angular momentum - - array Lorb_new = {}; - - Lorb_new[0] = Mcm*(rcm[1]*vcm[2] - rcm[2]*vcm[1]); - Lorb_new[1] = Mcm*(rcm[2]*vcm[0] - rcm[0]*vcm[2]); - Lorb_new[2] = Mcm*(rcm[0]*vcm[1] - rcm[1]*vcm[0]); - - array Lspin_new = {}; - - for(int k=0; k<3; k++) { - Lspin_new[k] = Ltot[k]-Lorb_new[k]; - } - - // Identify most massive collision partner - - int index_max = 0; - double Mmax = 0; - - for(int j=0; j Mmax) { - Mmax = bodies[chain_index[i][j]].m; - index_max = j; - } - } - - // Derive new internal properties based on assumptions - - // New radius - double Rcm = 0; - - if(bodies[chain_index[i][index_max]].R > 0) { - double rho = bodies[chain_index[i][index_max]].rho; - if(rho <= 0) { - bodies[chain_index[i][index_max]].update_aux_properties(); - rho = bodies[chain_index[i][index_max]].rho; - } - Rcm = pow(3*Mcm / rho / (4*M_PI), 1./3); - } - - // Assume xi remains unchanged - // Assume kf remains unchanged - // Assume tau remains unchanged - // Assume a_mb remains unchanged - - // Shape: assume sphere after collision has relaxed - double Imag = bodies[chain_index[i][index_max]].xi * Mcm * Rcm * Rcm; - - array Icm_p = {}; - Icm_p.fill(0); - Icm_p[0] = Imag; - Icm_p[3] = Imag; - Icm_p[5] = Imag; - - array Icm_n = {}; - Icm_n.fill(0); - - array Icm = {}; - for(int k=0; k<6; k++) { - Icm[k] = Icm_p[k] + Icm_n[k]; - } - - array Icm_inv = {}; - if(Imag > 0) { - Icm_inv.fill(0); - Icm_inv[0] = 1./Imag; - Icm_inv[3] = 1./Imag; - Icm_inv[5] = 1./Imag; - } - - // Spin - array wcm = {}; - - wcm[0] = Icm_inv[0]*Lspin_new[0] + Icm_inv[1]*Lspin_new[1] + Icm_inv[2]*Lspin_new[2]; - wcm[1] = Icm_inv[1]*Lspin_new[0] + Icm_inv[3]*Lspin_new[1] + Icm_inv[4]*Lspin_new[2]; - wcm[2] = Icm_inv[2]*Lspin_new[0] + Icm_inv[4]*Lspin_new[1] + Icm_inv[5]*Lspin_new[2]; - - // Update primary collision partner - bodies[chain_index[i][index_max]].m = Mcm; - bodies[chain_index[i][index_max]].R = Rcm; - - for(int k=0; k<6; k++) { - bodies[chain_index[i][index_max]].I_p[k] = Icm_p[k]; - bodies[chain_index[i][index_max]].I_n[k] = Icm_n[k]; - bodies[chain_index[i][index_max]].I[k] = Icm[k]; - bodies[chain_index[i][index_max]].I_inv[k] = Icm_inv[k]; - } - - for(int k=0; k<3; k++) { - bodies[chain_index[i][index_max]].w[k] = wcm[k]; - bodies[chain_index[i][index_max]].L[k] = Lspin_new[k]; - } - - for(int k=0; k<3; k++) { - bodies[chain_index[i][index_max]].r[k] = rcm[k]; - bodies[chain_index[i][index_max]].v[k] = vcm[k]; - } - - // Set auxiliary quantities - bodies[chain_index[i][index_max]].update_aux_properties(); - - // Book keep indices of secondary collision partners - for(int j=0; j &bodies, vector< array > &cindex) { - process_collision_chains(cindex); - convert_id_to_index(bodies); - - vector index_sec; - - for(int i=0; i= 2 ) { - collision_type = 2; - break; - } - else if( bodies[chain_index[i][j]].particle_type == 1 ) { - collision_type = 1; - } - } - - if(collision_type == 0) { - replace_test_body(bodies, i, Ns, index_sec); - } - else if(collision_type == 1) { - replace_point_body(bodies, i, Ns, index_sec); - } - else { - replace_tidal_body(bodies, i, Ns, index_sec); - } - } - - // Remove merger components - std::sort(index_sec.begin(), index_sec.end(), std::greater()); - - for(int i=0; i > &cindex) { - int Nc = cindex.size(); - for(int i=0; i Evolver_base::get_center_of_mass(vector &bodies) { - return orbit.get_center_of_mass(bodies); -} -array Evolver_base::get_center_of_mass_velocity(vector &bodies) { - return orbit.get_center_of_mass_velocity(bodies); -} -array Evolver_base::get_orbital_angular_momentum(vector &bodies) { - return orbit.get_angular_momentum(bodies); -} -double Evolver_base::get_orbital_kinetic_energy(vector &bodies) { - return orbit.get_kinetic_energy(bodies); -} - -void Evolver_base::assign_vectors(vector &bodies, Force *force) { - int N = bodies.size(); - int Np = 0.5*N*(N-1); // this only works for N < few k in terms of memory - force->dr2_vec.assign(Np, 0); - force->dr_3_vec.assign(Np, 0); -} - -void Evolver_base::set_n_iter(int n_iter) { - this->n_iter = n_iter; -} -int Evolver_base::get_n_iter() { - return n_iter; -} - -void Evolver_base::reset_aux(vector &bodies) { - orbit.init_vv(bodies); - spin.init_K(bodies); - shape.init_J(bodies); -} - -void Evolver_base::set_collision_mode(int collision_mode) { - this->collision_mode = collision_mode; -} -void Evolver_base::set_roche_mode(int roche_mode) { - this->roche_mode = roche_mode; -} - -bool Evolver_base::stopping_condition_time(double t0, double t1, int dt_sgn) { - bool toContinue = true; - if(dt_sgn == 1) { - if(t0 >= t1) toContinue = false; - } - else { - if(t0 <= t1) toContinue = false; - } - return toContinue; -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep.cpp deleted file mode 100644 index 2cc2c2468a..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep.cpp +++ /dev/null @@ -1,173 +0,0 @@ -#include "Evolver_creep.h" - -// Evolve function -void Evolver_creep::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_torque_load(bodies, true); - - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} - -void Evolver_creep::sync_step(vector &bodies, Force *force, double dth) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.memorize_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_creep::mclachlan_step(vector &bodies, double dt, Force *force) { - shape.calc_expos(bodies, w1*dt); - shape.copy_expos_to_1(bodies); - - leapfrog_step(bodies, w1*dt, force); - - shape.calc_expos(bodies, w2*dt); - shape.copy_expos_to_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.calc_expos(bodies, w3*dt); - - leapfrog_step(bodies, w3*dt, force); - - shape.revert_expos_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.revert_expos_1(bodies); - - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_creep::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_creep::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_creep::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col.cpp deleted file mode 100644 index d69a4a0d6f..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col.cpp +++ /dev/null @@ -1,273 +0,0 @@ -#include "Evolver_creep_col.h" - -// Evolve function -void Evolver_creep_col::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_torque_load(bodies, true); - - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} -void Evolver_creep_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_torque_load(bodies, true); - - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_col_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} - -void Evolver_creep_col::sync_step(vector &bodies, Force *force, double dth) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.memorize_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_creep_col::mclachlan_step(vector &bodies, double dt, Force *force) { - shape.calc_expos(bodies, w1*dt); - shape.copy_expos_to_1(bodies); - - leapfrog_step(bodies, w1*dt, force); - - shape.calc_expos(bodies, w2*dt); - shape.copy_expos_to_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.calc_expos(bodies, w3*dt); - - leapfrog_step(bodies, w3*dt, force); - - shape.revert_expos_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.revert_expos_1(bodies); - - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_creep_col::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_creep_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_creep_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_mb.cpp deleted file mode 100644 index 5c42ad4447..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_mb.cpp +++ /dev/null @@ -1,277 +0,0 @@ -#include "Evolver_creep_col_mb.h" - -// Evolve function -void Evolver_creep_col_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_torque_load(bodies, true); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} -void Evolver_creep_col_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_torque_load(bodies, true); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_col_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} - -void Evolver_creep_col_mb::sync_step(vector &bodies, Force *force, double dth) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.memorize_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_creep_col_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - shape.calc_expos(bodies, w1*dt); - shape.copy_expos_to_1(bodies); - - leapfrog_step(bodies, w1*dt, force); - - shape.calc_expos(bodies, w2*dt); - shape.copy_expos_to_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.calc_expos(bodies, w3*dt); - - leapfrog_step(bodies, w3*dt, force); - - shape.revert_expos_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.revert_expos_1(bodies); - - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_creep_col_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_creep_col_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_creep_col_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn.cpp deleted file mode 100644 index c1d5d0fa47..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn.cpp +++ /dev/null @@ -1,277 +0,0 @@ -#include "Evolver_creep_col_pn.h" - -// Evolve function -void Evolver_creep_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, true); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} -void Evolver_creep_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, true); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_col_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} - -void Evolver_creep_col_pn::sync_step(vector &bodies, Force *force, double dth) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.memorize_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_creep_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - shape.calc_expos(bodies, w1*dt); - shape.copy_expos_to_1(bodies); - - leapfrog_step(bodies, w1*dt, force); - - shape.calc_expos(bodies, w2*dt); - shape.copy_expos_to_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.calc_expos(bodies, w3*dt); - - leapfrog_step(bodies, w3*dt, force); - - shape.revert_expos_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.revert_expos_1(bodies); - - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_creep_col_pn::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_creep_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_creep_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn_mb.cpp deleted file mode 100644 index 643f9f4a77..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_col_pn_mb.cpp +++ /dev/null @@ -1,281 +0,0 @@ -#include "Evolver_creep_col_pn_mb.h" - -// Evolve function -void Evolver_creep_col_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, true); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} -void Evolver_creep_col_pn_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, true); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_col_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} - -void Evolver_creep_col_pn_mb::sync_step(vector &bodies, Force *force, double dth) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.memorize_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_creep_col_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - shape.calc_expos(bodies, w1*dt); - shape.copy_expos_to_1(bodies); - - leapfrog_step(bodies, w1*dt, force); - - shape.calc_expos(bodies, w2*dt); - shape.copy_expos_to_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.calc_expos(bodies, w3*dt); - - leapfrog_step(bodies, w3*dt, force); - - shape.revert_expos_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.revert_expos_1(bodies); - - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_creep_col_pn_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_creep_col_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_creep_col_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_mb.cpp deleted file mode 100644 index 516b983b26..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_mb.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "Evolver_creep_mb.h" - -// Evolve function -void Evolver_creep_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_torque_load(bodies, true); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} - -void Evolver_creep_mb::sync_step(vector &bodies, Force *force, double dth) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.memorize_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_creep_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - shape.calc_expos(bodies, w1*dt); - shape.copy_expos_to_1(bodies); - - leapfrog_step(bodies, w1*dt, force); - - shape.calc_expos(bodies, w2*dt); - shape.copy_expos_to_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.calc_expos(bodies, w3*dt); - - leapfrog_step(bodies, w3*dt, force); - - shape.revert_expos_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.revert_expos_1(bodies); - - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_creep_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_creep_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_creep_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn.cpp deleted file mode 100644 index 3fb8a916b9..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#include "Evolver_creep_pn.h" - -// Evolve function -void Evolver_creep_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, true); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} - -void Evolver_creep_pn::sync_step(vector &bodies, Force *force, double dth) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.memorize_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_creep_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - shape.calc_expos(bodies, w1*dt); - shape.copy_expos_to_1(bodies); - - leapfrog_step(bodies, w1*dt, force); - - shape.calc_expos(bodies, w2*dt); - shape.copy_expos_to_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.calc_expos(bodies, w3*dt); - - leapfrog_step(bodies, w3*dt, force); - - shape.revert_expos_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.revert_expos_1(bodies); - - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_creep_pn::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_creep_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_creep_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn_mb.cpp deleted file mode 100644 index 28eeb041df..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_creep_pn_mb.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include "Evolver_creep_pn_mb.h" - -// Evolve function -void Evolver_creep_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.memorize_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - shape.calculate_J_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_J(bodies); - shape.deform_and_rotate_J_half(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, true); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.memorize_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.reset_I(bodies); - shape.deform_and_rotate_half(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dth); -} - -void Evolver_creep_pn_mb::sync_step(vector &bodies, Force *force, double dth) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.memorize_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - shape.reset_I(bodies); - - shape.deform_and_rotate_half(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_creep_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - shape.calc_expos(bodies, w1*dt); - shape.copy_expos_to_1(bodies); - - leapfrog_step(bodies, w1*dt, force); - - shape.calc_expos(bodies, w2*dt); - shape.copy_expos_to_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.calc_expos(bodies, w3*dt); - - leapfrog_step(bodies, w3*dt, force); - - shape.revert_expos_2(bodies); - - leapfrog_step(bodies, w2*dt, force); - - shape.revert_expos_1(bodies); - - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_creep_pn_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_creep_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_creep_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct.cpp deleted file mode 100644 index f60b9833d8..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "Evolver_direct.h" - -// Evolve function - -void Evolver_direct::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - spin.kick_L(bodies, dt); - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); -} - -void Evolver_direct::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_direct::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); -} -void Evolver_direct::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_direct::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col.cpp deleted file mode 100644 index 2acdcc109d..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include "Evolver_direct_col.h" - -// Evolve function - -void Evolver_direct_col::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - spin.kick_L(bodies, dt); - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); -} -void Evolver_direct_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor_col(bodies, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - spin.kick_L(bodies, dt); - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); -} - -void Evolver_direct_col::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_direct_col::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); -} -void Evolver_direct_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_direct_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_mb.cpp deleted file mode 100644 index f18e4fb8a8..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_mb.cpp +++ /dev/null @@ -1,199 +0,0 @@ -#include "Evolver_direct_col_mb.h" - -// Evolve function - -void Evolver_direct_col_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - shape.kick_direct_J(bodies, dth); -} -void Evolver_direct_col_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor_col(bodies, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - shape.kick_direct_J(bodies, dth); -} - -void Evolver_direct_col_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_direct_col_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); -} -void Evolver_direct_col_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_direct_col_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn.cpp deleted file mode 100644 index 92026f1f1c..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include "Evolver_direct_col_pn.h" - -// Evolve function - -void Evolver_direct_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, true, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - spin.kick_L(bodies, dt); - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); -} -void Evolver_direct_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor_col(bodies, true, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - spin.kick_L(bodies, dt); - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); -} - -void Evolver_direct_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_direct_col_pn::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); -} -void Evolver_direct_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_direct_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn_mb.cpp deleted file mode 100644 index 914e53eae2..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_col_pn_mb.cpp +++ /dev/null @@ -1,199 +0,0 @@ -#include "Evolver_direct_col_pn_mb.h" - -// Evolve function - -void Evolver_direct_col_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, true, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - shape.kick_direct_J(bodies, dth); -} -void Evolver_direct_col_pn_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor_col(bodies, true, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - shape.kick_direct_J(bodies, dth); -} - -void Evolver_direct_col_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_direct_col_pn_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); -} -void Evolver_direct_col_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_direct_col_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_mb.cpp deleted file mode 100644 index 727e0b72eb..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_mb.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include "Evolver_direct_mb.h" - -// Evolve function - -void Evolver_direct_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - shape.kick_direct_J(bodies, dth); -} - -void Evolver_direct_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_direct_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_and_deformation_tensor(bodies, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); -} -void Evolver_direct_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_direct_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn.cpp deleted file mode 100644 index c7623813cf..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "Evolver_direct_pn.h" - -// Evolve function - -void Evolver_direct_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, true, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - spin.kick_L(bodies, dt); - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - spin.kick_K(bodies, dth); - shape.kick_direct_J(bodies, dth); -} - -void Evolver_direct_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_direct_pn::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); -} -void Evolver_direct_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_direct_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn_mb.cpp deleted file mode 100644 index b23d619fc4..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_direct_pn_mb.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include "Evolver_direct_pn_mb.h" - -// Evolve function - -void Evolver_direct_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.kick_direct_J(bodies, dth); - - shape.calculate_J_inv_and_w_with_K(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, true, true); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, true); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.kick_direct(bodies, dt); - - orbit.drift_r(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - shape.kick_direct_J(bodies, dth); -} - -void Evolver_direct_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_direct_pn_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_acceleration_and_torque_pn_and_deformation_tensor(bodies, false, false); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_deformation_tensor(bodies, false); -} -void Evolver_direct_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_direct_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium.cpp deleted file mode 100755 index b68cb77465..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium.cpp +++ /dev/null @@ -1,164 +0,0 @@ -#include "Evolver_equilibrium.h" - -// Evolve function -void Evolver_equilibrium::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - orbit.drift_r(bodies, dth); -} - -void Evolver_equilibrium::sync_step(vector &bodies, Force *force) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - shape.calculate_I_inv_and_w(bodies); -} - -void Evolver_equilibrium::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_equilibrium::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_equilibrium::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } - - sync_step(bodies, force); -} -void Evolver_equilibrium::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } - - sync_step(bodies, force); -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col.cpp deleted file mode 100644 index da30dcf522..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col.cpp +++ /dev/null @@ -1,271 +0,0 @@ -#include "Evolver_equilibrium_col.h" - -// Evolve function -void Evolver_equilibrium_col::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - orbit.drift_r(bodies, dth); -} -void Evolver_equilibrium_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_col_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - orbit.drift_r(bodies, dth); -} -void Evolver_equilibrium_col::sync_step(vector &bodies, Force *force) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - shape.calculate_I_inv_and_w(bodies); -} - -void Evolver_equilibrium_col::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_equilibrium_col::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_equilibrium_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } - - sync_step(bodies, force); -} -void Evolver_equilibrium_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } - - sync_step(bodies, force); -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_mb.cpp deleted file mode 100644 index e2d31fa2e2..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_mb.cpp +++ /dev/null @@ -1,278 +0,0 @@ -#include "Evolver_equilibrium_col_mb.h" - -// Evolve function -void Evolver_equilibrium_col_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - orbit.drift_r(bodies, dth); -} -void Evolver_equilibrium_col_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_col_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - orbit.drift_r(bodies, dth); -} - -void Evolver_equilibrium_col_mb::sync_step(vector &bodies, Force *force) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - shape.calculate_I_inv_and_w(bodies); -} - -void Evolver_equilibrium_col_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_equilibrium_col_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_equilibrium_col_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } - - sync_step(bodies, force); -} -void Evolver_equilibrium_col_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } - - sync_step(bodies, force); -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn.cpp deleted file mode 100644 index d5101fe8ff..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn.cpp +++ /dev/null @@ -1,281 +0,0 @@ -#include "Evolver_equilibrium_col_pn.h" - -// Evolve function -void Evolver_equilibrium_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - orbit.drift_r(bodies, dth); -} -void Evolver_equilibrium_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_col_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - orbit.drift_r(bodies, dth); -} - -void Evolver_equilibrium_col_pn::sync_step(vector &bodies, Force *force) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - shape.calculate_I_inv_and_w(bodies); -} - -void Evolver_equilibrium_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_equilibrium_col_pn::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_equilibrium_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } - - sync_step(bodies, force); -} -void Evolver_equilibrium_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } - - sync_step(bodies, force); -} - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn_mb.cpp deleted file mode 100644 index ceb0c2d8af..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_col_pn_mb.cpp +++ /dev/null @@ -1,286 +0,0 @@ -#include "Evolver_equilibrium_col_pn_mb.h" - -// Evolve function -void Evolver_equilibrium_col_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - orbit.drift_r(bodies, dth); -} -void Evolver_equilibrium_col_pn_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_col_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - orbit.drift_r(bodies, dth); -} - -void Evolver_equilibrium_col_pn_mb::sync_step(vector &bodies, Force *force) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - shape.calculate_I_inv_and_w(bodies); -} - -void Evolver_equilibrium_col_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_equilibrium_col_pn_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_equilibrium_col_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } - - sync_step(bodies, force); -} -void Evolver_equilibrium_col_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } - - sync_step(bodies, force); -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_mb.cpp deleted file mode 100644 index 5120700cf5..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_mb.cpp +++ /dev/null @@ -1,167 +0,0 @@ -#include "Evolver_equilibrium_mb.h" - -// Evolve function -void Evolver_equilibrium_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - orbit.drift_r(bodies, dth); -} - -void Evolver_equilibrium_mb::sync_step(vector &bodies, Force *force) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - shape.calculate_I_inv_and_w(bodies); -} - -void Evolver_equilibrium_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_equilibrium_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_equilibrium_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } - - sync_step(bodies, force); -} -void Evolver_equilibrium_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } - - sync_step(bodies, force); -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn.cpp deleted file mode 100644 index 28bf58f5ff..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn.cpp +++ /dev/null @@ -1,167 +0,0 @@ -#include "Evolver_equilibrium_pn.h" - -// Evolve function -void Evolver_equilibrium_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - orbit.drift_r(bodies, dth); -} - -void Evolver_equilibrium_pn::sync_step(vector &bodies, Force *force) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - shape.calculate_I_inv_and_w(bodies); -} - -void Evolver_equilibrium_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_equilibrium_pn::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_equilibrium_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } - - sync_step(bodies, force); -} -void Evolver_equilibrium_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } - - sync_step(bodies, force); -} - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn_mb.cpp deleted file mode 100644 index 0a274763e3..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_equilibrium_pn_mb.cpp +++ /dev/null @@ -1,171 +0,0 @@ -#include "Evolver_equilibrium_pn_mb.h" - -// Evolve function -void Evolver_equilibrium_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - spin.kick_K_mb(bodies, dth); - - orbit.drift_r(bodies, dth); -} - -void Evolver_equilibrium_pn_mb::sync_step(vector &bodies, Force *force) { - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_to_equilibrium_shape(bodies); - } - - shape.calculate_I_inv_and_w(bodies); -} - -void Evolver_equilibrium_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_equilibrium_pn_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_equilibrium_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } - - sync_step(bodies, force); -} -void Evolver_equilibrium_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } - - sync_step(bodies, force); -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear.cpp deleted file mode 100644 index de5d7c5f3e..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include "Evolver_linear.h" - -// Evolve function -void Evolver_linear::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} - -void Evolver_linear::sync_step(vector &bodies, Force *force, double dt) { - double dth = 0.5*dt; - - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_linear::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_linear::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_linear::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_linear::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col.cpp deleted file mode 100644 index 10287b9450..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col.cpp +++ /dev/null @@ -1,245 +0,0 @@ -#include "Evolver_linear_col.h" - -// Evolve function -void Evolver_linear_col::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} -void Evolver_linear_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_torque_load(bodies, false); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_col_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} - -void Evolver_linear_col::sync_step(vector &bodies, Force *force, double dt) { - double dth = 0.5*dt; - - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_linear_col::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_linear_col::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_linear_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_linear_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_mb.cpp deleted file mode 100644 index 9c16f34748..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_mb.cpp +++ /dev/null @@ -1,249 +0,0 @@ -#include "Evolver_linear_col_mb.h" - -// Evolve function -void Evolver_linear_col_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_torque_load(bodies, false); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} -void Evolver_linear_col_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_torque_load(bodies, false); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_col_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} - -void Evolver_linear_col_mb::sync_step(vector &bodies, Force *force, double dt) { - double dth = 0.5*dt; - - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_linear_col_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_linear_col_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_linear_col_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_linear_col_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn.cpp deleted file mode 100644 index 8dc3125cee..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn.cpp +++ /dev/null @@ -1,249 +0,0 @@ -#include "Evolver_linear_col_pn.h" - -// Evolve function -void Evolver_linear_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} -void Evolver_linear_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_col_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} - -void Evolver_linear_col_pn::sync_step(vector &bodies, Force *force, double dt) { - double dth = 0.5*dt; - - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_linear_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_linear_col_pn::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_linear_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_linear_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn_mb.cpp deleted file mode 100644 index 9a75d6a49a..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_col_pn_mb.cpp +++ /dev/null @@ -1,253 +0,0 @@ -#include "Evolver_linear_col_pn_mb.h" - -// Evolve function -void Evolver_linear_col_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} -void Evolver_linear_col_pn_mb::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_col_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} - -void Evolver_linear_col_pn_mb::sync_step(vector &bodies, Force *force, double dt) { - double dth = 0.5*dt; - - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_linear_col_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_linear_col_pn_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_linear_col_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_linear_col_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_mb.cpp deleted file mode 100644 index 6ba3c862af..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_mb.cpp +++ /dev/null @@ -1,151 +0,0 @@ -#include "Evolver_linear_mb.h" - -// Evolve function -void Evolver_linear_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_torque_load(bodies, false); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_load(bodies, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} - -void Evolver_linear_mb::sync_step(vector &bodies, Force *force, double dt) { - double dth = 0.5*dt; - - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_linear_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_linear_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque(bodies, false); -} -void Evolver_linear_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_linear_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn.cpp deleted file mode 100644 index 146edc7a72..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#include "Evolver_linear_pn.h" - -// Evolve function -void Evolver_linear_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} - -void Evolver_linear_pn::sync_step(vector &bodies, Force *force, double dt) { - double dth = 0.5*dt; - - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_linear_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_linear_pn::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_linear_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_linear_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn_mb.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn_mb.cpp deleted file mode 100644 index 13d1f03e4c..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_linear_pn_mb.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include "Evolver_linear_pn_mb.h" - -// Evolve function -void Evolver_linear_pn_mb::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - - orbit.drift_r(bodies, dth); - - force->update_tidal_deformation_save(bodies); - force->update_equilibrium_tensor_and_memorize(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - force->update_acceleration_and_torque_pn_load(bodies, false, false); - - orbit.kick_vv(bodies, dth); - - spin.kick_K_mb(bodies, dth); - spin.kick_K(bodies, dth); - - shape.calculate_I_inv_and_w_with_K(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - spin.memorize_w(bodies); - shape.backup_I_e(bodies); - - force->update_acceleration_and_torque_pn_load(bodies, true, false); - - orbit.kick_v(bodies, dt); - - spin.kick_L(bodies, dt); - spin.kick_L_mb(bodies, dt); - - orbit.drift_r(bodies, dth); - - sync_step(bodies, force, dt_step); -} - -void Evolver_linear_pn_mb::sync_step(vector &bodies, Force *force, double dt) { - double dth = 0.5*dt; - - force->update_tidal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - shape.set_I_e_prev_to_backup(bodies); - - shape.kick_linear_discrete(bodies, dth); - - shape.calculate_I_inv_and_w(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - - for(int n=0; nupdate_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - spin.reset_w(bodies); - - shape.kick_linear_discrete(bodies, dth); - } - - shape.calculate_I_inv_and_w(bodies); - - reset_aux(bodies); -} - -void Evolver_linear_pn_mb::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_linear_pn_mb::initialize(vector &bodies, Force *force) { - shape.calculate_I_inv_and_w(bodies); - - force->update_tidal_deformation(bodies); - force->update_centrifugal_deformation(bodies); - force->update_equilibrium_tensor(bodies); - - force->update_acceleration_and_torque_pn(bodies, false, false); -} -void Evolver_linear_pn_mb::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_linear_pn_mb::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody.cpp deleted file mode 100755 index d9deafa6de..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "Evolver_nbody.h" - -// Evolve function -void Evolver_nbody::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - orbit.drift_r(bodies, dth); - force->update_acceleration(bodies); - orbit.kick_v(bodies, dt); - orbit.drift_r(bodies, dth); -} -void Evolver_nbody::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_nbody::initialize(vector &bodies, Force *force) { - force->update_acceleration(bodies); -} -void Evolver_nbody::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_nbody::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_base.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_base.cpp deleted file mode 100644 index e5f581679f..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_base.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "Evolver_nbody_base.h" - -// Get diagnostics -array Evolver_nbody_base::get_spin_angular_momentum(vector &bodies) { - array L = {}; - return L; -} -double Evolver_nbody_base::get_spin_kinetic_energy(vector &bodies) { - return 0; -} -double Evolver_nbody_base::get_potential_energy(vector &bodies) { - return orbit.get_potential_energy_nbody(bodies); -} -array Evolver_nbody_base::get_angular_momentum(vector &bodies) { - return orbit.get_angular_momentum(bodies); -} -double Evolver_nbody_base::get_energy(vector &bodies) { - double EK = get_orbital_kinetic_energy(bodies); - double EP = get_potential_energy(bodies); - return EK + EP; -} - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col.cpp deleted file mode 100644 index 190543954d..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "Evolver_nbody_col.h" - -// Evolve function -void Evolver_nbody_col::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - orbit.drift_r(bodies, dth); - force->update_acceleration(bodies); - orbit.kick_v(bodies, dt); - orbit.drift_r(bodies, dth); -} -void Evolver_nbody_col::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - orbit.drift_r(bodies, dth); - force->update_acceleration_col(bodies); - orbit.kick_v(bodies, dt); - orbit.drift_r(bodies, dth); -} -void Evolver_nbody_col::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_nbody_col::initialize(vector &bodies, Force *force) { - force->update_acceleration(bodies); -} -void Evolver_nbody_col::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - -void Evolver_nbody_col::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col_pn.cpp deleted file mode 100644 index 20f8b6b57e..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_col_pn.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include "Evolver_nbody_col_pn.h" - -// Evolve function -void Evolver_nbody_col_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - orbit.drift_r(bodies, dth); - force->update_acceleration_pn_save(bodies, false); - orbit.kick_vv(bodies, dth); - force->update_acceleration_pn_load(bodies, true); - orbit.kick_v(bodies, dt); - force->update_acceleration_pn_load(bodies, false); - orbit.kick_vv(bodies, dth); - orbit.drift_r(bodies, dth); -} -void Evolver_nbody_col_pn::leapfrog_step_with_collisions(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - orbit.drift_r(bodies, dth); - force->update_acceleration_pn_save(bodies, false); - orbit.kick_vv(bodies, dth); - force->update_acceleration_pn_col_load(bodies, true); - orbit.kick_v(bodies, dt); - force->update_acceleration_pn_load(bodies, false); - orbit.kick_vv(bodies, dth); - orbit.drift_r(bodies, dth); -} -void Evolver_nbody_col_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step_with_collisions(bodies, w1*dt, force); -} - -void Evolver_nbody_col_pn::initialize(vector &bodies, Force *force) { - force->update_acceleration_pn(bodies, false); -} -void Evolver_nbody_col_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} -void Evolver_nbody_col_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - if(force->collision_detected) { - collision_flag = true; - } - if(force->roche_detected) { - roche_flag = true; - } - - if(force->collision_detected) { - if(collision_mode >= 2) { - break; - } - } - if(force->roche_detected) { - if(roche_mode >= 2) { - break; - } - } - } -} - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_pn.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_pn.cpp deleted file mode 100644 index ae32a685c9..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_nbody_pn.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "Evolver_nbody_pn.h" - -// Evolve function -void Evolver_nbody_pn::leapfrog_step(vector &bodies, double dt, Force *force) { - double dth = 0.5*dt; - orbit.drift_r(bodies, dth); - force->update_acceleration_pn_save(bodies, false); - orbit.kick_vv(bodies, dth); - force->update_acceleration_pn_load(bodies, true); - orbit.kick_v(bodies, dt); - force->update_acceleration_pn_load(bodies, false); - orbit.kick_vv(bodies, dth); - orbit.drift_r(bodies, dth); -} -void Evolver_nbody_pn::mclachlan_step(vector &bodies, double dt, Force *force) { - leapfrog_step(bodies, w1*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w3*dt, force); - leapfrog_step(bodies, w2*dt, force); - leapfrog_step(bodies, w1*dt, force); -} - -void Evolver_nbody_pn::initialize(vector &bodies, Force *force) { - force->update_acceleration_pn(bodies, false); -} -void Evolver_nbody_pn::evolve_model(double &t, double &t_end, vector &bodies, Force *force, Timestep_base *timestep) { - bool toContinue = true; - - num_integration_step = 0; - - while(toContinue) { - reset_aux(bodies); - - //---------------------------------------------- - - dt_step = timestep->get_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - - //---------------------------------------------- - - toContinue = stopping_condition_time(t, t_end, timestep->dt_sgn); - } -} -void Evolver_nbody_pn::evolve_model(double &t, int &N_step, vector &bodies, Force *force, Timestep_base *timestep) { - num_integration_step = 0; - - for(int i=0; iget_timestep(bodies); - - //---------------------------------------------- - - mclachlan_step(bodies, dt_step, force); - - //---------------------------------------------- - - t += dt_step; - num_integration_step++; - } -} - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_shape_base.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_shape_base.cpp deleted file mode 100644 index 36fd07ba1b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Evolver_shape_base.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "Evolver_shape_base.h" - -// Get diagnostics -array Evolver_shape_base::get_spin_angular_momentum(vector &bodies) { - return spin.get_angular_momentum(bodies); -} -double Evolver_shape_base::get_spin_kinetic_energy(vector &bodies) { - return spin.get_kinetic_energy(bodies); -} -double Evolver_shape_base::get_potential_energy(vector &bodies) { - return orbit.get_potential_energy(bodies); -} -array Evolver_shape_base::get_angular_momentum(vector &bodies) { - array Lorbit = get_orbital_angular_momentum(bodies); - array Lspin = get_spin_angular_momentum(bodies); - array Ltot = {}; - for(int k=0; k<3; k++) { - Ltot[k] = Lorbit[k] + Lspin[k]; - } - return Ltot; -} -double Evolver_shape_base::get_energy(vector &bodies) { - double EK_orbit = get_orbital_kinetic_energy(bodies); - double EK_spin = get_spin_kinetic_energy(bodies); - double EP = get_potential_energy(bodies); - double E = EK_orbit + EK_spin + EP; - return E; -} - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Force.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Force.cpp deleted file mode 100755 index baa79772b0..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Force.cpp +++ /dev/null @@ -1,3062 +0,0 @@ -#include "Force.h" - -// Initializers - -Force::Force() { - this->set_default_settings(); -} - -Force::Force(int pn_order, double c) { - this->set_default_settings(); - - this->pn_order = pn_order; - this->c = c; - this->set_speed_of_light(this->c); -} - -void Force::set_default_settings() { - this->pn_order = 0; - - this->c = 1e100; - this->set_speed_of_light(this->c); - - collision_detected = false; - index_collisions.clear(); - - roche_detected = false; - index_roche.clear(); -} - -// Setters - -void Force::set_pn_order(int pn_order) { - this->pn_order = pn_order; -} -void Force::set_speed_of_light(double c) { - this->c = c; - this->c_2 = 1./(this->c*this->c); - this->c_4 = this->c_2*this->c_2; - this->c_5 = this->c_4/this->c; -} - -// Collision checker - -void Force::check_for_collisions(Body &bi, Body &bj, double &dr_1) { - double Rsum = bi.R+bj.R; - double fcol_R = Rsum*dr_1; - - if(fcol_R > 1) { - this->collision_detected = true; - - array couple; - couple[0] = bi.id; - couple[1] = bj.id; - - this->index_collisions.push_back(couple); - } -} -void Force::check_for_collisions(Body &bi, Body &bj, double &dr_3, double &dr2) { - double dr_1 = dr_3*dr2; - this->check_for_collisions(bi, bj, dr_1); -} - -void Force::check_for_roche(Body &bi, Body &bj, double &dr_1) { - bool is_roche = false; - - if(bi.rho > 0 && bj.m > 0) { - double C = bi.roche_factor; - double m = bi.m; - double r = bi.R; - double M = bj.m; - - double d = C * r * pow(M/m, 1./3); - double f = d*dr_1; - - if(f > 1) { - this->roche_detected = true; - - array couple; - couple[0] = bi.id; - couple[1] = bj.id; - - this->index_roche.push_back(couple); - - is_roche = true; - } - } - - if(!is_roche) { - if(bj.rho > 0 && bi.m > 0) { - double C = bj.roche_factor; - double m = bj.m; - double r = bj.R; - double M = bi.m; - - double d = C * r * pow(M/m, 1./3); - double f = d*dr_1; - - if(f > 1) { - this->roche_detected = true; - - array couple; - couple[0] = bi.id; - couple[1] = bj.id; - - this->index_roche.push_back(couple); - - is_roche = true; - } - } - } -} -void Force::check_for_roche(Body &bi, Body &bj, double &dr_3, double &dr2) { - double dr_1 = dr_3*dr2; - this->check_for_roche(bi, bj, dr_1); -} - -void Force::reset_collisions() { - this->collision_detected = false; - this->index_collisions.clear(); -} -void Force::reset_roche() { - this->roche_detected = false; - this->index_roche.clear(); -} - -// Force functions - -void Force::precalc_sep_vec(Body &bi, Body &bj, array &dr) { - for(int k=0; k<3; k++) { - dr[k] = bi.r[k]-bj.r[k]; - } -} -void Force::precalc_sep_mag(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3) { - precalc_sep_vec(bi, bj, dr); - dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - dr_3 = 1./sqrt(dr2*dr2*dr2); -} -void Force::precalc_sep_vec_norm(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr_3) { - double dr2; - - precalc_sep_mag(bi, bj, dr, dr2, dr_3); - - double dr_1 = dr2*dr_3; - dr_4 = dr_3*dr_1; - - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } -} -void Force::precalc_sep_vec_norm_load(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr2, double &dr_3) { - precalc_sep_vec(bi, bj, dr); - - double dr_1 = dr2*dr_3; - dr_4 = dr_3*dr_1; - - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } -} -void Force::precalc_sep_vec_norm_save(Body &bi, Body &bj, array &dr, array &drn, double &dr_4, double &dr2, double &dr_3) { - precalc_sep_mag(bi, bj, dr, dr2, dr_3); - - double dr_1 = dr2*dr_3; - dr_4 = dr_3*dr_1; - - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } -} - -void Force::precalc_pn(Body &bi, Body &bj, bool &use_vv, array &drn, double &dr_1, double &vivi, double &vjvj, double &vivj, double &drnvi, double &drnvj, double &dv2, array &dv, double &drnvidrnvi, double &drnvjdrnvj, double &bimdr_1, double &bjmdr_1) { - if(use_vv) { - for(int k=0; k<3; k++) dv[k] = bi.vv[k]-bj.vv[k]; - vivi = inner_product(bi.vv.begin(), bi.vv.end(), bi.vv.begin(), 0.); - vjvj = inner_product(bj.vv.begin(), bj.vv.end(), bj.vv.begin(), 0.); - vivj = inner_product(bi.vv.begin(), bi.vv.end(), bj.vv.begin(), 0.); - drnvi = inner_product(drn.begin(), drn.end(), bi.vv.begin(), 0.); - drnvj = inner_product(drn.begin(), drn.end(), bj.vv.begin(), 0.); - } - else { - for(int k=0; k<3; k++) dv[k] = bi.v[k]-bj.v[k]; - vivi = inner_product(bi.v.begin(), bi.v.end(), bi.v.begin(), 0.); - vjvj = inner_product(bj.v.begin(), bj.v.end(), bj.v.begin(), 0.); - vivj = inner_product(bi.v.begin(), bi.v.end(), bj.v.begin(), 0.); - drnvi = inner_product(drn.begin(), drn.end(), bi.v.begin(), 0.); - drnvj = inner_product(drn.begin(), drn.end(), bj.v.begin(), 0.); - } - - dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); - - drnvidrnvi = drnvi*drnvi; - drnvjdrnvj = drnvj*drnvj; - - bimdr_1 = bi.m*dr_1; - bjmdr_1 = bj.m*dr_1; -} -void Force::precalc_tidal(double &dr2, double &dr_3, double &dr_1, double &dr_2, double &dr_4, double &dr_5, array &dr, array &drn, double &dyndyn, double &dzndzn, double &dxndyn, double &dxndzn, double &dyndzn) { - dr_1 = dr2*dr_3; - dr_2 = dr_1*dr_1; - dr_4 = dr_2*dr_2; - dr_5 = dr_3*dr_2; - - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } - - dyndyn = 0.5*(drn[1]*drn[1] - 0.2); - dzndzn = 0.5*(drn[2]*drn[2] - 0.2); - dxndyn = drn[0]*drn[1]; - dxndzn = drn[0]*drn[2]; - dyndzn = drn[1]*drn[2]; -} - -void Force::calculate_nbody_force(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3, array &ai, array &aj) { - bool calc_done = false; - - if(bj.particle_type > 0) { - precalc_sep_mag(bi, bj, dr, dr2, dr_3); - calc_done = true; - - double amag = bj.m*dr_3; - - for(int k=0; k<3; k++) { - ai[k] = -amag*dr[k]; - } - } - else { - for(int k=0; k<3; k++) { - ai[k] = 0; - } - } - - if(bi.particle_type > 0) { - if(calc_done == false) { - precalc_sep_mag(bi, bj, dr, dr2, dr_3); - calc_done = true; - } - - double amag = bi.m*dr_3; - - for(int k=0; k<3; k++) { - aj[k] = amag*dr[k]; - } - } - else { - for(int k=0; k<3; k++) { - aj[k] = 0; - } - } -} -void Force::calculate_nbody_force_load(Body &bi, Body &bj, array &dr, double &dr2, double &dr_3, array &ai, array &aj) { - bool calc_done = false; - - if(bj.particle_type > 0) { - precalc_sep_vec(bi, bj, dr); - calc_done = true; - - double amag = bj.m*dr_3; - - for(int k=0; k<3; k++) { - ai[k] = -amag*dr[k]; - } - } - else { - for(int k=0; k<3; k++) { - ai[k] = 0; - } - } - - if(bi.particle_type > 0) { - if(calc_done == false) { - precalc_sep_vec(bi, bj, dr); - calc_done = true; - } - - double amag = bi.m*dr_3; - - for(int k=0; k<3; k++) { - aj[k] = amag*dr[k]; - } - } - else { - for(int k=0; k<3; k++) { - aj[k] = 0; - } - } -} - -void Force::calculate_pn_force(Body &bi, Body &bj, double &dr2, double &dr_1, double &dr_2, double &dr_3, double &dr_4, array &dr, array &drn, double &dv2, array &dv, array &ai_pn, array &aj_pn, bool use_vv) { - bool calc_done = false; - - double vivi, vjvj, vivj, drnvi, drnvj, drnvidrnvi, drnvjdrnvj, bimdr_1, bjmdr_1; - - if(bj.particle_type > 0) { - precalc_pn(bi, bj, use_vv, drn, dr_1, vivi, vjvj, vivj, drnvi, drnvj, dv2, dv, drnvidrnvi, drnvjdrnvj, bimdr_1, bjmdr_1); - calc_done = true; - - // 1 PN - array ai_1pn = {}; - - double A = bj.m*dr_2; - double B = -vivi - 2*vjvj + 4*vivj + 1.5*drnvjdrnvj + 5*bimdr_1 + 4*bjmdr_1; - double C = 4*drnvi - 3*drnvj; - - for(int k=0; k<3; k++) { - ai_1pn[k] = A*(B*drn[k] + C*dv[k]); - } - - // 2 PN - array ai_2pn = {}; - - if(pn_order > 1) { - A = bj.m*dr_2; - B = vivi*drnvj + 4*vjvj*drnvi - 5*vjvj*drnvj - 4*vivj*drnvi + 4*vivj*drnvj - 6*drnvi*drnvjdrnvj + 4.5*drnvjdrnvj*drnvj + - bimdr_1*(-15.75*drnvi + 13.75*drnvj) + bjmdr_1*(-2*drnvi - 2*drnvj); - C = -2*vjvj*vjvj + 4*vjvj*vivj - 2*vivj*vivj + 1.5*vivi*drnvjdrnvj + 4.5*vjvj*drnvjdrnvj - 6*vivj*drnvjdrnvj - 1.875*drnvjdrnvj*drnvjdrnvj + - bjmdr_1*(4*vjvj - 8*vivj + 2*drnvidrnvi - 4*drnvi*drnvj - 6*drnvjdrnvj) + - bimdr_1*(-3.75*vivi + 1.25*vjvj - 2.5*vivj + 19.5*drnvidrnvi - 39.*drnvi*drnvj + 8.5*drnvjdrnvj); - double D = bj.m*dr_4*(-14.25*bi.m*bi.m - 9*bj.m*bj.m - 34.5*bi.m*bj.m); - - for(int k=0; k<3; k++) { - ai_2pn[k] = A*( B*dv[k] + C*drn[k]) + D*drn[k]; - } - } - - // 2.5 PN - array ai_25pn = {}; - - if(pn_order > 2) { - A = 0.8*bi.m*bj.m*dr_3; - B = -dv2 + 2*bimdr_1 - 8*bjmdr_1; - C = (3*dv2 - 6*bimdr_1 + (17.+1./3)*bjmdr_1)*(drnvi - drnvj); - for(int k=0; k<3; k++) { - ai_25pn[k] = A*( B*dv[k] + C*drn[k] ); - } - } - - for(int k=0; k<3; k++) { - ai_pn[k] = ai_1pn[k]*c_2 + ai_2pn[k]*c_4 + ai_25pn[k]*c_5; - } - } - else { - for(int k=0; k<3; k++) { - ai_pn[k] = 0; - } - } - - if(bi.particle_type > 0) { - if(calc_done == false) { - precalc_pn(bi, bj, use_vv, drn, dr_1, vivi, vjvj, vivj, drnvi, drnvj, dv2, dv, drnvidrnvi, drnvjdrnvj, bimdr_1, bjmdr_1); - calc_done = true; - } - - // 1 PN - array aj_1pn = {}; - - double A = bi.m*dr_2; - double B = -vjvj - 2*vivi + 4*vivj + 1.5*drnvidrnvi + 5*bjmdr_1 + 4*bimdr_1; - double C = 4*-drnvj - 3*-drnvi; - - for(int k=0; k<3; k++) { - aj_1pn[k] = A*(B*-drn[k] + C*-dv[k] ); - } - - // 2 PN - array aj_2pn = {}; - - if(pn_order > 1) { - A = bi.m*dr_2; - B = vjvj*-drnvi + 4*vivi*-drnvj - 5*vivi*-drnvi - 4*vivj*-drnvj + 4*vivj*-drnvi - 6*-drnvj*drnvidrnvi + 4.5*drnvidrnvi*-drnvi + - bjmdr_1*(-15.75*-drnvj + 13.75*-drnvi) + bimdr_1*(-2*-drnvj - 2*-drnvi); - C = -2*vivi*vivi + 4*vivi*vivj - 2*vivj*vivj + 1.5*vjvj*drnvidrnvi + 4.5*vivi*drnvidrnvi - 6*vivj*drnvidrnvi - 1.875*drnvidrnvi*drnvidrnvi + - bimdr_1*(4*vivi - 8*vivj + 2*drnvjdrnvj - 4*-drnvj*-drnvi - 6*drnvidrnvi) + - bjmdr_1*(-3.75*vjvj + 1.25*vivi - 2.5*vivj + 19.5*drnvjdrnvj - 39.*-drnvj*-drnvi + 8.5*drnvidrnvi); - double D = bi.m*dr_4*(-14.25*bj.m*bj.m - 9*bi.m*bi.m - 34.5*bj.m*bi.m); - - for(int k=0; k<3; k++) { - aj_2pn[k] = A*( B*-dv[k] + C*-drn[k]) + D*-drn[k]; - } - } - - // 2.5 PN - array aj_25pn = {}; - - if(pn_order > 2) { - A = 0.8*bi.m*bj.m*dr_3; - B = -dv2 + 2*bjmdr_1 - 8*bimdr_1; - C = (3*dv2 - 6*bjmdr_1 + (17.+1./3)*bimdr_1)*(-drnvj - -drnvi); - for(int k=0; k<3; k++) { - aj_25pn[k] = A*( B*-dv[k] + C*-drn[k] ); - } - } - - for(int k=0; k<3; k++) { - aj_pn[k] = aj_1pn[k]*c_2 + aj_2pn[k]*c_4 + aj_25pn[k]*c_5; - } - } - else { - for(int k=0; k<3; k++) { - aj_pn[k] = 0; - } - } -} - -void Force::calculate_tidal_force(Body &bi, Body &bj, double &dr2, double &dr_3, double &dr_1, double &dr_2, double &dr_4, double &dr_5, array &dr, array &drn, array &ai_tidal, array &aj_tidal, array &hij, array &hji, bool use_J) { - bool calc_done = false; - - double dyndyn, dzndzn, dxndyn, dxndzn, dyndzn; - array bi_I, bj_I; - array gij = {}; - array gji = {}; - double gmag, A; - - if(bj.particle_type == 3) { - precalc_tidal(dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, dyndyn, dzndzn, dxndyn, dxndzn, dyndzn); - A = -3*dr_4; - calc_done = true; - - if(use_J) { - for(int k=0; k<6; k++) { - bj_I[k] = bj.J[k]; - } - } - else { - for(int k=0; k<6; k++) { - bj_I[k] = bj.I[k]; - } - } - - gmag = 15*dr_5 * ( (bj_I[3]-bj_I[0])*dyndyn + (bj_I[5]-bj_I[0])*dzndzn + bj_I[1]*dxndyn + bj_I[2]*dxndzn + bj_I[4]*dyndzn ); - - for(int k=0; k<3; k++) { - gij[k] = gmag*dr[k]; - } - - hij[0] = A * ( bj_I[2]*drn[2] + bj_I[1]*drn[1] ); - hij[1] = A * ( (bj_I[3]-bj_I[0])*drn[1] + bj_I[1]*drn[0] + bj_I[4]*drn[2] ); - hij[2] = A * ( (bj_I[5]-bj_I[0])*drn[2] + bj_I[2]*drn[0] + bj_I[4]*drn[1] ); - } - else { - for(int k=0; k<3; k++) { - gij[k] = 0; - hij[k] = 0; - } - } - - if(bi.particle_type == 3) { - if(calc_done == false) { - precalc_tidal(dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, dyndyn, dzndzn, dxndyn, dxndzn, dyndzn); - A = -3*dr_4; - calc_done = true; - } - - if(use_J) { - for(int k=0; k<6; k++) { - bi_I[k] = bi.J[k]; - } - } - else { - for(int k=0; k<6; k++) { - bi_I[k] = bi.I[k]; - } - } - - gmag = 15*dr_5 * ( (bi_I[3]-bi_I[0])*dyndyn + (bi_I[5]-bi_I[0])*dzndzn + bi_I[1]*dxndyn + bi_I[2]*dxndzn + bi_I[4]*dyndzn ); - - for(int k=0; k<3; k++) { - gji[k] = gmag*dr[k]; - } - - hji[0] = A * ( bi_I[2]*drn[2] + bi_I[1]*drn[1] ); - hji[1] = A * ( (bi_I[3]-bi_I[0])*drn[1] + bi_I[1]*drn[0] + bi_I[4]*drn[2] ); - hji[2] = A * ( (bi_I[5]-bi_I[0])*drn[2] + bi_I[2]*drn[0] + bi_I[4]*drn[1] ); - } - else { - for(int k=0; k<3; k++) { - gji[k] = 0; - hji[k] = 0; - } - } - - if(bi.particle_type > 0 && bj.particle_type > 0) { - for(int k=0; k<3; k++) { - double F = bi.m*gij[k] + bi.m*hij[k] + bj.m*gji[k] + bj.m*hji[k]; - ai_tidal[k] = F / bi.m; - aj_tidal[k] = -F / bj.m; - } - } - else { - if(bi.particle_type > 0) { - for(int k=0; k<3; k++) { - double acc = gji[k] + hji[k]; - ai_tidal[k] = 0; - aj_tidal[k] = -acc; - } - } - else if(bj.particle_type > 0) { - for(int k=0; k<3; k++) { - double acc = gij[k] + hij[k]; - ai_tidal[k] = acc; - aj_tidal[k] = 0; - } - } - else { - for(int k=0; k<3; k++) { - ai_tidal[k] = 0; - aj_tidal[k] = 0; - } - } - } - - for(int k=0; k<3; k++) { - hij[k] *= bi.m; - hji[k] *= bj.m; - } -} - -void Force::calculate_tidal_h(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J) { - bool calc_done = false; - - array drn; - array bi_I, bj_I; - double A, dr_4, dr_3; - - if(bj.particle_type == 3) { - precalc_sep_vec_norm(bi, bj, dr, drn, dr_4, dr_3); - A = -3*dr_4; - calc_done = true; - - if(use_J) { - for(int k=0; k<6; k++) { - bj_I[k] = bj.J[k]; - } - } - else { - for(int k=0; k<6; k++) { - bj_I[k] = bj.I[k]; - } - } - - hij[0] = A * ( bj_I[2]*drn[2] + bj_I[1]*drn[1] ); - hij[1] = A * ( (bj_I[3]-bj_I[0])*drn[1] + bj_I[1]*drn[0] + bj_I[4]*drn[2] ); - hij[2] = A * ( (bj_I[5]-bj_I[0])*drn[2] + bj_I[2]*drn[0] + bj_I[4]*drn[1] ); - } - else { - for(int k=0; k<3; k++) { - hij[k] = 0; - } - } - - if(bi.particle_type == 3) { - if(calc_done == false) { - precalc_sep_vec_norm(bi, bj, dr, drn, dr_4, dr_3); - A = -3*dr_4; - calc_done = true; - } - - if(use_J) { - for(int k=0; k<6; k++) { - bi_I[k] = bi.J[k]; - } - } - else { - for(int k=0; k<6; k++) { - bi_I[k] = bi.I[k]; - } - } - - hji[0] = A * ( bi_I[2]*drn[2] + bi_I[1]*drn[1] ); - hji[1] = A * ( (bi_I[3]-bi_I[0])*drn[1] + bi_I[1]*drn[0] + bi_I[4]*drn[2] ); - hji[2] = A * ( (bi_I[5]-bi_I[0])*drn[2] + bi_I[2]*drn[0] + bi_I[4]*drn[1] ); - } - else { - for(int k=0; k<3; k++) { - hji[k] = 0; - } - } - - for(int k=0; k<3; k++) { - hij[k] *= bi.m; - hji[k] *= bj.m; - } -} -void Force::calculate_tidal_h_load(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J, double &dr2, double &dr_3) { - bool calc_done = false; - - array drn; - array bi_I, bj_I; - double A, dr_4; - - if(bj.particle_type == 3) { - precalc_sep_vec_norm_load(bi, bj, dr, drn, dr_4, dr2, dr_3); - A = -3*dr_4; - calc_done = true; - - if(use_J) { - for(int k=0; k<6; k++) { - bj_I[k] = bj.J[k]; - } - } - else { - for(int k=0; k<6; k++) { - bj_I[k] = bj.I[k]; - } - } - - hij[0] = A * ( bj_I[2]*drn[2] + bj_I[1]*drn[1] ); - hij[1] = A * ( (bj_I[3]-bj_I[0])*drn[1] + bj_I[1]*drn[0] + bj_I[4]*drn[2] ); - hij[2] = A * ( (bj_I[5]-bj_I[0])*drn[2] + bj_I[2]*drn[0] + bj_I[4]*drn[1] ); - } - else { - for(int k=0; k<3; k++) { - hij[k] = 0; - } - } - - if(bi.particle_type == 3) { - if(calc_done == false) { - precalc_sep_vec_norm_load(bi, bj, dr, drn, dr_4, dr2, dr_3); - A = -3*dr_4; - calc_done = true; - } - - if(use_J) { - for(int k=0; k<6; k++) { - bi_I[k] = bi.J[k]; - } - } - else { - for(int k=0; k<6; k++) { - bi_I[k] = bi.I[k]; - } - } - - hji[0] = A * ( bi_I[2]*drn[2] + bi_I[1]*drn[1] ); - hji[1] = A * ( (bi_I[3]-bi_I[0])*drn[1] + bi_I[1]*drn[0] + bi_I[4]*drn[2] ); - hji[2] = A * ( (bi_I[5]-bi_I[0])*drn[2] + bi_I[2]*drn[0] + bi_I[4]*drn[1] ); - } - else { - for(int k=0; k<3; k++) { - hji[k] = 0; - } - } - - for(int k=0; k<3; k++) { - hij[k] *= bi.m; - hji[k] *= bj.m; - } -} -void Force::calculate_tidal_h_save(Body &bi, Body &bj, array &dr, array &hij, array &hji, bool use_J, double &dr2, double &dr_3) { - bool calc_done = false; - - array drn; - array bi_I, bj_I; - double A, dr_4; - - if(bi.particle_type > 0 || bj.particle_type > 0) { - precalc_sep_vec_norm_save(bi, bj, dr, drn, dr_4, dr2, dr_3); - A = -3*dr_4; - calc_done = true; - } - - if(bj.particle_type == 3) { - if(calc_done == false) { - precalc_sep_vec_norm_save(bi, bj, dr, drn, dr_4, dr2, dr_3); - A = -3*dr_4; - calc_done = true; - } - - if(use_J) { - for(int k=0; k<6; k++) { - bj_I[k] = bj.J[k]; - } - } - else { - for(int k=0; k<6; k++) { - bj_I[k] = bj.I[k]; - } - } - - hij[0] = A * ( bj_I[2]*drn[2] + bj_I[1]*drn[1] ); - hij[1] = A * ( (bj_I[3]-bj_I[0])*drn[1] + bj_I[1]*drn[0] + bj_I[4]*drn[2] ); - hij[2] = A * ( (bj_I[5]-bj_I[0])*drn[2] + bj_I[2]*drn[0] + bj_I[4]*drn[1] ); - } - else { - for(int k=0; k<3; k++) { - hij[k] = 0; - } - } - - if(bi.particle_type == 3) { - if(calc_done == false) { - precalc_sep_vec_norm_save(bi, bj, dr, drn, dr_4, dr2, dr_3); - A = -3*dr_4; - calc_done = true; - } - - if(use_J) { - for(int k=0; k<6; k++) { - bi_I[k] = bi.J[k]; - } - } - else { - for(int k=0; k<6; k++) { - bi_I[k] = bi.I[k]; - } - } - - hji[0] = A * ( bi_I[2]*drn[2] + bi_I[1]*drn[1] ); - hji[1] = A * ( (bi_I[3]-bi_I[0])*drn[1] + bi_I[1]*drn[0] + bi_I[4]*drn[2] ); - hji[2] = A * ( (bi_I[5]-bi_I[0])*drn[2] + bi_I[2]*drn[0] + bi_I[4]*drn[1] ); - } - else { - for(int k=0; k<3; k++) { - hji[k] = 0; - } - } - - for(int k=0; k<3; k++) { - hij[k] *= bi.m; - hji[k] *= bj.m; - } -} - -// Torque functions - -void Force::calculate_torque(Body &bi, Body &bj, array &dr, array &hij, array &hji) { - if(bi.particle_type == 3) { - bi.T[0] += -dr[1]*hji[2] + dr[2]*hji[1]; - bi.T[1] += -dr[2]*hji[0] + dr[0]*hji[2]; - bi.T[2] += -dr[0]*hji[1] + dr[1]*hji[0]; - } - if(bj.particle_type == 3) { - bj.T[0] += -dr[1]*hij[2] + dr[2]*hij[1]; - bj.T[1] += -dr[2]*hij[0] + dr[0]*hij[2]; - bj.T[2] += -dr[0]*hij[1] + dr[1]*hij[0]; - } -} - -// Inertia tensor functions - -void Force::calculate_deformation_tensor(Body &bi, Body &bj, array &drn, double &dr_3) { - bool calc_done = false; - - double third, Xi, Xj, dr_4; - array Ie_tidal = {}; - array dr = {}; - - if(bi.particle_type == 3 && bj.particle_type > 0) { - third = 1./3; - - Ie_tidal[0] = (drn[0]*drn[0]-third); - Ie_tidal[3] = (drn[1]*drn[1]-third); - Ie_tidal[1] = drn[0]*drn[1]; - Ie_tidal[2] = drn[0]*drn[2]; - Ie_tidal[4] = drn[1]*drn[2]; - - calc_done = true; - - Xi = -bj.m*bi.kf_R5*dr_3; - - for(int k=0; k<5; k++) { - bi.I_e_r[k] += Xi*Ie_tidal[k]; - } - } - - if(bj.particle_type == 3 && bi.particle_type > 0) { - if(calc_done == false) { - third = 1./3; - - Ie_tidal[0] = (drn[0]*drn[0]-third); - Ie_tidal[3] = (drn[1]*drn[1]-third); - Ie_tidal[1] = drn[0]*drn[1]; - Ie_tidal[2] = drn[0]*drn[2]; - Ie_tidal[4] = drn[1]*drn[2]; - - calc_done = true; - } - - Xj = -bi.m*bj.kf_R5*dr_3; - - for(int k=0; k<5; k++) { - bj.I_e_r[k] += Xj*Ie_tidal[k]; - } - } -} - -// Acceleration updaters - -void Force::update_acceleration(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k]; - bj->a[k] += aj[k]; - } - } - } -} - -void Force::update_acceleration_pn(vector &bodies, bool use_vv) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_pn - double dr_1 = dr2*dr_3; - double dr_2 = dr_1*dr_1; - double dr_4 = dr_2*dr_2; - array drn = {}; - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } - - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_pn[k]; - } - } - } -} - -void Force::update_acceleration_tidal(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - } - } -} - -void Force::update_acceleration_col(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k]; - bj->a[k] += aj[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - - -void Force::update_acceleration_pn_col(vector &bodies, bool use_vv) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_pn - double dr_1 = dr2*dr_3; - double dr_2 = dr_1*dr_1; - double dr_4 = dr_2*dr_2; - array drn = {}; - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } - - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_pn[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_tidal_col(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_tidal_pn(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - } - } -} - -void Force::update_acceleration_tidal_pn_col(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_and_torque(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_acceleration_and_torque_pn(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_acceleration_and_torque_col(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - reset_collisions(); - reset_roche(); - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_and_torque_pn_col(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - reset_collisions(); - reset_roche(); - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_and_torque_and_deformation_tensor(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - b->I_e_r.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Tidal deformation - calculate_deformation_tensor(*bi, *bj, drn, dr_3); - } - } -} - -void Force::update_acceleration_and_torque_and_deformation_tensor_col(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - b->I_e_r.fill(0); - } - - reset_collisions(); - reset_roche(); - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Tidal deformation - calculate_deformation_tensor(*bi, *bj, drn, dr_3); - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_and_torque_pn_and_deformation_tensor(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - b->I_e_r.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Tidal deformation - calculate_deformation_tensor(*bi, *bj, drn, dr_3); - } - } -} -void Force::update_acceleration_and_torque_pn_and_deformation_tensor_col(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - b->I_e_r.fill(0); - } - - reset_collisions(); - reset_roche(); - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Tidal deformation - calculate_deformation_tensor(*bi, *bj, drn, dr_3); - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_load(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k]; - bj->a[k] += aj[k]; - } - } - } -} - -void Force::update_acceleration_pn_load(vector &bodies, bool use_vv) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_pn - double dr_1 = dr2*dr_3; - double dr_2 = dr_1*dr_1; - double dr_4 = dr_2*dr_2; - array drn = {}; - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } - - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_pn[k]; - } - } - } -} - -void Force::update_acceleration_tidal_load(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - } - } -} - -void Force::update_acceleration_col_load(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k]; - bj->a[k] += aj[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_pn_col_load(vector &bodies, bool use_vv) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_pn - double dr_1 = dr2*dr_3; - double dr_2 = dr_1*dr_1; - double dr_4 = dr_2*dr_2; - array drn = {}; - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } - - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_pn[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_tidal_col_load(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_tidal_pn_load(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - } - } -} - -void Force::update_acceleration_tidal_pn_col_load(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_and_torque_load(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_acceleration_and_torque_pn_load(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_acceleration_and_torque_col_load(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_and_torque_pn_col_load(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // Load - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // f - array dr = {}; - array ai = {}; - array aj = {}; - - calculate_nbody_force_load(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_save(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k]; - bj->a[k] += aj[k]; - } - } - } -} - -void Force::update_acceleration_pn_save(vector &bodies, bool use_vv) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_pn - double dr_1 = dr2*dr_3; - double dr_2 = dr_1*dr_1; - double dr_4 = dr_2*dr_2; - array drn = {}; - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } - - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_pn[k]; - } - } - } -} - -void Force::update_acceleration_tidal_save(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - } - } -} - -void Force::update_acceleration_col_save(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k]; - bj->a[k] += aj[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_pn_col_save(vector &bodies, bool use_vv) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_pn - double dr_1 = dr2*dr_3; - double dr_2 = dr_1*dr_1; - double dr_4 = dr_2*dr_2; - array drn = {}; - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } - - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_pn[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_tidal_col_save(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_tidal_pn_save(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - } - } -} - -void Force::update_acceleration_tidal_pn_col_save(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_and_torque_save(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_acceleration_and_torque_pn_save(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_acceleration_and_torque_col_save(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k]; - bj->a[k] += aj[k] + aj_tidal[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_acceleration_and_torque_pn_col_save(vector &bodies, bool use_vv, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->a.fill(0); - b->T.fill(0); - } - - reset_collisions(); - reset_roche(); - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // f - array dr = {}; - double dr2, dr_3; - array ai = {}; - array aj = {}; - - calculate_nbody_force(*bi, *bj, dr, dr2, dr_3, ai, aj); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // f_tidal - array drn = {}; - double dr_1, dr_2, dr_4, dr_5; - array ai_tidal = {}; - array aj_tidal = {}; - array hij = {}; - array hji = {}; - - calculate_tidal_force(*bi, *bj, dr2, dr_3, dr_1, dr_2, dr_4, dr_5, dr, drn, ai_tidal, aj_tidal, hij, hji, use_J); - - // f_pn - double dv2; - array dv = {}; - array ai_pn = {}; - array aj_pn = {}; - - calculate_pn_force(*bi, *bj, dr2, dr_1, dr_2, dr_3, dr_4, dr, drn, dv2, dv, ai_pn, aj_pn, use_vv); - - // Acceleration - for(int k=0; k<3; k++) { - bi->a[k] += ai[k] + ai_tidal[k] + ai_pn[k]; - bj->a[k] += aj[k] + aj_tidal[k] + aj_pn[k]; - } - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - - // Check for collisions - check_for_collisions(*bi, *bj, dr_3, dr2); - - // Check for Roche limit - check_for_roche(*bi, *bj, dr_3, dr2); - } - } -} - -void Force::update_torque(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->T.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // Tidal h function - array dr; - array hij, hji; - - calculate_tidal_h(*bi, *bj, dr, hij, hji, use_J); - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_torque_load(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->T.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - // Tidal h function - array dr; - array hij, hji; - - calculate_tidal_h_load(*bi, *bj, dr, hij, hji, use_J, dr2, dr_3); - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_torque_save(vector &bodies, bool use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->T.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - // Tidal h function - array dr; - array hij, hji; - double dr2, dr_3; - - calculate_tidal_h_save(*bi, *bj, dr, hij, hji, use_J, dr2, dr_3); - - // Save - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - cnt++; - - // Torques - calculate_torque(*bi, *bj, dr, hij, hji); - } - } -} - -void Force::update_tidal_deformation(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->I_e_r.fill(0); - } - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - bool calc_done = false; - - double third, Xi, Xj, dr_4, dr_3; - array Ie_tidal = {}; - array dr = {}; - array drn = {}; - - if(bi->particle_type == 3 && bj->particle_type > 0) { - third = 1./3; - - precalc_sep_vec_norm(*bi, *bj, dr, drn, dr_4, dr_3); - - Ie_tidal[0] = (drn[0]*drn[0]-third); - Ie_tidal[3] = (drn[1]*drn[1]-third); - Ie_tidal[1] = drn[0]*drn[1]; - Ie_tidal[2] = drn[0]*drn[2]; - Ie_tidal[4] = drn[1]*drn[2]; - - calc_done = true; - - Xi = -bj->m*bi->kf_R5*dr_3; - - for(int k=0; k<5; k++) { - bi->I_e_r[k] += Xi*Ie_tidal[k]; - } - } - - if(bj->particle_type == 3 && bi->particle_type > 0) { - if(calc_done == false) { - third = 1./3; - - precalc_sep_vec_norm(*bi, *bj, dr, drn, dr_4, dr_3); - - Ie_tidal[0] = (drn[0]*drn[0]-third); - Ie_tidal[3] = (drn[1]*drn[1]-third); - Ie_tidal[1] = drn[0]*drn[1]; - Ie_tidal[2] = drn[0]*drn[2]; - Ie_tidal[4] = drn[1]*drn[2]; - - calc_done = true; - } - - Xj = -bi->m*bj->kf_R5*dr_3; - - for(int k=0; k<5; k++) { - bj->I_e_r[k] += Xj*Ie_tidal[k]; - } - } - } - } -} - -void Force::update_centrifugal_deformation(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - double w00 = b->w[0]*b->w[0]; - double w11 = b->w[1]*b->w[1]; - double w22 = b->w[2]*b->w[2]; - - double w2 = w00 + w11 + w22; - double w23 = w2/3; - - b->I_e_w[0] = b->kf_R5_3*(w00 - w23); - b->I_e_w[3] = b->kf_R5_3*(w11 - w23); - b->I_e_w[1] = b->kf_R5_3*b->w[0]*b->w[1]; - b->I_e_w[2] = b->kf_R5_3*b->w[0]*b->w[2]; - b->I_e_w[4] = b->kf_R5_3*b->w[1]*b->w[2]; - } - } -} - -void Force::update_equilibrium_tensor(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - for(int i=0; i<5; i++) { - b->I_e[i] = b->I_e_r[i] + b->I_e_w[i]; - } - } - } -} - -void Force::update_equilibrium_tensor_and_memorize(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - for(int i=0; i<5; i++) { - b->I_e_prev[i] = b->I_e[i]; - b->I_e[i] = b->I_e_r[i] + b->I_e_w[i]; - } - } - } -} - -void Force::update_deformation_tensor(vector &bodies, bool use_J) { - if(use_J) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - b->dI_n[0] = 2*b->J_n[2]*b->w[1] - 2*b->J_n[1]*b->w[2] + (b->I_e[0]-b->J_n[0])*b->tau_inv; - b->dI_n[3] = -2*b->J_n[4]*b->w[0] + 2*b->J_n[1]*b->w[2] + (b->I_e[3]-b->J_n[3])*b->tau_inv; - b->dI_n[1] = -b->J_n[2]*b->w[0] + b->J_n[4]*b->w[1] + (b->J_n[0]-b->J_n[3])*b->w[2] + (b->I_e[1]-b->J_n[1])*b->tau_inv; - b->dI_n[2] = b->J_n[1]*b->w[0] - (2*b->J_n[0]+b->J_n[3])*b->w[1] - b->J_n[4]*b->w[2] + (b->I_e[2]-b->J_n[2])*b->tau_inv; - b->dI_n[4] = (b->J_n[0]+2*b->J_n[3])*b->w[0] - b->J_n[1]*b->w[1] + b->J_n[2]*b->w[2] + (b->I_e[4]-b->J_n[4])*b->tau_inv; - } - } - } - else { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - b->dI_n[0] = 2*b->I_n[2]*b->w[1] - 2*b->I_n[1]*b->w[2] + (b->I_e[0]-b->I_n[0])*b->tau_inv; - b->dI_n[3] = -2*b->I_n[4]*b->w[0] + 2*b->I_n[1]*b->w[2] + (b->I_e[3]-b->I_n[3])*b->tau_inv; - b->dI_n[1] = -b->I_n[2]*b->w[0] + b->I_n[4]*b->w[1] + (b->I_n[0]-b->I_n[3])*b->w[2] + (b->I_e[1]-b->I_n[1])*b->tau_inv; - b->dI_n[2] = b->I_n[1]*b->w[0] - (2*b->I_n[0]+b->I_n[3])*b->w[1] - b->I_n[4]*b->w[2] + (b->I_e[2]-b->I_n[2])*b->tau_inv; - b->dI_n[4] = (b->I_n[0]+2*b->I_n[3])*b->w[0] - b->I_n[1]*b->w[1] + b->I_n[2]*b->w[2] + (b->I_e[4]-b->I_n[4])*b->tau_inv; - } - } - } -} - -void Force::update_tidal_deformation_load(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->I_e_r.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - bool calc_done = false; - - double third, Xi, Xj, dr_4; - array Ie_tidal = {}; - array dr = {}; - array drn = {}; - - double dr2 = dr2_vec[cnt]; - double dr_3 = dr_3_vec[cnt]; - cnt++; - - if(bi->particle_type == 3 && bj->particle_type > 0) { - third = 1./3; - - precalc_sep_vec_norm_load(*bi, *bj, dr, drn, dr_4, dr2, dr_3); - - Ie_tidal[0] = (drn[0]*drn[0]-third); - Ie_tidal[3] = (drn[1]*drn[1]-third); - Ie_tidal[1] = drn[0]*drn[1]; - Ie_tidal[2] = drn[0]*drn[2]; - Ie_tidal[4] = drn[1]*drn[2]; - - calc_done = true; - - Xi = -bj->m*bi->kf_R5*dr_3; - - for(int k=0; k<5; k++) { - bi->I_e_r[k] += Xi*Ie_tidal[k]; - } - } - - if(bj->particle_type == 3 && bi->particle_type > 0) { - if(calc_done == false) { - third = 1./3; - - precalc_sep_vec_norm_load(*bi, *bj, dr, drn, dr_4, dr2, dr_3); - - Ie_tidal[0] = (drn[0]*drn[0]-third); - Ie_tidal[3] = (drn[1]*drn[1]-third); - Ie_tidal[1] = drn[0]*drn[1]; - Ie_tidal[2] = drn[0]*drn[2]; - Ie_tidal[4] = drn[1]*drn[2]; - - calc_done = true; - } - - Xj = -bi->m*bj->kf_R5*dr_3; - - for(int k=0; k<5; k++) { - bj->I_e_r[k] += Xj*Ie_tidal[k]; - } - } - } - } -} - -void Force::update_tidal_deformation_save(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->I_e_r.fill(0); - } - - int cnt = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - bool calc_done = false; - - double third, Xi, Xj, dr_4, dr2, dr_3; - array Ie_tidal = {}; - array dr = {}; - array drn = {}; - - if(bi->particle_type == 3 && bj->particle_type > 0) { - third = 1./3; - - precalc_sep_vec_norm_save(*bi, *bj, dr, drn, dr_4, dr2, dr_3); - - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - - Ie_tidal[0] = (drn[0]*drn[0]-third); - Ie_tidal[3] = (drn[1]*drn[1]-third); - Ie_tidal[1] = drn[0]*drn[1]; - Ie_tidal[2] = drn[0]*drn[2]; - Ie_tidal[4] = drn[1]*drn[2]; - - calc_done = true; - - Xi = -bj->m*bi->kf_R5*dr_3; - - for(int k=0; k<5; k++) { - bi->I_e_r[k] += Xi*Ie_tidal[k]; - } - } - - if(bj->particle_type == 3 && bi->particle_type > 0) { - if(calc_done == false) { - third = 1./3; - - precalc_sep_vec_norm_save(*bi, *bj, dr, drn, dr_4, dr2, dr_3); - - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - - Ie_tidal[0] = (drn[0]*drn[0]-third); - Ie_tidal[3] = (drn[1]*drn[1]-third); - Ie_tidal[1] = drn[0]*drn[1]; - Ie_tidal[2] = drn[0]*drn[2]; - Ie_tidal[4] = drn[1]*drn[2]; - - calc_done = true; - } - - Xj = -bi->m*bj->kf_R5*dr_3; - - for(int k=0; k<5; k++) { - bj->I_e_r[k] += Xj*Ie_tidal[k]; - } - } - - if(calc_done == false) { - precalc_sep_vec_norm_save(*bi, *bj, dr, drn, dr_4, dr2, dr_3); - - dr2_vec[cnt] = dr2; - dr_3_vec[cnt] = dr_3; - } - - cnt++; - } - } -} - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Initializer.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Initializer.cpp deleted file mode 100755 index 70bda5546e..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Initializer.cpp +++ /dev/null @@ -1,3112 +0,0 @@ -#include "Initializer.h" - -// Constructor -Initializer::Initializer() { - set_to_default_values(); -} - -void Initializer::set_to_default_values() { - // Simulation parameters - - to_continue = false; // 0=new simulation, 1=continue simulation - max_cpu_time = 0; // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. - - // Physical model parameters - - tidal_model = 4; // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default) - pn_order = 0; // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn - magnetic_braking = 0; // Magnetic braking. 0=off, 1=on - - collisions = 0; // 0=off, 1=flag, 2=exception, 3=replace - roche_limit = 0; // 0=off, 1=flag, 2=exception - breakup_speed = 0; // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception - - // Unit system - - mass_unit = "[Msun]"; // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] - length_unit = "[au]"; // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] - time_unit = "[yr]"; // Unit of time for 1) t_begin, t_end and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] - speed_unit = "[au/yr]"; // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] - - speed_of_light = 0; // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. - - // Initial condition parameters - - file_ic = "tidymess.ic"; // initial condition file - - orbit_coor = 1; // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian - spin_coor = 2; // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit - - initial_shape = 0; // 0=sphere, 1=equilibrium (future, 2=specified in initial condition) - num_body = 0; // 0=all, num_body+1=number of bodies to include - - // Output parameters - - snapshot_mode = 0; // 0=linear interval (default), 1=logarithmic interval, 2=variable interval - n_snapshot = 100; // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) - - output_dir = "data/"; // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. - overwrite = 1; // overwrite existing files: 0=no, 1=yes - - output_format = 0; // 0=file per body, 1=file per snapshot, 2=single file - output_info = 1; // 0=time-varying quantities, 1=all quantities - output_coor = 0; // 0=cartesian inertial - - output_diag = 0; // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' - output_terminal = 1; // Display progress of simulation in terminal window. 0=no, 1=yes - - // Integration parameters - - t_begin = 0; // begin time in units given by time_unit - t_end = 1e2; // final time in units given by time_unit - - dt_mode = 2; // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt - dt_const = 0.015625; // constant time step in units given by time_unit (only used if dt_mode=0) - eta = 0.0625; // accuracy parameter; timestep multiplication factor, default=0.125 (only used if dt_mode>0) - - n_iter = 1; // Number of iterations to improve reversibility (default=1) - - // Program parameters - - file_par = "tidymess.par"; // Name of setup file with parameters. Set to "none" if no setup file is required. - - toSetOutputDir = false; // Boolean for copying output dir from initial condition file - - Units units; - physical_units = true; // boolean for using physical units or N-body units - - Banner banner; - - // Snapshot variables - - N = 0; - data_ic.clear(); - id.clear(); - name.clear(); -} - -double Initializer::get_Cm() { - return units.Cm; -} -double Initializer::get_Cr() { - return units.Cr; -} -double Initializer::get_Cv() { - return units.Cv; -} -double Initializer::get_Ct() { - return units.Ct; -} - -// Readme -void Initializer::display_version() { - banner.print_header(); -} -void Initializer::display_help() { - cout << " " << endl; - display_readme(); - cout << " " << endl; -} -void Initializer::display_readme() { - display_version(); - - cout << "To run TIDYMESS successfully, please make sure to have " << endl; - cout << " 1) a proper initial condition file (e.g. tidymess.ic), and " << endl; - cout << " 2) a valid setup file (e.g. tidymess.par) and/or command line arguments." << endl; - cout << " " << endl; - cout << "Then run ./tidymess.exe, which by default will look for tidymess.par. " << endl; - cout << "User specified parameter files can be used by ./tidymess.exe -f name_of_par_file." << endl; - cout << "The initial condition file is specified in the setup file, or on the command line." << endl; - cout << " " << endl; - cout << "The default output directory is 'data/', but this can be changed by setting the output_dir parameter." << endl; - cout << "When set to '/' or left blank, then a folder will be created with the name of the initial condition file." << endl; - cout << " " << endl; - cout << "For more info, run ./tidymess.exe with the following flags:" << endl; - cout << "--parameters or -p to see the list of simulation parameters." << endl; - cout << "--ic to see an overview of properties to be assigned to the bodies in the initial condition file." << endl; - cout << "--units or -u to see the list of recognized units in TIDYMESS." << endl; - cout << " " << endl; - cout << "Please see the examples folder for TIDYMESS tutorials." << endl; - cout << endl; -} -void Initializer::display_parameters() { - cout << " " << endl; - cout << "Parameters to be specified in the setup file (e.g. tidymess.par)." << endl; - cout << "They can also be set manually in the command line. In that case, add '--' in front and remove '=' (e.g. --t_begin 0)" << endl; - cout << "If a value is defined in both the setup file and command line, then TIDYMESS adopts the command line value." << endl; - cout << "The values below are the default values. " << endl; - cout << " " << endl; - print_arguments_as_setup_file(); - cout << " " << endl; -} -void Initializer::display_units() { - cout << " " << endl; - cout << "The following units are recognized by TIDYMESS, and should be used in the" << endl; - cout << "parameter setup file (e.g. tidymess.par) and initial condition file (e.g. tidymess.ic)." << endl; - cout << " " << endl; - units.print_units(); - cout << " " << endl; -} -void Initializer::display_ic_args() { - cout << " " << endl; - print_initial_condition_args(); - cout << " " << endl; - cout << "Use the -u or --units flag to see the list of recognized units in TIDYMESS." << endl; - cout << " " << endl; -} - -// Argument parser -void Initializer::parse_arguments(int argc, char* argv[]) { - // Convert command line arguments to strings - vector args(argv+1, argv+argc); - argc = args.size(); - - // Check for support flags - if(argc > 0) { - for(int i=0; i > setup_line = read_file(file_par); - - vector args_f; - int numLine = setup_line.size(); - for(int i=0; i= 3 && setup_line[i][1] == "=") { - args_f.push_back("--"+setup_line[i][0]); - args_f.push_back(setup_line[i][2]); - } - } - int argc_f = args_f.size(); - - bool valid_setup_file_args = validate_setup_file_args(argc_f, args_f); - if(!valid_setup_file_args) { - exit(1); - } - - // Process setup file arguments - process_args(argc_f, args_f); - } - - // Override setup file args with command line args - process_args(argc, args); - - // Extract initial condition file name without extension and paths - string f1 = file_ic; - string f2 = ""; - - int N_str = f1.length(); - for(int k=0; k > data = read_file(file_ic); - - vector var, unit; - int numLine = data.size(); - for(int i=0; i= 2) { - int num_tau = check_var(data, var, unit, numLine, "tau"); - if(num_tau == 0) { - exit(1); - } - else if(num_tau != N) { - cerr << "Missing data in the initial condition table: tau" << endl; - exit(1); - } - } - - if(collisions > 0 || roche_limit > 0 || breakup_speed > 0) { - int num_R = check_var(data, var, unit, numLine, "R"); - if(num_R == 0) { - exit(1); - } - else if(num_R != N) { - cerr << "Missing data in the initial condition table: R" << endl; - exit(1); - } - } - - if(magnetic_braking == 1) { - int num_a_mb = check_var(data, var, unit, numLine, "a_mb"); - if(num_a_mb == 0) { - exit(1); - } - else if(num_a_mb != N) { - cerr << "Missing data in the initial condition table: a_mb" << endl; - exit(1); - } - } - - // Validate Post-Newtonian parameters - if(pn_order > 0) { - if(physical_units) { - speed_of_light = 299792.458; // c = 299792.458 km/s - speed_of_light = units.convert_speed_to_standard(speed_of_light, "[km/s]"); - } - else { - if(speed_of_light == 0) { - speed_of_light = 1e100; - } - } - } - - // Validate units - bool valid_units = validate_units_internal_properties(var, unit); - if(!valid_units) { - exit(1); - } - - if(orbit_coor == 0) { // Cartesian coordinates - valid_units = validate_units_orbital_cartesian(var, unit); - if(!valid_units) { - exit(1); - } - } - else { // Elliptical coordinates - valid_units = validate_units_orbital_elliptical(var, unit); - if(!valid_units) { - exit(1); - } - } - - // If spin properties are specified in the initial conditions, validate them. - // If no spin properties are specified, TIDYMESS assumes no initial spin. - bool valid_spin = validate_initial_condition_spin(data, var, unit, numLine); - if(!valid_spin) { - exit(1); - } - - // Make sure simulation time is not zero - double t_sim = t_end - t_begin; - if(t_sim == 0) { - cerr << "t_begin = " << t_begin << endl; - cerr << "t_end = " << t_end << endl; - cerr << "Please set the end time to a different value than the begin time." << endl; - exit(1); - } - - // Set units of time integration parameters - t_begin = units.convert_time_to_standard(t_begin, time_unit); - t_end = units.convert_time_to_standard(t_end, time_unit); - dt_const = units.convert_time_to_standard(dt_const, time_unit); - - // Process initial conditions and store in data_ic container - data_ic.clear(); - for(int i=0; i dd = {}; - data_ic.push_back(dd); - } - - // Upload internal properties in standard units - for(int i=0; i 0) { - for(int i=0; i= 1+num_body) { - data_ic.erase (data_ic.begin()+N-1-i); - } - } - N = data_ic.size(); - - // move to center - move_to_center(); - } -} -bool Initializer::validate_command_line_args(int argc, vector &args) { - vector arg_validated(argc, false); - - for(int i=0; i 1) { - if(str.at(0) == '-' && str.at(1) == '-') { - str.erase(str.begin()+0, str.begin()+2); - bool isValid = check_valid_argument(str); - if(!isValid) { - cerr << " " << endl; - cerr << "Unrecognized command line argument: " << args[i] << endl; - cerr << " " << endl; - return false; - } - arg_validated[i] = true; - - if(i+1 < argc) { - string str_val = args[i+1]; - isValid = check_valid_value(str, str_val); - if(!isValid) { - cerr << " " << endl; - cerr << "Invalid command line value: " << args[i] << " " << args[i+1] << endl; - cerr << " " << endl; - return false; - } - arg_validated[i+1] = true; - } - else { - if(str == "output_dir") { - ; - } - else { - cerr << " " << endl; - cerr << "Please specify a value after: " << args[i] << endl; - cerr << " " << endl; - return false; - } - } - } - else if(str == "-f") { - str.erase(str.begin()+0, str.begin()+1); - bool isValid = check_valid_argument(str); - if(!isValid) { - cerr << " " << endl; - cerr << "Unrecognized command line argument: " << args[i] << endl; - cerr << " " << endl; - return false; - } - arg_validated[i] = true; - - if(i+1 < argc) { - string str_val = args[i+1]; - isValid = check_valid_value(str, str_val); - if(!isValid) { - cerr << " " << endl; - cerr << "Invalid command line value: " << args[i] << " " << args[i+1] << endl; - cerr << " " << endl; - return false; - } - arg_validated[i+1] = true; - } - else { - cerr << " " << endl; - cerr << "Please specify a value after: " << args[i] << endl; - cerr << " " << endl; - return false; - } - } - } - } - - for(int i=0; i &args) { - vector arg_validated(argc, false); - - bool ignoring = false; - - for(int i=0; i 1) { - if(str.at(0) == '-' && str.at(1) == '-') { - str.erase(str.begin()+0, str.begin()+2); - bool isValid = check_valid_argument(str); - if(!isValid) { - cerr << " " << endl; - cerr << "Warning: ignoring line in parameter setup file starting with: " << str << endl; - ignoring = true; - } - else { - if(i+1 < argc) { - string str_val = args[i+1]; - isValid = check_valid_value(str, str_val); - if(!isValid) { - cerr << " " << endl; - cerr << "Invalid value in parameter setup file: " << args[i] << " " << args[i+1] << endl; - cerr << " " << endl; - return false; - } - arg_validated[i+1] = true; - } - else { - if(str == "output_dir") { - ; - } - else { - cerr << " " << endl; - cerr << "Please specify a value after: " << args[i] << endl; - cerr << " " << endl; - return false; - } - } - - } - arg_validated[i] = true; - } - } - } - - if(ignoring) cerr << " " << endl; - - return true; -} -bool Initializer::check_valid_argument(string &str) { - if(str == "to_continue") { - return true; - } - else if(str == "max_cpu_time") { - return true; - } - else if(str == "file_par" || str == "f") { - return true; - } - else if(str == "file_ic") { - return true; - } - else if(str == "orbit_coor") { - return true; - } - else if(str == "num_body") { - return true; - } - else if(str == "output_format") { - return true; - } - else if(str == "output_info") { - return true; - } - else if(str == "output_coor") { - return true; - } - else if(str == "output_dir") { - return true; - } - else if(str == "overwrite") { - return true; - } - else if(str == "output_diag") { - return true; - } - else if(str == "output_terminal") { - return true; - } - else if(str == "mass_unit") { - return true; - } - else if(str == "length_unit") { - return true; - } - else if(str == "time_unit") { - return true; - } - else if(str == "speed_unit") { - return true; - } - else if(str == "t_begin") { - return true; - } - else if(str == "t_end") { - return true; - } - else if(str == "dt_mode") { - return true; - } - else if(str == "dt_const") { - return true; - } - else if(str == "eta") { - return true; - } - else if(str == "snapshot_mode") { - return true; - } - else if(str == "n_snapshot") { - return true; - } - else if(str == "tidal_model") { - return true; - } - else if(str == "initial_shape") { - return true; - } - else if(str == "spin_coor") { - return true; - } - else if(str == "pn_order") { - return true; - } - else if(str == "speed_of_light") { - return true; - } - else if(str == "B_braking") { - return true; - } - else if(str == "collisions") { - return true; - } - else if(str == "roche_limit") { - return true; - } - else if(str == "breakup_speed") { - return true; - } - else if(str == "n_iter") { - return true; - } - return false; -} -bool Initializer::check_valid_value(string &str, string &str_val) { - if(str == "to_continue") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "max_cpu_time") { - try { - size_t offset = 0; - double t = stod(str_val, &offset); - if(offset == str_val.length()) { - if(t >= 0) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "file_par" || str == "f") { - //string f = str_val; - //if(f == "none" || f == "None") return true; - //else { - // bool f_exist = check_file_exists(f); - // if(f_exist) return true; - // else { - //cerr << "Cannot open " << f << "!" << endl; - //return false; - // } - //} - return true; - } - else if(str == "file_ic") { - string f = str_val; - //bool f_exist = check_file_exists(f); - //if(f_exist) return true; - //else { - //cerr << "Cannot open " << f << "!" << endl; - //return false; - //} - return true; - } - else if(str == "orbit_coor") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "num_body") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - if(num >= 0) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "output_format") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "output_info") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "output_coor") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "output_dir") { - return true; - } - else if(str == "overwrite") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "output_diag") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "output_terminal") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "mass_unit") { - string u = str_val; - bool valid_u = units.validate_mass_unit(u); - if(valid_u) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "length_unit") { - string u = str_val; - bool valid_u = units.validate_length_unit(u); - if(valid_u) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "time_unit") { - string u = str_val; - bool valid_u = units.validate_time_unit(u); - if(valid_u) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "speed_unit") { - string u = str_val; - bool valid_u = units.validate_speed_unit(u); - if(valid_u) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "t_begin") { - try { - size_t offset = 0; - double t = stod(str_val, &offset); - if(offset == str_val.length()) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "t_end") { - try { - size_t offset = 0; - double t = stod(str_val, &offset); - if(offset == str_val.length()) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "dt_mode") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "dt_const") { - try { - size_t offset = 0; - double t = stod(str_val, &offset); - if(offset == str_val.length()) { - if(t > 0) return true; - else { - if(dt_mode > 0) return true; - else cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "eta") { - try { - size_t offset = 0; - double t = stod(str_val, &offset); - if(offset == str_val.length()) { - if(t > 0) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "snapshot_mode") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "n_snapshot") { - try { - size_t offset = 0; - - double numd = stod(str_val, &offset); - int num = (int)numd; - - if(offset == str_val.length()) { - if(num > 0) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "tidal_model") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - case 3: - return true; - case 4: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "initial_shape") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "spin_coor") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "pn_order") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - case 25: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "speed_of_light") { - try { - size_t offset = 0; - double t = stod(str_val, &offset); - if(offset == str_val.length()) { - if(t >= 0) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - - } - else if(str == "B_braking") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "collisions") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - case 3: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "roche_limit") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "breakup_speed") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - switch(num) { - case 0: - return true; - case 1: - return true; - case 2: - return true; - default: - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else if(str == "n_iter") { - try { - size_t offset = 0; - int num = stoi(str_val, &offset); - if(offset == str_val.length()) { - if(num >= 0) return true; - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - else { - cerr << "Please specify a valid value after: " << str << endl; - } - } - catch(exception &e) { - cerr << "Please specify a valid value after: " << str << endl; - } - } - - cerr << "Type \"./tidymess.exe -p\" or \"./tidymess.exe --parameters\" for an overview of input parameters and values" << endl; - return false; -} -void Initializer::process_args(int argc, vector &args) { - for(int i=0; i 1) { - if(str.at(0) == '-' && str.at(1) == '-') { - str.erase(str.begin()+0, str.begin()+2); - if(str == "to_continue") { - to_continue = stoi(args[i+1]); - } - else if(str == "max_cpu_time") { - max_cpu_time = stod(args[i+1]); - } - else if(str == "file_ic") { - file_ic = args[i+1]; - } - else if(str == "orbit_coor") { - orbit_coor = stoi(args[i+1]); - } - else if(str == "num_body") { - num_body = stoi(args[i+1]); - } - else if(str == "output_format") { - output_format = stoi(args[i+1]); - } - else if(str == "output_info") { - output_info = stoi(args[i+1]); - } - else if(str == "output_coor") { - output_coor = stoi(args[i+1]); - } - else if(str == "output_dir") { - if(i+1 < argc) { - string dir = args[i+1]; - - if(dir == "/" || dir == "//") { - output_dir = ""; - toSetOutputDir = true; - } - else if(dir.at(0) == '-') { - output_dir = ""; - toSetOutputDir = true; - } - else { - output_dir = dir; - toSetOutputDir = false; - } - } - else { - output_dir = ""; - toSetOutputDir = true; - } - } - else if(str == "overwrite") { - overwrite = stoi(args[i+1]); - } - else if(str == "output_diag") { - output_diag = stoi(args[i+1]); - } - else if(str == "output_terminal") { - output_terminal = stoi(args[i+1]); - } - else if(str == "mass_unit") { - mass_unit = args[i+1]; - } - else if(str == "length_unit") { - length_unit = args[i+1]; - } - else if(str == "time_unit") { - time_unit = args[i+1]; - } - else if(str == "speed_unit") { - speed_unit = args[i+1]; - } - else if(str == "t_begin") { - t_begin = stod(args[i+1]); - } - else if(str == "t_end") { - t_end = stod(args[i+1]); - } - else if(str == "dt_mode") { - dt_mode = stoi(args[i+1]); - } - else if(str == "dt_const") { - dt_const = stod(args[i+1]); - } - else if(str == "eta") { - eta = stod(args[i+1]); - } - else if(str == "snapshot_mode") { - snapshot_mode = stoi(args[i+1]); - } - else if(str == "n_snapshot") { - double numd = stod(args[i+1]); - int num = (int)numd; - n_snapshot = num; - } - else if(str == "tidal_model") { - tidal_model = stoi(args[i+1]); - } - else if(str == "initial_shape") { - initial_shape = stoi(args[i+1]); - } - else if(str == "spin_coor") { - spin_coor = stoi(args[i+1]); - } - else if(str == "pn_order") { - pn_order = stoi(args[i+1]); - } - else if(str == "speed_of_light") { - speed_of_light = stod(args[i+1]); - } - else if(str == "B_braking") { - magnetic_braking = stoi(args[i+1]); - } - else if(str == "collisions") { - collisions = stoi(args[i+1]); - } - else if(str == "roche_limit") { - roche_limit = stoi(args[i+1]); - } - else if(str == "breakup_speed") { - breakup_speed = stoi(args[i+1]); - } - else if(str == "n_iter") { - n_iter = stoi(args[i+1]); - } - } - } - } -} - -void Initializer::print_arguments_as_setup_file() { - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "// Simulation parameters" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "" << endl; - cout << "to_continue\t= " << to_continue << "\t\t// 0=new simulation, 1=continue simulation" << endl; - cout << "max_cpu_time\t= " << max_cpu_time << "\t\t// Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit." << endl; - cout << "" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "// Physical model parameters" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "" << endl; - cout << "tidal_model\t= " << tidal_model << "\t\t// 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default)" << endl; - cout << "pn_order\t= " << pn_order << "\t\t// Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn" << endl; - cout << "B_braking\t= " << magnetic_braking << "\t\t// Magnetic braking. 0=off, 1=on" << endl; - cout << "" << endl; - cout << "collisions\t= " << collisions << "\t\t// 0=off, 1=flag, 2=exception, 3=replace" << endl; - cout << "roche_limit\t= " << roche_limit << "\t\t// 0=off, 1=flag, 2=exception" << endl; - cout << "breakup_speed\t= " << breakup_speed << "\t\t// Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception" << endl; - cout << "" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "// Unit system" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "" << endl; - cout << "mass_unit\t= " << mass_unit << "\t// Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun]" << endl; - cout << "length_unit\t= " << length_unit << "\t\t// Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc]" << endl; - cout << "time_unit\t= " << time_unit << "\t\t// Unit of time for 1) t_begin, t_end and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr]" << endl; - cout << "speed_unit\t= " << speed_unit << "\t// Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr]" << endl; - cout << "" << endl; - cout << "speed_of_light\t= " << speed_of_light << "\t\t// Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c." << endl; - cout << "" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "// Initial condition parameters" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "" << endl; - cout << "file_ic\t = " << file_ic << "\t// initial condition file" << endl; - cout << "" << endl; - cout << "orbit_coor\t= " << orbit_coor << "\t\t// 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian" << endl; - cout << "spin_coor\t= " << spin_coor << "\t\t// 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit" << endl; - cout << "" << endl; - cout << "initial_shape\t= " << initial_shape << "\t\t// 0=sphere, 1=equilibrium" << endl; - cout << "num_body\t= " << num_body << "\t\t// 0=all, num_body+1=number of bodies to include" << endl; - cout << "" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "// Output parameters" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "" << endl; - cout << "snapshot_mode\t = " << snapshot_mode << "\t\t// 0=linear interval (default), 1=logarithmic interval, 2=variable interval" << endl; - cout << "n_snapshot\t = " << n_snapshot << "\t\t// Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable)" << endl; - cout << "" << endl; - cout << "output_dir\t= " << output_dir << "\t\t// Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension." << endl; - cout << "overwrite\t= " << overwrite << "\t\t// overwrite existing files: 0=no, 1=yes" << endl; - cout << "" << endl; - cout << "output_format\t= " << output_format << "\t\t// 0=file per body, 1=file per snapshot, 2=single file" << endl; - cout << "output_info\t= " << output_info << "\t\t// 0=time-varying quantities, 1=all quantities" << endl; - cout << "output_coor\t= " << output_coor << "\t\t// 0=cartesian inertial" << endl; - cout << "" << endl; - cout << "output_diag\t= " << output_diag << "\t\t// 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag'" << endl; - cout << "output_terminal\t= " << output_terminal << "\t\t// Display progress of simulation in terminal window. 0=no, 1=yes" << endl; - cout << "" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "// Integration parameters" << endl; - cout << "//--------------------------------------------------------------------------------------------------" << endl; - cout << "" << endl; - cout << "t_begin\t = " << t_begin << "\t\t// begin time in units given by time_unit" << endl; - cout << "t_end\t\t= " << t_end << "\t\t// final time in units given by time_unit" << endl; - cout << "" << endl; - cout << "dt_mode\t\t= " << dt_mode << "\t\t// 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt" << endl; - cout << "dt_const\t= " << dt_const << "\t// constant time step in units given by time_unit (only used if dt_mode=0)" << endl; - cout << "eta\t\t= " << eta << "\t\t// accuracy parameter; timestep multiplication factor, default=0.125 (only used if dt_mode>0)" << endl; - cout << "" << endl; - cout << "n_iter\t\t= " << n_iter << "\t\t// Number of iterations to improve reversibility (default=1)" << endl; -} -void Initializer::print_arguments_as_setup_file(ofstream &fo) { - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "// Simulation parameters" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "" << endl; - fo << "to_continue\t= " << to_continue << "\t\t// 0=new simulation, 1=continue simulation" << endl; - fo << "max_cpu_time\t= " << max_cpu_time << "\t\t// Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit." << endl; - fo << "" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "// Physical model parameters" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "" << endl; - fo << "tidal_model\t= " << tidal_model << "\t\t// 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default)" << endl; - fo << "pn_order\t= " << pn_order << "\t\t// Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn" << endl; - fo << "B_braking\t= " << magnetic_braking << "\t\t// Magnetic braking. 0=off, 1=on" << endl; - fo << "" << endl; - fo << "collisions\t= " << collisions << "\t\t// 0=off, 1=flag, 2=exception, 3=replace" << endl; - fo << "roche_limit\t= " << roche_limit << "\t\t// 0=off, 1=flag, 2=exception" << endl; - fo << "breakup_speed\t= " << breakup_speed << "\t\t// Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception" << endl; - fo << "" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "// Unit system" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "" << endl; - fo << "mass_unit\t= " << mass_unit << "\t// Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun]" << endl; - fo << "length_unit\t= " << length_unit << "\t\t// Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc]" << endl; - fo << "time_unit\t= " << time_unit << "\t\t// Unit of time for 1) t_begin, t_end and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr]" << endl; - fo << "speed_unit\t= " << speed_unit << "\t// Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr]" << endl; - fo << "" << endl; - fo << "speed_of_light\t= " << speed_of_light << "\t\t// Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c." << endl; - fo << "" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "// Initial condition parameters" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "" << endl; - fo << "file_ic\t = " << file_ic << "\t// initial condition file" << endl; - fo << "" << endl; - fo << "orbit_coor\t= " << orbit_coor << "\t\t// 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian" << endl; - fo << "spin_coor\t= " << spin_coor << "\t\t// 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit" << endl; - fo << "" << endl; - fo << "initial_shape\t= " << initial_shape << "\t\t// 0=sphere, 1=equilibrium" << endl; - fo << "num_body\t= " << num_body << "\t\t// 0=all, num_body+1=number of bodies to include" << endl; - fo << "" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "// Output parameters" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "" << endl; - fo << "snapshot_mode\t = " << snapshot_mode << "\t\t// 0=linear interval (default), 1=logarithmic interval, 2=variable interval" << endl; - fo << "n_snapshot\t = " << n_snapshot << "\t\t// Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable)" << endl; - fo << "" << endl; - fo << "output_dir\t= " << output_dir << "\t\t// Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension." << endl; - fo << "overwrite\t= " << overwrite << "\t\t// overwrite existing files: 0=no, 1=yes" << endl; - fo << "" << endl; - fo << "output_format\t= " << output_format << "\t\t// 0=file per body, 1=file per snapshot, 2=single file" << endl; - fo << "output_info\t= " << output_info << "\t\t// 0=time-varying quantities, 1=all quantities" << endl; - fo << "output_coor\t= " << output_coor << "\t\t// 0=cartesian inertial" << endl; - fo << "" << endl; - fo << "output_diag\t= " << output_diag << "\t\t// 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag'" << endl; - fo << "output_terminal\t= " << output_terminal << "\t\t// Display progress of simulation in terminal window. 0=no, 1=yes" << endl; - fo << "" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "// Integration parameters" << endl; - fo << "//--------------------------------------------------------------------------------------------------" << endl; - fo << "" << endl; - fo << "t_begin\t = " << t_begin << "\t\t// begin time in units given by time_unit" << endl; - fo << "t_end\t\t= " << t_end << "\t\t// final time in units given by time_unit" << endl; - fo << "" << endl; - fo << "dt_mode\t\t= " << dt_mode << "\t\t// 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt" << endl; - fo << "dt_const\t= " << dt_const << "\t// constant time step in units given by time_unit (only used if dt_mode=0)" << endl; - fo << "eta\t\t= " << eta << "\t\t// accuracy parameter; timestep multiplication factor, default=0.125 (only used if dt_mode>0)" << endl; - fo << "" << endl; - fo << "n_iter\t\t= " << n_iter << "\t\t// Number of iterations to improve reversibility (default=1)" << endl; -} -void Initializer::print_initial_condition_args() { - cout << "Overview of properties to be assigned to the bodies in the initial condition file:" << endl; - cout << " " << endl; - cout << "- Internal properties" << endl; - cout << "mass = mass" << endl; - cout << "R = radius" << endl; - cout << "xi = moment of inertia factor" << endl; - cout << " " << endl; - cout << "- Tidal response parameters" << endl; - cout << "kf = Fluid Love number for potential" << endl; - cout << "tau = Fluid relaxation time" << endl; - cout << " " << endl; - cout << "- Other physics" << endl; - cout << "a_mb = magnetic braking coefficient" << endl; - cout << " " << endl; - cout << "- Spin coordinates" << endl; - cout << "lod = length of day" << endl; - cout << "obl = obliquity" << endl; - cout << "psi = precession angle" << endl; - cout << " " << endl; - cout << "- Orbital coordinates: Cartesian " << endl; - cout << "x = position along x-axis" << endl; - cout << "y = position along y-axis " << endl; - cout << "z = position along z-axis " << endl; - cout << "vx = velocity along x-axis " << endl; - cout << "vy = velocity along y-axis " << endl; - cout << "vz = velocity along z-axis " << endl; - cout << " " << endl; - cout << "- Orbital coordinates: Elliptical " << endl; - cout << "a = semimajor axis" << endl; - cout << "e = eccentricity" << endl; - cout << "I = inclination" << endl; - cout << "O = longitude of ascending node" << endl; - cout << "w = argument of pericenter" << endl; - cout << "M = mean anomaly" << endl; -} - -int Initializer::check_var(vector< vector > &data, vector &var, vector &unit, int numLine, string x) { - int num_x = 0; - bool found_x = false; - for(int i=0; i > &data, vector &var, vector &unit, int numLine) { - int num_x = check_var(data, var, unit, numLine, "x"); - if(num_x == 0) { - return false; - } - else if(num_x != N) { - cerr << "Inconsistency in the initial condition table: x" << endl; - return false; - } - - int num_y = check_var(data, var, unit, numLine, "y"); - if(num_y == 0) { - return false; - } - else if(num_y != N) { - cerr << "Inconsistency in the initial condition table: y" << endl; - return false; - } - - int num_z = check_var(data, var, unit, numLine, "z"); - if(num_z == 0) { - return false; - } - else if(num_z != N) { - cerr << "Inconsistency in the initial condition table: z" << endl; - return false; - } - - int num_vx = check_var(data, var, unit, numLine, "vx"); - if(num_vx == 0) { - return false; - } - else if(num_vx != N) { - cerr << "Inconsistency in the initial condition table: vx" << endl; - return false; - } - - int num_vy = check_var(data, var, unit, numLine, "vy"); - if(num_vy == 0) { - return false; - } - else if(num_vy != N) { - cerr << "Inconsistency in the initial condition table: vy" << endl; - return false; - } - - int num_vz = check_var(data, var, unit, numLine, "vz"); - if(num_vz == 0) { - return false; - } - else if(num_vz != N) { - cerr << "Inconsistency in the initial condition table: vz" << endl; - return false; - } - - return true; -} -bool Initializer::validate_initial_condition_elliptical(vector< vector > &data, vector &var, vector &unit, int numLine) { - int num_a = check_var(data, var, unit, numLine, "a"); - if(num_a == 0) { - return false; - } - else if(num_a != N-1) { - cerr << "Inconsistency in the initial condition table: a" << endl; - return false; - } - - int num_e = check_var(data, var, unit, numLine, "e"); - if(num_e == 0) { - return false; - } - else if(num_e != N-1) { - cerr << "Inconsistency in the initial condition table: e" << endl; - return false; - } - - int num_I = check_var(data, var, unit, numLine, "I"); - if(num_I == 0) { - return false; - } - else if(num_I != N-1) { - cerr << "Inconsistency in the initial condition table: I" << endl; - return false; - } - - int num_O = check_var(data, var, unit, numLine, "O"); - if(num_O == 0) { - return false; - } - else if(num_O != N-1) { - cerr << "Inconsistency in the initial condition table: O" << endl; - return false; - } - - int num_w = check_var(data, var, unit, numLine, "w"); - if(num_w == 0) { - return false; - } - else if(num_w != N-1) { - cerr << "Inconsistency in the initial condition table: w" << endl; - return false; - } - - int num_M = check_var(data, var, unit, numLine, "M"); - if(num_M == 0) { - return false; - } - else if(num_M != N-1) { - cerr << "Inconsistency in the initial condition table: M" << endl; - return false; - } - - return true; -} -bool Initializer::validate_initial_condition_spin(vector< vector > &data, vector &var, vector &unit, int numLine) { - int num_lod = 0; - bool found_lod = false; - for(int i=0; i &var, vector &unit) { - int numLine = var.size(); - - for(int i=0; i &var, vector &unit) { - int numLine = var.size(); - - for(int i=0; i &var, vector &unit) { - int numLine = var.size(); - - vector rs; - rs.push_back("x"); - rs.push_back("y"); - rs.push_back("z"); - - for(int k=0; k<3; k++) { - for(int i=0; i vs; - vs.push_back("vx"); - vs.push_back("vy"); - vs.push_back("vz"); - - for(int k=0; k<3; k++) { - for(int i=0; i &var, vector &unit) { - int numLine = var.size(); - - for(int i=0; i angles; - angles.push_back("I"); - angles.push_back("O"); - angles.push_back("w"); - angles.push_back("M"); - - for(int k=0; k<4; k++) { - for(int i=0; i &var, vector &unit) { - int numLine = var.size(); - - for(int i=0; i angles; - angles.push_back("obl"); - angles.push_back("psi"); - - for(int k=0; k<2; k++) { - for(int i=0; i Initializer::get_words(string line) { - istringstream iss(line); - vector results; - copy(istream_iterator(iss), istream_iterator(), back_inserter(results)); - return results; -} -vector< vector > Initializer::read_file(string file_in) { - // Check if regular file - bool file_exist = check_file_exists(file_in); - if(!file_exist) { - exit(1); - } - - // Read file - vector< vector > data; - - ifstream str; - str.open(file_in.c_str()); - if(!str) { - cerr << "Cannot open " << file_in << "!" << endl; - exit(1); - } - else { - string line; - while(!str.eof()) { - getline(str, line); - vector words = get_words(line); - if(words.size() > 0) { - data.push_back(words); - } - } - str.close(); - } - - return data; -} - -// Coordinate transformation functions - -vector Initializer::rotZrotX(double anglez, double anglex, vector vin) { - double sz = sin(anglez); - double sx = sin(anglex); - double cz = cos(anglez); - double cx = cos(anglex); - - double rin = cx*vin[1]-sx*vin[2]; - - vector vec(3); - vec[0] = cz*vin[0]-sz*rin; - vec[1] = sz*vin[0]+cz*rin; - vec[2] = sx*vin[1]+cx*vin[2]; - - return vec; -} - -void Initializer::convert_spin_vectors_to_inertial() { - for(int i=0; i w_vec(3); - w_vec[0] = 0; - w_vec[1] = 0; - w_vec[2] = wmag; - - w_vec = rotZrotX(psi, obl, w_vec); - - data_ic[i][6] = w_vec[0]; - data_ic[i][7] = w_vec[1]; - data_ic[i][8] = w_vec[2]; - } - } -} -void Initializer::convert_spin_vectors_from_elliptical_body0abs() { - double P = data_ic[0][6]; - double obl = data_ic[0][7]; - double psi = data_ic[0][8]; - - if(P == 0) { - data_ic[0][6] = 0.; - data_ic[0][7] = 0.; - data_ic[0][8] = 0.; - } - else if(P < 0) { - cerr << " " << endl; - cerr << "Negative length of day detected: " << data_ic[0][6] << endl; - cerr << " " << endl; - exit(1); - } - else { - double wmag = 2*M_PI/P; - - vector spinvec(3); - spinvec[0] = 0; - spinvec[1] = 0; - spinvec[2] = wmag; - - vector spinvec3 = rotZrotX(psi, obl, spinvec); - - for(int k=0; k<3; k++) { - data_ic[0][6+k] = spinvec3[k]; - } - } - - for(int i=1; i spinvec(3); - spinvec[0] = 0; - spinvec[1] = 0; - spinvec[2] = wmag; - - double inc = data_ic[i][11]; - double O = data_ic[i][12]; - - vector spinvec2 = rotZrotX(psi-O, obl, spinvec); - vector spinvec3 = rotZrotX(O, inc, spinvec2); - - for(int k=0; k<3; k++) { - data_ic[i][6+k] = spinvec3[k]; - } - } - } -} -void Initializer::convert_spin_vectors_from_elliptical_body0rel() { - double P = data_ic[0][6]; - double obl = data_ic[0][7]; - double psi = data_ic[0][8]; - - double inc = data_ic[1][11]; - double O = data_ic[1][12]; - - if(P == 0) { - data_ic[0][6] = 0.; - data_ic[0][7] = 0.; - data_ic[0][8] = 0.; - } - else if(P < 0) { - cerr << " " << endl; - cerr << "Negative length of day detected: " << data_ic[0][6] << endl; - cerr << " " << endl; - exit(1); - } - else { - double wmag = 2*M_PI/P; - - vector spinvec(3); - spinvec[0] = 0; - spinvec[1] = 0; - spinvec[2] = wmag; - - vector spinvec2 = rotZrotX(psi-O, obl, spinvec); - vector spinvec3 = rotZrotX(O, inc, spinvec2); - - for(int k=0; k<3; k++) { - data_ic[0][6+k] = spinvec3[k]; - } - } - - for(int i=1; i spinvec(3); - spinvec[0] = 0; - spinvec[1] = 0; - spinvec[2] = wmag; - - inc = data_ic[i][11]; - O = data_ic[i][12]; - - vector spinvec2 = rotZrotX(psi-O, obl, spinvec); - vector spinvec3 = rotZrotX(O, inc, spinvec2); - - for(int k=0; k<3; k++) { - data_ic[i][6+k] = spinvec3[k]; - } - } - } -} - -double Initializer::mean_to_eccentric_anomaly(double MA, double e) { - double delta = 1e-14; - - int maxIter = 10000; - int cntIter = 0; - - double EA = MA; - double diff = 1.; - - if(e > 0.4) { - while(diff > delta && cntIter < maxIter) { - double EA0 = EA; - EA = EA0 + (MA + e*sin(EA0) - EA0) / (1. - e*cos(EA0)); - diff = abs(EA-EA0); - cntIter += 1; - } - } - else { - while(diff > delta && cntIter < maxIter) { - double EA0 = EA; - EA = MA + e*sin(EA0); - diff = abs(EA-EA0); - cntIter += 1; - } - } - - return EA; -} -double Initializer::eccentric_to_true_anomaly(double EA, double e) { - double TA = 2. * atan2(sqrt(1.+e)*sin(EA/2.), sqrt(1.-e)*cos(EA/2.)); - return TA; -} -double Initializer::convert_mean_to_true_anomaly(double MA, double ecc) { - double EA = mean_to_eccentric_anomaly(MA, ecc); - double TA = eccentric_to_true_anomaly(EA, ecc); - if(TA < 0) TA += 2*M_PI; - else if(TA >= 2*M_PI) TA -= 2*M_PI; - return TA; -} - -// This implementation is based on orbital_elements.py from the -// AMUSE software framework ( https://amusecode.github.io/ ). -vector Initializer::get_relative_posvel_from_orbital_elements(double m1, double m2, double a, double ecc, double inc, double O, double w, double TA, double G) { - double cos_TA = cos(TA); - double sin_TA = sin(TA); - - double cos_inc = cos(inc); - double sin_inc = sin(inc); - - double cos_w = cos(w); - double sin_w = sin(w); - - double cos_O = cos(O); - double sin_O = sin(O); - - // alpha is a unit vector directed along the line of node - vector alpha(3); - alpha[0] = ( cos_O*cos_w - sin_O*sin_w*cos_inc ); - alpha[1] = ( sin_O*cos_w + cos_O*sin_w*cos_inc ); - alpha[2] = sin_w*sin_inc; - - // beta is a unit vector perpendicular to alpha and the orbital angular momentum vector - vector beta(3); - beta[0] = ( - cos_O*sin_w - sin_O*cos_w*cos_inc ); - beta[1] = ( - sin_O*sin_w + cos_O*cos_w*cos_inc ); - beta[2] = cos_w*sin_inc; - - // Relative position and velocity - double r = a*(1. - ecc*ecc) / (1. + ecc*cos_TA); - - vector dr(3); - dr[0] = r*cos_TA*alpha[0] + r*sin_TA*beta[0]; - dr[1] = r*cos_TA*alpha[1] + r*sin_TA*beta[1]; - dr[2] = r*cos_TA*alpha[2] + r*sin_TA*beta[2]; - - double mu = G*(m1 + m2); - - double dv_aux = 0; - if(a != 0) { - dv_aux = sqrt( mu / (a*(1. - ecc*ecc)) ); - } - - vector dv(3); - dv[0] = -1. * dv_aux * sin_TA * alpha[0] + dv_aux*(ecc + cos_TA)*beta[0]; - dv[1] = -1. * dv_aux * sin_TA * alpha[1] + dv_aux*(ecc + cos_TA)*beta[1]; - dv[2] = -1. * dv_aux * sin_TA * alpha[2] + dv_aux*(ecc + cos_TA)*beta[2]; - - vector posvel(6); - posvel[0] = dr[0]; - posvel[1] = dr[1]; - posvel[2] = dr[2]; - posvel[3] = dv[0]; - posvel[4] = dv[1]; - posvel[5] = dv[2]; - - return posvel; -} -void Initializer::move_to_center() { - double M = 0; - vector rcm(3,0); - vector vcm(3,0); - for(int i=0; i rcm(3,0); - vector vcm(3,0); - for(int i=0; i posvel = get_relative_posvel_from_orbital_elements(data_ic[0][0], data_ic[i][0], data_ic[i][9], data_ic[i][10], data_ic[i][11], data_ic[i][12], data_ic[i][13], data_ic[i][14], G); - for(int k=0; k<3; k++) { - data_ic[i][9+k] = posvel[k]; - data_ic[i][12+k] = posvel[3+k]; - } - } - - move_to_center(); -} -void Initializer::convert_jacobian_elements_to_cartesian_coordinates() { - double G = 1; // N-body units - if(physical_units) G = units.G_standard; // Gravitational constant in units of MSun, AU and yr - - for(int k=0; k<3; k++) { - data_ic[0][9+k] = 0; - data_ic[0][12+k] = 0; - } - - double TA = convert_mean_to_true_anomaly(data_ic[1][14], data_ic[1][10]); - data_ic[1][14] = TA; - - vector posvel = get_relative_posvel_from_orbital_elements(data_ic[0][0], data_ic[1][0], data_ic[1][9], data_ic[1][10], data_ic[1][11], data_ic[1][12], data_ic[1][13], data_ic[1][14], G); - for(int k=0; k<3; k++) { - data_ic[1][9+k] = posvel[k]; - data_ic[1][12+k] = posvel[3+k]; - } - - int Nenc = 2; - double Menc = data_ic[0][0] + data_ic[1][0]; - move_to_center(Nenc); - - for(int i=2; i posvel = get_relative_posvel_from_orbital_elements(Menc, data_ic[i][0], data_ic[i][9], data_ic[i][10], data_ic[i][11], data_ic[i][12], data_ic[i][13], data_ic[i][14], G); - for(int k=0; k<3; k++) { - data_ic[i][9+k] = posvel[k]; - data_ic[i][12+k] = posvel[3+k]; - } - - Nenc++; - Menc += data_ic[i][0]; - move_to_center(Nenc); - } - - move_to_center(); -} - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Orbit.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Orbit.cpp deleted file mode 100755 index dccc9e6405..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Orbit.cpp +++ /dev/null @@ -1,212 +0,0 @@ -#include "Orbit.h" - -// Initializers -Orbit::Orbit() { - ; -} - -void Orbit::drift_r(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - b->r[k] += b->v[k]*dt; - } - } -} - -void Orbit::kick_v(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - b->v[k] += b->a[k]*dt; - } - } -} -void Orbit::kick_vv(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - b->vv[k] += b->a[k]*dt; - } - } -} - -void Orbit::memorize_r(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - b->r_prev[k] = b->r[k]; - } - } -} -void Orbit::swap_r_and_r_prev(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - double d = b->r_prev[k]; - b->r_prev[k] = b->r[k]; - b->r[k] = d; - } - } -} - -void Orbit::init_vv(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - b->vv[k] = b->v[k]; - } - } -} -void Orbit::swap_v_and_vv(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - double dummy = b->v[k]; - b->v[k] = b->vv[k]; - b->vv[k] = dummy; - } - } -} - -// Diagnostics -double Orbit::get_kinetic_energy(vector &bodies) { - double EK = 0; - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type > 0) { - double v2 = inner_product(b->v.begin(), b->v.end(), b->v.begin(), 0.); - EK += 0.5*b->m*v2; - } - } - return EK; -} -double Orbit::get_potential_energy(vector &bodies) { - double EP = 0; - - array dr, drn; - array J; - - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - - if(bi->particle_type > 0) { - - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - if(bj->particle_type > 0) { - - for(int k=0; k<3; k++) { - dr[k] = bi->r[k]-bj->r[k]; - } - - double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - double dr_3 = 1./sqrt(dr2*dr2*dr2); - double dr_1 = dr_3*dr2; - - double EP1 = -bi->m*bj->m*dr_1; - - EP += EP1; - - if(bi->particle_type >= 2 || bj->particle_type >= 2) { - - for(int k=0; k<3; k++) { - drn[k] = dr[k]*dr_1; - } - - for(int k=0; k<6; k++) { - J[k] = bi->m*bj->I[k] + bj->m*bi->I[k]; - } - - double dxJdx = drn[0]*(drn[0]*J[0] + drn[1]*J[1] + drn[2]*J[2]); - double dyJdy = drn[1]*(drn[0]*J[1] + drn[1]*J[3] + drn[2]*J[4]); - double dzJdz = drn[2]*(drn[0]*J[2] + drn[1]*J[4] + drn[2]*J[5]); - - double EP2 = 1.5*dr_3*(dxJdx + dyJdy + dzJdz - (J[0]+J[3]+J[5])/3.); - - EP += EP2; - } - - } - } - - } - } - - return EP; -} -double Orbit::get_potential_energy_nbody(vector &bodies) { - double EP = 0; - - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - - if(bi->particle_type > 0) { - - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - if(bj->particle_type > 0) { - - array dr = {}; - for(int k=0; k<3; k++) { - dr[k] = bi->r[k]-bj->r[k]; - } - - double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - double dr_1 = 1./sqrt(dr2); - - double EP1 = -bi->m*bj->m*dr_1; - - EP += EP1; - } - - } - - } - - } - - return EP; -} - -array Orbit::get_center_of_mass(vector &bodies) { - array r = {}; - int N = bodies.size(); - double M = 0.; - for(int i=0; i 0) { - M += bodies[i].m; - for(int k=0; k<3; k++) { - r[k] += bodies[i].m*bodies[i].r[k]; - } - } - } - for(int k=0; k<3; k++) { - r[k] /= M; - } - return r; -} -array Orbit::get_center_of_mass_velocity(vector &bodies) { - array v = {}; - int N = bodies.size(); - double M = 0.; - for(int i=0; i 0) { - M += bodies[i].m; - for(int k=0; k<3; k++) { - v[k] += bodies[i].m*bodies[i].v[k]; - } - } - } - for(int k=0; k<3; k++) { - v[k] /= M; - } - return v; -} -array Orbit::get_angular_momentum(vector &bodies) { - array L = {}; - int N = bodies.size(); - for(int i=0; i 0) { - double Lx = bodies[i].r[1]*bodies[i].v[2] - bodies[i].r[2]*bodies[i].v[1]; - double Ly = bodies[i].r[2]*bodies[i].v[0] - bodies[i].r[0]*bodies[i].v[2]; - double Lz = bodies[i].r[0]*bodies[i].v[1] - bodies[i].r[1]*bodies[i].v[0]; - L[0] += bodies[i].m*Lx; - L[1] += bodies[i].m*Ly; - L[2] += bodies[i].m*Lz; - } - } - return L; -} - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Output.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Output.cpp deleted file mode 100755 index 9ee49fa3ed..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Output.cpp +++ /dev/null @@ -1,2415 +0,0 @@ -#include "Output.h" - -// Constructor -Output::Output() { - format = 0; - info = 0; - coor = 0; - dir = "data/"; - overwrite = true; - - physical_units = false; - time_unit_output = ""; - mass_unit_output = ""; - length_unit_output = ""; - speed_unit_output = ""; - frequency_unit_output = ""; - angular_momentum_unit_output = ""; - energy_unit_output = ""; - inertia_unit_output = ""; - - tidal_model = 4; - - file_out = "outfile"; - file_parbu = ""; - - output_class = 0; - - firstWrite = true; - firstWriteDiag = true; - file_counter = 0; - bin_number = 0; - - n_width = 25; -} - -// Functions -void Output::set_format(int output_format) { - this->format = output_format; -} -void Output::set_info(int output_info) { - this->info = output_info; -} -void Output::set_coor(int output_coor) { - this->coor = output_coor; -} -void Output::set_dir(string output_dir) { - this->dir = output_dir; - - int N_str = this->dir.length(); - if(this->dir.at(N_str-1) != '/') { - string s = "/"; - this->dir = this->dir + s; - } -} -void Output::set_overwrite(int overwrite) { - switch(overwrite) { - case 0: - this->overwrite = false; - break; - case 1: - this->overwrite = true; - break; - } -} - -void Output::set_units(bool physical_units, string mass_unit, string length_unit, string time_unit, string speed_unit) { - this->physical_units = physical_units; - - if(physical_units) { - time_unit_output = time_unit; - mass_unit_output = mass_unit; - length_unit_output = length_unit; - speed_unit_output = speed_unit; - convert_time_to_frequency_unit(time_unit); - construct_angular_momentum_unit(mass_unit, length_unit, speed_unit); - construct_energy_unit(mass_unit, speed_unit); - construct_inertia_unit(mass_unit, length_unit); - } -} -void Output::set_conversion_factors(double Cm, double Cr, double Cv, double Ct) { - units.Cm = Cm; - units.Cr = Cr; - units.Cv = Cv; - units.Ct = Ct; -} -void Output::convert_time_to_frequency_unit(string time_unit) { - if(time_unit == "") frequency_unit_output = ""; - else if(time_unit == "[]") frequency_unit_output = "[]"; - else { - string s1 = "["; - string s2 = "1/"; - int n = time_unit.length(); - string s3 = time_unit.substr(1, n); - - frequency_unit_output = s1 + s2 + s3; - } -} -void Output::construct_angular_momentum_unit(string mass_unit, string length_unit, string speed_unit) { - if(mass_unit == "" || mass_unit == "[]") angular_momentum_unit_output = ""; - else { - string s1 = "["; - - int n = mass_unit.length(); - string sm = mass_unit.substr(1, n-2); - - n = length_unit.length(); - string sr = length_unit.substr(1, n-2); - - n = speed_unit.length(); - string sv = speed_unit.substr(1, n-1); - - angular_momentum_unit_output = s1 + sm + " " + sr + " " + sv; - } -} -void Output::construct_energy_unit(string mass_unit, string speed_unit) { - if(mass_unit == "" || mass_unit == "[]") energy_unit_output = ""; - else { - string s1 = "["; - - int n = mass_unit.length(); - string sm = mass_unit.substr(1, n-2); - - n = speed_unit.length(); - string sv = speed_unit.substr(1, n-2); - - string s2 = "]"; - - energy_unit_output = s1 + sm + " " + sv + " " + sv + s2; - } -} -void Output::construct_inertia_unit(string mass_unit, string length_unit) { - if(mass_unit == "" || mass_unit == "[]") inertia_unit_output = ""; - else { - string s1 = "["; - - int n = mass_unit.length(); - string sm = mass_unit.substr(1, n-2); - - n = length_unit.length(); - string sr = length_unit.substr(1, n-2); - - string s2 = "]"; - - inertia_unit_output = s1 + sm + " " + sr + " " + sr + s2; - } -} - -void Output::set_tidal_model(int tidal_model) { - this->tidal_model = tidal_model; -} - -void Output::set_file_out(string fo) { - this->file_out = dir + fo; -} - -void Output::determine_output_mode() { - if(format == 0) { - output_class = 0; - } - else if(format == 1) { - output_class = 1; - } - else if(format == 2) { - output_class = 2; - } - else { - cerr << endl; - cerr << "Invalid output_format: " << format << endl; - cerr << "Choose from [0=file_per_body, 1=file_per_snapshot, 2=single_file]." << endl; - cerr << endl; - exit(1); - } - - if(info == 0) { - output_class = output_class*10 + 0; - } - else if(info == 1) { - output_class = output_class*10 + 1; - } - else { - cerr << endl; - cerr << "Invalid output_info: " << info << endl; - cerr << "Choose from [0=time-varying quantities, 1=all]." << endl; - cerr << endl; - exit(1); - } - - if(coor == 0) { - output_class = output_class*10 + 0; - } - else { - cerr << endl; - cerr << "Invalid output_coor: " << info << endl; - cerr << "Choose from [0=Cartesian]." << endl; - cerr << endl; - exit(1); - } - - if(tidal_model == 0) { - output_class = output_class*10 + 0; - } - else { - output_class = output_class*10 + 1; - } -} - -void Output::write_snapshot(double t, double tcpu, vector &bodies) { - switch(output_class) { - - //0 0=file per body + 0=time-varying quantities + 0=cartesian inertial + N-body - //100 0=file per body + 1=all quantities + 0=cartesian inertial + N-body - - //1000 1=file per snapshot + 0=time-varying quantities + 0=cartesian inertial + N-body - //1100 1=file per snapshot + 1=all quantities + 0=cartesian inertial + N-body - - //2000 2=single file + 0=time-varying quantities + 0=cartesian inertial + N-body - //2100 2=single file + 1=all quantities + 0=cartesian inertial + N-body - - //1 0=file per body + 0=time-varying quantities + 0=cartesian inertial + Tidal - //101 0=file per body + 1=all quantities + 0=cartesian inertial + Tidal - - //1001 1=file per snapshot + 0=time-varying quantities + 0=cartesian inertial + Tidal - //1101 1=file per snapshot + 1=all quantities + 0=cartesian inertial + Tidal - - //2001 2=single file + 0=time-varying quantities + 0=cartesian inertial + Tidal - //2101 2=single file + 1=all quantities + 0=cartesian inertial + Tidal - - case 0: - write_snapshot_per_body_compact_nbody(t, tcpu, bodies); - break; - case 100: - write_snapshot_per_body_nbody(t, tcpu, bodies); - break; - - case 1000: - write_new_snapshot_file_compact_nbody(t, tcpu, bodies); - break; - case 1100: - write_new_snapshot_file_nbody(t, tcpu, bodies); - break; - - case 2000: - write_snapshot_to_file_compact_nbody(t, tcpu, bodies); - break; - case 2100: - write_snapshot_to_file_nbody(t, tcpu, bodies); - break; - - case 1: - write_snapshot_per_body_compact(t, tcpu, bodies); - break; - case 101: - write_snapshot_per_body(t, tcpu, bodies); - break; - - case 1001: - write_new_snapshot_file_compact(t, tcpu, bodies); - break; - case 1101: - write_new_snapshot_file(t, tcpu, bodies); - break; - - case 2001: - write_snapshot_to_file_compact(t, tcpu, bodies); - break; - case 2101: - write_snapshot_to_file(t, tcpu, bodies); - break; - } -} -void Output::create_output_file(string outputFile, bool isFirstWrite) { - // Check if file already exists - std::ifstream reader(outputFile); - bool exist = reader.good(); - reader.close(); - - if(exist == false) { - // Create the file - ofstream writer; - writer.open(outputFile, ios::out); - writer.close(); - } - else { - if(!overwrite) { - cerr << " " << endl; - cerr << outputFile << " already exists!" << endl; - cerr << " " << endl; - exit(1); - } - else if(isFirstWrite && overwrite) { - ofstream writer; - writer.open(outputFile, ios::out); - writer.close(); - } - } -} - -// Writers -void Output::write_snapshot_to_file(double t, double tcpu, vector &bodies) { - string outputFile = file_out + ".run"; - - create_output_file(outputFile, firstWrite); - - ofstream writer; - writer.open(outputFile, ios::app); - - if (!writer) { - cerr << endl; - cerr << "Cannot open output file: " << outputFile << endl; - cerr << endl; - exit(1); - } - - int N = bodies.size(); - - writer << setprecision(16); - writer << scientific; - - writer << units.convert_time_from_code_to_output(t, time_unit_output) << " " << N << " " << tcpu << endl; - for(int i=0; i &bodies) { - string outputFile = file_out + ".run"; - - create_output_file(outputFile, firstWrite); - - ofstream writer; - writer.open(outputFile, ios::app); - - if (!writer) { - cerr << endl; - cerr << "Cannot open output file: " << outputFile << endl; - cerr << endl; - exit(1); - } - - int N = bodies.size(); - - writer << setprecision(16); - writer << scientific; - - writer << units.convert_time_from_code_to_output(t, time_unit_output) << " " << N << " " << tcpu << endl; - for(int i=0; i &bodies) { - string outputFile = file_out + ".s" + to_string(file_counter); - - firstWrite = true; - create_output_file(outputFile, firstWrite); - - ofstream writer; - writer.open(outputFile, ios::app); - - if (!writer) { - cerr << "Cannot open output file: " << outputFile << endl; - exit(1); - } - - int N = bodies.size(); - - writer << setprecision(16); - writer << scientific; - - string s = "# t"; - writer << s + time_unit_output << " = "; - writer << units.convert_time_from_code_to_output(t, time_unit_output) << endl; - - writer << "# N = " << N << endl; - writer << "# tcpu[s] = " << tcpu << endl; - - if(firstWrite) { - s = "# "; - writer << s; - - writer << std::left; - - s = "name"; - writer << setw(n_width-2) << s; - s = "id"; - writer << setw(n_width) << s; - - writer << std::right; - - s = "mass"; - writer << setw(n_width) << s + mass_unit_output; - s = "R"; - writer << setw(n_width) << s + length_unit_output; - s = "xi"; - writer << setw(n_width) << s; - - s = "kf"; - writer << setw(n_width) << s; - s = "tau"; - writer << setw(n_width) << s + time_unit_output; - - s = "a_mb"; - writer << setw(n_width) << s + time_unit_output; - - s = "Ixx"; - writer << setw(n_width) << s + inertia_unit_output; - s = "Ixy"; - writer << setw(n_width) << s + inertia_unit_output; - s = "Ixz"; - writer << setw(n_width) << s + inertia_unit_output; - s = "Iyy"; - writer << setw(n_width) << s + inertia_unit_output; - s = "Iyz"; - writer << setw(n_width) << s + inertia_unit_output; - s = "Izz"; - writer << setw(n_width) << s + inertia_unit_output; - - s = "wx"; - writer << setw(n_width) << s + frequency_unit_output; - s = "wy"; - writer << setw(n_width) << s + frequency_unit_output; - s = "wz"; - writer << setw(n_width) << s + frequency_unit_output; - - s = "x"; - writer << setw(n_width) << s + length_unit_output; - s = "y"; - writer << setw(n_width) << s + length_unit_output; - s = "z"; - writer << setw(n_width) << s + length_unit_output; - - s = "vx"; - writer << setw(n_width) << s + speed_unit_output; - s = "vy"; - writer << setw(n_width) << s + speed_unit_output; - s = "vz"; - writer << setw(n_width) << s + speed_unit_output; - - writer << endl; - } - - for(int i=0; i &bodies) { - string outputFile = file_out + ".s" + to_string(file_counter); - - firstWrite = true; - create_output_file(outputFile, firstWrite); - - ofstream writer; - writer.open(outputFile, ios::app); - - if (!writer) { - cerr << "Cannot open output file: " << outputFile << endl; - exit(1); - } - - int N = bodies.size(); - - writer << setprecision(16); - writer << scientific; - - string s = "# t"; - writer << s + time_unit_output << " = "; - writer << units.convert_time_from_code_to_output(t, time_unit_output) << endl; - - writer << "# N = " << N << endl; - writer << "# tcpu[s] = " << tcpu << endl; - - if(firstWrite) { - s = "#"; - writer << s; - - s = "Ixx"; - writer << setw(n_width-1) << s + inertia_unit_output; - s = "Ixy"; - writer << setw(n_width) << s + inertia_unit_output; - s = "Ixz"; - writer << setw(n_width) << s + inertia_unit_output; - s = "Iyy"; - writer << setw(n_width) << s + inertia_unit_output; - s = "Iyz"; - writer << setw(n_width) << s + inertia_unit_output; - - s = "wx"; - writer << setw(n_width) << s + frequency_unit_output; - s = "wy"; - writer << setw(n_width) << s + frequency_unit_output; - s = "wz"; - writer << setw(n_width) << s + frequency_unit_output; - - s = "x"; - writer << setw(n_width) << s + length_unit_output; - s = "y"; - writer << setw(n_width) << s + length_unit_output; - s = "z"; - writer << setw(n_width) << s + length_unit_output; - - s = "vx"; - writer << setw(n_width) << s + speed_unit_output; - s = "vy"; - writer << setw(n_width) << s + speed_unit_output; - s = "vz"; - writer << setw(n_width) << s + speed_unit_output; - - writer << endl; - } - - for(int i=0; i &bodies) { - int N = bodies.size(); - for(int i=0; i &bodies) { - int N = bodies.size(); - for(int i=0; i &bodies) { - string outputFile = file_out + ".run"; - - create_output_file(outputFile, firstWrite); - - ofstream writer; - writer.open(outputFile, ios::app); - - if (!writer) { - cerr << endl; - cerr << "Cannot open output file: " << outputFile << endl; - cerr << endl; - exit(1); - } - - int N = bodies.size(); - - writer << setprecision(16); - writer << scientific; - - writer << units.convert_time_from_code_to_output(t, time_unit_output) << " " << N << " " << tcpu << endl; - for(int i=0; i &bodies) { - string outputFile = file_out + ".run"; - - create_output_file(outputFile, firstWrite); - - ofstream writer; - writer.open(outputFile, ios::app); - - if (!writer) { - cerr << endl; - cerr << "Cannot open output file: " << outputFile << endl; - cerr << endl; - exit(1); - } - - int N = bodies.size(); - - writer << setprecision(16); - writer << scientific; - - writer << units.convert_time_from_code_to_output(t, time_unit_output) << " " << N << " " << tcpu << endl; - for(int i=0; i &bodies) { - string outputFile = file_out + ".s" + to_string(file_counter); - - firstWrite = true; - create_output_file(outputFile, firstWrite); - - ofstream writer; - writer.open(outputFile, ios::app); - - if (!writer) { - cerr << "Cannot open output file: " << outputFile << endl; - exit(1); - } - - int N = bodies.size(); - - writer << setprecision(16); - writer << scientific; - - string s = "# t"; - writer << s + time_unit_output << " = "; - writer << units.convert_time_from_code_to_output(t, time_unit_output) << endl; - - writer << "# N = " << N << endl; - writer << "# tcpu[s] = " << tcpu << endl; - - if(firstWrite) { - s = "# "; - writer << s; - - writer << std::left; - - s = "name"; - writer << setw(n_width-2) << s; - s = "id"; - writer << setw(n_width) << s; - - writer << std::right; - - s = "mass"; - writer << setw(n_width) << s + mass_unit_output; - s = "R"; - writer << setw(n_width) << s + length_unit_output; - - s = "x"; - writer << setw(n_width) << s + length_unit_output; - s = "y"; - writer << setw(n_width) << s + length_unit_output; - s = "z"; - writer << setw(n_width) << s + length_unit_output; - - s = "vx"; - writer << setw(n_width) << s + speed_unit_output; - s = "vy"; - writer << setw(n_width) << s + speed_unit_output; - s = "vz"; - writer << setw(n_width) << s + speed_unit_output; - - writer << endl; - } - - for(int i=0; i &bodies) { - string outputFile = file_out + ".s" + to_string(file_counter); - - firstWrite = true; - create_output_file(outputFile, firstWrite); - - ofstream writer; - writer.open(outputFile, ios::app); - - if (!writer) { - cerr << "Cannot open output file: " << outputFile << endl; - exit(1); - } - - int N = bodies.size(); - - writer << setprecision(16); - writer << scientific; - - string s = "# t"; - writer << s + time_unit_output << " = "; - writer << units.convert_time_from_code_to_output(t, time_unit_output) << endl; - - writer << "# N = " << N << endl; - writer << "# tcpu[s] = " << tcpu << endl; - - if(firstWrite) { - s = "# "; - writer << s; - - s = "x"; - writer << setw(n_width-2) << s + length_unit_output; - s = "y"; - writer << setw(n_width) << s + length_unit_output; - s = "z"; - writer << setw(n_width) << s + length_unit_output; - - s = "vx"; - writer << setw(n_width) << s + speed_unit_output; - s = "vy"; - writer << setw(n_width) << s + speed_unit_output; - s = "vz"; - writer << setw(n_width) << s + speed_unit_output; - - writer << endl; - } - - for(int i=0; i &bodies) { - int N = bodies.size(); - for(int i=0; i &bodies) { - int N = bodies.size(); - for(int i=0; i &bodies, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot) { - string bin_name = file_out + ".bin" + to_string(bin_number); - bin_number = (bin_number + 1) % 2; - - fstream fb(bin_name, ios::in | ios::out | ios::binary | ios::trunc); - - // header - fb.write((char*)&t, sizeof (double)); - fb.write((char*)&N, sizeof (int)); - fb.write((char*)&tcpu, sizeof (double)); - fb.write((char*)&dt_prev, sizeof (double)); - fb.write((char*)&num_integration_steps, sizeof (int)); - - fb.write((char*)&collision_flag, sizeof (int)); - fb.write((char*)&roche_flag, sizeof (int)); - fb.write((char*)&breakup_flag, sizeof (int)); - - fb.write((char*)&dt_snapshot, sizeof (double)); - fb.write((char*)&dt0_log, sizeof (double)); - fb.write((char*)&fmul_log, sizeof (double)); - - fb.write((char*)&num_snapshot, sizeof (int)); - - // id - vector id(N); - for(int i=0; i m(N), R(N), xi(N); - for(int i=0; i kf(N), tau(N); - for(int i=0; i a_mb(N); - for(int i=0; i Ixx(N), Ixy(N), Ixz(N), Iyy(N), Iyz(N), Izz(N); - for(int i=0; i Ixx_p(N), Ixy_p(N), Ixz_p(N), Iyy_p(N), Iyz_p(N), Izz_p(N); - for(int i=0; i Ixx_n(N), Ixy_n(N), Ixz_n(N), Iyy_n(N), Iyz_n(N), Izz_n(N); - for(int i=0; i Ixx_inv(N), Ixy_inv(N), Ixz_inv(N), Iyy_inv(N), Iyz_inv(N), Izz_inv(N); - for(int i=0; i Ixx_e_r(N), Ixy_e_r(N), Ixz_e_r(N), Iyy_e_r(N), Iyz_e_r(N), Izz_e_r(N); - for(int i=0; i dIxx_e_r(N), dIxy_e_r(N), dIxz_e_r(N), dIyy_e_r(N), dIyz_e_r(N), dIzz_e_r(N); - for(int i=0; i Ixx_e_w(N), Ixy_e_w(N), Ixz_e_w(N), Iyy_e_w(N), Iyz_e_w(N), Izz_e_w(N); - for(int i=0; i Ixx_e(N), Ixy_e(N), Ixz_e(N), Iyy_e(N), Iyz_e(N), Izz_e(N); - for(int i=0; i dIxx_e(N), dIxy_e(N), dIxz_e(N), dIyy_e(N), dIyz_e(N), dIzz_e(N); - for(int i=0; i dIxx_n(N), dIxy_n(N), dIxz_n(N), dIyy_n(N), dIyz_n(N), dIzz_n(N); - for(int i=0; i Ixx_e_prev(N), Ixy_e_prev(N), Ixz_e_prev(N), Iyy_e_prev(N), Iyz_e_prev(N), Izz_e_prev(N); - for(int i=0; i Ixx_n_prev(N), Ixy_n_prev(N), Ixz_n_prev(N), Iyy_n_prev(N), Iyz_n_prev(N), Izz_n_prev(N); - for(int i=0; i Ixx_e_prev_bu(N), Ixy_e_prev_bu(N), Ixz_e_prev_bu(N), Iyy_e_prev_bu(N), Iyz_e_prev_bu(N), Izz_e_prev_bu(N); - for(int i=0; i Ixx_e_rh(N), Ixy_e_rh(N), Ixz_e_rh(N), Iyy_e_rh(N), Iyz_e_rh(N), Izz_e_rh(N); - for(int i=0; i wx(N), wy(N), wz(N); - vector Lx(N), Ly(N), Lz(N); - - for(int i=0; i Tx(N), Ty(N), Tz(N); - - for(int i=0; i x(N), y(N), z(N); - vector vx(N), vy(N), vz(N); - - for(int i=0; i ax(N), ay(N), az(N); - - for(int i=0; i R5(N), R5_3(N), kf_R5(N), kf_R5_3(N), tau_inv(N); - for(int i=0; i vvx(N), vvy(N), vvz(N); - - for(int i=0; i Jxx_n(N), Jxy_n(N), Jxz_n(N), Jyy_n(N), Jyz_n(N), Jzz_n(N); - for(int i=0; i Jxx(N), Jxy(N), Jxz(N), Jyy(N), Jyz(N), Jzz(N); - for(int i=0; i Jxx_inv(N), Jxy_inv(N), Jxz_inv(N), Jyy_inv(N), Jyz_inv(N), Jzz_inv(N); - for(int i=0; i Kx(N), Ky(N), Kz(N); - - for(int i=0; i &bodies, int &collision_flag, int &roche_flag, int &breakup_flag, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot) { - string bin0_name = file_out + ".bin0"; - - bool isComplete0; - double t0, tcpu0, dt_prev0; - int N0; - vector bodies0; - bool firstWrite0; - bool firstWriteDiag0; - int file_counter0; - int bin_number0; - int num_integration_steps0, num_snapshot0; - int collision_flag0, roche_flag0, breakup_flag0; - double dt_snapshot0, dt0_log0, fmul_log0; - - try { - read_from_binary(t0, N0, tcpu0, dt_prev0, num_integration_steps0, bodies0, bin0_name, firstWrite0, firstWriteDiag0, file_counter0, bin_number0, collision_flag0, roche_flag0, breakup_flag0, dt_snapshot0, dt0_log0, fmul_log0, num_snapshot0); - isComplete0 = true; - } - catch(const std::exception&) { - isComplete0 = false; - } - - string bin1_name = file_out + ".bin1"; - - bool isComplete1; - double t1, tcpu1, dt_prev1; - int N1; - vector bodies1; - bool firstWrite1; - bool firstWriteDiag1; - int file_counter1; - int bin_number1; - int num_integration_steps1, num_snapshot1; - int collision_flag1, roche_flag1, breakup_flag1; - double dt_snapshot1, dt0_log1, fmul_log1; - - try { - read_from_binary(t1, N1, tcpu1, dt_prev1, num_integration_steps1, bodies1, bin1_name, firstWrite1, firstWriteDiag1, file_counter1, bin_number1, collision_flag1, roche_flag1, breakup_flag1, dt_snapshot1, dt0_log1, fmul_log1, num_snapshot1); - isComplete1 = true; - } - catch(const std::exception&) { - isComplete1 = false; - } - - if(isComplete0) { - if(isComplete1) { - if(t1 > t0) { - t = t1; - N = N1; - tcpu = tcpu1; - dt_prev = dt_prev1; - bodies = bodies1; - firstWrite = firstWrite1; - firstWriteDiag = firstWriteDiag1; - file_counter = file_counter1; - bin_number = bin_number1; - num_integration_steps = num_integration_steps1; - collision_flag = collision_flag1; - roche_flag = roche_flag1; - breakup_flag = breakup_flag1; - dt_snapshot = dt_snapshot1; - dt0_log = dt0_log1; - fmul_log = fmul_log1; - num_snapshot = num_snapshot1; - } - else { - t = t0; - N = N0; - tcpu = tcpu0; - dt_prev = dt_prev0; - bodies = bodies0; - firstWrite = firstWrite0; - firstWriteDiag = firstWriteDiag0; - file_counter = file_counter0; - bin_number = bin_number0; - num_integration_steps = num_integration_steps0; - collision_flag = collision_flag0; - roche_flag = roche_flag0; - breakup_flag = breakup_flag0; - dt_snapshot = dt_snapshot0; - dt0_log = dt0_log0; - fmul_log = fmul_log0; - num_snapshot = num_snapshot0; - } - } - else { - t = t0; - N = N0; - tcpu = tcpu0; - dt_prev = dt_prev0; - bodies = bodies0; - firstWrite = firstWrite0; - firstWriteDiag = firstWriteDiag0; - file_counter = file_counter0; - bin_number = bin_number0; - num_integration_steps = num_integration_steps0; - collision_flag = collision_flag0; - roche_flag = roche_flag0; - breakup_flag = breakup_flag0; - dt_snapshot = dt_snapshot0; - dt0_log = dt0_log0; - fmul_log = fmul_log0; - num_snapshot = num_snapshot0; - } - } - else { - if(isComplete1) { - t = t1; - N = N1; - tcpu = tcpu1; - dt_prev = dt_prev1; - bodies = bodies1; - firstWrite = firstWrite1; - firstWriteDiag = firstWriteDiag1; - file_counter = file_counter1; - bin_number = bin_number1; - num_integration_steps = num_integration_steps1; - collision_flag = collision_flag1; - roche_flag = roche_flag1; - breakup_flag = breakup_flag1; - dt_snapshot = dt_snapshot1; - dt0_log = dt0_log1; - fmul_log = fmul_log1; - num_snapshot = num_snapshot1; - } - else { - cerr << " " << endl; - cerr << "Incomplete/invalid binary files: cannot continue simulation." << endl; - cerr << " " << endl; - exit(1); - } - } -} -void Output::read_from_binary(double &t, int &N, double &tcpu, double &dt_prev, int &num_integration_steps, vector &bodies, string &bin_name, bool &myfirstWrite, bool &myfirstWriteDiag, int &myfile_counter, int &mybin_number, int &collision_flag, int &roche_flag, int &breakup_flag, double &dt_snapshot, double &dt0_log, double &fmul_log, int &num_snapshot) { - fstream fb(bin_name, ios::in | ios::out | ios::binary); - - // header - fb.read((char*)&t, sizeof (double)); - fb.read((char*)&N, sizeof (int)); - fb.read((char*)&tcpu, sizeof (double)); - fb.read((char*)&dt_prev, sizeof (double)); - fb.read((char*)&num_integration_steps, sizeof (int)); - - fb.read((char*)&collision_flag, sizeof (int)); - fb.read((char*)&roche_flag, sizeof (int)); - fb.read((char*)&breakup_flag, sizeof (int)); - - fb.read((char*)&dt_snapshot, sizeof (double)); - fb.read((char*)&dt0_log, sizeof (double)); - fb.read((char*)&fmul_log, sizeof (double)); - - fb.read((char*)&num_snapshot, sizeof (int)); - - bodies.resize(N); - - // id - vector id(N); - fb.read((char*)&id[0], sizeof (int)*N); - - for(int i=0; i m(N), R(N), xi(N); - fb.read((char*)&m[0], sizeof (double)*N); - fb.read((char*)&R[0], sizeof (double)*N); - fb.read((char*)&xi[0], sizeof (double)*N); - - for(int i=0; i kf(N), tau(N); - fb.read((char*)&kf[0], sizeof (double)*N); - fb.read((char*)&tau[0], sizeof (double)*N); - - for(int i=0; i a_mb(N); - fb.read((char*)&a_mb[0], sizeof (double)*N); - - for(int i=0; i Ixx(N), Ixy(N), Ixz(N), Iyy(N), Iyz(N), Izz(N); - - fb.read((char*)&Ixx[0], sizeof (double)*N); - fb.read((char*)&Ixy[0], sizeof (double)*N); - fb.read((char*)&Ixz[0], sizeof (double)*N); - fb.read((char*)&Iyy[0], sizeof (double)*N); - fb.read((char*)&Iyz[0], sizeof (double)*N); - fb.read((char*)&Izz[0], sizeof (double)*N); - - for(int i=0; i Ixx_p(N), Ixy_p(N), Ixz_p(N), Iyy_p(N), Iyz_p(N), Izz_p(N); - - fb.read((char*)&Ixx_p[0], sizeof (double)*N); - fb.read((char*)&Ixy_p[0], sizeof (double)*N); - fb.read((char*)&Ixz_p[0], sizeof (double)*N); - fb.read((char*)&Iyy_p[0], sizeof (double)*N); - fb.read((char*)&Iyz_p[0], sizeof (double)*N); - fb.read((char*)&Izz_p[0], sizeof (double)*N); - - for(int i=0; i Ixx_n(N), Ixy_n(N), Ixz_n(N), Iyy_n(N), Iyz_n(N), Izz_n(N); - - fb.read((char*)&Ixx_n[0], sizeof (double)*N); - fb.read((char*)&Ixy_n[0], sizeof (double)*N); - fb.read((char*)&Ixz_n[0], sizeof (double)*N); - fb.read((char*)&Iyy_n[0], sizeof (double)*N); - fb.read((char*)&Iyz_n[0], sizeof (double)*N); - fb.read((char*)&Izz_n[0], sizeof (double)*N); - - for(int i=0; i Ixx_inv(N), Ixy_inv(N), Ixz_inv(N), Iyy_inv(N), Iyz_inv(N), Izz_inv(N); - - fb.read((char*)&Ixx_inv[0], sizeof (double)*N); - fb.read((char*)&Ixy_inv[0], sizeof (double)*N); - fb.read((char*)&Ixz_inv[0], sizeof (double)*N); - fb.read((char*)&Iyy_inv[0], sizeof (double)*N); - fb.read((char*)&Iyz_inv[0], sizeof (double)*N); - fb.read((char*)&Izz_inv[0], sizeof (double)*N); - - for(int i=0; i Ixx_e_r(N), Ixy_e_r(N), Ixz_e_r(N), Iyy_e_r(N), Iyz_e_r(N), Izz_e_r(N); - - fb.read((char*)&Ixx_e_r[0], sizeof (double)*N); - fb.read((char*)&Ixy_e_r[0], sizeof (double)*N); - fb.read((char*)&Ixz_e_r[0], sizeof (double)*N); - fb.read((char*)&Iyy_e_r[0], sizeof (double)*N); - fb.read((char*)&Iyz_e_r[0], sizeof (double)*N); - fb.read((char*)&Izz_e_r[0], sizeof (double)*N); - - for(int i=0; i dIxx_e_r(N), dIxy_e_r(N), dIxz_e_r(N), dIyy_e_r(N), dIyz_e_r(N), dIzz_e_r(N); - - fb.read((char*)&dIxx_e_r[0], sizeof (double)*N); - fb.read((char*)&dIxy_e_r[0], sizeof (double)*N); - fb.read((char*)&dIxz_e_r[0], sizeof (double)*N); - fb.read((char*)&dIyy_e_r[0], sizeof (double)*N); - fb.read((char*)&dIyz_e_r[0], sizeof (double)*N); - fb.read((char*)&dIzz_e_r[0], sizeof (double)*N); - - for(int i=0; i Ixx_e_w(N), Ixy_e_w(N), Ixz_e_w(N), Iyy_e_w(N), Iyz_e_w(N), Izz_e_w(N); - - fb.read((char*)&Ixx_e_w[0], sizeof (double)*N); - fb.read((char*)&Ixy_e_w[0], sizeof (double)*N); - fb.read((char*)&Ixz_e_w[0], sizeof (double)*N); - fb.read((char*)&Iyy_e_w[0], sizeof (double)*N); - fb.read((char*)&Iyz_e_w[0], sizeof (double)*N); - fb.read((char*)&Izz_e_w[0], sizeof (double)*N); - - for(int i=0; i Ixx_e(N), Ixy_e(N), Ixz_e(N), Iyy_e(N), Iyz_e(N), Izz_e(N); - - fb.read((char*)&Ixx_e[0], sizeof (double)*N); - fb.read((char*)&Ixy_e[0], sizeof (double)*N); - fb.read((char*)&Ixz_e[0], sizeof (double)*N); - fb.read((char*)&Iyy_e[0], sizeof (double)*N); - fb.read((char*)&Iyz_e[0], sizeof (double)*N); - fb.read((char*)&Izz_e[0], sizeof (double)*N); - - for(int i=0; i dIxx_e(N), dIxy_e(N), dIxz_e(N), dIyy_e(N), dIyz_e(N), dIzz_e(N); - - fb.read((char*)&dIxx_e[0], sizeof (double)*N); - fb.read((char*)&dIxy_e[0], sizeof (double)*N); - fb.read((char*)&dIxz_e[0], sizeof (double)*N); - fb.read((char*)&dIyy_e[0], sizeof (double)*N); - fb.read((char*)&dIyz_e[0], sizeof (double)*N); - fb.read((char*)&dIzz_e[0], sizeof (double)*N); - - for(int i=0; i dIxx_n(N), dIxy_n(N), dIxz_n(N), dIyy_n(N), dIyz_n(N), dIzz_n(N); - - fb.read((char*)&dIxx_n[0], sizeof (double)*N); - fb.read((char*)&dIxy_n[0], sizeof (double)*N); - fb.read((char*)&dIxz_n[0], sizeof (double)*N); - fb.read((char*)&dIyy_n[0], sizeof (double)*N); - fb.read((char*)&dIyz_n[0], sizeof (double)*N); - fb.read((char*)&dIzz_n[0], sizeof (double)*N); - - for(int i=0; i Ixx_e_prev(N), Ixy_e_prev(N), Ixz_e_prev(N), Iyy_e_prev(N), Iyz_e_prev(N), Izz_e_prev(N); - - fb.read((char*)&Ixx_e_prev[0], sizeof (double)*N); - fb.read((char*)&Ixy_e_prev[0], sizeof (double)*N); - fb.read((char*)&Ixz_e_prev[0], sizeof (double)*N); - fb.read((char*)&Iyy_e_prev[0], sizeof (double)*N); - fb.read((char*)&Iyz_e_prev[0], sizeof (double)*N); - fb.read((char*)&Izz_e_prev[0], sizeof (double)*N); - - for(int i=0; i Ixx_n_prev(N), Ixy_n_prev(N), Ixz_n_prev(N), Iyy_n_prev(N), Iyz_n_prev(N), Izz_n_prev(N); - - fb.read((char*)&Ixx_n_prev[0], sizeof (double)*N); - fb.read((char*)&Ixy_n_prev[0], sizeof (double)*N); - fb.read((char*)&Ixz_n_prev[0], sizeof (double)*N); - fb.read((char*)&Iyy_n_prev[0], sizeof (double)*N); - fb.read((char*)&Iyz_n_prev[0], sizeof (double)*N); - fb.read((char*)&Izz_n_prev[0], sizeof (double)*N); - - for(int i=0; i Ixx_e_prev_bu(N), Ixy_e_prev_bu(N), Ixz_e_prev_bu(N), Iyy_e_prev_bu(N), Iyz_e_prev_bu(N), Izz_e_prev_bu(N); - - fb.read((char*)&Ixx_e_prev_bu[0], sizeof (double)*N); - fb.read((char*)&Ixy_e_prev_bu[0], sizeof (double)*N); - fb.read((char*)&Ixz_e_prev_bu[0], sizeof (double)*N); - fb.read((char*)&Iyy_e_prev_bu[0], sizeof (double)*N); - fb.read((char*)&Iyz_e_prev_bu[0], sizeof (double)*N); - fb.read((char*)&Izz_e_prev_bu[0], sizeof (double)*N); - - for(int i=0; i Ixx_e_rh(N), Ixy_e_rh(N), Ixz_e_rh(N), Iyy_e_rh(N), Iyz_e_rh(N), Izz_e_rh(N); - - fb.read((char*)&Ixx_e_rh[0], sizeof (double)*N); - fb.read((char*)&Ixy_e_rh[0], sizeof (double)*N); - fb.read((char*)&Ixz_e_rh[0], sizeof (double)*N); - fb.read((char*)&Iyy_e_rh[0], sizeof (double)*N); - fb.read((char*)&Iyz_e_rh[0], sizeof (double)*N); - fb.read((char*)&Izz_e_rh[0], sizeof (double)*N); - - for(int i=0; i wx(N), wy(N), wz(N); - vector Lx(N), Ly(N), Lz(N); - - fb.read((char*)&wx[0], sizeof (double)*N); - fb.read((char*)&wy[0], sizeof (double)*N); - fb.read((char*)&wz[0], sizeof (double)*N); - fb.read((char*)&Lx[0], sizeof (double)*N); - fb.read((char*)&Ly[0], sizeof (double)*N); - fb.read((char*)&Lz[0], sizeof (double)*N); - - for(int i=0; i Tx(N), Ty(N), Tz(N); - - fb.read((char*)&Tx[0], sizeof (double)*N); - fb.read((char*)&Ty[0], sizeof (double)*N); - fb.read((char*)&Tz[0], sizeof (double)*N); - - for(int i=0; i x(N), y(N), z(N); - vector vx(N), vy(N), vz(N); - - fb.read((char*)&x[0], sizeof (double)*N); - fb.read((char*)&y[0], sizeof (double)*N); - fb.read((char*)&z[0], sizeof (double)*N); - fb.read((char*)&vx[0], sizeof (double)*N); - fb.read((char*)&vy[0], sizeof (double)*N); - fb.read((char*)&vz[0], sizeof (double)*N); - - for(int i=0; i ax(N), ay(N), az(N); - - fb.read((char*)&ax[0], sizeof (double)*N); - fb.read((char*)&ay[0], sizeof (double)*N); - fb.read((char*)&az[0], sizeof (double)*N); - - for(int i=0; i R5(N), R5_3(N), kf_R5(N), kf_R5_3(N), tau_inv(N); - fb.read((char*)&R5[0], sizeof (double)*N); - fb.read((char*)&R5_3[0], sizeof (double)*N); - fb.read((char*)&kf_R5[0], sizeof (double)*N); - fb.read((char*)&kf_R5_3[0], sizeof (double)*N); - fb.read((char*)&tau_inv[0], sizeof (double)*N); - - for(int i=0; i vvx(N), vvy(N), vvz(N); - - fb.read((char*)&vvx[0], sizeof (double)*N); - fb.read((char*)&vvy[0], sizeof (double)*N); - fb.read((char*)&vvz[0], sizeof (double)*N); - - for(int i=0; i Jxx_n(N), Jxy_n(N), Jxz_n(N), Jyy_n(N), Jyz_n(N), Jzz_n(N); - - fb.read((char*)&Jxx_n[0], sizeof (double)*N); - fb.read((char*)&Jxy_n[0], sizeof (double)*N); - fb.read((char*)&Jxz_n[0], sizeof (double)*N); - fb.read((char*)&Jyy_n[0], sizeof (double)*N); - fb.read((char*)&Jyz_n[0], sizeof (double)*N); - fb.read((char*)&Jzz_n[0], sizeof (double)*N); - - for(int i=0; i Jxx(N), Jxy(N), Jxz(N), Jyy(N), Jyz(N), Jzz(N); - - fb.read((char*)&Jxx[0], sizeof (double)*N); - fb.read((char*)&Jxy[0], sizeof (double)*N); - fb.read((char*)&Jxz[0], sizeof (double)*N); - fb.read((char*)&Jyy[0], sizeof (double)*N); - fb.read((char*)&Jyz[0], sizeof (double)*N); - fb.read((char*)&Jzz[0], sizeof (double)*N); - - for(int i=0; i Jxx_inv(N), Jxy_inv(N), Jxz_inv(N), Jyy_inv(N), Jyz_inv(N), Jzz_inv(N); - - fb.read((char*)&Jxx_inv[0], sizeof (double)*N); - fb.read((char*)&Jxy_inv[0], sizeof (double)*N); - fb.read((char*)&Jxz_inv[0], sizeof (double)*N); - fb.read((char*)&Jyy_inv[0], sizeof (double)*N); - fb.read((char*)&Jyz_inv[0], sizeof (double)*N); - fb.read((char*)&Jzz_inv[0], sizeof (double)*N); - - for(int i=0; i Kx(N), Ky(N), Kz(N); - - fb.read((char*)&Kx[0], sizeof (double)*N); - fb.read((char*)&Ky[0], sizeof (double)*N); - fb.read((char*)&Kz[0], sizeof (double)*N); - - for(int i=0; i &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - double I0 = b->xi*b->m*b->R*b->R; - b->I_p.fill(0); - b->I_p[0] = I0; - b->I_p[3] = I0; - b->I_p[5] = I0; - } -} -void Shape::set_to_spherical_shape(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->I_n.fill(0); - for(int k=0; k<6; k++) { - b->I[k] = b->I_p[k] + b->I_n[k]; - } - } -} -void Shape::set_to_equilibrium_shape(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<5; k++) { - b->I_n[k] = b->I_e[k]; - b->I[k] = b->I_p[k] + b->I_n[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - b->I[5] = b->I_p[5] + b->I_n[5]; - } -} -void Shape::set_to_equilibrium_shape_with_J(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<5; k++) { - b->J_n[k] = b->I_e[k]; - b->J[k] = b->I_p[k] + b->J_n[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - b->J[5] = b->I_p[5] + b->J_n[5]; - } -} -void Shape::set_to_linear_shape(vector &bodies) { - kick_linear(bodies); -} -void Shape::init_J(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->J_n[k] = b->I_n[k]; - b->J[k] = b->I[k]; - } - } -} - -void Shape::calc_expos(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3 && b->tau > 0) { - double dt_abs = abs(dt); - - double f_ratio = dt*b->tau_inv; - double f_ratio_abs = dt_abs*b->tau_inv; - - double fh_ratio = 0.5*f_ratio; - double fh_ratio_abs = 0.5*f_ratio_abs; - - double expoh_abs = exp(-fh_ratio_abs); - double expo_abs = expoh_abs*expoh_abs; - - if(f_ratio_abs < f_lim) { - double expoh = (dt > 0) ? expoh_abs : 1./expoh_abs; - - double expo = expoh*expoh; - - int dt_sgn = dt/dt_abs; - - double dt_step = b->tau*(1-expo_abs); - dt_step *= dt_sgn; - - double dth_step = b->tau*(1-expoh_abs); - dth_step *= dt_sgn; - - b->expo = expo; - b->expoh = expoh; - b->dt_rot = dt_step; - b->dth_rot = dth_step; - b->isLinear = false; - } - else { - double dth_step = b->tau*(1-expoh_abs); - double dt_step = b->tau*(1-expo_abs); - - b->dt_rot = dt_step; - b->dth_rot = dth_step; - b->isLinear = true; - } - } - } -} -void Shape::copy_expos_to_1(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->expo_1 = b->expo; - b->expoh_1 = b->expoh; - b->dt_rot_1 = b->dt_rot; - b->dth_rot_1 = b->dth_rot; - b->isLinear_1 = b->isLinear; - } -} -void Shape::copy_expos_to_2(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->expo_2 = b->expo; - b->expoh_2 = b->expoh; - b->dt_rot_2 = b->dt_rot; - b->dth_rot_2 = b->dth_rot; - b->isLinear_2 = b->isLinear; - } -} -void Shape::revert_expos_1(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->expo = b->expo_1; - b->expoh = b->expoh_1; - b->dt_rot = b->dt_rot_1; - b->dth_rot = b->dth_rot_1; - b->isLinear = b->isLinear_1; - } -} -void Shape::revert_expos_2(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - b->expo = b->expo_2; - b->expoh = b->expoh_2; - b->dt_rot = b->dt_rot_2; - b->dth_rot = b->dth_rot_2; - b->isLinear = b->isLinear_2; - } -} - -// Calculators -void Shape::calculate_I_inv(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - double I11 = b->I[1]*b->I[1]; - double I22 = b->I[2]*b->I[2]; - double I44 = b->I[4]*b->I[4]; - - double I24 = b->I[2]*b->I[4]; - double I35 = b->I[3]*b->I[5]; - - double D = 1./(b->I[0]*I35 + 2*b->I[1]*I24 - b->I[0]*I44 - b->I[3]*I22 - b->I[5]*I11); - - b->I_inv[0] = D * (I35-I44); - b->I_inv[1] = D * (I24-b->I[1]*b->I[5]); - b->I_inv[2] = D * (b->I[1]*b->I[4]-b->I[3]*b->I[2]); - b->I_inv[3] = D * (b->I[0]*b->I[5]-I22); - b->I_inv[4] = D * (b->I[1]*b->I[2]-b->I[0]*b->I[4]); - b->I_inv[5] = D * (b->I[0]*b->I[3]-I11); - } - else if(b->particle_type == 2) { - b->I_inv[0] = 1./b->I[0]; - b->I_inv[1] = 0; - b->I_inv[2] = 0; - b->I_inv[3] = 1./b->I[3]; - b->I_inv[4] = 0; - b->I_inv[5] = 1./b->I[5]; - } - } -} -void Shape::calculate_I_inv_and_w(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - double I11 = b->I[1]*b->I[1]; - double I22 = b->I[2]*b->I[2]; - double I44 = b->I[4]*b->I[4]; - - double I24 = b->I[2]*b->I[4]; - double I35 = b->I[3]*b->I[5]; - - double D = 1./(b->I[0]*I35 + 2*b->I[1]*I24 - b->I[0]*I44 - b->I[3]*I22 - b->I[5]*I11); - - b->I_inv[0] = D * (I35-I44); - b->I_inv[1] = D * (I24-b->I[1]*b->I[5]); - b->I_inv[2] = D * (b->I[1]*b->I[4]-b->I[3]*b->I[2]); - b->I_inv[3] = D * (b->I[0]*b->I[5]-I22); - b->I_inv[4] = D * (b->I[1]*b->I[2]-b->I[0]*b->I[4]); - b->I_inv[5] = D * (b->I[0]*b->I[3]-I11); - - b->w[0] = b->I_inv[0]*b->L[0] + b->I_inv[1]*b->L[1] + b->I_inv[2]*b->L[2]; - b->w[1] = b->I_inv[1]*b->L[0] + b->I_inv[3]*b->L[1] + b->I_inv[4]*b->L[2]; - b->w[2] = b->I_inv[2]*b->L[0] + b->I_inv[4]*b->L[1] + b->I_inv[5]*b->L[2]; - } - else if(b->particle_type == 2) { - b->I_inv[0] = 1./b->I[0]; - b->I_inv[1] = 0; - b->I_inv[2] = 0; - b->I_inv[3] = 1./b->I[3]; - b->I_inv[4] = 0; - b->I_inv[5] = 1./b->I[5]; - - b->w[0] = b->I_inv[0]*b->L[0] + b->I_inv[1]*b->L[1] + b->I_inv[2]*b->L[2]; - b->w[1] = b->I_inv[1]*b->L[0] + b->I_inv[3]*b->L[1] + b->I_inv[4]*b->L[2]; - b->w[2] = b->I_inv[2]*b->L[0] + b->I_inv[4]*b->L[1] + b->I_inv[5]*b->L[2]; - } - } -} - -void Shape::calculate_J_inv_and_w(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - double I11 = b->J[1]*b->J[1]; - double I22 = b->J[2]*b->J[2]; - double I44 = b->J[4]*b->J[4]; - - double I24 = b->J[2]*b->J[4]; - double I35 = b->J[3]*b->J[5]; - - double D = 1./(b->J[0]*I35 + 2*b->J[1]*I24 - b->J[0]*I44 - b->J[3]*I22 - b->J[5]*I11); - - b->J_inv[0] = D * (I35-I44); - b->J_inv[1] = D * (I24-b->J[1]*b->J[5]); - b->J_inv[2] = D * (b->J[1]*b->J[4]-b->J[3]*b->J[2]); - b->J_inv[3] = D * (b->J[0]*b->J[5]-I22); - b->J_inv[4] = D * (b->J[1]*b->J[2]-b->J[0]*b->J[4]); - b->J_inv[5] = D * (b->J[0]*b->J[3]-I11); - - b->w[0] = b->J_inv[0]*b->L[0] + b->J_inv[1]*b->L[1] + b->J_inv[2]*b->L[2]; - b->w[1] = b->J_inv[1]*b->L[0] + b->J_inv[3]*b->L[1] + b->J_inv[4]*b->L[2]; - b->w[2] = b->J_inv[2]*b->L[0] + b->J_inv[4]*b->L[1] + b->J_inv[5]*b->L[2]; - } - else if(b->particle_type == 2) { - b->J_inv[0] = 1./b->J[0]; - b->J_inv[1] = 0; - b->J_inv[2] = 0; - b->J_inv[3] = 1./b->J[3]; - b->J_inv[4] = 0; - b->J_inv[5] = 1./b->J[5]; - - b->w[0] = b->J_inv[0]*b->L[0] + b->J_inv[1]*b->L[1] + b->J_inv[2]*b->L[2]; - b->w[1] = b->J_inv[1]*b->L[0] + b->J_inv[3]*b->L[1] + b->J_inv[4]*b->L[2]; - b->w[2] = b->J_inv[2]*b->L[0] + b->J_inv[4]*b->L[1] + b->J_inv[5]*b->L[2]; - } - } -} - -void Shape::calculate_I_inv_and_w_with_K(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - double I11 = b->I[1]*b->I[1]; - double I22 = b->I[2]*b->I[2]; - double I44 = b->I[4]*b->I[4]; - - double I24 = b->I[2]*b->I[4]; - double I35 = b->I[3]*b->I[5]; - - double D = 1./(b->I[0]*I35 + 2*b->I[1]*I24 - b->I[0]*I44 - b->I[3]*I22 - b->I[5]*I11); - - b->I_inv[0] = D * (I35-I44); - b->I_inv[1] = D * (I24-b->I[1]*b->I[5]); - b->I_inv[2] = D * (b->I[1]*b->I[4]-b->I[3]*b->I[2]); - b->I_inv[3] = D * (b->I[0]*b->I[5]-I22); - b->I_inv[4] = D * (b->I[1]*b->I[2]-b->I[0]*b->I[4]); - b->I_inv[5] = D * (b->I[0]*b->I[3]-I11); - - b->w[0] = b->I_inv[0]*b->K[0] + b->I_inv[1]*b->K[1] + b->I_inv[2]*b->K[2]; - b->w[1] = b->I_inv[1]*b->K[0] + b->I_inv[3]*b->K[1] + b->I_inv[4]*b->K[2]; - b->w[2] = b->I_inv[2]*b->K[0] + b->I_inv[4]*b->K[1] + b->I_inv[5]*b->K[2]; - } - else if(b->particle_type == 2) { - b->I_inv[0] = 1./b->I[0]; - b->I_inv[1] = 0; - b->I_inv[2] = 0; - b->I_inv[3] = 1./b->I[3]; - b->I_inv[4] = 0; - b->I_inv[5] = 1./b->I[5]; - - b->w[0] = b->I_inv[0]*b->K[0] + b->I_inv[1]*b->K[1] + b->I_inv[2]*b->K[2]; - b->w[1] = b->I_inv[1]*b->K[0] + b->I_inv[3]*b->K[1] + b->I_inv[4]*b->K[2]; - b->w[2] = b->I_inv[2]*b->K[0] + b->I_inv[4]*b->K[1] + b->I_inv[5]*b->K[2]; - } - } -} -void Shape::calculate_J_inv_and_w_with_K(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - double I11 = b->J[1]*b->J[1]; - double I22 = b->J[2]*b->J[2]; - double I44 = b->J[4]*b->J[4]; - - double I24 = b->J[2]*b->J[4]; - double I35 = b->J[3]*b->J[5]; - - double D = 1./(b->J[0]*I35 + 2*b->J[1]*I24 - b->J[0]*I44 - b->J[3]*I22 - b->J[5]*I11); - - b->J_inv[0] = D * (I35-I44); - b->J_inv[1] = D * (I24-b->J[1]*b->J[5]); - b->J_inv[2] = D * (b->J[1]*b->J[4]-b->J[3]*b->J[2]); - b->J_inv[3] = D * (b->J[0]*b->J[5]-I22); - b->J_inv[4] = D * (b->J[1]*b->J[2]-b->J[0]*b->J[4]); - b->J_inv[5] = D * (b->J[0]*b->J[3]-I11); - - b->w[0] = b->J_inv[0]*b->K[0] + b->J_inv[1]*b->K[1] + b->J_inv[2]*b->K[2]; - b->w[1] = b->J_inv[1]*b->K[0] + b->J_inv[3]*b->K[1] + b->J_inv[4]*b->K[2]; - b->w[2] = b->J_inv[2]*b->K[0] + b->J_inv[4]*b->K[1] + b->J_inv[5]*b->K[2]; - } - else if(b->particle_type == 2) { - b->J_inv[0] = 1./b->J[0]; - b->J_inv[1] = 0; - b->J_inv[2] = 0; - b->J_inv[3] = 1./b->J[3]; - b->J_inv[4] = 0; - b->J_inv[5] = 1./b->J[5]; - - b->w[0] = b->J_inv[0]*b->K[0] + b->J_inv[1]*b->K[1] + b->J_inv[2]*b->K[2]; - b->w[1] = b->J_inv[1]*b->K[0] + b->J_inv[3]*b->K[1] + b->J_inv[4]*b->K[2]; - b->w[2] = b->J_inv[2]*b->K[0] + b->J_inv[4]*b->K[1] + b->J_inv[5]*b->K[2]; - } - } -} - -// Evolvers -void Shape::kick_linear(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - b->I_n[0] = b->I_e[0] + b->tau*( 2*b->I_e[2]*b->w[1] - 2*b->I_e[1]*b->w[2] - b->dI_e[0] ); - b->I_n[3] = b->I_e[3] + b->tau*(-2*b->I_e[4]*b->w[0] + 2*b->I_e[1]*b->w[2] - b->dI_e[3] ); - b->I_n[1] = b->I_e[1] + b->tau*( -b->I_e[2]*b->w[0] + b->I_e[4]*b->w[1] + (b->I_e[0]-b->I_e[3])*b->w[2] - b->dI_e[1]); - b->I_n[2] = b->I_e[2] + b->tau*( b->I_e[1]*b->w[0] - (2*b->I_e[0]+b->I_e[3])*b->w[1] - b->I_e[4]*b->w[2] - b->dI_e[2] ); - b->I_n[4] = b->I_e[4] + b->tau*( (b->I_e[0]+2*b->I_e[3])*b->w[0] - b->I_e[1]*b->w[1] + b->I_e[2]*b->w[2] - b->dI_e[4] ); - - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - - for(int i=0; i<6; i++) { - b->I[i] = b->I_p[i] + b->I_n[i]; - } - } - } -} -void Shape::kick_linear_J(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - b->J_n[0] = b->I_e[0] + b->tau*( 2*b->I_e[2]*b->w[1] - 2*b->I_e[1]*b->w[2] - b->dI_e[0] ); - b->J_n[3] = b->I_e[3] + b->tau*(-2*b->I_e[4]*b->w[0] + 2*b->I_e[1]*b->w[2] - b->dI_e[3] ); - b->J_n[1] = b->I_e[1] + b->tau*( -b->I_e[2]*b->w[0] + b->I_e[4]*b->w[1] + (b->I_e[0]-b->I_e[3])*b->w[2] - b->dI_e[1]); - b->J_n[2] = b->I_e[2] + b->tau*( b->I_e[1]*b->w[0] - (2*b->I_e[0]+b->I_e[3])*b->w[1] - b->I_e[4]*b->w[2] - b->dI_e[2] ); - b->J_n[4] = b->I_e[4] + b->tau*( (b->I_e[0]+2*b->I_e[3])*b->w[0] - b->I_e[1]*b->w[1] + b->I_e[2]*b->w[2] - b->dI_e[4] ); - - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - - for(int i=0; i<6; i++) { - b->J[i] = b->I_p[i] + b->J_n[i]; - } - } - } -} - -void Shape::kick_linear_discrete(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - for(int k=0; k<5; k++) { - b->dI_e[k] = (b->I_e[k]-b->I_e_prev[k]) / dt; - } - - b->I_n[0] = b->I_e[0] + b->tau*( 2*b->I_e[2]*b->w[1] - 2*b->I_e[1]*b->w[2] - b->dI_e[0] ); - b->I_n[3] = b->I_e[3] + b->tau*(-2*b->I_e[4]*b->w[0] + 2*b->I_e[1]*b->w[2] - b->dI_e[3] ); - b->I_n[1] = b->I_e[1] + b->tau*( -b->I_e[2]*b->w[0] + b->I_e[4]*b->w[1] + (b->I_e[0]-b->I_e[3])*b->w[2] - b->dI_e[1]); - b->I_n[2] = b->I_e[2] + b->tau*( b->I_e[1]*b->w[0] - (2*b->I_e[0]+b->I_e[3])*b->w[1] - b->I_e[4]*b->w[2] - b->dI_e[2] ); - b->I_n[4] = b->I_e[4] + b->tau*( (b->I_e[0]+2*b->I_e[3])*b->w[0] - b->I_e[1]*b->w[1] + b->I_e[2]*b->w[2] - b->dI_e[4] ); - - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - - for(int i=0; i<6; i++) { - b->I[i] = b->I_p[i] + b->I_n[i]; - } - } - } -} -void Shape::kick_linear_discrete_J(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - for(int k=0; k<5; k++) { - b->dI_e[k] = (b->I_e[k]-b->I_e_prev[k]) / dt; - } - - b->J_n[0] = b->I_e[0] + b->tau*( 2*b->I_e[2]*b->w[1] - 2*b->I_e[1]*b->w[2] - b->dI_e[0] ); - b->J_n[3] = b->I_e[3] + b->tau*(-2*b->I_e[4]*b->w[0] + 2*b->I_e[1]*b->w[2] - b->dI_e[3] ); - b->J_n[1] = b->I_e[1] + b->tau*( -b->I_e[2]*b->w[0] + b->I_e[4]*b->w[1] + (b->I_e[0]-b->I_e[3])*b->w[2] - b->dI_e[1]); - b->J_n[2] = b->I_e[2] + b->tau*( b->I_e[1]*b->w[0] - (2*b->I_e[0]+b->I_e[3])*b->w[1] - b->I_e[4]*b->w[2] - b->dI_e[2] ); - b->J_n[4] = b->I_e[4] + b->tau*( (b->I_e[0]+2*b->I_e[3])*b->w[0] - b->I_e[1]*b->w[1] + b->I_e[2]*b->w[2] - b->dI_e[4] ); - - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - - for(int i=0; i<6; i++) { - b->J[i] = b->I_p[i] + b->J_n[i]; - } - } - } -} - -void Shape::kick_direct(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - for(int k=0; k<5; k++) { - b->I_n[k] += b->dI_n[k]*dt; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - - for(int k=0; k<6; k++) { - b->I[k] = b->I_p[k] + b->I_n[k]; - } - } - } -} -void Shape::kick_direct_J(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - for(int k=0; k<5; k++) { - b->J_n[k] += b->dI_n[k]*dt; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - - for(int k=0; k<6; k++) { - b->J[k] = b->I_p[k] + b->J_n[k]; - } - } - } -} - -void Shape::deform_and_rotate(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - if(b->tau > 0) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - double w = sqrt(w2); - - double dt_step = b->dt_rot; - - double wdt = 0.5*w*dt_step; - double cosa = cos(wdt); - double sina = sin(wdt); - - array q0 = {}; - q0[0] = 1.; - - if(w > 0) { - double w_1 = 1/w; - - q0[0] = cosa; - q0[1] = sina*b->w[0]*w_1; - q0[2] = sina*b->w[1]*w_1; - q0[3] = sina*b->w[2]*w_1; - } - - if(b->isLinear) { - for(int k=0; k<5; k++) { - double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; - b->I_n[k] = b->I_e[k] - b->tau*dIe; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - - array I2 = {}; - rotate_tensor(q0, b->I_n, I2); - for(int k=0; k<5; k++) { - b->I_n[k] = I2[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - } - else { - double expo = b->expo; - - if(dt < 0) { - array I1 = {}; - rotate_tensor(q0, b->I_n, I1); - for(int k=0; k<5; k++) { - b->I_n[k] = I1[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - } - - for(int k=0; k<5; k++) { - double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; - b->I_n[k] = b->I_e[k] + (b->I_n[k] - b->I_e_prev[k])*expo - b->tau*dIe*(1-expo); - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - - if(dt > 0) { - array I2 = {}; - rotate_tensor(q0, b->I_n, I2); - for(int k=0; k<5; k++) { - b->I_n[k] = I2[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - } - } - } - else { - for(int k=0; k<5; k++) { - b->I_n[k] = b->I_e[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - } - - for(int k=0; k<6; k++) { - b->I[k] = b->I_p[k] + b->I_n[k]; - } - } - } -} -void Shape::deform_and_rotate_half(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - if(b->tau > 0) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - double w = sqrt(w2); - - double dt_step = b->dth_rot; - - double wdt = 0.5*w*dt_step; - double cosa = cos(wdt); - double sina = sin(wdt); - - array q0 = {}; - q0[0] = 1.; - - if(w > 0) { - double w_1 = 1/w; - - q0[0] = cosa; - q0[1] = sina*b->w[0]*w_1; - q0[2] = sina*b->w[1]*w_1; - q0[3] = sina*b->w[2]*w_1; - } - - if(b->isLinear) { - for(int k=0; k<5; k++) { - double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; - b->I_n[k] = b->I_e[k] - b->tau*dIe; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - - array I2 = {}; - rotate_tensor(q0, b->I_n, I2); - for(int k=0; k<5; k++) { - b->I_n[k] = I2[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - } - else { - double expo = b->expoh; - - if(dt < 0) { - array I1 = {}; - rotate_tensor(q0, b->I_n, I1); - for(int k=0; k<5; k++) { - b->I_n[k] = I1[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - } - - for(int k=0; k<5; k++) { - double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; - b->I_n[k] = b->I_e[k] + (b->I_n[k] - b->I_e_prev[k])*expo - b->tau*dIe*(1-expo); - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - - if(dt > 0) { - array I2 = {}; - rotate_tensor(q0, b->I_n, I2); - for(int k=0; k<5; k++) { - b->I_n[k] = I2[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - } - } - } - else { - for(int k=0; k<5; k++) { - b->I_n[k] = b->I_e[k]; - } - b->I_n[5] = -(b->I_n[0]+b->I_n[3]); - } - - for(int k=0; k<6; k++) { - b->I[k] = b->I_p[k] + b->I_n[k]; - } - } - } -} - -void Shape::deform_and_rotate_J(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - if(b->tau > 0) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - double w = sqrt(w2); - - double dt_step = b->dt_rot; - - double wdt = 0.5*w*dt_step; - double cosa = cos(wdt); - double sina = sin(wdt); - - array q0 = {}; - q0[0] = 1.; - - if(w > 0) { - double w_1 = 1/w; - - q0[0] = cosa; - q0[1] = sina*b->w[0]*w_1; - q0[2] = sina*b->w[1]*w_1; - q0[3] = sina*b->w[2]*w_1; - } - - if(b->isLinear) { - for(int k=0; k<5; k++) { - double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; - b->J_n[k] = b->I_e[k] - b->tau*dIe; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - - array I2 = {}; - rotate_tensor(q0, b->J_n, I2); - for(int k=0; k<5; k++) { - b->J_n[k] = I2[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - } - else { - double expo = b->expo; - - if(dt < 0) { - array I1 = {}; - rotate_tensor(q0, b->J_n, I1); - for(int k=0; k<5; k++) { - b->J_n[k] = I1[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - } - - for(int k=0; k<5; k++) { - double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; - b->J_n[k] = b->I_e[k] + (b->J_n[k] - b->I_e_prev[k])*expo - b->tau*dIe*(1-expo); - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - - if(dt > 0) { - array I2 = {}; - rotate_tensor(q0, b->J_n, I2); - for(int k=0; k<5; k++) { - b->J_n[k] = I2[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - } - } - } - else { - for(int k=0; k<5; k++) { - b->J_n[k] = b->I_e[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - } - - for(int k=0; k<6; k++) { - b->J[k] = b->I_p[k] + b->J_n[k]; - } - } - } -} -void Shape::deform_and_rotate_J_half(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - if(b->tau > 0) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - double w = sqrt(w2); - - double dt_step = b->dth_rot; - - double wdt = 0.5*w*dt_step; - double cosa = cos(wdt); - double sina = sin(wdt); - - array q0 = {}; - q0[0] = 1.; - - if(w > 0) { - double w_1 = 1/w; - - q0[0] = cosa; - q0[1] = sina*b->w[0]*w_1; - q0[2] = sina*b->w[1]*w_1; - q0[3] = sina*b->w[2]*w_1; - } - - if(b->isLinear) { - for(int k=0; k<5; k++) { - double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; - b->J_n[k] = b->I_e[k] - b->tau*dIe; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - - array I2 = {}; - rotate_tensor(q0, b->J_n, I2); - for(int k=0; k<5; k++) { - b->J_n[k] = I2[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - } - else { - double expo = b->expoh; - - if(dt < 0) { - array I1 = {}; - rotate_tensor(q0, b->J_n, I1); - for(int k=0; k<5; k++) { - b->J_n[k] = I1[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - } - - for(int k=0; k<5; k++) { - double dIe = (b->I_e[k]-b->I_e_prev[k])/dt; - b->J_n[k] = b->I_e[k] + (b->J_n[k] - b->I_e_prev[k])*expo - b->tau*dIe*(1-expo); - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - - if(dt > 0) { - array I2 = {}; - rotate_tensor(q0, b->J_n, I2); - for(int k=0; k<5; k++) { - b->J_n[k] = I2[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - } - } - } - else { - for(int k=0; k<5; k++) { - b->J_n[k] = b->I_e[k]; - } - b->J_n[5] = -(b->J_n[0]+b->J_n[3]); - } - - for(int k=0; k<6; k++) { - b->J[k] = b->I_p[k] + b->J_n[k]; - } - } - } -} - -void Shape::rotate_tensor(array &q, array &A, array &B) { - // Quaternion to Rotation matrix - double q00 = q[0] * q[0]; - double q11 = q[1] * q[1]; - double q22 = q[2] * q[2]; - double q33 = q[3] * q[3]; - double q01 = q[0] * q[1]; - double q02 = q[0] * q[2]; - double q03 = q[0] * q[3]; - double q12 = q[1] * q[2]; - double q13 = q[1] * q[3]; - double q23 = q[2] * q[3]; - - double r00 = 2 * (q00 + q11) - 1; - double r01 = 2 * (q12 - q03); - double r02 = 2 * (q13 + q02); - - double r10 = 2 * (q12 + q03); - double r11 = 2 * (q00 + q22) - 1; - double r12 = 2 * (q23 - q01); - - double r20 = 2 * (q13 - q02); - double r21 = 2 * (q23 + q01); - double r22 = 2 * (q00 + q33) - 1; - - // RA - double x00 = r00*A[0]+r01*A[1]+r02*A[2]; - double x01 = r00*A[1]+r01*A[3]+r02*A[4]; - double x02 = r00*A[2]+r01*A[4]+r02*A[5]; - - double x10 = r10*A[0]+r11*A[1]+r12*A[2]; - double x11 = r10*A[1]+r11*A[3]+r12*A[4]; - double x12 = r10*A[2]+r11*A[4]+r12*A[5]; - - // RAR^T - B[0] = x00*r00+x01*r01+x02*r02; - B[1] = x00*r10+x01*r11+x02*r12; - B[2] = x00*r20+x01*r21+x02*r22; - B[3] = x10*r10+x11*r11+x12*r12; - B[4] = x10*r20+x11*r21+x12*r22; -} - -void Shape::copy_I_e_r_to_I_e_rh(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->I_e_rh[k] = b->I_e_r[k]; - } - } -} - -void Shape::copy_I_to_J(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->J_n[k] = b->I_n[k]; - b->J[k] = b->I[k]; - } - } -} - -void Shape::memorize_I(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->I_n_prev[k] = b->I_n[k]; - } - } -} -void Shape::reset_I(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->I_n[k] = b->I_n_prev[k]; - b->I[k] = b->I_p[k] + b->I_n[k]; - } - } -} - -void Shape::memorize_J(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->I_n_prev[k] = b->J_n[k]; - } - } -} -void Shape::reset_J(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->J_n[k] = b->I_n_prev[k]; - b->J[k] = b->I_p[k] + b->J_n[k]; - } - } -} - -void Shape::backup_I_e(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->I_e_prev_bu[k] = b->I_e[k]; - } - } -} -void Shape::set_I_e_prev_to_backup(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<6; k++) { - b->I_e_prev[k] = b->I_e_prev_bu[k]; - } - } -} - - - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Spin.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Spin.cpp deleted file mode 100755 index 3e8ce9a38b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Spin.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include "Spin.h" - -// Initializers -Spin::Spin() { - ; -} - -// Calculators -void Spin::calculate_w(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - b->w[0] = b->I_inv[0]*b->L[0] + b->I_inv[1]*b->L[1] + b->I_inv[2]*b->L[2]; - b->w[1] = b->I_inv[1]*b->L[0] + b->I_inv[3]*b->L[1] + b->I_inv[4]*b->L[2]; - b->w[2] = b->I_inv[2]*b->L[0] + b->I_inv[4]*b->L[1] + b->I_inv[5]*b->L[2]; - } - else { - b->w[0] = 0; - b->w[1] = 0; - b->w[2] = 0; - } - } -} -void Spin::calculate_w_with_J(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - b->w[0] = b->J_inv[0]*b->L[0] + b->J_inv[1]*b->L[1] + b->J_inv[2]*b->L[2]; - b->w[1] = b->J_inv[1]*b->L[0] + b->J_inv[3]*b->L[1] + b->J_inv[4]*b->L[2]; - b->w[2] = b->J_inv[2]*b->L[0] + b->J_inv[4]*b->L[1] + b->J_inv[5]*b->L[2]; - } - else { - b->w[0] = 0; - b->w[1] = 0; - b->w[2] = 0; - } - } -} -void Spin::calculate_w_with_K(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - b->w[0] = b->I_inv[0]*b->K[0] + b->I_inv[1]*b->K[1] + b->I_inv[2]*b->K[2]; - b->w[1] = b->I_inv[1]*b->K[0] + b->I_inv[3]*b->K[1] + b->I_inv[4]*b->K[2]; - b->w[2] = b->I_inv[2]*b->K[0] + b->I_inv[4]*b->K[1] + b->I_inv[5]*b->K[2]; - } - else { - b->w[0] = 0; - b->w[1] = 0; - b->w[2] = 0; - } - } -} - -void Spin::calculate_L(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - b->L[0] = b->I[0]*b->w[0]+b->I[1]*b->w[1]+b->I[2]*b->w[2]; - b->L[1] = b->I[1]*b->w[0]+b->I[3]*b->w[1]+b->I[4]*b->w[2]; - b->L[2] = b->I[2]*b->w[0]+b->I[4]*b->w[1]+b->I[5]*b->w[2]; - } - else { - b->L[0] = 0; - b->L[1] = 0; - b->L[2] = 0; - } - } -} -void Spin::init_K(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - b->K[k] = b->L[k]; - } - } -} - -void Spin::memorize_w(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - b->w_prev[k] = b->w[k]; - } - } -} -void Spin::reset_w(vector &bodies) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - for(int k=0; k<3; k++) { - b->w[k] = b->w_prev[k]; - } - } -} - -void Spin::kick_L(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - for(int k=0; k<3; k++) { - b->L[k] += b->T[k]*dt; - } - } - } -} -void Spin::kick_K(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - for(int k=0; k<3; k++) { - b->K[k] += b->T[k]*dt; - } - } - } -} - -void Spin::kick_L_mb(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - if(b->a_mb > 0) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - - //double expo = exp(-b->a_mb * w2 * dt); - //for(int k=0; k<3; k++) { - // b->L[k] = b->L[k] * expo; - //} - - double x = b->a_mb * w2 * dt; - for(int k=0; k<3; k++) { - b->L[k] = b->L[k] * (1-x); - } - } - } - } -} -void Spin::kick_K_mb(vector &bodies, double dt) { - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - if(b->a_mb > 0) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - - //double expo = exp(-b->a_mb * w2 * dt); - //for(int k=0; k<3; k++) { - // b->K[k] = b->K[k] * expo; - //} - - double x = b->a_mb * w2 * dt; - for(int k=0; k<3; k++) { - b->K[k] = b->K[k] * (1-x); - } - } - } - } -} - -// Diagnostics -double Spin::get_kinetic_energy(vector &bodies) { - double E = 0; - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - double dwxIdwx = b->w[0]*(b->w[0]*b->I[0] + b->w[1]*b->I[1] + b->w[2]*b->I[2]); - double dwyIdwy = b->w[1]*(b->w[0]*b->I[1] + b->w[1]*b->I[3] + b->w[2]*b->I[4]); - double dwzIdwz = b->w[2]*(b->w[0]*b->I[2] + b->w[1]*b->I[4] + b->w[2]*b->I[5]); - double myE = 0.5 * (dwxIdwx + dwyIdwy + dwzIdwz); - E += myE; - } - } - return E; -} - -array Spin::get_angular_momentum(vector &bodies) { - array L = {}; - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type >= 2) { - double Lx = b->I[0]*b->w[0] + b->I[1]*b->w[1] + b->I[2]*b->w[2]; - double Ly = b->I[1]*b->w[0] + b->I[3]*b->w[1] + b->I[4]*b->w[2]; - double Lz = b->I[2]*b->w[0] + b->I[4]*b->w[1] + b->I[5]*b->w[2]; - L[0] += Lx; - L[1] += Ly; - L[2] += Lz; - } - } - return L; -} - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Tidy.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Tidy.cpp deleted file mode 100755 index bb39797631..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Tidy.cpp +++ /dev/null @@ -1,589 +0,0 @@ -#include "Tidy.h" - -// Setters and Getters -void Tidy::set_model_time(double t) { - this->t = t; -} -double Tidy::get_model_time() { - return t; -} - -void Tidy::set_particles(vector &bodies) { - this->bodies.clear(); - this->bodies = bodies; -} -void Tidy::set_particles(vector< array > &d) { - this->bodies.clear(); - - int N = d.size(); - this->bodies.resize(N); - - for(int i=0; i &name, vector &id, vector< array > &d) { - this->bodies.clear(); - - int N = d.size(); - this->bodies.resize(N); - - for(int i=0; i Tidy::get_particles() { - return this->bodies; -} - -void Tidy::set_tidal_model(int tidal_model) { - this->tidal_model = tidal_model; -} -int Tidy::get_tidal_model() { - return tidal_model; -} - -void Tidy::set_collision_mode(int collision_mode) { - this->collision_mode = collision_mode; -} -int Tidy::get_collision_mode() { - return collision_mode; -} - -void Tidy::set_roche_mode(int roche_mode) { - this->roche_mode = roche_mode; -} -int Tidy::get_roche_mode() { - return roche_mode; -} - -void Tidy::set_encounter_mode() { - encounter_mode = 0; - if(collision_mode > 0 || roche_mode > 0) encounter_mode = 1; -} -int Tidy::get_encounter_mode() { - return encounter_mode; -} - -void Tidy::set_pn_order(int pn_order) { - this->pn_order = pn_order; -} -int Tidy::get_pn_order() { - return pn_order; -} - -void Tidy::set_speed_of_light(double c) { - this->speed_of_light = c; -} -double Tidy::get_speed_of_light() { - return speed_of_light; -} - -void Tidy::set_magnetic_braking(int b) { - this->magnetic_braking = b; -} -int Tidy::get_magnetic_braking() { - return magnetic_braking; -} - -void Tidy::set_dt_mode(int dt_mode) { - this->dt_mode = dt_mode; -} -double Tidy::get_dt_mode() { - return dt_mode; -} - -void Tidy::set_dt_const(double dt_const) { - this->dt_const = dt_const; -} -double Tidy::get_dt_const() { - return dt_const; -} - -void Tidy::set_eta(double eta) { - this->eta = eta; -} -double Tidy::get_eta() { - return eta; -} - -void Tidy::set_dt_prev(double dt_prev) { - timestep_ptr->set_dt_prev(dt_prev); - this->dt_prev = timestep_ptr->dt_prev; -} -double Tidy::get_dt_prev() { - this->dt_prev = timestep_ptr->dt_prev; - return dt_prev; -} - -void Tidy::set_n_iter(int n_iter) { - this->n_iter = n_iter; -} -int Tidy::get_n_iter() { - this->n_iter = evolver_ptr->n_iter; - return this->n_iter; -} - -void Tidy::set_num_integration_step(int num_integration_step) { - this->num_integration_step = num_integration_step; -} -int Tidy::get_num_integration_step() { - return num_integration_step; -} - -void Tidy::set_dt_sgn(int dt_sgn) { - this->dt_sgn = dt_sgn; - timestep_ptr->set_dt_sgn(this->dt_sgn); -} - -// Initializers -Tidy::Tidy() { - t = 0.; - bodies.clear(); - - tidal_model = 0; - - collision_mode = 0; - roche_mode = 0; - encounter_mode = 0; - - pn_order = 0; - speed_of_light = 1e100; - - magnetic_braking = 0; - - dt_mode = 1; - dt_const = 0.015625; - eta = 0.0625; - num_integration_step = 0; - - n_iter = 1; -} -Tidy::~Tidy() { - ; -} - -// Committers -void Tidy::commit_parameters() { - set_encounter_mode(); - set_pointers(); - upload_parameters(); - initialize(); - this->dt_prev = timestep_ptr->dt_prev; -} -void Tidy::commit_particles() { - int N = bodies.size(); - for(int i=0; iinitialize(bodies, force_ptr); - } - else { - commit_parameters(); - } -} -void Tidy::set_pointers() { - force_ptr = &force; - - switch(dt_mode) { - case 0: - timestep_ptr = ×tep_const; - break; - case 1: - if(this->tidal_model == 3) { - timestep_ptr = ×tep_direct; - } - else { - timestep_ptr = ×tep_adapt; - } - break; - default: - if(this->tidal_model == 3) { - timestep_ptr = ×tep_direct_weight; - } - else { - timestep_ptr = ×tep_adapt_weight; - } - break; - } - - switch(tidal_model) { - case 0: - switch(encounter_mode) { - case 0: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_nbody; - break; - default: - evolver_ptr = &evolver_nbody; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_nbody_pn; - break; - default: - evolver_ptr = &evolver_nbody_pn; - break; - } - break; - } - break; - default: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_nbody_col; - break; - default: - evolver_ptr = &evolver_nbody_col; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_nbody_col_pn; - break; - default: - evolver_ptr = &evolver_nbody_col_pn; - break; - } - break; - } - break; - } - break; - case 1: - switch(encounter_mode) { - case 0: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_equilibrium; - break; - default: - evolver_ptr = &evolver_equilibrium_mb; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_equilibrium_pn; - break; - default: - evolver_ptr = &evolver_equilibrium_pn_mb; - break; - } - break; - } - break; - default: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_equilibrium_col; - break; - default: - evolver_ptr = &evolver_equilibrium_col_mb; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_equilibrium_col_pn; - break; - default: - evolver_ptr = &evolver_equilibrium_col_pn_mb; - break; - } - break; - } - break; - } - break; - case 2: - switch(encounter_mode) { - case 0: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_linear; - break; - default: - evolver_ptr = &evolver_linear_mb; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_linear_pn; - break; - default: - evolver_ptr = &evolver_linear_pn_mb; - break; - } - break; - } - break; - default: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_linear_col; - break; - default: - evolver_ptr = &evolver_linear_col_mb; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_linear_col_pn; - break; - default: - evolver_ptr = &evolver_linear_col_pn_mb; - break; - } - break; - } - break; - } - break; - case 3: - switch(encounter_mode) { - case 0: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_direct; - break; - default: - evolver_ptr = &evolver_direct_mb; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_direct_pn; - break; - default: - evolver_ptr = &evolver_direct_pn_mb; - break; - } - break; - } - break; - default: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_direct_col; - break; - default: - evolver_ptr = &evolver_direct_col_mb; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_direct_col_pn; - break; - default: - evolver_ptr = &evolver_direct_col_pn_mb; - break; - } - break; - } - break; - } - break; - default: - switch(encounter_mode) { - case 0: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_creep; - break; - default: - evolver_ptr = &evolver_creep_mb; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_creep_pn; - break; - default: - evolver_ptr = &evolver_creep_pn_mb; - break; - } - break; - } - break; - default: - switch(pn_order) { - case 0: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_creep_col; - break; - default: - evolver_ptr = &evolver_creep_col_mb; - break; - } - break; - default: - switch(magnetic_braking) { - case 0: - evolver_ptr = &evolver_creep_col_pn; - break; - default: - evolver_ptr = &evolver_creep_col_pn_mb; - break; - } - break; - } - break; - } - break; - } -} - -void Tidy::upload_parameters() { - force_ptr->set_pn_order(pn_order); - force_ptr->set_speed_of_light(speed_of_light); - - timestep_ptr->set_dt_const(dt_const); - timestep_ptr->set_eta(eta); - - evolver_ptr->set_n_iter(n_iter); - - evolver_ptr->set_collision_mode(collision_mode); - evolver_ptr->set_roche_mode(roche_mode); -} -void Tidy::initialize() { - evolver_ptr->initialize(bodies, force_ptr); - timestep_ptr->initialize(bodies); -} - -// Collision handling -bool Tidy::is_collision_detected() { - return force_ptr->collision_detected; -} -vector< array > Tidy::get_collision_indices() { - return force_ptr->index_collisions; -} -bool Tidy::get_collision_flag() { - return evolver_ptr->collision_flag; -} - -bool Tidy::is_roche_detected() { - return force_ptr->roche_detected; -} -vector< array > Tidy::get_roche_indices() { - return force_ptr->index_roche; -} -bool Tidy::get_roche_flag() { - return evolver_ptr->roche_flag; -} - -// Shape handling -void Tidy::set_to_spherical_shape() { - shape.set_permanent_shape(bodies); - shape.set_to_spherical_shape(bodies); - shape.calculate_I_inv(bodies); -} -void Tidy::set_to_equilibrium_shape() { - force.update_tidal_deformation(bodies); - force.update_centrifugal_deformation(bodies); - force.update_equilibrium_tensor(bodies); - - shape.set_permanent_shape(bodies); - shape.set_to_equilibrium_shape(bodies); - shape.calculate_I_inv(bodies); -} -void Tidy::update_angular_momentum() { - spin.calculate_L(bodies); - spin.init_K(bodies); - shape.init_J(bodies); -} - -// Get diagnostics -array Tidy::get_center_of_mass() { - return evolver_ptr->get_center_of_mass(bodies); -} -array Tidy::get_center_of_mass_velocity() { - return evolver_ptr->get_center_of_mass_velocity(bodies); -} -array Tidy::get_orbital_angular_momentum() { - return evolver_ptr->get_orbital_angular_momentum(bodies); -} -array Tidy::get_spin_angular_momentum() { - return evolver_ptr->get_spin_angular_momentum(bodies); -} -double Tidy::get_orbital_kinetic_energy() { - return evolver_ptr->get_orbital_kinetic_energy(bodies); -} -double Tidy::get_spin_kinetic_energy() { - return evolver_ptr->get_spin_kinetic_energy(bodies); -} -double Tidy::get_potential_energy() { - return evolver_ptr->get_potential_energy(bodies); -} -array Tidy::get_angular_momentum() { - return evolver_ptr->get_angular_momentum(bodies); -} -double Tidy::get_energy() { - return evolver_ptr->get_energy(bodies); -} - -// Top level evolve functions -void Tidy::evolve_model(double t_end) { - evolver_ptr->assign_vectors(bodies, force_ptr); - timestep_ptr->set_dt_sgn(dt_sgn); - - evolver_ptr->evolve_model(t, t_end, bodies, force_ptr, timestep_ptr); - - num_integration_step += evolver_ptr->num_integration_step; -} -void Tidy::evolve_model(int N_step) { - evolver_ptr->assign_vectors(bodies, force_ptr); - timestep_ptr->set_dt_sgn(dt_sgn); - - evolver_ptr->evolve_model(t, N_step, bodies, force_ptr, timestep_ptr); - - num_integration_step += evolver_ptr->num_integration_step; -} - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timer.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timer.cpp deleted file mode 100755 index 759de9ac7e..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Timer.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "Timer.h" - -Timer::Timer() { - t_cpu = 0; - timerStarted = false; -} -void Timer::start() { - gettimeofday(&Tvalue,&dummy); - timerStarted = true; -} -void Timer::stop() { - if(timerStarted == false) t_cpu = 0; - else { - struct timeval Tvalue2; - struct timezone dummy2; - gettimeofday(&Tvalue2,&dummy2); - double startTime = ((double) Tvalue.tv_sec +1.e-6*((double) Tvalue.tv_usec)); - double endTime = ((double) Tvalue2.tv_sec +1.e-6*((double) Tvalue2.tv_usec)); - t_cpu = endTime-startTime; - timerStarted = false; - } -} -double Timer::read() { - if(timerStarted == false) t_cpu = 0; - else { - struct timeval Tvalue2; - struct timezone dummy2; - gettimeofday(&Tvalue2,&dummy2); - double startTime = ((double) Tvalue.tv_sec +1.e-6*((double) Tvalue.tv_usec)); - double endTime = ((double) Tvalue2.tv_sec +1.e-6*((double) Tvalue2.tv_usec)); - t_cpu = endTime-startTime; - } - return t_cpu; -} -double Timer::get() { - return t_cpu; -} - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt.cpp deleted file mode 100644 index 9d71d4b8b4..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "Timestep_adapt.h" - -// Calculators -void Timestep_adapt::calculate_shared_adaptive_minimum_timestep_orbital(vector &bodies) { - this->h = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - if(bi->particle_type > 0 || bj->particle_type > 0) { - - double mu = bi->m + bj->m; - - array dr, dv; - - for(int k=0; k<3; k++) { - dr[k] = bi->r[k] - bj->r[k]; - dv[k] = bi->v[k] - bj->v[k]; - } - - double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); - - double dr4 = dr2*dr2; - - double dt1_4 = mu*mu/(dr4*dr2); - double dt2_4 = dv2*dv2/dr4; - - double P_4 = max(dt1_4, dt2_4); - - if(P_4 > this->h) this->h = P_4; - } - } - } - - this->h = 1./sqrt(sqrt(this->h)); -} - -void Timestep_adapt::initialize(vector &bodies) { - ; -} -double Timestep_adapt::get_timestep(vector &bodies) { - calculate_shared_adaptive_minimum_timestep_orbital(bodies); - h *= eta; - h *= dt_sgn; - return h; -} - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt_weight.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt_weight.cpp deleted file mode 100644 index d26d1882b3..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_adapt_weight.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include "Timestep_adapt_weight.h" - -// Calculators -void Timestep_adapt_weight::calculate_shared_adaptive_weighted_timestep_orbital(vector &bodies) { - double wsum = 0; - double wh2sum = 0; - - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - if(bi->particle_type > 0 || bj->particle_type > 0) { - - double mu = bi->m + bj->m; - - array dr, dv; - - for(int k=0; k<3; k++) { - dr[k] = bi->r[k] - bj->r[k]; - dv[k] = bi->v[k] - bj->v[k]; - } - - double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); - - double dr4 = dr2*dr2; - - double dt1_4 = mu*mu/(dr4*dr2); - double dt2_4 = dv2*dv2/dr4; - - //--------------------------------------------------------------- - - double P_4 = dt1_4 + dt2_4; - double P_2 = sqrt(P_4); - double P_8 = P_4*P_4; - double P_10 = P_8*P_2; - - //--------------------------------------------------------------- - - double wh2 = P_8; - double w = P_10; - - //--------------------------------------------------------------- - - wsum += w; - wh2sum += wh2; - } - } - } - - this->h2 = eta2 * wh2sum/wsum; -} -void Timestep_adapt_weight::calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(vector &bodies) { - double h_8 = 0; - double h_10 = 0; - double h_9_dh = 0; - double h_11_dh = 0; - - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - if(bi->particle_type > 0 || bj->particle_type > 0) { - - double mu = bi->m + bj->m; - - array dr, dv, da; - - for(int k=0; k<3; k++) { - dr[k] = bj->r[k] - bi->r[k]; - dv[k] = bj->v[k] - bi->v[k]; - da[k] = bj->a[k] - bi->a[k]; - } - - double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); - - double rdotv = inner_product(dr.begin(), dr.end(), dv.begin(), 0.); - double vdota = inner_product(dv.begin(), dv.end(), da.begin(), 0.); - - //------------------------------------------ - - double h_4_ra = mu*mu/(dr2*dr2*dr2); - - double h_1_dh_ra = 1.5*rdotv/dr2; - double h_5_dh_ra = h_4_ra * h_1_dh_ra; - - //------------------------------------------ - - double h_2_rv = dv2/dr2; - double h_4_rv = h_2_rv*h_2_rv; - - double h_3_dh_rv = (rdotv * h_2_rv - vdota) / dr2; - double h_5_dh_rv = h_2_rv * h_3_dh_rv; - - //------------------------------------------ - - double T_4 = h_4_ra + h_4_rv; - - double T_8 = T_4*T_4; - double T_2 = sqrt(T_4); - double T_10 = T_8*T_2; - - double T_5_dT = h_5_dh_ra + h_5_dh_rv; - - double T_9_dT = T_4 * T_5_dT; - double T_11_dT = T_2 * T_9_dT; - - //------------------------------------------ - - h_8 += T_8; - h_10 += T_10; - - h_9_dh += T_9_dT; - h_11_dh += T_11_dT; - } - } - } - - double T = sqrt(h_8 / h_10); - double dT = 0.5 / T * ( (2-alpha)*h_9_dh/h_10 - h_8/(h_10*h_10)*-alpha*h_11_dh ); - - T *= eta; - dT *= eta; - - this->h = T; - this->dh = dT; -} - -void Timestep_adapt_weight::initialize(vector &bodies) { - calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(bodies); - - if(dt_sgn > 0) { - this->dt_prev = this->h / (1+0.5*this->dh); - } - else { - this->dt_prev = this->h / (1-0.5*this->dh); - } - - this->dt_prev *= dt_sgn; -} -double Timestep_adapt_weight::get_timestep(vector &bodies) { - calculate_shared_adaptive_weighted_timestep_orbital(bodies); - - this->dt_next = this->h2 / this->dt_prev; - - double f2 = this->dt_next*this->dt_next / this->h2; - if(f2 > this->fp2_bound) this->dt_next = dt_sgn * sqrt(this->h2); - else if(f2 < this->fm2_bound) this->dt_next = dt_sgn * sqrt(this->h2); - - this->dt_prev = this->dt_next; - - return this->dt_next; -} - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_base.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_base.cpp deleted file mode 100644 index 98bcfcb3d3..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_base.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "Timestep_base.h" - -// Initializer -Timestep_base::Timestep_base() { - set_default_values(); -} - -void Timestep_base::set_default_values() { - this->dt_const = 0.015625; - this->eta = 0.0625; - this->eta2 = this->eta*this->eta; - - this->h = 0; - this->h2 = 0; - this->dh = 0; - this->h_spin = 0; - this->h_shape = 0; - - this->dt_prev = 0; - this->dt_next = 0; - - this->fp_bound = 4; - this->fm_bound = 0.25; - this->fp2_bound = this->fp_bound*this->fp_bound; - this->fm2_bound = this->fm_bound*this->fm_bound; - this->alpha = 10; - this->dt_sgn = 1; -} - -// Setters and Getters -void Timestep_base::set_dt_const(double dt_const) { - this->dt_const = dt_const; -} -double Timestep_base::get_dt_const() { - return dt_const; -} - -void Timestep_base::set_eta(double eta) { - this->eta = eta; - this->eta2 = this->eta*this->eta; -} -double Timestep_base::get_eta() { - return eta; -} - -void Timestep_base::commit() { - dt_const = abs(dt_const); - - if(dt_sgn > 0) { - if(dt_prev < 0) dt_prev = abs(dt_prev); - } - else { - if(dt_prev > 0) dt_prev = -dt_prev; - } -} - -void Timestep_base::set_dt_sgn(double t0, double t1) { - dt_sgn = (t1 >= t0) ? 1 : -1; - commit(); -} -void Timestep_base::set_dt_sgn(int dt_sgn) { - this->dt_sgn = dt_sgn; - commit(); -} - -void Timestep_base::set_dt_prev(double dt_prev) { - this->dt_prev = abs(dt_prev); - - if(this->dt_sgn < 0) { - this->dt_prev *= -1; - } -} - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_const.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_const.cpp deleted file mode 100644 index 494fd3687b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_const.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "Timestep_const.h" - -// Calculators -void Timestep_const::initialize(vector &bodies) { - ; -} -double Timestep_const::get_timestep(vector &bodies) { - return dt_sgn*dt_const; -} - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct.cpp deleted file mode 100644 index 0bcae19fa5..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "Timestep_direct.h" - -// Calculators -void Timestep_direct::calculate_shared_adaptive_minimum_timestep_orbital(vector &bodies) { - this->h = 0; - - // O(N^2) operations - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - if(bi->particle_type > 0 || bj->particle_type > 0) { - - double mu = bi->m + bj->m; - - array dr, dv; - - for(int k=0; k<3; k++) { - dr[k] = bi->r[k] - bj->r[k]; - dv[k] = bi->v[k] - bj->v[k]; - } - - double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); - - double dr4 = dr2*dr2; - - double dt1_4 = mu*mu/(dr4*dr2); - double dt2_4 = dv2*dv2/dr4; - - double P_4 = max(dt1_4, dt2_4); - - if(P_4 > this->h) this->h = P_4; - } - } - } - - this->h = 1./sqrt(this->h); -} - -void Timestep_direct::calculate_minimum_timestep_spin(vector &bodies) { - h_spin = 0.; - - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - if(w2 > h_spin) { - h_spin = w2; - } - } - } - - if(h_spin == 0) { - h_spin = 1e100; - } - else { - h_spin = 1/h_spin; - } -} -void Timestep_direct::calculate_minimum_timestep_shape(vector &bodies) { - h_shape = 1e100; - - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - if(b->tau > 0) { - if(b->tau < h_shape) { - h_shape = b->tau; - } - } - } - } - - h_shape = h_shape*h_shape; -} - -void Timestep_direct::initialize(vector &bodies) { - ; -} -double Timestep_direct::get_timestep(vector &bodies) { - calculate_shared_adaptive_minimum_timestep_orbital(bodies); - calculate_minimum_timestep_spin(bodies); - calculate_minimum_timestep_shape(bodies); - - h = min(min(h_spin, h_shape), h); - h = sqrt(h); - - h *= eta; - h *= dt_sgn; - - return h; -} - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct_weight.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct_weight.cpp deleted file mode 100644 index 210dd9f6ba..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Timestep_direct_weight.cpp +++ /dev/null @@ -1,206 +0,0 @@ -#include "Timestep_direct_weight.h" - -// Calculators -void Timestep_direct_weight::calculate_shared_adaptive_weighted_timestep_orbital(vector &bodies) { - double wsum = 0; - double wh2sum = 0; - - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - if(bi->particle_type > 0 || bj->particle_type > 0) { - - double mu = bi->m + bj->m; - - array dr, dv; - - for(int k=0; k<3; k++) { - dr[k] = bi->r[k] - bj->r[k]; - dv[k] = bi->v[k] - bj->v[k]; - } - - double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); - - double dr4 = dr2*dr2; - - double dt1_4 = mu*mu/(dr4*dr2); - double dt2_4 = dv2*dv2/dr4; - - //--------------------------------------------------------------- - - double P_4 = dt1_4 + dt2_4; - double P_2 = sqrt(P_4); - double P_8 = P_4*P_4; - double P_10 = P_8*P_2; - - //--------------------------------------------------------------- - - double wh2 = P_8; - double w = P_10; - - //--------------------------------------------------------------- - - wsum += w; - wh2sum += wh2; - } - } - } - - this->h2 = eta2 * wh2sum/wsum; -} -void Timestep_direct_weight::calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(vector &bodies) { - double h_8 = 0; - double h_10 = 0; - double h_9_dh = 0; - double h_11_dh = 0; - - for(vector::iterator bi = bodies.begin(); bi != bodies.end()-1; ++bi) { - for(vector::iterator bj = bi+1; bj != bodies.end(); ++bj) { - - if(bi->particle_type > 0 || bj->particle_type > 0) { - - double mu = bi->m + bj->m; - - array dr, dv, da; - - for(int k=0; k<3; k++) { - dr[k] = bj->r[k] - bi->r[k]; - dv[k] = bj->v[k] - bi->v[k]; - da[k] = bj->a[k] - bi->a[k]; - } - - double dr2 = inner_product(dr.begin(), dr.end(), dr.begin(), 0.); - double dv2 = inner_product(dv.begin(), dv.end(), dv.begin(), 0.); - - double rdotv = inner_product(dr.begin(), dr.end(), dv.begin(), 0.); - double vdota = inner_product(dv.begin(), dv.end(), da.begin(), 0.); - - //------------------------------------------ - - double h_4_ra = mu*mu/(dr2*dr2*dr2); - - double h_1_dh_ra = 1.5*rdotv/dr2; - double h_5_dh_ra = h_4_ra * h_1_dh_ra; - - //------------------------------------------ - - double h_2_rv = dv2/dr2; - double h_4_rv = h_2_rv*h_2_rv; - - double h_3_dh_rv = (rdotv * h_2_rv - vdota) / dr2; - double h_5_dh_rv = h_2_rv * h_3_dh_rv; - - //------------------------------------------ - - double T_4 = h_4_ra + h_4_rv; - - double T_8 = T_4*T_4; - double T_2 = sqrt(T_4); - double T_10 = T_8*T_2; - - double T_5_dT = h_5_dh_ra + h_5_dh_rv; - - double T_9_dT = T_4 * T_5_dT; - double T_11_dT = T_2 * T_9_dT; - - //------------------------------------------ - - h_8 += T_8; - h_10 += T_10; - - h_9_dh += T_9_dT; - h_11_dh += T_11_dT; - } - } - } - - double T = sqrt(h_8 / h_10); - double dT = 0.5 / T * ( (2-alpha)*h_9_dh/h_10 - h_8/(h_10*h_10)*-alpha*h_11_dh ); - - T *= eta; - dT *= eta; - - this->h = T; - this->dh = dT; -} - -void Timestep_direct_weight::calculate_minimum_timestep_spin(vector &bodies) { - h_spin = 0.; - - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - double w2 = inner_product(b->w.begin(), b->w.end(), b->w.begin(), 0.); - if(w2 > h_spin) { - h_spin = w2; - } - } - } - - if(h_spin == 0) { - h_spin = 1e100; - } - else { - h_spin = 1/h_spin; - } -} -void Timestep_direct_weight::calculate_minimum_timestep_shape(vector &bodies) { - h_shape = 1e100; - - for(vector::iterator b = bodies.begin(); b != bodies.end(); ++b) { - if(b->particle_type == 3) { - if(b->tau > 0) { - if(b->tau < h_shape) { - h_shape = b->tau; - } - } - } - } - - h_shape = h_shape*h_shape; -} - -void Timestep_direct_weight::initialize(vector &bodies) { - calculate_shared_adaptive_weighted_timestep_orbital_and_derivative(bodies); - - if(dt_sgn > 0) { - this->dt_prev = this->h / (1+0.5*this->dh); - } - else { - this->dt_prev = this->h / (1-0.5*this->dh); - } - - double dt2_prev = this->dt_prev * this->dt_prev; - - calculate_minimum_timestep_spin(bodies); - calculate_minimum_timestep_shape(bodies); - - double dt2_min = eta2 * min(h_spin, h_shape); - dt2_prev = min(dt2_prev, dt2_min); - - this->dt_prev = sqrt( dt2_prev ); - this->dt_prev *= dt_sgn; -} -double Timestep_direct_weight::get_timestep(vector &bodies) { - calculate_shared_adaptive_weighted_timestep_orbital(bodies); - calculate_minimum_timestep_spin(bodies); - calculate_minimum_timestep_shape(bodies); - - double dt2_min = eta2 * min(h_spin, h_shape); - this->h2 = min(this->h2, dt2_min); - - this->dt_next = this->h2 / this->dt_prev; - - double f2 = this->dt_next*this->dt_next / this->h2; - if(f2 > this->fp2_bound) this->dt_next = dt_sgn * sqrt(this->h2); - else if(f2 < this->fm2_bound) this->dt_next = dt_sgn * sqrt(this->h2); - - this->dt_prev = this->dt_next; - - return this->dt_next; -} - - - - - diff --git a/src/amuse_tidymess/src/tidymess/integrator/src/Units.cpp b/src/amuse_tidymess/src/tidymess/integrator/src/Units.cpp deleted file mode 100755 index 028327f33b..0000000000 --- a/src/amuse_tidymess/src/tidymess/integrator/src/Units.cpp +++ /dev/null @@ -1,485 +0,0 @@ -#include "Units.h" - -Units::Units() { - // Constants - c_m_s = 299792458; - - c_km_s = c_m_s / 1.e3; - c_AU_yr = c_m_s * m_s_to_AU_yr; - c_two_pi_AU_yr = c_AU_yr * AU_yr_to_two_pi_AU_yr; - - G_standard = 39.47841760435743; //39.48524924651484; // Gravitational constant in units of MSun, AU and yr - - // Time: s, min, hr, day, yr, Myr, Gyr - s_to_yr = 1./60/60/24/365.25; - min_to_yr = 1./60/24/365.25; - hr_to_yr = 1./24/365.25; - day_to_yr = 1./365.25; - Myr_to_yr = 1.e6; - Gyr_to_yr = 1.e9; - - yr_to_s = 1./s_to_yr; - yr_to_min = 1./min_to_yr; - yr_to_hr = 1./hr_to_yr; - yr_to_day = 1./day_to_yr; - yr_to_Myr = 1./Myr_to_yr; - yr_to_Gyr = 1./Gyr_to_yr; - - // Length: m, km, Rsun/RSun, AU, pc - km_in_m = 1.e3; - Rsun_in_m = 6.957e8; - AU_in_m = 149597870700; - pc_in_m = 180*60*60*AU_in_m / M_PI; - - m_to_AU = 1/AU_in_m; - km_to_AU = 1e3/AU_in_m; - Rsun_to_AU = Rsun_in_m/AU_in_m; - pc_to_AU = pc_in_m/AU_in_m; - - AU_to_m = 1./m_to_AU; - AU_to_km = 1./km_to_AU; - AU_to_Rsun = 1./Rsun_to_AU; - AU_to_pc = 1./pc_to_AU; - - // Mass: g, kg, Mearth/MEarth, Mjupiter/MJupiter/Mjup/MJup, Msun/MSun - - GMjupiter_in_m_s = 1.2668653e17; // m^3 s^-2 - GMearth_in_m_s = 3.986004e14; // m^3 s^-2 - - GMjupiter_in_AU_yr = GMjupiter_in_m_s * pow(AU_in_m, -3) * pow(s_to_yr, -2); // AU^3 yr^-2 - GMearth_in_AU_yr = GMearth_in_m_s * pow(AU_in_m, -3) * pow(s_to_yr, -2); // AU^3 yr^-2 - - Mjupiter_in_Msun = GMjupiter_in_AU_yr / (4*M_PI*M_PI); - Mearth_in_Msun = GMearth_in_AU_yr / (4*M_PI*M_PI); - - Msun_in_kg = 1.98847e30; - Msun_in_g = Msun_in_kg*1.e3; - - g_to_Msun = 1./Msun_in_g; - kg_to_Msun = 1./Msun_in_kg; - Mearth_to_Msun = Mearth_in_Msun; - Mjupiter_to_Msun = Mjupiter_in_Msun; - - Msun_to_g = 1./g_to_Msun; - Msun_to_kg = 1./kg_to_Msun; - Msun_to_Mearth = 1./Mearth_to_Msun; - Msun_to_Mjupiter = 1./Mjupiter_to_Msun; - - // Velocity: m/s, km/s, km/hr, AU/day, pc/Myr - m_s_to_AU_yr = m_to_AU / s_to_yr; - km_s_to_AU_yr = km_to_AU / s_to_yr; - km_hr_to_AU_yr = km_to_AU / hr_to_yr; - AU_day_to_AU_yr = 1. / day_to_yr; - pc_Myr_to_AU_yr = pc_to_AU / Myr_to_yr; - - AU_yr_to_m_s = 1./m_s_to_AU_yr; - AU_yr_to_km_s = 1./km_s_to_AU_yr; - AU_yr_to_km_hr = 1./km_hr_to_AU_yr; - AU_yr_to_AU_day = 1./AU_day_to_AU_yr; - AU_yr_to_pc_Myr = 1./pc_Myr_to_AU_yr; - - // Angles: deg, rad - rad_to_deg = 1. / M_PI * 180; - deg_to_rad = 1. / 180 * M_PI; - - // G=4pi <-> G=1 conversion - yr_to_yr_two_pi = 2*M_PI; - yr_two_pi_to_yr = 1./yr_to_yr_two_pi; - - AU_yr_to_two_pi_AU_yr = 1./(2*M_PI); - two_pi_AU_yr_to_AU_yr = 1./AU_yr_to_two_pi_AU_yr; - - // Conversion factors to dimensionless units - Cm = 1.; - Cr = 1.; - Cv = 1.; - Ct = 1.; - - physical_units = true; -} - -void Units::set_physical_units(bool physical_units) { - this->physical_units = physical_units; -} - -bool Units::validate_mass_unit(string u) { - if(u == "" || u == "[]") return true; - else if(u == "[g]") return true; - else if(u == "[kg]") return true; - else if(u == "[Mearth]" || u == "[MEarth]") return true; - else if(u == "[Mjupiter]" || u == "[MJupiter]") return true; - else if(u == "[Mjup]" || u == "[MJup]") return true; - else if(u == "[Msun]" || u == "[MSun]") return true; - return false; -} -bool Units::validate_length_unit(string u) { - if(u == "" || u == "[]") return true; - else if(u == "[m]") return true; - else if(u == "[km]") return true; - else if(u == "[Rsun]" || u == "[RSun]") return true; - else if(u == "[AU]" || u == "[au]") return true; - else if(u == "[parsec]" || u == "[pc]") return true; - return false; -} -bool Units::validate_time_unit(string u) { - if(u == "" || u == "[]") return true; - else if(u == "[s]") return true; - else if(u == "[hour]" || u == "[hr]") return true; - else if(u == "[day]") return true; - else if(u == "[year]" || u == "[yr]") return true; - else if(u == "[Myr]") return true; - else if(u == "[Gyr]") return true; - return false; -} -bool Units::validate_speed_unit(string u) { - if(u == "" || u == "[]") return true; - else if(u == "[m/s]") return true; - else if(u == "[km/s]") return true; - else if(u == "[km/hr]" || u == "[km/hour]") return true; - else if(u == "[AU/day]" || u == "[au/day]") return true; - else if(u == "[AU/yr]" || u == "[AU/year]") return true; - else if(u == "[au/yr]" || u == "[au/year]") return true; - else if(u == "[pc/Myr]") return true; - return false; -} -bool Units::validate_angular_unit(string u) { - if(u == "" || u == "[]") return true; - else if(u == "[deg]") return true; - else if(u == "[rad]") return true; - return false; -} - -double Units::convert_mass_to_standard(double value, string unit) { - if(physical_units) { - if(unit == "[g]") return value * g_to_Msun; - else if(unit == "[kg]") return value * kg_to_Msun; - else if(unit == "[Mearth]" || unit == "[MEarth]") return value * Mearth_to_Msun; - else if(unit == "[Mjupiter]" || unit == "[MJupiter]") return value * Mjupiter_to_Msun; - else if(unit == "[Mjup]" || unit == "[MJup]") return value * Mjupiter_to_Msun; - else if(unit == "[Msun]" || unit == "[MSun]") return value; - } - return value; -} -double Units::convert_length_to_standard(double value, string unit) { - if(physical_units) { - if(unit == "[m]") return value * m_to_AU; - else if(unit == "[km]") return value * km_to_AU; - else if(unit == "[Rsun]" || unit == "[RSun]") return value * Rsun_to_AU; - else if(unit == "[AU]" || unit == "[au]") return value; - else if(unit == "[parsec]" || unit == "[pc]") return value * pc_to_AU; - } - return value; -} -double Units::convert_time_to_standard(double value, string unit) { - if(physical_units) { - if(unit == "[s]") return value * s_to_yr; - else if(unit == "[hour]" || unit == "[hr]") return value * hr_to_yr; - else if(unit == "[day]") return value * day_to_yr; - else if(unit == "[year]" || unit == "[yr]") return value; - else if(unit == "[Myr]") return value * Myr_to_yr; - else if(unit == "[Gyr]") return value * Gyr_to_yr; - } - return value; -} -double Units::convert_speed_to_standard(double value, string unit) { - if(physical_units) { - if(unit == "[m/s]") return value * m_s_to_AU_yr; - else if(unit == "[km/s]") return value * km_s_to_AU_yr; - else if(unit == "[km/hr]" || unit == "[km/hour]") return value * km_hr_to_AU_yr; - else if(unit == "[AU/day]" || unit == "[au/day]") return value * AU_day_to_AU_yr; - else if(unit == "[AU/yr]" || unit == "[AU/year]") return value; - else if(unit == "[au/yr]" || unit == "[au/year]") return value; - else if(unit == "[pc/Myr]") return value * pc_Myr_to_AU_yr; - } - return value; -} -double Units::convert_angle_to_standard(double value, string unit) { - if(unit == "" || unit == "[]") return value * deg_to_rad; - else if(unit == "[deg]") return value * deg_to_rad; - else if(unit == "[rad]") return value; - return value; -} - -double Units::convert_time_from_standard_to_code(double value) { - if(physical_units) { - return value * yr_to_yr_two_pi; - } - return value; -} -double Units::convert_speed_from_standard_to_code(double value) { - if(physical_units) { - return value * AU_yr_to_two_pi_AU_yr; - } - return value; -} -double Units::convert_frequency_from_standard_to_code(double value) { - if(physical_units) { - return value / yr_to_yr_two_pi; - } - return value; -} - -double Units::convert_time_from_code_to_output(double value, string unit) { - if(physical_units) { - double val_G1_nodim = value; - double val_G1_dim = Ct * val_G1_nodim; - double val_standard = yr_two_pi_to_yr * val_G1_dim; - if(unit == "[s]") return val_standard * yr_to_s; - else if(unit == "[hour]" || unit == "[hr]") return val_standard * yr_to_hr; - else if(unit == "[day]") return val_standard * yr_to_day; - else if(unit == "[year]" || unit == "[yr]") return val_standard; - else if(unit == "[Myr]") return val_standard * yr_to_Myr; - else if(unit == "[Gyr]") return val_standard * yr_to_Gyr; - } - return value; -} -double Units::convert_frequency_from_code_to_output(double value, string unit) { - if(physical_units) { - double val_G1_nodim = value; - double val_G1_dim = val_G1_nodim / Ct; - double val_standard = val_G1_dim / yr_two_pi_to_yr; - if(unit == "[1/s]") return val_standard / yr_to_s; - else if(unit == "[1/hour]" || unit == "[1/hr]") return val_standard / yr_to_hr; - else if(unit == "[1/day]") return val_standard / yr_to_day; - else if(unit == "[1/year]" || unit == "[1/yr]") return val_standard; - else if(unit == "[1/Myr]") return val_standard / yr_to_Myr; - else if(unit == "[1/Gyr]") return val_standard / yr_to_Gyr; - } - return value; -} -double Units::convert_mass_from_code_to_output(double value, string unit) { - if(physical_units) { - double val_G1_nodim = value; - double val_G1_dim = Cm * val_G1_nodim; - double val_standard = val_G1_dim; - if(unit == "[g]") return val_standard * Msun_to_g; - else if(unit == "[kg]") return val_standard * Msun_to_kg; - else if(unit == "[Mearth]" || unit == "[MEarth]") return val_standard * Msun_to_Mearth; - else if(unit == "[Mjupiter]" || unit == "[MJupiter]") return val_standard * Msun_to_Mjupiter; - else if(unit == "[Mjup]" || unit == "[MJup]") return val_standard * Msun_to_Mjupiter; - else if(unit == "[Msun]" || unit == "[MSun]") return val_standard; - } - return value; -} -double Units::convert_length_from_code_to_output(double value, string unit) { - if(physical_units) { - double val_G1_nodim = value; - double val_G1_dim = Cr * val_G1_nodim; - double val_standard = val_G1_dim; - if(unit == "[m]") return val_standard * AU_to_m; - else if(unit == "[km]") return val_standard * AU_to_km; - else if(unit == "[Rsun]" || unit == "[RSun]") return val_standard * AU_to_Rsun; - else if(unit == "[AU]" || unit == "[au]") return val_standard; - else if(unit == "[parsec]" || unit == "[pc]") return val_standard * AU_to_pc; - } - return value; -} -double Units::convert_speed_from_code_to_output(double value, string unit) { - if(physical_units) { - double val_G1_nodim = value; - double val_G1_dim = Cv * val_G1_nodim; - double val_standard = two_pi_AU_yr_to_AU_yr * val_G1_dim; - if(unit == "[m/s]") return val_standard * AU_yr_to_m_s; - else if(unit == "[km/s]") return val_standard * AU_yr_to_km_s; - else if(unit == "[km/hr]" || unit == "[km/hour]") return val_standard * AU_yr_to_km_hr; - else if(unit == "[AU/day]" || unit == "[au/day]") return val_standard * AU_yr_to_AU_day; - else if(unit == "[AU/yr]" || unit == "[AU/year]") return val_standard; - else if(unit == "[au/yr]" || unit == "[au/year]") return val_standard; - else if(unit == "[pc/Myr]") return val_standard * AU_yr_to_pc_Myr; - } - return value; -} -double Units::convert_angular_momentum_from_code_to_output(double value, string unit) { - if(physical_units) { - double val_G1_nodim = value; - double val_G1_dim = Cm*Cr*Cv * val_G1_nodim; - double val_standard = two_pi_AU_yr_to_AU_yr * val_G1_dim; - - vector str = split_units(unit); - - for(int i=0; i str = split_units(unit); - - for(int i=0; i str = split_units(unit); - - for(int i=0; i Units::split_units(string &u) { - vector v; - - vector ind; - ind.push_back(-1); - - int N_str = u.length(); - for(int k=0; k 0) { - switch(init.initial_shape) { - case 0: - tidymess.set_to_spherical_shape(); - break; - case 1: - tidymess.set_to_equilibrium_shape(); - break; - } - - tidymess.update_angular_momentum(); - } - - tidymess.commit_parameters(); - - // Set up collision detection - Collision collision; - - collision.set_collision_mode(init.collisions); - collision.set_roche_mode(init.roche_limit); - collision.setup(); - - // Set up rotational breakup detection - Breakup breakup; - - breakup.set_breakup_mode(init.breakup_speed); - breakup.setup(); - - // Set up output - Output output; - - output.set_dir(init.output_dir); - output.set_overwrite(init.overwrite); - output.set_file_out(init.file_out); - - output.set_format(init.output_format); - output.set_info(init.output_info); - output.set_coor(init.output_coor); - - output.set_units(init.physical_units, init.mass_unit, init.length_unit, init.time_unit, init.speed_unit); - output.set_conversion_factors(init.get_Cm(), init.get_Cr(), init.get_Cv(), init.get_Ct()); - - output.set_tidal_model(init.tidal_model); - output.determine_output_mode(); - - // Set up simulation and diagnostics - double t = tidymess.get_model_time(); - double t_end = init.t_end; - - int snapshot_mode = init.snapshot_mode; - int N_snapshot = init.n_snapshot; - - vector bodies = tidymess.get_particles(); - int N_init = bodies.size(); - - //--------------------------------------------------------------------- - - bool dt_pos; - int dt_sgn; - if(t_end > t) { - dt_pos = true; - dt_sgn = 1; - } - else { - dt_pos = false; - dt_sgn = -1; - } - - tidymess.set_dt_sgn(dt_sgn); - - int num_snapshot = 0; - int num_integration_step = 0; - - double t_begin = t; - double dt_snapshot = 0; - - double dt0_log = 0; - double fmul_log = 0; - - if(snapshot_mode == 0) { - double t_sim = t_end - t_begin; - dt_snapshot = t_sim / N_snapshot; - } - else if(snapshot_mode == 1) { - double t_sim = abs(t_end - t_begin); - - double dt_ratio = 1000; - fmul_log = pow(10., log10(dt_ratio)/N_snapshot); - - double S = 0; - for(int i=0; i r0 = tidymess.get_center_of_mass(); - array v0 = tidymess.get_center_of_mass_velocity(); - array L0_orb = tidymess.get_orbital_angular_momentum(); - array L0_spin = tidymess.get_spin_angular_momentum(); - double Ekin0_orb = tidymess.get_orbital_kinetic_energy(); - double Ekin0_spin = tidymess.get_spin_kinetic_energy(); - double Epot0 = tidymess.get_potential_energy(); - - //--------------------------------------------------------------------- - - int N; - double tcpu_offset, t_cpu; - - double dt_prev = tidymess.get_dt_prev(); - - int collision_flag = 0; - int roche_flag = 0; - int breakup_flag = 0; - - if(init.to_continue) { - double t_bin; - int N_bin; - double tcpu_bin; - double dt_prev_bin; - vector bodies_bin; - int num_snapshot_bin; - int num_integration_step_bin; - int collision_flag_bin, roche_flag_bin, breakup_flag_bin; - double dt_snapshot_bin, dt0_log_bin, fmul_log_bin; - - output.read_binary_backup(t_bin, N_bin, tcpu_bin, dt_prev_bin, num_integration_step_bin, bodies_bin, collision_flag_bin, roche_flag_bin, breakup_flag_bin, dt_snapshot_bin, dt0_log_bin, fmul_log_bin, num_snapshot_bin); - - t = t_bin; - N = N_bin; - tcpu_offset = tcpu_bin; - dt_prev = dt_prev_bin; - num_snapshot = num_snapshot_bin; - num_integration_step = num_integration_step_bin; - collision_flag = collision_flag_bin; - roche_flag = roche_flag_bin; - breakup_flag = breakup_flag_bin; - dt_snapshot = dt_snapshot_bin; - dt0_log = dt0_log_bin; - fmul_log = fmul_log_bin; - - bodies.clear(); - for(int i=0; i t_end) { - t = t_end; - num_snapshot--; - } - } - else { - if(t < t_end) { - t = t_end; - num_snapshot--; - } - } - - tidymess.evolve_model(t); - } - else if(snapshot_mode == 1) { - double dt = dt_sgn * dt0_log * pow(fmul_log, num_snapshot-1); - t += dt; - - if(dt_pos) { - if(t > t_end) { - t = t_end; - num_snapshot--; - } - } - else { - if(t < t_end) { - t = t_end; - num_snapshot--; - } - } - - tidymess.evolve_model(t); - } - else { - tidymess.evolve_model(N_snapshot); - } - - t = tidymess.get_model_time(); - bodies = tidymess.get_particles(); - - // Store a snapshot - t_cpu = tcpu_offset + timer.read(); - output.write_snapshot(t, t_cpu, bodies); - - // Save snapshot to binary file - N = bodies.size(); - dt_prev = tidymess.get_dt_prev(); - num_integration_step = tidymess.get_num_integration_step(); - - output.save_to_binary(t, N, t_cpu, dt_prev, num_integration_step, collision_flag, roche_flag, breakup_flag, bodies, dt_snapshot, dt0_log, fmul_log, num_snapshot); - - // Store diagnostics - if(init.output_diag) { - array r1 = tidymess.get_center_of_mass(); - array v1 = tidymess.get_center_of_mass_velocity(); - array L1_orb = tidymess.get_orbital_angular_momentum(); - array L1_spin = tidymess.get_spin_angular_momentum(); - double Ekin1_orb = tidymess.get_orbital_kinetic_energy(); - double Ekin1_spin = tidymess.get_spin_kinetic_energy(); - double Epot1 = tidymess.get_potential_energy(); - - output.write_diag(t, t_cpu, num_integration_step, N, r1, v1, L1_orb, L1_spin, Ekin1_orb, Epot1, Ekin1_spin); - } - - if(init.output_terminal) { - cout << "Simulation progress:\t"; - cout << scientific<< setw(12) << setprecision(6) << 100*t/t_end << " %"; - cout << "\tCPU time:\t"; - cout << scientific<< setw(12) << setprecision(6) << t_cpu << " [s]"; - cout << "\tETA:\t"; - cout << scientific << setw(12) << setprecision(6) << (t_end-t) * t_cpu/(t-init.t_begin) << " [s]" << endl; - } - - // Stopping condition end time - if(dt_pos) { - if(t >= t_end) { - stopping_condition_type = 0; - break; - } - } - else { - if(t <= t_end) { - stopping_condition_type = 0; - break; - } - } - - // Collision handling - if(collision.to_detect_collision) { - collision_flag = tidymess.get_collision_flag(); - - if(tidymess.is_collision_detected() == true) { - if(collision.collision_mode == 1) { - cout << "Collision detected. Ignoring it. " << endl; - } - else if(collision.collision_mode == 2) { // exception = End program - stopping_condition_type = 2; - - cout << "Collision detected. Ending simulation." << endl; - break; - } - else if(collision.collision_mode == 3) { // sticky sphere approximation - cout << "Collision detected. Replace by center of mass particle." << endl; - - vector< array > cindex = tidymess.get_collision_indices(); - collision.replace(bodies, cindex); - - tidymess.set_particles(bodies); - tidymess.commit_particles(); - - t_cpu = tcpu_offset + timer.read(); - output.write_snapshot(t, t_cpu, bodies); - - if(bodies.size() == 1) { - stopping_condition_type = 4; - - cout << "Only one body left. Ending simulation." << endl; - break; - } - } - } - } - - // Roche limit handling - if(collision.to_detect_roche) { - roche_flag = tidymess.get_roche_flag(); - - if(tidymess.is_roche_detected() == true) { - if(collision.roche_mode == 1) { - cout << "Roche limit breached. Ignoring it. " << endl; - } - else if(collision.roche_mode == 2) { - stopping_condition_type = 3; - - cout << "Roche limit breached. Ending simulation." << endl; - break; - } - } - } - - // Breakup speed handling - if(breakup.to_detect) { - bool rotational_breakup = breakup.detect_breakup(bodies); - if(rotational_breakup) { - breakup_flag = 1; - - if(breakup.mode == 1) { - cout << "Rotational breakup detected. Ignoring it. " << endl; - } - else if(breakup.mode == 2) { - stopping_condition_type = 5; - - cout << "Rotational breakup detected. Ending simulation." << endl; - break; - } - } - } - - // Maximum CPU running time - if(check_max_cpu) { - if(t_cpu > max_cpu_time) { - stopping_condition_type = 1; - - cout << "t_cpu = " << t_cpu << " [s]" << endl; - cout << "max_cpu_time = " << max_cpu_time << " [s]" << endl; - cout << "Halting simulation!" << endl; - break; - } - } - } - - //--------------------------------------------------------------------- - - // Save snapshot to binary file - N = bodies.size(); - t_cpu = tcpu_offset + timer.read(); - dt_prev = tidymess.get_dt_prev(); - num_integration_step = tidymess.get_num_integration_step(); - - output.save_to_binary(t, N, t_cpu, dt_prev, num_integration_step, collision_flag, roche_flag, breakup_flag, bodies, dt_snapshot, dt0_log, fmul_log, num_snapshot); - - // Clean up - timer.stop(); - - // Final log data - int N_final = bodies.size(); - - array r1 = tidymess.get_center_of_mass(); - array v1 = tidymess.get_center_of_mass_velocity(); - array L1_orb = tidymess.get_orbital_angular_momentum(); - array L1_spin = tidymess.get_spin_angular_momentum(); - double Ekin1_orb = tidymess.get_orbital_kinetic_energy(); - double Ekin1_spin = tidymess.get_spin_kinetic_energy(); - double Epot1 = tidymess.get_potential_energy(); - - if(init.output_diag) { - output.write_diag(t, t_cpu, num_integration_step, N, r1, v1, L1_orb, L1_spin, Ekin1_orb, Epot1, Ekin1_spin); - } - - double dr = sqrt(pow(r1[0]-r0[0], 2) + pow(r1[1]-r0[1], 2) + pow(r1[2]-r0[2], 2)); - double dv = sqrt(pow(v1[0]-v0[0], 2) + pow(v1[1]-v0[1], 2) + pow(v1[2]-v0[2], 2)); - - vector L0(3); - L0[0] = L0_orb[0] + L0_spin[0]; - L0[1] = L0_orb[1] + L0_spin[1]; - L0[2] = L0_orb[2] + L0_spin[2]; - - vector L1(3); - L1[0] = L1_orb[0] + L1_spin[0]; - L1[1] = L1_orb[1] + L1_spin[1]; - L1[2] = L1_orb[2] + L1_spin[2]; - - double dLx = L1[0]-L0[0]; - double dLy = L1[1]-L0[1]; - double dLz = L1[2]-L0[2]; - - double L0mag = sqrt(L0[0]*L0[0] + L0[1]*L0[1] + L0[2]*L0[2]); - double L1mag = sqrt(L1[0]*L1[0] + L1[1]*L1[1] + L1[2]*L1[2]); - double dLmag = sqrt(dLx*dLx + dLy*dLy + dLz*dLz); - - double dLx_rel = dLx; - double dLy_rel = dLy; - double dLz_rel = dLz; - if(L0[0] != 0) dLx_rel /= L0[0]; - if(L0[1] != 0) dLy_rel /= L0[1]; - if(L0[2] != 0) dLz_rel /= L0[2]; - - double dL_rel = dLmag; - if(L0mag != 0) dL_rel /= (L0mag); - - double Etot0 = Ekin0_orb + Epot0 + Ekin0_spin; - double Etot1 = Ekin1_orb + Epot1 + Ekin1_spin; - - double dE_abs = Etot1-Etot0; - double dE_rel = dE_abs; - if(Etot0 != 0) dE_rel /= Etot0; - - banner.print_outro(init.output_dir); - - output.write_log(argc, argv, t, t_cpu, num_integration_step, N_init, N_final, dr, dv, dLx, dLy, dLz, dLx_rel, dLy_rel, dLz_rel, dLmag, dL_rel, dE_abs, dE_rel, bodies[0].r[0], stopping_condition_type, collision_flag, roche_flag, breakup_flag); - output.print_log(argc, argv, t, t_cpu, num_integration_step, N_init, N_final, dr, dv, dLx, dLy, dLz, dLx_rel, dLy_rel, dLz_rel, dLmag, dL_rel, dE_abs, dE_rel, bodies[0].r[0], stopping_condition_type, collision_flag, roche_flag, breakup_flag); - - banner.print_stars(); - banner.print_banner(); - banner.print_reference(); - banner.print_stars(); - cout << endl; - - return 1; -} - - diff --git a/src/amuse_tidymess/src/tidymess/makefile b/src/amuse_tidymess/src/tidymess/makefile deleted file mode 100755 index 617e253eca..0000000000 --- a/src/amuse_tidymess/src/tidymess/makefile +++ /dev/null @@ -1,33 +0,0 @@ -INT_DIR := integrator - -SRC_DIR := $(INT_DIR)/src -INC_DIR := $(INT_DIR)/include -OBJ_DIR := $(INT_DIR)/build -BIN_DIR := . - -SRC := $(wildcard $(SRC_DIR)/*.cpp) -OBJ := $(SRC:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o) - -CODE = tidymess.exe - -CC := g++ -CFLAGS := -Ofast - -.PHONY: all clean - -all: $(CODE) - -tidymess.exe: $(OBJ) | $(BIN_DIR) - $(CC) $(CFLAGS) $^ -o $@ $(INC_DIR:%=-I%) - -$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR) - $(CC) $(CFLAGS) -c $< -o $@ $(INC_DIR:%=-I%) - -$(BIN_DIR) $(OBJ_DIR): - mkdir -p $@ - -clean: - @$(RM) -rv $(OBJ_DIR) $(CODE) - --include $(OBJ:.o=.d) - diff --git a/src/amuse_tidymess/src/tidymess/tidymess.ic b/src/amuse_tidymess/src/tidymess/tidymess.ic deleted file mode 100755 index 9419e4428d..0000000000 --- a/src/amuse_tidymess/src/tidymess/tidymess.ic +++ /dev/null @@ -1,20 +0,0 @@ -Name Earth Moon - -mass[kg] 5.9724e24 0.07346e24 -R[km] 6371. 1737.4 -xi 0.3308 0.394 - -kf 0.933 0 -tau[s] 180 0 - -lod[day] 1.0 27.322 -obl[deg] 0.0 0.0 -psi[deg] 0.0 0.0 - -a[km] 0.3844e6 -e 0.0 -I 0 -O 0 -w 0 -M 0 - diff --git a/src/amuse_tidymess/src/tidymess/tidymess.par b/src/amuse_tidymess/src/tidymess/tidymess.par deleted file mode 100755 index ef86c69be2..0000000000 --- a/src/amuse_tidymess/src/tidymess/tidymess.par +++ /dev/null @@ -1,72 +0,0 @@ -//-------------------------------------------------------------------------------------------------- -// Simulation parameters -//-------------------------------------------------------------------------------------------------- - -to_continue = 0 // 0=new simulation, 1=continue simulation -max_cpu_time = 0 // Maximum CPU running time in seconds. If 0 (default), then cpu time has no limit. - -//-------------------------------------------------------------------------------------------------- -// Physical model parameters -//-------------------------------------------------------------------------------------------------- - -tidal_model = 0 // 0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess -pn_order = 0 // Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn -B_braking = 0 // Magnetic braking. 0=off, 1=on - -collisions = 0 // 0=off, 1=flag, 2=exception, 3=replace -roche_limit = 0 // 0=off, 1=flag, 2=exception -breakup_speed = 0 // Centrifugal breakup speed detection. 0=off, 1=flag, 2=exception - -//-------------------------------------------------------------------------------------------------- -// Unit system -//-------------------------------------------------------------------------------------------------- - -mass_unit = [Msun] // Unit of mass in output: []=Nbody unit, [g], [kg], [Mearth], [Mjupiter], [Msun] -length_unit = [au] // Unit of length in output: []=Nbody unit, [m], [km], [Rsun], [au], [pc] -time_unit = [yr] // Unit of time for 1) t_begin, t_end, and 2) unit of time in output: []=Nbody unit, [s], [hr], [day], [yr], [Myr], [Gyr] -speed_unit = [au/yr] // Unit of speed in output: []=Nbody unit, [m/s], [km/s], [km/hr], [km/hour], [au/day], [au/yr], [au/year], [pc/Myr] - -speed_of_light = 0 // Speed of light in N-body units. Only used in conjunction with N-body units and pn_order>0, otherwise equal to c. - -//-------------------------------------------------------------------------------------------------- -// Initial condition parameters -//-------------------------------------------------------------------------------------------------- - -file_ic = tidymess.ic // initial condition file - -orbit_coor = 1 // 0=cartesian inertial, 1=elliptical astrocentric, 2=elliptical jacobian -spin_coor = 2 // 0=absolute in inertial frame, 1=relative to its orbit; body 0 in the inertial frame, 2=relative to its orbit; body 0 relative to innermost orbit - -initial_shape = 0 // 0=sphere, 1=equilibrium -num_body = 0 // 0=all, num_body+1=number of bodies to include - -//-------------------------------------------------------------------------------------------------- -// Output parameters -//-------------------------------------------------------------------------------------------------- - -snapshot_mode = 0 // 0=linear interval (default), 1=logarithmic interval, 2=variable interval -n_snapshot = 1e2 // Total number of snapshots between t_begin and t_end (linear or in log10), or output a snapshot every fixed number (n_snapshot) of integration steps (variable) - -output_dir = data/ // Output directory; default is 'data/'. If left blank or set to '/', then file_ic will be adopted without the extension. -overwrite = 1 // overwrite existing files: 0=no, 1=yes - -output_format = 2 // 0=file per body, 1=file per snapshot, 2=single file -output_info = 1 // 0=time-varying quantities, 1=all quantities -output_coor = 0 // 0=cartesian inertial - -output_diag = 0 // 0=no (default), 1=yes: output diagnostics, such as E and L, are written to a separate diagnostics file with extension '.diag' -output_terminal = 1 // Display progress of simulation in terminal window. 0=no, 1=yes - -//-------------------------------------------------------------------------------------------------- -// Integration parameters -//-------------------------------------------------------------------------------------------------- - -t_begin = 0 // begin time in units given by time_unit -t_end = 1e2 // final time in units given by time_unit - -dt_mode = 1 // 0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt -dt_const = 0.015625 // constant time step in units given by time_unit (only used if dt_mode=0) -eta = 0.0625 // accuracy parameter; timestep multiplication factor, default=0.0625 (only used if dt_mode>0) - -n_iter = 1 // Number of iterations to improve reversibility (default=1) - From e9b633b9b058371fd5269423e61b0bb4324f695b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Dec 2025 16:57:37 +0100 Subject: [PATCH 010/174] added /packages and /support in tidymess --- .../packages/amuse-tidymess.amuse_deps | 1 + .../packages/amuse-tidymess/pyproject.toml | 49 + .../packages/amuse-tidymess/tidymess | 1 + src/amuse_tidymess/support/aclocal.m4 | 18 + src/amuse_tidymess/support/config.mk.in | 15 + src/amuse_tidymess/support/configure | 6092 +++++++++++++++++ src/amuse_tidymess/support/configure.ac | 30 + .../support/shared/config.guess | 1812 +++++ src/amuse_tidymess/support/shared/config.sub | 1971 ++++++ src/amuse_tidymess/support/shared/install-sh | 541 ++ .../support/shared/m4/amuse_conda.m4 | 36 + .../support/shared/m4/amuse_cuda.m4 | 232 + .../support/shared/m4/amuse_detect_os.m4 | 19 + .../support/shared/m4/amuse_download.m4 | 38 + .../support/shared/m4/amuse_lib.m4 | 138 + .../support/shared/m4/amuse_lib_healpix.m4 | 48 + .../support/shared/m4/amuse_lib_qhull.m4 | 30 + .../support/shared/m4/amuse_opencl.m4 | 63 + .../support/shared/m4/amuse_venv.m4 | 31 + .../support/shared/m4/ax_blas.m4 | 241 + .../support/shared/m4/ax_check_classpath.m4 | 61 + .../support/shared/m4/ax_check_gnu_make.m4 | 96 + .../support/shared/m4/ax_count_cpus.m4 | 101 + .../support/shared/m4/ax_lapack.m4 | 134 + .../support/shared/m4/ax_lib_hdf5.m4 | 323 + .../support/shared/m4/ax_lib_netcdf4.m4 | 277 + .../support/shared/m4/ax_mpi.m4 | 235 + .../support/shared/m4/ax_openmp.m4 | 123 + .../support/shared/m4/ax_prog_jar.m4 | 50 + .../support/shared/m4/ax_prog_java.m4 | 116 + .../support/shared/m4/ax_prog_java_works.m4 | 92 + .../support/shared/m4/ax_prog_javac.m4 | 80 + .../support/shared/m4/ax_prog_javac_works.m4 | 73 + src/amuse_tidymess/support/shared/m4/fftw.m4 | 122 + .../support/shared/m4/fortran.m4 | 43 + src/amuse_tidymess/support/shared/m4/gmp.m4 | 103 + src/amuse_tidymess/support/shared/m4/gsl.m4 | 122 + src/amuse_tidymess/support/shared/m4/mpfr.m4 | 109 + src/amuse_tidymess/support/shared/m4/pkg.m4 | 343 + .../support/shared/uninstall.sh | 51 + 40 files changed, 14060 insertions(+) create mode 100644 src/amuse_tidymess/packages/amuse-tidymess.amuse_deps create mode 100644 src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml create mode 120000 src/amuse_tidymess/packages/amuse-tidymess/tidymess create mode 100644 src/amuse_tidymess/support/aclocal.m4 create mode 100644 src/amuse_tidymess/support/config.mk.in create mode 100755 src/amuse_tidymess/support/configure create mode 100644 src/amuse_tidymess/support/configure.ac create mode 100755 src/amuse_tidymess/support/shared/config.guess create mode 100755 src/amuse_tidymess/support/shared/config.sub create mode 100755 src/amuse_tidymess/support/shared/install-sh create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_conda.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_cuda.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_detect_os.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_download.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_lib.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_lib_healpix.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_lib_qhull.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_opencl.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/amuse_venv.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_blas.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_check_classpath.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_check_gnu_make.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_count_cpus.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_lapack.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_lib_hdf5.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_lib_netcdf4.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_mpi.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_openmp.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_jar.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_java.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_java_works.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_javac.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_javac_works.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/fftw.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/fortran.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/gmp.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/gsl.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/mpfr.m4 create mode 100644 src/amuse_tidymess/support/shared/m4/pkg.m4 create mode 100755 src/amuse_tidymess/support/shared/uninstall.sh diff --git a/src/amuse_tidymess/packages/amuse-tidymess.amuse_deps b/src/amuse_tidymess/packages/amuse-tidymess.amuse_deps new file mode 100644 index 0000000000..92b61ef197 --- /dev/null +++ b/src/amuse_tidymess/packages/amuse-tidymess.amuse_deps @@ -0,0 +1 @@ +c c++ \ No newline at end of file diff --git a/src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml b/src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml new file mode 100644 index 0000000000..5e5135f400 --- /dev/null +++ b/src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml @@ -0,0 +1,49 @@ +[project] +name = "amuse-tidymess" +version = "0.0.1" +# use the line below instead of the version above if this code is inside the AMUSE +# repository +# dynamic = ["version"] +requires-python = ">=3.7" +#dependencies = [ +# "amuse-framework==2025.9.1.dev14+g24542e9b4.d20251121" +#] +dependencies = [ + "amuse-framework" +] + +[build-system] +requires = ["hatchling", "versioningit"] +build-backend = "hatchling.build" + +[tool.hatch.version] +source = "versioningit" + +[tool.versioningit.next-version] +method = "smallest" + +[tool.versioningit.format] +distance = "{next_version}.dev{distance}+{vcs}{rev}" +dirty = "{base_version}+d{build_date:%Y%m%d}" +distance-dirty = "{next_version}.dev{distance}+{vcs}{rev}.d{build_date:%Y%m%d}" + +[tool.versioningit.vcs] +method = { module = "version_helper", value = "get_amuse_version", module-dir = "amuse_tidymess/support/shared" } + +[tool.hatch.build] +skip-excluded-dirs = true + +[tool.hatch.build.targets.wheel] +include = ["amuse_tidymess/**/*.py"] +exclude = [ + "amuse_tidymess/packages", + "amuse_tidymess/support", + "amuse_tidymess/src", + "amuse_tidymess/tests" + ] +artifacts = ["amuse_tidymess/tidymess_worker"] + +[tool.pytest.ini_options] +pythonpath = ["amuse_tidymess/tests/"] + +testpaths = ["amuse_tidymess/tests"] diff --git a/src/amuse_tidymess/packages/amuse-tidymess/tidymess b/src/amuse_tidymess/packages/amuse-tidymess/tidymess new file mode 120000 index 0000000000..c25bddb6dd --- /dev/null +++ b/src/amuse_tidymess/packages/amuse-tidymess/tidymess @@ -0,0 +1 @@ +../.. \ No newline at end of file diff --git a/src/amuse_tidymess/support/aclocal.m4 b/src/amuse_tidymess/support/aclocal.m4 new file mode 100644 index 0000000000..746e8a9b4b --- /dev/null +++ b/src/amuse_tidymess/support/aclocal.m4 @@ -0,0 +1,18 @@ +# generated automatically by aclocal 1.18.1 -*- Autoconf -*- + +# Copyright (C) 1996-2025 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_include([shared/m4/amuse_lib.m4]) +m4_include([shared/m4/amuse_venv.m4]) +m4_include([shared/m4/ax_count_cpus.m4]) +m4_include([shared/m4/pkg.m4]) diff --git a/src/amuse_tidymess/support/config.mk.in b/src/amuse_tidymess/support/config.mk.in new file mode 100644 index 0000000000..697fc04a54 --- /dev/null +++ b/src/amuse_tidymess/support/config.mk.in @@ -0,0 +1,15 @@ +# Compilers +CXX = @CXX@ + +#MPICXX = @MPICXX@ + +CPU_COUNT = @CPU_COUNT@ + +# Tools +AR = @AR@ +RANLIB = @RANLIB@ +DOWNLOAD = @DOWNLOAD@ + +# AMUSE framework libraries +STOPCOND_CFLAGS = @STOPCOND_CFLAGS@ +STOPCOND_LIBS = @STOPCOND_LIBS@ \ No newline at end of file diff --git a/src/amuse_tidymess/support/configure b/src/amuse_tidymess/support/configure new file mode 100755 index 0000000000..aea03216bd --- /dev/null +++ b/src/amuse_tidymess/support/configure @@ -0,0 +1,6092 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.72 for amuse-tidymess 1.0. +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed 'exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else case e in #( + e) case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else case e in #( + e) exitcode=1; echo positional parameters were not saved. ;; +esac +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else case e in #( + e) as_have_required=no ;; +esac +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi ;; +esac +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed 'exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi ;; +esac +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + t clear + :clear + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='amuse-tidymess' +PACKAGE_TARNAME='amuse-tidymess' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='amuse-tidymess 1.0' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_subst_vars='LTLIBOBJS +LIBOBJS +FOUND_STOPCOND +STOPCOND_LIBS +STOPCOND_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +ac_ct_CC +CFLAGS +CC +RANLIB +AR +target_os +target_vendor +target_cpu +target +OBJEXT +EXEEXT +ac_ct_CXX +CPPFLAGS +LDFLAGS +CXXFLAGS +CXX +CPU_COUNT +EGREP +GREP +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +FFLAGS +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +' + ac_precious_vars='build_alias +host_alias +target_alias +CXX +CXXFLAGS +LDFLAGS +LIBS +CPPFLAGS +CCC +CC +CFLAGS +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +STOPCOND_CFLAGS +STOPCOND_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: '$ac_option' +Try '$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: '$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: '$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +'configure' configures amuse-tidymess 1.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print 'checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for '--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or '..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, 'make install' will install all the files in +'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify +an installation prefix other than '$ac_default_prefix' using '--prefix', +for instance '--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/amuse-tidymess] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of amuse-tidymess 1.0:";; + esac + cat <<\_ACEOF + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CC C compiler command + CFLAGS C compiler flags + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + STOPCOND_CFLAGS + C compiler flags for STOPCOND, overriding pkg-config + STOPCOND_LIBS + linker flags for STOPCOND, overriding pkg-config + +Use these variables to override the choices made by 'configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +amuse-tidymess configure 1.0 +generated by GNU Autoconf 2.72 + +Copyright (C) 2023 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by amuse-tidymess $as_me 1.0, which was +generated by GNU Autoconf 2.72. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See 'config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (char **p, int i) +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* C89 style stringification. */ +#define noexpand_stringify(a) #a +const char *stringified = noexpand_stringify(arbitrary+token=sequence); + +/* C89 style token pasting. Exercises some of the corner cases that + e.g. old MSVC gets wrong, but not very hard. */ +#define noexpand_concat(a,b) a##b +#define expand_concat(a,b) noexpand_concat(a,b) +extern int vA; +extern int vbee; +#define aye A +#define bee B +int *pvA = &expand_concat(v,aye); +int *pvbee = &noexpand_concat(v,bee); + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +/* Does the compiler advertise C99 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +// See if C++-style comments work. + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); +extern void free (void *); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + // Work around memory leak warnings. + free (ia); + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +/* Does the compiler advertise C11 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + + +# Auxiliary files required by this configure script. +ac_aux_files="config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/shared" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; +esac +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Pick up Conda env or virtualenv + + if test "x$VIRTUAL_ENV" != x +then : + + CFLAGS="$CFLAGS -I${VIRTUAL_ENV}/include" + CXXFLAGS="$CXXFLAGS -I${VIRTUAL_ENV}/include" + FFLAGS="$FFLAGS -I${VIRTUAL_ENV}/include" + FCFLAGS="$FCFLAGS -I${VIRTUAL_ENV}/include" + LDFLAGS="$LDFLAGS -L${VIRTUAL_ENV}/lib -Wl,-rpath,${VIRTUAL_ENV}/lib" + PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH" + +fi + + if test "x$CONDA_PREFIX" != x +then : + + # Conda does not set FCFLAGS, so we copy from FFLAGS here + FCFLAGS="$FFLAGS" + LDFLAGS="$LDFLAGS -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib" + # Conda pkg-config includes this already, but in case we have one from + # the system... + PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${CONDA_PREFIX}/lib/pkgconfig" + +fi + # Needs to be exported or the PKG_CHECK_MODULES macro won't see it + export PKG_CONFIG_PATH + + + +# Set CPU_COUNT + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + EGREP_TRADITIONAL=$EGREP + ac_cv_path_EGREP_TRADITIONAL=$EGREP + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the number of available CPUs" >&5 +printf %s "checking the number of available CPUs... " >&6; } + CPU_COUNT="0" + + # Try generic methods + + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1 +then : + : # empty +else case e in #( + e) # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null +then : + : # empty +else case e in #( + e) # Try platform-specific preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^[0-9]+,' -c` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0" ;; #( + freebsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0" ;; #( + netbsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0" ;; #( + solaris*) : + command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^[0-9].*on-line' -c 2>/dev/null` || CPU_COUNT="0" ;; #( + mingw*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + msys*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + cygwin*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + *) : + ;; +esac ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1 +then : + : # empty +else case e in #( + e) # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null +then : + : # empty +else case e in #( + e) # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0" ;; #( + freebsd*) : + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + netbsd*) : + CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^[0-9]+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + solaris*) : + command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0" ;; #( + mingw*) : + if CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\[0-9]+$' -c` +then : + : # empty +else case e in #( + e) test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; +esac +fi ;; #( + msys*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + cygwin*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + *) : + ;; +esac ;; +esac +fi + if test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPU_COUNT" >&5 +printf "%s\n" "$CPU_COUNT" >&6; } + +else case e in #( + e) CPU_COUNT="1" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unable to detect (assuming 1)" >&5 +printf "%s\n" "unable to detect (assuming 1)" >&6; } + ;; +esac +fi + + +# Find the compiler(s) + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 +printf %s "checking whether the C++ compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. +# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an '-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else case e in #( + e) ac_file='' ;; +esac +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "C++ compiler cannot create executables +See 'config.log' for more details" "$LINENO" 5; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 +printf %s "checking for C++ compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) +# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will +# work properly (i.e., refer to 'conftest.exe'), while it won't with +# 'rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else case e in #( + e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + if (!f) + return 1; + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C++ compiled programs. +If you meant to cross compile, use '--host'. +See 'config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext \ + conftest.o conftest.obj conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else case e in #( + e) ac_compiler_gnu=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else case e in #( + e) CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else case e in #( + e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cxx_cxx11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX ;; +esac +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; +esac +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 ;; +esac +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx98+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cxx_cxx98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX ;; +esac +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; +esac +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 ;; +esac +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Find tools for creating static libraries +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +printf %s "checking target system type... " >&6; } +if test ${ac_cv_target+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +printf "%s\n" "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +# Extract the first word of "$target_alias-ar", so it can be a program name with args. +set dummy $target_alias-ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$target_alias-ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +if test -z "$ac_cv_prog_AR"; then + if test "$build" = "$target"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR=":" +fi ;; +esac +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + AR=$ac_ct_AR + else + AR=":" + fi +else + AR="$ac_cv_prog_AR" +fi + +if test $AR = ":" +then : + as_fn_error $? "ar command not found." "$LINENO" 5 +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test $RANLIB = ":" +then : + as_fn_error $? "ranlib command not found." "$LINENO" 5 +fi + +# Find AMUSE libraries + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See 'config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else case e in #( + e) ac_compiler_gnu=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else case e in #( + e) CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 ;; +esac +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + PKG_CONFIG="" + fi +fi + + + amuse_save_LIBS="$LIBS" + amuse_save_LIB_CFLAGS="$STOPCOND_CFLAGS" + amuse_save_LIB_LIBS="$STOPCOND_LIBS" + amuse_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" + + # If we have an active virtualenv, make sure pkg-config searches it + if test "a${VIRTUAL_ENV}" != "a" + then + PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}" + fi + + # All AMUSE libs export C symbols + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + # Search for the library, first directly then fall back to pkg-config + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing is_condition_enabled" >&5 +printf %s "checking for library containing is_condition_enabled... " >&6; } +if test ${ac_cv_search_is_condition_enabled+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char is_condition_enabled (void); +int +main (void) +{ +return is_condition_enabled (); + ; + return 0; +} +_ACEOF +for ac_lib in '' stopcond +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_is_condition_enabled=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_is_condition_enabled+y} +then : + break +fi +done +if test ${ac_cv_search_is_condition_enabled+y} +then : + +else case e in #( + e) ac_cv_search_is_condition_enabled=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_is_condition_enabled" >&5 +printf "%s\n" "$ac_cv_search_is_condition_enabled" >&6; } +ac_res=$ac_cv_search_is_condition_enabled +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + FOUND_STOPCOND="yes" + STOPCOND_LIBS="$LIBS" + STOPCOND_CFLAGS="" + +else case e in #( + e) + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for STOPCOND" >&5 +printf %s "checking for STOPCOND... " >&6; } + +if test -n "$STOPCOND_CFLAGS"; then + pkg_cv_STOPCOND_CFLAGS="$STOPCOND_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"stopcond\""; } >&5 + ($PKG_CONFIG --exists --print-errors "stopcond") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_STOPCOND_CFLAGS=`$PKG_CONFIG --cflags "stopcond" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$STOPCOND_LIBS"; then + pkg_cv_STOPCOND_LIBS="$STOPCOND_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"stopcond\""; } >&5 + ($PKG_CONFIG --exists --print-errors "stopcond") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_STOPCOND_LIBS=`$PKG_CONFIG --libs "stopcond" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + STOPCOND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "stopcond" 2>&1` + else + STOPCOND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "stopcond" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$STOPCOND_PKG_ERRORS" >&5 + + + FOUND_STOPCOND="no" + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + FOUND_STOPCOND="no" + +else + STOPCOND_CFLAGS=$pkg_cv_STOPCOND_CFLAGS + STOPCOND_LIBS=$pkg_cv_STOPCOND_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + FOUND_STOPCOND="yes" + +fi + ;; +esac +fi + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + PKG_CONFIG_PATH="$amuse_save_PKG_CONFIG_PATH" + LIBS="$amuse_save_LIBS" + + # If we have an active CONDA environment, assume that the lib is coming from + # there and add an additional flag so that .mod files can be found. Only really + # needed for stopcond and forsockets, and hopefully conda-forge will give us a + # better solution soon. + if test "${FOUND_STOPCOND}" == "yes" -a "x$CONDA_PREFIX" != "x" + then + STOPCOND_CFLAGS="${STOPCOND_CFLAGS} -I${CONDA_PREFIX}/include" + fi + + # If the user overrode the variables, go with what they set instead of + # what we just detected. + if test "x$amuse_save_LIB_CFLAGS" != "x" +then : + + STOPCOND_CFLAGS="$amuse_save_LIB_CFLAGS" + +fi + if test "x$amuse_save_LIB_LIBS" != "x" +then : + + STOPCOND_LIBS="$amuse_save_LIB_LIBS" + +fi + + + + + + + +# Generate output +ac_config_files="$ac_config_files config.mk" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# 'ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* 'ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # 'set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # 'set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[][ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by amuse-tidymess $as_me 1.0, which was +generated by GNU Autoconf 2.72. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +'$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to the package provider." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +amuse-tidymess config.status 1.0 +configured by $0, generated by GNU Autoconf 2.72, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2023 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: '$1' +Try '$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.mk") CONFIG_FILES="$CONFIG_FILES config.mk" ;; + + *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to '$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with './config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain ':'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is 'configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when '$srcdir' = '.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + + + diff --git a/src/amuse_tidymess/support/configure.ac b/src/amuse_tidymess/support/configure.ac new file mode 100644 index 0000000000..1f0d7d2009 --- /dev/null +++ b/src/amuse_tidymess/support/configure.ac @@ -0,0 +1,30 @@ +AC_CONFIG_AUX_DIR([shared]) +AC_CONFIG_MACRO_DIRS([shared/m4]) + +AC_INIT([amuse-tidymess], [1.0]) + +# Pick up Conda env or virtualenv +AMUSE_VENV() + +# Set CPU_COUNT +AX_COUNT_CPUS() +AC_SUBST(CPU_COUNT) + +# Find the compiler(s) +AC_PROG_CXX() + +# Find tools for creating static libraries +AC_CHECK_TARGET_TOOL([AR], [ar], [:]) +AS_IF([test $AR = ":"], [AC_MSG_ERROR([ar command not found.])]) + +AC_PROG_RANLIB() +AS_IF([test $RANLIB = ":"], [AC_MSG_ERROR([ranlib command not found.])]) + +# Find AMUSE libraries +AMUSE_LIB_STOPCOND() + +# Generate output +AC_CONFIG_FILES([config.mk]) +AC_OUTPUT + + diff --git a/src/amuse_tidymess/support/shared/config.guess b/src/amuse_tidymess/support/shared/config.guess new file mode 100755 index 0000000000..f6d217a49f --- /dev/null +++ b/src/amuse_tidymess/support/shared/config.guess @@ -0,0 +1,1812 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2024 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to . + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system '$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2024 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try '$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# Just in case it came from the environment. +GUESS= + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still +# use 'HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #if defined(__ANDROID__) + LIBC=android + #else + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #elif defined(__LLVM_LIBC__) + LIBC=llvm + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# Note: order is significant - the case branches are not exclusive. + +case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; + *) machine=$UNAME_MACHINE_ARCH-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + sun4*:SunOS:*:*) + case `/usr/bin/arch -k` in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like '4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in + sun3) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + case $UNAME_MACHINE in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if test -x /usr/bin/getconf; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case $sc_cpu_version in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case $sc_kernel_bits in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + GUESS=i386-sequent-sysv4 + ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find 'uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort + # says + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "${cputype-}" = 386; then + UNAME_MACHINE=i386 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; + *:Ironclad:*:*) + GUESS=$UNAME_MACHINE-unknown-ironclad + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&2 </dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = "$UNAME_MACHINE" +UNAME_RELEASE = "$UNAME_RELEASE" +UNAME_SYSTEM = "$UNAME_SYSTEM" +UNAME_VERSION = "$UNAME_VERSION" +EOF +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/amuse_tidymess/support/shared/config.sub b/src/amuse_tidymess/support/shared/config.sub new file mode 100755 index 0000000000..2c6a07ab3c --- /dev/null +++ b/src/amuse_tidymess/support/shared/config.sub @@ -0,0 +1,1971 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2024 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2024 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try '$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ + | windows-* ) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x"$basic_os" != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +obj= +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <&2 + fi + ;; + *) + echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 + exit 1 + ;; +esac + +case $obj in + aout* | coff* | elf* | pe*) + ;; + '') + # empty is fine + ;; + *) + echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 + exit 1 + ;; +esac + +# Here we handle the constraint that a (synthetic) cpu and os are +# valid only in combination with each other and nowhere else. +case $cpu-$os in + # The "javascript-unknown-ghcjs" triple is used by GHC; we + # accept it here in order to tolerate that, but reject any + # variations. + javascript-ghcjs) + ;; + javascript-* | *-ghcjs) + echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os-$obj in + linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ + | linux-mlibc*- | linux-musl*- | linux-newlib*- \ + | linux-relibc*- | linux-uclibc*- ) + ;; + uclinux-uclibc*- ) + ;; + managarm-mlibc*- | managarm-kernel*- ) + ;; + windows*-msvc*-) + ;; + -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ + | -uclibc*- ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + -kernel*- ) + echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel*- ) + echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + exit 1 + ;; + *-msvc*- ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu*- | kopensolaris*-gnu*-) + ;; + vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) + ;; + nto-qnx*-) + ;; + os2-emx-) + ;; + *-eabi*- | *-gnueabi*-) + ;; + none--*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an machine code file format + ;; + -*-) + # Blank kernel with real OS is always fine. + ;; + --*) + # Blank kernel and OS with real machine code file format is always fine. + ;; + *-*-*) + echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/amuse_tidymess/support/shared/install-sh b/src/amuse_tidymess/support/shared/install-sh new file mode 100755 index 0000000000..ec298b5374 --- /dev/null +++ b/src/amuse_tidymess/support/shared/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/src/amuse_tidymess/support/shared/m4/amuse_conda.m4 b/src/amuse_tidymess/support/shared/m4/amuse_conda.m4 new file mode 100644 index 0000000000..f015fa7dab --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_conda.m4 @@ -0,0 +1,36 @@ +# AMUSE_CONDA_LIST() +# +# Runs conda list and saves the result in amuse_conda_list. +# The conda list command is rather slow, so we can avoid an annoying wait by running +# it once and saving the output for use with AMUSE_CONDA_PACKAGE below. +# +# Note that we can't save newlines in a shell variable, so we're replacing them with +# circumflexes instead. We change them back below before grepping. +AC_DEFUN([AMUSE_CONDA_LIST],[ + amuse_conda_list="$(conda list | tr '\n' '^')" +]) + + +# AMUSE_CONDA_PACKAGE(VARIABLE, NAME, VALUE) +# +# Checks that the given package is installed in the active conda environment. +# +# You must run AMUSE_CONDA_LIST() before calling this macro. +# +# Sets $VARIABLE to VALUE if the package was found, or "yes" if VALUE is not passed. +AC_DEFUN([AMUSE_CONDA_PACKAGE],[ + AC_MSG_CHECKING([for conda package $2]) + ax_conda_package_line="$(echo $amuse_conda_list | tr '^' '\n' | grep '^$2 ')" + AS_IF([test "$?" = "0"], [ + # $1="$(AS_ECHO("$ax_conda_package_line") | tr -s ' ' | cut -f 2 -d ' ')" + m4_if([$3],[], [ + $1="yes" + ], [ + $1="$3" + ]) + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/amuse_cuda.m4 b/src/amuse_tidymess/support/shared/m4/amuse_cuda.m4 new file mode 100644 index 0000000000..1da58a131e --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_cuda.m4 @@ -0,0 +1,232 @@ +# AMUSE_CUDA_VERIFY_HEADERS(PATH) +# +# Checks that the given path contains a CUDA installation with include/cuda.h. +# +# Sets amuse_cuda_verify_FLAGS to -I/path/to/cuda/include if successful. +AC_DEFUN([AMUSE_CUDA_VERIFY_HEADERS], [ + AS_IF([test "x$1" = x], [ + amuse_cuda_verify_msg="for cuda.h" + amuse_cuda_flags= + ], [ + amuse_cuda_verify_msg="for cuda.h in $1/include" + amuse_cuda_flags="-I$1/include" + ]) + + AC_MSG_CHECKING([$amuse_cuda_verify_msg]) + amuse_cuda_verify_FLAGS= + + ax_save_CFLAGS="$CFLAGS" + + CFLAGS="$amuse_cuda_flags" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ])], [ + amuse_cuda_verify_FLAGS="$CFLAGS" + amuse_cuda_verify_headers_found="yes" + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + + CFLAGS="$ax_save_CFLAGS" +]) + +# AMUSE_CUDA_VERIFY_LIBS(PATH) +# +# Checks that the given path contains a CUDA installation with lib/libcudart.so or +# lib64/libcudart.so. +# +# Sets amuse_cuda_verify_LDFLAGS to -L/path/to/cuda/lib{64} if successful. +AC_DEFUN([AMUSE_CUDA_VERIFY_LIBS], [ + AS_IF([test "x$1" = x], [ + amuse_cuda_verify_msg="for libcudart" + amuse_cuda_ldflags= + ], [ + amuse_cuda_verify_msg="for libcudart in $1/lib" + amuse_cuda_verify_msg64="for libcudart in $1/lib64" + amuse_cuda_ldflags="-L$1/lib" + amuse_cuda_ldflags64="-L$1/lib64" + ]) + + AC_MSG_CHECKING([$amuse_cuda_verify_msg]) + amuse_cuda_verify_LDFLAGS= + + ax_save_LDFLAGS="$LDFLAGS" + ax_save_LIBS="$LIBS" + + LDFLAGS="$amuse_cuda_ldflags" + LIBS="-lcudart" + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [cudaFree(0);])], [ + amuse_cuda_verify_LDFLAGS="$LDFLAGS" + amuse_cuda_verify_libs_found="yes" + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + + AS_IF([test "x$amuse_cuda_verify_libs_found" = x], [ + AC_MSG_CHECKING([$amuse_cuda_verify_msg64]) + LDFLAGS="$amuse_cuda_ldflags64" + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [cudaFree(0);])], [ + amuse_cuda_verify_LDFLAGS="$LDFLAGS" + amuse_cuda_verify_libs_found="yes" + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + ]) + ]) + + LIBS="$ax_save_LIBS" + LDFLAGS="$ax_save_LDFLAGS" +]) + +# AMUSE_CUDA_VERIFY_SET_VARS(CUDA_TK) +# +# Sets CUDA_TK, NVCC, CUDA_FLAGS and CUDA_LDFLAGS from the internal values, if all +# of them have been found. +AC_DEFUN([AMUSE_CUDA_VERIFY_SET_VARS], [ + AS_IF( + [test \(x"$amuse_cuda_verify_NVCC" != x\) -a \(x"$amuse_cuda_verify_headers_found" != x\) -a \(x"$amuse_cuda_verify_libs_found" != x\)], + [ + CUDA_TK="$1" + NVCC="$amuse_cuda_verify_NVCC" + CUDA_FLAGS="$amuse_cuda_verify_FLAGS" + CUDA_LDFLAGS="$amuse_cuda_verify_LDFLAGS" + ] + ) +]) + +# AMUSE_CUDA_VERIFY(PATH) +# +# Checks that the given path contains a CUDA installation with bin/nvcc, +# lib/libcudart.so, and include/cuda.h. +# +# Sets CUDA_TK= if successful, and if successful also sets NVCC to the location +# of nvcc, CUDA_LDFLAGS to -L/path/to/cuda/libs, and CUDA_FLAGS to +# -I/path/to/cuda/include. +AC_DEFUN([AMUSE_CUDA_VERIFY], [ + amuse_cuda_verify_headers_found= + amuse_cuda_verify_libs_found= + + AS_IF([test -d $1], [ + AC_PATH_PROG([amuse_cuda_verify_NVCC], [nvcc], [], [$1/bin]) + + AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ + AMUSE_CUDA_VERIFY_HEADERS([$1]) + ]) + + AS_IF([test x"$amuse_cuda_verify_headers_found" != x], [ + AMUSE_CUDA_VERIFY_LIBS([$1]) + ]) + + AMUSE_CUDA_VERIFY_SET_VARS([$1]) + ], [ + AC_MSG_NOTICE([$1 does not exist or is not a directory, CUDA not found there]) + ]) +]) + +# AMUSE_CUDA_VERIFY_DEFAULT() +# +# Checks for NVCC on the PATH, then finds the CUDA directory from there. +# +# Sets CUDA_TK= if successful, and if successful also sets NVCC to the location +# of nvcc, CUDA_LDFLAGS to -L/path/to/cuda/libs, and CUDA_FLAGS to +# -I/path/to/cuda/include. +AC_DEFUN([AMUSE_CUDA_VERIFY_DEFAULT], [ + AC_PATH_PROG([amuse_cuda_verify_NVCC], [nvcc]) + + AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ + # Got nvcc, verify that we have the rest too + amuse_cuda_verify_ctk_rel=$(dirname -- "$amuse_cuda_verify_NVCC")/.. + # Canonicalise path portably so that it looks nicer + amuse_cuda_verify_CUDA_TK=$(test -d "$amuse_cuda_verify_ctk_rel" && CDPATH= cd -P -- "$amuse_cuda_verify_ctk_rel" && pwd -P) + + AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ + AMUSE_CUDA_VERIFY_HEADERS() + ]) + + AS_IF([test x"$amuse_cuda_verify_headers_found" != x], [ + AMUSE_CUDA_VERIFY_LIBS() + ]) + + AMUSE_CUDA_VERIFY_SET_VARS([$amuse_cuda_verify_CUDA_TK]) + ], [ + AC_MSG_NOTICE([Could not find CUDA via PATH]) + ]) +]) + +# AMUSE_CUDA +# ---------------------------------------------------------- +# set up for CUDA +# +# will set: +# +# CUDA_TK +# NVCC +# +# CUDA_LDFLAGS (with -L/path/to/cuda/lib) +# CUDA_FLAGS (with -I/path/to/cuda/include) +# +# and call AC_SUBST on them. +# +AC_DEFUN([AMUSE_CUDA], [ + AC_LANG_PUSH([C]) + AS_IF([test x"$CUDA_TK" != x], [ + # User set CUDA_TK, verify and use it if it works + AMUSE_CUDA_VERIFY($CUDA_TK) + + AS_IF([test x"$NVCC" = x], [ + AC_MSG_ERROR([CUDA_TK is set, but there is no nvcc in $CUDA_TK/bin. Please set CUDA_TK to the CUDA installation directory, or unset it to autodetect.]) + ]) + ], [ + # CUDA_TK not set, try to discover CUDA via PATH + AMUSE_CUDA_VERIFY_DEFAULT() + + # Not in PATH, try default directory + AS_IF([test x"$CUDA_TK" = x], [ + AMUSE_CUDA_VERIFY([/usr/local/cuda]) + ]) + + # Try /usr/local/cuda-#.#, but only if there's exactly one match + AS_IF([test x"$CUDA_TK" = x], [ + # List CUDA installations + amuse_cuda_installs=$(ls -1 -d /usr/local/cuda-*.* 2>/dev/null) + # If there's more than one, the above will have newlines, and change when we do this + amuse_cuda_installs2=$(echo "x${amuse_cuda_installs}" | tr -d '[:space:]') + AS_IF([test "x${amuse_cuda_installs}" != x], [ + AS_IF([test "x${amuse_cuda_installs}" = "${amuse_cuda_installs2}"], [ + # Here, there's exactly one match + AMUSE_CUDA_VERIFY([$amuse_cuda_installs]) + ], [ + AC_MSG_NOTICE([Multiple CUDA installations found in /usr/local, without a /usr/local/cuda symlink. Please set CUDA_TK to specify which one you want to use.]) + ]) + ], [ + AC_MSG_NOTICE([No CUDA installations found in /usr/local]) + ]) + ]) + + # Try some other locations + for dir in /opt/cuda /usr/local/cuda/cuda /opt/cuda/cuda ; do + AS_IF([test x"$CUDA_TK" = x], [ + AMUSE_CUDA_VERIFY([$dir]) + ]) + done + + # These directories were checked by the old macro, but they're highly obsolete + # so we're not trying them anymore: + # /usr/lib/nvidia, /usr/include/nvidia, /usr/lib/nvidia-current, /usr/include/nvidia-current + + AS_IF([test x"$CUDA_TK" = x], [ + AC_MSG_NOTICE([CUDA not found. Set CUDA_TK if you have it in an odd location.]) + ]) + ]) + + AS_IF([test x"$CUDA_TK" != x], [ + AC_MSG_NOTICE([CUDA found at $CUDA_TK]) + AC_SUBST(CUDA_TK) + AC_SUBST(NVCC) + AC_SUBST(CUDA_FLAGS) + AC_SUBST(CUDA_LDFLAGS) + ]) + + AC_LANG_POP([C]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/amuse_detect_os.m4 b/src/amuse_tidymess/support/shared/m4/amuse_detect_os.m4 new file mode 100644 index 0000000000..ad5375e7b2 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_detect_os.m4 @@ -0,0 +1,19 @@ +# Macro for detecting the platform we're on +# +# Sets AMUSE_ON_MACOS if we're on macOS, or AMUSE_ON_LINUX if we're on GNU/Linux. +AC_DEFUN([AMUSE_DETECT_OS], [ + AC_CANONICAL_TARGET + if test "x$target_os" == "xlinux-gnu" + then + AMUSE_ON_LINUX=1 + fi + + if test "x$target_vendor" == "xapple" + then + AMUSE_ON_MACOS=1 + fi + + AC_SUBST([AMUSE_ON_LINUX]) + AC_SUBST([AMUSE_ON_MACOS]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/amuse_download.m4 b/src/amuse_tidymess/support/shared/m4/amuse_download.m4 new file mode 100644 index 0000000000..6cd03aee6f --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_download.m4 @@ -0,0 +1,38 @@ +# Helper macros for detecting download tools +# +# Some of the community codes aren't included with AMUSE, but are downloaded at build +# time. We need a tool for that, and here is where we find one. +# +# AMUSE_DOWNLOAD() +# +# Searches for a download tool. Two popular and commonly available command line +# download tools are curl and wget. This macro tries to find either one of them +# and sets DOWNLOAD to a command that will take a URL and download its contents to +# standard output. This makes it easier to write that output to a file with a known +# name, which you usually want in a Makefile. +# +# To download a file, use $(DOWNLOAD) https://example.com >example.html +# +AC_DEFUN([AMUSE_DOWNLOAD], [ + AC_CHECK_TOOL(WGET, wget) + AC_CHECK_TOOL(CURL, curl) + + AC_MSG_CHECKING([for a wget or curl to download files with]) + if test "x$WGET" != "x" + then + # The MESA SDK server rejects wget, this is the official work-around + DOWNLOAD="$WGET --progress=bar:force:noscroll --user-agent='' -O -" + AC_MSG_RESULT([yes]) + else + if test "x$CURL" != "x" + then + DOWNLOAD="$CURL -L" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + fi + + AC_SUBST([DOWNLOAD]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/amuse_lib.m4 b/src/amuse_tidymess/support/shared/m4/amuse_lib.m4 new file mode 100644 index 0000000000..a378d8de44 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_lib.m4 @@ -0,0 +1,138 @@ +# Helper macros for detecting AMUSE libraries. +# +# See https://stackoverflow.com/questions/10220946/pkg-check-modules-considered-harmful +# for some background on why we're not using PKG_CHECK_MODULES directly. Do note that +# PKG_CHECK_MODULES checks for pkg-config and gives a useful error these days, so that +# that page is partially outdated. + +# AMUSE_LIB(prefix, module, library, function) +# +# Searches for an AMUSE library and sets ${prefix}_CFLAGS, ${prefix}_LIBS to the +# appropriate values if it is found. +# +# prefix: prefix for the variables to be set +# module: name of the pkg-config module to search for if needed +# library: name of the library to be searched for +# function: name of a function in the library to use for the link check +AC_DEFUN([AMUSE_LIB], [ + amuse_save_LIBS="$LIBS" + amuse_save_LIB_CFLAGS="$[$1][_CFLAGS]" + amuse_save_LIB_LIBS="$[$1][_LIBS]" + amuse_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" + + # If we have an active virtualenv, make sure pkg-config searches it + if test "a${VIRTUAL_ENV}" != "a" + then + PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}" + fi + + # All AMUSE libs export C symbols + AC_LANG_PUSH([C]) + + # Search for the library, first directly then fall back to pkg-config + AC_SEARCH_LIBS([$4], [$3], [ + FOUND_$1="yes" + $1_LIBS="$LIBS" + $1_CFLAGS="" + ], [ + PKG_CHECK_MODULES([$1], [$2], [ + FOUND_$1="yes" + ], [ + FOUND_$1="no" + ]) + ]) + + AC_LANG_POP([C]) + + PKG_CONFIG_PATH="$amuse_save_PKG_CONFIG_PATH" + LIBS="$amuse_save_LIBS" + + # If we have an active CONDA environment, assume that the lib is coming from + # there and add an additional flag so that .mod files can be found. Only really + # needed for stopcond and forsockets, and hopefully conda-forge will give us a + # better solution soon. + if test "${FOUND_$1}" == "yes" -a "x$CONDA_PREFIX" != "x" + then + $1_CFLAGS="${$1_CFLAGS} -I${CONDA_PREFIX}/include" + fi + + # If the user overrode the variables, go with what they set instead of + # what we just detected. + AS_IF([test "x$amuse_save_LIB_CFLAGS" != "x"], [ + $1_CFLAGS="$amuse_save_LIB_CFLAGS" + ]) + AS_IF([test "x$amuse_save_LIB_LIBS" != "x"], [ + $1_LIBS="$amuse_save_LIB_LIBS" + ]) + + AC_SUBST([FOUND_][$1]) + AC_SUBST([$1][_CFLAGS]) + AC_SUBST([$1][_LIBS]) +]) + + +# AMUSE_LIB_STOPCOND() +# +# Searches for the AMUSE stopping conditions library and sets STOPCOND_CFLAGS +# and STOPCOND_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_STOPCOND], [ + AMUSE_LIB([STOPCOND], [stopcond], [stopcond], [is_condition_enabled]) +]) + + +# AMUSE_LIB_STOPCONDMPI() +# +# Searches for the AMUSE stopping conditions library and sets STOPCONDMPI_CFLAGS +# and STOPCONDMPI_LIBS to the appropriate values if it is found. +# +# We use a different function here, to avoid getting a cached value from +# AMUSE_LIB_STOPCOND if both are used. Seems like it indexes by function name. +AC_DEFUN([AMUSE_LIB_STOPCONDMPI], [ + AMUSE_LIB([STOPCONDMPI], [stopcondmpi], [stopcondmpi], [get_set_conditions_]) +]) + + +# AMUSE_LIB_AMUSE_MPI() +# +# Searches for the AMUSE MPI helper library and sets AMUSE_MPI_CFLAGS and +# AMUSE_MPI_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_AMUSE_MPI], [ + AMUSE_LIB([AMUSE_MPI], [amuse_mpi], [amuse_mpi], [get_comm_world]) +]) + + +# AMUSE_LIB_FORSOCKETS() +# +# Searches for the AMUSE forsockets library and sets FORSOCKETS_CFLAGS and +# FORSOCKETS_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_FORSOCKETS], [ + AMUSE_LIB([FORSOCKETS], [forsockets], [forsockets], [forsockets_close]) +]) + + +# AMUSE_LIB_SIMPLE_HASH() +# +# Searches for the AMUSE simple hash library and sets SIMPLE_HASH_CFLAGS and +# SIMPLE_HASH_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_SIMPLE_HASH], [ + AMUSE_LIB([SIMPLE_HASH], [simple_hash], [simple_hash], [init_hash]) +]) + + +# AMUSE_LIB_G6LIB() +# +# Searches for the g6 library and sets G6LIB_CFLAGS and G6LIB_LIBS to +# the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_G6LIB], [ + AMUSE_LIB([G6LIB], [g6lib], [g6], [g6_npipes]) +]) + + +# AMUSE_LIB_SAPPORO_LIGHT() +# +# Searches for the Sapporo light library and sets SAPPORO_LIGHT_CFLAGS and +# SAPPORO_LIGHT_LIBS to the appropriate values if it is found. +AC_DEFUN([AMUSE_LIB_SAPPORO_LIGHT], [ + AMUSE_LIB([SAPPORO_LIGHT], [sapporo_light], [sapporo], [get_device_count]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/amuse_lib_healpix.m4 b/src/amuse_tidymess/support/shared/m4/amuse_lib_healpix.m4 new file mode 100644 index 0000000000..07b6ef6c5e --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_lib_healpix.m4 @@ -0,0 +1,48 @@ +# Helper macro for detecting libhealpix_cxx +# +# AMUSE_LIB_HEALPIX_CXX() +# +# Searches for libhealpix_cxx and sets FOUND_HEALPIX_CXX to "yes" if found. +# +# Also sets HEALPIX_CXX_LIBS to any needed link commands, and HEALPIX_CXX_CFLAGS to any +# needed compiler flags. +# +AC_DEFUN([AMUSE_LIB_HEALPIX_CXX], [ + amuse_lib_healpix_cxx_save_libs="$LIBS" + + AC_MSG_CHECKING([for HEALPix]) + + AC_LANG_PUSH([C++]) + + LIBS="-lhealpix_cxx" + + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([ + #include + ], [ + Healpix_Base hb; + ]) + ], [ + FOUND_HEALPIX_CXX="yes" + HEALPIX_CXX_CFLAGS="" + HEALPIX_CXX_LIBS="$LIBS" + + AC_MSG_RESULT([yes]) + ], + [ + # Not found, try pkg-config instead + PKG_CHECK_MODULES([HEALPIX_CXX], [healpix_cxx], [ + FOUND_HEALPIX_CXX="yes" + AC_MSG_RESULT([yes]) + ], [ + FOUND_HEALPIX_CXX="no" + AC_MSG_RESULT([no]) + ]) + ]) + + AC_LANG_POP([C++]) + + AC_SUBST([HEALPIX_CXX_CFLAGS]) + AC_SUBST([HEALPIX_CXX_LIBS]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/amuse_lib_qhull.m4 b/src/amuse_tidymess/support/shared/m4/amuse_lib_qhull.m4 new file mode 100644 index 0000000000..8761694163 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_lib_qhull.m4 @@ -0,0 +1,30 @@ +# Helper macro for detecting libqhull +# +# AMUSE_LIB_QHULL() +# +# Searches for libqhull and sets FOUND_QHULL to "yes" if found. +# +# Also sets QHULL_LIBS to any needed link commands, and QHULL_FLAGS to any needed +# compiler flags. +# +# Recent versions of libqhull have a reentrant libqhull_r and also a libqhull_p, but we +# test only for libqhull. +# +AC_DEFUN([AMUSE_LIB_QHULL], [ + amuse_lib_qhull_save_libs="$LIBS" + + LIBS="" + AC_SEARCH_LIBS([qh_freeqhull], [qhull_r], [ + FOUND_QHULL="yes" + ], []) + QHULL_LIBS="$LIBS" + QHULL_FLAGS="" + + LIBS="$amuse_lib_qhull_save_libs" + + AC_CHECK_HEADERS([libqhull_r/libqhull_r.h], [], [FOUND_QHULL="no"]) + + AC_SUBST([QHULL_LIBS]) + AC_SUBST([QHULL_FLAGS]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/amuse_opencl.m4 b/src/amuse_tidymess/support/shared/m4/amuse_opencl.m4 new file mode 100644 index 0000000000..28b1efcd8e --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_opencl.m4 @@ -0,0 +1,63 @@ +# Helper macro for detecting OpenCL for C. + +# AMUSE_OPENCL() +# +# Sets FOUND_OPENCL to "yes" if OpenCL is found, to "no" if it is not. +# Sets OPENCL_CFLAGS and OPENCL_LIBS as needed. +# Calls AC_SUBST on all of the above. +# +AC_DEFUN([AMUSE_OPENCL], [ + amuse_save_CFLAGS="$CFLAGS" + amuse_save_LIBS="$LIBS" + + AC_MSG_CHECKING([for OpenCL]) + + # If the user overrode the variables, then we'll use what they set and verify that + # it works. + AS_IF([test "x$OPENCL_CFLAGS" != "x"], [ + amuse_user_OPENCL_CFLAGS="$OPENCL_CFLAGS" + CFLAGS="$OPENCL_CFLAGS $CFLAGS" + ]) + AS_IF([test "x$OPENCL_LIBS" != "x"], [ + amuse_user_OPENCL_LIBS="$OPENCL_LIBS" + LIBS="$OPENCL_LIBS $LIBS" + ]) + + # We only use OpenCL from C, in huayno + AC_LANG_PUSH([C]) + + # Search for the headers + m4_define([amuse_opencl_test_program], [AC_LANG_PROGRAM([ + #if defined(__APPLE__) || defined(__MACOSX) + #include + #else + #include + #endif + ], [clFinish(0)])]) + + AC_COMPILE_IFELSE([amuse_opencl_test_program], [ + # Search for the library as well + LIBS="-lOpenCL $LIBS" + AC_LINK_IFELSE([amuse_opencl_test_program], [ + FOUND_OPENCL="yes" + OPENCL_LIBS="-lOpenCL" + OPENCL_CFLAGS="" + ], [ + FOUND_OPENCL="no" + ]) + ], [ + FOUND_OPENCL="no" + ]) + + AC_LANG_POP([C]) + + LIBS="$amuse_save_LIBS" + CFLAGS="$amuse_save_CFLAGS" + + AC_MSG_RESULT([$FOUND_OPENCL]) + + AC_SUBST([FOUND_OPENCL]) + AC_SUBST([OPENCL_CFLAGS]) + AC_SUBST([OPENCL_LIBS]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/amuse_venv.m4 b/src/amuse_tidymess/support/shared/m4/amuse_venv.m4 new file mode 100644 index 0000000000..155d88d9d6 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/amuse_venv.m4 @@ -0,0 +1,31 @@ +# Helper macro for installing into Conda envs and virtualenvs. + +# AMUSE_VENV() +# +# Detect the active Conda env or virtualenv and extend LDFLAGS and +# PKG_CONFIG_PATH to point to it. This then makes it possible to detect the AMUSE +# libraries as installed in the environment and link to them. +# +AC_DEFUN([AMUSE_VENV], [ + AS_IF([test "x$VIRTUAL_ENV" != x], [ + CFLAGS="$CFLAGS -I${VIRTUAL_ENV}/include" + CXXFLAGS="$CXXFLAGS -I${VIRTUAL_ENV}/include" + FFLAGS="$FFLAGS -I${VIRTUAL_ENV}/include" + FCFLAGS="$FCFLAGS -I${VIRTUAL_ENV}/include" + LDFLAGS="$LDFLAGS -L${VIRTUAL_ENV}/lib -Wl,-rpath,${VIRTUAL_ENV}/lib" + PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH" + ]) + + AS_IF([test "x$CONDA_PREFIX" != x], [ + # Conda does not set FCFLAGS, so we copy from FFLAGS here + FCFLAGS="$FFLAGS" + LDFLAGS="$LDFLAGS -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib" + # Conda pkg-config includes this already, but in case we have one from + # the system... + PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${CONDA_PREFIX}/lib/pkgconfig" + ]) + # Needs to be exported or the PKG_CHECK_MODULES macro won't see it + export PKG_CONFIG_PATH + AC_SUBST([FFLAGS]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/ax_blas.m4 b/src/amuse_tidymess/support/shared/m4/ax_blas.m4 new file mode 100644 index 0000000000..95719050a9 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_blas.m4 @@ -0,0 +1,241 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_blas.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro looks for a library that implements the BLAS linear-algebra +# interface (see http://www.netlib.org/blas/). On success, it sets the +# BLAS_LIBS output variable to hold the requisite library linkages. +# +# To link with BLAS, you should link with: +# +# $BLAS_LIBS $LIBS $FLIBS +# +# in that order. FLIBS is the output variable of the +# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is +# sometimes necessary in order to link with F77 libraries. Users will also +# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same +# reason. +# +# Many libraries are searched for, from ATLAS to CXML to ESSL. The user +# may also use --with-blas= in order to use some specific BLAS +# library . In order to link successfully, however, be aware that you +# will probably need to use the same Fortran compiler (which can be set +# via the F77 env. var.) as was used to compile the BLAS library. +# +# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is +# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is +# not found. If ACTION-IF-FOUND is not specified, the default action will +# define HAVE_BLAS. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2019 Geoffrey M. Oxberry +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 17 + +AU_ALIAS([ACX_BLAS], [AX_BLAS]) +AC_DEFUN([AX_BLAS], [ +AC_PREREQ([2.55]) +AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) +AC_REQUIRE([AC_CANONICAL_HOST]) +ax_blas_ok=no + +AC_ARG_WITH(blas, + [AS_HELP_STRING([--with-blas=], [use BLAS library ])]) +case $with_blas in + yes | "") ;; + no) ax_blas_ok=disable ;; + -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) + BLAS_LIBS="$with_blas" + ;; + *) BLAS_LIBS="-l$with_blas" ;; +esac + +# Get fortran linker names of BLAS functions to check for. +AC_F77_FUNC(sgemm) +AC_F77_FUNC(dgemm) + +ax_blas_save_LIBS="$LIBS" +LIBS="$LIBS $FLIBS" + +# First, check BLAS_LIBS environment variable +if test $ax_blas_ok = no; then +if test "x$BLAS_LIBS" != x; then + save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" + AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes], [BLAS_LIBS=""]) + AC_MSG_RESULT($ax_blas_ok) + LIBS="$save_LIBS" +fi +fi + +# BLAS linked to by default? (happens on some supercomputers) +if test $ax_blas_ok = no; then + save_LIBS="$LIBS"; LIBS="$LIBS" + AC_MSG_CHECKING([if $sgemm is being linked in already]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes]) + AC_MSG_RESULT($ax_blas_ok) + LIBS="$save_LIBS" +fi + +# BLAS in OpenBLAS library? (http://xianyi.github.com/OpenBLAS/) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(openblas, $sgemm, [ax_blas_ok=yes + BLAS_LIBS="-lopenblas"]) +fi + +# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(atlas, ATL_xerbla, + [AC_CHECK_LIB(f77blas, $sgemm, + [AC_CHECK_LIB(cblas, cblas_dgemm, + [ax_blas_ok=yes + BLAS_LIBS="-lcblas -lf77blas -latlas"], + [], [-lf77blas -latlas])], + [], [-latlas])]) +fi + +# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(blas, $sgemm, + [AC_CHECK_LIB(dgemm, $dgemm, + [AC_CHECK_LIB(sgemm, $sgemm, + [ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"], + [], [-lblas])], + [], [-lblas])]) +fi + +# BLAS in Intel MKL library? +if test $ax_blas_ok = no; then + # MKL for gfortran + if test x"$ac_cv_fc_compiler_gnu" = xyes; then + # 64 bit + if test $host_cpu = x86_64; then + AC_CHECK_LIB(mkl_gf_lp64, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread]) + # 32 bit + elif test $host_cpu = i686; then + AC_CHECK_LIB(mkl_gf, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_gf -lmkl_sequential -lmkl_core -lpthread]) + fi + # MKL for other compilers (Intel, PGI, ...?) + else + # 64-bit + if test $host_cpu = x86_64; then + AC_CHECK_LIB(mkl_intel_lp64, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread]) + # 32-bit + elif test $host_cpu = i686; then + AC_CHECK_LIB(mkl_intel, $sgemm, + [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel -lmkl_sequential -lmkl_core -lpthread"],, + [-lmkl_intel -lmkl_sequential -lmkl_core -lpthread]) + fi + fi +fi +# Old versions of MKL +if test $ax_blas_ok = no; then + AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread]) +fi + +# BLAS in Apple vecLib library? +if test $ax_blas_ok = no; then + save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS" + AC_MSG_CHECKING([for $sgemm in -framework vecLib]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"]) + AC_MSG_RESULT($ax_blas_ok) + LIBS="$save_LIBS" +fi + +# BLAS in Alpha CXML library? +if test $ax_blas_ok = no; then + AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"]) +fi + +# BLAS in Alpha DXML library? (now called CXML, see above) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"]) +fi + +# BLAS in Sun Performance library? +if test $ax_blas_ok = no; then + if test "x$GCC" != xyes; then # only works with Sun CC + AC_CHECK_LIB(sunmath, acosp, + [AC_CHECK_LIB(sunperf, $sgemm, + [BLAS_LIBS="-xlic_lib=sunperf -lsunmath" + ax_blas_ok=yes],[],[-lsunmath])]) + fi +fi + +# BLAS in SCSL library? (SGI/Cray Scientific Library) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"]) +fi + +# BLAS in SGIMATH library? +if test $ax_blas_ok = no; then + AC_CHECK_LIB(complib.sgimath, $sgemm, + [ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"]) +fi + +# BLAS in IBM ESSL library? (requires generic BLAS lib, too) +if test $ax_blas_ok = no; then + AC_CHECK_LIB(blas, $sgemm, + [AC_CHECK_LIB(essl, $sgemm, + [ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"], + [], [-lblas $FLIBS])]) +fi + +# Generic BLAS library? +if test $ax_blas_ok = no; then + AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"]) +fi + +AC_SUBST(BLAS_LIBS) + +LIBS="$ax_blas_save_LIBS" + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_blas_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1]) + : +else + ax_blas_ok=no + $2 +fi +])dnl AX_BLAS diff --git a/src/amuse_tidymess/support/shared/m4/ax_check_classpath.m4 b/src/amuse_tidymess/support/shared/m4/ax_check_classpath.m4 new file mode 100644 index 0000000000..55b43d93e3 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_check_classpath.m4 @@ -0,0 +1,61 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_CLASSPATH +# +# DESCRIPTION +# +# AX_CHECK_CLASSPATH just displays the CLASSPATH, for the edification of +# the user. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) +AC_DEFUN([AX_CHECK_CLASSPATH],[ +if test "x$CLASSPATH" = x; then + echo "You have no CLASSPATH, I hope it is good" +else + echo "You have CLASSPATH $CLASSPATH, hope it is correct" +fi +]) + diff --git a/src/amuse_tidymess/support/shared/m4/ax_check_gnu_make.m4 b/src/amuse_tidymess/support/shared/m4/ax_check_gnu_make.m4 new file mode 100644 index 0000000000..71ffe34817 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_check_gnu_make.m4 @@ -0,0 +1,96 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_GNU_MAKE([run-if-true],[run-if-false]) +# +# DESCRIPTION +# +# This macro searches for a GNU version of make. If a match is found: +# +# * The makefile variable `ifGNUmake' is set to the empty string, otherwise +# it is set to "#". This is useful for including a special features in a +# Makefile, which cannot be handled by other versions of make. +# * The makefile variable `ifnGNUmake' is set to #, otherwise +# it is set to the empty string. This is useful for including a special +# features in a Makefile, which can be handled +# by other versions of make or to specify else like clause. +# * The variable `_cv_gnu_make_command` is set to the command to invoke +# GNU make if it exists, the empty string otherwise. +# * The variable `ax_cv_gnu_make_command` is set to the command to invoke +# GNU make by copying `_cv_gnu_make_command`, otherwise it is unset. +# * If GNU Make is found, its version is extracted from the output of +# `make --version` as the last field of a record of space-separated +# columns and saved into the variable `ax_check_gnu_make_version`. +# * Additionally if GNU Make is found, run shell code run-if-true +# else run shell code run-if-false. +# +# Here is an example of its use: +# +# Makefile.in might contain: +# +# # A failsafe way of putting a dependency rule into a makefile +# $(DEPEND): +# $(CC) -MM $(srcdir)/*.c > $(DEPEND) +# +# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) +# @ifGNUmake@ include $(DEPEND) +# @ifGNUmake@ else +# fallback code +# @ifGNUmake@ endif +# +# Then configure.in would normally contain: +# +# AX_CHECK_GNU_MAKE() +# AC_OUTPUT(Makefile) +# +# Then perhaps to cause gnu make to override any other make, we could do +# something like this (note that GNU make always looks for GNUmakefile +# first): +# +# if ! test x$_cv_gnu_make_command = x ; then +# mv Makefile GNUmakefile +# echo .DEFAULT: > Makefile ; +# echo \ $_cv_gnu_make_command \$@ >> Makefile; +# fi +# +# Then, if any (well almost any) other make is called, and GNU make also +# exists, then the other make wraps the GNU make. +# +# LICENSE +# +# Copyright (c) 2008 John Darrington +# Copyright (c) 2015 Enrico M. Crisostomo +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 12 + +AC_DEFUN([AX_CHECK_GNU_MAKE],dnl + [AC_PROG_AWK + AC_CACHE_CHECK([for GNU make],[_cv_gnu_make_command],[dnl + _cv_gnu_make_command="" ; +dnl Search all the common names for GNU make + for a in "$MAKE" make gmake gnumake ; do + if test -z "$a" ; then continue ; fi ; + if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then + _cv_gnu_make_command=$a ; + AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make") + ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') + break ; + fi + done ;]) +dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])]) + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifnGNUmake], [""])], [AS_VAR_SET([ifnGNUmake], ["#"])]) + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])]) + AS_VAR_IF([_cv_gnu_make_command], [""],[$2],[$1]) + AC_SUBST([ifGNUmake]) + AC_SUBST([ifnGNUmake]) +]) + diff --git a/src/amuse_tidymess/support/shared/m4/ax_count_cpus.m4 b/src/amuse_tidymess/support/shared/m4/ax_count_cpus.m4 new file mode 100644 index 0000000000..5db8925534 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_count_cpus.m4 @@ -0,0 +1,101 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED]) +# +# DESCRIPTION +# +# Attempt to count the number of logical processor cores (including +# virtual and HT cores) currently available to use on the machine and +# place detected value in CPU_COUNT variable. +# +# On successful detection, ACTION-IF-DETECTED is executed if present. If +# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The +# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1. +# +# LICENSE +# +# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) +# Copyright (c) 2012 Brian Aker +# Copyright (c) 2008 Michael Paul Bailey +# Copyright (c) 2008 Christophe Tournayre +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 22 + + AC_DEFUN([AX_COUNT_CPUS],[dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_EGREP])dnl + AC_MSG_CHECKING([the number of available CPUs]) + CPU_COUNT="0" + + # Try generic methods + + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl + # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl + [[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl + [[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl + )dnl + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl + # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + ])dnl + + AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl + # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + AS_CASE([[$host_os]],dnl + [[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl + [[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl + [[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl + [[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl + [[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl + [[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl + [[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl + [[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl + )dnl + ])dnl + + AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl + AC_MSG_RESULT([[$CPU_COUNT]]) + m4_ifvaln([$1],[$1],)dnl + ],[dnl + m4_ifval([$2],[dnl + AS_UNSET([[CPU_COUNT]]) + AC_MSG_RESULT([[unable to detect]]) + $2 + ], [dnl + CPU_COUNT="1" + AC_MSG_RESULT([[unable to detect (assuming 1)]]) + ])dnl + ])dnl + ])dnl diff --git a/src/amuse_tidymess/support/shared/m4/ax_lapack.m4 b/src/amuse_tidymess/support/shared/m4/ax_lapack.m4 new file mode 100644 index 0000000000..abaff9d171 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_lapack.m4 @@ -0,0 +1,134 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_lapack.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro looks for a library that implements the LAPACK linear-algebra +# interface (see http://www.netlib.org/lapack/). On success, it sets the +# LAPACK_LIBS output variable to hold the requisite library linkages. +# +# To link with LAPACK, you should link with: +# +# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS +# +# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro, +# called automatically. FLIBS is the output variable of the +# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is +# sometimes necessary in order to link with F77 libraries. Users will also +# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same +# reason. +# +# The user may also use --with-lapack= in order to use some specific +# LAPACK library . In order to link successfully, however, be aware +# that you will probably need to use the same Fortran compiler (which can +# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS +# libraries. +# +# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_LAPACK. +# +# LICENSE +# +# Copyright (c) 2009 Steven G. Johnson +# Copyright (c) 2019 Geoffrey M. Oxberry +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 10 + +AU_ALIAS([ACX_LAPACK], [AX_LAPACK]) +AC_DEFUN([AX_LAPACK], [ +AC_REQUIRE([AX_BLAS]) +ax_lapack_ok=no + +AC_ARG_WITH(lapack, + [AS_HELP_STRING([--with-lapack=], [use LAPACK library ])]) +case $with_lapack in + yes | "") ;; + no) ax_lapack_ok=disable ;; + -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) + LAPACK_LIBS="$with_lapack" + ;; + *) LAPACK_LIBS="-l$with_lapack" ;; +esac + +# Get fortran linker name of LAPACK function to check for. +AC_F77_FUNC(cheev) + +# We cannot use LAPACK if BLAS is not found +if test "x$ax_blas_ok" != xyes; then + ax_lapack_ok=noblas + LAPACK_LIBS="" +fi + +# First, check LAPACK_LIBS environment variable +if test "x$LAPACK_LIBS" != x; then + save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" + AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [$cheev])], [ax_lapack_ok=yes], [LAPACK_LIBS=""]) + AC_MSG_RESULT($ax_lapack_ok) + LIBS="$save_LIBS" + if test $ax_lapack_ok = no; then + LAPACK_LIBS="" + fi +fi + +# LAPACK linked to by default? (is sometimes included in BLAS lib) +if test $ax_lapack_ok = no; then + save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" + AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes]) + LIBS="$save_LIBS" +fi + +# Generic LAPACK library? +for lapack in lapack lapack_rs6k; do + if test $ax_lapack_ok = no; then + save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" + AC_CHECK_LIB($lapack, $cheev, + [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) + LIBS="$save_LIBS" + fi +done + +AC_SUBST(LAPACK_LIBS) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x"$ax_lapack_ok" = xyes; then + ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) + : +else + ax_lapack_ok=no + $2 +fi +])dnl AX_LAPACK diff --git a/src/amuse_tidymess/support/shared/m4/ax_lib_hdf5.m4 b/src/amuse_tidymess/support/shared/m4/ax_lib_hdf5.m4 new file mode 100644 index 0000000000..074c2a820a --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_lib_hdf5.m4 @@ -0,0 +1,323 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_lib_hdf5.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_LIB_HDF5([serial/parallel]) +# +# DESCRIPTION +# +# This macro provides tests of the availability of HDF5 library. +# +# The optional macro argument should be either 'serial' or 'parallel'. The +# former only looks for serial HDF5 installations via h5cc. The latter +# only looks for parallel HDF5 installations via h5pcc. If the optional +# argument is omitted, serial installations will be preferred over +# parallel ones. +# +# The macro adds a --with-hdf5 option accepting one of three values: +# +# no - do not check for the HDF5 library. +# yes - do check for HDF5 library in standard locations. +# path - complete path to the HDF5 helper script h5cc or h5pcc. +# +# If HDF5 is successfully found, this macro calls +# +# AC_SUBST(HDF5_VERSION) +# AC_SUBST(HDF5_CC) +# AC_SUBST(HDF5_CFLAGS) +# AC_SUBST(HDF5_CPPFLAGS) +# AC_SUBST(HDF5_LDFLAGS) +# AC_SUBST(HDF5_LIBS) +# AC_SUBST(HDF5_FC) +# AC_SUBST(HDF5_FFLAGS) +# AC_SUBST(HDF5_FLIBS) +# AC_SUBST(HDF5_TYPE) +# AC_DEFINE(HAVE_HDF5) +# +# and sets with_hdf5="yes". Additionally, the macro sets +# with_hdf5_fortran="yes" if a matching Fortran wrapper script is found. +# Note that Autoconf's Fortran support is not used to perform this check. +# H5CC and H5FC will contain the appropriate serial or parallel HDF5 +# wrapper script locations. +# +# If HDF5 is disabled or not found, this macros sets with_hdf5="no" and +# with_hdf5_fortran="no". +# +# Your configuration script can test $with_hdf to take any further +# actions. HDF5_{C,CPP,LD}FLAGS may be used when building with C or C++. +# HDF5_F{FLAGS,LIBS} should be used when building Fortran applications. +# +# To use the macro, one would code one of the following in "configure.ac" +# before AC_OUTPUT: +# +# 1) dnl Check for HDF5 support +# AX_LIB_HDF5() +# +# 2) dnl Check for serial HDF5 support +# AX_LIB_HDF5([serial]) +# +# 3) dnl Check for parallel HDF5 support +# AX_LIB_HDF5([parallel]) +# +# One could test $with_hdf5 for the outcome or display it as follows +# +# echo "HDF5 support: $with_hdf5" +# +# You could also for example, override the default CC in "configure.ac" to +# enforce compilation with the compiler that HDF5 uses: +# +# AX_LIB_HDF5([parallel]) +# if test "$with_hdf5" = "yes"; then +# CC="$HDF5_CC" +# else +# AC_MSG_ERROR([Unable to find HDF5, we need parallel HDF5.]) +# fi +# +# The HDF5_TYPE environment variable returns "parallel" or "serial", +# depending on which type of library is found. +# +# LICENSE +# +# Copyright (c) 2009 Timothy Brown +# Copyright (c) 2010 Rhys Ulerich +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 20 + +AC_DEFUN([AX_LIB_HDF5], [ + +AC_REQUIRE([AC_PROG_SED]) +AC_REQUIRE([AC_PROG_AWK]) +AC_REQUIRE([AC_PROG_GREP]) + +dnl Check first argument is one of the recognized values. +dnl Fail eagerly if is incorrect as this simplifies case statements below. +if test "m4_normalize(m4_default([$1],[]))" = "" ; then + : # Recognized value +elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then + : # Recognized value +elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then + : # Recognized value +else + AC_MSG_ERROR([ +Unrecognized value for AX[]_LIB_HDF5 within configure.ac. +If supplied, argument 1 must be either 'serial' or 'parallel'. +]) +fi + +dnl Add a default --with-hdf5 configuration option. +AC_ARG_WITH([hdf5], + AS_HELP_STRING( + [--with-hdf5=[yes/no/PATH]], + m4_case(m4_normalize([$1]), + [serial], [location of h5cc for serial HDF5 configuration], + [parallel], [location of h5pcc for parallel HDF5 configuration], + [location of h5cc or h5pcc for HDF5 configuration]) + ), + [if test "$withval" = "no"; then + with_hdf5="no" + elif test "$withval" = "yes"; then + with_hdf5="yes" + else + with_hdf5="yes" + H5CC="$withval" + fi], + [with_hdf5="yes"] +) + +dnl Set defaults to blank +HDF5_CC="" +HDF5_VERSION="" +HDF5_CFLAGS="" +HDF5_CPPFLAGS="" +HDF5_LDFLAGS="" +HDF5_LIBS="" +HDF5_FC="" +HDF5_FFLAGS="" +HDF5_FLIBS="" +HDF5_TYPE="" + +dnl Try and find hdf5 compiler tools and options. +if test "$with_hdf5" = "yes"; then + if test -z "$H5CC"; then + dnl Check to see if H5CC is in the path. + AC_PATH_PROGS( + [H5CC], + m4_case(m4_normalize([$1]), + [serial], [h5cc], + [parallel], [h5pcc], + [h5cc h5pcc]), + []) + else + AC_MSG_CHECKING([Using provided HDF5 C wrapper]) + AC_MSG_RESULT([$H5CC]) + fi + AC_MSG_CHECKING([for HDF5 type]) + AS_CASE([$H5CC], + [*h5pcc], [HDF5_TYPE=parallel], + [*h5cc], [HDF5_TYPE=serial], + [HDF5_TYPE=neither]) + AC_MSG_RESULT([$HDF5_TYPE]) + AC_MSG_CHECKING([for HDF5 libraries]) + if test ! -f "$H5CC" || test ! -x "$H5CC"; then + AC_MSG_RESULT([no]) + AC_MSG_WARN(m4_case(m4_normalize([$1]), + [serial], [ +Unable to locate serial HDF5 compilation helper script 'h5cc'. +Please specify --with-hdf5= as the full path to h5cc. +HDF5 support is being disabled (equivalent to --with-hdf5=no). +], [parallel],[ +Unable to locate parallel HDF5 compilation helper script 'h5pcc'. +Please specify --with-hdf5= as the full path to h5pcc. +HDF5 support is being disabled (equivalent to --with-hdf5=no). +], [ +Unable to locate HDF5 compilation helper scripts 'h5cc' or 'h5pcc'. +Please specify --with-hdf5= as the full path to h5cc or h5pcc. +HDF5 support is being disabled (equivalent to --with-hdf5=no). +])) + with_hdf5="no" + with_hdf5_fortran="no" + else + dnl Get the h5cc output + HDF5_SHOW=$(eval $H5CC -show) + + dnl Get the actual compiler used + HDF5_CC=$(eval $H5CC -show | head -n 1 | $AWK '{print $[]1}') + if test "$HDF5_CC" = "ccache"; then + HDF5_CC=$(eval $H5CC -show | head -n 1 | $AWK '{print $[]2}') + fi + + dnl h5cc provides both AM_ and non-AM_ options + dnl depending on how it was compiled either one of + dnl these are empty. Lets roll them both into one. + + dnl Look for "HDF5 Version: X.Y.Z" + HDF5_VERSION=$(eval $H5CC -showconfig | $GREP 'HDF5 Version:' \ + | $AWK '{print $[]3}') + + dnl A ideal situation would be where everything we needed was + dnl in the AM_* variables. However most systems are not like this + dnl and seem to have the values in the non-AM variables. + dnl + dnl We try the following to find the flags: + dnl (1) Look for "NAME:" tags + dnl (2) Look for "H5_NAME:" tags + dnl (3) Look for "AM_NAME:" tags + dnl + HDF5_tmp_flags=$(eval $H5CC -showconfig \ + | $GREP 'FLAGS\|Extra libraries:' \ + | $AWK -F: '{printf("%s "), $[]2}' ) + + dnl Find the installation directory and append include/ + HDF5_tmp_inst=$(eval $H5CC -showconfig \ + | $GREP 'Installation point:' \ + | $AWK '{print $[]NF}' ) + + dnl Add this to the CPPFLAGS + HDF5_CPPFLAGS="-I${HDF5_tmp_inst}/include" + + dnl Now sort the flags out based upon their prefixes + for arg in $HDF5_SHOW $HDF5_tmp_flags ; do + case "$arg" in + -I*) echo $HDF5_CPPFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ + || HDF5_CPPFLAGS="$HDF5_CPPFLAGS $arg" + ;; + -L*) echo $HDF5_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ + || HDF5_LDFLAGS="$HDF5_LDFLAGS $arg" + ;; + -l*) echo $HDF5_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \ + || HDF5_LIBS="$HDF5_LIBS $arg" + ;; + esac + done + + HDF5_LIBS="-lhdf5 $HDF5_LIBS" + AC_MSG_RESULT([yes (version $[HDF5_VERSION])]) + + dnl See if we can compile + AC_LANG_PUSH([C]) + ax_lib_hdf5_save_CC=$CC + ax_lib_hdf5_save_CPPFLAGS=$CPPFLAGS + ax_lib_hdf5_save_LIBS=$LIBS + ax_lib_hdf5_save_LDFLAGS=$LDFLAGS + CC=$HDF5_CC + CPPFLAGS=$HDF5_CPPFLAGS + LIBS=$HDF5_LIBS + LDFLAGS=$HDF5_LDFLAGS + AC_CHECK_HEADER([hdf5.h], [ac_cv_hadf5_h=yes], [ac_cv_hadf5_h=no]) + AC_CHECK_LIB([hdf5], [H5Fcreate], [ac_cv_libhdf5=yes], + [ac_cv_libhdf5=no]) + if test "$ac_cv_hadf5_h" = "no" && test "$ac_cv_libhdf5" = "no" ; then + AC_MSG_WARN([Unable to compile HDF5 test program]) + fi + dnl Look for HDF5's high level library + AC_HAVE_LIBRARY([hdf5_hl], [HDF5_LIBS="-lhdf5_hl $HDF5_LIBS"], [], []) + + CC=$ax_lib_hdf5_save_CC + CPPFLAGS=$ax_lib_hdf5_save_CPPFLAGS + LIBS=$ax_lib_hdf5_save_LIBS + LDFLAGS=$ax_lib_hdf5_save_LDFLAGS + AC_LANG_POP([C]) + + AC_MSG_CHECKING([for matching HDF5 Fortran wrapper]) + dnl Presume HDF5 Fortran wrapper is just a name variant from H5CC + H5FC=$(eval echo -n $H5CC | $SED -n 's/cc$/fc/p') + if test -x "$H5FC"; then + AC_MSG_RESULT([$H5FC]) + with_hdf5_fortran="yes" + AC_SUBST([H5FC]) + + dnl Again, pry any remaining -Idir/-Ldir from compiler wrapper + for arg in `$H5FC -show` + do + case "$arg" in #( + -I*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \ + || HDF5_FFLAGS="$HDF5_FFLAGS $arg" + ;;#( + -L*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \ + || HDF5_FFLAGS="$HDF5_FFLAGS $arg" + dnl HDF5 installs .mod files in with libraries, + dnl but some compilers need to find them with -I + echo $HDF5_FFLAGS | $GREP -e "-I${arg#-L}" >/dev/null \ + || HDF5_FFLAGS="$HDF5_FFLAGS -I${arg#-L}" + ;; + esac + done + + dnl Make Fortran link line by inserting Fortran libraries + for arg in $HDF5_LIBS + do + case "$arg" in #( + -lhdf5_hl) HDF5_FLIBS="$HDF5_FLIBS -lhdf5hl_fortran $arg" + ;; #( + -lhdf5) HDF5_FLIBS="$HDF5_FLIBS -lhdf5_fortran $arg" + ;; #( + *) HDF5_FLIBS="$HDF5_FLIBS $arg" + ;; + esac + done + else + AC_MSG_RESULT([no]) + with_hdf5_fortran="no" + fi + + AC_SUBST([HDF5_VERSION]) + AC_SUBST([HDF5_CC]) + AC_SUBST([HDF5_CFLAGS]) + AC_SUBST([HDF5_CPPFLAGS]) + AC_SUBST([HDF5_LDFLAGS]) + AC_SUBST([HDF5_LIBS]) + AC_SUBST([HDF5_FC]) + AC_SUBST([HDF5_FFLAGS]) + AC_SUBST([HDF5_FLIBS]) + AC_SUBST([HDF5_TYPE]) + AC_DEFINE([HAVE_HDF5], [1], [Defined if you have HDF5 support]) + fi +fi +]) diff --git a/src/amuse_tidymess/support/shared/m4/ax_lib_netcdf4.m4 b/src/amuse_tidymess/support/shared/m4/ax_lib_netcdf4.m4 new file mode 100644 index 0000000000..e9dd487a02 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_lib_netcdf4.m4 @@ -0,0 +1,277 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_lib_netcdf4.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_LIB_NETCDF4([serial/parallel]) +# +# DESCRIPTION +# +# This macro provides tests of the availability of the NetCDF v4 library. +# +# The optional macro argument should be either 'serial' or 'parallel'. The +# macro will call nc-config to check the output of the '--has-pnetcdf' +# option and error out if the requested parallel isn't supported. +# +# If the optional argument is omitted, no check is made to see if NetCDF +# has parallel support. +# +# The macro adds a --with-netcdf4 option accepting one of three values: +# +# no - do not check for the NetCDF4 library. +# yes - do check for NetCDF4 library in standard locations. +# path - installation prefix for NetCDF version 4. +# +# If NetCDF4 is successfully found, this macro calls +# +# AC_SUBST(NETCDF4_VERSION) +# AC_SUBST(NETCDF4_CC) +# AC_SUBST(NETCDF4_CFLAGS) +# AC_SUBST(NETCDF4_CPPFLAGS) +# AC_SUBST(NETCDF4_LDFLAGS) +# AC_SUBST(NETCDF4_LIBS) +# AC_SUBST(NETCDF4_FC) +# AC_SUBST(NETCDF4_FFLAGS) +# AC_SUBST(NETCDF4_FLIBS) +# AC_DEFINE(HAVE_NETCDF4) +# +# It also sets +# +# with_netcdf4="yes" +# with_netcdf4_fortran="yes" (if NetCDF has Fortran support) +# with_netcdf4_parallel="yes" (if NetCDF has MPI support) +# +# If NetCDF4 is disabled or not found, this macros sets +# +# with_netcdf4="no" +# with_netcdf4_fortran="no" +# +# Note it does not set with_netcdf4_parallel in this case. +# +# Your configuration script can test $with_netcdf4 to take any further +# actions. NETCDF4_{C,CPP,LD}FLAGS may be used when building with C or +# C++. NETCDF4_F{FLAGS,LIBS} and NETCDF4_LDFLAGS should be used when +# building Fortran applications. +# +# To use the macro, one would code one of the following in "configure.ac" +# before AC_OUTPUT: +# +# 1) dnl Check for NetCDF4 support +# AX_LIB_NETCDF4() +# +# 2) dnl Check for serial NetCDF4 support +# AX_LIB_NETCDF4([serial]) +# +# 3) dnl Check for parallel NetCDF4 support +# AX_LIB_NETCDF4([parallel]) +# +# One could test $with_netcdf4 for the outcome or display it as follows +# +# echo "NetCDF v4 support: $with_netcdf4" +# +# One could also for example, override the default CC in "configure.ac" to +# enforce compilation with the compiler that NetCDF v4 was built with: +# +# AX_LIB_NETCDF4([parallel]) +# if test "$with_netcdf4" = "yes"; then +# CC="$NETCDF4_CC" +# else +# AC_MSG_ERROR([Unable to find NetCDF4, we need parallel NetCDF4.]) +# fi +# +# LICENSE +# +# Copyright (c) 2016 Timothy Brown +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AC_DEFUN([AX_LIB_NETCDF4], [ + +AC_REQUIRE([AC_PROG_SED]) +AC_REQUIRE([AC_PROG_AWK]) +AC_REQUIRE([AC_PROG_GREP]) + +dnl Check first argument is one of the recognized values. +dnl Fail eagerly if is incorrect as this simplifies case statements below. +if test "m4_normalize(m4_default([$1],[]))" = "" ; then + netcdf4_requested_mode="serial" +elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then + netcdf4_requested_mode="serial" +elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then + netcdf4_requested_mode="parallel" +else + AC_MSG_ERROR([ +Unrecognized value for AX[]_LIB_NETCDF4 within configure.ac. +If supplied, argument 1 must be either 'serial' or 'parallel'. +]) +fi + +dnl Add a default --with-netcdf4 configuration option. +AC_ARG_WITH([netcdf4], + AS_HELP_STRING( + [--with-netcdf4=[yes/no/PATH]], + m4_case(m4_normalize([$1]), + [serial], [base directory of serial NetCDF4 installation], + [parallel], [base directory of parallel NetCDF4 installation], + [base directory of NetCDF4 installation]) + ), + [if test "$withval" = "no"; then + with_netcdf4="no" + elif test "$withval" = "yes"; then + with_netcdf4="yes" + else + with_netcdf4="yes" + NETCDF4_PREFIX="${withval}" + NC_CONFIG="${withval}/bin/nc-config" + fi], + [with_netcdf4="yes"] +) + +dnl Set defaults to blank +NETCDF4_CC="" +NETCDF4_VERSION="" +NETCDF4_CFLAGS="" +NETCDF4_CPPFLAGS="" +NETCDF4_LDFLAGS="" +NETCDF4_LIBS="" +NETCDF4_FC="" +NETCDF4_FFLAGS="" +NETCDF4_FLIBS="" + +dnl Try and find NetCDF4 tools and options. +if test "$with_netcdf4" = "yes"; then + if test -z "$NC_CONFIG"; then + dnl Check to see if NC_CONFIG is in the path. + AC_PATH_PROGS([NC_CONFIG], [nc-config], []) + NETCDF4_PREFIX=$(AS_DIRNAME([$(AS_DIRNAME(["$NC_CONFIG"]))])) + else + AC_MSG_CHECKING([Using provided NetCDF4 prefix]) + AC_MSG_RESULT([$NC_CONFIG]) + fi + + AC_MSG_CHECKING([for NetCDF4 libraries]) + + if test ! -f "$NC_CONFIG" || test ! -x "$NC_CONFIG"; then + AC_MSG_RESULT([no]) + AC_MSG_WARN([ + +Unable to locate NetCDF4 compilation helper script 'nc-config'. +Please specify --with-netcdf4= as the full path prefix +where NetCDF4 has been installed. +NetCDF4 support is being disabled (equivalent to --with-netcdf4=no). +]) + with_netcdf4="no" + with_netcdf4_fortran="no" + else + dnl Get the actual compiler used + NETCDF4_CC=$(eval $NC_CONFIG --cc | $AWK '{print $[]1}') + if test "$NETCDF4_CC" = "ccache"; then + NETCDF4_CC=$(eval $NC_CONFIG --cc | $AWK '{print $[]2}') + fi + + dnl Look for version + NETCDF4_VERSION=$(eval $NC_CONFIG --version | $AWK '{print $[]2}') + + dnl Look for the CFLAGS + NETCDF4_CFLAGS=$(eval $NC_CONFIG --cflags) + + dnl Look for the LIBS and LDFLAGS + NETCDF4_tmp_clibs=$(eval $NC_CONFIG --libs) + + dnl Sort out the tmp libs based on their prefixes + for arg in $NETCDF4_tmp_clibs ; do + case "$arg" in + -L*) echo $NETCDF4_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ + || NETCDF4_LDFLAGS="$arg $NETCDF4_LDFLAGS" + ;; + -l*) echo $NETCDF4_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \ + || NETCDF4_LIBS="$arg $NETCDF4_LIBS" + ;; + esac + done + + AC_MSG_RESULT([yes (version $[NETCDF4_VERSION])]) + + dnl See if we need (and have) parallel support + if test "$netcdf4_requested_mode" = "parallel" ; then + with_netcdf4_parallel=$(eval $NC_CONFIG --has-pnetcdf) + if test "$with_netcdf4_parallel" = "no" ; then + AC_MSG_ERROR([ +parallel NetCDF4 is not supported (while it was requested) +]) + fi + fi + + dnl See if we can compile + ax_lib_netcdf4_save_CC=$CC + ax_lib_netcdf4_save_CPPFLAGS=$CPPFLAGS + ax_lib_netcdf4_save_LIBS=$LIBS + ax_lib_netcdf4_save_LDFLAGS=$LDFLAGS + CC=$NETCDF4_CC + CFLAGS=$NETCDF4_CFLAGS + LIBS=$NETCDF4_LIBS + LDFLAGS=$NETCDF4_LDFLAGS + AC_CHECK_HEADER([netcdf.h], [ac_cv_netcdf4_h=yes], [ac_cv_netcdf4_h=no]) + AC_CHECK_LIB([netcdf], [nc_create], [ac_cv_libnetcdf4=yes], + [ac_cv_libnetcdf4=no]) + if test "$ac_cv_netcdf4_h" = "no" && \ + test "$ac_cv_libnetcdf4" = "no" ; then + AC_MSG_WARN([Unable to compile NetCDF4 test program]) + fi + + CC=$ax_lib_netcdf4_save_CC + CFLAGS=$ax_lib_netcdf4_save_CFLAGS + LIBS=$ax_lib_netcdf4_save_LIBS + LDFLAGS=$ax_lib_hdf5_save_LDFLAGS + + + AC_MSG_CHECKING([for matching NetCDF4 Fortran libraries]) + NF_CONFIG="${NETCDF4_PREFIX}/bin/nf-config" + if test ! -f "$NF_CONFIG" || test ! -x "$NF_CONFIG"; then + AC_MSG_RESULT([no]) + with_netcdf4_fortran="no" + else + NETCDF_FVERSION=$(eval $NF_CONFIG --version | $AWK '{print $[]2}') + AC_MSG_RESULT([yes (version $[NETCDF_FVERSION])]) + NETCDF4_FC=$(eval $NF_CONFIG --fc | $AWK '{print $[]1}') + if test "$NETCDF4_FC" = "ccache"; then + NETCDF4_FC=$(eval $NF_CONFIG --fc | $AWK '{print $[]2}') + fi + dnl Look for the FFLAGS + NETCDF4_FFLAGS=$(eval $NC_CONFIG --fflags) + + dnl Look for the FLIBS and LDFLAGS + NETCDF4_tmp_flibs=$(eval $NC_CONFIG --flibs) + + dnl Sort out the tmp libs based on their prefixes + for arg in $NETCDF4_tmp_flibs ; do + case "$arg" in + -L*) echo $NETCDF4_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ + || NETCDF4_LDFLAGS="$arg $NETCDF4_LDFLAGS" + ;; + -l*) echo $NETCDF4_FLIBS | $GREP -e "$arg" 2>&1 >/dev/null \ + || NETCDF4_FLIBS="$arg $NETCDF4_FLIBS" + ;; + esac + done + with_netcdf4_fortran="yes" + fi + + AC_SUBST([NETCDF4_VERSION]) + AC_SUBST([NETCDF4_CC]) + AC_SUBST([NETCDF4_CFLAGS]) + AC_SUBST([NETCDF4_LDFLAGS]) + AC_SUBST([NETCDF4_LIBS]) + AC_SUBST([NETCDF4_FC]) + AC_SUBST([NETCDF4_FFLAGS]) + AC_SUBST([NETCDF4_FLIBS]) + AC_DEFINE([HAVE_NETCDF4], [1], [Defined if you have NETCDF4 support]) + fi +fi +]) diff --git a/src/amuse_tidymess/support/shared/m4/ax_mpi.m4 b/src/amuse_tidymess/support/shared/m4/ax_mpi.m4 new file mode 100644 index 0000000000..dbde02a9c4 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_mpi.m4 @@ -0,0 +1,235 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_mpi.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_MPI([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro tries to find out how to compile programs that use MPI +# (Message Passing Interface), a standard API for parallel process +# communication (see http://www-unix.mcs.anl.gov/mpi/) +# +# On success, it sets the MPICC, MPICXX, MPIF77, or MPIFC output variable +# to the name of the MPI compiler, depending upon the current language. +# (This may just be $CC/$CXX/$F77/$FC, but is more often something like +# mpicc/mpiCC/mpif77/mpif90.) It also sets MPILIBS to any libraries that +# are needed for linking MPI (e.g. -lmpi or -lfmpi, if a special +# MPICC/MPICXX/MPIF77/MPIFC was not found). +# +# If you want to compile everything with MPI, you should use something +# like this for C: +# +# if test -z "$CC" && test -n "$MPICC"; then +# CC="$MPICC" +# fi +# AC_PROG_CC +# AX_MPI +# CC="$MPICC" +# LIBS="$MPILIBS $LIBS" +# +# and similar for C++ (change all instances of CC to CXX), Fortran 77 +# (with F77 instead of CC) or Fortran (with FC instead of CC). +# +# NOTE: The above assumes that you will use $CC (or whatever) for linking +# as well as for compiling. (This is the default for automake and most +# Makefiles.) +# +# The user can force a particular library/compiler by setting the +# MPICC/MPICXX/MPIF77/MPIFC and/or MPILIBS environment variables. +# +# ACTION-IF-FOUND is a list of shell commands to run if an MPI library is +# found, and ACTION-IF-NOT-FOUND is a list of commands to run if it is not +# found. If ACTION-IF-FOUND is not specified, the default action will +# define HAVE_MPI. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Julian C. Cummings +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AU_ALIAS([ACX_MPI], [AX_MPI]) +AC_DEFUN([AX_MPI], [ +AC_PREREQ([2.71]) dnl for AC_LANG_CASE + +AC_LANG_CASE([C], [ + AC_REQUIRE([AC_PROG_CC]) + AC_ARG_VAR(MPICC,[MPI C compiler command]) + AC_CHECK_PROGS(MPICC, mpicc hcc mpxlc_r mpxlc mpcc cmpicc, $CC) + ax_mpi_save_CC="$CC" + CC="$MPICC" + AC_SUBST(MPICC) + AC_MSG_CHECKING([checking MPI C flags]) + ax_mpi_c_flags="`$MPICC -showme:compile 2>/dev/null| cut -d\ -f2-`" + ax_mpi_c_libs="`$MPICC -showme:link 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_c_flags" = "x"],[ + ax_mpi_c_flags="`$MPICC -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" + ax_mpi_c_libs="`$MPICC -show 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_c_flags" = "x"],[AC_MSG_RESULT([could not determine c flags from show functions])],[AC_MSG_RESULT([flags found])]) + + ], [ + AC_MSG_RESULT([flags found])]) + MPI_CFLAGS="$ax_mpi_c_flags" + MPI_CLIBS="$ax_mpi_c_libs" + AC_SUBST(MPI_CFLAGS) + AC_SUBST(MPI_CLIBS) + +], +[C++], [ + AC_REQUIRE([AC_PROG_CXX]) + AC_ARG_VAR(MPICXX,[MPI C++ compiler command]) + AC_CHECK_PROGS(MPICXX, mpicxx mpiCC mpic++ hcp mpxlC_r mpxlC mpCC cmpic++, $CXX) + ax_mpi_save_CXX="$CXX" + CXX="$MPICXX" + AC_SUBST(MPICXX) + + AC_MSG_CHECKING([checking MPI C++ flags]) + ax_mpi_cc_flags="`$MPICXX -showme:compile 2>/dev/null| cut -d\ -f2-`" + ax_mpi_cc_libs="`$MPICXX -showme:link 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_cc_flags" = "x"],[ + ax_mpi_cc_flags="`$MPICXX -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" + ax_mpi_cc_libs="`$MPICXX -show 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_cc_flags" = "x"],[AC_MSG_RESULT([could not determine C++ flags from show functions])],[AC_MSG_RESULT([flags found])]) + + ], [ + AC_MSG_RESULT([flags found])]) + MPI_CXXFLAGS="$ax_mpi_cc_flags" + MPI_CXXLIBS="$ax_mpi_cc_libs" + AC_SUBST(MPI_CXXFLAGS) + AC_SUBST(MPI_CXXLIBS) + +], +[Fortran 77], [ + AC_REQUIRE([AC_PROG_F77]) + AC_ARG_VAR(MPIF77,[MPI Fortran 77 compiler command]) + AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf_r mpxlf mpf77 cmpifc, $F77) + ax_mpi_save_F77="$F77" + F77="$MPIF77" + AC_SUBST(MPIF77) +], +[Fortran], [ + AC_REQUIRE([AC_PROG_FC]) + AC_ARG_VAR(MPIFC,[MPI Fortran compiler command]) + AC_CHECK_PROGS(MPIFC, mpif90 mpxlf95_r mpxlf90_r mpxlf95 mpxlf90 mpf90 cmpif90c, $FC) + ax_mpi_save_FC="$FC" + FC="$MPIFC" + AC_SUBST(MPIFC) + AC_MSG_CHECKING([checking MPI Fortran flags]) + ax_mpi_fc_flags="`$MPIFC -showme:compile 2>/dev/null| cut -d\ -f2-`" + ax_mpi_fc_libs="`$MPIFC -showme:link 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_fc_flags" = "x"],[ + ax_mpi_fc_flags="`$MPIFC -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" + ax_mpi_fc_libs="`$MPIFC -show 2>/dev/null| cut -d\ -f2-`" + AS_IF([test "x$ax_mpi_fc_flags" = "x"],[AC_MSG_RESULT([could not determine c flags from show functions])],[AC_MSG_RESULT([flags found])]) + + ], [ + AC_MSG_RESULT([flags found])]) + MPI_FCFLAGS="$ax_mpi_fc_flags" + MPI_FCLIBS="$ax_mpi_fc_libs" + AC_SUBST(MPI_FCFLAGS) + AC_SUBST(MPI_FCLIBS) +]) + +if test x = x"$MPILIBS"; then + AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], + [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], + [Fortran 77], [AC_MSG_CHECKING([for MPI_Init]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " + AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])], + [Fortran], [AC_MSG_CHECKING([for MPI_Init]) + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " + AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) +fi +AC_LANG_CASE([Fortran 77], [ + if test x = x"$MPILIBS"; then + AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) + fi + if test x = x"$MPILIBS"; then + AC_CHECK_LIB(fmpich, MPI_Init, [MPILIBS="-lfmpich"]) + fi +], +[Fortran], [ + if test x = x"$MPILIBS"; then + AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) + fi + if test x = x"$MPILIBS"; then + AC_CHECK_LIB(mpichf90, MPI_Init, [MPILIBS="-lmpichf90"]) + fi + +]) +if test x = x"$MPILIBS"; then + AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"]) +fi +if test x = x"$MPILIBS"; then + AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"]) +fi + +dnl We have to use AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) and not AC_CHECK_HEADER because the +dnl latter uses $CPP, not $CC (which may be mpicc). +AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then + AC_MSG_CHECKING([for mpi.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" + AC_MSG_RESULT(no)]) +fi], +[C++], [if test x != x"$MPILIBS"; then + AC_MSG_CHECKING([for mpi.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" + AC_MSG_RESULT(no)]) +fi], +[Fortran 77], [if test x != x"$MPILIBS"; then + AC_MSG_CHECKING([for mpif.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" + AC_MSG_RESULT(no)]) +fi], +[Fortran], [if test x != x"$MPILIBS"; then + AC_MSG_CHECKING([for mpif.h]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" + AC_MSG_RESULT(no)]) +fi]) + +AC_LANG_CASE([C], [CC="$ax_mpi_save_CC"], + [C++], [CXX="$ax_mpi_save_CXX"], + [Fortran 77], [F77="$ax_mpi_save_F77"], + [Fortran], [FC="$ax_mpi_save_FC"]) + +AC_SUBST(MPILIBS) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x = x"$MPILIBS"; then + $2 + : +else + ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1]) + : +fi +])dnl AX_MPI diff --git a/src/amuse_tidymess/support/shared/m4/ax_openmp.m4 b/src/amuse_tidymess/support/shared/m4/ax_openmp.m4 new file mode 100644 index 0000000000..866e1d6645 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_openmp.m4 @@ -0,0 +1,123 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_openmp.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_OPENMP([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro tries to find out how to compile programs that use OpenMP a +# standard API and set of compiler directives for parallel programming +# (see http://www-unix.mcs/) +# +# On success, it sets the OPENMP_CFLAGS/OPENMP_CXXFLAGS/OPENMP_F77FLAGS +# output variable to the flag (e.g. -omp) used both to compile *and* link +# OpenMP programs in the current language. +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also link it with them as well. +# +# If you want to compile everything with OpenMP, you should set: +# +# CFLAGS="$CFLAGS $OPENMP_CFLAGS" +# #OR# CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" +# #OR# FFLAGS="$FFLAGS $OPENMP_FFLAGS" +# +# (depending on the selected language). +# +# The user can override the default choice by setting the corresponding +# environment variable (e.g. OPENMP_CFLAGS). +# +# ACTION-IF-FOUND is a list of shell commands to run if an OpenMP flag is +# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is +# not found. If ACTION-IF-FOUND is not specified, the default action will +# define HAVE_OPENMP. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2015 John W. Peterson +# Copyright (c) 2016 Nick R. Papior +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 13 + +AC_DEFUN([AX_OPENMP], [ +AC_PREREQ([2.69]) dnl for _AC_LANG_PREFIX + +AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS +ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown +# Flags to try: -fopenmp (gcc), -mp (SGI & PGI), +# -qopenmp (icc>=15), -openmp (icc), +# -xopenmp (Sun), -omp (Tru64), +# -qsmp=omp (AIX), +# none +ax_openmp_flags="-fopenmp -openmp -qopenmp -mp -xopenmp -omp -qsmp=omp none" +if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then + ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags" +fi +for ax_openmp_flag in $ax_openmp_flags; do + case $ax_openmp_flag in + none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;; + *) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;; + esac + AC_LINK_IFELSE([AC_LANG_SOURCE([[ +@%:@include + +static void +parallel_fill(int * data, int n) +{ + int i; +@%:@pragma omp parallel for + for (i = 0; i < n; ++i) + data[i] = i; +} + +int +main() +{ + int arr[100000]; + omp_set_num_threads(2); + parallel_fill(arr, 100000); + return 0; +} +]])],[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break],[]) +done +[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS +]) +if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then + m4_default([$2],:) +else + if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then + OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp + fi + m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])]) +fi +])dnl AX_OPENMP diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_jar.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_jar.m4 new file mode 100644 index 0000000000..76ed8147c6 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_prog_jar.m4 @@ -0,0 +1,50 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAR +# +# DESCRIPTION +# +# AX_PROG_JAR tests for an existing jar program. It uses the environment +# variable JAR then tests in sequence various common jar programs. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAR=yourcompiler before calling +# AX_PROG_JAR +# +# - at the configure level, setenv JAR +# +# You can use the JAR variable in your Makefile.in, with @JAR@. +# +# Note: This macro depends on the autoconf M4 macros for Java programs. It +# is VERY IMPORTANT that you download that whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Egon Willighagen +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) +AC_DEFUN([AX_PROG_JAR],[ +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar])], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar], [], [$JAVAPREFIX/bin])]) +test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) +AC_PROVIDE([$0])dnl +]) + diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_java.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_java.m4 new file mode 100644 index 0000000000..c4312ee8e7 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_prog_java.m4 @@ -0,0 +1,116 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA +# +# DESCRIPTION +# +# Here is a summary of the main macros: +# +# AX_PROG_JAVAC: finds a Java compiler. +# +# AX_PROG_JAVA: finds a Java virtual machine. +# +# AX_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!). +# +# AX_CHECK_RQRD_CLASS: finds if we have the given class and stops +# otherwise. +# +# AX_TRY_COMPILE_JAVA: attempt to compile user given source. +# +# AX_TRY_RUN_JAVA: attempt to compile and run user given source. +# +# AX_JAVA_OPTIONS: adds Java configure options. +# +# AX_PROG_JAVA tests an existing Java virtual machine. It uses the +# environment variable JAVA then tests in sequence various common Java +# virtual machines. For political reasons, it starts with the free ones. +# You *must* call [AX_PROG_JAVAC] before. +# +# If you want to force a specific VM: +# +# - at the configure.in level, set JAVA=yourvm before calling AX_PROG_JAVA +# +# (but after AC_INIT) +# +# - at the configure level, setenv JAVA +# +# You can use the JAVA variable in your Makefile.in, with @JAVA@. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# TODO: allow to exclude virtual machines (rationale: most Java programs +# cannot run with some VM like kaffe). +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# A Web page, with a link to the latest CVS snapshot is at +# . +# +# This is a sample configure.in Process this file with autoconf to produce +# a configure script. +# +# AC_INIT(UnTag.java) +# +# dnl Checks for programs. +# AC_CHECK_CLASSPATH +# AX_PROG_JAVAC +# AX_PROG_JAVA +# +# dnl Checks for classes +# AX_CHECK_RQRD_CLASS(org.xml.sax.Parser) +# AX_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) +# +# AC_OUTPUT(Makefile) +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 10 + +AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) +AC_DEFUN([AX_PROG_JAVA],[ +m4_define([m4_ax_prog_java_list], [kaffe java])dnl +AS_IF([test "x$JAVAPREFIX" = x], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list])], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list], [], [$JAVAPREFIX/bin])]) +test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) +m4_undefine([m4_ax_prog_java_list])dnl +AX_PROG_JAVA_WORKS +AC_PROVIDE([$0])dnl +]) + diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_java_works.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_java_works.m4 new file mode 100644 index 0000000000..d92b7b8ddc --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_prog_java_works.m4 @@ -0,0 +1,92 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 11 + +AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) +AC_DEFUN([AX_PROG_JAVA_WORKS], [ + if test x$ac_cv_prog_javac_works = xno; then + AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) + fi + if test x$ac_cv_prog_javac_works = x; then + AX_PROG_JAVAC + fi +AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +TEST=Test +changequote(, )dnl +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +public static void main (String args[]) { + System.exit (0); +} } +EOF +changequote([, ])dnl + if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then + : + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD + AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) + fi +if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then + ac_cv_prog_java_works=yes +else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD + AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +AC_PROVIDE([$0])dnl +] +) + diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_javac.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_javac.m4 new file mode 100644 index 0000000000..9dae89b1bb --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_prog_javac.m4 @@ -0,0 +1,80 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAC +# +# DESCRIPTION +# +# AX_PROG_JAVAC tests an existing Java compiler. It uses the environment +# variable JAVAC then tests in sequence various common Java compilers. For +# political reasons, it starts with the free ones. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVAC=yourcompiler before calling +# AX_PROG_JAVAC +# +# - at the configure level, setenv JAVAC +# +# You can use the JAVAC variable in your Makefile.in, with @JAVAC@. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# TODO: allow to exclude compilers (rationale: most Java programs cannot +# compile with some compilers like guavac). +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 8 + +AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) +AC_DEFUN([AX_PROG_JAVAC],[ +m4_define([m4_ax_prog_javac_list],["gcj -C" guavac jikes javac])dnl +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list])], + [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list], [], [$JAVAPREFIX/bin])]) +m4_undefine([m4_ax_prog_javac_list])dnl +test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) +AX_PROG_JAVAC_WORKS +AC_PROVIDE([$0])dnl +]) + diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_javac_works.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_javac_works.m4 new file mode 100644 index 0000000000..f0efe85342 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/ax_prog_javac_works.m4 @@ -0,0 +1,73 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAC_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) +AC_DEFUN([AX_PROG_JAVAC_WORKS],[ +AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then + ac_cv_prog_javac_works=yes +else + AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +AC_PROVIDE([$0])dnl +]) + diff --git a/src/amuse_tidymess/support/shared/m4/fftw.m4 b/src/amuse_tidymess/support/shared/m4/fftw.m4 new file mode 100644 index 0000000000..45a55f06fc --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/fftw.m4 @@ -0,0 +1,122 @@ +# AX_FFTW +# ---------------------------------------------------------- +# set up for FFTW +# +AC_DEFUN([AX_FFTW],[ + AC_ARG_WITH(fftw, + AS_HELP_STRING([--with-fftw=PFX],[Prefix where FFTW has been installed ]), + [ + test "$withval" = no && AC_MSG_WARN([fftw is a required package for some modules]) + test "$withval" = yes || fftw_prefix="$withval" + with_fftw=yes ], + [ with_fftw=yes ] + ) + + AS_IF([test "x$with_fftw" != xno ], + [ + #user override + AS_IF([test "x$FFTW_LIBS" != x && test "x$FFTW_FLAGS" != x ], + [ + have_fftw=yes + FOUND_FFTW="yes" + ], + [ + saved_LIBS="$LIBS" + saved_CXXFLAGS="$CXXFLAGS" + FFTW_LIBS="" + FFTW_FLAGS="" + FOUND_FFTW="no" + if test x$fftw_prefix == x; then + if test x$PREFIX != x; then + fftw_prefix=$PREFIX + fi + fi + if test x$fftw_prefix != x; then + ac_FFTW_CFLAGS="-I$fftw_prefix/include" + ac_FFTW_LDOPTS="-L$fftw_prefix/lib" + + + save_CFLAGS="$CFLAGS" + save_CPPFLAGS="$CPPFLAGS" + CFLAGS="$ac_FFTW_CFLAGS $save_CFLAGS" + CPPFLAGS="$ac_FFTW_CFLAGS $save_CPPFLAGS" + AC_CHECK_HEADER( + [fftw3.h], + [FFTW_FLAGS="$ac_FFTW_CFLAGS" + FOUND_FFTW="yes"], + [AC_MSG_WARN([Cannot find headers (fftw3.h) of the library FFTW in $fftw_prefix/include.])] + ) + CFLAGS="$save_CFLAGS" + CPPFLAGS="$save_CPPFLAGS" + + save_LIBS="$LIBS" + LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads $save_LIBS" + + cache_var=AS_TR_SH([ac_cv_lib_fftw3_fftw_plan_dft_r2c]) + AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], + [FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads"], + [FOUND_FFTW="no"] + ) + $as_unset $cache_var + if test x$FOUND_FFTW != xyes; then + LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm $save_LIBS" + AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], + [FOUND_FFTW="yes" + FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm"], + [AC_MSG_WARN([libfftw3 : library missing. (Cannot find symbol fftw_plan_dft_r2c) in $fftw_prefix. Check if libfftw3 is installed and if the version is correct])] + ) + $as_unset $cache_var + fi + LIBS="$save_LIBS" + fi + + if test x$FOUND_FFTW != xyes; then + PKG_CHECK_MODULES([FFTW],[fftw3 >= 3.2], + [ + FFTW_FLAGS="$FFTW_CFLAGS" + FFTW_LIBS="$FFTW_LIBS -lfftw3_threads" + FOUND_FFTW=yes + ], + [] + ) + fi + + if test x$FOUND_FFTW != xyes; then + AC_CHECK_HEADER( + [fftw3.h], + [FFTW_FLAGS="" + FOUND_FFTW="yes"], + [AC_MSG_WARN([Cannot find headers (fftw3.h) of the library FFTW in $fftw_prefix/include.])] + ) + cache_var=AS_TR_SH([ac_cv_lib_fftw3_fftw_plan_dft_r2c]) + AC_CHECK_LIB( + [fftw3], + [fftw_plan_dft_r2c], + [FFTW_LIBS="-lfftw3 -lfftw3_threads"], + [FOUND_FFTW="no"] + ) + $as_unset $cache_var + + if test x$FOUND_FFTW != xyes; then + + save_LIBS="$LIBS" + LIBS="-lfftw3_threads -lm $save_LIBS" + AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], + [FOUND_FFTW="yes" + FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm"], + [FOUND_FFTW="no" + AC_MSG_WARN([libfftw3 : library missing. (Cannot find symbol fftw_plan_dft_r2c) in $fftw_prefix. Check if libfftw3 is installed and if the version is correct])] + ) + LIBS="$save_LIBS" + fi + fi + + + ]) + ]) + + AC_SUBST(FOUND_FFTW) + AC_SUBST(FFTW_FLAGS) + AC_SUBST(FFTW_LIBS) + ] +) diff --git a/src/amuse_tidymess/support/shared/m4/fortran.m4 b/src/amuse_tidymess/support/shared/m4/fortran.m4 new file mode 100644 index 0000000000..8b042cd390 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/fortran.m4 @@ -0,0 +1,43 @@ +AC_DEFUN([AX_FC_WORKS],[ +AC_LANG_PUSH(Fortran) +AC_MSG_CHECKING([whether the Fortran 90 compiler ($FC $FCFLAGS $LDFLAGS) works]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program conftest + integer, dimension(10) :: n + end + ]) +],[ + ax_cv_prog_fc_works="yes" + AC_MSG_RESULT([$ax_cv_prog_fc_works]) +],[ + ax_cv_prog_fc_works="no" + AC_MSG_WARN([installation or configuration problem: Fortran 90 compiler cannot create executables.]) +]) +# The intel compiler sometimes generates these work.pc and .pcl files +rm -f work.pc work.pcl +AC_LANG_POP(Fortran) +]) + + +AC_DEFUN([AX_FC_ISO_C_BINDING],[ +AC_LANG_PUSH(Fortran) +AC_MSG_CHECKING([if the fortran compiler supports iso c binding]) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([ + program conftest + use ISO_C_BINDING + integer, dimension(10) :: n + end + ]) +],[ + FC_ISO_C_BINDINGS="yes" + AC_MSG_RESULT([$ax_cv_fc_iso_c_bindings]) +],[ + FC_ISO_C_BINDINGS="no" + AC_MSG_RESULT([no, fortran codes and sockets or embedding will not work.]) +]) +# The intel compiler sometimes generates these work.pc and .pcl files +rm -f work.pc work.pcl +AC_LANG_POP(Fortran) +]) diff --git a/src/amuse_tidymess/support/shared/m4/gmp.m4 b/src/amuse_tidymess/support/shared/m4/gmp.m4 new file mode 100644 index 0000000000..584168bd12 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/gmp.m4 @@ -0,0 +1,103 @@ +# AX_GMP +# ---------------------------------------------------------- +# set up for GMP +# +AC_DEFUN([AX_GMP],[ + AC_ARG_WITH(gmp, + AS_HELP_STRING([--with-gmp=PFX],[Prefix where GMP has been installed ]), + [ + test "$withval" = no && AC_MSG_WARN([gmp is a required package for some modules]) + test "$withval" = yes || gmp_prefix="$withval" + with_gmp=yes ], + [ with_gmp=yes ] + ) + + AS_IF([test "x$with_gmp" != xno ], + [ + #user override + AS_IF([test "x$GMP_LIBS" != x ], + [ + have_gmp=yes + FOUND_GMP="yes" + ], + [ + + + + saved_LIBS="$LIBS" + saved_CXXFLAGS="$CXXFLAGS" + GMP_LIBS="" + GMP_FLAGS="" + FOUND_GMP="no" + if test x$gmp_prefix == x; then + if test x$PREFIX != x; then + gmp_prefix=$PREFIX + fi + fi + if test x$gmp_prefix != x; then + ac_gmp_CFLAGS="-I$gmp_prefix/include" + ac_gmp_LDOPTS="-L$gmp_prefix/lib" + + + save_CFLAGS="$CFLAGS" + save_CPPFLAGS="$CPPFLAGS" + CFLAGS="$ac_gmp_CFLAGS $save_CFLAGS" + CPPFLAGS="$ac_gmp_CFLAGS $save_CPPFLAGS" + AC_CHECK_HEADER( + [gmp.h], + [GMP_FLAGS="$ac_gmp_CFLAGS" + FOUND_GMP="yes"], + [AC_MSG_WARN([Cannot find headers (gmp.h) of the library GMP in $gmp_prefix/include.])] + ) + CFLAGS="$save_CFLAGS" + CPPFLAGS="$save_CPPFLAGS" + + if test x$FOUND_GMP == xyes; then + save_LIBS="$LIBS" + LIBS="$ac_gmp_LDOPTS -lgmp $save_LIBS" + AC_CHECK_LIB([gmp], [__gmpz_init], + [GMP_LIBS="$ac_gmp_LDOPTS -lgmp"], + [FOUND_GMP="no" + AC_MSG_WARN([libgmp : library missing. (Cannot find symbol gmpz_init) in $gmp_prefix. Check if libgmp is installed and if the version is correct])] + ) + LIBS="$save_LIBS" + fi + fi + if test x$FOUND_GMP != xyes; then + PKG_CHECK_MODULES([GMP],[gmp >= 3], + [ + GMP_FLAGS="$GMP_FLAGS" + GMP_LIBS="$GMP_LIBS" + FOUND_GMP=yes + ], + [] + ) + + fi + + if test x$FOUND_GMP != xyes; then + AC_CHECK_HEADER( + [gmp.h], + [GMP_FLAGS="" + FOUND_GMP="yes"], + [AC_MSG_WARN([Cannot find headers (gmp.h) of the library GMP.])] + ) + AC_CHECK_LIB( + [gmp], + [__gmpz_init], + [GMP_LIBS="-lgmp"], + [ + FOUND_GMP="no" + AC_MSG_WARN([libgmp : library missing. (Cannot find symbol gmpz_init). Check if libgmp is installed and if the version is correct])] + ) + fi + + + ]) + ]) + + AC_SUBST(FOUND_GMP) + AC_SUBST(GMP_FLAGS) + AC_SUBST(GMP_LIBS) + ] +) diff --git a/src/amuse_tidymess/support/shared/m4/gsl.m4 b/src/amuse_tidymess/support/shared/m4/gsl.m4 new file mode 100644 index 0000000000..96c3189801 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/gsl.m4 @@ -0,0 +1,122 @@ +# Configure path for the GNU Scientific Library +# Christopher R. Gabriel , April 2000 + + +AC_DEFUN([AX_PATH_GSL], +[ +AC_ARG_WITH(gsl-prefix,[ --with-gsl-prefix=PFX Prefix where GSL is installed (optional)], + gsl_prefix="$withval", gsl_prefix="") +AC_ARG_WITH(gsl-exec-prefix,[ --with-gsl-exec-prefix=PFX Exec prefix where GSL is installed (optional)], + gsl_exec_prefix="$withval", gsl_exec_prefix="") +AC_ARG_ENABLE(gsltest, [ --disable-gsltest Do not try to compile and run a test GSL program], + , enable_gsltest=yes) + + if test "x${GSL_CONFIG+set}" != xset ; then + if test "x$gsl_prefix" != x ; then + GSL_CONFIG="$gsl_prefix/bin/gsl-config" + fi + if test "x$gsl_exec_prefix" != x ; then + GSL_CONFIG="$gsl_exec_prefix/bin/gsl-config" + fi + fi + + + if test "x${GSL_CONFIG+set}" == xset ; then + if test -x "${GSL_CONFIG}" ; then + gsl_config_exists=yes + else + gsl_config_exists=no + fi + fi + FOUND_GSL=no + if test "x$GSL_CFLAGS" != x ; then + if test "x$GSL_LIBS" != x ; then + GSL_FLAGS="$GSL_CFLAGS" + GSL_LIBS="$GSL_LIBS" + FOUND_GSL=yes + AC_SUBST(GSL_FLAGS) + fi + fi + if test "$FOUND_GSL" = "no"; then + if test "x$gsl_config_exists" != xyes ; then + PKG_CHECK_MODULES([GSL],[gsl >= 1.0], + [ + GSL_FLAGS="$GSL_CFLAGS" + GSL_LIBS="$GSL_LIBS" + FOUND_GSL=yes + AC_SUBST(GSL_FLAGS) + + ifelse([$2], , :, [$2]) + ], + [ + ] + ) + fi + fi + if test "$FOUND_GSL" = "no"; then + AC_PATH_PROG(GSL_CONFIG, gsl-config, no) + min_gsl_version=ifelse([$1], ,0.2.5,$1) + AC_MSG_CHECKING(for GSL - version >= $min_gsl_version) + no_gsl="" + if test "$GSL_CONFIG" = "no" ; then + no_gsl=yes + else + GSL_FLAGS=`$GSL_CONFIG --cflags` + GSL_LIBS=`$GSL_CONFIG --libs` + + gsl_version=`$GSL_CONFIG --version` + AS_VERSION_COMPARE( + [$gsl_version], + [$min_gsl_version], + [no_gsl=yes], + + ) + fi + if test "x$no_gsl" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$GSL_CONFIG" = "no" ; then + echo "*** The gsl-config script installed by GSL could not be found" + echo "*** If GSL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the GSL_CONFIG environment variable to the" + echo "*** full path to gsl-config." + else + if test -f conf.gsltest ; then + : + else + echo "*** Could not run GSL test program, checking why..." + CFLAGS="$CFLAGS $GSL_FLAGS" + LIBS="$LIBS $GSL_LIBS" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include + ]], [[ return 0; ]])],[ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding GSL or finding the wrong" + echo "*** version of GSL. If it is not finding GSL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],[ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means GSL was incorrectly installed" + echo "*** or that you have moved GSL since it was installed. In the latter case, you" + echo "*** may want to edit the gsl-config script: $GSL_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + # GSL_FLAGS="" + # GSL_LIBS="" + ifelse([$3], , :, [$3]) + fi + + fi + AC_SUBST(GSL_FLAGS) + AC_SUBST(GSL_LIBS) + rm -f conf.gsltest + +]) + +AU_ALIAS([AM_PATH_GSL], [AX_PATH_GSL]) diff --git a/src/amuse_tidymess/support/shared/m4/mpfr.m4 b/src/amuse_tidymess/support/shared/m4/mpfr.m4 new file mode 100644 index 0000000000..eba25c6dc9 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/mpfr.m4 @@ -0,0 +1,109 @@ +# AX_MPFR +# ---------------------------------------------------------- +# set up for MPFR +# +AC_DEFUN([AX_MPFR],[ + AC_ARG_WITH(mpfr, + AS_HELP_STRING([--with-mpfr=PFX],[Prefix where MPFR has been installed ]), + [ + test "$withval" = no && AC_MSG_WARN([mpfr is a required package for some modules]) + test "$withval" = yes || mpfr_prefix="$withval" + with_mpfr=yes ], + [ with_mpfr=yes ] + ) + + AS_IF([test "x$with_mpfr" != xno ], + [ + #user override + AS_IF([test "x$MPFR_LIBS" != x ], + [ + have_mpfr=yes + FOUND_MPFR="yes" + ], + [ + + + + saved_LIBS="$LIBS" + saved_CXXFLAGS="$CXXFLAGS" + MPFR_LIBS="" + MPFR_FLAGS="" + FOUND_MPFR="no" + if test x$mpfr_prefix == x; then + if test x$PREFIX != x; then + mpfr_prefix=$PREFIX + fi + fi + if test x$mpfr_prefix != x; then + ac_mpfr_CFLAGS="-I$mpfr_prefix/include" + ac_mpfr_LDOPTS="-L$mpfr_prefix/lib" + + + save_CFLAGS="$CFLAGS" + save_CPPFLAGS="$CPPFLAGS" + CFLAGS="$ac_mpfr_CFLAGS $save_CFLAGS" + CPPFLAGS="$ac_mpfr_CFLAGS $save_CPPFLAGS" + + cache_var=AS_TR_SH([ac_cv_header_mpfr.h]) + AC_CHECK_HEADER( + [mpfr.h], + [MPFR_FLAGS="$ac_mpfr_CFLAGS" + FOUND_MPFR="yes"], + [AC_MSG_WARN([Cannot find headers (mpfr.h) of the library MPFR in $mpfr_prefix/include.])] + ) + $as_unset $cache_var + CFLAGS="$save_CFLAGS" + CPPFLAGS="$save_CPPFLAGS" + + if test x$FOUND_MPFR == xyes; then + save_LIBS="$LIBS" + LIBS="$ac_mpfr_LDOPTS -lmpfr $save_LIBS" + + cache_var=AS_TR_SH([ac_cv_lib_mpfr_mpfr_init]) + AC_CHECK_LIB([mpfr], [mpfr_init], + [MPFR_LIBS="$ac_mpfr_LDOPTS -lmpfr"], + [FOUND_MPFR="no" + AC_MSG_WARN([libmpfr : library missing. (Cannot find symbol mpfr_init) in $mpfr_prefix. Check if libmpfr is installed and if the version is correct])] + ) + LIBS="$save_LIBS" + $as_unset $cache_var + fi + fi + if test x$FOUND_MPFR != xyes; then + PKG_CHECK_MODULES([MPFR],[mpfr >= 3], + [ + MPFR_FLAGS="$MPFR_FLAGS" + MPFR_LIBS="$MPFR_LIBS" + FOUND_MPFR=yes + ], + [] + ) + + fi + + if test x$FOUND_MPFR != xyes; then + AC_CHECK_HEADER( + [mpfr.h], + [MPFR_FLAGS="" + FOUND_MPFR="yes"], + [AC_MSG_WARN([Cannot find headers (mpfr.h) of the library MPFR.])] + ) + AC_CHECK_LIB( + [mpfr], + [mpfr_init], + [MPFR_LIBS="-lmpfr"], + [ + FOUND_MPFR="no" + AC_MSG_WARN([libmpfr : library missing. (Cannot find symbol mpfr_init). Check if libmpfr is installed and if the version is correct])] + ) + fi + + + ]) + ]) + + AC_SUBST(FOUND_MPFR) + AC_SUBST(MPFR_FLAGS) + AC_SUBST(MPFR_LIBS) + ] +) diff --git a/src/amuse_tidymess/support/shared/m4/pkg.m4 b/src/amuse_tidymess/support/shared/m4/pkg.m4 new file mode 100644 index 0000000000..d8549a4789 --- /dev/null +++ b/src/amuse_tidymess/support/shared/m4/pkg.m4 @@ -0,0 +1,343 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 11 (pkg-config-0.29.1) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.1]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR + +dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------ +dnl +dnl Prepare a "--with-" configure option using the lowercase +dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and +dnl PKG_CHECK_MODULES in a single macro. +AC_DEFUN([PKG_WITH_MODULES], +[ +m4_pushdef([with_arg], m4_tolower([$1])) + +m4_pushdef([description], + [m4_default([$5], [build with ]with_arg[ support])]) + +m4_pushdef([def_arg], [m4_default([$6], [auto])]) +m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) +m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) + +m4_case(def_arg, + [yes],[m4_pushdef([with_without], [--without-]with_arg)], + [m4_pushdef([with_without],[--with-]with_arg)]) + +AC_ARG_WITH(with_arg, + AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, + [AS_TR_SH([with_]with_arg)=def_arg]) + +AS_CASE([$AS_TR_SH([with_]with_arg)], + [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], + [auto],[PKG_CHECK_MODULES([$1],[$2], + [m4_n([def_action_if_found]) $3], + [m4_n([def_action_if_not_found]) $4])]) + +m4_popdef([with_arg]) +m4_popdef([description]) +m4_popdef([def_arg]) + +])dnl PKG_WITH_MODULES + +dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ----------------------------------------------- +dnl +dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES +dnl check._[VARIABLE-PREFIX] is exported as make variable. +AC_DEFUN([PKG_HAVE_WITH_MODULES], +[ +PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) + +AM_CONDITIONAL([HAVE_][$1], + [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) +])dnl PKG_HAVE_WITH_MODULES + +dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, +dnl [DESCRIPTION], [DEFAULT]) +dnl ------------------------------------------------------ +dnl +dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after +dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make +dnl and preprocessor variable. +AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], +[ +PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) + +AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], + [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) +])dnl PKG_HAVE_DEFINE_WITH_MODULES diff --git a/src/amuse_tidymess/support/shared/uninstall.sh b/src/amuse_tidymess/support/shared/uninstall.sh new file mode 100755 index 0000000000..e08122700e --- /dev/null +++ b/src/amuse_tidymess/support/shared/uninstall.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +PACKAGE="$1" + +if test -z "${PACKAGE}" ; then + echo " Incorrect usage, please specify a package name as the first argument." + exit 1 +fi + +if test -n "${VIRTUAL_ENV}${CONDA_DEFAULT_ENV}" ; then + pip_package_line=$(pip list | grep "${PACKAGE} ") + if [ "a${pip_package_line}" = "a" ] ; then + printf '%s\n' " Package ${PACKAGE} was not installed, not uninstalling." + exit 0 + fi +fi + +if test -n "${VIRTUAL_ENV}" ; then + # grep -q stops reading when a match is found, which then crashes pip list, so we + # redirect instead. With conda list we can use -q as usual. + if [ "a${pip_package_line}" != "a" ] ; then + pip uninstall -y ${PACKAGE} + fi +fi + +if test -n "${CONDA_DEFAULT_ENV}" ; then + conda_package_line=$(conda list | grep "^${PACKAGE} ") + if printf '%s' "${conda_package_line}" | grep "" >/dev/null 2>&1 ; then + # Conda is showing a pip-installed develop package. However, there may be a + # conda package hidden underneath, so we're going to try to conda uninstall + # anyway to fix that if needed. This will fail if everything is as it should + # be, so we make sure to inhibit the error message to reduce confusion. + EXPECTING_FAIL=true + fi + + if printf '%s' "${conda_package_line}" | grep -v "pypi$" >/dev/null 2>&1 ; then + TMPOUT=$(mktemp) + conda remove -y ${PACKAGE} >${TMPOUT} 2>&1 + err="$?" + # If it failed and we were not expecting it to, print the output + if test "$err" != 0 -a -z "${EXPECTING_FAIL}" ; then + cat ${TMPOUT} + fi + rm ${TMPOUT} + fi + + if [ "a${pip_package_line}" != "a" ] ; then + pip uninstall -y ${PACKAGE} + fi +fi + From 38aae9f4550071b423e9763a366c4d4bd35673e9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 8 Dec 2025 16:58:23 +0100 Subject: [PATCH 011/174] rm units in tidymess interface.py --- src/amuse_tidymess/interface.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 9a9519e32b..5dbfb34196 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -49,63 +49,54 @@ def new_particle(): 'This index is supposed to be a local index for the code ' '(and not valid in other instances of the code or in other codes)' ), - unit = MethodWithUnitsDefinition.INDEX ) function.addParameter( 'mass', dtype='float64', direction=function.IN, description='The mass of the particle', - unit=nbody_system.mass ) function.addParameter( 'x', dtype='float64', direction=function.IN, description='The initial position vector of the particle', - unit=nbody_system.length ) function.addParameter( 'y', dtype='float64', direction=function.IN, description='The initial position vector of the particle', - unit=nbody_system.length ) function.addParameter( 'z', dtype='float64', direction=function.IN, description='The initial position vector of the particle', - unit=nbody_system.length ) function.addParameter( 'vx', dtype='float64', direction=function.IN, description='The initial velocity vector of the particle', - unit=nbody_system.speed ) function.addParameter( 'vy', dtype='float64', direction=function.IN, description='The initial velocity vector of the particle', - unit=nbody_system.speed ) function.addParameter( 'vz', dtype='float64', direction=function.IN, description='The initial velocity vector of the particle', - unit=nbody_system.speed ) function.addParameter( 'radius', dtype='float64', direction=function.IN, description='The radius of the particle', - default=-1, # what is this default - unit=nbody_system.length + default=0, ) function.addParameter( 'xi', @@ -165,7 +156,6 @@ def new_particle(): 'option for restoring state after loading' ), default=-1, - unit=MethodWithUnitsDefinition.NO_UNIT ) function.result_type = 'int32' function.result_doc = '''\ From 9325a68888c786a4757ba31d83e5b4586403649b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 15:55:19 +0100 Subject: [PATCH 012/174] fixed Tidymess outer Makefile --- src/amuse_tidymess/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/amuse_tidymess/Makefile b/src/amuse_tidymess/Makefile index 114fa71db0..d6e788e214 100644 --- a/src/amuse_tidymess/Makefile +++ b/src/amuse_tidymess/Makefile @@ -20,33 +20,33 @@ src/tidymess: tidymess.tar.gz # Building the code into a static library DEPFLAGS += $(STOPCOND_CFLAGS) -CFLAGS += $(DEPFLAGS) +CXXFLAGS += $(DEPFLAGS) LDLIBS += -lm $(STOPCOND_LIBS) CODELIB = src/libtidymess.a .PHONY: $(CODELIB) -$(CODELIB): | src +$(CODELIB): | src/tidymess $(MAKE) -C src -j $(CPU_COUNT) all # Building the workers tidymess_worker.h: interface.py - amusifier --type=h interface.py tidymessInterface -o $@ + amusifier --type=h interface.py TidymessInterface -o $@ tidymess_worker.cc: interface.py - amusifier --type=c interface.py tidymessInterface -o $@ + amusifier --type=c interface.py TidymessInterface -o $@ tidymess_worker.o: tidymess_worker.cc tidymess_worker.h - $(MPICXX) -c -o $@ $(CFLAGS) $< + $(MPICXX) -c -o $@ $(CXXFLAGS) $< tidymess_worker: interface.o tidymess_worker.o $(CODELIB) $(MPICXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) -interface.o: interface.cc tidymess_worker.h - $(MPICXX) -o $@ -c -I src/tidymess/integrator/include $(CFLAGS) $< +interface.o: interface.cc tidymess_worker.h | src/tidymess + $(MPICXX) -o $@ -c -I src/tidymess/integrator/include $(CXXFLAGS) $< # Which packages contain which workers? From 2e5b05a94ce29ef3217c89e1583300b3612dea9e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 15:57:21 +0100 Subject: [PATCH 013/174] fixed bug in interface.cc not correctly mapping new_particle input arguments --- src/amuse_tidymess/interface.cc | 66 ++++++++++++++++----------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index dd17258c19..f5cff32008 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -1,4 +1,4 @@ -#include "worker_code.h" +#include "tidymess_worker.h" #include @@ -8,16 +8,16 @@ using namespace std; -#include "src/Timer.h" -#include "src/Banner.h" +#include "Timer.h" +#include "Banner.h" -#include "src/Initializer.h" -#include "src/Output.h" +#include "Initializer.h" +#include "Output.h" -#include "src/Tidy.h" +#include "Tidy.h" -#include "src/Collision.h" -#include "src/Breakup.h" +#include "Collision.h" +#include "Breakup.h" static Tidy tidymess; static Initializer init; @@ -52,7 +52,7 @@ int set_shapes_and_momenta() { // copied from tidymess.cpp tidymess.set_to_equilibrium_shape(); break; } - tidymess.update_angular_momentum(); + tidymess.update_angular_momentum(); } return 0;} @@ -62,7 +62,7 @@ int determine_dt_sgn(double t_end) { // copied from tidymess.cpp if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems dt_pos = true; dt_sgn = 1; - } + } else { dt_pos = false; dt_sgn = -1; @@ -169,7 +169,7 @@ int initialize_code(){ // any other call on the code (so before any parameters // are set or particles are defined in the code). // """ - + //initialize_stopping_conditions(); // AMUSE STOPPING CONDITIONS SUPPORT @@ -203,9 +203,9 @@ int recommit_parameters(){ // For GravitationalDynamicsInterface // https://github.com/amusecode/amuse/blob/main/src/amuse/community/interface/gd.py -int new_particle(int * index_of_the_particle, double mass, double x, +int new_particle(int * index_of_the_particle, double mass, double x, double y, double z, double vx, double vy, double vz, double radius, - double xi, double kf, double tau, double wx, double wy, double wz, double a_mb){ + double xi, double kf, double tau, double wx, double wy, double wz, double a_mb, int id){ // """ // Define a new particle in the stellar dynamics code. The particle is // initialized with the provided mass, radius, position and velocity. This @@ -213,7 +213,7 @@ int new_particle(int * index_of_the_particle, double mass, double x, // """ vector bodies = tidymess.get_particles(); - + Body newbody = {mass, radius, xi, kf, tau, a_mb, wx, wy, wz, x, y, z, vx, vy, vz}; *index_of_the_particle = highest_index; newbody.set_id(highest_index); @@ -221,7 +221,7 @@ int new_particle(int * index_of_the_particle, double mass, double x, bodies.push_back(newbody); tidymess.set_particles(bodies); - + tidymess.commit_parameters(); return 0;} @@ -235,7 +235,7 @@ int delete_particle(int index_of_the_particle){ // setters & getters -int set_state(int index_of_the_particle, double mass, double x, double y, +int set_state(int index_of_the_particle, double mass, double x, double y, double z, double vx, double vy, double vz, double radius){ vector bodies = tidymess.get_particles(); int ind = get_ind_from_index(index_of_the_particle); @@ -245,8 +245,8 @@ int set_state(int index_of_the_particle, double mass, double x, double y, bodies[ind].v = {vx, vy, vz}; tidymess.set_particles(bodies); return 0;} -int get_state(int index_of_the_particle, double * mass, double * x, - double * y, double * z, double * vx, double * vy, double * vz, +int get_state(int index_of_the_particle, double * mass, double * x, + double * y, double * z, double * vx, double * vy, double * vz, double * radius){ vector bodies = tidymess.get_particles(); Body body = bodies[get_ind_from_index(index_of_the_particle)]; @@ -254,7 +254,7 @@ int get_state(int index_of_the_particle, double * mass, double * x, *x = body.r[0]; *y = body.r[1]; *z = body.r[2]; - *vx = body.v[0]; + *vx = body.v[0]; *vy = body.v[1]; *vz = body.v[2]; *radius = body.R; @@ -280,7 +280,7 @@ int set_radius(int index_of_the_particle, double radius){ tidymess.set_particles(bodies); return 0;} -int get_position(int index_of_the_particle, double * x, double * y, +int get_position(int index_of_the_particle, double * x, double * y, double * z){ vector bodies = tidymess.get_particles(); array position = bodies[get_ind_from_index(index_of_the_particle)].r; @@ -294,7 +294,7 @@ int set_position(int index_of_the_particle, double x, double y, double z){ tidymess.set_particles(bodies); return 0;} -int get_velocity(int index_of_the_particle, double * vx, double * vy, +int get_velocity(int index_of_the_particle, double * vx, double * vy, double * vz){ vector bodies = tidymess.get_particles(); array velocity = bodies[get_ind_from_index(index_of_the_particle)].v; @@ -302,14 +302,14 @@ int get_velocity(int index_of_the_particle, double * vx, double * vy, *vy = velocity[1]; *vz = velocity[2]; return 0;} -int set_velocity(int index_of_the_particle, double vx, double vy, +int set_velocity(int index_of_the_particle, double vx, double vy, double vz){ vector bodies = tidymess.get_particles(); bodies[get_ind_from_index(index_of_the_particle)].v = {vx, vy, vz}; tidymess.set_particles(bodies); return 0;} -int get_spin(int index_of_the_particle, double * wx, double * wy, +int get_spin(int index_of_the_particle, double * wx, double * wy, double * wz){ vector bodies = tidymess.get_particles(); array spin = bodies[get_ind_from_index(index_of_the_particle)].w; @@ -317,17 +317,17 @@ int get_spin(int index_of_the_particle, double * wx, double * wy, *wy = spin[1]; *wz = spin[2]; return 0;} -int set_spin(int index_of_the_particle, double wx, double wy, +int set_spin(int index_of_the_particle, double wx, double wy, double wz){ vector bodies = tidymess.get_particles(); bodies[get_ind_from_index(index_of_the_particle)].w = {wx, wy, wz}; tidymess.set_particles(bodies); return 0;} -int get_acceleration(int index_of_the_particle, double * ax, double * ay, +int get_acceleration(int index_of_the_particle, double * ax, double * ay, double * az){ return 0;} -int set_acceleration(int index_of_the_particle, double ax, double ay, +int set_acceleration(int index_of_the_particle, double ax, double ay, double az){ return 0;} @@ -361,7 +361,7 @@ int get_time_step(double * time_step){ *time_step = tidymess.get_dt_prev(); } return 0;} - + int get_total_mass(double * mass){ vector bodies = tidymess.get_particles(); *mass = 0.0; @@ -400,7 +400,7 @@ int get_index_of_first_particle(int * index_of_the_particle){ Body body = tidymess.get_particles()[0]; *index_of_the_particle = body.id; return 0;} -int get_index_of_next_particle(int index_of_the_particle, +int get_index_of_next_particle(int index_of_the_particle, int * index_of_the_next_particle){ vector bodies = tidymess.get_particles(); Body body = bodies[get_ind_from_index(index_of_the_particle)+1]; @@ -427,11 +427,11 @@ int recommit_particles(){ int synchronize_model(){ return 0;} -int get_potential_at_point(double eps, double x, double y, double z, +int get_potential_at_point(double eps, double x, double y, double z, double * phi, int npoints){ return 0;} -int get_gravity_at_point(double eps, double x, double y, double z, +int get_gravity_at_point(double eps, double x, double y, double z, double * ax, double * ay, double * az, int npoints){ return 0;} @@ -480,7 +480,7 @@ int detect_collision(int * collision_flag, int * n_collisions, int * index1, int return 0;} int merge_collided_particles(int * number_of_particles) { - vector< array > cindex = tidymess.get_collision_indices(); + vector< array > cindex = tidymess.get_collision_indices(); collision.replace(bodies, cindex); tidymess.set_particles(bodies); @@ -489,7 +489,3 @@ int merge_collided_particles(int * number_of_particles) { vector bodies = tidymess.get_particles(); *number_of_particles = bodies.size(); return 0;} - - - - From 6b7faa914d0a4cd3bfa5de64217f2deeb10a0308 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 15:58:27 +0100 Subject: [PATCH 014/174] renamed TidyMess to Tidymess, removed GravityFieldInterface to allow code to compile, TODO: add it back in --- src/amuse_tidymess/interface.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 5dbfb34196..61190452e8 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1,6 +1,6 @@ from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravitationalDynamicsInterface -from amuse.community.interface.gd import GravityFieldInterface +#from amuse.community.interface.gd import GravityFieldInterface from amuse.community.interface.gd import GravityFieldCode from amuse.community.interface.stopping_conditions import StoppingConditions, StoppingConditionInterface from amuse.rfi.core import CodeInterface, legacy_function, LegacyFunctionSpecification @@ -8,12 +8,12 @@ from amuse.support.literature import LiteratureReferencesMixIn from amuse.units import nbody_system -class TidyMessInterface( +class TidymessInterface( CodeInterface, LiteratureReferencesMixIn, GravitationalDynamicsInterface, StoppingConditionInterface, - GravityFieldInterface + #GravityFieldInterface ): """ @@ -786,7 +786,7 @@ def merge_collided_particles(): return function -class TidyMess(GravitationalDynamics, GravityFieldCode): +class Tidymess(GravitationalDynamics, GravityFieldCode): def __init__(self, convert_nbody=None, **options): From 7be6cf049990dcff5b2c4ea7c736c3a6ecc43feb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 16:00:11 +0100 Subject: [PATCH 015/174] added configure.ac support to download Tidymess from github tgz, corrected to find MPI for worker --- src/amuse_tidymess/support/configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/amuse_tidymess/support/configure.ac b/src/amuse_tidymess/support/configure.ac index 1f0d7d2009..7173aaf84f 100644 --- a/src/amuse_tidymess/support/configure.ac +++ b/src/amuse_tidymess/support/configure.ac @@ -20,9 +20,17 @@ AS_IF([test $AR = ":"], [AC_MSG_ERROR([ar command not found.])]) AC_PROG_RANLIB() AS_IF([test $RANLIB = ":"], [AC_MSG_ERROR([ranlib command not found.])]) +AMUSE_DOWNLOAD() +AC_CHECK_TOOL(TAR, tar) + # Find AMUSE libraries AMUSE_LIB_STOPCOND() +# Find MPI for the worker +AC_LANG_PUSH([C++]) +AX_MPI() +AC_LANG_POP([C++]) + # Generate output AC_CONFIG_FILES([config.mk]) AC_OUTPUT From 9a076fb3eec74a4c887197ef0eb11461b5effe04 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 16:01:29 +0100 Subject: [PATCH 016/174] rm generated configs --- src/amuse_tidymess/support/aclocal.m4 | 18 - src/amuse_tidymess/support/configure | 6092 ------------------------- 2 files changed, 6110 deletions(-) delete mode 100644 src/amuse_tidymess/support/aclocal.m4 delete mode 100755 src/amuse_tidymess/support/configure diff --git a/src/amuse_tidymess/support/aclocal.m4 b/src/amuse_tidymess/support/aclocal.m4 deleted file mode 100644 index 746e8a9b4b..0000000000 --- a/src/amuse_tidymess/support/aclocal.m4 +++ /dev/null @@ -1,18 +0,0 @@ -# generated automatically by aclocal 1.18.1 -*- Autoconf -*- - -# Copyright (C) 1996-2025 Free Software Foundation, Inc. - -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -m4_include([shared/m4/amuse_lib.m4]) -m4_include([shared/m4/amuse_venv.m4]) -m4_include([shared/m4/ax_count_cpus.m4]) -m4_include([shared/m4/pkg.m4]) diff --git a/src/amuse_tidymess/support/configure b/src/amuse_tidymess/support/configure deleted file mode 100755 index aea03216bd..0000000000 --- a/src/amuse_tidymess/support/configure +++ /dev/null @@ -1,6092 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.72 for amuse-tidymess 1.0. -# -# -# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, -# Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else case e in #( - e) case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac ;; -esac -fi - - - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. -as_nl=' -' -export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi - -# The user is always right. -if ${PATH_SEPARATOR+false} :; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as 'sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - - -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed 'exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else case e in #( - e) case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ) -then : - -else case e in #( - e) exitcode=1; echo positional parameters were not saved. ;; -esac -fi -test x\$exitcode = x0 || exit 1 -blah=\$(echo \$(echo blah)) -test x\"\$blah\" = xblah || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null -then : - as_have_required=yes -else case e in #( - e) as_have_required=no ;; -esac -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null -then : - -else case e in #( - e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : - CONFIG_SHELL=$as_shell as_have_required=yes - if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null -then : - break 2 -fi -fi - done;; - esac - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else case e in #( - e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null -then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi ;; -esac -fi - - - if test "x$CONFIG_SHELL" != x -then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed 'exec'. -printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno -then : - printf "%s\n" "$0: This script requires a shell more modern than all" - printf "%s\n" "$0: the shells that I found on your system." - if test ${ZSH_VERSION+y} ; then - printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" - printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." - else - printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi ;; -esac -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else case e in #( - e) as_fn_append () - { - eval $1=\$$1\$2 - } ;; -esac -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else case e in #( - e) as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } ;; -esac -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - printf "%s\n" "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - t clear - :clear - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. - # In both cases, we have to default to 'cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" -as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated - -# Sed expression to map a string onto a valid variable name. -as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" -as_tr_sh="eval sed '$as_sed_sh'" # deprecated - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='amuse-tidymess' -PACKAGE_TARNAME='amuse-tidymess' -PACKAGE_VERSION='1.0' -PACKAGE_STRING='amuse-tidymess 1.0' -PACKAGE_BUGREPORT='' -PACKAGE_URL='' - -ac_subst_vars='LTLIBOBJS -LIBOBJS -FOUND_STOPCOND -STOPCOND_LIBS -STOPCOND_CFLAGS -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH -PKG_CONFIG -ac_ct_CC -CFLAGS -CC -RANLIB -AR -target_os -target_vendor -target_cpu -target -OBJEXT -EXEEXT -ac_ct_CXX -CPPFLAGS -LDFLAGS -CXXFLAGS -CXX -CPU_COUNT -EGREP -GREP -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -FFLAGS -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -runstatedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -' - ac_precious_vars='build_alias -host_alias -target_alias -CXX -CXXFLAGS -LDFLAGS -LIBS -CPPFLAGS -CCC -CC -CFLAGS -PKG_CONFIG -PKG_CONFIG_PATH -PKG_CONFIG_LIBDIR -STOPCOND_CFLAGS -STOPCOND_LIBS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: '$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: '$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: '$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: '$ac_useropt'" - ac_useropt_orig=$ac_useropt - ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: '$ac_option' -Try '$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: '$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: '$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -'configure' configures amuse-tidymess 1.0 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print 'checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for '--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or '..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, 'make install' will install all the files in -'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify -an installation prefix other than '$ac_default_prefix' using '--prefix', -for instance '--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/amuse-tidymess] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] - --target=TARGET configure for building compilers for TARGET [HOST] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of amuse-tidymess 1.0:";; - esac - cat <<\_ACEOF - -Some influential environment variables: - CXX C++ compiler command - CXXFLAGS C++ compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CC C compiler command - CFLAGS C compiler flags - PKG_CONFIG path to pkg-config utility - PKG_CONFIG_PATH - directories to add to pkg-config's search path - PKG_CONFIG_LIBDIR - path overriding pkg-config's built-in search path - STOPCOND_CFLAGS - C compiler flags for STOPCOND, overriding pkg-config - STOPCOND_LIBS - linker flags for STOPCOND, overriding pkg-config - -Use these variables to override the choices made by 'configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to the package provider. -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for configure.gnu first; this name is used for a wrapper for - # Metaconfig's "Configure" on case-insensitive file systems. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -amuse-tidymess configure 1.0 -generated by GNU Autoconf 2.72 - -Copyright (C) 2023 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext -then : - ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 ;; -esac -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext -then : - ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 ;; -esac -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - } -then : - ac_retval=0 -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 ;; -esac -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link -ac_configure_args_raw= -for ac_arg -do - case $ac_arg in - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append ac_configure_args_raw " '$ac_arg'" -done - -case $ac_configure_args_raw in - *$as_nl*) - ac_safe_unquote= ;; - *) - ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. - ac_unsafe_a="$ac_unsafe_z#~" - ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" - ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; -esac - -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by amuse-tidymess $as_me 1.0, which was -generated by GNU Autoconf 2.72. Invocation command line was - - $ $0$ac_configure_args_raw - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - printf "%s\n" "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Sanitize IFS. - IFS=" "" $as_nl" - # Save into config.log some information that might help in debugging. - { - echo - - printf "%s\n" "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - printf "%s\n" "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - printf "%s\n" "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - printf "%s\n" "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - printf "%s\n" "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - printf "%s\n" "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - printf "%s\n" "$as_me: caught signal $ac_signal" - printf "%s\n" "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -printf "%s\n" "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h - -printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -if test -n "$CONFIG_SITE"; then - ac_site_files="$CONFIG_SITE" -elif test "x$prefix" != xNONE; then - ac_site_files="$prefix/share/config.site $prefix/etc/config.site" -else - ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" -fi - -for ac_site_file in $ac_site_files -do - case $ac_site_file in #( - */*) : - ;; #( - *) : - ac_site_file=./$ac_site_file ;; -esac - if test -f "$ac_site_file" && test -r "$ac_site_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See 'config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -printf "%s\n" "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -printf "%s\n" "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Test code for whether the C++ compiler supports C++98 (global declarations) -ac_cxx_conftest_cxx98_globals=' -// Does the compiler advertise C++98 conformance? -#if !defined __cplusplus || __cplusplus < 199711L -# error "Compiler does not advertise C++98 conformance" -#endif - -// These inclusions are to reject old compilers that -// lack the unsuffixed header files. -#include -#include - -// and are *not* freestanding headers in C++98. -extern void assert (int); -namespace std { - extern int strcmp (const char *, const char *); -} - -// Namespaces, exceptions, and templates were all added after "C++ 2.0". -using std::exception; -using std::strcmp; - -namespace { - -void test_exception_syntax() -{ - try { - throw "test"; - } catch (const char *s) { - // Extra parentheses suppress a warning when building autoconf itself, - // due to lint rules shared with more typical C programs. - assert (!(strcmp) (s, "test")); - } -} - -template struct test_template -{ - T const val; - explicit test_template(T t) : val(t) {} - template T add(U u) { return static_cast(u) + val; } -}; - -} // anonymous namespace -' - -# Test code for whether the C++ compiler supports C++98 (body of main) -ac_cxx_conftest_cxx98_main=' - assert (argc); - assert (! argv[0]); -{ - test_exception_syntax (); - test_template tt (2.0); - assert (tt.add (4) == 6.0); - assert (true && !false); -} -' - -# Test code for whether the C++ compiler supports C++11 (global declarations) -ac_cxx_conftest_cxx11_globals=' -// Does the compiler advertise C++ 2011 conformance? -#if !defined __cplusplus || __cplusplus < 201103L -# error "Compiler does not advertise C++11 conformance" -#endif - -namespace cxx11test -{ - constexpr int get_val() { return 20; } - - struct testinit - { - int i; - double d; - }; - - class delegate - { - public: - delegate(int n) : n(n) {} - delegate(): delegate(2354) {} - - virtual int getval() { return this->n; }; - protected: - int n; - }; - - class overridden : public delegate - { - public: - overridden(int n): delegate(n) {} - virtual int getval() override final { return this->n * 2; } - }; - - class nocopy - { - public: - nocopy(int i): i(i) {} - nocopy() = default; - nocopy(const nocopy&) = delete; - nocopy & operator=(const nocopy&) = delete; - private: - int i; - }; - - // for testing lambda expressions - template Ret eval(Fn f, Ret v) - { - return f(v); - } - - // for testing variadic templates and trailing return types - template auto sum(V first) -> V - { - return first; - } - template auto sum(V first, Args... rest) -> V - { - return first + sum(rest...); - } -} -' - -# Test code for whether the C++ compiler supports C++11 (body of main) -ac_cxx_conftest_cxx11_main=' -{ - // Test auto and decltype - auto a1 = 6538; - auto a2 = 48573953.4; - auto a3 = "String literal"; - - int total = 0; - for (auto i = a3; *i; ++i) { total += *i; } - - decltype(a2) a4 = 34895.034; -} -{ - // Test constexpr - short sa[cxx11test::get_val()] = { 0 }; -} -{ - // Test initializer lists - cxx11test::testinit il = { 4323, 435234.23544 }; -} -{ - // Test range-based for - int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, - 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; - for (auto &x : array) { x += 23; } -} -{ - // Test lambda expressions - using cxx11test::eval; - assert (eval ([](int x) { return x*2; }, 21) == 42); - double d = 2.0; - assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); - assert (d == 5.0); - assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); - assert (d == 5.0); -} -{ - // Test use of variadic templates - using cxx11test::sum; - auto a = sum(1); - auto b = sum(1, 2); - auto c = sum(1.0, 2.0, 3.0); -} -{ - // Test constructor delegation - cxx11test::delegate d1; - cxx11test::delegate d2(); - cxx11test::delegate d3(45); -} -{ - // Test override and final - cxx11test::overridden o1(55464); -} -{ - // Test nullptr - char *c = nullptr; -} -{ - // Test template brackets - test_template<::test_template> v(test_template(12)); -} -{ - // Unicode literals - char const *utf8 = u8"UTF-8 string \u2500"; - char16_t const *utf16 = u"UTF-8 string \u2500"; - char32_t const *utf32 = U"UTF-32 string \u2500"; -} -' - -# Test code for whether the C compiler supports C++11 (complete). -ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} -${ac_cxx_conftest_cxx11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - ${ac_cxx_conftest_cxx11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C++98 (complete). -ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_cxx_conftest_cxx98_main} - return ok; -} -" - -# Test code for whether the C compiler supports C89 (global declarations) -ac_c_conftest_c89_globals=' -/* Does the compiler advertise C89 conformance? - Do not test the value of __STDC__, because some compilers set it to 0 - while being otherwise adequately conformant. */ -#if !defined __STDC__ -# error "Compiler does not advertise C89 conformance" -#endif - -#include -#include -struct stat; -/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ -struct buf { int x; }; -struct buf * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (char **p, int i) -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* C89 style stringification. */ -#define noexpand_stringify(a) #a -const char *stringified = noexpand_stringify(arbitrary+token=sequence); - -/* C89 style token pasting. Exercises some of the corner cases that - e.g. old MSVC gets wrong, but not very hard. */ -#define noexpand_concat(a,b) a##b -#define expand_concat(a,b) noexpand_concat(a,b) -extern int vA; -extern int vbee; -#define aye A -#define bee B -int *pvA = &expand_concat(v,aye); -int *pvbee = &noexpand_concat(v,bee); - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not \xHH hex character constants. - These do not provoke an error unfortunately, instead are silently treated - as an "x". The following induces an error, until -std is added to get - proper ANSI mode. Curiously \x00 != x always comes out true, for an - array size at least. It is necessary to write \x00 == 0 to get something - that is true only with -std. */ -int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) '\''x'\'' -int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), - int, int);' - -# Test code for whether the C compiler supports C89 (body of main). -ac_c_conftest_c89_main=' -ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); -' - -# Test code for whether the C compiler supports C99 (global declarations) -ac_c_conftest_c99_globals=' -/* Does the compiler advertise C99 conformance? */ -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L -# error "Compiler does not advertise C99 conformance" -#endif - -// See if C++-style comments work. - -#include -extern int puts (const char *); -extern int printf (const char *, ...); -extern int dprintf (int, const char *, ...); -extern void *malloc (size_t); -extern void free (void *); - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -// dprintf is used instead of fprintf to avoid needing to declare -// FILE and stderr. -#define debug(...) dprintf (2, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - #error "your preprocessor is broken" -#endif -#if BIG_OK -#else - #error "your preprocessor is broken" -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static bool -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str = ""; - int number = 0; - float fnumber = 0; - - while (*format) - { - switch (*format++) - { - case '\''s'\'': // string - str = va_arg (args_copy, const char *); - break; - case '\''d'\'': // int - number = va_arg (args_copy, int); - break; - case '\''f'\'': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); - - return *str && number && fnumber; -} -' - -# Test code for whether the C compiler supports C99 (body of main). -ac_c_conftest_c99_main=' - // Check bool. - _Bool success = false; - success |= (argc != 0); - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - // Work around memory leak warnings. - free (ia); - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[0] = argv[0][0]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' - || dynamic_array[ni.number - 1] != 543); -' - -# Test code for whether the C compiler supports C11 (global declarations) -ac_c_conftest_c11_globals=' -/* Does the compiler advertise C11 conformance? */ -#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L -# error "Compiler does not advertise C11 conformance" -#endif - -// Check _Alignas. -char _Alignas (double) aligned_as_double; -char _Alignas (0) no_special_alignment; -extern char aligned_as_int; -char _Alignas (0) _Alignas (int) aligned_as_int; - -// Check _Alignof. -enum -{ - int_alignment = _Alignof (int), - int_array_alignment = _Alignof (int[100]), - char_alignment = _Alignof (char) -}; -_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); - -// Check _Noreturn. -int _Noreturn does_not_return (void) { for (;;) continue; } - -// Check _Static_assert. -struct test_static_assert -{ - int x; - _Static_assert (sizeof (int) <= sizeof (long int), - "_Static_assert does not work in struct"); - long int y; -}; - -// Check UTF-8 literals. -#define u8 syntax error! -char const utf8_literal[] = u8"happens to be ASCII" "another string"; - -// Check duplicate typedefs. -typedef long *long_ptr; -typedef long int *long_ptr; -typedef long_ptr long_ptr; - -// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. -struct anonymous -{ - union { - struct { int i; int j; }; - struct { int k; long int l; } w; - }; - int m; -} v1; -' - -# Test code for whether the C compiler supports C11 (body of main). -ac_c_conftest_c11_main=' - _Static_assert ((offsetof (struct anonymous, i) - == offsetof (struct anonymous, w.k)), - "Anonymous union alignment botch"); - v1.i = 2; - v1.w.k = 5; - ok |= v1.i != 5; -' - -# Test code for whether the C compiler supports C11 (complete). -ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} -${ac_c_conftest_c11_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - ${ac_c_conftest_c11_main} - return ok; -} -" - -# Test code for whether the C compiler supports C99 (complete). -ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} -${ac_c_conftest_c99_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - ${ac_c_conftest_c99_main} - return ok; -} -" - -# Test code for whether the C compiler supports C89 (complete). -ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} - -int -main (int argc, char **argv) -{ - int ok = 0; - ${ac_c_conftest_c89_main} - return ok; -} -" - - -# Auxiliary files required by this configure script. -ac_aux_files="config.guess config.sub" - -# Locations in which to look for auxiliary files. -ac_aux_dir_candidates="${srcdir}/shared" - -# Search for a directory containing all of the required auxiliary files, -# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. -# If we don't find one directory that contains all the files we need, -# we report the set of missing files from the *first* directory in -# $ac_aux_dir_candidates and give up. -ac_missing_aux_files="" -ac_first_candidate=: -printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in $ac_aux_dir_candidates -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - as_found=: - - printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 - ac_aux_dir_found=yes - ac_install_sh= - for ac_aux in $ac_aux_files - do - # As a special case, if "install-sh" is required, that requirement - # can be satisfied by any of "install-sh", "install.sh", or "shtool", - # and $ac_install_sh is set appropriately for whichever one is found. - if test x"$ac_aux" = x"install-sh" - then - if test -f "${as_dir}install-sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 - ac_install_sh="${as_dir}install-sh -c" - elif test -f "${as_dir}install.sh"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 - ac_install_sh="${as_dir}install.sh -c" - elif test -f "${as_dir}shtool"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 - ac_install_sh="${as_dir}shtool install -c" - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} install-sh" - else - break - fi - fi - else - if test -f "${as_dir}${ac_aux}"; then - printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 - else - ac_aux_dir_found=no - if $ac_first_candidate; then - ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" - else - break - fi - fi - fi - done - if test "$ac_aux_dir_found" = yes; then - ac_aux_dir="$as_dir" - break - fi - ac_first_candidate=false - - as_found=false -done -IFS=$as_save_IFS -if $as_found -then : - -else case e in #( - e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; -esac -fi - - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -if test -f "${ac_aux_dir}config.guess"; then - ac_config_guess="$SHELL ${ac_aux_dir}config.guess" -fi -if test -f "${ac_aux_dir}config.sub"; then - ac_config_sub="$SHELL ${ac_aux_dir}config.sub" -fi -if test -f "$ac_aux_dir/configure"; then - ac_configure="$SHELL ${ac_aux_dir}configure" -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 -printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 -printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 -printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 -printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 -printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 -printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' - and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# Pick up Conda env or virtualenv - - if test "x$VIRTUAL_ENV" != x -then : - - CFLAGS="$CFLAGS -I${VIRTUAL_ENV}/include" - CXXFLAGS="$CXXFLAGS -I${VIRTUAL_ENV}/include" - FFLAGS="$FFLAGS -I${VIRTUAL_ENV}/include" - FCFLAGS="$FCFLAGS -I${VIRTUAL_ENV}/include" - LDFLAGS="$LDFLAGS -L${VIRTUAL_ENV}/lib -Wl,-rpath,${VIRTUAL_ENV}/lib" - PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH" - -fi - - if test "x$CONDA_PREFIX" != x -then : - - # Conda does not set FCFLAGS, so we copy from FFLAGS here - FCFLAGS="$FFLAGS" - LDFLAGS="$LDFLAGS -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib" - # Conda pkg-config includes this already, but in case we have one from - # the system... - PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${CONDA_PREFIX}/lib/pkgconfig" - -fi - # Needs to be exported or the PKG_CHECK_MODULES macro won't see it - export PKG_CONFIG_PATH - - - -# Set CPU_COUNT - - - - # Make sure we can run config.sub. -$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -printf %s "checking build system type... " >&6; } -if test ${ac_cv_build+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -printf "%s\n" "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -printf %s "checking host system type... " >&6; } -if test ${ac_cv_host+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 -fi - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -printf "%s\n" "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -printf %s "checking for grep that handles long lines and -e... " >&6; } -if test ${ac_cv_path_GREP+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in grep ggrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in #( -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -#( -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -printf "%s\n" "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -printf %s "checking for egrep... " >&6; } -if test ${ac_cv_path_EGREP+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_prog in egrep - do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in #( -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -#( -*) - ac_count=0 - printf %s 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - printf "%s\n" 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -printf "%s\n" "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - EGREP_TRADITIONAL=$EGREP - ac_cv_path_EGREP_TRADITIONAL=$EGREP - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the number of available CPUs" >&5 -printf %s "checking the number of available CPUs... " >&6; } - CPU_COUNT="0" - - # Try generic methods - - # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and - # 'NPROCESSORS_ONLN' are platform-specific - command -v getconf >/dev/null 2>&1 && \ - CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" - if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1 -then : - : # empty -else case e in #( - e) # 'nproc' is part of GNU Coreutils and is widely available - CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" - ;; -esac -fi - if test "$CPU_COUNT" -gt "0" 2>/dev/null -then : - : # empty -else case e in #( - e) # Try platform-specific preferred methods - case $host_os in #( - *linux*) : - CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^[0-9]+,' -c` || CPU_COUNT="0" ;; #( - *darwin*) : - CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0" ;; #( - freebsd*) : - command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0" ;; #( - netbsd*) : - command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0" ;; #( - solaris*) : - command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^[0-9].*on-line' -c 2>/dev/null` || CPU_COUNT="0" ;; #( - mingw*) : - CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( - msys*) : - CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( - cygwin*) : - CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( - *) : - ;; -esac ;; -esac -fi - if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1 -then : - : # empty -else case e in #( - e) # Try less preferred generic method - # 'hw.ncpu' exist on many platforms, but not on GNU/Linux - CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" - ;; -esac -fi - if test "$CPU_COUNT" -gt "0" 2>/dev/null -then : - : # empty -else case e in #( - e) # Try platform-specific fallback methods - # They can be less accurate and slower then preferred methods - case $host_os in #( - *linux*) : - CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0" ;; #( - *darwin*) : - CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0" ;; #( - freebsd*) : - CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( - netbsd*) : - CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^[0-9]+ .* online ' -c` || \ - CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( - solaris*) : - command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ - CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0" ;; #( - mingw*) : - if CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\[0-9]+$' -c` -then : - : # empty -else case e in #( - e) test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; -esac -fi ;; #( - msys*) : - test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( - cygwin*) : - test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( - *) : - ;; -esac ;; -esac -fi - if test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPU_COUNT" >&5 -printf "%s\n" "$CPU_COUNT" >&6; } - -else case e in #( - e) CPU_COUNT="1" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unable to detect (assuming 1)" >&5 -printf "%s\n" "unable to detect (assuming 1)" >&6; } - ;; -esac -fi - - -# Find the compiler(s) - - - - - - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CXX+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -printf "%s\n" "$CXX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CXX+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -printf "%s\n" "$ac_ct_CXX" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 -printf %s "checking whether the C++ compiler works... " >&6; } -ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. -# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an '-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else case e in #( - e) ac_file='' ;; -esac -fi -if test -z "$ac_file" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "C++ compiler cannot create executables -See 'config.log' for more details" "$LINENO" 5; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 -printf %s "checking for C++ compiler default output file name... " >&6; } -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -printf "%s\n" "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -printf %s "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) -# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will -# work properly (i.e., refer to 'conftest.exe'), while it won't with -# 'rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else case e in #( - e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See 'config.log' for more details" "$LINENO" 5; } ;; -esac -fi -rm -f conftest conftest$ac_cv_exeext -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -printf "%s\n" "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -FILE *f = fopen ("conftest.out", "w"); - if (!f) - return 1; - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -printf %s "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error 77 "cannot run C++ compiled programs. -If you meant to cross compile, use '--host'. -See 'config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -printf "%s\n" "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext \ - conftest.o conftest.obj conftest.out -ac_clean_files=$ac_clean_files_save -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -printf %s "checking for suffix of object files... " >&6; } -if test ${ac_cv_objext+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else case e in #( - e) printf "%s\n" "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See 'config.log' for more details" "$LINENO" 5; } ;; -esac -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -printf "%s\n" "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 -printf %s "checking whether the compiler supports GNU C++... " >&6; } -if test ${ac_cv_cxx_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else case e in #( - e) ac_compiler_gnu=no ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+y} -ac_save_CXXFLAGS=$CXXFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -printf %s "checking whether $CXX accepts -g... " >&6; } -if test ${ac_cv_prog_cxx_g+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_g=yes -else case e in #( - e) CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - -else case e in #( - e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } -if test $ac_test_CXXFLAGS; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_prog_cxx_stdcxx=no -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 -printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_cxx11+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cxx_cxx11=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx11_program -_ACEOF -for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx11" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX ;; -esac -fi - -if test "x$ac_cv_prog_cxx_cxx11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cxx_cxx11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; -esac -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 - ac_prog_cxx_stdcxx=cxx11 ;; -esac -fi -fi -if test x$ac_prog_cxx_stdcxx = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 -printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_cxx98+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cxx_cxx98=no -ac_save_CXX=$CXX -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_cxx_conftest_cxx98_program -_ACEOF -for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA -do - CXX="$ac_save_CXX $ac_arg" - if ac_fn_cxx_try_compile "$LINENO" -then : - ac_cv_prog_cxx_cxx98=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cxx_cxx98" != "xno" && break -done -rm -f conftest.$ac_ext -CXX=$ac_save_CXX ;; -esac -fi - -if test "x$ac_cv_prog_cxx_cxx98" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cxx_cxx98" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 -printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } - CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; -esac -fi - ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 - ac_prog_cxx_stdcxx=cxx98 ;; -esac -fi -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Find tools for creating static libraries -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 -printf %s "checking target system type... " >&6; } -if test ${ac_cv_target+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test "x$target_alias" = x; then - ac_cv_target=$ac_cv_host -else - ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || - as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 -fi - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 -printf "%s\n" "$ac_cv_target" >&6; } -case $ac_cv_target in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; -esac -target=$ac_cv_target -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_target -shift -target_cpu=$1 -target_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -target_os=$* -IFS=$ac_save_IFS -case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac - - -# The aliases save the names the user supplied, while $host etc. -# will get canonicalized. -test -n "$target_alias" && - test "$program_prefix$program_suffix$program_transform_name" = \ - NONENONEs,x,x, && - program_prefix=${target_alias}- -# Extract the first word of "$target_alias-ar", so it can be a program name with args. -set dummy $target_alias-ar; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_AR+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_AR="$target_alias-ar" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -printf "%s\n" "$AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -if test -z "$ac_cv_prog_AR"; then - if test "$build" = "$target"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_AR+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_AR="ar" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR=":" -fi ;; -esac -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -printf "%s\n" "$ac_ct_AR" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - AR=$ac_ct_AR - else - AR=":" - fi -else - AR="$ac_cv_prog_AR" -fi - -if test $AR = ":" -then : - as_fn_error $? "ar command not found." "$LINENO" 5 -fi - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_RANLIB+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -printf "%s\n" "$RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_RANLIB+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -printf "%s\n" "$ac_ct_RANLIB" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -if test $RANLIB = ":" -then : - as_fn_error $? "ranlib command not found." "$LINENO" 5 -fi - -# Find AMUSE libraries - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" - fi -fi -fi ;; -esac -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. -set dummy ${ac_tool_prefix}clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_CC+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -printf "%s\n" "$CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "clang", so it can be a program name with args. -set dummy clang; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_prog_ac_ct_CC+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="clang" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi ;; -esac -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -printf "%s\n" "$ac_ct_CC" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -fi - - -test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 -printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See 'config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion -version; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -printf "%s\n" "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 -printf %s "checking whether the compiler supports GNU C... " >&6; } -if test ${ac_cv_c_compiler_gnu+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_compiler_gnu=yes -else case e in #( - e) ac_compiler_gnu=no ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+y} -ac_save_CFLAGS=$CFLAGS -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -printf %s "checking whether $CC accepts -g... " >&6; } -if test ${ac_cv_prog_cc_g+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_g=yes -else case e in #( - e) CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else case e in #( - e) ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -printf "%s\n" "$ac_cv_prog_cc_g" >&6; } -if test $ac_test_CFLAGS; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -ac_prog_cc_stdc=no -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 -printf %s "checking for $CC option to enable C11 features... " >&6; } -if test ${ac_cv_prog_cc_c11+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c11=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c11_program -_ACEOF -for ac_arg in '' -std=gnu11 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c11=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c11" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac -fi - -if test "x$ac_cv_prog_cc_c11" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c11" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 -printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } - CC="$CC $ac_cv_prog_cc_c11" ;; -esac -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 - ac_prog_cc_stdc=c11 ;; -esac -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 -printf %s "checking for $CC option to enable C99 features... " >&6; } -if test ${ac_cv_prog_cc_c99+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c99_program -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac -fi - -if test "x$ac_cv_prog_cc_c99" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c99" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } - CC="$CC $ac_cv_prog_cc_c99" ;; -esac -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 - ac_prog_cc_stdc=c99 ;; -esac -fi -fi -if test x$ac_prog_cc_stdc = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 -printf %s "checking for $CC option to enable C89 features... " >&6; } -if test ${ac_cv_prog_cc_c89+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_c_conftest_c89_program -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC ;; -esac -fi - -if test "x$ac_cv_prog_cc_c89" = xno -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -printf "%s\n" "unsupported" >&6; } -else case e in #( - e) if test "x$ac_cv_prog_cc_c89" = x -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -printf "%s\n" "none needed" >&6; } -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } - CC="$CC $ac_cv_prog_cc_c89" ;; -esac -fi - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 - ac_prog_cc_stdc=c89 ;; -esac -fi -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -printf "%s\n" "$PKG_CONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -printf %s "checking for $ac_word... " >&6; } -if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" - printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } -fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - PKG_CONFIG="" - fi -fi - - - amuse_save_LIBS="$LIBS" - amuse_save_LIB_CFLAGS="$STOPCOND_CFLAGS" - amuse_save_LIB_LIBS="$STOPCOND_LIBS" - amuse_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" - - # If we have an active virtualenv, make sure pkg-config searches it - if test "a${VIRTUAL_ENV}" != "a" - then - PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}" - fi - - # All AMUSE libs export C symbols - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - # Search for the library, first directly then fall back to pkg-config - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing is_condition_enabled" >&5 -printf %s "checking for library containing is_condition_enabled... " >&6; } -if test ${ac_cv_search_is_condition_enabled+y} -then : - printf %s "(cached) " >&6 -else case e in #( - e) ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. - The 'extern "C"' is for builds by C++ compilers; - although this is not generally supported in C code supporting it here - has little cost and some practical benefit (sr 110532). */ -#ifdef __cplusplus -extern "C" -#endif -char is_condition_enabled (void); -int -main (void) -{ -return is_condition_enabled (); - ; - return 0; -} -_ACEOF -for ac_lib in '' stopcond -do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO" -then : - ac_cv_search_is_condition_enabled=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext - if test ${ac_cv_search_is_condition_enabled+y} -then : - break -fi -done -if test ${ac_cv_search_is_condition_enabled+y} -then : - -else case e in #( - e) ac_cv_search_is_condition_enabled=no ;; -esac -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS ;; -esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_is_condition_enabled" >&5 -printf "%s\n" "$ac_cv_search_is_condition_enabled" >&6; } -ac_res=$ac_cv_search_is_condition_enabled -if test "$ac_res" != no -then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - - FOUND_STOPCOND="yes" - STOPCOND_LIBS="$LIBS" - STOPCOND_CFLAGS="" - -else case e in #( - e) - -pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for STOPCOND" >&5 -printf %s "checking for STOPCOND... " >&6; } - -if test -n "$STOPCOND_CFLAGS"; then - pkg_cv_STOPCOND_CFLAGS="$STOPCOND_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"stopcond\""; } >&5 - ($PKG_CONFIG --exists --print-errors "stopcond") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_STOPCOND_CFLAGS=`$PKG_CONFIG --cflags "stopcond" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$STOPCOND_LIBS"; then - pkg_cv_STOPCOND_LIBS="$STOPCOND_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"stopcond\""; } >&5 - ($PKG_CONFIG --exists --print-errors "stopcond") 2>&5 - ac_status=$? - printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_STOPCOND_LIBS=`$PKG_CONFIG --libs "stopcond" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - STOPCOND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "stopcond" 2>&1` - else - STOPCOND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "stopcond" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$STOPCOND_PKG_ERRORS" >&5 - - - FOUND_STOPCOND="no" - -elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "no" >&6; } - - FOUND_STOPCOND="no" - -else - STOPCOND_CFLAGS=$pkg_cv_STOPCOND_CFLAGS - STOPCOND_LIBS=$pkg_cv_STOPCOND_LIBS - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; } - - FOUND_STOPCOND="yes" - -fi - ;; -esac -fi - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - PKG_CONFIG_PATH="$amuse_save_PKG_CONFIG_PATH" - LIBS="$amuse_save_LIBS" - - # If we have an active CONDA environment, assume that the lib is coming from - # there and add an additional flag so that .mod files can be found. Only really - # needed for stopcond and forsockets, and hopefully conda-forge will give us a - # better solution soon. - if test "${FOUND_STOPCOND}" == "yes" -a "x$CONDA_PREFIX" != "x" - then - STOPCOND_CFLAGS="${STOPCOND_CFLAGS} -I${CONDA_PREFIX}/include" - fi - - # If the user overrode the variables, go with what they set instead of - # what we just detected. - if test "x$amuse_save_LIB_CFLAGS" != "x" -then : - - STOPCOND_CFLAGS="$amuse_save_LIB_CFLAGS" - -fi - if test "x$amuse_save_LIB_LIBS" != "x" -then : - - STOPCOND_LIBS="$amuse_save_LIB_LIBS" - -fi - - - - - - - -# Generate output -ac_config_files="$ac_config_files config.mk" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# 'ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* 'ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # 'set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # 'set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -printf "%s\n" "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -# -# If the first sed substitution is executed (which looks for macros that -# take arguments), then branch to the quote section. Otherwise, -# look for a macro that doesn't take arguments. -ac_script=' -:mline -/\\$/{ - N - s,\\\n,, - b mline -} -t clear -:clear -s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g -t quote -s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g -t quote -b any -:quote -s/[][ `~#$^&*(){}\\|;'\''"<>?]/\\&/g -s/\$/$$/g -H -:any -${ - g - s/^\n// - s/\n/ /g - p -} -' -DEFS=`sed -n "$ac_script" confdefs.h` - - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 -then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else case e in #( - e) case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac ;; -esac -fi - - - -# Reset variables that may have inherited troublesome values from -# the environment. - -# IFS needs to be set, to space, tab, and newline, in precisely that order. -# (If _AS_PATH_WALK were called with IFS unset, it would have the -# side effect of setting IFS to empty, thus disabling word splitting.) -# Quoting is to prevent editors from complaining about space-tab. -as_nl=' -' -export as_nl -IFS=" "" $as_nl" - -PS1='$ ' -PS2='> ' -PS4='+ ' - -# Ensure predictable behavior from utilities with locale-dependent output. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# We cannot yet rely on "unset" to work, but we need these variables -# to be unset--not just set to an empty or harmless value--now, to -# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct -# also avoids known problems related to "unset" and subshell syntax -# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). -for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH -do eval test \${$as_var+y} \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done - -# Ensure that fds 0, 1, and 2 are open. -if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi -if (exec 3>&2) ; then :; else exec 2>/dev/null; fi - -# The user is always right. -if ${PATH_SEPARATOR+false} :; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - case $as_dir in #((( - '') as_dir=./ ;; - */) ;; - *) as_dir=$as_dir/ ;; - esac - test -r "$as_dir$0" && as_myself=$as_dir$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as 'sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - printf "%s\n" "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null -then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else case e in #( - e) as_fn_append () - { - eval $1=\$$1\$2 - } ;; -esac -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null -then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else case e in #( - e) as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } ;; -esac -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - -# Determine whether it's possible to make 'echo' print without a newline. -# These variables are no longer used directly by Autoconf, but are AC_SUBSTed -# for compatibility with existing Makefiles. -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -# For backward compatibility with old third-party macros, we provide -# the shell variables $as_echo and $as_echo_n. New code should use -# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. -as_echo='printf %s\n' -as_echo_n='printf %s' - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. - # In both cases, we have to default to 'cp -pR'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -pR' - fi -else - as_ln_s='cp -pR' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p - -# Sed expression to map a string onto a valid CPP name. -as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" -as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated - -# Sed expression to map a string onto a valid variable name. -as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" -as_tr_sh="eval sed '$as_sed_sh'" # deprecated - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by amuse-tidymess $as_me 1.0, which was -generated by GNU Autoconf 2.72. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -'$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - -Configuration files: -$config_files - -Report bugs to the package provider." - -_ACEOF -ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` -ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config='$ac_cs_config_escaped' -ac_cs_version="\\ -amuse-tidymess config.status 1.0 -configured by $0, generated by GNU Autoconf 2.72, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2023 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - printf "%s\n" "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - printf "%s\n" "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h | --help | --hel | -h ) - printf "%s\n" "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: '$1' -Try '$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - printf "%s\n" "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.mk") CONFIG_FILES="$CONFIG_FILES config.mk" ;; - - *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to '$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with './config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - - -eval set X " :F $CONFIG_FILES " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain ':'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is 'configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -printf "%s\n" "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`printf "%s\n" "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -printf "%s\n" X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when '$srcdir' = '.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - - - - esac - -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - - - From 6c7d2b77f5099b4db044f0fd5e2374864abadd9f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 16:02:25 +0100 Subject: [PATCH 017/174] fixed config.mk.in to find MPICXX worker and to download from TAR --- src/amuse_tidymess/support/config.mk.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/amuse_tidymess/support/config.mk.in b/src/amuse_tidymess/support/config.mk.in index 697fc04a54..3956ed493d 100644 --- a/src/amuse_tidymess/support/config.mk.in +++ b/src/amuse_tidymess/support/config.mk.in @@ -1,7 +1,7 @@ # Compilers CXX = @CXX@ -#MPICXX = @MPICXX@ +MPICXX = @MPICXX@ CPU_COUNT = @CPU_COUNT@ @@ -9,6 +9,7 @@ CPU_COUNT = @CPU_COUNT@ AR = @AR@ RANLIB = @RANLIB@ DOWNLOAD = @DOWNLOAD@ +TAR = @TAR@ # AMUSE framework libraries STOPCOND_CFLAGS = @STOPCOND_CFLAGS@ From 51dfd808106ee0ea730667932d8c24374765e1e5 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 16:04:07 +0100 Subject: [PATCH 018/174] fixed amuse/community/tidymess backwards compatibility imports --- src/amuse/community/tidymess/__init__.py | 2 +- src/amuse/community/tidymess/interface.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/amuse/community/tidymess/__init__.py b/src/amuse/community/tidymess/__init__.py index 70fc18e269..c92c275499 100644 --- a/src/amuse/community/tidymess/__init__.py +++ b/src/amuse/community/tidymess/__init__.py @@ -1 +1 @@ -from .interface import TidyMess +from .interface import Tidymess diff --git a/src/amuse/community/tidymess/interface.py b/src/amuse/community/tidymess/interface.py index abe890731d..9c7012b41d 100644 --- a/src/amuse/community/tidymess/interface.py +++ b/src/amuse/community/tidymess/interface.py @@ -1,5 +1,5 @@ from amuse.support.import_helper import load_code -TidyMessInterface = load_code("tidymess", "TidyMessInterface") -TidyMess = load_code("tidymess", "TidyMess") +TidymessInterface = load_code("tidymess", "TidymessInterface") +Tidymess = load_code("tidymess", "Tidymess") From 60afcb0560801a9af63e0c34e3b7d5099efd2442 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 16:05:42 +0100 Subject: [PATCH 019/174] tidymess tests --- src/amuse_tidymess/tests/test_tidymess.py | 779 +++++++++++++++++++++- 1 file changed, 771 insertions(+), 8 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index a8d760deef..10e1abbda2 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1,12 +1,775 @@ -from amuse.support.testing.amusetest import TestWithMPI +from amuse.test.amusetest import TestWithMPI +#from amuse.community import * -from amuse.community.tidymess.interface import tidymessInterface, tidymess +from interface import Tidymess, TidymessInterface -class tidymessInterfaceTests(TestWithMPI): +import numpy as np +import matplotlib.pyplot as plt +from amuse.units import units as u +from amuse.units import constants as c +from amuse.lab import Particles +from amuse.ext.orbital_elements import new_binary_from_orbital_elements, get_orbital_elements_from_binary + +class TidymessInterfaceTests(TestWithMPI): + + def test1(self): + ''' + # Test particle properties + ''' + + instance = TIDYMESS(redirection="none") + + self.assertEquals(instance.get_number_of_particles(), 0) + + index_of_the_particle = instance.new_particle( + 1.0 | generic_unit_system.mass, + 1.0 | generic_unit_system.length, + 1.0 | generic_unit_system.length, + 1.0 | generic_unit_system.length, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.length, # radius + + 1.0, # xi + 1.0, # kf + 1.0 | generic_unit_system.time, # tau + 1.0 | 1/generic_unit_system.time, # wx + 1.0 | 1/generic_unit_system.time, # wy + 1.0 | 1/generic_unit_system.time, # wz + + 1.0, # a_mb + ) + self.assertEquals(index_of_the_particle, 0) + + index_of_the_particle = instance.new_particle( + 1.0 | generic_unit_system.mass, + 2.0 | generic_unit_system.length, + 2.0 | generic_unit_system.length, + 2.0 | generic_unit_system.length, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.length, # radius + + 1.0, # xi + 1.0, # kf + 1.0 | generic_unit_system.time, # tau + 1.0 | 1/generic_unit_system.time, # wx + 1.0 | 1/generic_unit_system.time, # wy + 1.0 | 1/generic_unit_system.time, # wz + + 1.0, # a_mb + ) + self.assertEquals(index_of_the_particle, 1) + self.assertEquals(instance.get_number_of_particles(), 2) + + # test get/set_mass + instance.set_mass(0, 2.0 | generic_unit_system.mass) + self.assertEquals(instance.get_mass(0), 2.0 | generic_unit_system.mass) + + # test get/set_radius + instance.set_radius(1, 1.1 | generic_unit_system.length) + self.assertEquals(instance.get_radius(1), 1.1 | generic_unit_system.length) + + # test get/set_position + instance.set_position(0, 1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.length) + self.assertEquals(instance.get_position(0), [1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.length]) + + # test get/set_velocity + instance.set_velocity(1, 1.3 | generic_unit_system.speed, + 1.3 | generic_unit_system.speed, + 1.3 | generic_unit_system.speed) + self.assertEquals(instance.get_velocity(1), [1.3 | generic_unit_system.speed, + 1.3 | generic_unit_system.speed, + 1.3 | generic_unit_system.speed]) + + # test get/set_spin + instance.set_spin(0, 1.4 | 1/generic_unit_system.time, + 1.4 | 1/generic_unit_system.time, + 1.4 | 1/generic_unit_system.time) + self.assertEquals(instance.get_spin(0), [1.4 | 1/generic_unit_system.time, + 1.4 | 1/generic_unit_system.time, + 1.4 | 1/generic_unit_system.time]) + + # test get/set_state + state0 = [2.0 | generic_unit_system.mass, + 1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.length, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.length] + + self.assertEquals(instance.get_state(0), state0) + + instance.set_state(1, 1.0 | generic_unit_system.mass, + 2.0 | generic_unit_system.length, + 2.0 | generic_unit_system.length, + 2.0 | generic_unit_system.length, + 1.3 | generic_unit_system.speed, + 1.3 | generic_unit_system.speed, + 1.3 | generic_unit_system.speed, + 1.2 | generic_unit_system.length) + state1 = [1.0 | generic_unit_system.mass, + 2.0 | generic_unit_system.length, + 2.0 | generic_unit_system.length, + 2.0 | generic_unit_system.length, + 1.3 | generic_unit_system.speed, + 1.3 | generic_unit_system.speed, + 1.3 | generic_unit_system.speed, + 1.2 | generic_unit_system.length] + self.assertEquals(instance.get_state(1), state1) + + instance.stop() + + + def test2(self): + ''' + #Test particle indices + ''' + + instance = TIDYMESS(redirection="none") + + index_of_the_particle = instance.new_particle( + 1.0 | generic_unit_system.mass, + 1.0 | generic_unit_system.length, + 1.0 | generic_unit_system.length, + 1.0 | generic_unit_system.length, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.speed, + 1.0 | generic_unit_system.length, # radius + 1.0, # xi + 1.0, # kf + 1.0 | generic_unit_system.time, # tau + 1.0 | 1/generic_unit_system.time, # wx + 1.0 | 1/generic_unit_system.time, # wy + 1.0 | 1/generic_unit_system.time, # wz + ) + self.assertEquals(index_of_the_particle, 0) + + index_of_the_particle = instance.new_particle( + 1.1 | generic_unit_system.mass, + 1.1 | generic_unit_system.length, + 1.1 | generic_unit_system.length, + 1.1 | generic_unit_system.length, + 1.1 | generic_unit_system.speed, + 1.1 | generic_unit_system.speed, + 1.1 | generic_unit_system.speed, + 1.1 | generic_unit_system.length, # radius + 1.1, # xi + 1.1, # kf + 1.1 | generic_unit_system.time, # tau + 1.1 | 1/generic_unit_system.time, # wx + 1.1 | 1/generic_unit_system.time, # wy + 1.1 | 1/generic_unit_system.time, # wz + ) + self.assertEquals(index_of_the_particle, 1) + + index_of_the_particle = instance.new_particle( + 1.2 | generic_unit_system.mass, + 1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.length, + 1.2 | generic_unit_system.speed, + 1.2 | generic_unit_system.speed, + 1.2 | generic_unit_system.speed, + 1.2 | generic_unit_system.length, # radius + 1.2, # xi + 1.2, # kf + 1.2 | generic_unit_system.time, # tau + 1.2 | 1/generic_unit_system.time, # wx + 1.2 | 1/generic_unit_system.time, # wy + 1.2 | 1/generic_unit_system.time, # wz + ) + self.assertEquals(instance.get_number_of_particles(), 3) + + self.assertEquals(instance.get_index_of_first_particle(), 0) + self.assertEquals(instance.get_index_of_next_particle(0), 1) + + instance.delete_particle(1) + self.assertEquals(instance.get_index_of_first_particle(), 0) + self.assertEquals(instance.get_index_of_next_particle(0), 2) + + instance.stop() + + + def test3(self): + ''' + #Test simulation parameters + ''' + + instance = TIDYMESS(redirection="none") + instance.set_tidal_model(4) + + self.assertEquals(instance.get_tidal_model(),4) + instance.set_tidal_model(0) + self.assertEquals(instance.parameters.tidal_model,0) + + self.assertEquals(instance.get_pn_order(),0) + instance.set_pn_order(1) + self.assertEquals(instance.parameters.pn_order,1) + + self.assertEquals(instance.get_magnetic_braking(),0) + instance.set_magnetic_braking(1) + self.assertEquals(instance.parameters.magnetic_braking ,1) + + self.assertEquals(instance.get_collision_mode(),0) + instance.set_collision_mode(1) + self.assertEquals(instance.parameters.collision_mode,1) + + self.assertEquals(instance.get_roche_mode(),0) + instance.set_roche_mode(2) + self.assertEquals(instance.parameters.roche_mode,2) + + self.assertEquals(instance.get_breakup_mode(),0) + instance.set_breakup_mode(1) + self.assertEquals(instance.parameters.breakup_mode,1) + + instance.stop() + + def test4(self): + ''' + #Make a system from Particles + ''' + + system = new_binary_from_orbital_elements( + 1 | u.MEarth, + 7.342e22 | u.kg, + 384399e3 | u.m, + G=c.G) + planet = system[0] + moon = system[1] + + planet.radius = 6371. | u.km + planet.xi = 0.3308 + planet.kf = 0.933 + planet.tau = 180 | u.s + planet.wx = 0.0 | 1/u.yr + planet.wy = 2.3e3 | 1/u.yr + planet.wz = -4.7e6 | 1/u.yr + moon.radius = 1737.4 | u.km + moon.xi = 0.394 + moon.kf = 0 + moon.kf = 0 + moon.wx = 0.0 | 1/u.yr + moon.wy = 8.4e1 | 1/u.yr + moon.wz = 3.8e8 | 1/u.yr + + system.move_to_center() + + converter = nbody_system.nbody_to_si(system.mass.sum(), planet.position.length()) + instance = TIDYMESS(converter) + instance.set_tidal_model(0) + + instance.particles.add_particles(system) # hier wordt tidal_model weer naar 4 gezet?? waarom? + instance.set_tidal_model(0) + + instance.get_time_step() + # ^ dit kan hij alleen als bij new_particle() ook tidymess.commit_parameters(); staat + + self.assertGreater(instance.get_total_mass(), 6.04562e24 | u.kg) + self.assertLess(instance.get_total_mass(), 6.04563e24 | u.kg) + self.assertEquals(instance.get_total_radius(), 8108400.0 | u.m) + + instance.stop() + + def test5(self): + ''' + #Evolve a system of Particles + ''' + + system = new_binary_from_orbital_elements( + 5.9724e24 | u.kg, + 0.0735e24 | u.kg, + 0.3844e6 | u.km, + G=c.G) + planet = system[0] + moon = system[1] + + planet.radius = 6371. | u.km + planet.xi = 0.3308 + planet.kf = 0 + planet.tau = 180 | u.s + planet.wx = 0.0 | 1/u.yr + planet.wy = 0.0 | 1/u.yr + planet.wz = 0.0 | 1/u.yr + moon.radius = 1737.4 | u.km + moon.xi = 0.394 + moon.kf = 0 + moon.tau = 0 | u.s + moon.wx = 0.0 | 1/u.yr + moon.wy = 0.0 | 1/u.yr + moon.wz = 0.0 | 1/u.yr + + system.move_to_center() + + converter = nbody_system.nbody_to_si(system.mass.sum(), planet.position.length()) + instance = TIDYMESS(converter) + tidal_model = 0 + instance.set_tidal_model(tidal_model) + + instance.particles.add_particles(system) # hier wordt tidal_model weer naar 4 gezet?? waarom? + instance.set_tidal_model(tidal_model) + + self.assertGreater(instance.get_total_mass(), 6.0458e24 | u.kg) + self.assertLess(instance.get_total_mass(), 6.0460e24 | u.kg) + self.assertEquals(instance.get_total_radius(), 8108400.0 | u.m) + + instance.set_dt_mode(2) + + # Empty lists for properties to track + star_positions = [] + planet_positions = [] + moon_positions = [] + channel = instance.particles.new_channel_to(system) + + # Running gravity code + end_time = 1 + dt = 0.1 + times = np.arange(0, end_time, dt) | u.yr + + for t in times: + + instance.evolve_model(t) + channel.copy() + + system.move_to_center() + + planet_positions.append([planet.position.number[0], planet.position.number[1], planet.position.number[2]]) + moon_positions.append([moon.position.number[0], moon.position.number[1], moon.position.number[2]]) + + planet_positions = np.asarray(planet_positions) + moon_positions = np.asarray(moon_positions) + + self.assertNotEqual(planet_positions[0,0],planet_positions[-1,0]) # check if it evolved at all + + instance.stop() + + def test6(self): + ''' + #Evolve a system + ''' + + converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) + instance = TIDYMESS(converter) + + index_earth = instance.new_particle( + 1.0 | u.MEarth, + -4.6706380895356489e+06 | u.m, + 0.0000000000000000e+00 | u.m, + 0.0000000000000000e+00 | u.m, + 0.0000000000000000e+00 | u.m/u.s, + -1.2449006368729913e+01 | u.m/u.s, + 0.0000000000000000e+00 | u.m/u.s, + ) + self.assertEquals(index_earth, 0) + + index_moon = instance.new_particle( + 7.3460000000000003e+22 | u.kg, + 3.7972936191046441e+08 | u.m, + 0.0000000000000000e+00 | u.m, + 0.0000000000000000e+00 | u.m, + 0.0000000000000000e+00 | u.m/u.s, + 1.0121215033569634e+03 | u.m/u.s, + 0.0000000000000000e+00 | u.m/u.s, + ) + self.assertEquals(index_moon, 1) + appendix = "dt_sgn changed (>=)" + + tidal_model = 0 + instance.set_tidal_model(tidal_model) + dt_mode = 2 + instance.set_dt_mode(dt_mode) + + # Empty lists for properties to track + star_positions = [] + planet_positions = [] + moon_positions = [] + + # Running gravity code + end_time = 0.1 + dt = 0.01 + times = np.arange(0, end_time, dt) | u.yr + + planet_pos = instance.get_position(0) + moon_pos = instance.get_position(1) + + for t in times: + + instance.evolve_model(t) + + planet_pos = instance.get_position(0) + moon_pos = instance.get_position(1) + + planet_positions.append([planet_pos[0].number, planet_pos[1].number, planet_pos[2].number]) + moon_positions.append([moon_pos[0].number, moon_pos[1].number, moon_pos[2].number]) + + planet_positions = np.asarray(planet_positions) + moon_positions = np.asarray(moon_positions) + + #plt.plot(planet_positions[:,0], planet_positions[:,1], marker='.') + #plt.plot(moon_positions[:,0], moon_positions[:,1], marker='.') + #plt.axis("equal") + #plt.title("tidal_model="+str(tidal_model)+", dt_mode="+str(dt_mode)+", dt="+str(dt)+", end_time="+str(end_time)+"\n"+appendix) + #plt.savefig("figures/tidal_model="+str(tidal_model)+", dt_mode="+str(dt_mode)+", dt="+str(dt)+", end_time="+str(end_time)+", "+appendix+".png") + #plt.show() + + self.assertNotEqual(planet_positions[0,0],planet_positions[-1,0]) + self.assertNotEqual(planet_positions[0,1],planet_positions[-1,1]) + + instance.stop() + + + def test7(self): + ''' + #Test the function for converting spin vectors + ''' + + converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) + instance = TIDYMESS(converter) + + lod = 24 | u.hour + obl = 10 | u.deg + psi = 0 | u.deg + + spin = instance.convert_spin_vectors_to_inertial(lod, obl, psi) + + self.assertLess(np.abs(spin[2].number-7.1617240788458890e-05), 1e-19) + + + def test8(self): + ''' + #Test collisions (just remove both particles) + ''' + + def merge_two_stars(bodies, particles_in_encounter): + com_pos = particles_in_encounter.center_of_mass() + com_vel = particles_in_encounter.center_of_mass_velocity() + d = (particles_in_encounter[0].position - particles_in_encounter[1].position) + v = (particles_in_encounter[0].velocity - particles_in_encounter[1].velocity) + print("Actually merger occurred:") + print("Two stars (M=",particles_in_encounter.mass.in_(units.MSun), + ") collided with d=", d.length().in_(units.au)) + new_particle=Particles(1) + new_particle.mass = particles_in_encounter.total_mass() + new_particle.age = min(particles_in_encounter.age) \ + * max(particles_in_encounter.mass)/new_particle.mass + new_particle.position = com_pos + new_particle.velocity = com_vel + new_particle.radius = particles_in_encounter.radius.sum() + bodies.add_particles(new_particle) + bodies.remove_particles(particles_in_encounter) + + + converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) + instance = TIDYMESS(converter) + + index_earth = instance.new_particle( + 1.0 | u.MEarth, + -2e8 | u.m, + 0.0 | u.m, + 0.0 | u.m, + 0.0 | u.m/u.s, + 0.0 | u.m/u.s, + 0.0 | u.m/u.s, + 3000 | u.km + ) + self.assertEquals(index_earth, 0) + + index_moon = instance.new_particle( + 0.1 | u.kg, + 0.0e8 | u.m, + -1.0e8 | u.m, + 0.0 | u.m, + 0.0 | u.m/u.s, + 1.0e3 | u.m/u.s, + 0.0 | u.m/u.s, + 3000 | u.km + ) + self.assertEquals(index_moon, 1) + + dummy1 = instance.new_particle( + 0.1 | u.kg, + 100 | u.m, + 1.0e8 | u.m, + 0.0 | u.m, + 0.0 | u.m/u.s, + -1.0e3 | u.m/u.s, + 0.0 | u.m/u.s, + 3000 | u.km + ) + self.assertEquals(dummy1, 2) + + dummy2 = instance.new_particle( + 0.1 | u.kg, + 1.e8 | u.m, + -2.0e8 | u.m, + 0.0 | u.m, + 0.0 | u.m/u.s, + 1.0e3 | u.m/u.s, + 0.0 | u.m/u.s, + 3000 | u.km + ) + self.assertEquals(dummy2, 3) + + dummy3 = instance.new_particle( + 0.1 | u.kg, + 1e8 | u.m, + 2.0e8 | u.m, + 0.0 | u.m, + 0.0 | u.m/u.s, + -1.0e3 | u.m/u.s, + 0.0 | u.m/u.s, + 3000 | u.km + ) + self.assertEquals(dummy3, 4) + + dummy4 = instance.new_particle( + 0.1 | u.kg, + 1.4e8 | u.m, + 0.0 | u.m, + 0.0 | u.m, + 0.0 | u.m/u.s, + 1.0e3 | u.m/u.s, + 0.0 | u.m/u.s, + 3000 | u.km + ) + self.assertEquals(dummy4, 5) + + appendix = "" + + tidal_model = 0 + instance.set_tidal_model(tidal_model) + dt_mode = 2 + instance.set_dt_mode(dt_mode) + + + # Running gravity code + end_time = 5 + dt = end_time/13 + times = np.arange(0, end_time, dt) | u.day + print("times:",times) + + planet_pos = instance.get_position(0) + moon_pos = instance.get_position(1) + + def get_particle_indices(): + N = instance.get_number_of_particles() + idx = instance.get_index_of_first_particle() + indices = [idx] + while len(indices) < N: + idx = instance.get_index_of_next_particle(idx) + indices.append(idx) + return indices + + # Empty lists for properties to track + positions = [[], [], [], [], [], []] + self.assertEquals(len(positions), instance.get_number_of_particles()) + + instance.set_collision_mode(3) # 0=off, 1=ignore, 2=exception, 3=replace + print("collision_mode:", instance.parameters.collision_mode, "(0=off, 1=ignore, 2=exception, 3=replace)") + + for t in times: + print(t) + + instance.evolve_model(t) + + indices = get_particle_indices() + print("indices:", indices) + for idx in indices: + pos = instance.get_position(idx) + positions[idx].append([pos[0].number, pos[1].number, pos[2].number]) + + collision_flag, n_collisions, collider1, collider2 = instance.detect_collision() + if n_collisions > 0: + print("botsing! deeltjes", collider1, collider2) + instance.delete_particle(collider2) + instance.delete_particle(collider1) + print("deleted colliding particles") + else: + print("geen botsingen") + + for i in range(len(positions)): + pos = np.asarray(positions[i]) + plt.plot(pos[:,0], pos[:,1], marker='.', alpha=0.5) + + plt.axis("equal") + plt.title("tidal_model="+str(tidal_model)+", dt_mode="+str(dt_mode)+", dt="+str(dt)+", end_time="+str(end_time)+"\n"+appendix) + #plt.show() + + instance.stop() + + def test9(self): + ''' + #Test collisions (replace particles) + ''' + + def merge_two_stars(bodies, particles_in_encounter): + com_pos = particles_in_encounter.center_of_mass() + com_vel = particles_in_encounter.center_of_mass_velocity() + d = (particles_in_encounter[0].position - particles_in_encounter[1].position) + v = (particles_in_encounter[0].velocity - particles_in_encounter[1].velocity) + new_particle=Particles(1) + new_particle.mass = particles_in_encounter.total_mass() + new_particle.position = com_pos + new_particle.velocity = com_vel + new_particle.radius = particles_in_encounter.radius.sum() + bodies.add_particles(new_particle) + bodies.remove_particles(particles_in_encounter) + + + converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) + instance = TIDYMESS(converter) + + + system = Particles(6) + + # planeet staat stil + system[0].mass = 1.0 | u.MEarth + system[0].x = -2e8 | u.m + system[0].y = 0.0 | u.m + system[0].z = 0.0 | u.m + system[0].vx = 0.0 | u.m/u.s + system[0].vy = 0.0 | u.m/u.s + system[0].vz = 0.0 | u.m/u.s + system[0].radius = 3000 | u.km + system[0].index = 0 + + # 1e botser van boven + system[1].mass = 0.1 | u.kg + system[1].x = 0.0 | u.m + system[1].y = -1.0e8 | u.m + system[1].z = 0.0 | u.m + system[1].vx = 0.0 | u.m/u.s + system[1].vy = 1.0e3 | u.m/u.s + system[1].vz = 0.0 | u.m/u.s + system[1].radius = 3000 | u.km + system[1].index = 1 + + # 1e botser van beneden + system[2].mass = 0.1 | u.kg + system[2].x = 100 | u.m + system[2].y = 1.0e8 | u.m + system[2].z = 0.0 | u.m + system[2].vx = 0.0 | u.m/u.s + system[2].vy = -1.0e3 | u.m/u.s + system[2].vz = 0.0 | u.m/u.s + system[2].radius = 3000 | u.km + system[2].index = 2 + + # 2e botser van boven + system[3].mass = 0.1 | u.kg + system[3].x = 1.0e8 | u.m + system[3].y = -2.0e8 | u.m + system[3].z = 0.0 | u.m + system[3].vx = 0.0 | u.m/u.s + system[3].vy = 1.0e3 | u.m/u.s + system[3].vz = 0.0 | u.m/u.s + system[3].radius = 3000 | u.km + system[3].index = 3 + + # 2e botser van beneden + system[4].mass = 0.1 | u.kg + system[4].x = 1.0e8 | u.m + system[4].y = 2.0e8 | u.m + system[4].z = 0.0 | u.m + system[4].vx = 0.0 | u.m/u.s + system[4].vy = -1.0e3 | u.m/u.s + system[4].vz = 0.0 | u.m/u.s + system[4].radius = 3000 | u.km + system[4].index = 4 + + # botst niet + system[5].mass = 0.1 | u.kg + system[5].x = 1.4e8 | u.m + system[5].y = 0.0 | u.m + system[5].z = 0.0 | u.m + system[5].vx = 0.0 | u.m/u.s + system[5].vy = 1.0e3 | u.m/u.s + system[5].vz = 0.0 | u.m/u.s + system[5].radius = 3000 | u.km + system[5].index = 5 + + instance.particles.add_particles(system) + + appendix = "" + + tidal_model = 0 + instance.set_tidal_model(tidal_model) + dt_mode = 2 + instance.set_dt_mode(dt_mode) + + + # Running gravity code + end_time = 5 + dt = end_time/13 + times = np.arange(0, end_time, dt) | u.day + + planet_pos = instance.get_position(0) + moon_pos = instance.get_position(1) + + def get_particle_indices(): + N = instance.get_number_of_particles() + idx = instance.get_index_of_first_particle() + indices = [idx] + while len(indices) < N: + idx = instance.get_index_of_next_particle(idx) + indices.append(idx) + return indices + + # Empty lists for properties to track + positions = [[], [], [], [], [], []] + self.assertEquals(len(positions), instance.get_number_of_particles()) + channel = instance.particles.new_channel_to(system) + + instance.set_collision_mode(3) # 0=off, 1=ignore, 2=exception, 3=replace + + for t in times: + print("\ntijd:", t) + + instance.evolve_model(t) + + indices = get_particle_indices() + print("indices:", indices) + for idx in indices: + pos = instance.get_position(idx) + positions[idx].append([pos[0].number, pos[1].number, pos[2].number]) + + collision_flag, n_collisions, collider1, collider2 = instance.detect_collision() + if n_collisions > 0: + print("botsing! deeltjes", collider1, "en", collider2) + + particle_indices = [] + for i in range(len(system)): + if system[i].index in [collider1, collider2]: + particle_indices.append(i) + encountering_particles = system[particle_indices] + + indices.remove(collider1) + indices.remove(collider2) + indices.append(max(indices)+1) + merge_two_stars(system, encountering_particles) + system[-1].index = max(indices) + system.synchronize_to(instance.particles) + positions.append([]) + print("new system indices:",system.index) + else: + print("geen botsingen") + channel.copy() + + for i in range(len(positions)): + pos = np.asarray(positions[i]) + plt.plot(pos[:,0], pos[:,1], marker='.', alpha=0.5) + + plt.axis("equal") + plt.title("tidal_model="+str(tidal_model)+", dt_mode="+str(dt_mode)+", dt="+str(dt)+", end_time="+str(end_time)+"\n"+appendix) + #plt.show() - def test_echo_int(self): - instance = tidymessInterface() - result,error = instance.echo_int(12) - self.assertEquals(error, 0) - self.assertEquals(result, 12) instance.stop() From b01c43972a9e21c458a5f867ce62c45580441f4a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 16:17:59 +0100 Subject: [PATCH 020/174] fixed bug importing TidyMess not Tidymess --- src/amuse_tidymess/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tidymess/__init__.py b/src/amuse_tidymess/__init__.py index 70fc18e269..c92c275499 100644 --- a/src/amuse_tidymess/__init__.py +++ b/src/amuse_tidymess/__init__.py @@ -1 +1 @@ -from .interface import TidyMess +from .interface import Tidymess From 14a7afedc62e2e7eb4570136e5dacbddfcc51c86 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 16:27:47 +0100 Subject: [PATCH 021/174] fixed Tidymess interface.py StopCond bug --- src/amuse_tidymess/interface.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 61190452e8..0eb081cced 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -790,7 +790,8 @@ class Tidymess(GravitationalDynamics, GravityFieldCode): def __init__(self, convert_nbody=None, **options): - legacy_interface = TidyMessInterface(**options) + legacy_interface = TidymessInterface(**options) + self.stopping_conditions = StoppingConditions(self) GravitationalDynamics.__init__( self, @@ -799,10 +800,6 @@ def __init__(self, convert_nbody=None, **options): **options ) - # should this be here or before? - self.stopping_conditions = StoppingConditions(self) - - def define_state(self, handler): GravitationalDynamics.define_state(self, handler) handler.add_method('RUN', 'get_spin') From 11fa5b65f46a082718b239711497dcccefd1ab1a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 10 Dec 2025 16:28:35 +0100 Subject: [PATCH 022/174] fixed Tidymess imports and instance declaration --- src/amuse_tidymess/tests/test_tidymess.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 10e1abbda2..d7aefee29d 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1,14 +1,13 @@ -from amuse.test.amusetest import TestWithMPI -#from amuse.community import * - -from interface import Tidymess, TidymessInterface - import numpy as np import matplotlib.pyplot as plt + +from amuse.support.testing.amusetest import TestWithMPI +from amuse_tidymess.interface import Tidymess, TidymessInterface from amuse.units import units as u from amuse.units import constants as c -from amuse.lab import Particles -from amuse.ext.orbital_elements import new_binary_from_orbital_elements, get_orbital_elements_from_binary +from amuse.units import generic_unit_system +from amuse.datamodel import Particles +#from amuse.ext.orbital_elements import new_binary_from_orbital_elements, get_orbital_elements_from_binary class TidymessInterfaceTests(TestWithMPI): @@ -17,7 +16,7 @@ def test1(self): # Test particle properties ''' - instance = TIDYMESS(redirection="none") + instance = Tidymess() self.assertEquals(instance.get_number_of_particles(), 0) From a615f94d1290837f4bdd976b6893512ca07b04a8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 16 Dec 2025 10:26:28 +0100 Subject: [PATCH 023/174] moved tidymess interface.py to use generic_unit_system instead of nbody_units --- src/amuse_tidymess/interface.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 0eb081cced..8d0ad71829 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -813,27 +813,26 @@ def define_methods(self, handler): GravitationalDynamics.define_methods(self, handler) - # Turn interface functions into methods. + # turn interface functions into methods. handler.add_method( 'new_particle', ( - nbody_system.mass, - nbody_system.length, - nbody_system.length, - nbody_system.length, - nbody_system.speed, - nbody_system.speed, - nbody_system.speed, - nbody_system.length, # radius - + generic_unit_system.mass, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.length, # radius handler.NO_UNIT, # xi, moment of inertia factor handler.NO_UNIT, # kf, fluid Love number for potential - nbody_system.time, # tau, fluid relaxation time - 1/nbody_system.time, # wx - 1/nbody_system.time, # wy - 1/nbody_system.time, # wz - + generic_unit_system.time, # tau, fluid relaxation time + 1 / generic_unit_system.time, # wx + 1 / generic_unit_system.time, # wy + 1 / generic_unit_system.time, # wz handler.NO_UNIT, # a_mb, magnetic braking coefficient + handler.INDEX ), ( handler.INDEX, From ad9507696789fc87ad7556c1d047283c106d8d8f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 16 Dec 2025 10:34:26 +0100 Subject: [PATCH 024/174] cleaned up tidymess configure scripts --- .gitignore | 1 + src/amuse_tidymess/support/aclocal.m4 | 20 + src/amuse_tidymess/support/configure | 6795 +++++++++++++++++++++ src/amuse_tidymess/tests/test_tidymess.py | 3 +- 4 files changed, 6817 insertions(+), 2 deletions(-) create mode 100644 src/amuse_tidymess/support/aclocal.m4 create mode 100755 src/amuse_tidymess/support/configure diff --git a/.gitignore b/.gitignore index b7db7e943e..733ed80eac 100644 --- a/.gitignore +++ b/.gitignore @@ -458,3 +458,4 @@ env/ # macOS .DS_Store +*tar.gz diff --git a/src/amuse_tidymess/support/aclocal.m4 b/src/amuse_tidymess/support/aclocal.m4 new file mode 100644 index 0000000000..c31375ce6e --- /dev/null +++ b/src/amuse_tidymess/support/aclocal.m4 @@ -0,0 +1,20 @@ +# generated automatically by aclocal 1.18.1 -*- Autoconf -*- + +# Copyright (C) 1996-2025 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_include([shared/m4/amuse_download.m4]) +m4_include([shared/m4/amuse_lib.m4]) +m4_include([shared/m4/amuse_venv.m4]) +m4_include([shared/m4/ax_count_cpus.m4]) +m4_include([shared/m4/ax_mpi.m4]) +m4_include([shared/m4/pkg.m4]) diff --git a/src/amuse_tidymess/support/configure b/src/amuse_tidymess/support/configure new file mode 100755 index 0000000000..5836907436 --- /dev/null +++ b/src/amuse_tidymess/support/configure @@ -0,0 +1,6795 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.72 for amuse-tidymess 1.0. +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, +# Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed 'exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else case e in #( + e) case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else case e in #( + e) exitcode=1; echo positional parameters were not saved. ;; +esac +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else case e in #( + e) as_have_required=no ;; +esac +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else case e in #( + e) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi ;; +esac +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed 'exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi ;; +esac +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + t clear + :clear + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='amuse-tidymess' +PACKAGE_TARNAME='amuse-tidymess' +PACKAGE_VERSION='1.0' +PACKAGE_STRING='amuse-tidymess 1.0' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_subst_vars='LTLIBOBJS +LIBOBJS +MPILIBS +MPI_CXXLIBS +MPI_CXXFLAGS +MPICXX +FOUND_STOPCOND +STOPCOND_LIBS +STOPCOND_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG +ac_ct_CC +CFLAGS +CC +TAR +DOWNLOAD +CURL +WGET +RANLIB +AR +target_os +target_vendor +target_cpu +target +OBJEXT +EXEEXT +ac_ct_CXX +CPPFLAGS +LDFLAGS +CXXFLAGS +CXX +CPU_COUNT +EGREP +GREP +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +FFLAGS +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +' + ac_precious_vars='build_alias +host_alias +target_alias +CXX +CXXFLAGS +LDFLAGS +LIBS +CPPFLAGS +CCC +CC +CFLAGS +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR +STOPCOND_CFLAGS +STOPCOND_LIBS +MPICXX' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: '$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: '$ac_option' +Try '$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: '$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: '$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but 'cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +'configure' configures amuse-tidymess 1.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print 'checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for '--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or '..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, 'make install' will install all the files in +'$ac_default_prefix/bin', '$ac_default_prefix/lib' etc. You can specify +an installation prefix other than '$ac_default_prefix' using '--prefix', +for instance '--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/amuse-tidymess] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of amuse-tidymess 1.0:";; + esac + cat <<\_ACEOF + +Some influential environment variables: + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CC C compiler command + CFLAGS C compiler flags + PKG_CONFIG path to pkg-config utility + PKG_CONFIG_PATH + directories to add to pkg-config's search path + PKG_CONFIG_LIBDIR + path overriding pkg-config's built-in search path + STOPCOND_CFLAGS + C compiler flags for STOPCOND, overriding pkg-config + STOPCOND_LIBS + linker flags for STOPCOND, overriding pkg-config + MPICXX MPI C++ compiler command + +Use these variables to override the choices made by 'configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +amuse-tidymess configure 1.0 +generated by GNU Autoconf 2.72 + +Copyright (C) 2023 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 ;; +esac +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_cxx_check_func LINENO FUNC VAR +# ------------------------------------ +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_cxx_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (void); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (void); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + eval "$3=yes" +else case e in #( + e) eval "$3=no" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext ;; +esac +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_cxx_check_func +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by amuse-tidymess $as_me 1.0, which was +generated by GNU Autoconf 2.72. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See 'config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C++ compiler supports C++98 (global declarations) +ac_cxx_conftest_cxx98_globals=' +// Does the compiler advertise C++98 conformance? +#if !defined __cplusplus || __cplusplus < 199711L +# error "Compiler does not advertise C++98 conformance" +#endif + +// These inclusions are to reject old compilers that +// lack the unsuffixed header files. +#include +#include + +// and are *not* freestanding headers in C++98. +extern void assert (int); +namespace std { + extern int strcmp (const char *, const char *); +} + +// Namespaces, exceptions, and templates were all added after "C++ 2.0". +using std::exception; +using std::strcmp; + +namespace { + +void test_exception_syntax() +{ + try { + throw "test"; + } catch (const char *s) { + // Extra parentheses suppress a warning when building autoconf itself, + // due to lint rules shared with more typical C programs. + assert (!(strcmp) (s, "test")); + } +} + +template struct test_template +{ + T const val; + explicit test_template(T t) : val(t) {} + template T add(U u) { return static_cast(u) + val; } +}; + +} // anonymous namespace +' + +# Test code for whether the C++ compiler supports C++98 (body of main) +ac_cxx_conftest_cxx98_main=' + assert (argc); + assert (! argv[0]); +{ + test_exception_syntax (); + test_template tt (2.0); + assert (tt.add (4) == 6.0); + assert (true && !false); +} +' + +# Test code for whether the C++ compiler supports C++11 (global declarations) +ac_cxx_conftest_cxx11_globals=' +// Does the compiler advertise C++ 2011 conformance? +#if !defined __cplusplus || __cplusplus < 201103L +# error "Compiler does not advertise C++11 conformance" +#endif + +namespace cxx11test +{ + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate + { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate + { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy + { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; + + // for testing lambda expressions + template Ret eval(Fn f, Ret v) + { + return f(v); + } + + // for testing variadic templates and trailing return types + template auto sum(V first) -> V + { + return first; + } + template auto sum(V first, Args... rest) -> V + { + return first + sum(rest...); + } +} +' + +# Test code for whether the C++ compiler supports C++11 (body of main) +ac_cxx_conftest_cxx11_main=' +{ + // Test auto and decltype + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + int total = 0; + for (auto i = a3; *i; ++i) { total += *i; } + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for + int array[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, + 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (auto &x : array) { x += 23; } +} +{ + // Test lambda expressions + using cxx11test::eval; + assert (eval ([](int x) { return x*2; }, 21) == 42); + double d = 2.0; + assert (eval ([&](double x) { return d += x; }, 3.0) == 5.0); + assert (d == 5.0); + assert (eval ([=](double x) mutable { return d += x; }, 4.0) == 9.0); + assert (d == 5.0); +} +{ + // Test use of variadic templates + using cxx11test::sum; + auto a = sum(1); + auto b = sum(1, 2); + auto c = sum(1.0, 2.0, 3.0); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + test_template<::test_template> v(test_template(12)); +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +' + +# Test code for whether the C compiler supports C++11 (complete). +ac_cxx_conftest_cxx11_program="${ac_cxx_conftest_cxx98_globals} +${ac_cxx_conftest_cxx11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + ${ac_cxx_conftest_cxx11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C++98 (complete). +ac_cxx_conftest_cxx98_program="${ac_cxx_conftest_cxx98_globals} +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_cxx_conftest_cxx98_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (char **p, int i) +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* C89 style stringification. */ +#define noexpand_stringify(a) #a +const char *stringified = noexpand_stringify(arbitrary+token=sequence); + +/* C89 style token pasting. Exercises some of the corner cases that + e.g. old MSVC gets wrong, but not very hard. */ +#define noexpand_concat(a,b) a##b +#define expand_concat(a,b) noexpand_concat(a,b) +extern int vA; +extern int vbee; +#define aye A +#define bee B +int *pvA = &expand_concat(v,aye); +int *pvbee = &noexpand_concat(v,bee); + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +/* Does the compiler advertise C99 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +// See if C++-style comments work. + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); +extern void free (void *); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + // Work around memory leak warnings. + free (ia); + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +/* Does the compiler advertise C11 conformance? */ +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + + +# Auxiliary files required by this configure script. +ac_aux_files="config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/shared" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else case e in #( + e) as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 ;; +esac +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was set to '$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: '$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: '$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: '$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in '$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: '$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: '$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: '$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: '$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run '${MAKE-make} distclean' and/or 'rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# Pick up Conda env or virtualenv + + if test "x$VIRTUAL_ENV" != x +then : + + CFLAGS="$CFLAGS -I${VIRTUAL_ENV}/include" + CXXFLAGS="$CXXFLAGS -I${VIRTUAL_ENV}/include" + FFLAGS="$FFLAGS -I${VIRTUAL_ENV}/include" + FCFLAGS="$FCFLAGS -I${VIRTUAL_ENV}/include" + LDFLAGS="$LDFLAGS -L${VIRTUAL_ENV}/lib -Wl,-rpath,${VIRTUAL_ENV}/lib" + PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH" + +fi + + if test "x$CONDA_PREFIX" != x +then : + + # Conda does not set FCFLAGS, so we copy from FFLAGS here + FCFLAGS="$FFLAGS" + LDFLAGS="$LDFLAGS -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib" + # Conda pkg-config includes this already, but in case we have one from + # the system... + PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${CONDA_PREFIX}/lib/pkgconfig" + +fi + # Needs to be exported or the PKG_CHECK_MODULES macro won't see it + export PKG_CONFIG_PATH + + + +# Set CPU_COUNT + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in #( +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +#( +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + EGREP_TRADITIONAL=$EGREP + ac_cv_path_EGREP_TRADITIONAL=$EGREP + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the number of available CPUs" >&5 +printf %s "checking the number of available CPUs... " >&6; } + CPU_COUNT="0" + + # Try generic methods + + # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and + # 'NPROCESSORS_ONLN' are platform-specific + command -v getconf >/dev/null 2>&1 && \ + CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1 +then : + : # empty +else case e in #( + e) # 'nproc' is part of GNU Coreutils and is widely available + CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" + ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null +then : + : # empty +else case e in #( + e) # Try platform-specific preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^[0-9]+,' -c` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0" ;; #( + freebsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0" ;; #( + netbsd*) : + command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0" ;; #( + solaris*) : + command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^[0-9].*on-line' -c 2>/dev/null` || CPU_COUNT="0" ;; #( + mingw*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + msys*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + cygwin*) : + CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^[0-9]+/' -c` || CPU_COUNT="0" ;; #( + *) : + ;; +esac ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1 +then : + : # empty +else case e in #( + e) # Try less preferred generic method + # 'hw.ncpu' exist on many platforms, but not on GNU/Linux + CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" + ;; +esac +fi + if test "$CPU_COUNT" -gt "0" 2>/dev/null +then : + : # empty +else case e in #( + e) # Try platform-specific fallback methods + # They can be less accurate and slower then preferred methods + case $host_os in #( + *linux*) : + CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0" ;; #( + *darwin*) : + CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0" ;; #( + freebsd*) : + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + netbsd*) : + CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^[0-9]+ .* online ' -c` || \ + CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu[0-9]+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0" ;; #( + solaris*) : + command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ + CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0" ;; #( + mingw*) : + if CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\[0-9]+$' -c` +then : + : # empty +else case e in #( + e) test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; +esac +fi ;; #( + msys*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + cygwin*) : + test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS" ;; #( + *) : + ;; +esac ;; +esac +fi + if test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPU_COUNT" >&5 +printf "%s\n" "$CPU_COUNT" >&6; } + +else case e in #( + e) CPU_COUNT="1" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unable to detect (assuming 1)" >&5 +printf "%s\n" "unable to detect (assuming 1)" >&6; } + ;; +esac +fi + + +# Find the compiler(s) + + + + + + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5 +printf %s "checking whether the C++ compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to 'no'. +# So ignore a value of 'no', otherwise this would lead to 'EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an '-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else case e in #( + e) ac_file='' ;; +esac +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "C++ compiler cannot create executables +See 'config.log' for more details" "$LINENO" 5; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5 +printf %s "checking for C++ compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both 'conftest.exe' and 'conftest' are 'present' (well, observable) +# catch 'conftest.exe'. For instance with Cygwin, 'ls conftest' will +# work properly (i.e., refer to 'conftest.exe'), while it won't with +# 'rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else case e in #( + e) { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + if (!f) + return 1; + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C++ compiled programs. +If you meant to cross compile, use '--host'. +See 'config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext \ + conftest.o conftest.obj conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else case e in #( + e) printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See 'config.log' for more details" "$LINENO" 5; } ;; +esac +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else case e in #( + e) ac_compiler_gnu=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else case e in #( + e) CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else case e in #( + e) ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_prog_cxx_stdcxx=no +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 +printf %s "checking for $CXX option to enable C++11 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cxx_cxx11=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx11_program +_ACEOF +for ac_arg in '' -std=gnu++11 -std=gnu++0x -std=c++11 -std=c++0x -qlanglvl=extended0x -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx11" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX ;; +esac +fi + +if test "x$ac_cv_prog_cxx_cxx11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cxx_cxx11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx11" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx11" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx11" ;; +esac +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_prog_cxx_stdcxx=cxx11 ;; +esac +fi +fi +if test x$ac_prog_cxx_stdcxx = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 +printf %s "checking for $CXX option to enable C++98 features... " >&6; } +if test ${ac_cv_prog_cxx_cxx98+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cxx_cxx98=no +ac_save_CXX=$CXX +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_cxx_conftest_cxx98_program +_ACEOF +for ac_arg in '' -std=gnu++98 -std=c++98 -qlanglvl=extended -AA +do + CXX="$ac_save_CXX $ac_arg" + if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_cxx98=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cxx_cxx98" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX ;; +esac +fi + +if test "x$ac_cv_prog_cxx_cxx98" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cxx_cxx98" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_cxx98" >&5 +printf "%s\n" "$ac_cv_prog_cxx_cxx98" >&6; } + CXX="$CXX $ac_cv_prog_cxx_cxx98" ;; +esac +fi + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98 + ac_prog_cxx_stdcxx=cxx98 ;; +esac +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Find tools for creating static libraries +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +printf %s "checking target system type... " >&6; } +if test ${ac_cv_target+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "${ac_aux_dir}config.sub" $target_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $target_alias failed" "$LINENO" 5 +fi + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +printf "%s\n" "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +# Extract the first word of "$target_alias-ar", so it can be a program name with args. +set dummy $target_alias-ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$target_alias-ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +if test -z "$ac_cv_prog_AR"; then + if test "$build" = "$target"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR=":" +fi ;; +esac +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + AR=$ac_ct_AR + else + AR=":" + fi +else + AR="$ac_cv_prog_AR" +fi + +if test $AR = ":" +then : + as_fn_error $? "ar command not found." "$LINENO" 5 +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +if test $RANLIB = ":" +then : + as_fn_error $? "ranlib command not found." "$LINENO" 5 +fi + + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}wget", so it can be a program name with args. +set dummy ${ac_tool_prefix}wget; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_WGET+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$WGET"; then + ac_cv_prog_WGET="$WGET" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_WGET="${ac_tool_prefix}wget" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +WGET=$ac_cv_prog_WGET +if test -n "$WGET"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $WGET" >&5 +printf "%s\n" "$WGET" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_WGET"; then + ac_ct_WGET=$WGET + # Extract the first word of "wget", so it can be a program name with args. +set dummy wget; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_WGET+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_WGET"; then + ac_cv_prog_ac_ct_WGET="$ac_ct_WGET" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_WGET="wget" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_WGET=$ac_cv_prog_ac_ct_WGET +if test -n "$ac_ct_WGET"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_WGET" >&5 +printf "%s\n" "$ac_ct_WGET" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_WGET" = x; then + WGET="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + WGET=$ac_ct_WGET + fi +else + WGET="$ac_cv_prog_WGET" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}curl", so it can be a program name with args. +set dummy ${ac_tool_prefix}curl; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CURL+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CURL"; then + ac_cv_prog_CURL="$CURL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CURL="${ac_tool_prefix}curl" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CURL=$ac_cv_prog_CURL +if test -n "$CURL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CURL" >&5 +printf "%s\n" "$CURL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CURL"; then + ac_ct_CURL=$CURL + # Extract the first word of "curl", so it can be a program name with args. +set dummy curl; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CURL+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CURL"; then + ac_cv_prog_ac_ct_CURL="$ac_ct_CURL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CURL="curl" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CURL=$ac_cv_prog_ac_ct_CURL +if test -n "$ac_ct_CURL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CURL" >&5 +printf "%s\n" "$ac_ct_CURL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CURL" = x; then + CURL="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CURL=$ac_ct_CURL + fi +else + CURL="$ac_cv_prog_CURL" +fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a wget or curl to download files with" >&5 +printf %s "checking for a wget or curl to download files with... " >&6; } + if test "x$WGET" != "x" + then + # The MESA SDK server rejects wget, this is the official work-around + DOWNLOAD="$WGET --progress=bar:force:noscroll --user-agent='' -O -" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + if test "x$CURL" != "x" + then + DOWNLOAD="$CURL -L" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + fi + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}tar", so it can be a program name with args. +set dummy ${ac_tool_prefix}tar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_TAR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$TAR"; then + ac_cv_prog_TAR="$TAR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_TAR="${ac_tool_prefix}tar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +TAR=$ac_cv_prog_TAR +if test -n "$TAR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5 +printf "%s\n" "$TAR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_TAR"; then + ac_ct_TAR=$TAR + # Extract the first word of "tar", so it can be a program name with args. +set dummy tar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_TAR+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_TAR"; then + ac_cv_prog_ac_ct_TAR="$ac_ct_TAR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_TAR="tar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_TAR=$ac_cv_prog_ac_ct_TAR +if test -n "$ac_ct_TAR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_TAR" >&5 +printf "%s\n" "$ac_ct_TAR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_TAR" = x; then + TAR="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + TAR=$ac_ct_TAR + fi +else + TAR="$ac_cv_prog_TAR" +fi + + +# Find AMUSE libraries + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in '$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in '$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See 'config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else case e in #( + e) ac_compiler_gnu=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else case e in #( + e) CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else case e in #( + e) ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 ;; +esac +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC ;; +esac +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else case e in #( + e) if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" ;; +esac +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 ;; +esac +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + PKG_CONFIG="" + fi +fi + + + amuse_save_LIBS="$LIBS" + amuse_save_LIB_CFLAGS="$STOPCOND_CFLAGS" + amuse_save_LIB_LIBS="$STOPCOND_LIBS" + amuse_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" + + # If we have an active virtualenv, make sure pkg-config searches it + if test "a${VIRTUAL_ENV}" != "a" + then + PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}" + fi + + # All AMUSE libs export C symbols + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + # Search for the library, first directly then fall back to pkg-config + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for library containing is_condition_enabled" >&5 +printf %s "checking for library containing is_condition_enabled... " >&6; } +if test ${ac_cv_search_is_condition_enabled+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. + The 'extern "C"' is for builds by C++ compilers; + although this is not generally supported in C code supporting it here + has little cost and some practical benefit (sr 110532). */ +#ifdef __cplusplus +extern "C" +#endif +char is_condition_enabled (void); +int +main (void) +{ +return is_condition_enabled (); + ; + return 0; +} +_ACEOF +for ac_lib in '' stopcond +do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO" +then : + ac_cv_search_is_condition_enabled=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext + if test ${ac_cv_search_is_condition_enabled+y} +then : + break +fi +done +if test ${ac_cv_search_is_condition_enabled+y} +then : + +else case e in #( + e) ac_cv_search_is_condition_enabled=no ;; +esac +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_is_condition_enabled" >&5 +printf "%s\n" "$ac_cv_search_is_condition_enabled" >&6; } +ac_res=$ac_cv_search_is_condition_enabled +if test "$ac_res" != no +then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + FOUND_STOPCOND="yes" + STOPCOND_LIBS="$LIBS" + STOPCOND_CFLAGS="" + +else case e in #( + e) + +pkg_failed=no +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for STOPCOND" >&5 +printf %s "checking for STOPCOND... " >&6; } + +if test -n "$STOPCOND_CFLAGS"; then + pkg_cv_STOPCOND_CFLAGS="$STOPCOND_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"stopcond\""; } >&5 + ($PKG_CONFIG --exists --print-errors "stopcond") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_STOPCOND_CFLAGS=`$PKG_CONFIG --cflags "stopcond" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$STOPCOND_LIBS"; then + pkg_cv_STOPCOND_LIBS="$STOPCOND_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"stopcond\""; } >&5 + ($PKG_CONFIG --exists --print-errors "stopcond") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_STOPCOND_LIBS=`$PKG_CONFIG --libs "stopcond" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + STOPCOND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "stopcond" 2>&1` + else + STOPCOND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "stopcond" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$STOPCOND_PKG_ERRORS" >&5 + + + FOUND_STOPCOND="no" + +elif test $pkg_failed = untried; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + + FOUND_STOPCOND="no" + +else + STOPCOND_CFLAGS=$pkg_cv_STOPCOND_CFLAGS + STOPCOND_LIBS=$pkg_cv_STOPCOND_LIBS + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + + FOUND_STOPCOND="yes" + +fi + ;; +esac +fi + + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + PKG_CONFIG_PATH="$amuse_save_PKG_CONFIG_PATH" + LIBS="$amuse_save_LIBS" + + # If we have an active CONDA environment, assume that the lib is coming from + # there and add an additional flag so that .mod files can be found. Only really + # needed for stopcond and forsockets, and hopefully conda-forge will give us a + # better solution soon. + if test "${FOUND_STOPCOND}" == "yes" -a "x$CONDA_PREFIX" != "x" + then + STOPCOND_CFLAGS="${STOPCOND_CFLAGS} -I${CONDA_PREFIX}/include" + fi + + # If the user overrode the variables, go with what they set instead of + # what we just detected. + if test "x$amuse_save_LIB_CFLAGS" != "x" +then : + + STOPCOND_CFLAGS="$amuse_save_LIB_CFLAGS" + +fi + if test "x$amuse_save_LIB_LIBS" != "x" +then : + + STOPCOND_LIBS="$amuse_save_LIB_LIBS" + +fi + + + + + + + +# Find MPI for the worker +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + + + + + for ac_prog in mpicxx mpiCC mpic++ hcp mpxlC_r mpxlC mpCC cmpic++ +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MPICXX+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) if test -n "$MPICXX"; then + ac_cv_prog_MPICXX="$MPICXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MPICXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi ;; +esac +fi +MPICXX=$ac_cv_prog_MPICXX +if test -n "$MPICXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MPICXX" >&5 +printf "%s\n" "$MPICXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$MPICXX" && break +done +test -n "$MPICXX" || MPICXX="$CXX" + + ax_mpi_save_CXX="$CXX" + CXX="$MPICXX" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking checking MPI C++ flags" >&5 +printf %s "checking checking MPI C++ flags... " >&6; } + ax_mpi_cc_flags="`$MPICXX -showme:compile 2>/dev/null| cut -d\ -f2-`" + ax_mpi_cc_libs="`$MPICXX -showme:link 2>/dev/null| cut -d\ -f2-`" + if test "x$ax_mpi_cc_flags" = "x" +then : + + ax_mpi_cc_flags="`$MPICXX -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" + ax_mpi_cc_libs="`$MPICXX -show 2>/dev/null| cut -d\ -f2-`" + if test "x$ax_mpi_cc_flags" = "x" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: could not determine C++ flags from show functions" >&5 +printf "%s\n" "could not determine C++ flags from show functions" >&6; } +else case e in #( + e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: flags found" >&5 +printf "%s\n" "flags found" >&6; } ;; +esac +fi + + +else case e in #( + e) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: flags found" >&5 +printf "%s\n" "flags found" >&6; } ;; +esac +fi + MPI_CXXFLAGS="$ax_mpi_cc_flags" + MPI_CXXLIBS="$ax_mpi_cc_libs" + + + + + +if test x = x"$MPILIBS"; then + ac_fn_cxx_check_func "$LINENO" "MPI_Init" "ac_cv_func_MPI_Init" +if test "x$ac_cv_func_MPI_Init" = xyes +then : + MPILIBS=" " +fi + +fi + +if test x = x"$MPILIBS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5 +printf %s "checking for MPI_Init in -lmpi... " >&6; } +if test ${ac_cv_lib_mpi_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lmpi $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +namespace conftest { + extern "C" int MPI_Init (); +} +int +main (void) +{ +return conftest::MPI_Init (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + ac_cv_lib_mpi_MPI_Init=yes +else case e in #( + e) ac_cv_lib_mpi_MPI_Init=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpi_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpi_MPI_Init" = xyes +then : + MPILIBS="-lmpi" +fi + +fi +if test x = x"$MPILIBS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5 +printf %s "checking for MPI_Init in -lmpich... " >&6; } +if test ${ac_cv_lib_mpich_MPI_Init+y} +then : + printf %s "(cached) " >&6 +else case e in #( + e) ac_check_lib_save_LIBS=$LIBS +LIBS="-lmpich $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +namespace conftest { + extern "C" int MPI_Init (); +} +int +main (void) +{ +return conftest::MPI_Init (); + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + ac_cv_lib_mpich_MPI_Init=yes +else case e in #( + e) ac_cv_lib_mpich_MPI_Init=no ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS ;; +esac +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5 +printf "%s\n" "$ac_cv_lib_mpich_MPI_Init" >&6; } +if test "x$ac_cv_lib_mpich_MPI_Init" = xyes +then : + MPILIBS="-lmpich" +fi + +fi + +if test x != x"$MPILIBS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for mpi.h" >&5 +printf %s "checking for mpi.h... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else case e in #( + e) MPILIBS="" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +CXX="$ax_mpi_save_CXX" + + + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test x = x"$MPILIBS"; then + + : +else + +printf "%s\n" "#define HAVE_MPI 1" >>confdefs.h + + : +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Generate output +ac_config_files="$ac_config_files config.mk" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# 'ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* 'ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # 'set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # 'set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[][ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else case e in #( + e) case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as 'sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else case e in #( + e) as_fn_append () + { + eval $1=\$$1\$2 + } ;; +esac +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else case e in #( + e) as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } ;; +esac +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both 'ln -s file dir' and 'ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; 'ln -s' creates a wrapper executable. + # In both cases, we have to default to 'cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_sed_cpp="y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed '$as_sed_cpp'" # deprecated + +# Sed expression to map a string onto a valid variable name. +as_sed_sh="y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed '$as_sed_sh'" # deprecated + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by amuse-tidymess $as_me 1.0, which was +generated by GNU Autoconf 2.72. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +'$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to the package provider." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +amuse-tidymess config.status 1.0 +configured by $0, generated by GNU Autoconf 2.72, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2023 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: '$1' +Try '$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.mk") CONFIG_FILES="$CONFIG_FILES config.mk" ;; + + *) as_fn_error $? "invalid argument: '$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to '$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with './config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag '$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain ':'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: '$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is 'configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when '$srcdir' = '.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable 'datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + + + diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index d7aefee29d..b7bf73b32a 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -29,15 +29,14 @@ def test1(self): 1.0 | generic_unit_system.speed, 1.0 | generic_unit_system.speed, 1.0 | generic_unit_system.length, # radius - 1.0, # xi 1.0, # kf 1.0 | generic_unit_system.time, # tau 1.0 | 1/generic_unit_system.time, # wx 1.0 | 1/generic_unit_system.time, # wy 1.0 | 1/generic_unit_system.time, # wz - 1.0, # a_mb + 1.0 ) self.assertEquals(index_of_the_particle, 0) From d0247463e9d499ed0ec94f15f907e25dd7c427fe Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 16 Dec 2025 10:45:42 +0100 Subject: [PATCH 025/174] untracked amuse_tidymess/src/tidymess/ --- src/amuse_tidymess/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/amuse_tidymess/.gitignore diff --git a/src/amuse_tidymess/.gitignore b/src/amuse_tidymess/.gitignore new file mode 100644 index 0000000000..9eb55b9877 --- /dev/null +++ b/src/amuse_tidymess/.gitignore @@ -0,0 +1 @@ +src/tidymess From 84053f5251b2637030ea6d3ec3e987375ef930c8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 7 Jan 2026 16:34:32 -0500 Subject: [PATCH 026/174] TidymessInterface tests 1-4, passing --- src/amuse_tidymess/tests/test_tidymess.py | 332 ++++++++-------------- 1 file changed, 123 insertions(+), 209 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index b7bf73b32a..df9b5b02e6 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -5,245 +5,159 @@ from amuse_tidymess.interface import Tidymess, TidymessInterface from amuse.units import units as u from amuse.units import constants as c -from amuse.units import generic_unit_system +from amuse.units import generic_unit_system, nbody_system from amuse.datamodel import Particles -#from amuse.ext.orbital_elements import new_binary_from_orbital_elements, get_orbital_elements_from_binary +from amuse.ext.orbital_elements import generate_binaries, new_binary_from_orbital_elements class TidymessInterfaceTests(TestWithMPI): def test1(self): - ''' - # Test particle properties - ''' - - instance = Tidymess() - - self.assertEquals(instance.get_number_of_particles(), 0) - - index_of_the_particle = instance.new_particle( - 1.0 | generic_unit_system.mass, - 1.0 | generic_unit_system.length, - 1.0 | generic_unit_system.length, - 1.0 | generic_unit_system.length, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.length, # radius - 1.0, # xi - 1.0, # kf - 1.0 | generic_unit_system.time, # tau - 1.0 | 1/generic_unit_system.time, # wx - 1.0 | 1/generic_unit_system.time, # wy - 1.0 | 1/generic_unit_system.time, # wz - 1.0, # a_mb - 1.0 - ) - self.assertEquals(index_of_the_particle, 0) - - index_of_the_particle = instance.new_particle( - 1.0 | generic_unit_system.mass, - 2.0 | generic_unit_system.length, - 2.0 | generic_unit_system.length, - 2.0 | generic_unit_system.length, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.length, # radius - - 1.0, # xi - 1.0, # kf - 1.0 | generic_unit_system.time, # tau - 1.0 | 1/generic_unit_system.time, # wx - 1.0 | 1/generic_unit_system.time, # wy - 1.0 | 1/generic_unit_system.time, # wz - - 1.0, # a_mb - ) - self.assertEquals(index_of_the_particle, 1) - self.assertEquals(instance.get_number_of_particles(), 2) - - # test get/set_mass - instance.set_mass(0, 2.0 | generic_unit_system.mass) - self.assertEquals(instance.get_mass(0), 2.0 | generic_unit_system.mass) - - # test get/set_radius - instance.set_radius(1, 1.1 | generic_unit_system.length) - self.assertEquals(instance.get_radius(1), 1.1 | generic_unit_system.length) - - # test get/set_position - instance.set_position(0, 1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.length) - self.assertEquals(instance.get_position(0), [1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.length]) - - # test get/set_velocity - instance.set_velocity(1, 1.3 | generic_unit_system.speed, - 1.3 | generic_unit_system.speed, - 1.3 | generic_unit_system.speed) - self.assertEquals(instance.get_velocity(1), [1.3 | generic_unit_system.speed, - 1.3 | generic_unit_system.speed, - 1.3 | generic_unit_system.speed]) - - # test get/set_spin - instance.set_spin(0, 1.4 | 1/generic_unit_system.time, - 1.4 | 1/generic_unit_system.time, - 1.4 | 1/generic_unit_system.time) - self.assertEquals(instance.get_spin(0), [1.4 | 1/generic_unit_system.time, - 1.4 | 1/generic_unit_system.time, - 1.4 | 1/generic_unit_system.time]) - - # test get/set_state - state0 = [2.0 | generic_unit_system.mass, - 1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.length, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.length] - - self.assertEquals(instance.get_state(0), state0) - - instance.set_state(1, 1.0 | generic_unit_system.mass, - 2.0 | generic_unit_system.length, - 2.0 | generic_unit_system.length, - 2.0 | generic_unit_system.length, - 1.3 | generic_unit_system.speed, - 1.3 | generic_unit_system.speed, - 1.3 | generic_unit_system.speed, - 1.2 | generic_unit_system.length) - state1 = [1.0 | generic_unit_system.mass, - 2.0 | generic_unit_system.length, - 2.0 | generic_unit_system.length, - 2.0 | generic_unit_system.length, - 1.3 | generic_unit_system.speed, - 1.3 | generic_unit_system.speed, - 1.3 | generic_unit_system.speed, - 1.2 | generic_unit_system.length] - self.assertEquals(instance.get_state(1), state1) - + """ + Test Tidymess initialization. + """ + + instance = self.new_instance_of_an_optional_code(TidymessInterface) + self.assertEqual(0, instance.initialize_code()) + self.assertEqual(0, instance.commit_parameters()) + self.assertEqual(0, instance.cleanup_code()) instance.stop() - def test2(self): - ''' - #Test particle indices - ''' - - instance = TIDYMESS(redirection="none") - - index_of_the_particle = instance.new_particle( - 1.0 | generic_unit_system.mass, - 1.0 | generic_unit_system.length, - 1.0 | generic_unit_system.length, - 1.0 | generic_unit_system.length, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.speed, - 1.0 | generic_unit_system.length, # radius - 1.0, # xi - 1.0, # kf - 1.0 | generic_unit_system.time, # tau - 1.0 | 1/generic_unit_system.time, # wx - 1.0 | 1/generic_unit_system.time, # wy - 1.0 | 1/generic_unit_system.time, # wz - ) - self.assertEquals(index_of_the_particle, 0) - - index_of_the_particle = instance.new_particle( - 1.1 | generic_unit_system.mass, - 1.1 | generic_unit_system.length, - 1.1 | generic_unit_system.length, - 1.1 | generic_unit_system.length, - 1.1 | generic_unit_system.speed, - 1.1 | generic_unit_system.speed, - 1.1 | generic_unit_system.speed, - 1.1 | generic_unit_system.length, # radius - 1.1, # xi - 1.1, # kf - 1.1 | generic_unit_system.time, # tau - 1.1 | 1/generic_unit_system.time, # wx - 1.1 | 1/generic_unit_system.time, # wy - 1.1 | 1/generic_unit_system.time, # wz - ) - self.assertEquals(index_of_the_particle, 1) - - index_of_the_particle = instance.new_particle( - 1.2 | generic_unit_system.mass, - 1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.length, - 1.2 | generic_unit_system.speed, - 1.2 | generic_unit_system.speed, - 1.2 | generic_unit_system.speed, - 1.2 | generic_unit_system.length, # radius - 1.2, # xi - 1.2, # kf - 1.2 | generic_unit_system.time, # tau - 1.2 | 1/generic_unit_system.time, # wx - 1.2 | 1/generic_unit_system.time, # wy - 1.2 | 1/generic_unit_system.time, # wz + """ + Test TidymessInterface setters and getters. + """ + + instance = self.new_instance_of_an_optional_code(TidymessInterface) + + result = instance.get_number_of_particles() + self.assertEquals(result['number_of_particles'], 0) + + result = instance.new_particle( + 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, + 1.0, # radius + 1.0, # xi + 1.0, # kf + 1.0, # tau + 1.0, # wx + 1.0, # wy + 1.0, # wz ) - self.assertEquals(instance.get_number_of_particles(), 3) - self.assertEquals(instance.get_index_of_first_particle(), 0) - self.assertEquals(instance.get_index_of_next_particle(0), 1) + self.assertEqual(result['index_of_the_particle'], 0) - instance.delete_particle(1) - self.assertEquals(instance.get_index_of_first_particle(), 0) - self.assertEquals(instance.get_index_of_next_particle(0), 2) + # test get/set_mass + instance.set_mass(0, 2.0) + result = instance.get_mass(0) + self.assertEquals(result['mass'], 2.0) + # test get/set_position + instance.set_position(0, 1.2, 1.2, 1.2) + result = instance.get_position(0) + self.assertEquals(result['x'], 1.2) + self.assertEquals(result['y'], 1.2) + self.assertEquals(result['z'], 1.2) + + # test get/set velocity + instance.set_velocity(0, 1.3, 1.3, 1.3) + result = instance.get_velocity(0) + self.assertEquals(result['vx'], 1.3) + self.assertEquals(result['vy'], 1.3) + self.assertEquals(result['vz'], 1.3) + + # test get/set radius + instance.set_radius(0, 1.0) + result = instance.get_radius(0) + self.assertEquals(result['radius'], 1.0) + + # test get/set spin + instance.set_spin(0, 1.4, 1.4, 1.4) + result = instance.get_spin(0) + self.assertEquals(result['wx'], 1.4) + self.assertEquals(result['wy'], 1.4) + self.assertEquals(result['wz'], 1.4) + + # test get/set state + result = instance.get_state(0) + self.assertEquals(result['mass'], 2.0) + self.assertEquals(result['x'], 1.2) + self.assertEquals(result['y'], 1.2) + self.assertEquals(result['z'], 1.2) + self.assertEquals(result['vx'], 1.3) + self.assertEquals(result['vy'], 1.3) + self.assertEquals(result['vz'], 1.3) + self.assertEquals(result['radius'], 1.0) + + self.assertEqual(0, instance.cleanup_code()) instance.stop() - def test3(self): - ''' - #Test simulation parameters - ''' + """ + Test TidymessInterface creating and deleting particles. + """ + + instance = self.new_instance_of_an_optional_code(TidymessInterface) + + result = instance.new_particle( + 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, + 1.0, # radius + 1.0, # xi + 1.0, # kf + 1.0, # tau + 1.0, # wx + 1.0, # wy + 1.0, # wz + ) + self.assertEqual(result['index_of_the_particle'], 0) + + result = instance.new_particle( + 1.1, 1.1, 1.1, 1.1, + 1.1, 1.1, 1.1, + 1.1, # radius + 1.1, # xi + 1.1, # kf + 1.1, # tau + 1.1, # wx + 1.1, # wy + 1.1, # wz + ) - instance = TIDYMESS(redirection="none") - instance.set_tidal_model(4) + self.assertEqual(result['index_of_the_particle'], 1) - self.assertEquals(instance.get_tidal_model(),4) - instance.set_tidal_model(0) - self.assertEquals(instance.parameters.tidal_model,0) + # check number of particles + result = instance.get_number_of_particles() + self.assertEqual(result['number_of_particles'], 2) - self.assertEquals(instance.get_pn_order(),0) - instance.set_pn_order(1) - self.assertEquals(instance.parameters.pn_order,1) + # check that indexes are correct + first = instance.get_index_of_first_particle() + self.assertEqual(first['index_of_the_particle'], 0) - self.assertEquals(instance.get_magnetic_braking(),0) - instance.set_magnetic_braking(1) - self.assertEquals(instance.parameters.magnetic_braking ,1) + next = instance.get_index_of_next_particle(0) + self.assertEqual(next['index_of_the_next_particle'], 1) - self.assertEquals(instance.get_collision_mode(),0) - instance.set_collision_mode(1) - self.assertEquals(instance.parameters.collision_mode,1) + # delete particle + instance.delete_particle(1) - self.assertEquals(instance.get_roche_mode(),0) - instance.set_roche_mode(2) - self.assertEquals(instance.parameters.roche_mode,2) + result = instance.get_number_of_particles() + self.assertEqual(result['number_of_particles'], 1) - self.assertEquals(instance.get_breakup_mode(),0) - instance.set_breakup_mode(1) - self.assertEquals(instance.parameters.breakup_mode,1) + first = instance.get_index_of_first_particle() + self.assertEqual(first['index_of_the_particle'], 0) instance.stop() def test4(self): - ''' - #Make a system from Particles - ''' + """ + Test Tidymess add_particles method. + """ - system = new_binary_from_orbital_elements( + planet, moon = generate_binaries( 1 | u.MEarth, 7.342e22 | u.kg, 384399e3 | u.m, - G=c.G) - planet = system[0] - moon = system[1] + G=c.G + ) planet.radius = 6371. | u.km planet.xi = 0.3308 From 4e1b222d657f4fd42648b1309cf04e92ee17941c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 7 Jan 2026 16:45:10 -0500 Subject: [PATCH 027/174] class TestTidymess and test1, passing --- src/amuse_tidymess/tests/test_tidymess.py | 40 ++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index df9b5b02e6..f9efe9ead6 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -147,7 +147,45 @@ def test3(self): instance.stop() - def test4(self): + +class TestTidymess(TestWithMPI): + + def test1(self): + """ + Test Tidymess parameters attribute. + """ + + instance = self.new_instance_of_an_optional_code(Tidymess) + + instance.set_tidal_model(4) + self.assertEquals(instance.get_tidal_model(), 4) + + instance.set_tidal_model(0) + self.assertEquals(instance.parameters.tidal_model, 0) + + self.assertEquals(instance.get_pn_order(), 0) + instance.set_pn_order(1) + self.assertEquals(instance.parameters.pn_order, 1) + + self.assertEquals(instance.get_magnetic_braking(), 0) + instance.set_magnetic_braking(1) + self.assertEquals(instance.parameters.magnetic_braking ,1) + + self.assertEquals(instance.get_collision_mode(), 0) + instance.set_collision_mode(1) + self.assertEquals(instance.parameters.collision_mode, 1) + + self.assertEquals(instance.get_roche_mode(), 0) + instance.set_roche_mode(2) + self.assertEquals(instance.parameters.roche_mode, 2) + + self.assertEquals(instance.get_breakup_mode(), 0) + instance.set_breakup_mode(1) + self.assertEquals(instance.parameters.breakup_mode, 1) + + instance.stop() + + def test2(self): """ Test Tidymess add_particles method. """ From 91b4a38b21593e9e3be092450d66412edc0357bf Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 7 Jan 2026 16:52:12 -0500 Subject: [PATCH 028/174] TestTidymess test2 --- src/amuse_tidymess/tests/test_tidymess.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index f9efe9ead6..e7640b589b 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -212,17 +212,18 @@ def test2(self): moon.wy = 8.4e1 | 1/u.yr moon.wz = 3.8e8 | 1/u.yr - system.move_to_center() + system = Particles() + system.add_particles(planet) + system.add_particles(moon) converter = nbody_system.nbody_to_si(system.mass.sum(), planet.position.length()) - instance = TIDYMESS(converter) + instance = self.new_instance_of_an_optional_code(Tidymess, converter) instance.set_tidal_model(0) - instance.particles.add_particles(system) # hier wordt tidal_model weer naar 4 gezet?? waarom? + instance.particles.add_particles(system) instance.set_tidal_model(0) - instance.get_time_step() - # ^ dit kan hij alleen als bij new_particle() ook tidymess.commit_parameters(); staat + self.assertEquals(instance.get_time_step(), 0 | u.s) self.assertGreater(instance.get_total_mass(), 6.04562e24 | u.kg) self.assertLess(instance.get_total_mass(), 6.04563e24 | u.kg) From a78dfaeb1c2fe979554cec8603ea6fe9fc292ff6 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 7 Jan 2026 17:30:42 -0500 Subject: [PATCH 029/174] added all setters / getters in TestTidymessInterface test --- src/amuse_tidymess/tests/test_tidymess.py | 68 +++++++++++++++++++---- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index e7640b589b..222e6dbbeb 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -46,38 +46,26 @@ def test2(self): self.assertEqual(result['index_of_the_particle'], 0) - # test get/set_mass instance.set_mass(0, 2.0) result = instance.get_mass(0) self.assertEquals(result['mass'], 2.0) - # test get/set_position instance.set_position(0, 1.2, 1.2, 1.2) result = instance.get_position(0) self.assertEquals(result['x'], 1.2) self.assertEquals(result['y'], 1.2) self.assertEquals(result['z'], 1.2) - # test get/set velocity instance.set_velocity(0, 1.3, 1.3, 1.3) result = instance.get_velocity(0) self.assertEquals(result['vx'], 1.3) self.assertEquals(result['vy'], 1.3) self.assertEquals(result['vz'], 1.3) - # test get/set radius instance.set_radius(0, 1.0) result = instance.get_radius(0) self.assertEquals(result['radius'], 1.0) - # test get/set spin - instance.set_spin(0, 1.4, 1.4, 1.4) - result = instance.get_spin(0) - self.assertEquals(result['wx'], 1.4) - self.assertEquals(result['wy'], 1.4) - self.assertEquals(result['wz'], 1.4) - - # test get/set state result = instance.get_state(0) self.assertEquals(result['mass'], 2.0) self.assertEquals(result['x'], 1.2) @@ -88,6 +76,62 @@ def test2(self): self.assertEquals(result['vz'], 1.3) self.assertEquals(result['radius'], 1.0) + instance.set_spin(0, 1.4, 1.4, 1.4) + result = instance.get_spin(0) + self.assertEquals(result['wx'], 1.4) + self.assertEquals(result['wy'], 1.4) + self.assertEquals(result['wz'], 1.4) + + instance.set_tidal_model(0) + result = instance.get_tidal_model() + self.assertEquals(result['tidal_model'], 0) + + instance.set_pn_order(2) + result = instance.get_pn_order() + self.assertEquals(result['pn_order'], 2) + + instance.set_magnetic_braking(1) + result = instance.get_magnetic_braking() + self.assertEquals(result['magnetic_braking'], 1) + + instance.set_speed_of_light(299792) + result = instance.get_speed_of_light() + self.assertEquals(result['speed_of_light'], 299792) + + instance.set_dt_mode(0) # FIX + result = instance.get_dt_mode() + self.assertEquals(result['dt_mode'], 0) + + instance.set_dt_const(0) # FIX + result = instance.get_dt_const() + self.assertEquals(result['dt_const'], 0) + + result = instance.get_time_step() + self.assertEquals(result['time_step'], 0) + + instance.set_eta(0) # FIX + result = instance.get_eta() + self.assertEquals(result['eta'], 0) + + instance.set_n_iter(1) # FIX + result = instance.get_n_iter() + self.assertEquals(result['n_iter'], 1) + + instance.set_collision_mode(2) + result = instance.get_collision_mode() + self.assertEquals(result['collision_mode'], 2) + + instance.set_roche_mode(2) + result = instance.get_roche_mode() + self.assertEquals(result['roche_mode'], 2) + + instance.set_breakup_mode(1) + result = instance.get_breakup_mode() + self.assertEquals(result['breakup_mode'], 1) + + result = instance.get_num_integration_step() # FIX + self.assertEquals(result['num_integration_step'], 0) + self.assertEqual(0, instance.cleanup_code()) instance.stop() From 18800f6baf4a5a9ed4b7546aa958aa7090269054 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 7 Jan 2026 17:31:05 -0500 Subject: [PATCH 030/174] renamed TestTidymessInterface --- src/amuse_tidymess/tests/test_tidymess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 222e6dbbeb..9d3160ba6a 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -9,7 +9,7 @@ from amuse.datamodel import Particles from amuse.ext.orbital_elements import generate_binaries, new_binary_from_orbital_elements -class TidymessInterfaceTests(TestWithMPI): +class TestTidymessInterface(TestWithMPI): def test1(self): """ From e7953558665d110d3f3d9cecf77d9d225eb03ba1 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 7 Jan 2026 17:33:16 -0500 Subject: [PATCH 031/174] test_tidymess import fixes --- src/amuse_tidymess/tests/test_tidymess.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 9d3160ba6a..2cb32ba026 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -5,7 +5,7 @@ from amuse_tidymess.interface import Tidymess, TidymessInterface from amuse.units import units as u from amuse.units import constants as c -from amuse.units import generic_unit_system, nbody_system +from amuse.units import nbody_system from amuse.datamodel import Particles from amuse.ext.orbital_elements import generate_binaries, new_binary_from_orbital_elements From 5015fcb0fb803cf86087937c3e895de997acdfff Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 7 Jan 2026 17:34:29 -0500 Subject: [PATCH 032/174] refactored signature style of certain functions --- src/amuse_tidymess/interface.cc | 47 ++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index f5cff32008..6cc7e2d3fd 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -72,9 +72,12 @@ int determine_dt_sgn(double t_end) { // copied from tidymess.cpp // tidymess-specific setters & getters -int get_tidal_model(int * tidal_model){ +int get_tidal_model(int * tidal_model) +{ *tidal_model = tidymess.get_tidal_model(); - return 0;} + return 0; +} + int set_tidal_model(int tidal_model){ tidymess.set_tidal_model(tidal_model); set_shapes_and_momenta(); @@ -234,9 +237,21 @@ int delete_particle(int index_of_the_particle){ return 0;} // setters & getters - -int set_state(int index_of_the_particle, double mass, double x, double y, - double z, double vx, double vy, double vz, double radius){ +// +// SHOULD SET STATE TRACK THE OTHER PARAMS? + +int set_state( + int index_of_the_particle, + double mass, + double x, + double y, + double z, + double vx, + double vy, + double vz, + double radius +) +{ vector bodies = tidymess.get_particles(); int ind = get_ind_from_index(index_of_the_particle); bodies[ind].m = mass; @@ -244,10 +259,21 @@ int set_state(int index_of_the_particle, double mass, double x, double y, bodies[ind].r = {x, y, z}; bodies[ind].v = {vx, vy, vz}; tidymess.set_particles(bodies); - return 0;} -int get_state(int index_of_the_particle, double * mass, double * x, - double * y, double * z, double * vx, double * vy, double * vz, - double * radius){ + return 0; +} + +int get_state( + int index_of_the_particle, + double * mass, + double * x, + double * y, + double * z, + double * vx, + double * vy, + double * vz, + double * radius +) +{ vector bodies = tidymess.get_particles(); Body body = bodies[get_ind_from_index(index_of_the_particle)]; *mass = body.m; @@ -258,7 +284,8 @@ int get_state(int index_of_the_particle, double * mass, double * x, *vy = body.v[1]; *vz = body.v[2]; *radius = body.R; - return 0;} + return 0; +} int get_mass(int index_of_the_particle, double * mass){ vector bodies = tidymess.get_particles(); From 5b74d6c1a9e571418886477553ce10913265d003 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 7 Jan 2026 17:36:40 -0500 Subject: [PATCH 033/174] uncommented GravityFieldInterface in TidymessInterface --- src/amuse_tidymess/interface.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 8d0ad71829..4f81729420 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1,19 +1,20 @@ from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravitationalDynamicsInterface -#from amuse.community.interface.gd import GravityFieldInterface +from amuse.community.interface.gd import GravityFieldInterface from amuse.community.interface.gd import GravityFieldCode from amuse.community.interface.stopping_conditions import StoppingConditions, StoppingConditionInterface from amuse.rfi.core import CodeInterface, legacy_function, LegacyFunctionSpecification from amuse.support.interface import MethodWithUnitsDefinition from amuse.support.literature import LiteratureReferencesMixIn -from amuse.units import nbody_system +from amuse.units import generic_unit_system, nbody_system + class TidymessInterface( CodeInterface, LiteratureReferencesMixIn, GravitationalDynamicsInterface, StoppingConditionInterface, - #GravityFieldInterface + GravityFieldInterface ): """ From 5b651bfd268599458a8ee9046cd38ee8c4112fb4 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 8 Jan 2026 12:38:39 -0500 Subject: [PATCH 034/174] def test4 evole_model TidymessInterface --- src/amuse_tidymess/tests/test_tidymess.py | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 2cb32ba026..a2697db330 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -191,6 +191,30 @@ def test3(self): instance.stop() + def test4(self): + """ + Test TidymessInterface evolve_model with an equal mass binary. + """ + instance = self.new_instance_of_an_optional_code(TidymessInterface) + self.assertEqual(0, instance.initialize_code()) + + self.assertEqual(0, instance.commit_parameters()) + + self.assertEqual([0, 0], list(instance.new_particle(0.5, 0.5, 0, 0, 0, 0.5, 0).values())) + self.assertEqual([1, 0], list(instance.new_particle(0.5, -0.5, 0, 0, 0, -0.5, 0).values())) + self.assertEqual(0, instance.commit_particles()) + + self.assertEqual(0, instance.evolve_model(np.pi)) # half an orbit + for result, expected in zip(instance.get_position(0).values(), [-0.5, 0.0, 0.0, 0]): + self.assertAlmostEqual(result, expected, 5) + + self.assertEqual(0, instance.evolve_model(2 * np.pi)) # full orbit + for result, expected in zip(instance.get_position(0).values(), [0.5, 0.0, 0.0, 0]): + self.assertAlmostEqual(result, expected, 5) + + self.assertEqual(0, instance.cleanup_code()) + instance.stop() + class TestTidymess(TestWithMPI): From 57e95e5053fd9da35373edca6a0e1328c4505b41 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 8 Jan 2026 14:12:00 -0500 Subject: [PATCH 035/174] def earth_moon_system in TestTidymess --- src/amuse_tidymess/tests/test_tidymess.py | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index a2697db330..5f2a759ce9 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -218,6 +218,41 @@ def test4(self): class TestTidymess(TestWithMPI): + def earth_moon_system(self): + """ + Generate a Earth - moon system. + + Returns + ------- + planet, moon : amuse.datamodel.particles.Particles + Particle objects of the system. + """ + + planet, moon = generate_binaries( + 1 | u.MEarth, + 7.342e22 | u.kg, + 384399e3 | u.m, + G=c.G + ) + + planet.radius = 6371. | u.km + planet.xi = 0.3308 + planet.kf = 0.933 + planet.tau = 180 | u.s + planet.wx = 0.0 | 1/u.yr + planet.wy = 2.3e3 | 1/u.yr + planet.wz = -4.7e6 | 1/u.yr + moon.radius = 1737.4 | u.km + moon.xi = 0.394 + moon.kf = 0 + moon.kf = 0 + moon.wx = 0.0 | 1/u.yr + moon.wy = 8.4e1 | 1/u.yr + moon.wz = 3.8e8 | 1/u.yr + + return planet, moon + + def test1(self): """ Test Tidymess parameters attribute. From 83ca44185dbb900b8adeb0fd57f53ebca19975d8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 8 Jan 2026 14:14:54 -0500 Subject: [PATCH 036/174] TestTidymess test4 and 5 --- src/amuse_tidymess/tests/test_tidymess.py | 123 +++++++++------------- 1 file changed, 50 insertions(+), 73 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 5f2a759ce9..8d33a73c74 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -292,28 +292,7 @@ def test2(self): """ Test Tidymess add_particles method. """ - - planet, moon = generate_binaries( - 1 | u.MEarth, - 7.342e22 | u.kg, - 384399e3 | u.m, - G=c.G - ) - - planet.radius = 6371. | u.km - planet.xi = 0.3308 - planet.kf = 0.933 - planet.tau = 180 | u.s - planet.wx = 0.0 | 1/u.yr - planet.wy = 2.3e3 | 1/u.yr - planet.wz = -4.7e6 | 1/u.yr - moon.radius = 1737.4 | u.km - moon.xi = 0.394 - moon.kf = 0 - moon.kf = 0 - moon.wx = 0.0 | 1/u.yr - moon.wy = 8.4e1 | 1/u.yr - moon.wz = 3.8e8 | 1/u.yr + planet, moon = self.earth_moon_system() system = Particles() system.add_particles(planet) @@ -334,94 +313,92 @@ def test2(self): instance.stop() - def test5(self): - ''' - #Evolve a system of Particles - ''' + def test3(self): + """ + Test the function for converting spin vectors + """ - system = new_binary_from_orbital_elements( - 5.9724e24 | u.kg, - 0.0735e24 | u.kg, - 0.3844e6 | u.km, - G=c.G) - planet = system[0] - moon = system[1] + converter = nbody_system.nbody_to_si(1 | u.MEarth, 1 | u.REarth) + instance = Tidymess(converter) - planet.radius = 6371. | u.km - planet.xi = 0.3308 - planet.kf = 0 - planet.tau = 180 | u.s - planet.wx = 0.0 | 1/u.yr - planet.wy = 0.0 | 1/u.yr - planet.wz = 0.0 | 1/u.yr - moon.radius = 1737.4 | u.km - moon.xi = 0.394 - moon.kf = 0 - moon.tau = 0 | u.s - moon.wx = 0.0 | 1/u.yr - moon.wy = 0.0 | 1/u.yr - moon.wz = 0.0 | 1/u.yr + lod = 24 | u.hour + obl = 10 | u.deg + psi = 0 | u.deg + + spin = instance.convert_spin_vectors_to_inertial(lod, obl, psi) + + self.assertLess(np.abs(spin[2].number-7.1617240788458890e-05), 1e-19) + + def test4(self): + """ + Evolve a system of Particles + """ + planet, moon = self.earth_moon_system() + + system = Particles() + system.add_particles(planet) + system.add_particles(moon) system.move_to_center() converter = nbody_system.nbody_to_si(system.mass.sum(), planet.position.length()) - instance = TIDYMESS(converter) + instance = self.new_instance_of_an_optional_code(Tidymess, converter) tidal_model = 0 instance.set_tidal_model(tidal_model) - instance.particles.add_particles(system) # hier wordt tidal_model weer naar 4 gezet?? waarom? + instance.particles.add_particles(system) # FIX : tidal_model != 0 after adding particles instance.set_tidal_model(tidal_model) - self.assertGreater(instance.get_total_mass(), 6.0458e24 | u.kg) + ratio = instance.get_total_mass() / system.mass.sum() + + self.assertAlmostEquals(ratio, 1) self.assertLess(instance.get_total_mass(), 6.0460e24 | u.kg) self.assertEquals(instance.get_total_radius(), 8108400.0 | u.m) instance.set_dt_mode(2) - # Empty lists for properties to track - star_positions = [] - planet_positions = [] - moon_positions = [] - channel = instance.particles.new_channel_to(system) - - # Running gravity code - end_time = 1 + end_time = 1.1 dt = 0.1 times = np.arange(0, end_time, dt) | u.yr - for t in times: + planet_positions = np.zeros((times.shape[0], 3)) + moon_positions = np.zeros_like(planet_positions) + channel = instance.particles.new_channel_to(system) + + for i, t in enumerate(times): instance.evolve_model(t) channel.copy() - system.move_to_center() + planet_positions[i] = system[0].position.number + moon_positions[i] = system[1].position.number - planet_positions.append([planet.position.number[0], planet.position.number[1], planet.position.number[2]]) - moon_positions.append([moon.position.number[0], moon.position.number[1], moon.position.number[2]]) - planet_positions = np.asarray(planet_positions) - moon_positions = np.asarray(moon_positions) + evol_time = instance.get_time() + year = u.yr.in_(u.s) - self.assertNotEqual(planet_positions[0,0],planet_positions[-1,0]) # check if it evolved at all + self.assertAlmostEquals(evol_time, year) + self.assertNotEqual(planet_positions[0,0], planet_positions[-1,0]) + self.assertNotEqual(moon_positions[0,0], moon_positions[-1,0]) instance.stop() - def test6(self): - ''' - #Evolve a system - ''' + def test5(self): + """ + Evolve a system. + """ converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) - instance = TIDYMESS(converter) + instance = Tidymess(converter) index_earth = instance.new_particle( 1.0 | u.MEarth, -4.6706380895356489e+06 | u.m, 0.0000000000000000e+00 | u.m, 0.0000000000000000e+00 | u.m, - 0.0000000000000000e+00 | u.m/u.s, - -1.2449006368729913e+01 | u.m/u.s, - 0.0000000000000000e+00 | u.m/u.s, + 0.0000000000000000e+00 | u.m / u.s, + -1.2449006368729913e+01 | u.m / u.s, + 0.0000000000000000e+00 | u.m / u.s, ) self.assertEquals(index_earth, 0) From 47d95743777a03150da3160a0b88da6ff86f73c0 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 8 Jan 2026 14:15:27 -0500 Subject: [PATCH 037/174] formatting --- src/amuse_tidymess/tests/test_tidymess.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 8d33a73c74..e8f7a3e559 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -350,7 +350,6 @@ def test4(self): instance.set_tidal_model(tidal_model) ratio = instance.get_total_mass() / system.mass.sum() - self.assertAlmostEquals(ratio, 1) self.assertLess(instance.get_total_mass(), 6.0460e24 | u.kg) self.assertEquals(instance.get_total_radius(), 8108400.0 | u.m) @@ -373,7 +372,6 @@ def test4(self): planet_positions[i] = system[0].position.number moon_positions[i] = system[1].position.number - evol_time = instance.get_time() year = u.yr.in_(u.s) From 2b72aebcc0c722ed852f59c49e98a19d3bb83f4a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 8 Jan 2026 14:17:49 -0500 Subject: [PATCH 038/174] cleaned up TestTidymess --- src/amuse_tidymess/tests/test_tidymess.py | 39 ++++++----------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index e8f7a3e559..4d1c82afed 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -405,9 +405,9 @@ def test5(self): 3.7972936191046441e+08 | u.m, 0.0000000000000000e+00 | u.m, 0.0000000000000000e+00 | u.m, - 0.0000000000000000e+00 | u.m/u.s, - 1.0121215033569634e+03 | u.m/u.s, - 0.0000000000000000e+00 | u.m/u.s, + 0.0000000000000000e+00 | u.m / u.s, + 1.0121215033569634e+03 | u.m / u.s, + 0.0000000000000000e+00 | u.m / u.s, ) self.assertEquals(index_moon, 1) appendix = "dt_sgn changed (>=)" @@ -455,27 +455,9 @@ def test5(self): instance.stop() - - def test7(self): - ''' - #Test the function for converting spin vectors - ''' - - converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) - instance = TIDYMESS(converter) - - lod = 24 | u.hour - obl = 10 | u.deg - psi = 0 | u.deg - - spin = instance.convert_spin_vectors_to_inertial(lod, obl, psi) - - self.assertLess(np.abs(spin[2].number-7.1617240788458890e-05), 1e-19) - - - def test8(self): + def test6(self): ''' - #Test collisions (just remove both particles) + Test collisions (just remove both particles) ''' def merge_two_stars(bodies, particles_in_encounter): @@ -485,11 +467,11 @@ def merge_two_stars(bodies, particles_in_encounter): v = (particles_in_encounter[0].velocity - particles_in_encounter[1].velocity) print("Actually merger occurred:") print("Two stars (M=",particles_in_encounter.mass.in_(units.MSun), - ") collided with d=", d.length().in_(units.au)) + ") collided with d=", d.length().in_(units.au)) new_particle=Particles(1) new_particle.mass = particles_in_encounter.total_mass() new_particle.age = min(particles_in_encounter.age) \ - * max(particles_in_encounter.mass)/new_particle.mass + * max(particles_in_encounter.mass)/new_particle.mass new_particle.position = com_pos new_particle.velocity = com_vel new_particle.radius = particles_in_encounter.radius.sum() @@ -498,7 +480,7 @@ def merge_two_stars(bodies, particles_in_encounter): converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) - instance = TIDYMESS(converter) + instance = Tidymess(converter) index_earth = instance.new_particle( 1.0 | u.MEarth, @@ -635,7 +617,7 @@ def get_particle_indices(): instance.stop() - def test9(self): + def test7(self): ''' #Test collisions (replace particles) ''' @@ -655,8 +637,7 @@ def merge_two_stars(bodies, particles_in_encounter): converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) - instance = TIDYMESS(converter) - + instance = Tidymess(converter) system = Particles(6) From b898b153cd129246e5c0b1075718fc07bf163b71 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 13 Jan 2026 10:57:44 +0100 Subject: [PATCH 039/174] test_tidymess formatting --- src/amuse_tidymess/tests/test_tidymess.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 4d1c82afed..8bea4bdfe8 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -166,7 +166,6 @@ def test3(self): 1.1, # wy 1.1, # wz ) - self.assertEqual(result['index_of_the_particle'], 1) # check number of particles From b72e492afd954bc56a8b7a0e1f70e1b776c706ba Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 13 Jan 2026 11:30:45 +0100 Subject: [PATCH 040/174] renamed get_ind_from_index to get_body_index_by_id in tidymess interface.cc --- src/amuse_tidymess/.gitignore | 1 + src/amuse_tidymess/interface.cc | 34 +++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/amuse_tidymess/.gitignore b/src/amuse_tidymess/.gitignore index 9eb55b9877..ad55827268 100644 --- a/src/amuse_tidymess/.gitignore +++ b/src/amuse_tidymess/.gitignore @@ -1 +1,2 @@ src/tidymess +.clangd diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 6cc7e2d3fd..ff9a85f3b2 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -1,5 +1,4 @@ #include "tidymess_worker.h" - #include // AMUSE STOPPING CONDITIONS SUPPORT @@ -29,21 +28,31 @@ int highest_index = 0; static double begin_time = 0; -int get_ind_from_index(int index_of_the_particle) { - // find the position in bodies of the Body with a given index +int get_body_index_by_id(int index_of_the_particle) { + /* + * Given a particle ID, find the index of that particle + * within Tidymess Bodies. + * + * @param index_of_the_particle Particle identifier + */ vector bodies = tidymess.get_particles(); - int ind; - int i; - for (i=0; i 0) { + if (tidymess.get_tidal_model() > 0) { switch(init.initial_shape) { case 0: tidymess.set_to_spherical_shape(); @@ -54,7 +63,8 @@ int set_shapes_and_momenta() { // copied from tidymess.cpp } tidymess.update_angular_momentum(); } - return 0;} + return 0; +} int determine_dt_sgn(double t_end) { // copied from tidymess.cpp bool dt_pos; From baa3dc6d12d30f41a0be27e3333e0a4e16ea2e9c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 13 Jan 2026 11:33:08 +0100 Subject: [PATCH 041/174] tidymess interface.cc re formatted functions for consistent style --- src/amuse_tidymess/interface.cc | 123 +++++++++++++++++++------------- 1 file changed, 75 insertions(+), 48 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index ff9a85f3b2..61c6512dfa 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -78,106 +78,133 @@ int determine_dt_sgn(double t_end) { // copied from tidymess.cpp dt_sgn = -1; } tidymess.set_dt_sgn(dt_sgn); - return 0;} + return 0; +} // tidymess-specific setters & getters -int get_tidal_model(int * tidal_model) -{ +int get_tidal_model(int * tidal_model) { *tidal_model = tidymess.get_tidal_model(); return 0; } - -int set_tidal_model(int tidal_model){ +int set_tidal_model(int tidal_model) { tidymess.set_tidal_model(tidal_model); set_shapes_and_momenta(); - return 0;} + return 0; +} -int get_pn_order(int * pn_order){ +int get_pn_order(int * pn_order) { *pn_order = tidymess.get_pn_order(); - return 0;} -int set_pn_order(int pn_order){ + return 0; +} +int set_pn_order(int pn_order) { tidymess.set_pn_order(pn_order); - return 0;} + return 0; +} -int get_magnetic_braking(int * magnetic_braking){ +int get_magnetic_braking(int * magnetic_braking) { *magnetic_braking = tidymess.get_magnetic_braking(); - return 0;} -int set_magnetic_braking(int magnetic_braking){ + return 0; +} +int set_magnetic_braking(int magnetic_braking) { tidymess.set_magnetic_braking(magnetic_braking); - return 0;} + return 0; +} -int get_speed_of_light(double * speed_of_light){ +int get_speed_of_light(double * speed_of_light) { *speed_of_light = tidymess.get_speed_of_light(); - return 0;} -int set_speed_of_light(double speed_of_light){ + return 0; +} +int set_speed_of_light(double speed_of_light) { tidymess.set_speed_of_light(speed_of_light); - return 0;} + return 0; +} -int get_dt_mode(int * dt_mode){ +int get_dt_mode(int * dt_mode) { *dt_mode = tidymess.get_dt_mode(); - return 0;} -int set_dt_mode(int dt_mode){ + return 0; +} +int set_dt_mode(int dt_mode) { tidymess.set_dt_mode(dt_mode); - return 0;} + return 0; +} -int get_dt_const(double * dt_const){ +int get_dt_const(double * dt_const) { *dt_const = tidymess.get_dt_const(); - return 0;} -int set_dt_const(double dt_const){ + return 0; +} +int set_dt_const(double dt_const) { tidymess.set_dt_const(dt_const); - return 0;} + return 0; +} -int get_eta(double * eta){ +int get_eta(double * eta) { *eta = tidymess.get_eta(); - return 0;} -int set_eta(double eta){ + return 0; +} +int set_eta(double eta) { tidymess.set_eta(eta); - return 0;} + return 0; +} -int get_n_iter(int * n_iter){ +int get_n_iter(int * n_iter) { *n_iter = tidymess.get_n_iter(); - return 0;} -int set_n_iter(int n_iter){ + return 0; +} +int set_n_iter(int n_iter) { tidymess.set_n_iter(n_iter); - return 0;} + return 0; +} -int get_collision_mode(int * collision_mode){ +// FIX +int get_collision_mode(int * collision_mode) { + // if (tidymess.get_collision_mode() != collision.get_collision_mode()) { + + // } *collision_mode = tidymess.get_collision_mode(); + // maybe check if Tidy and Collision have the same value set - return 0;} -int set_collision_mode(int collision_mode){ + return 0; +} +int set_collision_mode(int collision_mode) { tidymess.set_collision_mode(collision_mode); collision.set_collision_mode(collision_mode); collision.setup(); - return 0;} + return 0; +} -int get_roche_mode(int * roche_mode){ +int get_roche_mode(int * roche_mode) { *roche_mode = collision.roche_mode; // doesn't appear in Tidy - return 0;} -int set_roche_mode(int roche_mode){ + return 0; +} +int set_roche_mode(int roche_mode) { + tidymess.set_roche_mode(roche_mode); collision.set_roche_mode(roche_mode); // doesn't appear in Tidy collision.setup(); - return 0;} + return 0; +} -int get_breakup_mode(int * breakup_mode){ +int get_breakup_mode(int * breakup_mode) { *breakup_mode = breakup.mode; /// niet in Tidy - return 0;} -int set_breakup_mode(int breakup_mode){ + return 0; +} +int set_breakup_mode(int breakup_mode) { breakup.set_breakup_mode(breakup_mode); breakup.setup(); - return 0;} + return 0; +} int get_num_integration_step(int * num_integration_step) { *num_integration_step = tidymess.get_num_integration_step(); - return 0;} + return 0; +} // For CommonCodeInterface // https://github.com/amusecode/amuse/blob/main/src/amuse/community/interface/common.py int initialize_code(){ - // """ + // // Run the initialization for the code, called before // any other call on the code (so before any parameters // are set or particles are defined in the code). From 755bdd34a793e9665119d5755763d6c9148c8be2 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 13 Jan 2026 11:57:55 +0100 Subject: [PATCH 042/174] fixed docstrings in tidymess interface.cc --- src/amuse_tidymess/interface.cc | 75 ++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 61c6512dfa..f2ced1bb79 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -28,13 +28,13 @@ int highest_index = 0; static double begin_time = 0; +/** + * Given a particle ID, find the index of that particle + * within Tidymess Bodies. + * + * @param index_of_the_particle Particle identifier + */ int get_body_index_by_id(int index_of_the_particle) { - /* - * Given a particle ID, find the index of that particle - * within Tidymess Bodies. - * - * @param index_of_the_particle Particle identifier - */ vector bodies = tidymess.get_particles(); for (int i = 0; i < bodies.size(); i++) { @@ -45,12 +45,12 @@ int get_body_index_by_id(int index_of_the_particle) { return -1; // FIX } +/** + * Set initial shapes and angular momenta. + * + * copied from tidymess.cpp + */ int set_shapes_and_momenta() { - /** - * Set initial shapes and angular momenta. - * - * copied from tidymess.cpp - */ if (tidymess.get_tidal_model() > 0) { switch(init.initial_shape) { @@ -216,42 +216,57 @@ int initialize_code(){ //set_support_for_condition(COLLISION_DETECTION); return 0;} -int cleanup_code(){ +int cleanup_code() { // """ // Run the cleanup for the code, called // just before stopping the code. No functions // should be called after this code. // """ - return 0;} + return 0; +} -int commit_parameters(){ +int commit_parameters() { // """ // Perform initialization in the code dependent on the // values of the parameters. // Called after the parameters have been set or updated. // """ - return 0;} -int recommit_parameters(){ + return 0; +} + +int recommit_parameters() { // """ // Perform initialization actions after parameters // have been updated (after commit_parameters and // particles have been loaded). // """ - return 0;} - - -// For GravitationalDynamicsInterface -// https://github.com/amusecode/amuse/blob/main/src/amuse/community/interface/gd.py - -int new_particle(int * index_of_the_particle, double mass, double x, - double y, double z, double vx, double vy, double vz, double radius, - double xi, double kf, double tau, double wx, double wy, double wz, double a_mb, int id){ - // """ - // Define a new particle in the stellar dynamics code. The particle is - // initialized with the provided mass, radius, position and velocity. This - // function returns an index that can be used to refer to this particle. - // """ + return 0; +} +/** + * Define a new particle in the stellar dynamics code. The particle is + * initialized with the provided mass, radius, position and velocity. + * This function returns an index that can be used to refer to this particle. + */ +int new_particle( + int * index_of_the_particle, + double mass, + double x, + double y, + double z, + double vx, + double vy, + double vz, + double radius, + double xi, + double kf, + double tau, + double wx, + double wy, + double wz, + double a_mb, + int id +) { vector bodies = tidymess.get_particles(); Body newbody = {mass, radius, xi, kf, tau, a_mb, wx, wy, wz, x, y, z, vx, vy, vz}; From 74423d40d31ba5de33ca7a8e6f020229563bd556 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 12:08:39 +0100 Subject: [PATCH 043/174] fixed get_body_index_by_id to not copy bodies --- src/amuse_tidymess/interface.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index f2ced1bb79..9c59a37d17 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -22,27 +22,26 @@ static Tidy tidymess; static Initializer init; static Collision collision; static Breakup breakup; -static vector bodies = tidymess.get_particles(); -int highest_index = 0; +int particle_id_counter = 0; static double begin_time = 0; /** - * Given a particle ID, find the index of that particle + * Given an AMUSE particle ID, find the index of that particle * within Tidymess Bodies. * * @param index_of_the_particle Particle identifier */ int get_body_index_by_id(int index_of_the_particle) { - vector bodies = tidymess.get_particles(); + std::vector& bodies = tidymess.bodies; - for (int i = 0; i < bodies.size(); i++) { + for (size_t i = 0; i < bodies.size(); i++) { if (bodies[i].id == index_of_the_particle) { return i; } } - return -1; // FIX + return -1; } /** From 232fd1d31d1e10f65b6809e05688678b3e507ccf Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 12:10:02 +0100 Subject: [PATCH 044/174] fixed get/set_n_iter crashing tidymess --- src/amuse_tidymess/interface.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 9c59a37d17..99f749e6cc 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -50,7 +50,6 @@ int get_body_index_by_id(int index_of_the_particle) { * copied from tidymess.cpp */ int set_shapes_and_momenta() { - if (tidymess.get_tidal_model() > 0) { switch(init.initial_shape) { case 0: @@ -146,20 +145,20 @@ int set_eta(double eta) { return 0; } -int get_n_iter(int * n_iter) { - *n_iter = tidymess.get_n_iter(); +int get_n_iter(int *n_iter) { + *n_iter = tidymess.n_iter; return 0; } int set_n_iter(int n_iter) { - tidymess.set_n_iter(n_iter); + tidymess.n_iter = n_iter; return 0; } // FIX int get_collision_mode(int * collision_mode) { - // if (tidymess.get_collision_mode() != collision.get_collision_mode()) { - - // } + if (tidymess.get_collision_mode() != collision.collision_mode) { + return -1; + } *collision_mode = tidymess.get_collision_mode(); // maybe check if Tidy and Collision have the same value set From 00ad1a57911b0053dba012da2e3155cee6dd289a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 12:12:16 +0100 Subject: [PATCH 045/174] fixed new_particle, delete_particle, and set_state in tidymess interface.cc --- src/amuse_tidymess/interface.cc | 67 +++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 99f749e6cc..ccbc627adb 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -262,34 +262,63 @@ int new_particle( double wx, double wy, double wz, - double a_mb, - int id + double a_mb ) { - vector bodies = tidymess.get_particles(); + std::vector& bodies = tidymess.bodies; + + Body newbody( + mass, radius, xi, kf, tau, a_mb, + wx, wy, wz, x, y, z, vx, vy, vz + ); - Body newbody = {mass, radius, xi, kf, tau, a_mb, wx, wy, wz, x, y, z, vx, vy, vz}; - *index_of_the_particle = highest_index; - newbody.set_id(highest_index); - highest_index++; + newbody.set_id(particle_id_counter); + + *index_of_the_particle = particle_id_counter; + particle_id_counter++; bodies.push_back(newbody); - tidymess.set_particles(bodies); - tidymess.commit_parameters(); + return 0; +} - return 0;} +int delete_particle(int index_of_the_particle) { + std::vector& bodies = tidymess.bodies; + int i = get_body_index_by_id(index_of_the_particle); -int delete_particle(int index_of_the_particle){ - vector bodies = tidymess.get_particles(); - int ind = get_ind_from_index(index_of_the_particle); - bodies.erase(bodies.begin()+ind); - tidymess.set_particles(bodies); - return 0;} + if (i < 0) return -1; + + bodies.erase(bodies.begin() + i); + + return 0; +} + +int get_state( + int index_of_the_particle, + double * mass, + double * x, + double * y, + double * z, + double * vx, + double * vy, + double * vz, + double * radius +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + const Body& body = tidymess.bodies[i]; -// setters & getters -// -// SHOULD SET STATE TRACK THE OTHER PARAMS? + *mass = body.m; + *x = body.r[0]; + *y = body.r[1]; + *z = body.r[2]; + *vx = body.v[0]; + *vy = body.v[1]; + *vz = body.v[2]; + *radius = body.R; + return 0; +} int set_state( int index_of_the_particle, double mass, From 701822675d16b7eb1124e169b3527016e65f0301 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 13:31:10 +0100 Subject: [PATCH 046/174] fixed tidymess getters and setters copying entire list of bodies --- src/amuse_tidymess/interface.cc | 198 +++++++++++++++++++------------- 1 file changed, 115 insertions(+), 83 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index ccbc627adb..2aa2df8ca2 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -79,15 +79,12 @@ int determine_dt_sgn(double t_end) { // copied from tidymess.cpp return 0; } -// tidymess-specific setters & getters - int get_tidal_model(int * tidal_model) { *tidal_model = tidymess.get_tidal_model(); return 0; } int set_tidal_model(int tidal_model) { tidymess.set_tidal_model(tidal_model); - set_shapes_and_momenta(); return 0; } @@ -329,106 +326,141 @@ int set_state( double vy, double vz, double radius -) -{ - vector bodies = tidymess.get_particles(); - int ind = get_ind_from_index(index_of_the_particle); - bodies[ind].m = mass; - bodies[ind].R = radius; - bodies[ind].r = {x, y, z}; - bodies[ind].v = {vx, vy, vz}; - tidymess.set_particles(bodies); +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + Body& body = tidymess.bodies[i]; + + body.m = mass; + body.R = radius; + body.r = {x, y, z}; + body.v = {vx, vy, vz}; return 0; } -int get_state( +int get_mass(int index_of_the_particle, double * mass) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *mass = tidymess.bodies[i].m; + return 0; +} +int set_mass(int index_of_the_particle, double mass) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].m = mass; + return 0; +} + +int get_radius(int index_of_the_particle, double * radius ) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *radius = tidymess.bodies[i].R; + return 0; +} +int set_radius(int index_of_the_particle, double radius) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].R = radius; + return 0; +} + +int get_position( int index_of_the_particle, - double * mass, double * x, double * y, - double * z, - double * vx, - double * vy, - double * vz, - double * radius -) -{ - vector bodies = tidymess.get_particles(); - Body body = bodies[get_ind_from_index(index_of_the_particle)]; - *mass = body.m; + double * z +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + const Body& body = tidymess.bodies[i]; + *x = body.r[0]; *y = body.r[1]; *z = body.r[2]; + return 0; +} +int set_position( + int index_of_the_particle, + double x, + double y, + double z +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + Body& body = tidymess.bodies[i]; + + body.r = {x, y, z}; + return 0; +} + +int get_velocity( + int index_of_the_particle, + double * vx, + double * vy, + double * vz +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + const Body& body = tidymess.bodies[i]; + *vx = body.v[0]; *vy = body.v[1]; *vz = body.v[2]; - *radius = body.R; return 0; } +int set_velocity( + int index_of_the_particle, + double vx, + double vy, + double vz +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; -int get_mass(int index_of_the_particle, double * mass){ - vector bodies = tidymess.get_particles(); - *mass = bodies[get_ind_from_index(index_of_the_particle)].m; - return 0;} -int set_mass(int index_of_the_particle, double mass){ - vector bodies = tidymess.get_particles(); - bodies[get_ind_from_index(index_of_the_particle)].m = mass; - tidymess.set_particles(bodies); - return 0;} + Body& body = tidymess.bodies[i]; -int get_radius(int index_of_the_particle, double * radius){ - vector bodies = tidymess.get_particles(); - *radius = bodies[get_ind_from_index(index_of_the_particle)].R; - return 0;} -int set_radius(int index_of_the_particle, double radius){ - vector bodies = tidymess.get_particles(); - bodies[get_ind_from_index(index_of_the_particle)].R = radius; - tidymess.set_particles(bodies); + body.v = {vx, vy, vz}; return 0;} -int get_position(int index_of_the_particle, double * x, double * y, - double * z){ - vector bodies = tidymess.get_particles(); - array position = bodies[get_ind_from_index(index_of_the_particle)].r; - *x = position[0]; - *y = position[1]; - *z = position[2]; - return 0;} -int set_position(int index_of_the_particle, double x, double y, double z){ - vector bodies = tidymess.get_particles(); - bodies[get_ind_from_index(index_of_the_particle)].r = {x, y, z}; - tidymess.set_particles(bodies); - return 0;} +int get_spin( + int index_of_the_particle, + double * wx, + double * wy, + double * wz +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; -int get_velocity(int index_of_the_particle, double * vx, double * vy, - double * vz){ - vector bodies = tidymess.get_particles(); - array velocity = bodies[get_ind_from_index(index_of_the_particle)].v; - *vx = velocity[0]; - *vy = velocity[1]; - *vz = velocity[2]; - return 0;} -int set_velocity(int index_of_the_particle, double vx, double vy, - double vz){ - vector bodies = tidymess.get_particles(); - bodies[get_ind_from_index(index_of_the_particle)].v = {vx, vy, vz}; - tidymess.set_particles(bodies); - return 0;} + const Body& body = tidymess.bodies[i]; -int get_spin(int index_of_the_particle, double * wx, double * wy, - double * wz){ - vector bodies = tidymess.get_particles(); - array spin = bodies[get_ind_from_index(index_of_the_particle)].w; - *wx = spin[0]; - *wy = spin[1]; - *wz = spin[2]; - return 0;} -int set_spin(int index_of_the_particle, double wx, double wy, - double wz){ - vector bodies = tidymess.get_particles(); - bodies[get_ind_from_index(index_of_the_particle)].w = {wx, wy, wz}; - tidymess.set_particles(bodies); - return 0;} + *wx = body.w[0]; + *wy = body.w[1]; + *wz = body.w[2]; + return 0; +} +int set_spin( + int index_of_the_particle, + double wx, + double wy, + double wz +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + Body& body = tidymess.bodies[i]; + + body.w = {wx, wy, wz}; + + return 0; +} int get_acceleration(int index_of_the_particle, double * ax, double * ay, double * az){ From 9c99f21e6bdbd8601b250ea9f37010af9a8f25ce Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 13:34:00 +0100 Subject: [PATCH 047/174] removed unused parameter in TidymessInterface interface.py new_particle --- src/amuse_tidymess/interface.py | 81 +++++++++++++++++---------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 4f81729420..55fe19c290 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -32,13 +32,13 @@ def __init__(self, **options): @legacy_function def new_particle(): - ''' + """ Define a new particle in the stellar dynamics code. The particle is initialized with the provided mass, radius, position, velocity, moment of inertia factor, fluid love number, fluid relaxation time, spin, and magnetic breaking coefficient. This function returns an index that can be used to refer to this particle. - ''' + """ function = LegacyFunctionSpecification() function.can_handle_array = True function.addParameter( @@ -148,23 +148,13 @@ def new_particle(): description='Magnetic braking coefficient', default=0 ) - function.addParameter( - 'id', - dtype='int32', - direction=function.IN, - description=( - 'Identifier of the particle, ' - 'option for restoring state after loading' - ), - default=-1, - ) function.result_type = 'int32' - function.result_doc = '''\ + function.result_doc = """\ 0 - OK particle was created and added to the model -1 - ERROR particle could not be created - ''' + """ return function @@ -523,7 +513,6 @@ def get_eta(): return function - @legacy_function def set_n_iter(): ''' @@ -558,6 +547,7 @@ def get_n_iter(): return function + @legacy_function def set_collision_mode(): ''' @@ -801,15 +791,17 @@ def __init__(self, convert_nbody=None, **options): **options ) + def define_state(self, handler): GravitationalDynamics.define_state(self, handler) + GravityFieldCode.define_state(self, handler) + handler.add_method('RUN', 'get_spin') handler.add_transition('RUN', 'UPDATE', 'set_spin', False) handler.add_method('UPDATE', 'set_spin') self.stopping_conditions.define_state(handler) - def define_methods(self, handler): GravitationalDynamics.define_methods(self, handler) @@ -825,28 +817,21 @@ def define_methods(self, handler): generic_unit_system.speed, generic_unit_system.speed, generic_unit_system.speed, - generic_unit_system.length, # radius - handler.NO_UNIT, # xi, moment of inertia factor - handler.NO_UNIT, # kf, fluid Love number for potential - generic_unit_system.time, # tau, fluid relaxation time + generic_unit_system.length, # radius + handler.NO_UNIT, # xi, moment of inertia factor + handler.NO_UNIT, # kf, fluid Love number for potential + generic_unit_system.time, # tau, fluid relaxation time 1 / generic_unit_system.time, # wx 1 / generic_unit_system.time, # wy 1 / generic_unit_system.time, # wz - handler.NO_UNIT, # a_mb, magnetic braking coefficient - handler.INDEX + handler.NO_UNIT, # a_mb, magnetic braking coefficient ), - ( - handler.INDEX, - handler.ERROR_CODE - ) + (handler.INDEX, handler.ERROR_CODE) ) handler.add_method( 'get_num_integration_step', (), - ( - handler.INDEX, - handler.ERROR_CODE - ) + (handler.INDEX, handler.ERROR_CODE) ) handler.add_method( 'detect_collision', @@ -897,9 +882,7 @@ def define_methods(self, handler): ) handler.add_method( 'get_spin', - ( - handler.NO_UNIT, - ), + (handler.NO_UNIT), ( 1/nbody_system.time, 1/nbody_system.time, @@ -907,18 +890,36 @@ def define_methods(self, handler): handler.ERROR_CODE ) ) + handler.add_method( + 'set_n_iter', + ( + handler.NO_UNIT, + ), + ( + handler.ERROR_CODE, + ) + ) + handler.add_method( + 'get_n_iter', + (), + ( + handler.NO_UNIT, + handler.ERROR_CODE, + ) + ) self.stopping_conditions.define_methods(handler) def define_parameters(self, handler): - # Set/get parameters specific to the module, not part of the - # standard interface. Accessors used here must be defined - # above and reflected in interface.cc. Python access is - # (e.g.) - # - # TidyMess.parameters.timestep_parameter = xxx - # + """ + Set/get parameters specific to the module, not part of the + standard interface. Accessors used here must be defined + above and reflected in interface.cc. Python access is + (e.g.) + + Tidymess.parameters.timestep_parameter = xxx + """ handler.add_method_parameter( 'get_tidal_model', 'set_tidal_model', From 8f862dffc32d35c67d7eb1bf3447817c23ae3483 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 15:54:24 +0100 Subject: [PATCH 048/174] cleaned up tidymess interface.cc setters and getters --- src/amuse_tidymess/interface.cc | 181 +++++++++++++++++++++++++++++++- 1 file changed, 178 insertions(+), 3 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 2aa2df8ca2..2423915f00 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -1,4 +1,5 @@ #include "tidymess_worker.h" +#include #include // AMUSE STOPPING CONDITIONS SUPPORT @@ -34,11 +35,11 @@ static double begin_time = 0; * @param index_of_the_particle Particle identifier */ int get_body_index_by_id(int index_of_the_particle) { - std::vector& bodies = tidymess.bodies; + const std::vector& bodies = tidymess.bodies; for (size_t i = 0; i < bodies.size(); i++) { if (bodies[i].id == index_of_the_particle) { - return i; + return static_cast(i); } } return -1; @@ -79,7 +80,181 @@ int determine_dt_sgn(double t_end) { // copied from tidymess.cpp return 0; } -int get_tidal_model(int * tidal_model) { +int get_state( + int index_of_the_particle, + double* mass, + double* x, + double* y, + double* z, + double* vx, + double* vy, + double* vz, + double* radius +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + const Body& body = tidymess.bodies[i]; + + *mass = body.m; + *x = body.r[0]; + *y = body.r[1]; + *z = body.r[2]; + *vx = body.v[0]; + *vy = body.v[1]; + *vz = body.v[2]; + *radius = body.R; + + return 0; +} +int set_state( + int index_of_the_particle, + double mass, + double x, + double y, + double z, + double vx, + double vy, + double vz, + double radius +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + Body& body = tidymess.bodies[i]; + + body.m = mass; + body.R = radius; + body.r = {x, y, z}; + body.v = {vx, vy, vz}; + return 0; +} + +int get_mass(int index_of_the_particle, double* mass) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *mass = tidymess.bodies[i].m; + return 0; +} +int set_mass(int index_of_the_particle, double mass) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].m = mass; + return 0; +} + +int get_radius(int index_of_the_particle, double* radius ) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *radius = tidymess.bodies[i].R; + return 0; +} +int set_radius(int index_of_the_particle, double radius) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].R = radius; + return 0; +} + +int get_position( + int index_of_the_particle, + double* x, + double* y, + double* z +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + const Body& body = tidymess.bodies[i]; + + *x = body.r[0]; + *y = body.r[1]; + *z = body.r[2]; + return 0; +} +int set_position( + int index_of_the_particle, + double x, + double y, + double z +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + Body& body = tidymess.bodies[i]; + + body.r = {x, y, z}; + return 0; +} + +int get_velocity( + int index_of_the_particle, + double* vx, + double* vy, + double* vz +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + const Body& body = tidymess.bodies[i]; + + *vx = body.v[0]; + *vy = body.v[1]; + *vz = body.v[2]; + return 0; +} +int set_velocity( + int index_of_the_particle, + double vx, + double vy, + double vz +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + Body& body = tidymess.bodies[i]; + + body.v = {vx, vy, vz}; + return 0; +} + +int get_spin( + int index_of_the_particle, + double* wx, + double* wy, + double* wz +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + const Body& body = tidymess.bodies[i]; + + *wx = body.w[0]; + *wy = body.w[1]; + *wz = body.w[2]; + return 0; +} +int set_spin( + int index_of_the_particle, + double wx, + double wy, + double wz +) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + Body& body = tidymess.bodies[i]; + + body.w = {wx, wy, wz}; + + return 0; +} + +int get_tidal_model(int* tidal_model) { *tidal_model = tidymess.get_tidal_model(); return 0; } From d76e39cb9b9356db3f13416ddb0ac5af36006144 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 15:56:31 +0100 Subject: [PATCH 049/174] tidymess interface.cc fn signature cleanup --- src/amuse_tidymess/interface.cc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 2423915f00..1fd2b69e58 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -263,7 +263,7 @@ int set_tidal_model(int tidal_model) { return 0; } -int get_pn_order(int * pn_order) { +int get_pn_order(int* pn_order) { *pn_order = tidymess.get_pn_order(); return 0; } @@ -272,7 +272,7 @@ int set_pn_order(int pn_order) { return 0; } -int get_magnetic_braking(int * magnetic_braking) { +int get_magnetic_braking(int* magnetic_braking) { *magnetic_braking = tidymess.get_magnetic_braking(); return 0; } @@ -281,7 +281,7 @@ int set_magnetic_braking(int magnetic_braking) { return 0; } -int get_speed_of_light(double * speed_of_light) { +int get_speed_of_light(double* speed_of_light) { *speed_of_light = tidymess.get_speed_of_light(); return 0; } @@ -290,7 +290,7 @@ int set_speed_of_light(double speed_of_light) { return 0; } -int get_dt_mode(int * dt_mode) { +int get_dt_mode(int* dt_mode) { *dt_mode = tidymess.get_dt_mode(); return 0; } @@ -299,7 +299,7 @@ int set_dt_mode(int dt_mode) { return 0; } -int get_dt_const(double * dt_const) { +int get_dt_const(double* dt_const) { *dt_const = tidymess.get_dt_const(); return 0; } @@ -308,7 +308,7 @@ int set_dt_const(double dt_const) { return 0; } -int get_eta(double * eta) { +int get_eta(double* eta) { *eta = tidymess.get_eta(); return 0; } @@ -317,7 +317,7 @@ int set_eta(double eta) { return 0; } -int get_n_iter(int *n_iter) { +int get_n_iter(int* n_iter) { *n_iter = tidymess.n_iter; return 0; } @@ -327,7 +327,7 @@ int set_n_iter(int n_iter) { } // FIX -int get_collision_mode(int * collision_mode) { +int get_collision_mode(int* collision_mode) { if (tidymess.get_collision_mode() != collision.collision_mode) { return -1; } @@ -343,7 +343,7 @@ int set_collision_mode(int collision_mode) { return 0; } -int get_roche_mode(int * roche_mode) { +int get_roche_mode(int* roche_mode) { *roche_mode = collision.roche_mode; // doesn't appear in Tidy return 0; } @@ -354,7 +354,7 @@ int set_roche_mode(int roche_mode) { return 0; } -int get_breakup_mode(int * breakup_mode) { +int get_breakup_mode(int* breakup_mode) { *breakup_mode = breakup.mode; /// niet in Tidy return 0; } @@ -364,7 +364,7 @@ int set_breakup_mode(int breakup_mode) { return 0; } -int get_num_integration_step(int * num_integration_step) { +int get_num_integration_step(int* num_integration_step) { *num_integration_step = tidymess.get_num_integration_step(); return 0; } @@ -413,13 +413,20 @@ int recommit_parameters() { return 0; } +int commit_particles() { + return 0; +} +int recommit_particles() { + return 0; +} + /** * Define a new particle in the stellar dynamics code. The particle is * initialized with the provided mass, radius, position and velocity. * This function returns an index that can be used to refer to this particle. */ int new_particle( - int * index_of_the_particle, + int* index_of_the_particle, double mass, double x, double y, From d6996ac379af8aba668b0ed77a664e434e2011e9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 15:58:33 +0100 Subject: [PATCH 050/174] refactored tidymess interface.cc fns copying full list of bodies --- src/amuse_tidymess/interface.cc | 339 ++++++++++++-------------------- 1 file changed, 128 insertions(+), 211 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 1fd2b69e58..c6d70593cc 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -471,289 +471,206 @@ int delete_particle(int index_of_the_particle) { return 0; } -int get_state( +int get_acceleration( int index_of_the_particle, - double * mass, - double * x, - double * y, - double * z, - double * vx, - double * vy, - double * vz, - double * radius + double* ax, + double* ay, + double* az ) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - const Body& body = tidymess.bodies[i]; - - *mass = body.m; - *x = body.r[0]; - *y = body.r[1]; - *z = body.r[2]; - *vx = body.v[0]; - *vy = body.v[1]; - *vz = body.v[2]; - *radius = body.R; - return 0; } -int set_state( +int set_acceleration( int index_of_the_particle, - double mass, - double x, - double y, - double z, - double vx, - double vy, - double vz, - double radius + double ax, + double ay, + double az ) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - Body& body = tidymess.bodies[i]; - - body.m = mass; - body.R = radius; - body.r = {x, y, z}; - body.v = {vx, vy, vz}; return 0; } -int get_mass(int index_of_the_particle, double * mass) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - *mass = tidymess.bodies[i].m; +int get_eps2(double* epsilon_squared) { return 0; } -int set_mass(int index_of_the_particle, double mass) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - tidymess.bodies[i].m = mass; +int set_eps2(double epsilon_squared) { return 0; } -int get_radius(int index_of_the_particle, double * radius ) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - *radius = tidymess.bodies[i].R; +int get_potential(int index_of_the_particle, double* potential) { return 0; } -int set_radius(int index_of_the_particle, double radius) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - tidymess.bodies[i].R = radius; +int get_kinetic_energy(double* kinetic_energy) { return 0; } -int get_position( - int index_of_the_particle, - double * x, - double * y, - double * z -) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - const Body& body = tidymess.bodies[i]; - - *x = body.r[0]; - *y = body.r[1]; - *z = body.r[2]; +int get_potential_energy(double* potential_energy) { + *potential_energy = tidymess.get_potential_energy(); return 0; } -int set_position( - int index_of_the_particle, - double x, - double y, - double z -) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - Body& body = tidymess.bodies[i]; - body.r = {x, y, z}; +int get_time(double* time) { + *time = tidymess.get_model_time(); return 0; } -int get_velocity( - int index_of_the_particle, - double * vx, - double * vy, - double * vz -) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - const Body& body = tidymess.bodies[i]; - - *vx = body.v[0]; - *vy = body.v[1]; - *vz = body.v[2]; +int get_begin_time(double* time) { + *time = begin_time; return 0; } -int set_velocity( - int index_of_the_particle, - double vx, - double vy, - double vz -) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - Body& body = tidymess.bodies[i]; - - body.v = {vx, vy, vz}; - return 0;} - -int get_spin( - int index_of_the_particle, - double * wx, - double * wy, - double * wz -) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - const Body& body = tidymess.bodies[i]; - - *wx = body.w[0]; - *wy = body.w[1]; - *wz = body.w[2]; +int set_begin_time(double time) { + begin_time = time; return 0; } -int set_spin( - int index_of_the_particle, - double wx, - double wy, - double wz -) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - Body& body = tidymess.bodies[i]; - - body.w = {wx, wy, wz}; +int get_time_step(double* time_step) { + if (!time_step) return -1; + *time_step = tidymess.get_dt_const(); + if (tidymess.get_dt_mode() > 0) { + *time_step = tidymess.get_dt_prev(); + } return 0; } -int get_acceleration(int index_of_the_particle, double * ax, double * ay, - double * az){ - return 0;} -int set_acceleration(int index_of_the_particle, double ax, double ay, - double az){ - return 0;} - -int get_eps2(double * epsilon_squared){ - return 0;} -int set_eps2(double epsilon_squared){ - return 0;} - -int get_potential(int index_of_the_particle, double * potential){ - return 0;} +int get_total_mass(double* mass) { + if (!mass) return -1; -int get_kinetic_energy(double * kinetic_energy){ - return 0;} -int get_potential_energy(double * potential_energy){ - return 0;} + const std::vector& bodies = tidymess.bodies; -int get_time(double * time){ - *time = tidymess.get_model_time(); - return 0;} + double total = 0.0; + for (size_t i = 0; i < bodies.size(); i++) { + total += bodies[i].m; + } + *mass = total; + return 0; +} -int get_begin_time(double * time){ - *time = begin_time; - return 0;} -int set_begin_time(double time){ - begin_time = time; - return 0;} +int get_total_radius(double* radius) { + if (!radius) return -1; -int get_time_step(double * time_step){ - *time_step = tidymess.get_dt_const(); - if (tidymess.get_dt_mode() > 0) { - *time_step = tidymess.get_dt_prev(); - } - return 0;} + const std::vector& bodies = tidymess.bodies; -int get_total_mass(double * mass){ - vector bodies = tidymess.get_particles(); - *mass = 0.0; - for (int i = 0; i< bodies.size(); i++) { - *mass += bodies[i].m; + double total = 0.0; + for (size_t i = 0; i < bodies.size(); i++) { + total += bodies[i].R; } - return 0;} + *radius = total; + return 0; +} -int get_total_radius(double * radius){ - vector bodies = tidymess.get_particles(); - *radius = 0.0; - for (int i = 0; i< bodies.size(); i++) { - *radius += bodies[i].R; +int get_center_of_mass_position( + double* x, + double* y, + double* z +) { + if (!x || !y || !z) { + return -1; } - return 0;} + const array position = tidymess.get_center_of_mass(); -int get_center_of_mass_position(double * x, double * y, double * z){ - array position = tidymess.get_center_of_mass(); *x = position[0]; *y = position[1]; *z = position[2]; - return 0;} -int get_center_of_mass_velocity(double * vx, double * vy, double * vz){ - array velocity = tidymess.get_center_of_mass_velocity(); + return 0; +} + +int get_center_of_mass_velocity( + double* vx, + double* vy, + double* vz +) { + if (!vx || !vy || !vz) { + return -1; + } + + const array velocity = tidymess.get_center_of_mass_velocity(); + *vx = velocity[0]; *vy = velocity[1]; *vz = velocity[2]; - return 0;} + return 0; +} -int get_number_of_particles(int * number_of_particles){ - vector bodies = tidymess.get_particles(); - *number_of_particles = bodies.size(); - return 0;} +int get_number_of_particles(int* number_of_particles) { + if (!number_of_particles) return -1; + + const std::vector& bodies = tidymess.bodies; + + *number_of_particles = static_cast(bodies.size()); + return 0; +} + +int get_index_of_first_particle(int* index_of_the_particle) { + if (!index_of_the_particle) return -1; + + const std::vector& bodies = tidymess.bodies; + if (bodies.empty()) return -1; + + *index_of_the_particle = bodies[0].id; + return 0; +} -int get_index_of_first_particle(int * index_of_the_particle){ - Body body = tidymess.get_particles()[0]; - *index_of_the_particle = body.id; - return 0;} int get_index_of_next_particle(int index_of_the_particle, int * index_of_the_next_particle){ vector bodies = tidymess.get_particles(); - Body body = bodies[get_ind_from_index(index_of_the_particle)+1]; + Body body = bodies[get_body_index_by_id(index_of_the_particle)+1]; *index_of_the_next_particle = body.id; return 0;} -// evolving -int evolve_model(double time){ +int evolve_model(double time) { // Evolve the model until the given time, or until a stopping condition is set. tidymess.commit_parameters(); // has to be called sometime before evolving determine_dt_sgn(time); tidymess.evolve_model(time); - return 0;} + return 0; +} + -int commit_particles(){ - return 0;} -int recommit_particles(){ - return 0;} int synchronize_model(){ return 0;} -int get_potential_at_point(double eps, double x, double y, double z, - double * phi, int npoints){ - return 0;} +int get_potential_at_point( + double * eps, + double * x, + double * y, + double * z, + double * phi, + int npoints +) { + /*** + * FIX + */ + for (int i = 0; i < npoints; i++) { + phi[i] = 0.0; + } + return 0; +} -int get_gravity_at_point(double eps, double x, double y, double z, - double * ax, double * ay, double * az, int npoints){ - return 0;} +int get_gravity_at_point( + double * eps, + double * x, + double * y, + double * z, + double * ax, + double * ay, + double * az, + int npoints +) { + /*** + * FIX + */ + for (int i = 0; i < npoints; i++) { + ax[i] = 0.0; + ay[i] = 0.0; + az[i] = 0.0; + } + return 0; +} // compute spin vector (largely copied from Initializer) From 149ac4a0bd08ce9ff25f216abd17797e62328840 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 16:13:13 +0100 Subject: [PATCH 051/174] added null pointer checks to all tidymess getters that take a pointer in fn signature --- src/amuse_tidymess/interface.cc | 52 ++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index c6d70593cc..c128f2819b 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -91,6 +91,9 @@ int get_state( double* vz, double* radius ) { + if (!mass || !x || !y || !z || + !vx || !vy || !vz || !radius) return -1; + int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -131,6 +134,8 @@ int set_state( } int get_mass(int index_of_the_particle, double* mass) { + if (!mass) return -1; + int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -146,6 +151,8 @@ int set_mass(int index_of_the_particle, double mass) { } int get_radius(int index_of_the_particle, double* radius ) { + if (!radius) return -1; + int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -166,6 +173,8 @@ int get_position( double* y, double* z ) { + if (!x || !y || !z) return -1; + int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -197,6 +206,8 @@ int get_velocity( double* vy, double* vz ) { + if (!vx || !vy || !vz) return -1; + int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -228,6 +239,8 @@ int get_spin( double* wy, double* wz ) { + if (!wx || !wy || !wz) return -1; + int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -255,6 +268,8 @@ int set_spin( } int get_tidal_model(int* tidal_model) { + if (!tidal_model) return -1; + *tidal_model = tidymess.get_tidal_model(); return 0; } @@ -264,6 +279,8 @@ int set_tidal_model(int tidal_model) { } int get_pn_order(int* pn_order) { + if (!pn_order) return -1; + *pn_order = tidymess.get_pn_order(); return 0; } @@ -273,6 +290,8 @@ int set_pn_order(int pn_order) { } int get_magnetic_braking(int* magnetic_braking) { + if (!magnetic_braking) return -1; + *magnetic_braking = tidymess.get_magnetic_braking(); return 0; } @@ -282,6 +301,8 @@ int set_magnetic_braking(int magnetic_braking) { } int get_speed_of_light(double* speed_of_light) { + if (!speed_of_light) return -1; + *speed_of_light = tidymess.get_speed_of_light(); return 0; } @@ -291,6 +312,8 @@ int set_speed_of_light(double speed_of_light) { } int get_dt_mode(int* dt_mode) { + if (!dt_mode) return -1; + *dt_mode = tidymess.get_dt_mode(); return 0; } @@ -300,6 +323,8 @@ int set_dt_mode(int dt_mode) { } int get_dt_const(double* dt_const) { + if (!dt_const) return -1; + *dt_const = tidymess.get_dt_const(); return 0; } @@ -309,6 +334,8 @@ int set_dt_const(double dt_const) { } int get_eta(double* eta) { + if (!eta) return -1; + *eta = tidymess.get_eta(); return 0; } @@ -318,6 +345,8 @@ int set_eta(double eta) { } int get_n_iter(int* n_iter) { + if (!n_iter) return -1; + *n_iter = tidymess.n_iter; return 0; } @@ -328,6 +357,8 @@ int set_n_iter(int n_iter) { // FIX int get_collision_mode(int* collision_mode) { + if (!collision_mode) return -1; + if (tidymess.get_collision_mode() != collision.collision_mode) { return -1; } @@ -344,6 +375,8 @@ int set_collision_mode(int collision_mode) { } int get_roche_mode(int* roche_mode) { + if (!roche_mode) return -1; + *roche_mode = collision.roche_mode; // doesn't appear in Tidy return 0; } @@ -355,6 +388,7 @@ int set_roche_mode(int roche_mode) { } int get_breakup_mode(int* breakup_mode) { + if (!breakup_mode) return -1; *breakup_mode = breakup.mode; /// niet in Tidy return 0; } @@ -365,6 +399,8 @@ int set_breakup_mode(int breakup_mode) { } int get_num_integration_step(int* num_integration_step) { + if (!num_integration_step) return -1; + *num_integration_step = tidymess.get_num_integration_step(); return 0; } @@ -443,6 +479,8 @@ int new_particle( double wz, double a_mb ) { + if (!index_of_the_particle) return -1; + std::vector& bodies = tidymess.bodies; Body newbody( @@ -477,6 +515,7 @@ int get_acceleration( double* ay, double* az ) { + if (!ax || !ay || !az) return -1; return 0; } int set_acceleration( @@ -489,6 +528,7 @@ int set_acceleration( } int get_eps2(double* epsilon_squared) { + if (!epsilon_squared) return -1; return 0; } int set_eps2(double epsilon_squared) { @@ -496,24 +536,29 @@ int set_eps2(double epsilon_squared) { } int get_potential(int index_of_the_particle, double* potential) { + if (!potential) return -1; return 0; } int get_kinetic_energy(double* kinetic_energy) { + if (!kinetic_energy) return -1; return 0; } int get_potential_energy(double* potential_energy) { + if (!potential_energy) return -1; *potential_energy = tidymess.get_potential_energy(); return 0; } int get_time(double* time) { + if (!time) return -1; *time = tidymess.get_model_time(); return 0; } int get_begin_time(double* time) { + if (!time) return -1; *time = begin_time; return 0; } @@ -629,10 +674,9 @@ int evolve_model(double time) { return 0; } - - -int synchronize_model(){ - return 0;} +int synchronize_model() { + return 0; +} int get_potential_at_point( double * eps, From acb8129712acf0426b6d484e3d7984d9c86138e0 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 22 Jan 2026 16:29:11 +0100 Subject: [PATCH 052/174] fixed get_index_of_next_particle tidymess interface.cc --- src/amuse_tidymess/interface.cc | 53 +++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index c128f2819b..85f4848b4b 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -655,14 +655,21 @@ int get_index_of_first_particle(int* index_of_the_particle) { return 0; } -int get_index_of_next_particle(int index_of_the_particle, - int * index_of_the_next_particle){ - vector bodies = tidymess.get_particles(); - Body body = bodies[get_body_index_by_id(index_of_the_particle)+1]; - *index_of_the_next_particle = body.id; - return 0;} +int get_index_of_next_particle( + int index_of_the_particle, + int* index_of_the_next_particle +) { + if (!index_of_the_next_particle) return -1; + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + const std::vector& bodies = tidymess.bodies; + if (static_cast(i + 1) >= bodies.size()) return -1; + + *index_of_the_next_particle = bodies[i + 1].id; + return 0; +} int evolve_model(double time) { // Evolve the model until the given time, or until a stopping condition is set. @@ -679,11 +686,11 @@ int synchronize_model() { } int get_potential_at_point( - double * eps, - double * x, - double * y, - double * z, - double * phi, + double* eps, + double* x, + double* y, + double* z, + double* phi, int npoints ) { /*** @@ -696,13 +703,13 @@ int get_potential_at_point( } int get_gravity_at_point( - double * eps, - double * x, - double * y, - double * z, - double * ax, - double * ay, - double * az, + double* eps, + double* x, + double* y, + double* z, + double* ax, + double* ay, + double* az, int npoints ) { /*** @@ -741,10 +748,12 @@ int convert_spin_vectors_to_inertial(double P, double obl, double psi, double * } return 0;} - -// collision detection - -int detect_collision(int * collision_flag, int * n_collisions, int * index1, int * index2) { +int detect_collision( + int* collision_flag, + int* n_collisions, + int* index1, + int* index2 +) { // Collision handling *collision_flag = tidymess.get_collision_flag(); vector< array > collided_indices = tidymess.get_collision_indices(); From 9d37ba0f14b85b0b3a8adb66024a55ec2235051b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 23 Jan 2026 14:06:34 +0100 Subject: [PATCH 053/174] interface.cc tidymess cleanup --- src/amuse_tidymess/interface.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 85f4848b4b..75fe9421a2 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -406,9 +406,6 @@ int get_num_integration_step(int* num_integration_step) { } -// For CommonCodeInterface -// https://github.com/amusecode/amuse/blob/main/src/amuse/community/interface/common.py - int initialize_code(){ // // Run the initialization for the code, called before From a944ce2ede20be90dee03dbcf9cba0e98466b6de Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 23 Jan 2026 14:07:33 +0100 Subject: [PATCH 054/174] tidymess interface.py cleanup --- src/amuse_tidymess/interface.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 55fe19c290..f54fe0fc73 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -913,19 +913,24 @@ def define_methods(self, handler): def define_parameters(self, handler): """ - Set/get parameters specific to the module, not part of the - standard interface. Accessors used here must be defined - above and reflected in interface.cc. Python access is - (e.g.) - - Tidymess.parameters.timestep_parameter = xxx + Define setters and getters as Tidymess.parameters. + This is the standard API for users to access and modify + Tidymess parameters. Users should use parameters rather + than acessing the setters and getters defined in + TidymessInterface directly. Accessors used here must be + defined in TidymessInterface as a legacy_function, as + well as the interface.cc. + User access then follows the syntax: + Tidymess.parameters.param_name = value + Users should not use: + Tidymess.set_param_name(value) """ handler.add_method_parameter( 'get_tidal_model', 'set_tidal_model', 'tidal_model', - '0=none, 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess (default)', - default_value=4, + '0=none (default), 1=conservative, 2=linear, 3=creep direct, 4=creep tidymess', + default_value=0, is_vector=False, must_set_before_get=False, ) @@ -954,7 +959,7 @@ def define_parameters(self, handler): 'get_speed_of_light', 'set_speed_of_light', 'speed_of_light', - '', + 'Speed of light. Should be set depending on unit system being used, or if using post newtonian.', default_value=1e100, is_vector=False, must_set_before_get=False, From 75180ed2ac6615982487ce81c7a861ea65147730 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 27 Jan 2026 16:26:43 +0100 Subject: [PATCH 055/174] def set/get_initial_shape tidymess interface.cc which is needed for tides --- src/amuse_tidymess/interface.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 75fe9421a2..603f357c7e 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -26,6 +26,7 @@ static Breakup breakup; int particle_id_counter = 0; static double begin_time = 0; +int init_shape = 0; /** @@ -267,6 +268,17 @@ int set_spin( return 0; } +int get_initial_shape(int* initial_shape) { + if (!initial_shape) return -1; + + *initial_shape = init_shape; + return 0; +} +int set_initial_shape(int initial_shape) { + init_shape = initial_shape; + return 0; +} + int get_tidal_model(int* tidal_model) { if (!tidal_model) return -1; From 03202a3e6ab5283555983434778d244cacacb423 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 27 Jan 2026 16:28:01 +0100 Subject: [PATCH 056/174] fixed issue resulting in NaNs for all tidal models other than 0 in tidymess by adding logic to commit_particles --- src/amuse_tidymess/interface.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 603f357c7e..9af76d561d 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -459,6 +459,21 @@ int recommit_parameters() { } int commit_particles() { + if (tidymess.get_tidal_model() > 0) { + switch(init_shape) { + case 0: + tidymess.set_to_spherical_shape(); + break; + case 1: + tidymess.set_to_equilibrium_shape(); + break; + default: + return -1; + } + tidymess.update_angular_momentum(); + } + + tidymess.commit_parameters(); return 0; } int recommit_particles() { @@ -503,7 +518,6 @@ int new_particle( particle_id_counter++; bodies.push_back(newbody); - return 0; } From 18366daf56425cf6d061c2258af90cd9fdccdb3f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 27 Jan 2026 16:29:14 +0100 Subject: [PATCH 057/174] defined set/get_initial_shape as legacy functions tidymess interface.py --- src/amuse_tidymess/interface.py | 38 +++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index f54fe0fc73..413a1de727 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -89,7 +89,8 @@ def new_particle(): ) function.addParameter( 'vz', - dtype='float64', direction=function.IN, + dtype='float64', + direction=function.IN, description='The initial velocity vector of the particle', ) function.addParameter( @@ -650,10 +651,43 @@ def get_breakup_mode(): ) ) function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """""" return function + @legacy_function + def set_initial_shape(): + """ + Set Tidymess initial shape. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'initial_shape', + dtype='int32', + direction=function.IN, + description='0=default' + ) + function.result_type = 'int32' + function.result_doc = """""" + + return function + + @legacy_function + def get_initial_shape(): + """ + Get Tidymess initial shape value. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'initial_shape', + dtype='int32', + direction=function.OUT, + description='' + ) + function.result_type = 'int32' + function.result_doc = """""" + + return function @legacy_function def get_num_integration_step(): From a3862a00081b98f461d0ef100c707cefdd644929 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 27 Jan 2026 16:29:52 +0100 Subject: [PATCH 058/174] defined initial_shape tidymess parameter --- src/amuse_tidymess/interface.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 413a1de727..081f099b0e 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1003,8 +1003,8 @@ def define_parameters(self, handler): 'get_dt_mode', 'set_dt_mode', 'dt_mode', - '0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt', - default_value=1, # of 2? + '0=constant dt; 1=adaptive dt; 2=adaptive, weighted dt', + default_value=2, is_vector=False, must_set_before_get=False, ) @@ -1059,6 +1059,16 @@ def define_parameters(self, handler): must_set_before_get=False, ) + handler.add_method_parameter( + 'get_initial_shape', + 'set_initial_shape', + 'initial_shape', + 'Initial shape, default=0', + default_value=0, + is_vector=False, + must_set_before_get=False, + ) + self.stopping_conditions.define_parameters(handler) From 8c79afd029e62646f53da77e6b089e73e67d11b3 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 10:31:15 +0100 Subject: [PATCH 059/174] added get/set_state legacy_function to TidymessInterface --- src/amuse_tidymess/interface.py | 234 ++++++++++++++++++++++++++++++++ 1 file changed, 234 insertions(+) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 081f099b0e..398b80bb3b 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -159,6 +159,240 @@ def new_particle(): return function + @legacy_function + def get_state(): + """ + Retrieve the current state of a particle. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + "Index of the particle to get the state from. This index must " + "have been returned by an earlier call to :meth:`new_particle`" + ), + ) + function.addParameter( + 'mass', + dtype='float64', + direction=function.OUT, + description='The current mass of the particle', + ) + function.addParameter( + 'x', + dtype='float64', + direction=function.OUT, + description='The current position vector of the particle', + ) + function.addParameter( + 'y', + dtype='float64', + direction=function.OUT, + description='The current position vector of the particle', + ) + function.addParameter( + 'z', + dtype='float64', + direction=function.OUT, + description='The current position vector of the particle', + ) + function.addParameter( + 'vx', + dtype='float64', + direction=function.OUT, + description='The current velocity vector of the particle', + ) + function.addParameter( + 'vy', + dtype='float64', + direction=function.OUT, + description='The current velocity vector of the particle', + ) + function.addParameter( + 'vz', + dtype='float64', + direction=function.OUT, + description='The current velocity vector of the particle', + ) + function.addParameter( + 'radius', + dtype='float64', + direction=function.OUT, + description='The current radius of the particle', + ) + function.addParameter( + 'xi', + dtype='float64', + direction=function.OUT, + description='Moment of inertia factor', + ) + function.addParameter( + 'kf', + dtype='float64', + direction=function.OUT, + description='Fluid Love number from potential', + ) + function.addParameter( + 'tau', + dtype='float64', + direction=function.OUT, + description='Fluid relaxation time', + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.OUT, + description='Spin', + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.OUT, + description='Spin', + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.OUT, + description='Spin', + ) + function.addParameter( + 'a_mb', + dtype='float64', + direction=function.OUT, + description='Magnetic braking coefficient', + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + state was retrieved from particle + -1 - ERROR + particle could not be found + """ + return function + + @legacy_function + def set_state(): + """ + Update the current state of a particle. + """ + function = LegacyFunctionSpecification() + function.can_handle_array = True + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + "Index of the particle for which the state is to be updated. " + "This index must have been returned by an earlier call to " + ":meth:`new_particle`" + ), + ) + function.addParameter( + 'mass', + dtype='float64', + direction=function.IN, + description='The new mass of the particle', + ) + function.addParameter( + 'x', + dtype='float64', + direction=function.IN, + description='The new position vector of the particle', + ) + function.addParameter( + 'y', + dtype='float64', + direction=function.IN, + description='The new position vector of the particle', + ) + function.addParameter( + 'z', + dtype='float64', + direction=function.IN, + description='The new position vector of the particle', + ) + function.addParameter( + 'vx', + dtype='float64', + direction=function.IN, + description='The new velocity vector of the particle', + ) + function.addParameter( + 'vy', + dtype='float64', + direction=function.IN, + description='The new velocity vector of the particle', + ) + function.addParameter( + 'vz', + dtype='float64', + direction=function.IN, + description='The new velocity vector of the particle', + ) + function.addParameter( + 'radius', + dtype='float64', + direction=function.IN, + description='The new radius of the particle', + ) + function.addParameter( + 'xi', + dtype='float64', + direction=function.IN, + description='Moment of inertia factor', + ) + function.addParameter( + 'kf', + dtype='float64', + direction=function.IN, + description='Fluid Love number from potential', + ) + function.addParameter( + 'tau', + dtype='float64', + direction=function.IN, + description='Fluid relaxation time', + ) + function.addParameter( + 'wx', + dtype='float64', + direction=function.IN, + description='Spin', + ) + function.addParameter( + 'wy', + dtype='float64', + direction=function.IN, + description='Spin', + ) + function.addParameter( + 'wz', + dtype='float64', + direction=function.IN, + description='Spin', + ) + function.addParameter( + 'a_mb', + dtype='float64', + direction=function.IN, + description='Magnetic braking coefficient', + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was found in the model and the information was set + -1 - ERROR + particle could not be found + -2 - ERROR + code does not support updating of a particle + -3 - ERROR + not yet implemented + """ + return function @legacy_function def get_spin(): From e4408f7a41b82fc1e65922e7c27d83a02b97f53e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 10:34:41 +0100 Subject: [PATCH 060/174] added get/set_state to Tidymess define_methods --- src/amuse_tidymess/interface.py | 48 ++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 398b80bb3b..d6a17f000d 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1096,6 +1096,50 @@ def define_methods(self, handler): ), (handler.INDEX, handler.ERROR_CODE) ) + handler.add_method( + 'get_state', + (handler.INDEX), + ( + generic_unit_system.mass, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.length, # radius + handler.NO_UNIT, # xi, moment of inertia factor + handler.NO_UNIT, # kf, fluid Love number for potential + generic_unit_system.time, # tau, fluid relaxation time + 1 / generic_unit_system.time, # wx + 1 / generic_unit_system.time, # wy + 1 / generic_unit_system.time, # wz + handler.NO_UNIT, # a_mb, magnetic braking coefficient + handler.ERROR_CODE, + ) + ) + handler.add_method( + 'set_state', + ( + handler.INDEX, + generic_unit_system.mass, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.length, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.speed, + generic_unit_system.length, # radius + handler.NO_UNIT, # xi, moment of inertia factor + handler.NO_UNIT, # kf, fluid Love number for potential + generic_unit_system.time, # tau, fluid relaxation time + 1 / generic_unit_system.time, # wx + 1 / generic_unit_system.time, # wy + 1 / generic_unit_system.time, # wz + handler.NO_UNIT, # a_mb, magnetic braking coefficient + ), + (handler.ERROR_CODE,) + ) handler.add_method( 'get_num_integration_step', (), @@ -1144,9 +1188,7 @@ def define_methods(self, handler): 1/nbody_system.time, 1/nbody_system.time, ), - ( - handler.ERROR_CODE - ) + (handler.ERROR_CODE,) ) handler.add_method( 'get_spin', From f3aab1c62eda680c33098eb00d6a67179a8d486c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 10:37:45 +0100 Subject: [PATCH 061/174] cleaned up tidymess interface.cc --- src/amuse_tidymess/interface.cc | 68 ++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 9af76d561d..6492359f68 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -30,8 +30,8 @@ int init_shape = 0; /** - * Given an AMUSE particle ID, find the index of that particle - * within Tidymess Bodies. + * Given an AMUSE particle index, find the corresponding + * index of that particle within Tidymess. * * @param index_of_the_particle Particle identifier */ @@ -47,29 +47,61 @@ int get_body_index_by_id(int index_of_the_particle) { } /** - * Set initial shapes and angular momenta. - * - * copied from tidymess.cpp + * Define a new particle in the stellar dynamics code. The particle is + * initialized with the provided mass, radius, position and velocity. + * This function returns an index that can be used to refer to this particle. */ -int set_shapes_and_momenta() { - if (tidymess.get_tidal_model() > 0) { - switch(init.initial_shape) { - case 0: - tidymess.set_to_spherical_shape(); - break; - case 1: - tidymess.set_to_equilibrium_shape(); - break; - } - tidymess.update_angular_momentum(); - } +int new_particle( + int* index_of_the_particle, + double mass, + double x, + double y, + double z, + double vx, + double vy, + double vz, + double radius, + double xi, + double kf, + double tau, + double wx, + double wy, + double wz, + double a_mb +) { + if (!index_of_the_particle) return -1; + + std::vector& bodies = tidymess.bodies; + + Body newbody( + mass, radius, xi, kf, tau, a_mb, + wx, wy, wz, x, y, z, vx, vy, vz + ); + + newbody.set_id(particle_id_counter); + + *index_of_the_particle = particle_id_counter; + particle_id_counter++; + + bodies.push_back(newbody); + return 0; +} + +int delete_particle(int index_of_the_particle) { + std::vector& bodies = tidymess.bodies; + int i = get_body_index_by_id(index_of_the_particle); + + if (i < 0) return -1; + + bodies.erase(bodies.begin() + i); + return 0; } int determine_dt_sgn(double t_end) { // copied from tidymess.cpp bool dt_pos; int dt_sgn; - if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems + if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems dt_pos = true; dt_sgn = 1; } From fd9a453a91547eee2d6e003dbba1fe5a6a64065b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 10:46:52 +0100 Subject: [PATCH 062/174] tidymess interface.cc set/get state --- src/amuse_tidymess/interface.cc | 54 +++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 6492359f68..75af226691 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -98,21 +98,6 @@ int delete_particle(int index_of_the_particle) { return 0; } -int determine_dt_sgn(double t_end) { // copied from tidymess.cpp - bool dt_pos; - int dt_sgn; - if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems - dt_pos = true; - dt_sgn = 1; - } - else { - dt_pos = false; - dt_sgn = -1; - } - tidymess.set_dt_sgn(dt_sgn); - return 0; -} - int get_state( int index_of_the_particle, double* mass, @@ -122,10 +107,21 @@ int get_state( double* vx, double* vy, double* vz, - double* radius + double* radius, + double* xi, + double* kf, + double* tau, + double* wx, + double* wy, + double* wz, + double* a_mb ) { - if (!mass || !x || !y || !z || - !vx || !vy || !vz || !radius) return -1; + if (!mass || !x || !y || !z || !vx || !vy || !vz || + !radius || !xi || !kf || !tau || !wx || !wy || + !wz || !a_mb) + { + return -1; + } int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -140,6 +136,13 @@ int get_state( *vy = body.v[1]; *vz = body.v[2]; *radius = body.R; + *xi = body.xi; + *kf = body.kf; + *tau = body.tau; + *wx = body.w[0]; + *wy = body.w[1]; + *wz = body.w[2]; + *a_mb = body.a_mb; return 0; } @@ -152,7 +155,14 @@ int set_state( double vx, double vy, double vz, - double radius + double radius, + double xi, + double kf, + double tau, + double wx, + double wy, + double wz, + double a_mb ) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -163,6 +173,12 @@ int set_state( body.R = radius; body.r = {x, y, z}; body.v = {vx, vy, vz}; + body.xi = xi; + body.kf = kf; + body.tau = tau; + body.w = {wx, wy, wz}; + body.a_mb = a_mb; + return 0; } From 8916711a40e59b78005a93fb9e4e851000784e35 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 11:21:20 +0100 Subject: [PATCH 063/174] tidymess interface.py cleanup --- src/amuse_tidymess/interface.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index d6a17f000d..c9d3e93479 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -387,10 +387,6 @@ def set_state(): particle was found in the model and the information was set -1 - ERROR particle could not be found - -2 - ERROR - code does not support updating of a particle - -3 - ERROR - not yet implemented """ return function @@ -441,7 +437,6 @@ def get_spin(): return function - @legacy_function def set_spin(): ''' @@ -489,7 +484,6 @@ def set_spin(): return function - @legacy_function def set_tidal_model(): ''' @@ -1071,10 +1065,13 @@ def define_state(self, handler): self.stopping_conditions.define_state(handler) def define_methods(self, handler): + """ + Map legacy functions in TidymessInterface into + Tidymess user methods. + """ GravitationalDynamics.define_methods(self, handler) - # turn interface functions into methods. handler.add_method( 'new_particle', ( @@ -1096,6 +1093,7 @@ def define_methods(self, handler): ), (handler.INDEX, handler.ERROR_CODE) ) + handler.add_method( 'get_state', (handler.INDEX), From 42fd3556ce4564b1dec7d6a324be430202c17bf6 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 11:23:19 +0100 Subject: [PATCH 064/174] more tidymess interface.py cleanup --- src/amuse_tidymess/interface.cc | 104 ++++++++++---------------------- 1 file changed, 33 insertions(+), 71 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 75af226691..43e6ffc044 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -199,23 +199,6 @@ int set_mass(int index_of_the_particle, double mass) { return 0; } -int get_radius(int index_of_the_particle, double* radius ) { - if (!radius) return -1; - - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - *radius = tidymess.bodies[i].R; - return 0; -} -int set_radius(int index_of_the_particle, double radius) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - tidymess.bodies[i].R = radius; - return 0; -} - int get_position( int index_of_the_particle, double* x, @@ -282,6 +265,23 @@ int set_velocity( return 0; } +int get_radius(int index_of_the_particle, double* radius ) { + if (!radius) return -1; + + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *radius = tidymess.bodies[i].R; + return 0; +} +int set_radius(int index_of_the_particle, double radius) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].R = radius; + return 0; +} + int get_spin( int index_of_the_particle, double* wx, @@ -489,11 +489,9 @@ int cleanup_code() { } int commit_parameters() { - // """ // Perform initialization in the code dependent on the // values of the parameters. // Called after the parameters have been set or updated. - // """ return 0; } @@ -528,58 +526,6 @@ int recommit_particles() { return 0; } -/** - * Define a new particle in the stellar dynamics code. The particle is - * initialized with the provided mass, radius, position and velocity. - * This function returns an index that can be used to refer to this particle. - */ -int new_particle( - int* index_of_the_particle, - double mass, - double x, - double y, - double z, - double vx, - double vy, - double vz, - double radius, - double xi, - double kf, - double tau, - double wx, - double wy, - double wz, - double a_mb -) { - if (!index_of_the_particle) return -1; - - std::vector& bodies = tidymess.bodies; - - Body newbody( - mass, radius, xi, kf, tau, a_mb, - wx, wy, wz, x, y, z, vx, vy, vz - ); - - newbody.set_id(particle_id_counter); - - *index_of_the_particle = particle_id_counter; - particle_id_counter++; - - bodies.push_back(newbody); - return 0; -} - -int delete_particle(int index_of_the_particle) { - std::vector& bodies = tidymess.bodies; - int i = get_body_index_by_id(index_of_the_particle); - - if (i < 0) return -1; - - bodies.erase(bodies.begin() + i); - - return 0; -} - int get_acceleration( int index_of_the_particle, double* ax, @@ -742,6 +688,22 @@ int get_index_of_next_particle( return 0; } +int determine_dt_sgn(double t_end) { // copied from tidymess.cpp + bool dt_pos; + int dt_sgn; + if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems + dt_pos = true; + dt_sgn = 1; + } + else { + dt_pos = false; + dt_sgn = -1; + } + tidymess.set_dt_sgn(dt_sgn); + return 0; +} + + int evolve_model(double time) { // Evolve the model until the given time, or until a stopping condition is set. From 3c774166496f7d325ce0fda83ad56164e5ba623e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 11:39:08 +0100 Subject: [PATCH 065/174] def get/set_xi tidymess interface.cc --- src/amuse_tidymess/interface.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 43e6ffc044..50f4a28f7a 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -282,6 +282,23 @@ int set_radius(int index_of_the_particle, double radius) { return 0; } +int get_xi(int index_of_the_particle, double* xi) { + if (!xi) return -1; + + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *xi = tidymess.bodies[i].xi; + return 0; +} +int set_xi(int index_of_the_particle, double xi) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].xi = xi; + return 0; +} + int get_spin( int index_of_the_particle, double* wx, From 21fe03a47f7b83505955ccc0da20bd96bbe6eb9a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 11:41:55 +0100 Subject: [PATCH 066/174] get/set_xi added to Tidymess in define_methods --- src/amuse_tidymess/interface.py | 74 +++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index c9d3e93479..0ab12f021b 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -390,6 +390,68 @@ def set_state(): """ return function + @legacy_function + def get_xi(): + """ + Retrieve the moment of inertia of a particle. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + 'Index of the particle to get the state from. This index must ' + 'have been returned by an earlier call to :meth:`new_particle`' + ) + ) + function.addParameter( + 'xi', + dtype='float64', + direction=function.OUT, + description='The moment of inertia of a particle.' + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was found in the model and the moment of inertia was retrieved + -1 - ERROR + particle could not be found + """ + + return function + + @legacy_function + def set_xi(): + """ + Set the moment of inertia of a particle. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + 'Index of the particle to get the state from. This index must ' + 'have been returned by an earlier call to :meth:`new_particle`' + ) + ) + function.addParameter( + 'xi', + dtype='float64', + direction=function.IN, + description='The moment of inertia of a particle.' + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was found in the model and the moment of inertia was set + -1 - ERROR + particle could not be found + """ + + return function + @legacy_function def get_spin(): ''' @@ -1138,6 +1200,18 @@ def define_methods(self, handler): ), (handler.ERROR_CODE,) ) + + handler.add_method( + 'get_xi', + (handler.INDEX,), + (handler.NO_UNIT, handler.ERROR_CODE,) + ) + handler.add_method( + 'set_xi', + (handler.INDEX, handler.NO_UNIT), + (handler.ERROR_CODE,) + ) + handler.add_method( 'get_num_integration_step', (), From 5826eda74cbcfdadf5e92c7eb621db77ea050491 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 11:50:09 +0100 Subject: [PATCH 067/174] def get/set _kf and _tau in tidymess interface.cc --- src/amuse_tidymess/interface.cc | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 50f4a28f7a..67e55ec8cd 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -299,6 +299,41 @@ int set_xi(int index_of_the_particle, double xi) { return 0; } + +int get_kf(int index_of_the_particle, double* kf) { + if (!kf) return -1; + + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *kf = tidymess.bodies[i].kf; + return 0; +} +int set_kf(int index_of_the_particle, double kf) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].kf = kf; + return 0; +} + +int get_tau(int index_of_the_particle, double* tau) { + if (!tau) return -1; + + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *tau = tidymess.bodies[i].tau; + return 0; +} +int set_tau(int index_of_the_particle, double tau) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].tau = tau; + return 0; +} + int get_spin( int index_of_the_particle, double* wx, From fe61a52455179d2afd5955a6332c1f41f50590a7 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 11:52:26 +0100 Subject: [PATCH 068/174] added set/get_kf to tidymess interface.py --- src/amuse_tidymess/interface.py | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 0ab12f021b..bd780c61dc 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -452,6 +452,68 @@ def set_xi(): return function + @legacy_function + def get_kf(): + """ + Retrieve the fluid love number of a particle. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + 'Index of the particle to get the state from. This index must ' + 'have been returned by an earlier call to :meth:`new_particle`' + ) + ) + function.addParameter( + 'kf', + dtype='float64', + direction=function.OUT, + description='The fluid love number of a particle.' + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was found in the model and the moment of inertia was retrieved + -1 - ERROR + particle could not be found + """ + + return function + + @legacy_function + def set_kf(): + """ + Set the fluid love number of a particle. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + 'Index of the particle to get the state from. This index must ' + 'have been returned by an earlier call to :meth:`new_particle`' + ) + ) + function.addParameter( + 'kf', + dtype='float64', + direction=function.IN, + description='The fluid love number of a particle.' + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was found in the model and the moment of inertia was set + -1 - ERROR + particle could not be found + """ + + return function + @legacy_function def get_spin(): ''' From 6065c22292647d01c2d5b6f0ad771532e5618c81 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 11:54:17 +0100 Subject: [PATCH 069/174] TidymessInterface get/set_tau --- src/amuse_tidymess/interface.py | 62 +++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index bd780c61dc..d8c6c39a18 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -514,6 +514,68 @@ def set_kf(): return function + @legacy_function + def get_tau(): + """ + Retrieve the fluid relaxation time of a particle. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + 'Index of the particle to get the state from. This index must ' + 'have been returned by an earlier call to :meth:`new_particle`' + ) + ) + function.addParameter( + 'tau', + dtype='float64', + direction=function.OUT, + description='The fluid relaxation time of a particle.' + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was found in the model and the moment of inertia was retrieved + -1 - ERROR + particle could not be found + """ + + return function + + @legacy_function + def set_tau(): + """ + Set the fluid relaxation time of a particle. + """ + function = LegacyFunctionSpecification() + function.addParameter( + 'index_of_the_particle', + dtype='int32', + direction=function.IN, + description=( + 'Index of the particle to get the state from. This index must ' + 'have been returned by an earlier call to :meth:`new_particle`' + ) + ) + function.addParameter( + 'tau', + dtype='float64', + direction=function.IN, + description='The fluid relaxation time of a particle.' + ) + function.result_type = 'int32' + function.result_doc = """ + 0 - OK + particle was found in the model and the moment of inertia was set + -1 - ERROR + particle could not be found + """ + + return function + @legacy_function def get_spin(): ''' From cfb6bf0bff9c6a568a5e508dedd9112312cf0235 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 11:56:03 +0100 Subject: [PATCH 070/174] added get/set kf and tau to Tidymess under define_methods --- src/amuse_tidymess/interface.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index d8c6c39a18..0351dcf5b8 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1336,6 +1336,28 @@ def define_methods(self, handler): (handler.ERROR_CODE,) ) + handler.add_method( + 'get_kf', + (handler.INDEX,), + (handler.NO_UNIT, handler.ERROR_CODE,) + ) + handler.add_method( + 'set_kf', + (handler.INDEX, handler.NO_UNIT), + (handler.ERROR_CODE,) + ) + + handler.add_method( + 'get_tau', + (handler.INDEX,), + (generic_unit_system.time, handler.ERROR_CODE,) + ) + handler.add_method( + 'set_tau', + (handler.INDEX, generic_unit_system.time), + (handler.ERROR_CODE,) + ) + handler.add_method( 'get_num_integration_step', (), From ca0ce5289c6a6805a9c44ebf63ff5703bf925246 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:11:35 +0100 Subject: [PATCH 071/174] added docs to setters/getters tidymess interface.cc --- src/amuse_tidymess/interface.cc | 61 +++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 67e55ec8cd..8d5d96ccdf 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -86,7 +86,9 @@ int new_particle( bodies.push_back(newbody); return 0; } - +/** + * Delete a particle inside Tidymess + */ int delete_particle(int index_of_the_particle) { std::vector& bodies = tidymess.bodies; int i = get_body_index_by_id(index_of_the_particle); @@ -98,6 +100,11 @@ int delete_particle(int index_of_the_particle) { return 0; } +// Tidymess setters and getters + +/** + * Get state of a particle + */ int get_state( int index_of_the_particle, double* mass, @@ -146,6 +153,9 @@ int get_state( return 0; } +/** + * Set state of a particle + */ int set_state( int index_of_the_particle, double mass, @@ -182,6 +192,9 @@ int set_state( return 0; } +/** + * Get mass of a particle + */ int get_mass(int index_of_the_particle, double* mass) { if (!mass) return -1; @@ -191,6 +204,9 @@ int get_mass(int index_of_the_particle, double* mass) { *mass = tidymess.bodies[i].m; return 0; } +/** + * Set mass of a particle + */ int set_mass(int index_of_the_particle, double mass) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -199,6 +215,9 @@ int set_mass(int index_of_the_particle, double mass) { return 0; } +/** + * Get position of a particle + */ int get_position( int index_of_the_particle, double* x, @@ -217,6 +236,9 @@ int get_position( *z = body.r[2]; return 0; } +/** + * Set position of a particle + */ int set_position( int index_of_the_particle, double x, @@ -232,6 +254,9 @@ int set_position( return 0; } +/** + * Get velocity of a particle + */ int get_velocity( int index_of_the_particle, double* vx, @@ -250,6 +275,9 @@ int get_velocity( *vz = body.v[2]; return 0; } +/** + * Set velocity of a particle + */ int set_velocity( int index_of_the_particle, double vx, @@ -265,6 +293,9 @@ int set_velocity( return 0; } +/** + * Get radius of a particle + */ int get_radius(int index_of_the_particle, double* radius ) { if (!radius) return -1; @@ -274,6 +305,9 @@ int get_radius(int index_of_the_particle, double* radius ) { *radius = tidymess.bodies[i].R; return 0; } +/** + * Set radius of a particle + */ int set_radius(int index_of_the_particle, double radius) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -282,6 +316,9 @@ int set_radius(int index_of_the_particle, double radius) { return 0; } +/** + * Get moment of inertia of a particle + */ int get_xi(int index_of_the_particle, double* xi) { if (!xi) return -1; @@ -291,6 +328,9 @@ int get_xi(int index_of_the_particle, double* xi) { *xi = tidymess.bodies[i].xi; return 0; } +/** + * Set moment of inertia of a particle + */ int set_xi(int index_of_the_particle, double xi) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -299,7 +339,9 @@ int set_xi(int index_of_the_particle, double xi) { return 0; } - +/** + * Get fluid love number of a particle + */ int get_kf(int index_of_the_particle, double* kf) { if (!kf) return -1; @@ -309,6 +351,9 @@ int get_kf(int index_of_the_particle, double* kf) { *kf = tidymess.bodies[i].kf; return 0; } +/** + * Set fluid love number of a particle + */ int set_kf(int index_of_the_particle, double kf) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -317,6 +362,9 @@ int set_kf(int index_of_the_particle, double kf) { return 0; } +/** + * Get fluid relaxation time of a particle + */ int get_tau(int index_of_the_particle, double* tau) { if (!tau) return -1; @@ -326,6 +374,9 @@ int get_tau(int index_of_the_particle, double* tau) { *tau = tidymess.bodies[i].tau; return 0; } +/** + * Set fluid relaxation time of a particle + */ int set_tau(int index_of_the_particle, double tau) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -334,6 +385,9 @@ int set_tau(int index_of_the_particle, double tau) { return 0; } +/** + * Get spin of a particle + */ int get_spin( int index_of_the_particle, double* wx, @@ -352,6 +406,9 @@ int get_spin( *wz = body.w[2]; return 0; } +/** + * Set spin of a particle + */ int set_spin( int index_of_the_particle, double wx, From 42a9e0ac9a8741e76d770b491136ab68ea8e7378 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:13:31 +0100 Subject: [PATCH 072/174] tidymess interface.cc docs --- src/amuse_tidymess/interface.cc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 8d5d96ccdf..aac18a301d 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -425,25 +425,31 @@ int set_spin( return 0; } -int get_initial_shape(int* initial_shape) { - if (!initial_shape) return -1; +/** + * Get Tidymess tidal model parameter + */ +int get_tidal_model(int* tidal_model) { + if (!tidal_model) return -1; - *initial_shape = init_shape; + *tidal_model = tidymess.get_tidal_model(); return 0; } -int set_initial_shape(int initial_shape) { - init_shape = initial_shape; +/** + * Set Tidymess tidal model parameter + */ +int set_tidal_model(int tidal_model) { + tidymess.set_tidal_model(tidal_model); return 0; } -int get_tidal_model(int* tidal_model) { - if (!tidal_model) return -1; +int get_initial_shape(int* initial_shape) { + if (!initial_shape) return -1; - *tidal_model = tidymess.get_tidal_model(); + *initial_shape = init_shape; return 0; } -int set_tidal_model(int tidal_model) { - tidymess.set_tidal_model(tidal_model); +int set_initial_shape(int initial_shape) { + init_shape = initial_shape; return 0; } From 517319ec078244dc64de2387de0580f2a4ee8b5d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:18:17 +0100 Subject: [PATCH 073/174] TidymessInterface get/set tidal_model legacy functions --- src/amuse_tidymess/interface.cc | 1 + src/amuse_tidymess/interface.py | 42 +++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index aac18a301d..209446a3bc 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -442,6 +442,7 @@ int set_tidal_model(int tidal_model) { return 0; } + int get_initial_shape(int* initial_shape) { if (!initial_shape) return -1; diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 0351dcf5b8..8e93f08357 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -659,56 +659,62 @@ def set_spin(): ) function.result_type = 'int32' function.can_handle_array = True - function.result_doc = '''\ + function.result_doc = """\ 0 - OK particle was found in the model and the information was set -1 - ERROR particle could not be found - -2 - ERROR - code does not support updating of a particle - ''' - + """ return function @legacy_function - def set_tidal_model(): - ''' - ''' + def get_tidal_model(): + """ + Get Tidymess tidal model. + """ function = LegacyFunctionSpecification() function.addParameter( 'tidal_model', dtype='int32', - direction=function.IN, + direction=function.OUT, description=( '0=none, 1=conservative, 2=linear, ' '3=creep direct, 4=creep tidymess (default)' ) ) function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """\ + 0 - OK + particle was found in the model and the information was set + -1 - ERROR + particle could not be found + """ return function - @legacy_function - def get_tidal_model(): - ''' - ''' + def set_tidal_model(): + """ + Set Tidymess tidal model. + """ function = LegacyFunctionSpecification() function.addParameter( 'tidal_model', dtype='int32', - direction=function.OUT, + direction=function.IN, description=( '0=none, 1=conservative, 2=linear, ' '3=creep direct, 4=creep tidymess (default)' ) ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + particle was found in the model and the information was set + -1 - ERROR + particle could not be found + """ return function - @legacy_function def set_pn_order(): ''' From b852e319318369079dad8d85f5cede636b5581bd Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:28:32 +0100 Subject: [PATCH 074/174] cleaned up tidymess interface.cc --- src/amuse_tidymess/interface.cc | 34 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 209446a3bc..d8e753020c 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -442,24 +442,18 @@ int set_tidal_model(int tidal_model) { return 0; } - -int get_initial_shape(int* initial_shape) { - if (!initial_shape) return -1; - - *initial_shape = init_shape; - return 0; -} -int set_initial_shape(int initial_shape) { - init_shape = initial_shape; - return 0; -} - +/** + * Get Tidymess pn order parameter + */ int get_pn_order(int* pn_order) { if (!pn_order) return -1; *pn_order = tidymess.get_pn_order(); return 0; } +/** + * Set Tidymess pn order parameter + */ int set_pn_order(int pn_order) { tidymess.set_pn_order(pn_order); return 0; @@ -581,6 +575,22 @@ int get_num_integration_step(int* num_integration_step) { return 0; } +/** + * Get Tidymess initial shape parameter + */ +int get_initial_shape(int* initial_shape) { + if (!initial_shape) return -1; + + *initial_shape = init_shape; + return 0; +} +/** + * Set Tidymess initial shape parameter + */ +int set_initial_shape(int initial_shape) { + init_shape = initial_shape; + return 0; +} int initialize_code(){ // From 655a97d9598e85a7332a7934a3a0d1b1e2191de2 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:29:19 +0100 Subject: [PATCH 075/174] TidymessInterface return docs --- src/amuse_tidymess/interface.py | 87 ++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 8e93f08357..11f564492c 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -151,10 +151,10 @@ def new_particle(): ) function.result_type = 'int32' function.result_doc = """\ - 0 - OK - particle was created and added to the model + 0 - OK + particle was created and added to the model -1 - ERROR - particle could not be created + particle could not be created """ return function @@ -476,7 +476,7 @@ def get_kf(): function.result_type = 'int32' function.result_doc = """ 0 - OK - particle was found in the model and the moment of inertia was retrieved + particle was found in the model and the fluid love number was retrieved -1 - ERROR particle could not be found """ @@ -507,7 +507,7 @@ def set_kf(): function.result_type = 'int32' function.result_doc = """ 0 - OK - particle was found in the model and the moment of inertia was set + particle was found in the model and the fluid love number was set -1 - ERROR particle could not be found """ @@ -538,7 +538,8 @@ def get_tau(): function.result_type = 'int32' function.result_doc = """ 0 - OK - particle was found in the model and the moment of inertia was retrieved + particle was found in the model and the fluid + relaxation time was retrieved -1 - ERROR particle could not be found """ @@ -569,7 +570,8 @@ def set_tau(): function.result_type = 'int32' function.result_doc = """ 0 - OK - particle was found in the model and the moment of inertia was set + particle was found in the model and the fluid + relaxation time was set -1 - ERROR particle could not be found """ @@ -578,10 +580,10 @@ def set_tau(): @legacy_function def get_spin(): - ''' + """ Retrieve the spin vector of a particle. Spin is a vector property, this function has 3 OUT arguments. - ''' + """ function = LegacyFunctionSpecification() function.addParameter( 'index_of_the_particle', @@ -612,22 +614,19 @@ def get_spin(): ) function.result_type = 'int32' function.can_handle_array = True - function.result_doc = '''\ + function.result_doc = """\ 0 - OK - current value was retrieved - -1 - ERROR + particle was found in the model and the spin was retrieved + -1 - ERROR particle could not be found - -2 - ERROR - not yet implemented - ''' - + """ return function @legacy_function def set_spin(): - ''' + """ Update the spin of a particle. - ''' + """ function = LegacyFunctionSpecification() function.addParameter( 'index_of_the_particle', @@ -660,10 +659,10 @@ def set_spin(): function.result_type = 'int32' function.can_handle_array = True function.result_doc = """\ - 0 - OK - particle was found in the model and the information was set + 0 - OK + particle was found in the model and the spin was set -1 - ERROR - particle could not be found + particle could not be found """ return function @@ -685,7 +684,8 @@ def get_tidal_model(): function.result_type = 'int32' function.result_doc = """\ 0 - OK - particle was found in the model and the information was set + particle was found in the model and the + tidal model was retrieved -1 - ERROR particle could not be found """ @@ -708,47 +708,56 @@ def set_tidal_model(): ) function.result_type = 'int32' function.result_doc = """\ - 0 - OK - particle was found in the model and the information was set - -1 - ERROR - particle could not be found + 0 - OK + particle was found in the model and the tidal model was set + -1 - ERROR + particle could not be found """ return function @legacy_function - def set_pn_order(): - ''' - ''' + def get_pn_order(): + """ + Get Tidymess pn order parameter. + """ function = LegacyFunctionSpecification() function.addParameter( 'pn_order', dtype='int32', - direction=function.IN, + direction=function.OUT, description='Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn' ) function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """\ + 0 - OK + particle was found in the model and the pn order was retrieved + -1 - ERROR + particle could not be found + """ return function - @legacy_function - def get_pn_order(): - ''' - ''' + def set_pn_order(): + """ + Set Tidymess pn order parameter + """ function = LegacyFunctionSpecification() function.addParameter( 'pn_order', dtype='int32', - direction=function.OUT, + direction=function.IN, description='Post-Newtonian order: 0=none, 1=1pn, 2=1+2pn, 25=1+2+2.5pn' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + particle was found in the model and the pn order was set + -1 - ERROR + particle could not be found + """ return function - @legacy_function def set_magnetic_braking(): ''' From 5d69232a59216e350c3a3a79234ccf06f68e80c5 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:31:13 +0100 Subject: [PATCH 076/174] tidymessInterface docs --- src/amuse_tidymess/interface.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 11f564492c..f616e47b1f 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -424,7 +424,7 @@ def get_xi(): @legacy_function def set_xi(): """ - Set the moment of inertia of a particle. + Update the current moment of inertia of a particle. """ function = LegacyFunctionSpecification() function.addParameter( @@ -486,7 +486,7 @@ def get_kf(): @legacy_function def set_kf(): """ - Set the fluid love number of a particle. + Update the current fluid love number of a particle. """ function = LegacyFunctionSpecification() function.addParameter( @@ -549,7 +549,7 @@ def get_tau(): @legacy_function def set_tau(): """ - Set the fluid relaxation time of a particle. + Update the current fluid relaxation time of a particle. """ function = LegacyFunctionSpecification() function.addParameter( @@ -581,8 +581,7 @@ def set_tau(): @legacy_function def get_spin(): """ - Retrieve the spin vector of a particle. Spin is a vector - property, this function has 3 OUT arguments. + Retrieve the spin vector of a particle. """ function = LegacyFunctionSpecification() function.addParameter( @@ -625,7 +624,7 @@ def get_spin(): @legacy_function def set_spin(): """ - Update the spin of a particle. + Update the current spin of a particle. """ function = LegacyFunctionSpecification() function.addParameter( From cb0a2be4337c260439d90fc8c22b4f2beecececd Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:34:29 +0100 Subject: [PATCH 077/174] TidymessInterface docs --- src/amuse_tidymess/interface.py | 34 ++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index f616e47b1f..b0eb9206b9 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -682,11 +682,10 @@ def get_tidal_model(): ) function.result_type = 'int32' function.result_doc = """\ - 0 - OK - particle was found in the model and the - tidal model was retrieved - -1 - ERROR - particle could not be found + 0 - OK + tidal model was retrieved + -1 - ERROR + tidal model could not be found """ return function @@ -708,9 +707,9 @@ def set_tidal_model(): function.result_type = 'int32' function.result_doc = """\ 0 - OK - particle was found in the model and the tidal model was set + tidal model was set -1 - ERROR - particle could not be found + tidal model could not be set """ return function @@ -729,9 +728,9 @@ def get_pn_order(): function.result_type = 'int32' function.result_doc = """\ 0 - OK - particle was found in the model and the pn order was retrieved + pn order was retrieved -1 - ERROR - particle could not be found + pn order could not be found """ return function @@ -751,16 +750,17 @@ def set_pn_order(): function.result_type = 'int32' function.result_doc = """\ 0 - OK - particle was found in the model and the pn order was set + pn order was set -1 - ERROR - particle could not be found + pn order could not be set """ return function @legacy_function def set_magnetic_braking(): - ''' - ''' + """ + Set the magnetic braking parameter. + """ function = LegacyFunctionSpecification() function.addParameter( 'magnetic_braking', @@ -769,8 +769,12 @@ def set_magnetic_braking(): description='Magnetic braking. 0=off, 1=on' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + magnetic braking coefficient was set + -1 - ERROR + Could not set magnetic braking coefficient + """ return function From 2f59992b78fc6b5d212a2821a76694bf4234fd6a Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:36:21 +0100 Subject: [PATCH 078/174] TidymessInterface set/get magnetic_braking --- src/amuse_tidymess/interface.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index b0eb9206b9..f53d3b7dc4 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -757,44 +757,47 @@ def set_pn_order(): return function @legacy_function - def set_magnetic_braking(): + def get_magnetic_braking(): """ - Set the magnetic braking parameter. + Get magnetic braking parameter. """ function = LegacyFunctionSpecification() function.addParameter( 'magnetic_braking', dtype='int32', - direction=function.IN, + direction=function.OUT, description='Magnetic braking. 0=off, 1=on' ) function.result_type = 'int32' function.result_doc = """\ 0 - OK - magnetic braking coefficient was set + magnetic braking was retrieved -1 - ERROR - Could not set magnetic braking coefficient + magnetic braking could not be found """ return function - @legacy_function - def get_magnetic_braking(): - ''' - ''' + def set_magnetic_braking(): + """ + Set the magnetic braking parameter. + """ function = LegacyFunctionSpecification() function.addParameter( 'magnetic_braking', dtype='int32', - direction=function.OUT, + direction=function.IN, description='Magnetic braking. 0=off, 1=on' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + magnetic braking coefficient was set + -1 - ERROR + Could not set magnetic braking coefficient + """ return function - @legacy_function def set_speed_of_light(): ''' From fe1fa366c7230977dee03cc9599f37d58374081b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:38:43 +0100 Subject: [PATCH 079/174] Tidymess defined_methods set/get_spin --- src/amuse_tidymess/interface.py | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index f53d3b7dc4..661a4e76c1 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1378,6 +1378,26 @@ def define_methods(self, handler): (handler.INDEX, generic_unit_system.time), (handler.ERROR_CODE,) ) + handler.add_method( + 'get_spin', + (handler.NO_UNIT), + ( + 1/nbody_system.time, + 1/nbody_system.time, + 1/nbody_system.time, + handler.ERROR_CODE + ) + ) + handler.add_method( + 'set_spin', + ( + handler.NO_UNIT, + 1/nbody_system.time, + 1/nbody_system.time, + 1/nbody_system.time, + ), + (handler.ERROR_CODE,) + ) handler.add_method( 'get_num_integration_step', @@ -1419,26 +1439,6 @@ def define_methods(self, handler): ) ) - handler.add_method( - 'set_spin', - ( - handler.NO_UNIT, - 1/nbody_system.time, - 1/nbody_system.time, - 1/nbody_system.time, - ), - (handler.ERROR_CODE,) - ) - handler.add_method( - 'get_spin', - (handler.NO_UNIT), - ( - 1/nbody_system.time, - 1/nbody_system.time, - 1/nbody_system.time, - handler.ERROR_CODE - ) - ) handler.add_method( 'set_n_iter', ( From 17f8e02cd769f3bf57b8c6e3ef00f8c7c3288f35 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:54:55 +0100 Subject: [PATCH 080/174] tidymess interface.cc docs --- src/amuse_tidymess/interface.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index d8e753020c..ced9ae6659 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -459,34 +459,52 @@ int set_pn_order(int pn_order) { return 0; } +/** + * Get Tidymess magnetic braking paramter + */ int get_magnetic_braking(int* magnetic_braking) { if (!magnetic_braking) return -1; *magnetic_braking = tidymess.get_magnetic_braking(); return 0; } +/** + * Set Tidymess magnetic braking parameter + */ int set_magnetic_braking(int magnetic_braking) { tidymess.set_magnetic_braking(magnetic_braking); return 0; } +/** + * Get Tidymess speed of light parameter + */ int get_speed_of_light(double* speed_of_light) { if (!speed_of_light) return -1; *speed_of_light = tidymess.get_speed_of_light(); return 0; } +/** + * Set Tidymess speed of light parameter + */ int set_speed_of_light(double speed_of_light) { tidymess.set_speed_of_light(speed_of_light); return 0; } +/** + * Get Tidymess dt mode parameter + */ int get_dt_mode(int* dt_mode) { if (!dt_mode) return -1; *dt_mode = tidymess.get_dt_mode(); return 0; } +/** + * Set Tidymess dt mode parameter + */ int set_dt_mode(int dt_mode) { tidymess.set_dt_mode(dt_mode); return 0; From e71088c4b40454d2cbe2a81790c9a6438253a9a8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 13:55:21 +0100 Subject: [PATCH 081/174] tidymessInterface docs --- src/amuse_tidymess/interface.py | 87 ++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 33 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 661a4e76c1..47245004a2 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -799,72 +799,93 @@ def set_magnetic_braking(): return function @legacy_function - def set_speed_of_light(): - ''' - ''' + def get_speed_of_light(): + """ + Retrieve Tidymess speed of light parameter. + Only used in conjunction with N-body units + and pn_order>0, otherwise equal to c. + """ function = LegacyFunctionSpecification() function.addParameter( 'speed_of_light', dtype='float64', - direction=function.IN, - description='') + direction=function.OUT, + description='' + ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + speed of light was retrieved + -1 - ERROR + Could not find speed of light + """ return function - @legacy_function - def get_speed_of_light(): - ''' - ''' + def set_speed_of_light(): + """ + Set Tidymess speed of light. Only used in + conjunction with N-body units and pn_order>0, + otherwise equal to c. + """ function = LegacyFunctionSpecification() function.addParameter( 'speed_of_light', dtype='float64', - direction=function.OUT, - description='' - ) + direction=function.IN, + description='') function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + speed of light was set + -1 - ERROR + Could not set speed of light + """ return function - @legacy_function - def set_dt_mode(): - ''' - ''' + def get_dt_mode(): + """ + Retrieve Tidymess dt mode parameter. + """ function = LegacyFunctionSpecification() function.addParameter( 'dt_mode', dtype='int32', - direction=function.IN, + direction=function.OUT, description='' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + dt mode was retrieved + -1 - ERROR + Could not find dt mode + """ return function - @legacy_function - def get_dt_mode(): - ''' - ''' + def set_dt_mode(): + """ + Set Tidymess dt mode parameter. Controls + which dt scheme is used in Tidymess. + """ function = LegacyFunctionSpecification() function.addParameter( 'dt_mode', dtype='int32', - direction=function.OUT, - description='' + direction=function.IN, + description='0=constant dt, 1=adaptive dt, 2=adaptive, weighted dt' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + dt mode was set + -1 - ERROR + Could not set dt mode + """ return function - @legacy_function def set_dt_const(): ''' @@ -1578,7 +1599,7 @@ def define_parameters(self, handler): 'get_initial_shape', 'set_initial_shape', 'initial_shape', - 'Initial shape, default=0', + 'Initial shape, 0=sphere (default), 1=equilibrium', default_value=0, is_vector=False, must_set_before_get=False, From aad4d7ad0aeb2a82f7323f04e604c99b28a746f6 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 14:03:00 +0100 Subject: [PATCH 082/174] tidymess interface.cc docs --- src/amuse_tidymess/interface.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index ced9ae6659..8a72cfef46 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -510,12 +510,18 @@ int set_dt_mode(int dt_mode) { return 0; } +/** + * Get Tidymess constant dt parameter + */ int get_dt_const(double* dt_const) { if (!dt_const) return -1; *dt_const = tidymess.get_dt_const(); return 0; } +/** + * Set Tidymess constant dt parameter + */ int set_dt_const(double dt_const) { tidymess.set_dt_const(dt_const); return 0; @@ -621,6 +627,9 @@ int initialize_code(){ // AMUSE STOPPING CONDITIONS SUPPORT //set_support_for_condition(COLLISION_DETECTION); + // reset id counter? + //particle_id_counter = 0; + return 0;} int cleanup_code() { From e0eb25dcadbee7406239e55b027ac6561ab14c60 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 14:06:12 +0100 Subject: [PATCH 083/174] Tidymess add_method get/set_dt_const --- src/amuse_tidymess/interface.py | 53 ++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 47245004a2..3e3f281a07 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -887,36 +887,45 @@ def set_dt_mode(): return function @legacy_function - def set_dt_const(): - ''' - ''' + def get_dt_const(): + """ + Retrieve Tidymess constant dt parameter. + """ function = LegacyFunctionSpecification() function.addParameter( 'dt_const', dtype='float64', - direction=function.IN, + direction=function.OUT, description='' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + constant dt was retrieved + -1 - ERROR + Could not find constant dt + """ return function - @legacy_function - def get_dt_const(): - ''' - ''' + def set_dt_const(): + """ + Set Tidymess constant dt parameter. + """ function = LegacyFunctionSpecification() function.addParameter( 'dt_const', dtype='float64', - direction=function.OUT, + direction=function.IN, description='' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + constant dt was set + -1 - ERROR + Could not set constant dt + """ return function @@ -1436,14 +1445,6 @@ def define_methods(self, handler): handler.ERROR_CODE ) ) - handler.add_method( - 'get_dt_const', - (), - ( - nbody_system.time, - handler.ERROR_CODE - ) - ) handler.add_method( 'convert_spin_vectors_to_inertial', @@ -1545,6 +1546,16 @@ def define_parameters(self, handler): must_set_before_get=False, ) + handler.add_method( + 'get_dt_const', + 'set_dt_const', + 'dt_const', + 'constant time step in units given by time_unit (only used if dt_mode=0)', # FIX + default_value=0.015625, + is_vector=False, + must_set_before_get=False, + ) + handler.add_method_parameter( 'get_eta', 'set_eta', From d9ae479a7e07c77aae9db39518caad68d4b355c3 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 14:15:48 +0100 Subject: [PATCH 084/174] Tidymess cleaned up user interface --- src/amuse_tidymess/interface.cc | 12 ++++ src/amuse_tidymess/interface.py | 106 +++++++++++++++----------------- 2 files changed, 62 insertions(+), 56 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 8a72cfef46..8308eb3318 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -527,23 +527,35 @@ int set_dt_const(double dt_const) { return 0; } +/** + * Get Tidymess eta (accuracy parameter) + */ int get_eta(double* eta) { if (!eta) return -1; *eta = tidymess.get_eta(); return 0; } +/** + * Set Tidymess eta (accuracy parameter) + */ int set_eta(double eta) { tidymess.set_eta(eta); return 0; } +/** + * Get Tidymess n iter parameter + */ int get_n_iter(int* n_iter) { if (!n_iter) return -1; *n_iter = tidymess.n_iter; return 0; } +/** + * Set Tidymess n iter parameter + */ int set_n_iter(int n_iter) { tidymess.n_iter = n_iter; return 0; diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 3e3f281a07..f617889696 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -156,7 +156,6 @@ def new_particle(): -1 - ERROR particle could not be created """ - return function @legacy_function @@ -418,7 +417,6 @@ def get_xi(): -1 - ERROR particle could not be found """ - return function @legacy_function @@ -449,7 +447,6 @@ def set_xi(): -1 - ERROR particle could not be found """ - return function @legacy_function @@ -480,7 +477,6 @@ def get_kf(): -1 - ERROR particle could not be found """ - return function @legacy_function @@ -511,7 +507,6 @@ def set_kf(): -1 - ERROR particle could not be found """ - return function @legacy_function @@ -543,7 +538,6 @@ def get_tau(): -1 - ERROR particle could not be found """ - return function @legacy_function @@ -575,7 +569,6 @@ def set_tau(): -1 - ERROR particle could not be found """ - return function @legacy_function @@ -928,28 +921,32 @@ def set_dt_const(): """ return function - @legacy_function - def get_time_step(): - ''' - ''' + def get_eta(): + """ + Retrieve Tidymess eta (accuracy) parameter. + """ function = LegacyFunctionSpecification() function.addParameter( - 'time_step', + 'eta', dtype='float64', direction=function.OUT, description='' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + eta was retrieved + -1 - ERROR + Could not find eta + """ return function - @legacy_function def set_eta(): - ''' - ''' + """ + Set Tidymess eta (accuracy) parameter. + """ function = LegacyFunctionSpecification() function.addParameter( 'eta', @@ -958,31 +955,42 @@ def set_eta(): description='' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + eta was set + -1 - ERROR + Could not set eta + """ return function - @legacy_function - def get_eta(): - ''' - ''' + def get_n_iter(): + """ + Retrieve Tidymess n iter parameter. This is the + number of iterations to improve reversibility. + """ function = LegacyFunctionSpecification() function.addParameter( - 'eta', - dtype='float64', + 'n_iter', + dtype='int32', direction=function.OUT, description='' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + n_iter was retrieved + -1 - ERROR + Could not find n_iter + """ return function @legacy_function def set_n_iter(): - ''' - ''' + """ + Set Tidymess n iter parameter. This is the + number of iterations to improve reversibility. + """ function = LegacyFunctionSpecification() function.addParameter( 'n_iter', @@ -991,19 +999,22 @@ def set_n_iter(): description='' ) function.result_type = 'int32' - function.result_doc = '''''' - + function.result_doc = """\ + 0 - OK + n_iter was set + -1 - ERROR + Could not set n_iter + """ return function - @legacy_function - def get_n_iter(): + def get_time_step(): ''' ''' function = LegacyFunctionSpecification() function.addParameter( - 'n_iter', - dtype='int32', + 'time_step', + dtype='float64', direction=function.OUT, description='' ) @@ -1012,8 +1023,6 @@ def get_n_iter(): return function - - @legacy_function def set_collision_mode(): ''' @@ -1461,24 +1470,6 @@ def define_methods(self, handler): ) ) - handler.add_method( - 'set_n_iter', - ( - handler.NO_UNIT, - ), - ( - handler.ERROR_CODE, - ) - ) - handler.add_method( - 'get_n_iter', - (), - ( - handler.NO_UNIT, - handler.ERROR_CODE, - ) - ) - self.stopping_conditions.define_methods(handler) @@ -1550,7 +1541,10 @@ def define_parameters(self, handler): 'get_dt_const', 'set_dt_const', 'dt_const', - 'constant time step in units given by time_unit (only used if dt_mode=0)', # FIX + ( + 'constant time step in units given by time_unit, ' # FIX + 'default=0.015625 (only used if dt_mode=0)' + ), default_value=0.015625, is_vector=False, must_set_before_get=False, From e52e9766d0f334d88f478ca24b42eb90132d1fd2 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 30 Jan 2026 15:13:12 +0100 Subject: [PATCH 085/174] TidymessInterface cleanup --- src/amuse_tidymess/interface.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index f617889696..343eba95c4 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1299,7 +1299,6 @@ def __init__(self, convert_nbody=None, **options): **options ) - def define_state(self, handler): GravitationalDynamics.define_state(self, handler) GravityFieldCode.define_state(self, handler) From 319d775bdeac284351362def1998cc1045fd2e96 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 6 Feb 2026 11:45:16 +0100 Subject: [PATCH 086/174] tidymess work in progress --- src/amuse_tidymess/interface.cc | 59 ++++++++++++++--------- src/amuse_tidymess/tests/test_tidymess.py | 15 +++--- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 8308eb3318..d424cbe940 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -687,27 +687,28 @@ int commit_particles() { tidymess.commit_parameters(); return 0; } + int recommit_particles() { return 0; } -int get_acceleration( - int index_of_the_particle, - double* ax, - double* ay, - double* az -) { - if (!ax || !ay || !az) return -1; - return 0; -} -int set_acceleration( - int index_of_the_particle, - double ax, - double ay, - double az -) { - return 0; -} +// int get_acceleration( +// int index_of_the_particle, +// double* ax, +// double* ay, +// double* az +// ) { +// if (!ax || !ay || !az) return -1; +// return 0; +// } +// int set_acceleration( +// int index_of_the_particle, +// double ax, +// double ay, +// double az +// ) { +// return 0; +// } int get_eps2(double* epsilon_squared) { if (!epsilon_squared) return -1; @@ -967,13 +968,27 @@ int detect_collision( return 0;} -int merge_collided_particles(int * number_of_particles) { +// int merge_collided_particles(int * number_of_particles) { +// vector bodies = tidymess.get_particles(); +// vector< array > cindex = tidymess.get_collision_indices(); +// collision.replace(bodies, cindex); + +// tidymess.set_particles(bodies); +// tidymess.commit_particles(); + +// *number_of_particles = bodies.size(); +// return 0; +// } +int merge_collided_particles(int* number_of_particles) { + if (!number_of_particles) return -1; + + std::vector& bodies = tidymess.bodies; vector< array > cindex = tidymess.get_collision_indices(); - collision.replace(bodies, cindex); - tidymess.set_particles(bodies); + collision.replace(bodies, cindex); + //tidymess.set_particles(bodies); tidymess.commit_particles(); - vector bodies = tidymess.get_particles(); *number_of_particles = bodies.size(); - return 0;} + return 0; +} diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 8bea4bdfe8..7f0cd53df1 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -9,6 +9,7 @@ from amuse.datamodel import Particles from amuse.ext.orbital_elements import generate_binaries, new_binary_from_orbital_elements + class TestTidymessInterface(TestWithMPI): def test1(self): @@ -152,6 +153,7 @@ def test3(self): 1.0, # wx 1.0, # wy 1.0, # wz + 1.0, # a_mb ) self.assertEqual(result['index_of_the_particle'], 0) @@ -165,6 +167,7 @@ def test3(self): 1.1, # wx 1.1, # wy 1.1, # wz + 1.1, # a_mb ) self.assertEqual(result['index_of_the_particle'], 1) @@ -180,15 +183,15 @@ def test3(self): self.assertEqual(next['index_of_the_next_particle'], 1) # delete particle - instance.delete_particle(1) + #instance.delete_particle(1) - result = instance.get_number_of_particles() - self.assertEqual(result['number_of_particles'], 1) + # result = instance.get_number_of_particles() + # self.assertEqual(result['number_of_particles'], 1) - first = instance.get_index_of_first_particle() - self.assertEqual(first['index_of_the_particle'], 0) + # first = instance.get_index_of_first_particle() + # self.assertEqual(first['index_of_the_particle'], 0) - instance.stop() + # instance.stop() def test4(self): """ From d5fcef74166f488e652f00afe4e36ec3c153d01c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 9 Feb 2026 13:29:24 +0100 Subject: [PATCH 087/174] tidymess formatting --- src/amuse_tidymess/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 343eba95c4..0d8ce0c30d 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -50,7 +50,7 @@ def new_particle(): 'This index is supposed to be a local index for the code ' '(and not valid in other instances of the code or in other codes)' ), - ) + ) function.addParameter( 'mass', dtype='float64', From 5fb551956959b951355dabfe20cb9080bf8e95a7 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 9 Feb 2026 17:37:43 +0100 Subject: [PATCH 088/174] Tidymess interface.cc rm using namespace std --- src/amuse_tidymess/interface.cc | 43 ++++++++++++++++----------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index d424cbe940..660cea5929 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -6,8 +6,6 @@ #include #include -using namespace std; - #include "Timer.h" #include "Banner.h" @@ -692,23 +690,24 @@ int recommit_particles() { return 0; } -// int get_acceleration( -// int index_of_the_particle, -// double* ax, -// double* ay, -// double* az -// ) { -// if (!ax || !ay || !az) return -1; -// return 0; -// } -// int set_acceleration( -// int index_of_the_particle, -// double ax, -// double ay, -// double az -// ) { -// return 0; -// } +// FIXME +int get_acceleration( + int index_of_the_particle, + double* ax, + double* ay, + double* az +) { + if (!ax || !ay || !az) return -1; + return 0; +} +int set_acceleration( + int index_of_the_particle, + double ax, + double ay, + double az +) { + return 0; +} int get_eps2(double* epsilon_squared) { if (!epsilon_squared) return -1; @@ -934,7 +933,7 @@ int convert_spin_vectors_to_inertial(double P, double obl, double psi, double * else { double wmag = 2*M_PI/P; - vector w_vec(3); + std::vector w_vec(3); w_vec[0] = 0; w_vec[1] = 0; w_vec[2] = wmag; @@ -955,7 +954,7 @@ int detect_collision( ) { // Collision handling *collision_flag = tidymess.get_collision_flag(); - vector< array > collided_indices = tidymess.get_collision_indices(); + std::vector< array > collided_indices = tidymess.get_collision_indices(); *n_collisions = collided_indices.size(); *index1 = 0; *index2 = 0; @@ -983,7 +982,7 @@ int merge_collided_particles(int* number_of_particles) { if (!number_of_particles) return -1; std::vector& bodies = tidymess.bodies; - vector< array > cindex = tidymess.get_collision_indices(); + std::vector< array > cindex = tidymess.get_collision_indices(); collision.replace(bodies, cindex); //tidymess.set_particles(bodies); From 53258df08e9ab8ba786613d53fa8390d4048a682 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 9 Feb 2026 17:38:10 +0100 Subject: [PATCH 089/174] Tidymess interface.py rm typo in defining parameters --- src/amuse_tidymess/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 0d8ce0c30d..3b8f250081 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1536,7 +1536,7 @@ def define_parameters(self, handler): must_set_before_get=False, ) - handler.add_method( + handler.add_method_parameter( 'get_dt_const', 'set_dt_const', 'dt_const', From 332bf2c340d534ad654ed046bd84a261e2518324 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 20 Feb 2026 14:07:40 +0100 Subject: [PATCH 090/174] fixed incorrect implementation of Tidymess interface.cc get_total_radius --- src/amuse_tidymess/interface.cc | 61 +++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 660cea5929..3318770e65 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -759,32 +759,26 @@ int get_time_step(double* time_step) { return 0; } +/** + * Get total mass of all particles in Tidymess + */ int get_total_mass(double* mass) { if (!mass) return -1; const std::vector& bodies = tidymess.bodies; - double total = 0.0; + for (size_t i = 0; i < bodies.size(); i++) { total += bodies[i].m; } - *mass = total; - return 0; -} - -int get_total_radius(double* radius) { - if (!radius) return -1; - const std::vector& bodies = tidymess.bodies; - - double total = 0.0; - for (size_t i = 0; i < bodies.size(); i++) { - total += bodies[i].R; - } - *radius = total; + *mass = total; return 0; } +/** + * Get position center of mass of all particles + */ int get_center_of_mass_position( double* x, double* y, @@ -801,6 +795,9 @@ int get_center_of_mass_position( return 0; } +/** + * Get velocity center of mass of all particles + */ int get_center_of_mass_velocity( double* vx, double* vy, @@ -818,6 +815,42 @@ int get_center_of_mass_velocity( return 0; } +/** + * Get the minimum radius of a sphere centered around + * the center of mass of all particles that contains + * every particle within Tidymess + */ +int get_total_radius(double* radius) { + if (!radius) return -1; + + const std::vector& bodies = tidymess.bodies; + double xcom, ycom, zcom; + double rsq_max = 0.0; + + if (get_center_of_mass_position(&xcom, &ycom, &zcom) != 0) + return -1; + + for (size_t i = 0; i < bodies.size(); i++) { + // compute distance between particle and COM + + const Body& body = bodies[i]; + + double dx = body.r[0] - xcom; + double dy = body.r[1] - ycom; + double dz = body.r[2] - zcom; + + double r_sq = dx*dx + dy*dy + dz*dz; + if (rsq_max < r_sq) + rsq_max = r_sq; + } + + *radius = std::sqrt(rsq_max); + return 0; +} + +/** + * Get total number of particles within Tidymess + */ int get_number_of_particles(int* number_of_particles) { if (!number_of_particles) return -1; From 8fef896dd1ca1bbd791656f055756477014b9b3f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 2 Mar 2026 19:28:16 +0100 Subject: [PATCH 091/174] tidymess interface.cc cleanup --- src/amuse_tidymess/interface.cc | 98 +++++++++++++++++++++++++-------- 1 file changed, 75 insertions(+), 23 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 3318770e65..3751f0041c 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -26,6 +26,7 @@ int particle_id_counter = 0; static double begin_time = 0; int init_shape = 0; +// TIDYMESS HELPER FUNCTIONS /** * Given an AMUSE particle index, find the corresponding @@ -44,6 +45,26 @@ int get_body_index_by_id(int index_of_the_particle) { return -1; } +/** + * Determine sign of dt value + * for integrating foward or backwards + * in time. copied from tidymess.cpp + */ +int determine_dt_sgn(double t_end) { + bool dt_pos; + int dt_sgn; + if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems + dt_pos = true; + dt_sgn = 1; + } + else { + dt_pos = false; + dt_sgn = -1; + } + tidymess.set_dt_sgn(dt_sgn); + return 0; +} + /** * Define a new particle in the stellar dynamics code. The particle is * initialized with the provided mass, radius, position and velocity. @@ -213,6 +234,29 @@ int set_mass(int index_of_the_particle, double mass) { return 0; } +/** + * Get radius of a particle + */ +int get_radius(int index_of_the_particle, double* radius ) { + if (!radius) return -1; + + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + *radius = tidymess.bodies[i].R; + return 0; +} +/** + * Set radius of a particle + */ +int set_radius(int index_of_the_particle, double radius) { + int i = get_body_index_by_id(index_of_the_particle); + if (i < 0) return -1; + + tidymess.bodies[i].R = radius; + return 0; +} + /** * Get position of a particle */ @@ -291,29 +335,6 @@ int set_velocity( return 0; } -/** - * Get radius of a particle - */ -int get_radius(int index_of_the_particle, double* radius ) { - if (!radius) return -1; - - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - *radius = tidymess.bodies[i].R; - return 0; -} -/** - * Set radius of a particle - */ -int set_radius(int index_of_the_particle, double radius) { - int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; - - tidymess.bodies[i].R = radius; - return 0; -} - /** * Get moment of inertia of a particle */ @@ -423,6 +444,37 @@ int set_spin( return 0; } +/** + * FIXME + */ +int get_acceleration( + int index_of_the_particle, + double* ax, + double* ay, + double* az +) { + if (!ax || !ay || !az) return -1; + return 0; +} + +/** + * FIXME + */ +int get_potential(int index_of_the_particle, double* potential) { + if (!potential) return -1; + return 0; +} + +int evolve_model(double time) { + // Evolve the model until the given time, or until a stopping condition is set. + + tidymess.commit_parameters(); // has to be called sometime before evolving + determine_dt_sgn(time); + + tidymess.evolve_model(time); + return 0; +} + /** * Get Tidymess tidal model parameter */ From cf1f95c7bfd2b5cfe90e5ec2c2ca8930003859c2 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 2 Mar 2026 19:30:16 +0100 Subject: [PATCH 092/174] tidymess interface.cc def get_time_step --- src/amuse_tidymess/interface.cc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 3751f0041c..9e306d3ff7 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -577,6 +577,22 @@ int set_dt_const(double dt_const) { return 0; } +/** + * Get internal integrator dt value of previous timestep + */ +int get_time_step(double* time_step) { + if (!time_step) return -1; + + if (tidymess.get_dt_mode() > 0) { + *time_step = tidymess.get_dt_prev(); + } + else { + *time_step = tidymess.get_dt_const(); + } + + return 0; +} + /** * Get Tidymess eta (accuracy parameter) */ @@ -801,16 +817,6 @@ int set_begin_time(double time) { return 0; } -int get_time_step(double* time_step) { - if (!time_step) return -1; - - *time_step = tidymess.get_dt_const(); - if (tidymess.get_dt_mode() > 0) { - *time_step = tidymess.get_dt_prev(); - } - return 0; -} - /** * Get total mass of all particles in Tidymess */ From 9ec47363b027b928527feab0ea8e8d384ca71fa9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 2 Mar 2026 19:30:41 +0100 Subject: [PATCH 093/174] tidymess interface.cc cleanup --- src/amuse_tidymess/interface.cc | 54 +++------------------------------ 1 file changed, 4 insertions(+), 50 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 9e306d3ff7..1ddc9faf6d 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -758,25 +758,6 @@ int recommit_particles() { return 0; } -// FIXME -int get_acceleration( - int index_of_the_particle, - double* ax, - double* ay, - double* az -) { - if (!ax || !ay || !az) return -1; - return 0; -} -int set_acceleration( - int index_of_the_particle, - double ax, - double ay, - double az -) { - return 0; -} - int get_eps2(double* epsilon_squared) { if (!epsilon_squared) return -1; return 0; @@ -785,11 +766,6 @@ int set_eps2(double epsilon_squared) { return 0; } -int get_potential(int index_of_the_particle, double* potential) { - if (!potential) return -1; - return 0; -} - int get_kinetic_energy(double* kinetic_energy) { if (!kinetic_energy) return -1; return 0; @@ -801,12 +777,16 @@ int get_potential_energy(double* potential_energy) { return 0; } +/** + * Get current Tidymess model time + */ int get_time(double* time) { if (!time) return -1; *time = tidymess.get_model_time(); return 0; } + int get_begin_time(double* time) { if (!time) return -1; *time = begin_time; @@ -944,32 +924,6 @@ int get_index_of_next_particle( return 0; } -int determine_dt_sgn(double t_end) { // copied from tidymess.cpp - bool dt_pos; - int dt_sgn; - if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems - dt_pos = true; - dt_sgn = 1; - } - else { - dt_pos = false; - dt_sgn = -1; - } - tidymess.set_dt_sgn(dt_sgn); - return 0; -} - - -int evolve_model(double time) { - // Evolve the model until the given time, or until a stopping condition is set. - - tidymess.commit_parameters(); // has to be called sometime before evolving - determine_dt_sgn(time); - - tidymess.evolve_model(time); - return 0; -} - int synchronize_model() { return 0; } From c0fd07b68481b5f2a958539373f60ff26fbc68f8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 2 Mar 2026 19:31:52 +0100 Subject: [PATCH 094/174] rm get_time_step tidymess interface.py as it is redundant (inherited from GD Interface) --- src/amuse_tidymess/interface.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 3b8f250081..dd2a31625d 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1007,22 +1007,6 @@ def set_n_iter(): """ return function - @legacy_function - def get_time_step(): - ''' - ''' - function = LegacyFunctionSpecification() - function.addParameter( - 'time_step', - dtype='float64', - direction=function.OUT, - description='' - ) - function.result_type = 'int32' - function.result_doc = '''''' - - return function - @legacy_function def set_collision_mode(): ''' From 8244c89b6e2d29a64e56ffd4a557a85ca6d5830b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 3 Mar 2026 11:42:52 +0100 Subject: [PATCH 095/174] cleaned up tidymess interface.cc mv commit_param call out of evolve_model method and into commit_parameters --- src/amuse_tidymess/interface.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 1ddc9faf6d..34eda06546 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -22,9 +22,10 @@ static Initializer init; static Collision collision; static Breakup breakup; -int particle_id_counter = 0; +static int particle_id_counter = 0; static double begin_time = 0; -int init_shape = 0; +static int init_shape = 0; +static int dt_sign = 1; // TIDYMESS HELPER FUNCTIONS @@ -52,16 +53,16 @@ int get_body_index_by_id(int index_of_the_particle) { */ int determine_dt_sgn(double t_end) { bool dt_pos; - int dt_sgn; + if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems dt_pos = true; - dt_sgn = 1; + dt_sign = 1; } else { dt_pos = false; - dt_sgn = -1; + dt_sign = -1; } - tidymess.set_dt_sgn(dt_sgn); + tidymess.set_dt_sgn(dt_sign); return 0; } @@ -468,7 +469,8 @@ int get_potential(int index_of_the_particle, double* potential) { int evolve_model(double time) { // Evolve the model until the given time, or until a stopping condition is set. - tidymess.commit_parameters(); // has to be called sometime before evolving + // has to be called sometime before evolving + //tidymess.set_dt_sgn(dt_sign); determine_dt_sgn(time); tidymess.evolve_model(time); @@ -719,10 +721,13 @@ int cleanup_code() { return 0; } +/** + * Perform initialization in the code dependent on the + * values of the parameters.Called after the parameters + * have been set or updated. + */ int commit_parameters() { - // Perform initialization in the code dependent on the - // values of the parameters. - // Called after the parameters have been set or updated. + tidymess.commit_parameters(); return 0; } From 7e3826258284850d95f2197be74b78eb03f7dd5c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 6 Mar 2026 16:03:07 +0100 Subject: [PATCH 096/174] mv setters and getters in tidymess interface.cc --- src/amuse_tidymess/interface.cc | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 34eda06546..8745cd1090 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -106,6 +106,7 @@ int new_particle( bodies.push_back(newbody); return 0; } + /** * Delete a particle inside Tidymess */ @@ -629,13 +630,30 @@ int set_n_iter(int n_iter) { return 0; } +/** + * Get Tidymess initial shape parameter + */ +int get_initial_shape(int* initial_shape) { + if (!initial_shape) return -1; + + *initial_shape = init_shape; + return 0; +} +/** + * Set Tidymess initial shape parameter + */ +int set_initial_shape(int initial_shape) { + init_shape = initial_shape; + return 0; +} + // FIX int get_collision_mode(int* collision_mode) { if (!collision_mode) return -1; - if (tidymess.get_collision_mode() != collision.collision_mode) { + if (tidymess.get_collision_mode() != collision.collision_mode) return -1; - } + *collision_mode = tidymess.get_collision_mode(); // maybe check if Tidy and Collision have the same value set @@ -679,23 +697,6 @@ int get_num_integration_step(int* num_integration_step) { return 0; } -/** - * Get Tidymess initial shape parameter - */ -int get_initial_shape(int* initial_shape) { - if (!initial_shape) return -1; - - *initial_shape = init_shape; - return 0; -} -/** - * Set Tidymess initial shape parameter - */ -int set_initial_shape(int initial_shape) { - init_shape = initial_shape; - return 0; -} - int initialize_code(){ // // Run the initialization for the code, called before From 0b62e83e74b6ccfa3bc0b107cdce5cf7ba903824 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 6 Mar 2026 16:03:33 +0100 Subject: [PATCH 097/174] tidymess interface.cc docs and cleanup --- src/amuse_tidymess/interface.cc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 8745cd1090..d354b2134c 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -860,7 +860,7 @@ int get_center_of_mass_velocity( } /** - * Get the minimum radius of a sphere centered around + * Get the radius of a sphere centered around * the center of mass of all particles that contains * every particle within Tidymess */ @@ -904,6 +904,9 @@ int get_number_of_particles(int* number_of_particles) { return 0; } +/** + * Get the index of the first inside of Tidymess + */ int get_index_of_first_particle(int* index_of_the_particle) { if (!index_of_the_particle) return -1; @@ -914,6 +917,9 @@ int get_index_of_first_particle(int* index_of_the_particle) { return 0; } +/** + * Get the index of the next particle given an index + */ int get_index_of_next_particle( int index_of_the_particle, int* index_of_the_next_particle @@ -1016,7 +1022,8 @@ int detect_collision( *index2 = collided_index[1]; } - return 0;} + return 0; +} // int merge_collided_particles(int * number_of_particles) { // vector bodies = tidymess.get_particles(); @@ -1029,16 +1036,16 @@ int detect_collision( // *number_of_particles = bodies.size(); // return 0; // } -int merge_collided_particles(int* number_of_particles) { - if (!number_of_particles) return -1; +// int merge_collided_particles(int* number_of_particles) { +// if (!number_of_particles) return -1; - std::vector& bodies = tidymess.bodies; - std::vector< array > cindex = tidymess.get_collision_indices(); +// std::vector& bodies = tidymess.bodies; +// std::vector< array > cindex = tidymess.get_collision_indices(); - collision.replace(bodies, cindex); - //tidymess.set_particles(bodies); - tidymess.commit_particles(); +// collision.replace(bodies, cindex); +// //tidymess.set_particles(bodies); +// tidymess.commit_particles(); - *number_of_particles = bodies.size(); - return 0; -} +// *number_of_particles = bodies.size(); +// return 0; +// } From 24be00e9b4b7e13051b4bb0ecf5b801b66a67333 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 11 Mar 2026 14:56:18 +0100 Subject: [PATCH 098/174] tidymess interface.cc cleanup --- src/amuse_tidymess/interface.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index d354b2134c..a5b25d9369 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -728,7 +728,7 @@ int cleanup_code() { * have been set or updated. */ int commit_parameters() { - tidymess.commit_parameters(); + //tidymess.commit_parameters(); return 0; } @@ -1036,16 +1036,16 @@ int detect_collision( // *number_of_particles = bodies.size(); // return 0; // } -// int merge_collided_particles(int* number_of_particles) { -// if (!number_of_particles) return -1; +int merge_collided_particles(int* number_of_particles) { + if (!number_of_particles) return -1; -// std::vector& bodies = tidymess.bodies; -// std::vector< array > cindex = tidymess.get_collision_indices(); + std::vector& bodies = tidymess.bodies; + std::vector< array > cindex = tidymess.get_collision_indices(); -// collision.replace(bodies, cindex); -// //tidymess.set_particles(bodies); -// tidymess.commit_particles(); + collision.replace(bodies, cindex); + //tidymess.set_particles(bodies); + tidymess.commit_particles(); -// *number_of_particles = bodies.size(); -// return 0; -// } + *number_of_particles = bodies.size(); + return 0; +} From bbc93f22cc039ace511eebfa74c74d3b72d86d13 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 12 Mar 2026 12:48:06 +0100 Subject: [PATCH 099/174] TidymessInterface test2 setters/getters --- src/amuse_tidymess/tests/test_tidymess.py | 129 +++++++++++++--------- 1 file changed, 77 insertions(+), 52 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 7f0cd53df1..f11dc4e27b 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -18,6 +18,7 @@ def test1(self): """ instance = self.new_instance_of_an_optional_code(TidymessInterface) + assert instance is not None self.assertEqual(0, instance.initialize_code()) self.assertEqual(0, instance.commit_parameters()) self.assertEqual(0, instance.cleanup_code()) @@ -29,63 +30,87 @@ def test2(self): """ instance = self.new_instance_of_an_optional_code(TidymessInterface) - + assert instance is not None result = instance.get_number_of_particles() self.assertEquals(result['number_of_particles'], 0) result = instance.new_particle( - 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, - 1.0, # radius - 1.0, # xi - 1.0, # kf - 1.0, # tau - 1.0, # wx - 1.0, # wy - 1.0, # wz + 1.0, # mass + 2.0, # x + 3.0, # y + 4.0, # z + 5.0, # vz + 6.0, # vy + 7.0, # vz + 8.0, # radius + 9.0, # xi + 10.0, # kf + 11.0, # tau + 12.0, # wx + 13.0, # wy + 14.0, # wz + 15.0 # a_mb ) + self.assertEquals(result['index_of_the_particle'], 0.0) - self.assertEqual(result['index_of_the_particle'], 0) - - instance.set_mass(0, 2.0) - result = instance.get_mass(0) - self.assertEquals(result['mass'], 2.0) + result = instance.get_state(0) + self.assertEquals(result['mass'], 1.0) + self.assertEquals(result['x'], 2.0) + self.assertEquals(result['y'], 3.0) + self.assertEquals(result['z'], 4.0) + self.assertEquals(result['vx'], 5.0) + self.assertEquals(result['vy'], 6.0) + self.assertEquals(result['vz'], 7.0) + self.assertEquals(result['radius'], 8.0) + self.assertEquals(result['xi'], 9.0) + self.assertEquals(result['kf'], 10.0) + self.assertEquals(result['tau'], 11.0) + self.assertEquals(result['wx'], 12.0) + self.assertEquals(result['wy'], 13.0) + self.assertEquals(result['wz'], 14.0) + self.assertEquals(result['a_mb'], 15.0) + + instance.set_mass(0, 1.5) + self.assertEquals(instance.get_mass(0)['mass'], 1.5) - instance.set_position(0, 1.2, 1.2, 1.2) result = instance.get_position(0) - self.assertEquals(result['x'], 1.2) - self.assertEquals(result['y'], 1.2) - self.assertEquals(result['z'], 1.2) + instance.set_position(0, 2.5, 3.5, 4.5) + result = instance.get_position(0) + self.assertEquals(result['x'], 2.5) + self.assertEquals(result['y'], 3.5) + self.assertEquals(result['z'], 4.5) - instance.set_velocity(0, 1.3, 1.3, 1.3) + instance.set_velocity(0, 5.5, 6.5, 7.5) result = instance.get_velocity(0) - self.assertEquals(result['vx'], 1.3) - self.assertEquals(result['vy'], 1.3) - self.assertEquals(result['vz'], 1.3) + self.assertEquals(result['vx'], 5.5) + self.assertEquals(result['vy'], 6.5) + self.assertEquals(result['vz'], 7.5) - instance.set_radius(0, 1.0) + instance.set_radius(0, 8.5) result = instance.get_radius(0) - self.assertEquals(result['radius'], 1.0) + self.assertEquals(result['radius'], 8.5) - result = instance.get_state(0) - self.assertEquals(result['mass'], 2.0) - self.assertEquals(result['x'], 1.2) - self.assertEquals(result['y'], 1.2) - self.assertEquals(result['z'], 1.2) - self.assertEquals(result['vx'], 1.3) - self.assertEquals(result['vy'], 1.3) - self.assertEquals(result['vz'], 1.3) - self.assertEquals(result['radius'], 1.0) - - instance.set_spin(0, 1.4, 1.4, 1.4) + instance.set_xi(0, 9.5) + result = instance.get_xi(0) + self.assertEquals(result['xi'], 9.5) + + instance.set_kf(0, 10.5) + result = instance.get_kf(0) + self.assertEquals(result['kf'], 10.5) + + instance.set_tau(0, 11.5) + result = instance.get_tau(0) + self.assertEquals(result['tau'], 11.5) + + instance.set_spin(0, 12.5, 13.5, 14.5) result = instance.get_spin(0) - self.assertEquals(result['wx'], 1.4) - self.assertEquals(result['wy'], 1.4) - self.assertEquals(result['wz'], 1.4) + self.assertEquals(result['wx'], 12.5) + self.assertEquals(result['wy'], 13.5) + self.assertEquals(result['wz'], 14.5) - instance.set_tidal_model(0) + instance.set_tidal_model(3) result = instance.get_tidal_model() - self.assertEquals(result['tidal_model'], 0) + self.assertEquals(result['tidal_model'], 3) instance.set_pn_order(2) result = instance.get_pn_order() @@ -99,24 +124,24 @@ def test2(self): result = instance.get_speed_of_light() self.assertEquals(result['speed_of_light'], 299792) - instance.set_dt_mode(0) # FIX + instance.set_dt_mode(1) result = instance.get_dt_mode() - self.assertEquals(result['dt_mode'], 0) + self.assertEquals(result['dt_mode'], 1) - instance.set_dt_const(0) # FIX + instance.set_dt_const(0.025625) result = instance.get_dt_const() - self.assertEquals(result['dt_const'], 0) + self.assertEquals(result['dt_const'], 0.025625) - result = instance.get_time_step() - self.assertEquals(result['time_step'], 0) + # result = instance.get_time_step() + # self.assertEquals(result['time_step'], 0) - instance.set_eta(0) # FIX + instance.set_eta(0.625) result = instance.get_eta() - self.assertEquals(result['eta'], 0) + self.assertEquals(result['eta'], 0.625) - instance.set_n_iter(1) # FIX + instance.set_n_iter(2) result = instance.get_n_iter() - self.assertEquals(result['n_iter'], 1) + self.assertEquals(result['n_iter'], 2) instance.set_collision_mode(2) result = instance.get_collision_mode() @@ -130,7 +155,7 @@ def test2(self): result = instance.get_breakup_mode() self.assertEquals(result['breakup_mode'], 1) - result = instance.get_num_integration_step() # FIX + result = instance.get_num_integration_step() # FIXME self.assertEquals(result['num_integration_step'], 0) self.assertEqual(0, instance.cleanup_code()) From e3ceeb90e629c37f213084009d7977a890ab308d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 12 Mar 2026 12:48:58 +0100 Subject: [PATCH 100/174] TidymessInterface test3 create/delete particles --- src/amuse_tidymess/tests/test_tidymess.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index f11dc4e27b..2d3eaa96d6 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -167,7 +167,7 @@ def test3(self): """ instance = self.new_instance_of_an_optional_code(TidymessInterface) - + assert instance is not None result = instance.new_particle( 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, @@ -204,27 +204,30 @@ def test3(self): first = instance.get_index_of_first_particle() self.assertEqual(first['index_of_the_particle'], 0) - next = instance.get_index_of_next_particle(0) + next = instance.get_index_of_next_particle( + first['index_of_the_particle'] + ) self.assertEqual(next['index_of_the_next_particle'], 1) # delete particle - #instance.delete_particle(1) + instance.delete_particle(1) - # result = instance.get_number_of_particles() - # self.assertEqual(result['number_of_particles'], 1) + result = instance.get_number_of_particles() + self.assertEqual(result['number_of_particles'], 1) - # first = instance.get_index_of_first_particle() - # self.assertEqual(first['index_of_the_particle'], 0) + first = instance.get_index_of_first_particle() + self.assertEqual(first['index_of_the_particle'], 0) - # instance.stop() + instance.stop() def test4(self): """ Test TidymessInterface evolve_model with an equal mass binary. """ instance = self.new_instance_of_an_optional_code(TidymessInterface) - self.assertEqual(0, instance.initialize_code()) + assert instance is not None + self.assertEqual(0, instance.initialize_code()) self.assertEqual(0, instance.commit_parameters()) self.assertEqual([0, 0], list(instance.new_particle(0.5, 0.5, 0, 0, 0, 0.5, 0).values())) From d425d0604f5ebdd305d2288608787d24d9df55ba Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 12 Mar 2026 12:51:32 +0100 Subject: [PATCH 101/174] Tidymess test1 setters/getters --- src/amuse_tidymess/tests/test_tidymess.py | 114 ++++++++++++++++------ 1 file changed, 83 insertions(+), 31 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 2d3eaa96d6..e14ecb031d 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -257,6 +257,7 @@ def earth_moon_system(self): planet, moon : amuse.datamodel.particles.Particles Particle objects of the system. """ + system = Particles() planet, moon = generate_binaries( 1 | u.MEarth, @@ -280,66 +281,117 @@ def earth_moon_system(self): moon.wy = 8.4e1 | 1/u.yr moon.wz = 3.8e8 | 1/u.yr - return planet, moon + system.add_particles(planet) + system.add_particles(moon) + system.move_to_center() + + return system def test1(self): """ - Test Tidymess parameters attribute. + Test Tidymess parameters attribute and their defaults """ + system = self.earth_moon_system() + converter = nbody_system.nbody_to_si( + system.mass.sum(), system[0].position.length() + ) + instance = self.new_instance_of_an_optional_code( + Tidymess, converter + ) + assert instance is not None - instance = self.new_instance_of_an_optional_code(Tidymess) - - instance.set_tidal_model(4) - self.assertEquals(instance.get_tidal_model(), 4) - - instance.set_tidal_model(0) self.assertEquals(instance.parameters.tidal_model, 0) + instance.parameters.tidal_model = 4 + self.assertEquals(instance.parameters.tidal_model, 4) - self.assertEquals(instance.get_pn_order(), 0) - instance.set_pn_order(1) + self.assertEquals(instance.parameters.pn_order, 0) + instance.parameters.pn_order = 1 self.assertEquals(instance.parameters.pn_order, 1) - self.assertEquals(instance.get_magnetic_braking(), 0) - instance.set_magnetic_braking(1) - self.assertEquals(instance.parameters.magnetic_braking ,1) + self.assertEquals(instance.parameters.magnetic_braking, 0) + instance.parameters.magnetic_braking = 1 + self.assertEquals(instance.parameters.magnetic_braking, 1) + + self.assertEquals(instance.parameters.speed_of_light, 1e100) + instance.parameters.speed_of_light = 2e100 + self.assertEquals(instance.parameters.speed_of_light, 2e100) + + self.assertEquals(instance.parameters.dt_mode, 1) + instance.parameters.dt_mode = 2 + self.assertEquals(instance.parameters.dt_mode, 2) + + self.assertEquals(instance.parameters.dt_const, 0.015625) + instance.parameters.dt_const = 0.025625 + self.assertEquals(instance.parameters.dt_const, 0.025625) + + self.assertEquals(instance.parameters.eta, 0.0625) + instance.parameters.eta = 0.0726 + self.assertEquals(instance.parameters.eta, 0.0726) - self.assertEquals(instance.get_collision_mode(), 0) - instance.set_collision_mode(1) + self.assertEquals(instance.parameters.n_iter, 1) + instance.parameters.n_iter = 2 + self.assertEquals(instance.parameters.n_iter, 2) + + self.assertEquals(instance.parameters.collision_mode, 0) + instance.parameters.collision_mode = 1 self.assertEquals(instance.parameters.collision_mode, 1) - self.assertEquals(instance.get_roche_mode(), 0) - instance.set_roche_mode(2) + self.assertEquals(instance.parameters.roche_mode, 0) + instance.parameters.roche_mode = 2 self.assertEquals(instance.parameters.roche_mode, 2) - self.assertEquals(instance.get_breakup_mode(), 0) - instance.set_breakup_mode(1) + self.assertEquals(instance.parameters.breakup_mode, 0) + instance.parameters.breakup_mode = 1 self.assertEquals(instance.parameters.breakup_mode, 1) + self.assertEquals(instance.parameters.initial_shape, 0) + instance.parameters.initial_shape = 1 + self.assertEquals(instance.parameters.initial_shape, 1) + + instance.commit_parameters() + + instance.particles.add_particles(system) + + # check that parameters are still set + # correctly after adding a particle + self.assertEquals(instance.parameters.tidal_model, 4) + self.assertEquals(instance.parameters.pn_order, 1) + self.assertEquals(instance.parameters.magnetic_braking, 1) + self.assertEquals(instance.parameters.speed_of_light, 2e100) + self.assertEquals(instance.parameters.dt_mode, 2) + self.assertEquals(instance.parameters.dt_const, 0.025625) + self.assertEquals(instance.parameters.eta, 0.0726) + self.assertEquals(instance.parameters.n_iter, 2) + self.assertEquals(instance.parameters.collision_mode, 1) + self.assertEquals(instance.parameters.roche_mode, 2) + self.assertEquals(instance.parameters.breakup_mode, 1) + self.assertEquals(instance.parameters.initial_shape, 1) + instance.stop() def test2(self): """ Test Tidymess add_particles method. """ - planet, moon = self.earth_moon_system() + system = self.earth_moon_system() + converter = nbody_system.nbody_to_si(system.mass.sum(), system[0].position.length()) - system = Particles() - system.add_particles(planet) - system.add_particles(moon) - - converter = nbody_system.nbody_to_si(system.mass.sum(), planet.position.length()) instance = self.new_instance_of_an_optional_code(Tidymess, converter) - instance.set_tidal_model(0) + assert instance is not None + instance.parameters.tidal_model = 0 instance.particles.add_particles(system) - instance.set_tidal_model(0) - self.assertEquals(instance.get_time_step(), 0 | u.s) + self.assertEquals(instance.get_number_of_particles(), 2) - self.assertGreater(instance.get_total_mass(), 6.04562e24 | u.kg) - self.assertLess(instance.get_total_mass(), 6.04563e24 | u.kg) - self.assertEquals(instance.get_total_radius(), 8108400.0 | u.m) + self.assertEquals(instance.model_time, 0 | u.s) + self.assertAlmostEquals(instance.get_total_mass(), system[0].mass + system[1].mass) + self.assertAlmostEquals(instance.get_total_radius(), 379730731.968 | u.m, 3) + + instance.delete_particle(1) + self.assertEquals(instance.get_number_of_particles(), 1) + self.assertAlmostEquals(instance.get_total_mass(), system[0].mass) instance.stop() From d8a8530abb6d64392de658aecb5bd53edb1f7395 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 12 Mar 2026 16:11:52 +0100 Subject: [PATCH 102/174] TestTidymess cleanup --- src/amuse_tidymess/tests/test_tidymess.py | 95 ++++++++++++++++++----- 1 file changed, 77 insertions(+), 18 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index e14ecb031d..76d63353da 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -287,6 +287,66 @@ def earth_moon_system(self): return system + def jupiter_io_system(self): + """ + Ephemeris Pasadena, USA, Horizons + + Jupiter and Io Ephemeris at A.D. 2026-Jan-01 00:00:00.0000 + + Jupiter: + kf from: Dong Lai 2021 Planet. Sci. J. 2 122 DOI 10.3847/PSJ/ac013b + xi from: https://doi.org/10.1016/j.icarus.2011.09.016 + spin vector from: https://radiojove.gsfc.nasa.gov/education/jupiter/basics/jfacts.htm + + Io: + kf from https://doi.org/10.1016/j.icarus.2025.116567 + xi from Schubert et al. 2004 + spin vector from https://doi.org/10.1016/j.icarus.2012.05.020 and ephemeris + + spin vectors were calculated from LOD, OBL, PSI using + the ``Tidymess.convert_spin_vectors_to_inertial()`` method. + + tau values are arbitrary for both bodies. + """ + system = Particles(2) + + system[0].name = 'Jupiter' + system[0].mass = 1898.6e24 | u.kg + system[0].radius = 6371.01 | u.km + system[0].x = -2.538781102425539e8 | u.km + system[0].y = 7.365225847926259e8 | u.km + system[0].z = 2.626628058868796e6 | u.km + system[0].vx = -1.250707427525374e1 | u.kms + system[0].vy = -3.638417682823274 | u.kms + system[0].vz = 2.949797151579847e-1 | u.kms + system[0].kf = 0.565 + system[0].xi = 0.2629 + system[0].tau = 0 | u.s + system[0].wx = 0.0 | 1 / u.s + system[0].wy = -9.60092648806e-6 | 1 / u.s + system[0].wz = 0.000175573560178 | 1 / u.s + system[0].a_mb = 0 + + system[1].name = 'Io' + system[1].mass = 893193797311089e8 | u.kg + system[1].radius = 1821.6 | u.km + system[1].x = -2.535070263728397e8 | u.km + system[1].y = 7.363212379813337e8 | u.km + system[1].z = 2.624656018151939e6 | u.km + system[1].vx = -4.195592326222561 | u.kms + system[1].vy = 1.153726914561471e1 | u.kms + system[1].vz = 9.564081722803852e-1 | u.kms + system[1].kf = 0.125 + system[1].xi = 0.378 + system[1].tau = 0 | u.s + system[1].wx = 0.0 | 1 / u.s + system[1].wy = -1.43416864277e-9 | 1 / u.s + system[1].wz = 4.10859051537e-5 | 1 / u.s + system[1].a_mb = 0 + + system.move_to_center() + + return system def test1(self): """ @@ -401,7 +461,8 @@ def test3(self): """ converter = nbody_system.nbody_to_si(1 | u.MEarth, 1 | u.REarth) - instance = Tidymess(converter) + instance = self.new_instance_of_an_optional_code(Tidymess, converter) + assert instance is not None lod = 24 | u.hour obl = 10 | u.deg @@ -409,34 +470,32 @@ def test3(self): spin = instance.convert_spin_vectors_to_inertial(lod, obl, psi) - self.assertLess(np.abs(spin[2].number-7.1617240788458890e-05), 1e-19) + self.assertAlmostEquals(spin[0], 0 | 1 / u.s) + self.assertAlmostEquals(spin[1], -1.26280518349e-5 | 1 / u.s) + self.assertAlmostEquals(spin[2], 7.16172407885e-5 | 1 / u.s) + + instance.stop() def test4(self): """ Evolve a system of Particles """ - planet, moon = self.earth_moon_system() - - system = Particles() - system.add_particles(planet) - system.add_particles(moon) - - system.move_to_center() + system = self.earth_moon_system() - converter = nbody_system.nbody_to_si(system.mass.sum(), planet.position.length()) + converter = nbody_system.nbody_to_si( + system.mass.sum(), system[0].position.length() + ) instance = self.new_instance_of_an_optional_code(Tidymess, converter) - tidal_model = 0 - instance.set_tidal_model(tidal_model) + assert instance is not None - instance.particles.add_particles(system) # FIX : tidal_model != 0 after adding particles - instance.set_tidal_model(tidal_model) + instance.parameters.tidal_model = 0 + instance.parameters.dt_mode = 2 + instance.commit_parameters() + + instance.particles.add_particles(system) ratio = instance.get_total_mass() / system.mass.sum() self.assertAlmostEquals(ratio, 1) - self.assertLess(instance.get_total_mass(), 6.0460e24 | u.kg) - self.assertEquals(instance.get_total_radius(), 8108400.0 | u.m) - - instance.set_dt_mode(2) end_time = 1.1 dt = 0.1 From 8143b2e65dde4a4d9894462e151a7713185b5de6 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 12 Mar 2026 16:49:01 +0100 Subject: [PATCH 103/174] Tidymess remove unecessary tests --- src/amuse_tidymess/tests/test_tidymess.py | 332 +--------------------- 1 file changed, 2 insertions(+), 330 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 76d63353da..da58b0f626 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -528,7 +528,8 @@ def test5(self): """ converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) - instance = Tidymess(converter) + instance = self.new_instance_of_an_optional_code(Tidymess, converter) + assert instance is not None index_earth = instance.new_particle( 1.0 | u.MEarth, @@ -595,332 +596,3 @@ def test5(self): self.assertNotEqual(planet_positions[0,1],planet_positions[-1,1]) instance.stop() - - def test6(self): - ''' - Test collisions (just remove both particles) - ''' - - def merge_two_stars(bodies, particles_in_encounter): - com_pos = particles_in_encounter.center_of_mass() - com_vel = particles_in_encounter.center_of_mass_velocity() - d = (particles_in_encounter[0].position - particles_in_encounter[1].position) - v = (particles_in_encounter[0].velocity - particles_in_encounter[1].velocity) - print("Actually merger occurred:") - print("Two stars (M=",particles_in_encounter.mass.in_(units.MSun), - ") collided with d=", d.length().in_(units.au)) - new_particle=Particles(1) - new_particle.mass = particles_in_encounter.total_mass() - new_particle.age = min(particles_in_encounter.age) \ - * max(particles_in_encounter.mass)/new_particle.mass - new_particle.position = com_pos - new_particle.velocity = com_vel - new_particle.radius = particles_in_encounter.radius.sum() - bodies.add_particles(new_particle) - bodies.remove_particles(particles_in_encounter) - - - converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) - instance = Tidymess(converter) - - index_earth = instance.new_particle( - 1.0 | u.MEarth, - -2e8 | u.m, - 0.0 | u.m, - 0.0 | u.m, - 0.0 | u.m/u.s, - 0.0 | u.m/u.s, - 0.0 | u.m/u.s, - 3000 | u.km - ) - self.assertEquals(index_earth, 0) - - index_moon = instance.new_particle( - 0.1 | u.kg, - 0.0e8 | u.m, - -1.0e8 | u.m, - 0.0 | u.m, - 0.0 | u.m/u.s, - 1.0e3 | u.m/u.s, - 0.0 | u.m/u.s, - 3000 | u.km - ) - self.assertEquals(index_moon, 1) - - dummy1 = instance.new_particle( - 0.1 | u.kg, - 100 | u.m, - 1.0e8 | u.m, - 0.0 | u.m, - 0.0 | u.m/u.s, - -1.0e3 | u.m/u.s, - 0.0 | u.m/u.s, - 3000 | u.km - ) - self.assertEquals(dummy1, 2) - - dummy2 = instance.new_particle( - 0.1 | u.kg, - 1.e8 | u.m, - -2.0e8 | u.m, - 0.0 | u.m, - 0.0 | u.m/u.s, - 1.0e3 | u.m/u.s, - 0.0 | u.m/u.s, - 3000 | u.km - ) - self.assertEquals(dummy2, 3) - - dummy3 = instance.new_particle( - 0.1 | u.kg, - 1e8 | u.m, - 2.0e8 | u.m, - 0.0 | u.m, - 0.0 | u.m/u.s, - -1.0e3 | u.m/u.s, - 0.0 | u.m/u.s, - 3000 | u.km - ) - self.assertEquals(dummy3, 4) - - dummy4 = instance.new_particle( - 0.1 | u.kg, - 1.4e8 | u.m, - 0.0 | u.m, - 0.0 | u.m, - 0.0 | u.m/u.s, - 1.0e3 | u.m/u.s, - 0.0 | u.m/u.s, - 3000 | u.km - ) - self.assertEquals(dummy4, 5) - - appendix = "" - - tidal_model = 0 - instance.set_tidal_model(tidal_model) - dt_mode = 2 - instance.set_dt_mode(dt_mode) - - - # Running gravity code - end_time = 5 - dt = end_time/13 - times = np.arange(0, end_time, dt) | u.day - print("times:",times) - - planet_pos = instance.get_position(0) - moon_pos = instance.get_position(1) - - def get_particle_indices(): - N = instance.get_number_of_particles() - idx = instance.get_index_of_first_particle() - indices = [idx] - while len(indices) < N: - idx = instance.get_index_of_next_particle(idx) - indices.append(idx) - return indices - - # Empty lists for properties to track - positions = [[], [], [], [], [], []] - self.assertEquals(len(positions), instance.get_number_of_particles()) - - instance.set_collision_mode(3) # 0=off, 1=ignore, 2=exception, 3=replace - print("collision_mode:", instance.parameters.collision_mode, "(0=off, 1=ignore, 2=exception, 3=replace)") - - for t in times: - print(t) - - instance.evolve_model(t) - - indices = get_particle_indices() - print("indices:", indices) - for idx in indices: - pos = instance.get_position(idx) - positions[idx].append([pos[0].number, pos[1].number, pos[2].number]) - - collision_flag, n_collisions, collider1, collider2 = instance.detect_collision() - if n_collisions > 0: - print("botsing! deeltjes", collider1, collider2) - instance.delete_particle(collider2) - instance.delete_particle(collider1) - print("deleted colliding particles") - else: - print("geen botsingen") - - for i in range(len(positions)): - pos = np.asarray(positions[i]) - plt.plot(pos[:,0], pos[:,1], marker='.', alpha=0.5) - - plt.axis("equal") - plt.title("tidal_model="+str(tidal_model)+", dt_mode="+str(dt_mode)+", dt="+str(dt)+", end_time="+str(end_time)+"\n"+appendix) - #plt.show() - - instance.stop() - - def test7(self): - ''' - #Test collisions (replace particles) - ''' - - def merge_two_stars(bodies, particles_in_encounter): - com_pos = particles_in_encounter.center_of_mass() - com_vel = particles_in_encounter.center_of_mass_velocity() - d = (particles_in_encounter[0].position - particles_in_encounter[1].position) - v = (particles_in_encounter[0].velocity - particles_in_encounter[1].velocity) - new_particle=Particles(1) - new_particle.mass = particles_in_encounter.total_mass() - new_particle.position = com_pos - new_particle.velocity = com_vel - new_particle.radius = particles_in_encounter.radius.sum() - bodies.add_particles(new_particle) - bodies.remove_particles(particles_in_encounter) - - - converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) - instance = Tidymess(converter) - - system = Particles(6) - - # planeet staat stil - system[0].mass = 1.0 | u.MEarth - system[0].x = -2e8 | u.m - system[0].y = 0.0 | u.m - system[0].z = 0.0 | u.m - system[0].vx = 0.0 | u.m/u.s - system[0].vy = 0.0 | u.m/u.s - system[0].vz = 0.0 | u.m/u.s - system[0].radius = 3000 | u.km - system[0].index = 0 - - # 1e botser van boven - system[1].mass = 0.1 | u.kg - system[1].x = 0.0 | u.m - system[1].y = -1.0e8 | u.m - system[1].z = 0.0 | u.m - system[1].vx = 0.0 | u.m/u.s - system[1].vy = 1.0e3 | u.m/u.s - system[1].vz = 0.0 | u.m/u.s - system[1].radius = 3000 | u.km - system[1].index = 1 - - # 1e botser van beneden - system[2].mass = 0.1 | u.kg - system[2].x = 100 | u.m - system[2].y = 1.0e8 | u.m - system[2].z = 0.0 | u.m - system[2].vx = 0.0 | u.m/u.s - system[2].vy = -1.0e3 | u.m/u.s - system[2].vz = 0.0 | u.m/u.s - system[2].radius = 3000 | u.km - system[2].index = 2 - - # 2e botser van boven - system[3].mass = 0.1 | u.kg - system[3].x = 1.0e8 | u.m - system[3].y = -2.0e8 | u.m - system[3].z = 0.0 | u.m - system[3].vx = 0.0 | u.m/u.s - system[3].vy = 1.0e3 | u.m/u.s - system[3].vz = 0.0 | u.m/u.s - system[3].radius = 3000 | u.km - system[3].index = 3 - - # 2e botser van beneden - system[4].mass = 0.1 | u.kg - system[4].x = 1.0e8 | u.m - system[4].y = 2.0e8 | u.m - system[4].z = 0.0 | u.m - system[4].vx = 0.0 | u.m/u.s - system[4].vy = -1.0e3 | u.m/u.s - system[4].vz = 0.0 | u.m/u.s - system[4].radius = 3000 | u.km - system[4].index = 4 - - # botst niet - system[5].mass = 0.1 | u.kg - system[5].x = 1.4e8 | u.m - system[5].y = 0.0 | u.m - system[5].z = 0.0 | u.m - system[5].vx = 0.0 | u.m/u.s - system[5].vy = 1.0e3 | u.m/u.s - system[5].vz = 0.0 | u.m/u.s - system[5].radius = 3000 | u.km - system[5].index = 5 - - instance.particles.add_particles(system) - - appendix = "" - - tidal_model = 0 - instance.set_tidal_model(tidal_model) - dt_mode = 2 - instance.set_dt_mode(dt_mode) - - - # Running gravity code - end_time = 5 - dt = end_time/13 - times = np.arange(0, end_time, dt) | u.day - - planet_pos = instance.get_position(0) - moon_pos = instance.get_position(1) - - def get_particle_indices(): - N = instance.get_number_of_particles() - idx = instance.get_index_of_first_particle() - indices = [idx] - while len(indices) < N: - idx = instance.get_index_of_next_particle(idx) - indices.append(idx) - return indices - - # Empty lists for properties to track - positions = [[], [], [], [], [], []] - self.assertEquals(len(positions), instance.get_number_of_particles()) - channel = instance.particles.new_channel_to(system) - - instance.set_collision_mode(3) # 0=off, 1=ignore, 2=exception, 3=replace - - for t in times: - print("\ntijd:", t) - - instance.evolve_model(t) - - indices = get_particle_indices() - print("indices:", indices) - for idx in indices: - pos = instance.get_position(idx) - positions[idx].append([pos[0].number, pos[1].number, pos[2].number]) - - collision_flag, n_collisions, collider1, collider2 = instance.detect_collision() - if n_collisions > 0: - print("botsing! deeltjes", collider1, "en", collider2) - - particle_indices = [] - for i in range(len(system)): - if system[i].index in [collider1, collider2]: - particle_indices.append(i) - encountering_particles = system[particle_indices] - - indices.remove(collider1) - indices.remove(collider2) - indices.append(max(indices)+1) - merge_two_stars(system, encountering_particles) - system[-1].index = max(indices) - system.synchronize_to(instance.particles) - positions.append([]) - print("new system indices:",system.index) - else: - print("geen botsingen") - channel.copy() - - for i in range(len(positions)): - pos = np.asarray(positions[i]) - plt.plot(pos[:,0], pos[:,1], marker='.', alpha=0.5) - - plt.axis("equal") - plt.title("tidal_model="+str(tidal_model)+", dt_mode="+str(dt_mode)+", dt="+str(dt)+", end_time="+str(end_time)+"\n"+appendix) - #plt.show() - - instance.stop() From c95915363922a23a863a5f9ddefcfc2e3501a586 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 12 Mar 2026 16:52:25 +0100 Subject: [PATCH 104/174] Tidymess interface.py refactor convert_spin_vectors_to_inertial --- src/amuse_tidymess/interface.cc | 53 +++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index a5b25d9369..9f7cb9dea2 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -979,29 +979,44 @@ int get_gravity_at_point( } -// compute spin vector (largely copied from Initializer) -int convert_spin_vectors_to_inertial(double P, double obl, double psi, double * wx, double * wy, double * wz) { +/** + * Convert spin LOD, OBL, PSI to spin vector wx, wy, wz + */ +int convert_spin_vectors_to_inertial( + double P, + double obl, + double psi, + double* wx, + double* wy, + double* wz +) { + if (!wx || !wy || !wz) + return -1; - if(P == 0) { - *wx = 0.; - *wy = 0.; - *wz = 0.; - } - else { - double wmag = 2*M_PI/P; + if(P == 0) { + *wx = 0.0; + *wy = 0.0; + *wz = 0.0; + } + else if (P < 0) { + return -2; + } + else { + double wmag = 2*M_PI/P; - std::vector w_vec(3); - w_vec[0] = 0; - w_vec[1] = 0; - w_vec[2] = wmag; + std::vector w_vec(3); + w_vec[0] = 0; + w_vec[1] = 0; + w_vec[2] = wmag; - w_vec = init.rotZrotX(psi, obl, w_vec); + w_vec = init.rotZrotX(psi, obl, w_vec); - *wx = w_vec[0]; - *wy = w_vec[1]; - *wz = w_vec[2]; - } - return 0;} + *wx = w_vec[0]; + *wy = w_vec[1]; + *wz = w_vec[2]; + } + return 0; +} int detect_collision( int* collision_flag, From 3fe3bcefc276dcd0754cdc66ede8ccd67e86fc0c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 12 Mar 2026 16:55:23 +0100 Subject: [PATCH 105/174] Tidymess interface.py cleanup --- src/amuse_tidymess/interface.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index dd2a31625d..01ce133bd5 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1204,8 +1204,10 @@ def detect_collision(): @legacy_function def convert_spin_vectors_to_inertial(): - ''' - ''' + """ + Function to convert a spin vector in the form of + LOD, OBL, PSI to {wx, wy, wz} + """ function = LegacyFunctionSpecification() function.addParameter( 'lod', @@ -1244,7 +1246,14 @@ def convert_spin_vectors_to_inertial(): description='' ) function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """\ + 0 - OK + spin converted to inertial frame succesfully + -1 - ERROR + Could not convert to inertial frame + -2 - ERROR + Negative length of day detected + """ return function From 34bbdea5fdcf98d436faf31a2b2a762c7da24330 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Mar 2026 15:41:53 +0100 Subject: [PATCH 106/174] added HD80606b initial conditions to tidymess tests --- src/amuse_tidymess/tests/test_tidymess.py | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index da58b0f626..065d8bddbd 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -2,6 +2,7 @@ import matplotlib.pyplot as plt from amuse.support.testing.amusetest import TestWithMPI +from amuse.units.quantities import VectorQuantity from amuse_tidymess.interface import Tidymess, TidymessInterface from amuse.units import units as u from amuse.units import constants as c @@ -348,6 +349,53 @@ def jupiter_io_system(self): return system + + def HD80606b_system(self): + """ + Initial conditions for the exoplanet system + HD80606b. Initial conditions from Tidymess. + """ + HD80606 = Particles(2) + star, planet = generate_binaries( + primary_mass=2.0088092e30 | u.kg, + secondary_mass=7.7459434e27 | u.kg, + semi_major_axis=0.455 | u.au, + eccentricity=0.9330 + ) + HD80606[0].name = 'HD80606' + HD80606[0].mass = star.mass + HD80606[0].radius = 702455.0 | u.km + HD80606[0].x = star.x.as_quantity_in(u.km) + HD80606[0].y = star.y.as_quantity_in(u.km) + HD80606[0].z = star.z.as_quantity_in(u.km) + HD80606[0].vx = star.vx.as_quantity_in(u.kms) + HD80606[0].vy = star.vy.as_quantity_in(u.kms) + HD80606[0].vz = star.vz.as_quantity_in(u.kms) + HD80606[0].xi = 0.07 + HD80606[0].kf = 0.0 + HD80606[0].tau = 0.0 | u.yr + HD80606[0].wx = 0.0 | 1 / u.s + HD80606[0].wy = 0.0 | 1 / u.s + HD80606[0].wz = 2.97188607137e-6 | 1 / u.s + + HD80606[1].name = 'HD80606b' + HD80606[1].mass = planet.mass + HD80606[1].radius = 68488.3446 | u.km + HD80606[1].x = planet.x.as_quantity_in(u.km) + HD80606[1].y = planet.y.as_quantity_in(u.km) + HD80606[1].z = planet.z.as_quantity_in(u.km) + HD80606[1].vx = planet.vx.as_quantity_in(u.kms) + HD80606[1].vy = planet.vy.as_quantity_in(u.kms) + HD80606[1].vz = planet.vz.as_quantity_in(u.kms) + HD80606[1].xi = 0.25 + HD80606[1].kf = 0.5 + HD80606[1].tau = 1e-2 | u.yr + HD80606[1].wx = 0.0 | 1 / u.s + HD80606[1].wy = 0.0 | 1 / u.s + HD80606[1].wz = 0.000145444104333 | 1 / u.s + + return HD80606 + def test1(self): """ Test Tidymess parameters attribute and their defaults From 96f2b1919b18f01fc7dd8dc0e26f00a2a8b79447 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Mar 2026 15:42:18 +0100 Subject: [PATCH 107/174] refactored tidymess test4 and 5 evolving with and without tides --- src/amuse_tidymess/tests/test_tidymess.py | 170 +++++++++++----------- 1 file changed, 84 insertions(+), 86 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 065d8bddbd..72f2a895f1 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -518,129 +518,127 @@ def test3(self): spin = instance.convert_spin_vectors_to_inertial(lod, obl, psi) - self.assertAlmostEquals(spin[0], 0 | 1 / u.s) - self.assertAlmostEquals(spin[1], -1.26280518349e-5 | 1 / u.s) - self.assertAlmostEquals(spin[2], 7.16172407885e-5 | 1 / u.s) + self.assertAlmostEquals(spin[0], 0 | 1/u.s) + self.assertAlmostEquals(spin[1], -1.26280518349e-5 | 1/u.s) + self.assertAlmostEquals(spin[2], 7.16172407885e-5 | 1/u.s) instance.stop() def test4(self): """ - Evolve a system of Particles + Evolve a system of Particles without tides """ - system = self.earth_moon_system() + end_time = 1 | u.yr + dt_diag = 1e-4 | u.yr + system = self.earth_moon_system() converter = nbody_system.nbody_to_si( - system.mass.sum(), system[0].position.length() + system.mass.sum(), end_time ) + instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None instance.parameters.tidal_model = 0 instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.0625 instance.commit_parameters() instance.particles.add_particles(system) - - ratio = instance.get_total_mass() / system.mass.sum() - self.assertAlmostEquals(ratio, 1) - - end_time = 1.1 - dt = 0.1 - times = np.arange(0, end_time, dt) | u.yr - - planet_positions = np.zeros((times.shape[0], 3)) - moon_positions = np.zeros_like(planet_positions) channel = instance.particles.new_channel_to(system) - for i, t in enumerate(times): + times = [] | u.yr + times.append(0.0 | u.yr) + particles = [system.copy()] - instance.evolve_model(t) + while instance.model_time < end_time: + time = instance.model_time + dt_diag + instance.evolve_model(time) channel.copy() - planet_positions[i] = system[0].position.number - moon_positions[i] = system[1].position.number + particles.append(system.copy()) + times.append(instance.model_time) - evol_time = instance.get_time() - year = u.yr.in_(u.s) - - self.assertAlmostEquals(evol_time, year) - self.assertNotEqual(planet_positions[0,0], planet_positions[-1,0]) - self.assertNotEqual(moon_positions[0,0], moon_positions[-1,0]) + self.assertAlmostEquals( + particles[-1].position[0], + VectorQuantity([3554487.97163, -3026275.21595, 0.0], u.m), + places=5 + ) + self.assertAlmostEquals( + particles[-1].position[1], + VectorQuantity([-289132566.932, 246166178.762, 0.0], u.m), + places=3 + ) + self.assertAlmostEquals( + particles[-1].velocity[0], + VectorQuantity([8.06599003995, 9.47384574385, 0.0], u.ms), + places=4 + ) + self.assertAlmostEquals( + particles[-1].velocity[1], + VectorQuantity([-656.111491645, -770.630639491, 0.0], u.ms), + places=4 + ) + self.assertAlmostRelativeEqual(times[-1], end_time, places=3) instance.stop() def test5(self): """ - Evolve a system. + Evolve the HD80606b exoplanet system with tides """ + end_time = 2e3 | u.yr + dt_diag = 1 | u.yr - converter = nbody_system.nbody_to_si(1|u.MEarth, 1|u.REarth) - instance = self.new_instance_of_an_optional_code(Tidymess, converter) - assert instance is not None - - index_earth = instance.new_particle( - 1.0 | u.MEarth, - -4.6706380895356489e+06 | u.m, - 0.0000000000000000e+00 | u.m, - 0.0000000000000000e+00 | u.m, - 0.0000000000000000e+00 | u.m / u.s, - -1.2449006368729913e+01 | u.m / u.s, - 0.0000000000000000e+00 | u.m / u.s, - ) - self.assertEquals(index_earth, 0) - - index_moon = instance.new_particle( - 7.3460000000000003e+22 | u.kg, - 3.7972936191046441e+08 | u.m, - 0.0000000000000000e+00 | u.m, - 0.0000000000000000e+00 | u.m, - 0.0000000000000000e+00 | u.m / u.s, - 1.0121215033569634e+03 | u.m / u.s, - 0.0000000000000000e+00 | u.m / u.s, + system = self.HD80606b_system() + converter = nbody_system.nbody_to_si( + system.mass.sum(), end_time ) - self.assertEquals(index_moon, 1) - appendix = "dt_sgn changed (>=)" - tidal_model = 0 - instance.set_tidal_model(tidal_model) - dt_mode = 2 - instance.set_dt_mode(dt_mode) - - # Empty lists for properties to track - star_positions = [] - planet_positions = [] - moon_positions = [] - - # Running gravity code - end_time = 0.1 - dt = 0.01 - times = np.arange(0, end_time, dt) | u.yr - - planet_pos = instance.get_position(0) - moon_pos = instance.get_position(1) - - for t in times: + instance = self.new_instance_of_an_optional_code(Tidymess, converter) + assert instance is not None - instance.evolve_model(t) + instance.parameters.tidal_model = 4 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.0625 + instance.commit_parameters() - planet_pos = instance.get_position(0) - moon_pos = instance.get_position(1) + instance.particles.add_particles(system) + channel = instance.particles.new_channel_to(system) - planet_positions.append([planet_pos[0].number, planet_pos[1].number, planet_pos[2].number]) - moon_positions.append([moon_pos[0].number, moon_pos[1].number, moon_pos[2].number]) + times = [] | u.yr + times.append(0.0 | u.yr) + particles = [system.copy()] - planet_positions = np.asarray(planet_positions) - moon_positions = np.asarray(moon_positions) + while instance.model_time < end_time: + time = instance.model_time + dt_diag + instance.evolve_model(time) + channel.copy() - #plt.plot(planet_positions[:,0], planet_positions[:,1], marker='.') - #plt.plot(moon_positions[:,0], moon_positions[:,1], marker='.') - #plt.axis("equal") - #plt.title("tidal_model="+str(tidal_model)+", dt_mode="+str(dt_mode)+", dt="+str(dt)+", end_time="+str(end_time)+"\n"+appendix) - #plt.savefig("figures/tidal_model="+str(tidal_model)+", dt_mode="+str(dt_mode)+", dt="+str(dt)+", end_time="+str(end_time)+", "+appendix+".png") - #plt.show() + particles.append(system.copy()) + times.append(instance.model_time) - self.assertNotEqual(planet_positions[0,0],planet_positions[-1,0]) - self.assertNotEqual(planet_positions[0,1],planet_positions[-1,1]) + # check that the last snapshot is correct + self.assertAlmostEquals( + particles[-1].position[0], + VectorQuantity([137405.552133, -84398.2017397, 0.0], u.km), + places=5 + ) + self.assertAlmostEquals( + particles[-1].position[1], + VectorQuantity([-35634334.1197, 21887570.4121, 0.0], u.km), + places=4 + ) + self.assertAlmostEquals( + particles[-1].velocity[0], + VectorQuantity([0.249251771924, -0.0361309584992, 0.0], u.kms), + places=4 + ) + self.assertAlmostEquals( + particles[-1].velocity[1], + VectorQuantity([-64.6401899292, 9.37009194233, 0.0], u.kms), + places=4 + ) + self.assertAlmostRelativeEqual(times[-1], end_time, places=3) instance.stop() From 4043bd03e9f1fd578d751a38130d8d716017bcf8 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Mar 2026 17:03:06 +0100 Subject: [PATCH 108/174] tidymess interface.cc cleanup --- src/amuse_tidymess/interface.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 9f7cb9dea2..465f994485 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -714,11 +714,11 @@ int initialize_code(){ return 0;} int cleanup_code() { - // """ + // FIXME // Run the cleanup for the code, called // just before stopping the code. No functions // should be called after this code. - // """ + // return 0; } @@ -777,6 +777,9 @@ int get_kinetic_energy(double* kinetic_energy) { return 0; } +/** + * Get potential energy + */ int get_potential_energy(double* potential_energy) { if (!potential_energy) return -1; *potential_energy = tidymess.get_potential_energy(); @@ -980,7 +983,9 @@ int get_gravity_at_point( /** - * Convert spin LOD, OBL, PSI to spin vector wx, wy, wz + * Convert spin vector {length of day, obliquity, spin precession angle} + * to spin vector {wx, wy, wz}. Logic copied from Tidymess + * Initializer::convert_spin_vectors_to_inertial() */ int convert_spin_vectors_to_inertial( double P, From 5e9667f57bea7baf1a83a00c24193de715483b3e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Mar 2026 17:20:28 +0100 Subject: [PATCH 109/174] tidymess interface.cc cleanup --- src/amuse_tidymess/interface.cc | 35 +++++---------------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 465f994485..ebae3a792a 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -939,10 +939,6 @@ int get_index_of_next_particle( return 0; } -int synchronize_model() { - return 0; -} - int get_potential_at_point( double* eps, double* x, @@ -981,7 +977,6 @@ int get_gravity_at_point( return 0; } - /** * Convert spin vector {length of day, obliquity, spin precession angle} * to spin vector {wx, wy, wz}. Logic copied from Tidymess @@ -1023,6 +1018,11 @@ int convert_spin_vectors_to_inertial( return 0; } +int synchronize_model() { + return 0; +} + +// FIXME int detect_collision( int* collision_flag, int* n_collisions, @@ -1044,28 +1044,3 @@ int detect_collision( return 0; } - -// int merge_collided_particles(int * number_of_particles) { -// vector bodies = tidymess.get_particles(); -// vector< array > cindex = tidymess.get_collision_indices(); -// collision.replace(bodies, cindex); - -// tidymess.set_particles(bodies); -// tidymess.commit_particles(); - -// *number_of_particles = bodies.size(); -// return 0; -// } -int merge_collided_particles(int* number_of_particles) { - if (!number_of_particles) return -1; - - std::vector& bodies = tidymess.bodies; - std::vector< array > cindex = tidymess.get_collision_indices(); - - collision.replace(bodies, cindex); - //tidymess.set_particles(bodies); - tidymess.commit_particles(); - - *number_of_particles = bodies.size(); - return 0; -} From 9c149282b6ff6b3fae2edb52360de176c02cc4fa Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Mar 2026 17:21:35 +0100 Subject: [PATCH 110/174] interface.py tidymess cleanup --- src/amuse_tidymess/interface.py | 100 +++++++++++++------------------- 1 file changed, 40 insertions(+), 60 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 01ce133bd5..2d5aadaa35 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -6,7 +6,7 @@ from amuse.rfi.core import CodeInterface, legacy_function, LegacyFunctionSpecification from amuse.support.interface import MethodWithUnitsDefinition from amuse.support.literature import LiteratureReferencesMixIn -from amuse.units import generic_unit_system, nbody_system +from amuse.units import units as u, generic_unit_system, nbody_system class TidymessInterface( @@ -1159,54 +1159,54 @@ def get_num_integration_step(): description='' ) function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """""" return function - @legacy_function - def detect_collision(): - ''' - ''' - function = LegacyFunctionSpecification() - function.addParameter( - 'collision_flag', - dtype='int32', - direction=function.OUT, - description='' - ) - function.addParameter( - 'n_collisions', - dtype='int32', - direction=function.OUT, - description='' - ) - function.addParameter( - 'index1', - dtype='int32', - direction=function.OUT, - description='' - ) - function.addParameter( - 'index2', - dtype='int32', - direction=function.OUT, - description='' - ) - #function.addParameter( - # 'indices_of_colliding_particles', dtype='int32', direction=function.OUT, - # description="") - function.result_type = 'int32' - function.result_doc = '''''' - - return function + # @legacy_function + # def detect_collision(): + # ''' + # ''' + # function = LegacyFunctionSpecification() + # function.addParameter( + # 'collision_flag', + # dtype='int32', + # direction=function.OUT, + # description='' + # ) + # function.addParameter( + # 'n_collisions', + # dtype='int32', + # direction=function.OUT, + # description='' + # ) + # function.addParameter( + # 'index1', + # dtype='int32', + # direction=function.OUT, + # description='' + # ) + # function.addParameter( + # 'index2', + # dtype='int32', + # direction=function.OUT, + # description='' + # ) + # #function.addParameter( + # # 'indices_of_colliding_particles', dtype='int32', direction=function.OUT, + # # description="") + # function.result_type = 'int32' + # function.result_doc = '''''' + + # return function @legacy_function def convert_spin_vectors_to_inertial(): """ - Function to convert a spin vector in the form of - LOD, OBL, PSI to {wx, wy, wz} + Convert spin vector {length of day, obliquity, spin precession angle} + to spin vector {wx, wy, wz} """ function = LegacyFunctionSpecification() function.addParameter( @@ -1258,26 +1258,6 @@ def convert_spin_vectors_to_inertial(): return function - @legacy_function - def merge_collided_particles(): - ''' - ''' - function = LegacyFunctionSpecification() - function.addParameter( - 'number_of_particles', - dtype='int32', - direction=function.OUT, - description=( - 'should be equivalent to collision ' - 'handling when collision_mode==3' - ) - ) - function.result_type = 'int32' - function.result_doc = '''''' - - return function - - class Tidymess(GravitationalDynamics, GravityFieldCode): def __init__(self, convert_nbody=None, **options): From 837f0f195f2adbb09e9dafdfa6f574e23c44c346 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Mar 2026 17:31:28 +0100 Subject: [PATCH 111/174] tidymess interface.py define_methods units cleanup --- src/amuse_tidymess/interface.py | 63 +++++++++++++++------------------ 1 file changed, 29 insertions(+), 34 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 2d5aadaa35..29822e6591 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1323,17 +1323,18 @@ def define_methods(self, handler): generic_unit_system.speed, generic_unit_system.speed, generic_unit_system.speed, - generic_unit_system.length, # radius - handler.NO_UNIT, # xi, moment of inertia factor - handler.NO_UNIT, # kf, fluid Love number for potential - generic_unit_system.time, # tau, fluid relaxation time - 1 / generic_unit_system.time, # wx - 1 / generic_unit_system.time, # wy - 1 / generic_unit_system.time, # wz - handler.NO_UNIT, # a_mb, magnetic braking coefficient + generic_unit_system.length, + handler.NO_UNIT, + handler.NO_UNIT, + generic_unit_system.time, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + handler.NO_UNIT, handler.ERROR_CODE, ) ) + handler.add_method( 'set_state', ( @@ -1345,14 +1346,14 @@ def define_methods(self, handler): generic_unit_system.speed, generic_unit_system.speed, generic_unit_system.speed, - generic_unit_system.length, # radius - handler.NO_UNIT, # xi, moment of inertia factor - handler.NO_UNIT, # kf, fluid Love number for potential - generic_unit_system.time, # tau, fluid relaxation time - 1 / generic_unit_system.time, # wx - 1 / generic_unit_system.time, # wy - 1 / generic_unit_system.time, # wz - handler.NO_UNIT, # a_mb, magnetic braking coefficient + generic_unit_system.length, + handler.NO_UNIT, + handler.NO_UNIT, + generic_unit_system.time, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + 1 / generic_unit_system.time, + handler.NO_UNIT, ), (handler.ERROR_CODE,) ) @@ -1362,6 +1363,7 @@ def define_methods(self, handler): (handler.INDEX,), (handler.NO_UNIT, handler.ERROR_CODE,) ) + handler.add_method( 'set_xi', (handler.INDEX, handler.NO_UNIT), @@ -1373,6 +1375,7 @@ def define_methods(self, handler): (handler.INDEX,), (handler.NO_UNIT, handler.ERROR_CODE,) ) + handler.add_method( 'set_kf', (handler.INDEX, handler.NO_UNIT), @@ -1384,14 +1387,16 @@ def define_methods(self, handler): (handler.INDEX,), (generic_unit_system.time, handler.ERROR_CODE,) ) + handler.add_method( 'set_tau', (handler.INDEX, generic_unit_system.time), (handler.ERROR_CODE,) ) + handler.add_method( 'get_spin', - (handler.NO_UNIT), + (handler.INDEX,), ( 1/nbody_system.time, 1/nbody_system.time, @@ -1399,10 +1404,11 @@ def define_methods(self, handler): handler.ERROR_CODE ) ) + handler.add_method( 'set_spin', ( - handler.NO_UNIT, + handler.INDEX, 1/nbody_system.time, 1/nbody_system.time, 1/nbody_system.time, @@ -1415,29 +1421,18 @@ def define_methods(self, handler): (), (handler.INDEX, handler.ERROR_CODE) ) - handler.add_method( - 'detect_collision', - (), - ( - handler.INDEX, - handler.INDEX, - handler.INDEX, - handler.INDEX, - handler.ERROR_CODE - ) - ) handler.add_method( 'convert_spin_vectors_to_inertial', ( nbody_system.time, - handler.NO_UNIT, - handler.NO_UNIT, + u.rad, + u.rad, ), ( - 1/nbody_system.time, # wx - 1/nbody_system.time, # wy - 1/nbody_system.time, # wz + 1/nbody_system.time, + 1/nbody_system.time, + 1/nbody_system.time, handler.ERROR_CODE ) ) From cc673bd5856d441dacf1e5457e0fffff1f8369a6 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 16 Mar 2026 17:47:19 +0100 Subject: [PATCH 112/174] Tidymess interface.cc begin time refactor --- src/amuse_tidymess/interface.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index ebae3a792a..0150cf6b93 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -756,6 +756,7 @@ int commit_particles() { tidymess.update_angular_momentum(); } + tidymess.set_model_time(begin_time); tidymess.commit_parameters(); return 0; } @@ -795,14 +796,20 @@ int get_time(double* time) { return 0; } - +/** + * Get Tidymess simulation start time + */ int get_begin_time(double* time) { if (!time) return -1; *time = begin_time; return 0; } +/** + * Set Tidymess simulation start time + */ int set_begin_time(double time) { begin_time = time; + tidymess.set_model_time(begin_time); return 0; } @@ -1029,7 +1036,6 @@ int detect_collision( int* index1, int* index2 ) { - // Collision handling *collision_flag = tidymess.get_collision_flag(); std::vector< array > collided_indices = tidymess.get_collision_indices(); *n_collisions = collided_indices.size(); From f5f0e6718d6a75cbc9e03acb5bef18c6caf10767 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 18 Mar 2026 11:33:10 +0100 Subject: [PATCH 113/174] rm unused param in determine_dt_sign tidymess interface.cc : --- src/amuse_tidymess/interface.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 0150cf6b93..bd2d6eddeb 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -52,14 +52,11 @@ int get_body_index_by_id(int index_of_the_particle) { * in time. copied from tidymess.cpp */ int determine_dt_sgn(double t_end) { - bool dt_pos; - - if(t_end > tidymess.get_model_time()) { // ** takes negative time step when evolving to 0, causes problems - dt_pos = true; + // ** takes negative time step when evolving to 0, causes problems + if(t_end > tidymess.get_model_time()) { dt_sign = 1; } else { - dt_pos = false; dt_sign = -1; } tidymess.set_dt_sgn(dt_sign); From 8a3c9d4f65b1b3862dd2b0f340c1b0c330b16a22 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 18 Mar 2026 11:34:31 +0100 Subject: [PATCH 114/174] added logic to commit_parameters and recommit_parameters tidymess interface.cc --- src/amuse_tidymess/interface.cc | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index bd2d6eddeb..8dd19f105b 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -694,7 +694,7 @@ int get_num_integration_step(int* num_integration_step) { return 0; } -int initialize_code(){ +int initialize_code() { // // Run the initialization for the code, called before // any other call on the code (so before any parameters @@ -708,7 +708,8 @@ int initialize_code(){ // reset id counter? //particle_id_counter = 0; - return 0;} + return 0; +} int cleanup_code() { // FIXME @@ -725,16 +726,17 @@ int cleanup_code() { * have been set or updated. */ int commit_parameters() { - //tidymess.commit_parameters(); + tidymess.set_model_time(begin_time); + tidymess.set_encounter_mode(); + tidymess.set_pointers(); + tidymess.upload_parameters(); return 0; } int recommit_parameters() { - // """ - // Perform initialization actions after parameters - // have been updated (after commit_parameters and - // particles have been loaded). - // """ + tidymess.set_encounter_mode(); + tidymess.set_pointers(); + tidymess.upload_parameters(); return 0; } From 667c5ca4ef4f39c0a9ea6c1c2984a6e468ec30df Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 18 Mar 2026 11:35:04 +0100 Subject: [PATCH 115/174] refactored commit_particles --- src/amuse_tidymess/interface.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 8dd19f105b..20f6e4034d 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -754,9 +754,7 @@ int commit_particles() { } tidymess.update_angular_momentum(); } - - tidymess.set_model_time(begin_time); - tidymess.commit_parameters(); + tidymess.initialize(); return 0; } From 8f07367a817296f6cf19fbecd021cfc2935826b0 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 18 Mar 2026 11:39:37 +0100 Subject: [PATCH 116/174] interface.cc cleanup tidymess --- src/amuse_tidymess/interface.cc | 137 +++++++++++++++++--------------- 1 file changed, 71 insertions(+), 66 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 20f6e4034d..8707ec7acc 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -443,32 +443,8 @@ int set_spin( return 0; } -/** - * FIXME - */ -int get_acceleration( - int index_of_the_particle, - double* ax, - double* ay, - double* az -) { - if (!ax || !ay || !az) return -1; - return 0; -} - -/** - * FIXME - */ -int get_potential(int index_of_the_particle, double* potential) { - if (!potential) return -1; - return 0; -} - int evolve_model(double time) { - // Evolve the model until the given time, or until a stopping condition is set. - // has to be called sometime before evolving - //tidymess.set_dt_sgn(dt_sign); determine_dt_sgn(time); tidymess.evolve_model(time); @@ -943,44 +919,6 @@ int get_index_of_next_particle( return 0; } -int get_potential_at_point( - double* eps, - double* x, - double* y, - double* z, - double* phi, - int npoints -) { - /*** - * FIX - */ - for (int i = 0; i < npoints; i++) { - phi[i] = 0.0; - } - return 0; -} - -int get_gravity_at_point( - double* eps, - double* x, - double* y, - double* z, - double* ax, - double* ay, - double* az, - int npoints -) { - /*** - * FIX - */ - for (int i = 0; i < npoints; i++) { - ax[i] = 0.0; - ay[i] = 0.0; - az[i] = 0.0; - } - return 0; -} - /** * Convert spin vector {length of day, obliquity, spin precession angle} * to spin vector {wx, wy, wz}. Logic copied from Tidymess @@ -1022,10 +960,6 @@ int convert_spin_vectors_to_inertial( return 0; } -int synchronize_model() { - return 0; -} - // FIXME int detect_collision( int* collision_flag, @@ -1047,3 +981,74 @@ int detect_collision( return 0; } + +/** + * Needed to compile the interface; + * not implemented yet + */ +int get_acceleration( + int index_of_the_particle, + double* ax, + double* ay, + double* az +) { + if (!ax || !ay || !az) return -1; + return 0; +} + +/** + * Needed to compile the interface; + * not implemented yet + */ +int get_potential(int index_of_the_particle, double* potential) { + if (!potential) return -1; + return 0; +} + +/** + * Needed to compile the interface; + * not implemented yet + */ +int get_potential_at_point( + double* eps, + double* x, + double* y, + double* z, + double* phi, + int npoints +) { + // for (int i = 0; i < npoints; i++) { + // phi[i] = 0.0; + // } + return 0; +} + +/** + * Needed to compile the interface; + * not implemented yet + */ +int get_gravity_at_point( + double* eps, + double* x, + double* y, + double* z, + double* ax, + double* ay, + double* az, + int npoints +) { + // for (int i = 0; i < npoints; i++) { + // ax[i] = 0.0; + // ay[i] = 0.0; + // az[i] = 0.0; + // } + return 0; +} + +/** + * Needed to compile the interface; + * not implemented yet + */ +int synchronize_model() { + return 0; +} From 0c66ce128e80576fbe74f4ec53f2ff8e8c8b62c5 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 19 Mar 2026 14:37:46 +0100 Subject: [PATCH 117/174] tidymess def test setting begin time --- src/amuse_tidymess/tests/test_tidymess.py | 44 +++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 72f2a895f1..ca25ac4458 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1,5 +1,8 @@ -import numpy as np -import matplotlib.pyplot as plt +""" +Date Created : December 10, 2025 +Last Updated : March 19, 2026 +Test Routine for Tidymess and TidymessInterface +""" from amuse.support.testing.amusetest import TestWithMPI from amuse.units.quantities import VectorQuantity @@ -8,7 +11,8 @@ from amuse.units import constants as c from amuse.units import nbody_system from amuse.datamodel import Particles -from amuse.ext.orbital_elements import generate_binaries, new_binary_from_orbital_elements +from amuse.ext.orbital_elements import generate_binaries +import numpy as np class TestTidymessInterface(TestWithMPI): @@ -525,6 +529,40 @@ def test3(self): instance.stop() def test4(self): + """ + Test that setting a begin time correctly creates a time offset + """ + dt = 5 | u.yr + begin_time = (50 | u.yr).as_quantity_in(u.s) + end_time = begin_time + dt + + system = self.earth_moon_system() + converter = nbody_system.nbody_to_si( + system.mass.sum(), 1 | u.au + ) + instance = self.new_instance_of_an_optional_code(Tidymess, converter) + assert instance is not None + + self.assertEquals(instance.get_begin_time(), instance.model_time) + self.assertEquals(instance.get_begin_time(), 0 | u.s) + + instance.parameters.tidal_model = 0 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.0625 + instance.set_begin_time(begin_time) + instance.commit_parameters() + + instance.particles.add_particles(system) + channel = instance.particles.new_channel_to(system) + + instance.evolve_model(instance.model_time + dt) + + self.assertEquals(instance.get_begin_time(), begin_time) + self.assertAlmostEquals(instance.model_time, end_time) + + instance.stop() + + def test5(self): """ Evolve a system of Particles without tides """ From 39ee237c34b82b1ed3793320a6d8d645d107d05e Mon Sep 17 00:00:00 2001 From: elkogerville Date: Thu, 19 Mar 2026 14:38:09 +0100 Subject: [PATCH 118/174] tidymess tests cleanup --- src/amuse_tidymess/tests/test_tidymess.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index ca25ac4458..f1e3a2d03d 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -571,7 +571,7 @@ def test5(self): system = self.earth_moon_system() converter = nbody_system.nbody_to_si( - system.mass.sum(), end_time + system.mass.sum(), 1 | u.au ) instance = self.new_instance_of_an_optional_code(Tidymess, converter) @@ -600,28 +600,28 @@ def test5(self): self.assertAlmostEquals( particles[-1].position[0], VectorQuantity([3554487.97163, -3026275.21595, 0.0], u.m), - places=5 + places=1 ) self.assertAlmostEquals( particles[-1].position[1], VectorQuantity([-289132566.932, 246166178.762, 0.0], u.m), - places=3 + places=1 ) self.assertAlmostEquals( particles[-1].velocity[0], VectorQuantity([8.06599003995, 9.47384574385, 0.0], u.ms), - places=4 + places=1 ) self.assertAlmostEquals( particles[-1].velocity[1], VectorQuantity([-656.111491645, -770.630639491, 0.0], u.ms), - places=4 + places=1 ) self.assertAlmostRelativeEqual(times[-1], end_time, places=3) instance.stop() - def test5(self): + def test6(self): """ Evolve the HD80606b exoplanet system with tides """ @@ -660,7 +660,7 @@ def test5(self): self.assertAlmostEquals( particles[-1].position[0], VectorQuantity([137405.552133, -84398.2017397, 0.0], u.km), - places=5 + places=4 ) self.assertAlmostEquals( particles[-1].position[1], From 5f97b8a99caa30d42236b174e88bd8cc40fda4ce Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 20 Mar 2026 11:44:18 +0100 Subject: [PATCH 119/174] tidymess notes --- src/amuse_tidymess/interface.cc | 23 +++++++++++++---------- src/amuse_tidymess/interface.py | 2 +- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 8707ec7acc..b9ca0f2295 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -27,6 +27,15 @@ static double begin_time = 0; static int init_shape = 0; static int dt_sign = 1; + +/** + * Check that begin time is an offset + * rn begin time is set in commit parameters but maybe can be moved + * test if u can evolve backwards in time (first w no tides, and if with tides use tidal model 1) + * test that dtconst requires units + * + */ + // TIDYMESS HELPER FUNCTIONS /** @@ -624,31 +633,25 @@ int set_initial_shape(int initial_shape) { int get_collision_mode(int* collision_mode) { if (!collision_mode) return -1; - if (tidymess.get_collision_mode() != collision.collision_mode) - return -1; - *collision_mode = tidymess.get_collision_mode(); - - // maybe check if Tidy and Collision have the same value set return 0; } + int set_collision_mode(int collision_mode) { tidymess.set_collision_mode(collision_mode); - collision.set_collision_mode(collision_mode); - collision.setup(); return 0; } int get_roche_mode(int* roche_mode) { if (!roche_mode) return -1; - *roche_mode = collision.roche_mode; // doesn't appear in Tidy + *roche_mode = tidymess.roche_mode; // doesn't appear in Tidy return 0; } int set_roche_mode(int roche_mode) { tidymess.set_roche_mode(roche_mode); - collision.set_roche_mode(roche_mode); // doesn't appear in Tidy - collision.setup(); + // collision.set_roche_mode(roche_mode); // doesn't appear in Tidy + // collision.setup(); return 0; } diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 29822e6591..aa7d72dc77 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1509,7 +1509,7 @@ def define_parameters(self, handler): 'set_dt_const', 'dt_const', ( - 'constant time step in units given by time_unit, ' # FIX + 'constant time step in units given by time_unit, ' # FIXME 'default=0.015625 (only used if dt_mode=0)' ), default_value=0.015625, From 039a8c513c763d479595f207113ce95e2970b55c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 24 Mar 2026 14:52:37 +0100 Subject: [PATCH 120/174] added cleanup code logic to tidymess interface.cc --- src/amuse_tidymess/interface.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index b9ca0f2295..897b43968b 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -106,8 +106,7 @@ int new_particle( newbody.set_id(particle_id_counter); - *index_of_the_particle = particle_id_counter; - particle_id_counter++; + *index_of_the_particle = particle_id_counter++; bodies.push_back(newbody); return 0; @@ -690,15 +689,18 @@ int initialize_code() { return 0; } + +/** + * Deallocate Tidymess bodies + */ int cleanup_code() { - // FIXME - // Run the cleanup for the code, called - // just before stopping the code. No functions - // should be called after this code. - // + std::vector& bodies = tidymess.bodies; + tidymess.bodies.clear(); + return 0; } + /** * Perform initialization in the code dependent on the * values of the parameters.Called after the parameters From 35716cb19ee7f234ece9ef873dd67c301c1ec741 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 24 Mar 2026 14:53:29 +0100 Subject: [PATCH 121/174] cleanup tidymess interface.py --- src/amuse_tidymess/interface.py | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index aa7d72dc77..992645518e 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -13,19 +13,20 @@ class TidymessInterface( CodeInterface, LiteratureReferencesMixIn, GravitationalDynamicsInterface, + GravityFieldInterface, StoppingConditionInterface, - GravityFieldInterface ): """ + Tidymess is a N-Body code with tides + .. [#] Boekholt & Correia (MNRAS 2023, vol. 522, pp. 2885–2900) """ include_headers = ['tidymess_worker.h', 'stopcond.h'] - - def __init__(self, **options): + def __init__(self, **kwargs): CodeInterface.__init__( - self, name_of_the_worker='tidymess_worker', **options + self, name_of_the_worker='tidymess_worker', **kwargs ) LiteratureReferencesMixIn.__init__(self) @@ -1581,22 +1582,6 @@ def define_parameters(self, handler): def define_particle_sets(self, handler): - handler.define_set('particles', 'index_of_the_particle') - handler.set_new('particles', 'new_particle') - handler.set_delete('particles', 'delete_particle') - handler.add_setter('particles', 'set_state') - handler.add_getter('particles', 'get_state') - handler.add_setter('particles', 'set_mass') - handler.add_getter('particles', 'get_mass', names=('mass',)) - handler.add_setter('particles', 'set_position') - handler.add_getter('particles', 'get_position') - handler.add_setter('particles', 'set_velocity') - handler.add_getter('particles', 'get_velocity') - handler.add_setter('particles', 'set_spin') - handler.add_getter('particles', 'get_spin') - handler.add_setter('particles', 'set_radius') - handler.add_getter('particles', 'get_radius') - handler.add_query( - 'particles', 'get_indices_of_colliding_particles', - public_name='select_colliding_particles' - ) + GravitationalDynamics.define_particle_sets(self, handler) + + self.stopping_conditions.define_particle_set(handler) From c2bd1442e49482d479cf3ff3983b18167ad27adb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 24 Mar 2026 14:54:08 +0100 Subject: [PATCH 122/174] add tidymess test to ensure particles are cleaned up --- src/amuse_tidymess/tests/test_tidymess.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index f1e3a2d03d..61021e59e3 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -164,6 +164,10 @@ def test2(self): self.assertEquals(result['num_integration_step'], 0) self.assertEqual(0, instance.cleanup_code()) + + result = instance.get_number_of_particles() + self.assertEquals(result['number_of_particles'], 0) + instance.stop() def test3(self): From a029b4d2965e0f5214132daa971af26b55606005 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 24 Mar 2026 14:55:05 +0100 Subject: [PATCH 123/174] fixed typo in amuse/rfi/core.py docstring --- src/amuse/rfi/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse/rfi/core.py b/src/amuse/rfi/core.py index 1a64358aee..fa9e5c8ea8 100644 --- a/src/amuse/rfi/core.py +++ b/src/amuse/rfi/core.py @@ -634,7 +634,7 @@ class LegacyFunctionSpecification(object): """Used to specify that a parameter is used as an output parameter, passed by reference""" INOUT = object() - """Used to specify that a parameter is used as an input and an outpur parameter, passed by reference""" + """Used to specify that a parameter is used as an input and an output parameter, passed by reference""" LENGTH = object() """Used to specify that a parameter is used as the length parameter for the other parameters""" From b7e7eeef866031dbc595ab72a45265e8514c1963 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 12:28:17 +0200 Subject: [PATCH 124/174] debugging logic to tidymess interface.cc --- src/amuse_tidymess/interface.cc | 119 +++++++++++++++++++++++++++++++- 1 file changed, 118 insertions(+), 1 deletion(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 897b43968b..5067ff1649 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -1,5 +1,7 @@ #include "tidymess_worker.h" +#include #include +#include #include // AMUSE STOPPING CONDITIONS SUPPORT @@ -26,6 +28,7 @@ static int particle_id_counter = 0; static double begin_time = 0; static int init_shape = 0; static int dt_sign = 1; +static bool print_info = false; /** @@ -109,6 +112,12 @@ int new_particle( *index_of_the_particle = particle_id_counter++; bodies.push_back(newbody); + if (print_info) { + cerr<<"printing particle in new_particle"<& bodies = tidymess.bodies; + + int N = static_cast(bodies.size()); + + + for(int i = 0; i < N; i++) { + Cm += bodies[i].m; + } + + if(Cm == 0) { + std::cerr<<"The cumulative mass of the N-body system is zero! Please include a non-zero mass body."< 0) { switch(init_shape) { case 0: @@ -734,8 +823,31 @@ int commit_particles() { return -1; } tidymess.update_angular_momentum(); + cerr<<"printing particles after update_angular_momentum"< Date: Wed, 1 Apr 2026 12:29:28 +0200 Subject: [PATCH 125/174] added unit to dt_const param in tidymess interface.py --- src/amuse_tidymess/interface.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 992645518e..f301f414c7 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -890,7 +890,8 @@ def get_dt_const(): 'dt_const', dtype='float64', direction=function.OUT, - description='' + description='', + unit=generic_unit_system.time ) function.result_type = 'int32' function.result_doc = """\ @@ -911,7 +912,8 @@ def set_dt_const(): 'dt_const', dtype='float64', direction=function.IN, - description='' + description='', + unit=generic_unit_system.time ) function.result_type = 'int32' function.result_doc = """\ @@ -1455,6 +1457,7 @@ def define_parameters(self, handler): Users should not use: Tidymess.set_param_name(value) """ + GravitationalDynamics.define_parameters(self, handler) handler.add_method_parameter( 'get_tidal_model', 'set_tidal_model', @@ -1513,7 +1516,7 @@ def define_parameters(self, handler): 'constant time step in units given by time_unit, ' # FIXME 'default=0.015625 (only used if dt_mode=0)' ), - default_value=0.015625, + default_value=0.015625 | generic_unit_system.time, is_vector=False, must_set_before_get=False, ) From 6427168396412ae6cc8a88c7c00041eaa2b5b132 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 1 Apr 2026 12:29:41 +0200 Subject: [PATCH 126/174] tidymess print particles fn --- src/amuse_tidymess/interface.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index f301f414c7..5c6321d712 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1166,6 +1166,18 @@ def get_num_integration_step(): return function + @legacy_function + def print_particles(): + function = LegacyFunctionSpecification() + function.addParameter( + 'print_wtides', + dtype='bool', + direction=function.IN + ) + function.result_type = 'int32' + + return function + # @legacy_function # def detect_collision(): @@ -1293,6 +1305,12 @@ def define_methods(self, handler): GravitationalDynamics.define_methods(self, handler) + handler.add_method( + 'print_particles', + (handler.NO_UNIT,), + (handler.ERROR_CODE) + ) + handler.add_method( 'new_particle', ( From b1849969bc028466dd9d1ea79d4c35a690e934b7 Mon Sep 17 00:00:00 2001 From: Elko Gerville-Reache <129769199+elkogerville@users.noreply.github.com> Date: Tue, 14 Apr 2026 15:51:18 +0200 Subject: [PATCH 127/174] changed tidymess interface.cc bodies to be accessed by smart pointer --- src/amuse_tidymess/interface.cc | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 5067ff1649..d255e38c48 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -19,16 +19,17 @@ #include "Collision.h" #include "Breakup.h" -static Tidy tidymess; -static Initializer init; -static Collision collision; -static Breakup breakup; +std::unique_ptr tidymess; -static int particle_id_counter = 0; -static double begin_time = 0; -static int init_shape = 0; -static int dt_sign = 1; -static bool print_info = false; +Initializer init; +Collision collision; +Breakup breakup; + +int particle_id_counter = 0; +double begin_time = 0; +int init_shape = 0; +int dt_sign = 1; +bool print_info = false; /** @@ -65,13 +66,13 @@ int get_body_index_by_id(int index_of_the_particle) { */ int determine_dt_sgn(double t_end) { // ** takes negative time step when evolving to 0, causes problems - if(t_end > tidymess.get_model_time()) { + if(t_end > tidymess->get_model_time()) { dt_sign = 1; } else { dt_sign = -1; } - tidymess.set_dt_sgn(dt_sign); + tidymess->set_dt_sgn(dt_sign); return 0; } @@ -759,7 +760,8 @@ int normalize_initial_conditions() { } int initialize_code() { - std::cerr<<"PLEASE"< (); + //std::cerr<<"PLEASE"<& bodies = tidymess.bodies; - tidymess.bodies.clear(); + std::vector& bodies = tidymess->bodies; + tidymess.reset(); // reset to point to Null + // tidymess.bodies.clear(); return 0; } From da5f53531314094b2c186012da7cf0b351913ced Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 24 Apr 2026 16:50:34 +0200 Subject: [PATCH 128/174] refactor tidymess interface.cc to use unique_pointers --- src/amuse_tidymess/interface.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index d255e38c48..841be8a5ea 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -3,6 +3,7 @@ #include #include #include +#include // AMUSE STOPPING CONDITIONS SUPPORT #include @@ -20,10 +21,9 @@ #include "Breakup.h" std::unique_ptr tidymess; - -Initializer init; -Collision collision; -Breakup breakup; +std::unique_ptr init; +std::unique_ptr collision; +std::unique_ptr breakup; int particle_id_counter = 0; double begin_time = 0; From 771e4cab0f91ec08263d5308e810cd986438d8df Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 24 Apr 2026 16:51:38 +0200 Subject: [PATCH 129/174] changed tidymess interface.py to use nbody_system over generic_unit_system --- src/amuse_tidymess/interface.py | 103 +++++++++++++------------------- 1 file changed, 42 insertions(+), 61 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 5c6321d712..90bfacb569 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -6,7 +6,7 @@ from amuse.rfi.core import CodeInterface, legacy_function, LegacyFunctionSpecification from amuse.support.interface import MethodWithUnitsDefinition from amuse.support.literature import LiteratureReferencesMixIn -from amuse.units import units as u, generic_unit_system, nbody_system +from amuse.units import units as u, nbody_system class TidymessInterface( @@ -891,7 +891,7 @@ def get_dt_const(): dtype='float64', direction=function.OUT, description='', - unit=generic_unit_system.time + unit=nbody_system.time ) function.result_type = 'int32' function.result_doc = """\ @@ -913,7 +913,7 @@ def set_dt_const(): dtype='float64', direction=function.IN, description='', - unit=generic_unit_system.time + unit=nbody_system.time ) function.result_type = 'int32' function.result_doc = """\ @@ -1166,19 +1166,6 @@ def get_num_integration_step(): return function - @legacy_function - def print_particles(): - function = LegacyFunctionSpecification() - function.addParameter( - 'print_wtides', - dtype='bool', - direction=function.IN - ) - function.result_type = 'int32' - - return function - - # @legacy_function # def detect_collision(): # ''' @@ -1305,29 +1292,23 @@ def define_methods(self, handler): GravitationalDynamics.define_methods(self, handler) - handler.add_method( - 'print_particles', - (handler.NO_UNIT,), - (handler.ERROR_CODE) - ) - handler.add_method( 'new_particle', ( - generic_unit_system.mass, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.length, # radius + nbody_system.mass, + nbody_system.length, + nbody_system.length, + nbody_system.length, + nbody_system.speed, + nbody_system.speed, + nbody_system.speed, + nbody_system.length, # radius handler.NO_UNIT, # xi, moment of inertia factor handler.NO_UNIT, # kf, fluid Love number for potential - generic_unit_system.time, # tau, fluid relaxation time - 1 / generic_unit_system.time, # wx - 1 / generic_unit_system.time, # wy - 1 / generic_unit_system.time, # wz + nbody_system.time, # tau, fluid relaxation time + 1 / nbody_system.time, # wx + 1 / nbody_system.time, # wy + 1 / nbody_system.time, # wz handler.NO_UNIT, # a_mb, magnetic braking coefficient ), (handler.INDEX, handler.ERROR_CODE) @@ -1337,20 +1318,20 @@ def define_methods(self, handler): 'get_state', (handler.INDEX), ( - generic_unit_system.mass, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.length, + nbody_system.mass, + nbody_system.length, + nbody_system.length, + nbody_system.length, + nbody_system.speed, + nbody_system.speed, + nbody_system.speed, + nbody_system.length, handler.NO_UNIT, handler.NO_UNIT, - generic_unit_system.time, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, + nbody_system.time, + 1 / nbody_system.time, + 1 / nbody_system.time, + 1 / nbody_system.time, handler.NO_UNIT, handler.ERROR_CODE, ) @@ -1360,20 +1341,20 @@ def define_methods(self, handler): 'set_state', ( handler.INDEX, - generic_unit_system.mass, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.length, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.speed, - generic_unit_system.length, + nbody_system.mass, + nbody_system.length, + nbody_system.length, + nbody_system.length, + nbody_system.speed, + nbody_system.speed, + nbody_system.speed, + nbody_system.length, handler.NO_UNIT, handler.NO_UNIT, - generic_unit_system.time, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, - 1 / generic_unit_system.time, + nbody_system.time, + 1 / nbody_system.time, + 1 / nbody_system.time, + 1 / nbody_system.time, handler.NO_UNIT, ), (handler.ERROR_CODE,) @@ -1406,12 +1387,12 @@ def define_methods(self, handler): handler.add_method( 'get_tau', (handler.INDEX,), - (generic_unit_system.time, handler.ERROR_CODE,) + (nbody_system.time, handler.ERROR_CODE,) ) handler.add_method( 'set_tau', - (handler.INDEX, generic_unit_system.time), + (handler.INDEX, nbody_system.time), (handler.ERROR_CODE,) ) @@ -1534,7 +1515,7 @@ def define_parameters(self, handler): 'constant time step in units given by time_unit, ' # FIXME 'default=0.015625 (only used if dt_mode=0)' ), - default_value=0.015625 | generic_unit_system.time, + default_value=0.015625 | nbody_system.time, is_vector=False, must_set_before_get=False, ) From 3b71cada7f26815a369ca9606032fcd003de56af Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 24 Apr 2026 16:52:20 +0200 Subject: [PATCH 130/174] fixed tidymess/support/shared not simlinking to amuse/support/shared --- src/amuse_tidymess/support/shared | 1 + .../support/shared/config.guess | 1812 --------------- src/amuse_tidymess/support/shared/config.sub | 1971 ----------------- src/amuse_tidymess/support/shared/install-sh | 541 ----- .../support/shared/m4/amuse_conda.m4 | 36 - .../support/shared/m4/amuse_cuda.m4 | 232 -- .../support/shared/m4/amuse_detect_os.m4 | 19 - .../support/shared/m4/amuse_download.m4 | 38 - .../support/shared/m4/amuse_lib.m4 | 138 -- .../support/shared/m4/amuse_lib_healpix.m4 | 48 - .../support/shared/m4/amuse_lib_qhull.m4 | 30 - .../support/shared/m4/amuse_opencl.m4 | 63 - .../support/shared/m4/amuse_venv.m4 | 31 - .../support/shared/m4/ax_blas.m4 | 241 -- .../support/shared/m4/ax_check_classpath.m4 | 61 - .../support/shared/m4/ax_check_gnu_make.m4 | 96 - .../support/shared/m4/ax_count_cpus.m4 | 101 - .../support/shared/m4/ax_lapack.m4 | 134 -- .../support/shared/m4/ax_lib_hdf5.m4 | 323 --- .../support/shared/m4/ax_lib_netcdf4.m4 | 277 --- .../support/shared/m4/ax_mpi.m4 | 235 -- .../support/shared/m4/ax_openmp.m4 | 123 - .../support/shared/m4/ax_prog_jar.m4 | 50 - .../support/shared/m4/ax_prog_java.m4 | 116 - .../support/shared/m4/ax_prog_java_works.m4 | 92 - .../support/shared/m4/ax_prog_javac.m4 | 80 - .../support/shared/m4/ax_prog_javac_works.m4 | 73 - src/amuse_tidymess/support/shared/m4/fftw.m4 | 122 - .../support/shared/m4/fortran.m4 | 43 - src/amuse_tidymess/support/shared/m4/gmp.m4 | 103 - src/amuse_tidymess/support/shared/m4/gsl.m4 | 122 - src/amuse_tidymess/support/shared/m4/mpfr.m4 | 109 - src/amuse_tidymess/support/shared/m4/pkg.m4 | 343 --- .../support/shared/uninstall.sh | 51 - 34 files changed, 1 insertion(+), 7854 deletions(-) create mode 120000 src/amuse_tidymess/support/shared delete mode 100755 src/amuse_tidymess/support/shared/config.guess delete mode 100755 src/amuse_tidymess/support/shared/config.sub delete mode 100755 src/amuse_tidymess/support/shared/install-sh delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_conda.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_cuda.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_detect_os.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_download.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_lib.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_lib_healpix.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_lib_qhull.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_opencl.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/amuse_venv.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_blas.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_check_classpath.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_check_gnu_make.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_count_cpus.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_lapack.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_lib_hdf5.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_lib_netcdf4.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_mpi.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_openmp.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_jar.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_java.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_java_works.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_javac.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/ax_prog_javac_works.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/fftw.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/fortran.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/gmp.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/gsl.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/mpfr.m4 delete mode 100644 src/amuse_tidymess/support/shared/m4/pkg.m4 delete mode 100755 src/amuse_tidymess/support/shared/uninstall.sh diff --git a/src/amuse_tidymess/support/shared b/src/amuse_tidymess/support/shared new file mode 120000 index 0000000000..213977b504 --- /dev/null +++ b/src/amuse_tidymess/support/shared @@ -0,0 +1 @@ +../../../support/shared/ \ No newline at end of file diff --git a/src/amuse_tidymess/support/shared/config.guess b/src/amuse_tidymess/support/shared/config.guess deleted file mode 100755 index f6d217a49f..0000000000 --- a/src/amuse_tidymess/support/shared/config.guess +++ /dev/null @@ -1,1812 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2024 Free Software Foundation, Inc. - -# shellcheck disable=SC2006,SC2268 # see below for rationale - -timestamp='2024-01-01' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. -# -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess -# -# Please send patches to . - - -# The "shellcheck disable" line above the timestamp inhibits complaints -# about features and limitations of the classic Bourne shell that were -# superseded or lifted in POSIX. However, this script identifies a wide -# variety of pre-POSIX systems that do not have POSIX shells at all, and -# even some reasonably current systems (Solaris 10 as case-in-point) still -# have a pre-POSIX /bin/sh. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system '$me' is run on. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2024 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try '$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -# Just in case it came from the environment. -GUESS= - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still -# use 'HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -tmp= -# shellcheck disable=SC2172 -trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 - -set_cc_for_build() { - # prevent multiple calls if $tmp is already set - test "$tmp" && return 0 - : "${TMPDIR=/tmp}" - # shellcheck disable=SC2039,SC3028 - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } - dummy=$tmp/dummy - case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in - ,,) echo "int x;" > "$dummy.c" - for driver in cc gcc c89 c99 ; do - if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then - CC_FOR_BUILD=$driver - break - fi - done - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; - esac -} - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if test -f /.attbin/uname ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case $UNAME_SYSTEM in -Linux|GNU|GNU/*) - LIBC=unknown - - set_cc_for_build - cat <<-EOF > "$dummy.c" - #if defined(__ANDROID__) - LIBC=android - #else - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #elif defined(__GLIBC__) - LIBC=gnu - #elif defined(__LLVM_LIBC__) - LIBC=llvm - #else - #include - /* First heuristic to detect musl libc. */ - #ifdef __DEFINED_va_list - LIBC=musl - #endif - #endif - #endif - EOF - cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - eval "$cc_set_libc" - - # Second heuristic to detect musl libc. - if [ "$LIBC" = unknown ] && - command -v ldd >/dev/null && - ldd --version 2>&1 | grep -q ^musl; then - LIBC=musl - fi - - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - if [ "$LIBC" = unknown ]; then - LIBC=gnu - fi - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ - /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ - echo unknown)` - case $UNAME_MACHINE_ARCH in - aarch64eb) machine=aarch64_be-unknown ;; - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine=${arch}${endian}-unknown - ;; - *) machine=$UNAME_MACHINE_ARCH-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. - case $UNAME_MACHINE_ARCH in - earm*) - os=netbsdelf - ;; - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # Determine ABI tags. - case $UNAME_MACHINE_ARCH in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case $UNAME_VERSION in - Debian*) - release='-gnu' - ;; - *) - release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - GUESS=$machine-${os}${release}${abi-} - ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE - ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE - ;; - *:SecBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE - ;; - *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE - ;; - *:MidnightBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE - ;; - *:ekkoBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE - ;; - *:SolidBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE - ;; - *:OS108:*:*) - GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE - ;; - macppc:MirBSD:*:*) - GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE - ;; - *:MirBSD:*:*) - GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE - ;; - *:Sortix:*:*) - GUESS=$UNAME_MACHINE-unknown-sortix - ;; - *:Twizzler:*:*) - GUESS=$UNAME_MACHINE-unknown-twizzler - ;; - *:Redox:*:*) - GUESS=$UNAME_MACHINE-unknown-redox - ;; - mips:OSF1:*.*) - GUESS=mips-dec-osf1 - ;; - alpha:OSF1:*:*) - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - trap '' 0 - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case $ALPHA_CPU_TYPE in - "EV4 (21064)") - UNAME_MACHINE=alpha ;; - "EV4.5 (21064)") - UNAME_MACHINE=alpha ;; - "LCA4 (21066/21068)") - UNAME_MACHINE=alpha ;; - "EV5 (21164)") - UNAME_MACHINE=alphaev5 ;; - "EV5.6 (21164A)") - UNAME_MACHINE=alphaev56 ;; - "EV5.6 (21164PC)") - UNAME_MACHINE=alphapca56 ;; - "EV5.7 (21164PC)") - UNAME_MACHINE=alphapca57 ;; - "EV6 (21264)") - UNAME_MACHINE=alphaev6 ;; - "EV6.7 (21264A)") - UNAME_MACHINE=alphaev67 ;; - "EV6.8CB (21264C)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8AL (21264B)") - UNAME_MACHINE=alphaev68 ;; - "EV6.8CX (21264D)") - UNAME_MACHINE=alphaev68 ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE=alphaev69 ;; - "EV7 (21364)") - UNAME_MACHINE=alphaev7 ;; - "EV7.9 (21364A)") - UNAME_MACHINE=alphaev79 ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - GUESS=$UNAME_MACHINE-dec-osf$OSF_REL - ;; - Amiga*:UNIX_System_V:4.0:*) - GUESS=m68k-unknown-sysv4 - ;; - *:[Aa]miga[Oo][Ss]:*:*) - GUESS=$UNAME_MACHINE-unknown-amigaos - ;; - *:[Mm]orph[Oo][Ss]:*:*) - GUESS=$UNAME_MACHINE-unknown-morphos - ;; - *:OS/390:*:*) - GUESS=i370-ibm-openedition - ;; - *:z/VM:*:*) - GUESS=s390-ibm-zvmoe - ;; - *:OS400:*:*) - GUESS=powerpc-ibm-os400 - ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - GUESS=arm-acorn-riscix$UNAME_RELEASE - ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - GUESS=arm-unknown-riscos - ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - GUESS=hppa1.1-hitachi-hiuxmpp - ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - case `(/bin/universe) 2>/dev/null` in - att) GUESS=pyramid-pyramid-sysv3 ;; - *) GUESS=pyramid-pyramid-bsd ;; - esac - ;; - NILE*:*:*:dcosx) - GUESS=pyramid-pyramid-svr4 - ;; - DRS?6000:unix:4.0:6*) - GUESS=sparc-icl-nx6 - ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) GUESS=sparc-icl-nx7 ;; - esac - ;; - s390x:SunOS:*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL - ;; - sun4H:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-hal-solaris2$SUN_REL - ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-sun-solaris2$SUN_REL - ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - GUESS=i386-pc-auroraux$UNAME_RELEASE - ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - set_cc_for_build - SUN_ARCH=i386 - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH=x86_64 - fi - fi - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=$SUN_ARCH-pc-solaris2$SUN_REL - ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=sparc-sun-solaris3$SUN_REL - ;; - sun4*:SunOS:*:*) - case `/usr/bin/arch -k` in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like '4.1.3-JL'. - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` - GUESS=sparc-sun-sunos$SUN_REL - ;; - sun3*:SunOS:*:*) - GUESS=m68k-sun-sunos$UNAME_RELEASE - ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 - case `/bin/arch` in - sun3) - GUESS=m68k-sun-sunos$UNAME_RELEASE - ;; - sun4) - GUESS=sparc-sun-sunos$UNAME_RELEASE - ;; - esac - ;; - aushp:SunOS:*:*) - GUESS=sparc-auspex-sunos$UNAME_RELEASE - ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - GUESS=m68k-atari-mint$UNAME_RELEASE - ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - GUESS=m68k-milan-mint$UNAME_RELEASE - ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - GUESS=m68k-hades-mint$UNAME_RELEASE - ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - GUESS=m68k-unknown-mint$UNAME_RELEASE - ;; - m68k:machten:*:*) - GUESS=m68k-apple-machten$UNAME_RELEASE - ;; - powerpc:machten:*:*) - GUESS=powerpc-apple-machten$UNAME_RELEASE - ;; - RISC*:Mach:*:*) - GUESS=mips-dec-mach_bsd4.3 - ;; - RISC*:ULTRIX:*:*) - GUESS=mips-dec-ultrix$UNAME_RELEASE - ;; - VAX*:ULTRIX*:*:*) - GUESS=vax-dec-ultrix$UNAME_RELEASE - ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - GUESS=clipper-intergraph-clix$UNAME_RELEASE - ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`"$dummy" "$dummyarg"` && - { echo "$SYSTEM_NAME"; exit; } - GUESS=mips-mips-riscos$UNAME_RELEASE - ;; - Motorola:PowerMAX_OS:*:*) - GUESS=powerpc-motorola-powermax - ;; - Motorola:*:4.3:PL8-*) - GUESS=powerpc-harris-powermax - ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - GUESS=powerpc-harris-powermax - ;; - Night_Hawk:Power_UNIX:*:*) - GUESS=powerpc-harris-powerunix - ;; - m88k:CX/UX:7*:*) - GUESS=m88k-harris-cxux7 - ;; - m88k:*:4*:R4*) - GUESS=m88k-motorola-sysv4 - ;; - m88k:*:3*:R3*) - GUESS=m88k-motorola-sysv3 - ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 - then - if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ - test "$TARGET_BINARY_INTERFACE"x = x - then - GUESS=m88k-dg-dgux$UNAME_RELEASE - else - GUESS=m88k-dg-dguxbcs$UNAME_RELEASE - fi - else - GUESS=i586-dg-dgux$UNAME_RELEASE - fi - ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - GUESS=m88k-dolphin-sysv3 - ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - GUESS=m88k-motorola-sysv3 - ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - GUESS=m88k-tektronix-sysv3 - ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - GUESS=m68k-tektronix-bsd - ;; - *:IRIX*:*:*) - IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` - GUESS=mips-sgi-irix$IRIX_REL - ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id - ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - GUESS=i386-ibm-aix - ;; - ia64:AIX:*:*) - if test -x /usr/bin/oslevel ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=$UNAME_VERSION.$UNAME_RELEASE - fi - GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV - ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` - then - GUESS=$SYSTEM_NAME - else - GUESS=rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - GUESS=rs6000-ibm-aix3.2.4 - else - GUESS=rs6000-ibm-aix3.2 - fi - ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if test -x /usr/bin/lslpp ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` - else - IBM_REV=$UNAME_VERSION.$UNAME_RELEASE - fi - GUESS=$IBM_ARCH-ibm-aix$IBM_REV - ;; - *:AIX:*:*) - GUESS=rs6000-ibm-aix - ;; - ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) - GUESS=romp-ibm-bsd4.4 - ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to - ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - GUESS=rs6000-bull-bosx - ;; - DPX/2?00:B.O.S.:*:*) - GUESS=m68k-bull-sysv3 - ;; - 9000/[34]??:4.3bsd:1.*:*) - GUESS=m68k-hp-bsd - ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - GUESS=m68k-hp-bsd4.4 - ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` - case $UNAME_MACHINE in - 9000/31?) HP_ARCH=m68000 ;; - 9000/[34]??) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if test -x /usr/bin/getconf; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case $sc_cpu_version in - 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 - 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case $sc_kernel_bits in - 32) HP_ARCH=hppa2.0n ;; - 64) HP_ARCH=hppa2.0w ;; - '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 - esac ;; - esac - fi - if test "$HP_ARCH" = ""; then - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if test "$HP_ARCH" = hppa2.0w - then - set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH=hppa2.0w - else - HP_ARCH=hppa64 - fi - fi - GUESS=$HP_ARCH-hp-hpux$HPUX_REV - ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` - GUESS=ia64-hp-hpux$HPUX_REV - ;; - 3050*:HI-UX:*:*) - set_cc_for_build - sed 's/^ //' << EOF > "$dummy.c" - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && - { echo "$SYSTEM_NAME"; exit; } - GUESS=unknown-hitachi-hiuxwe2 - ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) - GUESS=hppa1.1-hp-bsd - ;; - 9000/8??:4.3bsd:*:*) - GUESS=hppa1.0-hp-bsd - ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - GUESS=hppa1.0-hp-mpeix - ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) - GUESS=hppa1.1-hp-osf - ;; - hp8??:OSF1:*:*) - GUESS=hppa1.0-hp-osf - ;; - i*86:OSF1:*:*) - if test -x /usr/sbin/sysversion ; then - GUESS=$UNAME_MACHINE-unknown-osf1mk - else - GUESS=$UNAME_MACHINE-unknown-osf1 - fi - ;; - parisc*:Lites*:*:*) - GUESS=hppa1.1-hp-lites - ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - GUESS=c1-convex-bsd - ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - GUESS=c34-convex-bsd - ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - GUESS=c38-convex-bsd - ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - GUESS=c4-convex-bsd - ;; - CRAY*Y-MP:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=ymp-cray-unicos$CRAY_REL - ;; - CRAY*[A-Z]90:*:*:*) - echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=t90-cray-unicos$CRAY_REL - ;; - CRAY*T3E:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=alphaev5-cray-unicosmk$CRAY_REL - ;; - CRAY*SV1:*:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=sv1-cray-unicos$CRAY_REL - ;; - *:UNICOS/mp:*:*) - CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` - GUESS=craynv-cray-unicosmp$CRAY_REL - ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` - GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} - ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` - GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} - ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE - ;; - sparc*:BSD/OS:*:*) - GUESS=sparc-unknown-bsdi$UNAME_RELEASE - ;; - *:BSD/OS:*:*) - GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE - ;; - arm:FreeBSD:*:*) - UNAME_PROCESSOR=`uname -p` - set_cc_for_build - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi - else - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf - fi - ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`uname -p` - case $UNAME_PROCESSOR in - amd64) - UNAME_PROCESSOR=x86_64 ;; - i386) - UNAME_PROCESSOR=i586 ;; - esac - FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL - ;; - i*:CYGWIN*:*) - GUESS=$UNAME_MACHINE-pc-cygwin - ;; - *:MINGW64*:*) - GUESS=$UNAME_MACHINE-pc-mingw64 - ;; - *:MINGW*:*) - GUESS=$UNAME_MACHINE-pc-mingw32 - ;; - *:MSYS*:*) - GUESS=$UNAME_MACHINE-pc-msys - ;; - i*:PW*:*) - GUESS=$UNAME_MACHINE-pc-pw32 - ;; - *:SerenityOS:*:*) - GUESS=$UNAME_MACHINE-pc-serenity - ;; - *:Interix*:*) - case $UNAME_MACHINE in - x86) - GUESS=i586-pc-interix$UNAME_RELEASE - ;; - authenticamd | genuineintel | EM64T) - GUESS=x86_64-unknown-interix$UNAME_RELEASE - ;; - IA64) - GUESS=ia64-unknown-interix$UNAME_RELEASE - ;; - esac ;; - i*:UWIN*:*) - GUESS=$UNAME_MACHINE-pc-uwin - ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - GUESS=x86_64-pc-cygwin - ;; - prep*:SunOS:5.*:*) - SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` - GUESS=powerpcle-unknown-solaris2$SUN_REL - ;; - *:GNU:*:*) - # the GNU system - GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` - GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` - GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL - ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` - GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC - ;; - x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) - GUESS="$UNAME_MACHINE-pc-managarm-mlibc" - ;; - *:[Mm]anagarm:*:*) - GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" - ;; - *:Minix:*:*) - GUESS=$UNAME_MACHINE-unknown-minix - ;; - aarch64:Linux:*:*) - set_cc_for_build - CPU=$UNAME_MACHINE - LIBCABI=$LIBC - if test "$CC_FOR_BUILD" != no_compiler_found; then - ABI=64 - sed 's/^ //' << EOF > "$dummy.c" - #ifdef __ARM_EABI__ - #ifdef __ARM_PCS_VFP - ABI=eabihf - #else - ABI=eabi - #endif - #endif -EOF - cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` - eval "$cc_set_abi" - case $ABI in - eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; - esac - fi - GUESS=$CPU-unknown-linux-$LIBCABI - ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - arm*:Linux:*:*) - set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi - else - GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf - fi - fi - ;; - avr32*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - cris:Linux:*:*) - GUESS=$UNAME_MACHINE-axis-linux-$LIBC - ;; - crisv32:Linux:*:*) - GUESS=$UNAME_MACHINE-axis-linux-$LIBC - ;; - e2k:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - frv:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - hexagon:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - i*86:Linux:*:*) - GUESS=$UNAME_MACHINE-pc-linux-$LIBC - ;; - ia64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - k1om:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - kvx:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - kvx:cos:*:*) - GUESS=$UNAME_MACHINE-unknown-cos - ;; - kvx:mbr:*:*) - GUESS=$UNAME_MACHINE-unknown-mbr - ;; - loongarch32:Linux:*:* | loongarch64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - m32r*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - m68*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - mips:Linux:*:* | mips64:Linux:*:*) - set_cc_for_build - IS_GLIBC=0 - test x"${LIBC}" = xgnu && IS_GLIBC=1 - sed 's/^ //' << EOF > "$dummy.c" - #undef CPU - #undef mips - #undef mipsel - #undef mips64 - #undef mips64el - #if ${IS_GLIBC} && defined(_ABI64) - LIBCABI=gnuabi64 - #else - #if ${IS_GLIBC} && defined(_ABIN32) - LIBCABI=gnuabin32 - #else - LIBCABI=${LIBC} - #endif - #endif - - #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 - CPU=mipsisa64r6 - #else - #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 - CPU=mipsisa32r6 - #else - #if defined(__mips64) - CPU=mips64 - #else - CPU=mips - #endif - #endif - #endif - - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - MIPS_ENDIAN=el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - MIPS_ENDIAN= - #else - MIPS_ENDIAN= - #endif - #endif -EOF - cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` - eval "$cc_set_vars" - test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } - ;; - mips64el:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - openrisc*:Linux:*:*) - GUESS=or1k-unknown-linux-$LIBC - ;; - or32:Linux:*:* | or1k*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - padre:Linux:*:*) - GUESS=sparc-unknown-linux-$LIBC - ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - GUESS=hppa64-unknown-linux-$LIBC - ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; - PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; - *) GUESS=hppa-unknown-linux-$LIBC ;; - esac - ;; - ppc64:Linux:*:*) - GUESS=powerpc64-unknown-linux-$LIBC - ;; - ppc:Linux:*:*) - GUESS=powerpc-unknown-linux-$LIBC - ;; - ppc64le:Linux:*:*) - GUESS=powerpc64le-unknown-linux-$LIBC - ;; - ppcle:Linux:*:*) - GUESS=powerpcle-unknown-linux-$LIBC - ;; - riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - s390:Linux:*:* | s390x:Linux:*:*) - GUESS=$UNAME_MACHINE-ibm-linux-$LIBC - ;; - sh64*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - sh*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - tile*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - vax:Linux:*:*) - GUESS=$UNAME_MACHINE-dec-linux-$LIBC - ;; - x86_64:Linux:*:*) - set_cc_for_build - CPU=$UNAME_MACHINE - LIBCABI=$LIBC - if test "$CC_FOR_BUILD" != no_compiler_found; then - ABI=64 - sed 's/^ //' << EOF > "$dummy.c" - #ifdef __i386__ - ABI=x86 - #else - #ifdef __ILP32__ - ABI=x32 - #endif - #endif -EOF - cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` - eval "$cc_set_abi" - case $ABI in - x86) CPU=i686 ;; - x32) LIBCABI=${LIBC}x32 ;; - esac - fi - GUESS=$CPU-pc-linux-$LIBCABI - ;; - xtensa*:Linux:*:*) - GUESS=$UNAME_MACHINE-unknown-linux-$LIBC - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - GUESS=i386-sequent-sysv4 - ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION - ;; - i*86:OS/2:*:*) - # If we were able to find 'uname', then EMX Unix compatibility - # is probably installed. - GUESS=$UNAME_MACHINE-pc-os2-emx - ;; - i*86:XTS-300:*:STOP) - GUESS=$UNAME_MACHINE-unknown-stop - ;; - i*86:atheos:*:*) - GUESS=$UNAME_MACHINE-unknown-atheos - ;; - i*86:syllable:*:*) - GUESS=$UNAME_MACHINE-pc-syllable - ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - GUESS=i386-unknown-lynxos$UNAME_RELEASE - ;; - i*86:*DOS:*:*) - GUESS=$UNAME_MACHINE-pc-msdosdjgpp - ;; - i*86:*:4.*:*) - UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL - else - GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL - fi - ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL - else - GUESS=$UNAME_MACHINE-pc-sysv32 - fi - ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that - # this is a cross-build. - GUESS=i586-pc-msdosdjgpp - ;; - Intel:Mach:3*:*) - GUESS=i386-pc-mach3 - ;; - paragon:*:*:*) - GUESS=i860-intel-osf1 - ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 - fi - ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - GUESS=m68010-convergent-sysv - ;; - mc68k:UNIX:SYSTEM5:3.51m) - GUESS=m68k-convergent-sysv - ;; - M680?0:D-NIX:5.3:*) - GUESS=m68k-diab-dnix - ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - GUESS=m68k-unknown-lynxos$UNAME_RELEASE - ;; - mc68030:UNIX_System_V:4.*:*) - GUESS=m68k-atari-sysv4 - ;; - TSUNAMI:LynxOS:2.*:*) - GUESS=sparc-unknown-lynxos$UNAME_RELEASE - ;; - rs6000:LynxOS:2.*:*) - GUESS=rs6000-unknown-lynxos$UNAME_RELEASE - ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - GUESS=powerpc-unknown-lynxos$UNAME_RELEASE - ;; - SM[BE]S:UNIX_SV:*:*) - GUESS=mips-dde-sysv$UNAME_RELEASE - ;; - RM*:ReliantUNIX-*:*:*) - GUESS=mips-sni-sysv4 - ;; - RM*:SINIX-*:*:*) - GUESS=mips-sni-sysv4 - ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - GUESS=$UNAME_MACHINE-sni-sysv4 - else - GUESS=ns32k-sni-sysv - fi - ;; - PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort - # says - GUESS=i586-unisys-sysv4 - ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - GUESS=hppa1.1-stratus-sysv4 - ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - GUESS=i860-stratus-sysv4 - ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - GUESS=$UNAME_MACHINE-stratus-vos - ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - GUESS=hppa1.1-stratus-vos - ;; - mc68*:A/UX:*:*) - GUESS=m68k-apple-aux$UNAME_RELEASE - ;; - news*:NEWS-OS:6*:*) - GUESS=mips-sony-newsos6 - ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if test -d /usr/nec; then - GUESS=mips-nec-sysv$UNAME_RELEASE - else - GUESS=mips-unknown-sysv$UNAME_RELEASE - fi - ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - GUESS=powerpc-be-beos - ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - GUESS=powerpc-apple-beos - ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - GUESS=i586-pc-beos - ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - GUESS=i586-pc-haiku - ;; - ppc:Haiku:*:*) # Haiku running on Apple PowerPC - GUESS=powerpc-apple-haiku - ;; - *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) - GUESS=$UNAME_MACHINE-unknown-haiku - ;; - SX-4:SUPER-UX:*:*) - GUESS=sx4-nec-superux$UNAME_RELEASE - ;; - SX-5:SUPER-UX:*:*) - GUESS=sx5-nec-superux$UNAME_RELEASE - ;; - SX-6:SUPER-UX:*:*) - GUESS=sx6-nec-superux$UNAME_RELEASE - ;; - SX-7:SUPER-UX:*:*) - GUESS=sx7-nec-superux$UNAME_RELEASE - ;; - SX-8:SUPER-UX:*:*) - GUESS=sx8-nec-superux$UNAME_RELEASE - ;; - SX-8R:SUPER-UX:*:*) - GUESS=sx8r-nec-superux$UNAME_RELEASE - ;; - SX-ACE:SUPER-UX:*:*) - GUESS=sxace-nec-superux$UNAME_RELEASE - ;; - Power*:Rhapsody:*:*) - GUESS=powerpc-apple-rhapsody$UNAME_RELEASE - ;; - *:Rhapsody:*:*) - GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE - ;; - arm64:Darwin:*:*) - GUESS=aarch64-apple-darwin$UNAME_RELEASE - ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - if command -v xcode-select > /dev/null 2> /dev/null && \ - ! xcode-select --print-path > /dev/null 2> /dev/null ; then - # Avoid executing cc if there is no toolchain installed as - # cc will be a stub that puts up a graphical alert - # prompting the user to install developer tools. - CC_FOR_BUILD=no_compiler_found - else - set_cc_for_build - fi - if test "$CC_FOR_BUILD" != no_compiler_found; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # uname -m returns i386 or x86_64 - UNAME_PROCESSOR=$UNAME_MACHINE - fi - GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE - ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = x86; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE - ;; - *:QNX:*:4*) - GUESS=i386-pc-qnx - ;; - NEO-*:NONSTOP_KERNEL:*:*) - GUESS=neo-tandem-nsk$UNAME_RELEASE - ;; - NSE-*:NONSTOP_KERNEL:*:*) - GUESS=nse-tandem-nsk$UNAME_RELEASE - ;; - NSR-*:NONSTOP_KERNEL:*:*) - GUESS=nsr-tandem-nsk$UNAME_RELEASE - ;; - NSV-*:NONSTOP_KERNEL:*:*) - GUESS=nsv-tandem-nsk$UNAME_RELEASE - ;; - NSX-*:NONSTOP_KERNEL:*:*) - GUESS=nsx-tandem-nsk$UNAME_RELEASE - ;; - *:NonStop-UX:*:*) - GUESS=mips-compaq-nonstopux - ;; - BS2000:POSIX*:*:*) - GUESS=bs2000-siemens-sysv - ;; - DS/*:UNIX_System_V:*:*) - GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE - ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "${cputype-}" = 386; then - UNAME_MACHINE=i386 - elif test "x${cputype-}" != x; then - UNAME_MACHINE=$cputype - fi - GUESS=$UNAME_MACHINE-unknown-plan9 - ;; - *:TOPS-10:*:*) - GUESS=pdp10-unknown-tops10 - ;; - *:TENEX:*:*) - GUESS=pdp10-unknown-tenex - ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - GUESS=pdp10-dec-tops20 - ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - GUESS=pdp10-xkl-tops20 - ;; - *:TOPS-20:*:*) - GUESS=pdp10-unknown-tops20 - ;; - *:ITS:*:*) - GUESS=pdp10-unknown-its - ;; - SEI:*:*:SEIUX) - GUESS=mips-sei-seiux$UNAME_RELEASE - ;; - *:DragonFly:*:*) - DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` - GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL - ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case $UNAME_MACHINE in - A*) GUESS=alpha-dec-vms ;; - I*) GUESS=ia64-dec-vms ;; - V*) GUESS=vax-dec-vms ;; - esac ;; - *:XENIX:*:SysV) - GUESS=i386-pc-xenix - ;; - i*86:skyos:*:*) - SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` - GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL - ;; - i*86:rdos:*:*) - GUESS=$UNAME_MACHINE-pc-rdos - ;; - i*86:Fiwix:*:*) - GUESS=$UNAME_MACHINE-pc-fiwix - ;; - *:AROS:*:*) - GUESS=$UNAME_MACHINE-unknown-aros - ;; - x86_64:VMkernel:*:*) - GUESS=$UNAME_MACHINE-unknown-esx - ;; - amd64:Isilon\ OneFS:*:*) - GUESS=x86_64-unknown-onefs - ;; - *:Unleashed:*:*) - GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE - ;; - *:Ironclad:*:*) - GUESS=$UNAME_MACHINE-unknown-ironclad - ;; -esac - -# Do we have a guess based on uname results? -if test "x$GUESS" != x; then - echo "$GUESS" - exit -fi - -# No uname command or uname output not recognized. -set_cc_for_build -cat > "$dummy.c" < -#include -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#include -#if defined(_SIZE_T_) || defined(SIGLOST) -#include -#endif -#endif -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); -#endif - -#if defined (vax) -#if !defined (ultrix) -#include -#if defined (BSD) -#if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -#else -#if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -#else - printf ("vax-dec-bsd\n"); exit (0); -#endif -#endif -#else - printf ("vax-dec-bsd\n"); exit (0); -#endif -#else -#if defined(_SIZE_T_) || defined(SIGLOST) - struct utsname un; - uname (&un); - printf ("vax-dec-ultrix%s\n", un.release); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif -#endif -#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) -#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) -#if defined(_SIZE_T_) || defined(SIGLOST) - struct utsname *un; - uname (&un); - printf ("mips-dec-ultrix%s\n", un.release); exit (0); -#else - printf ("mips-dec-ultrix\n"); exit (0); -#endif -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. -test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } - -echo "$0: unable to guess system type" >&2 - -case $UNAME_MACHINE:$UNAME_SYSTEM in - mips:Linux | mips64:Linux) - # If we got here on MIPS GNU/Linux, output extra information. - cat >&2 <&2 <&2 </dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = "$UNAME_MACHINE" -UNAME_RELEASE = "$UNAME_RELEASE" -UNAME_SYSTEM = "$UNAME_SYSTEM" -UNAME_VERSION = "$UNAME_VERSION" -EOF -fi - -exit 1 - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/amuse_tidymess/support/shared/config.sub b/src/amuse_tidymess/support/shared/config.sub deleted file mode 100755 index 2c6a07ab3c..0000000000 --- a/src/amuse_tidymess/support/shared/config.sub +++ /dev/null @@ -1,1971 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2024 Free Software Foundation, Inc. - -# shellcheck disable=SC2006,SC2268 # see below for rationale - -timestamp='2024-01-01' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches to . -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -# The "shellcheck disable" line above the timestamp inhibits complaints -# about features and limitations of the classic Bourne shell that were -# superseded or lifted in POSIX. However, this script identifies a wide -# variety of pre-POSIX systems that do not have POSIX shells at all, and -# even some reasonably current systems (Solaris 10 as case-in-point) still -# have a pre-POSIX /bin/sh. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS - -Canonicalize a configuration name. - -Options: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2024 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try '$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo "$1" - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Split fields of configuration type -# shellcheck disable=SC2162 -saved_IFS=$IFS -IFS="-" read field1 field2 field3 field4 <&2 - exit 1 - ;; - *-*-*-*) - basic_machine=$field1-$field2 - basic_os=$field3-$field4 - ;; - *-*-*) - # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two - # parts - maybe_os=$field2-$field3 - case $maybe_os in - nto-qnx* | linux-* | uclinux-uclibc* \ - | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ - | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ - | windows-* ) - basic_machine=$field1 - basic_os=$maybe_os - ;; - android-linux) - basic_machine=$field1-unknown - basic_os=linux-android - ;; - *) - basic_machine=$field1-$field2 - basic_os=$field3 - ;; - esac - ;; - *-*) - # A lone config we happen to match not fitting any pattern - case $field1-$field2 in - decstation-3100) - basic_machine=mips-dec - basic_os= - ;; - *-*) - # Second component is usually, but not always the OS - case $field2 in - # Prevent following clause from handling this valid os - sun*os*) - basic_machine=$field1 - basic_os=$field2 - ;; - zephyr*) - basic_machine=$field1-unknown - basic_os=$field2 - ;; - # Manufacturers - dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ - | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ - | unicom* | ibm* | next | hp | isi* | apollo | altos* \ - | convergent* | ncr* | news | 32* | 3600* | 3100* \ - | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ - | ultra | tti* | harris | dolphin | highlevel | gould \ - | cbm | ns | masscomp | apple | axis | knuth | cray \ - | microblaze* | sim | cisco \ - | oki | wec | wrs | winbond) - basic_machine=$field1-$field2 - basic_os= - ;; - *) - basic_machine=$field1 - basic_os=$field2 - ;; - esac - ;; - esac - ;; - *) - # Convert single-component short-hands not valid as part of - # multi-component configurations. - case $field1 in - 386bsd) - basic_machine=i386-pc - basic_os=bsd - ;; - a29khif) - basic_machine=a29k-amd - basic_os=udi - ;; - adobe68k) - basic_machine=m68010-adobe - basic_os=scout - ;; - alliant) - basic_machine=fx80-alliant - basic_os= - ;; - altos | altos3068) - basic_machine=m68k-altos - basic_os= - ;; - am29k) - basic_machine=a29k-none - basic_os=bsd - ;; - amdahl) - basic_machine=580-amdahl - basic_os=sysv - ;; - amiga) - basic_machine=m68k-unknown - basic_os= - ;; - amigaos | amigados) - basic_machine=m68k-unknown - basic_os=amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - basic_os=sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - basic_os=sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - basic_os=bsd - ;; - aros) - basic_machine=i386-pc - basic_os=aros - ;; - aux) - basic_machine=m68k-apple - basic_os=aux - ;; - balance) - basic_machine=ns32k-sequent - basic_os=dynix - ;; - blackfin) - basic_machine=bfin-unknown - basic_os=linux - ;; - cegcc) - basic_machine=arm-unknown - basic_os=cegcc - ;; - convex-c1) - basic_machine=c1-convex - basic_os=bsd - ;; - convex-c2) - basic_machine=c2-convex - basic_os=bsd - ;; - convex-c32) - basic_machine=c32-convex - basic_os=bsd - ;; - convex-c34) - basic_machine=c34-convex - basic_os=bsd - ;; - convex-c38) - basic_machine=c38-convex - basic_os=bsd - ;; - cray) - basic_machine=j90-cray - basic_os=unicos - ;; - crds | unos) - basic_machine=m68k-crds - basic_os= - ;; - da30) - basic_machine=m68k-da30 - basic_os= - ;; - decstation | pmax | pmin | dec3100 | decstatn) - basic_machine=mips-dec - basic_os= - ;; - delta88) - basic_machine=m88k-motorola - basic_os=sysv3 - ;; - dicos) - basic_machine=i686-pc - basic_os=dicos - ;; - djgpp) - basic_machine=i586-pc - basic_os=msdosdjgpp - ;; - ebmon29k) - basic_machine=a29k-amd - basic_os=ebmon - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - basic_os=ose - ;; - gmicro) - basic_machine=tron-gmicro - basic_os=sysv - ;; - go32) - basic_machine=i386-pc - basic_os=go32 - ;; - h8300hms) - basic_machine=h8300-hitachi - basic_os=hms - ;; - h8300xray) - basic_machine=h8300-hitachi - basic_os=xray - ;; - h8500hms) - basic_machine=h8500-hitachi - basic_os=hms - ;; - harris) - basic_machine=m88k-harris - basic_os=sysv3 - ;; - hp300 | hp300hpux) - basic_machine=m68k-hp - basic_os=hpux - ;; - hp300bsd) - basic_machine=m68k-hp - basic_os=bsd - ;; - hppaosf) - basic_machine=hppa1.1-hp - basic_os=osf - ;; - hppro) - basic_machine=hppa1.1-hp - basic_os=proelf - ;; - i386mach) - basic_machine=i386-mach - basic_os=mach - ;; - isi68 | isi) - basic_machine=m68k-isi - basic_os=sysv - ;; - m68knommu) - basic_machine=m68k-unknown - basic_os=linux - ;; - magnum | m3230) - basic_machine=mips-mips - basic_os=sysv - ;; - merlin) - basic_machine=ns32k-utek - basic_os=sysv - ;; - mingw64) - basic_machine=x86_64-pc - basic_os=mingw64 - ;; - mingw32) - basic_machine=i686-pc - basic_os=mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - basic_os=mingw32ce - ;; - monitor) - basic_machine=m68k-rom68k - basic_os=coff - ;; - morphos) - basic_machine=powerpc-unknown - basic_os=morphos - ;; - moxiebox) - basic_machine=moxie-unknown - basic_os=moxiebox - ;; - msdos) - basic_machine=i386-pc - basic_os=msdos - ;; - msys) - basic_machine=i686-pc - basic_os=msys - ;; - mvs) - basic_machine=i370-ibm - basic_os=mvs - ;; - nacl) - basic_machine=le32-unknown - basic_os=nacl - ;; - ncr3000) - basic_machine=i486-ncr - basic_os=sysv4 - ;; - netbsd386) - basic_machine=i386-pc - basic_os=netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - basic_os=linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - basic_os=newsos - ;; - news1000) - basic_machine=m68030-sony - basic_os=newsos - ;; - necv70) - basic_machine=v70-nec - basic_os=sysv - ;; - nh3000) - basic_machine=m68k-harris - basic_os=cxux - ;; - nh[45]000) - basic_machine=m88k-harris - basic_os=cxux - ;; - nindy960) - basic_machine=i960-intel - basic_os=nindy - ;; - mon960) - basic_machine=i960-intel - basic_os=mon960 - ;; - nonstopux) - basic_machine=mips-compaq - basic_os=nonstopux - ;; - os400) - basic_machine=powerpc-ibm - basic_os=os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - basic_os=ose - ;; - os68k) - basic_machine=m68k-none - basic_os=os68k - ;; - paragon) - basic_machine=i860-intel - basic_os=osf - ;; - parisc) - basic_machine=hppa-unknown - basic_os=linux - ;; - psp) - basic_machine=mipsallegrexel-sony - basic_os=psp - ;; - pw32) - basic_machine=i586-unknown - basic_os=pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - basic_os=rdos - ;; - rdos32) - basic_machine=i386-pc - basic_os=rdos - ;; - rom68k) - basic_machine=m68k-rom68k - basic_os=coff - ;; - sa29200) - basic_machine=a29k-amd - basic_os=udi - ;; - sei) - basic_machine=mips-sei - basic_os=seiux - ;; - sequent) - basic_machine=i386-sequent - basic_os= - ;; - sps7) - basic_machine=m68k-bull - basic_os=sysv2 - ;; - st2000) - basic_machine=m68k-tandem - basic_os= - ;; - stratus) - basic_machine=i860-stratus - basic_os=sysv4 - ;; - sun2) - basic_machine=m68000-sun - basic_os= - ;; - sun2os3) - basic_machine=m68000-sun - basic_os=sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - basic_os=sunos4 - ;; - sun3) - basic_machine=m68k-sun - basic_os= - ;; - sun3os3) - basic_machine=m68k-sun - basic_os=sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - basic_os=sunos4 - ;; - sun4) - basic_machine=sparc-sun - basic_os= - ;; - sun4os3) - basic_machine=sparc-sun - basic_os=sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - basic_os=sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - basic_os=solaris2 - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - basic_os= - ;; - sv1) - basic_machine=sv1-cray - basic_os=unicos - ;; - symmetry) - basic_machine=i386-sequent - basic_os=dynix - ;; - t3e) - basic_machine=alphaev5-cray - basic_os=unicos - ;; - t90) - basic_machine=t90-cray - basic_os=unicos - ;; - toad1) - basic_machine=pdp10-xkl - basic_os=tops20 - ;; - tpf) - basic_machine=s390x-ibm - basic_os=tpf - ;; - udi29k) - basic_machine=a29k-amd - basic_os=udi - ;; - ultra3) - basic_machine=a29k-nyu - basic_os=sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - basic_os=none - ;; - vaxv) - basic_machine=vax-dec - basic_os=sysv - ;; - vms) - basic_machine=vax-dec - basic_os=vms - ;; - vsta) - basic_machine=i386-pc - basic_os=vsta - ;; - vxworks960) - basic_machine=i960-wrs - basic_os=vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - basic_os=vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - basic_os=vxworks - ;; - xbox) - basic_machine=i686-pc - basic_os=mingw32 - ;; - ymp) - basic_machine=ymp-cray - basic_os=unicos - ;; - *) - basic_machine=$1 - basic_os= - ;; - esac - ;; -esac - -# Decode 1-component or ad-hoc basic machines -case $basic_machine in - # Here we handle the default manufacturer of certain CPU types. It is in - # some cases the only manufacturer, in others, it is the most popular. - w89k) - cpu=hppa1.1 - vendor=winbond - ;; - op50n) - cpu=hppa1.1 - vendor=oki - ;; - op60c) - cpu=hppa1.1 - vendor=oki - ;; - ibm*) - cpu=i370 - vendor=ibm - ;; - orion105) - cpu=clipper - vendor=highlevel - ;; - mac | mpw | mac-mpw) - cpu=m68k - vendor=apple - ;; - pmac | pmac-mpw) - cpu=powerpc - vendor=apple - ;; - - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - cpu=m68000 - vendor=att - ;; - 3b*) - cpu=we32k - vendor=att - ;; - bluegene*) - cpu=powerpc - vendor=ibm - basic_os=cnk - ;; - decsystem10* | dec10*) - cpu=pdp10 - vendor=dec - basic_os=tops10 - ;; - decsystem20* | dec20*) - cpu=pdp10 - vendor=dec - basic_os=tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - cpu=m68k - vendor=motorola - ;; - dpx2*) - cpu=m68k - vendor=bull - basic_os=sysv3 - ;; - encore | umax | mmax) - cpu=ns32k - vendor=encore - ;; - elxsi) - cpu=elxsi - vendor=elxsi - basic_os=${basic_os:-bsd} - ;; - fx2800) - cpu=i860 - vendor=alliant - ;; - genix) - cpu=ns32k - vendor=ns - ;; - h3050r* | hiux*) - cpu=hppa1.1 - vendor=hitachi - basic_os=hiuxwe2 - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - cpu=m68000 - vendor=hp - ;; - hp9k3[2-9][0-9]) - cpu=m68k - vendor=hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - cpu=hppa1.1 - vendor=hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - cpu=hppa1.0 - vendor=hp - ;; - i*86v32) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv32 - ;; - i*86v4*) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv4 - ;; - i*86v) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=sysv - ;; - i*86sol2) - cpu=`echo "$1" | sed -e 's/86.*/86/'` - vendor=pc - basic_os=solaris2 - ;; - j90 | j90-cray) - cpu=j90 - vendor=cray - basic_os=${basic_os:-unicos} - ;; - iris | iris4d) - cpu=mips - vendor=sgi - case $basic_os in - irix*) - ;; - *) - basic_os=irix4 - ;; - esac - ;; - miniframe) - cpu=m68000 - vendor=convergent - ;; - *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) - cpu=m68k - vendor=atari - basic_os=mint - ;; - news-3600 | risc-news) - cpu=mips - vendor=sony - basic_os=newsos - ;; - next | m*-next) - cpu=m68k - vendor=next - case $basic_os in - openstep*) - ;; - nextstep*) - ;; - ns2*) - basic_os=nextstep2 - ;; - *) - basic_os=nextstep3 - ;; - esac - ;; - np1) - cpu=np1 - vendor=gould - ;; - op50n-* | op60c-*) - cpu=hppa1.1 - vendor=oki - basic_os=proelf - ;; - pa-hitachi) - cpu=hppa1.1 - vendor=hitachi - basic_os=hiuxwe2 - ;; - pbd) - cpu=sparc - vendor=tti - ;; - pbb) - cpu=m68k - vendor=tti - ;; - pc532) - cpu=ns32k - vendor=pc532 - ;; - pn) - cpu=pn - vendor=gould - ;; - power) - cpu=power - vendor=ibm - ;; - ps2) - cpu=i386 - vendor=ibm - ;; - rm[46]00) - cpu=mips - vendor=siemens - ;; - rtpc | rtpc-*) - cpu=romp - vendor=ibm - ;; - sde) - cpu=mipsisa32 - vendor=sde - basic_os=${basic_os:-elf} - ;; - simso-wrs) - cpu=sparclite - vendor=wrs - basic_os=vxworks - ;; - tower | tower-32) - cpu=m68k - vendor=ncr - ;; - vpp*|vx|vx-*) - cpu=f301 - vendor=fujitsu - ;; - w65) - cpu=w65 - vendor=wdc - ;; - w89k-*) - cpu=hppa1.1 - vendor=winbond - basic_os=proelf - ;; - none) - cpu=none - vendor=none - ;; - leon|leon[3-9]) - cpu=sparc - vendor=$basic_machine - ;; - leon-*|leon[3-9]-*) - cpu=sparc - vendor=`echo "$basic_machine" | sed 's/-.*//'` - ;; - - *-*) - # shellcheck disable=SC2162 - saved_IFS=$IFS - IFS="-" read cpu vendor <&2 - exit 1 - ;; - esac - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $vendor in - digital*) - vendor=dec - ;; - commodore*) - vendor=cbm - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if test x"$basic_os" != x -then - -# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just -# set os. -obj= -case $basic_os in - gnu/linux*) - kernel=linux - os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` - ;; - os2-emx) - kernel=os2 - os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` - ;; - nto-qnx*) - kernel=nto - os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` - ;; - *-*) - # shellcheck disable=SC2162 - saved_IFS=$IFS - IFS="-" read kernel os <&2 - fi - ;; - *) - echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 - exit 1 - ;; -esac - -case $obj in - aout* | coff* | elf* | pe*) - ;; - '') - # empty is fine - ;; - *) - echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 - exit 1 - ;; -esac - -# Here we handle the constraint that a (synthetic) cpu and os are -# valid only in combination with each other and nowhere else. -case $cpu-$os in - # The "javascript-unknown-ghcjs" triple is used by GHC; we - # accept it here in order to tolerate that, but reject any - # variations. - javascript-ghcjs) - ;; - javascript-* | *-ghcjs) - echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 - exit 1 - ;; -esac - -# As a final step for OS-related things, validate the OS-kernel combination -# (given a valid OS), if there is a kernel. -case $kernel-$os-$obj in - linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ - | linux-mlibc*- | linux-musl*- | linux-newlib*- \ - | linux-relibc*- | linux-uclibc*- ) - ;; - uclinux-uclibc*- ) - ;; - managarm-mlibc*- | managarm-kernel*- ) - ;; - windows*-msvc*-) - ;; - -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ - | -uclibc*- ) - # These are just libc implementations, not actual OSes, and thus - # require a kernel. - echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 - exit 1 - ;; - -kernel*- ) - echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 - exit 1 - ;; - *-kernel*- ) - echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 - exit 1 - ;; - *-msvc*- ) - echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 - exit 1 - ;; - kfreebsd*-gnu*- | kopensolaris*-gnu*-) - ;; - vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) - ;; - nto-qnx*-) - ;; - os2-emx-) - ;; - *-eabi*- | *-gnueabi*-) - ;; - none--*) - # None (no kernel, i.e. freestanding / bare metal), - # can be paired with an machine code file format - ;; - -*-) - # Blank kernel with real OS is always fine. - ;; - --*) - # Blank kernel and OS with real machine code file format is always fine. - ;; - *-*-*) - echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 - exit 1 - ;; -esac - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -case $vendor in - unknown) - case $cpu-$os in - *-riscix*) - vendor=acorn - ;; - *-sunos*) - vendor=sun - ;; - *-cnk* | *-aix*) - vendor=ibm - ;; - *-beos*) - vendor=be - ;; - *-hpux*) - vendor=hp - ;; - *-mpeix*) - vendor=hp - ;; - *-hiux*) - vendor=hitachi - ;; - *-unos*) - vendor=crds - ;; - *-dgux*) - vendor=dg - ;; - *-luna*) - vendor=omron - ;; - *-genix*) - vendor=ns - ;; - *-clix*) - vendor=intergraph - ;; - *-mvs* | *-opened*) - vendor=ibm - ;; - *-os400*) - vendor=ibm - ;; - s390-* | s390x-*) - vendor=ibm - ;; - *-ptx*) - vendor=sequent - ;; - *-tpf*) - vendor=ibm - ;; - *-vxsim* | *-vxworks* | *-windiss*) - vendor=wrs - ;; - *-aux*) - vendor=apple - ;; - *-hms*) - vendor=hitachi - ;; - *-mpw* | *-macos*) - vendor=apple - ;; - *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) - vendor=atari - ;; - *-vos*) - vendor=stratus - ;; - esac - ;; -esac - -echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" -exit - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/src/amuse_tidymess/support/shared/install-sh b/src/amuse_tidymess/support/shared/install-sh deleted file mode 100755 index ec298b5374..0000000000 --- a/src/amuse_tidymess/support/shared/install-sh +++ /dev/null @@ -1,541 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2020-11-14.01; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -tab=' ' -nl=' -' -IFS=" $tab$nl" - -# Set DOITPROG to "echo" to test this script. - -doit=${DOITPROG-} -doit_exec=${doit:-exec} - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -# Create dirs (including intermediate dirs) using mode 755. -# This is like GNU 'install' as of coreutils 8.32 (2020). -mkdir_umask=22 - -backupsuffix= -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -is_target_a_directory=possibly - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -p pass -p to $cpprog. - -s $stripprog installed files. - -S SUFFIX attempt to back up existing files, with suffix SUFFIX. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG - -By default, rm is invoked with -f; when overridden with RMPROG, -it's up to you to specify -f if you want it. - -If -S is not specified, no backups are attempted. - -Email bug reports to bug-automake@gnu.org. -Automake home page: https://www.gnu.org/software/automake/ -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -p) cpprog="$cpprog -p";; - - -s) stripcmd=$stripprog;; - - -S) backupsuffix="$2" - shift;; - - -t) - is_target_a_directory=always - dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) is_target_a_directory=never;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -# We allow the use of options -d and -T together, by making -d -# take the precedence; this is for compatibility with GNU install. - -if test -n "$dir_arg"; then - if test -n "$dst_arg"; then - echo "$0: target directory not allowed when installing a directory." >&2 - exit 1 - fi -fi - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - if test $# -gt 1 || test "$is_target_a_directory" = always; then - if test ! -d "$dst_arg"; then - echo "$0: $dst_arg: Is not a directory." >&2 - exit 1 - fi - fi -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - # Don't chown directories that already exist. - if test $dstdir_status = 0; then - chowncmd="" - fi - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename. - if test -d "$dst"; then - if test "$is_target_a_directory" = never; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dstbase=`basename "$src"` - case $dst in - */) dst=$dst$dstbase;; - *) dst=$dst/$dstbase;; - esac - dstdir_status=0 - else - dstdir=`dirname "$dst"` - test -d "$dstdir" - dstdir_status=$? - fi - fi - - case $dstdir in - */) dstdirslash=$dstdir;; - *) dstdirslash=$dstdir/;; - esac - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - # The $RANDOM variable is not portable (e.g., dash). Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - - trap ' - ret=$? - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null - exit $ret - ' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p'. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null - fi - trap '' 0;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - oIFS=$IFS - IFS=/ - set -f - set fnord $dstdir - shift - set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=${dstdirslash}_inst.$$_ - rmtmp=${dstdirslash}_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && - { test -z "$stripcmd" || { - # Create $dsttmp read-write so that cp doesn't create it read-only, - # which would cause strip to fail. - if test -z "$doit"; then - : >"$dsttmp" # No need to fork-exec 'touch'. - else - $doit touch "$dsttmp" - fi - } - } && - $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - set +f && - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # If $backupsuffix is set, and the file being installed - # already exists, attempt a backup. Don't worry if it fails, - # e.g., if mv doesn't support -f. - if test -n "$backupsuffix" && test -f "$dst"; then - $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null - fi - - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" -# time-stamp-end: "; # UTC" -# End: diff --git a/src/amuse_tidymess/support/shared/m4/amuse_conda.m4 b/src/amuse_tidymess/support/shared/m4/amuse_conda.m4 deleted file mode 100644 index f015fa7dab..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_conda.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# AMUSE_CONDA_LIST() -# -# Runs conda list and saves the result in amuse_conda_list. -# The conda list command is rather slow, so we can avoid an annoying wait by running -# it once and saving the output for use with AMUSE_CONDA_PACKAGE below. -# -# Note that we can't save newlines in a shell variable, so we're replacing them with -# circumflexes instead. We change them back below before grepping. -AC_DEFUN([AMUSE_CONDA_LIST],[ - amuse_conda_list="$(conda list | tr '\n' '^')" -]) - - -# AMUSE_CONDA_PACKAGE(VARIABLE, NAME, VALUE) -# -# Checks that the given package is installed in the active conda environment. -# -# You must run AMUSE_CONDA_LIST() before calling this macro. -# -# Sets $VARIABLE to VALUE if the package was found, or "yes" if VALUE is not passed. -AC_DEFUN([AMUSE_CONDA_PACKAGE],[ - AC_MSG_CHECKING([for conda package $2]) - ax_conda_package_line="$(echo $amuse_conda_list | tr '^' '\n' | grep '^$2 ')" - AS_IF([test "$?" = "0"], [ - # $1="$(AS_ECHO("$ax_conda_package_line") | tr -s ' ' | cut -f 2 -d ' ')" - m4_if([$3],[], [ - $1="yes" - ], [ - $1="$3" - ]) - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/amuse_cuda.m4 b/src/amuse_tidymess/support/shared/m4/amuse_cuda.m4 deleted file mode 100644 index 1da58a131e..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_cuda.m4 +++ /dev/null @@ -1,232 +0,0 @@ -# AMUSE_CUDA_VERIFY_HEADERS(PATH) -# -# Checks that the given path contains a CUDA installation with include/cuda.h. -# -# Sets amuse_cuda_verify_FLAGS to -I/path/to/cuda/include if successful. -AC_DEFUN([AMUSE_CUDA_VERIFY_HEADERS], [ - AS_IF([test "x$1" = x], [ - amuse_cuda_verify_msg="for cuda.h" - amuse_cuda_flags= - ], [ - amuse_cuda_verify_msg="for cuda.h in $1/include" - amuse_cuda_flags="-I$1/include" - ]) - - AC_MSG_CHECKING([$amuse_cuda_verify_msg]) - amuse_cuda_verify_FLAGS= - - ax_save_CFLAGS="$CFLAGS" - - CFLAGS="$amuse_cuda_flags" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include ])], [ - amuse_cuda_verify_FLAGS="$CFLAGS" - amuse_cuda_verify_headers_found="yes" - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - - CFLAGS="$ax_save_CFLAGS" -]) - -# AMUSE_CUDA_VERIFY_LIBS(PATH) -# -# Checks that the given path contains a CUDA installation with lib/libcudart.so or -# lib64/libcudart.so. -# -# Sets amuse_cuda_verify_LDFLAGS to -L/path/to/cuda/lib{64} if successful. -AC_DEFUN([AMUSE_CUDA_VERIFY_LIBS], [ - AS_IF([test "x$1" = x], [ - amuse_cuda_verify_msg="for libcudart" - amuse_cuda_ldflags= - ], [ - amuse_cuda_verify_msg="for libcudart in $1/lib" - amuse_cuda_verify_msg64="for libcudart in $1/lib64" - amuse_cuda_ldflags="-L$1/lib" - amuse_cuda_ldflags64="-L$1/lib64" - ]) - - AC_MSG_CHECKING([$amuse_cuda_verify_msg]) - amuse_cuda_verify_LDFLAGS= - - ax_save_LDFLAGS="$LDFLAGS" - ax_save_LIBS="$LIBS" - - LDFLAGS="$amuse_cuda_ldflags" - LIBS="-lcudart" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [cudaFree(0);])], [ - amuse_cuda_verify_LDFLAGS="$LDFLAGS" - amuse_cuda_verify_libs_found="yes" - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - - AS_IF([test "x$amuse_cuda_verify_libs_found" = x], [ - AC_MSG_CHECKING([$amuse_cuda_verify_msg64]) - LDFLAGS="$amuse_cuda_ldflags64" - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], [cudaFree(0);])], [ - amuse_cuda_verify_LDFLAGS="$LDFLAGS" - amuse_cuda_verify_libs_found="yes" - AC_MSG_RESULT([yes]) - ], [ - AC_MSG_RESULT([no]) - ]) - ]) - - LIBS="$ax_save_LIBS" - LDFLAGS="$ax_save_LDFLAGS" -]) - -# AMUSE_CUDA_VERIFY_SET_VARS(CUDA_TK) -# -# Sets CUDA_TK, NVCC, CUDA_FLAGS and CUDA_LDFLAGS from the internal values, if all -# of them have been found. -AC_DEFUN([AMUSE_CUDA_VERIFY_SET_VARS], [ - AS_IF( - [test \(x"$amuse_cuda_verify_NVCC" != x\) -a \(x"$amuse_cuda_verify_headers_found" != x\) -a \(x"$amuse_cuda_verify_libs_found" != x\)], - [ - CUDA_TK="$1" - NVCC="$amuse_cuda_verify_NVCC" - CUDA_FLAGS="$amuse_cuda_verify_FLAGS" - CUDA_LDFLAGS="$amuse_cuda_verify_LDFLAGS" - ] - ) -]) - -# AMUSE_CUDA_VERIFY(PATH) -# -# Checks that the given path contains a CUDA installation with bin/nvcc, -# lib/libcudart.so, and include/cuda.h. -# -# Sets CUDA_TK= if successful, and if successful also sets NVCC to the location -# of nvcc, CUDA_LDFLAGS to -L/path/to/cuda/libs, and CUDA_FLAGS to -# -I/path/to/cuda/include. -AC_DEFUN([AMUSE_CUDA_VERIFY], [ - amuse_cuda_verify_headers_found= - amuse_cuda_verify_libs_found= - - AS_IF([test -d $1], [ - AC_PATH_PROG([amuse_cuda_verify_NVCC], [nvcc], [], [$1/bin]) - - AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ - AMUSE_CUDA_VERIFY_HEADERS([$1]) - ]) - - AS_IF([test x"$amuse_cuda_verify_headers_found" != x], [ - AMUSE_CUDA_VERIFY_LIBS([$1]) - ]) - - AMUSE_CUDA_VERIFY_SET_VARS([$1]) - ], [ - AC_MSG_NOTICE([$1 does not exist or is not a directory, CUDA not found there]) - ]) -]) - -# AMUSE_CUDA_VERIFY_DEFAULT() -# -# Checks for NVCC on the PATH, then finds the CUDA directory from there. -# -# Sets CUDA_TK= if successful, and if successful also sets NVCC to the location -# of nvcc, CUDA_LDFLAGS to -L/path/to/cuda/libs, and CUDA_FLAGS to -# -I/path/to/cuda/include. -AC_DEFUN([AMUSE_CUDA_VERIFY_DEFAULT], [ - AC_PATH_PROG([amuse_cuda_verify_NVCC], [nvcc]) - - AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ - # Got nvcc, verify that we have the rest too - amuse_cuda_verify_ctk_rel=$(dirname -- "$amuse_cuda_verify_NVCC")/.. - # Canonicalise path portably so that it looks nicer - amuse_cuda_verify_CUDA_TK=$(test -d "$amuse_cuda_verify_ctk_rel" && CDPATH= cd -P -- "$amuse_cuda_verify_ctk_rel" && pwd -P) - - AS_IF([test x"$amuse_cuda_verify_NVCC" != x], [ - AMUSE_CUDA_VERIFY_HEADERS() - ]) - - AS_IF([test x"$amuse_cuda_verify_headers_found" != x], [ - AMUSE_CUDA_VERIFY_LIBS() - ]) - - AMUSE_CUDA_VERIFY_SET_VARS([$amuse_cuda_verify_CUDA_TK]) - ], [ - AC_MSG_NOTICE([Could not find CUDA via PATH]) - ]) -]) - -# AMUSE_CUDA -# ---------------------------------------------------------- -# set up for CUDA -# -# will set: -# -# CUDA_TK -# NVCC -# -# CUDA_LDFLAGS (with -L/path/to/cuda/lib) -# CUDA_FLAGS (with -I/path/to/cuda/include) -# -# and call AC_SUBST on them. -# -AC_DEFUN([AMUSE_CUDA], [ - AC_LANG_PUSH([C]) - AS_IF([test x"$CUDA_TK" != x], [ - # User set CUDA_TK, verify and use it if it works - AMUSE_CUDA_VERIFY($CUDA_TK) - - AS_IF([test x"$NVCC" = x], [ - AC_MSG_ERROR([CUDA_TK is set, but there is no nvcc in $CUDA_TK/bin. Please set CUDA_TK to the CUDA installation directory, or unset it to autodetect.]) - ]) - ], [ - # CUDA_TK not set, try to discover CUDA via PATH - AMUSE_CUDA_VERIFY_DEFAULT() - - # Not in PATH, try default directory - AS_IF([test x"$CUDA_TK" = x], [ - AMUSE_CUDA_VERIFY([/usr/local/cuda]) - ]) - - # Try /usr/local/cuda-#.#, but only if there's exactly one match - AS_IF([test x"$CUDA_TK" = x], [ - # List CUDA installations - amuse_cuda_installs=$(ls -1 -d /usr/local/cuda-*.* 2>/dev/null) - # If there's more than one, the above will have newlines, and change when we do this - amuse_cuda_installs2=$(echo "x${amuse_cuda_installs}" | tr -d '[:space:]') - AS_IF([test "x${amuse_cuda_installs}" != x], [ - AS_IF([test "x${amuse_cuda_installs}" = "${amuse_cuda_installs2}"], [ - # Here, there's exactly one match - AMUSE_CUDA_VERIFY([$amuse_cuda_installs]) - ], [ - AC_MSG_NOTICE([Multiple CUDA installations found in /usr/local, without a /usr/local/cuda symlink. Please set CUDA_TK to specify which one you want to use.]) - ]) - ], [ - AC_MSG_NOTICE([No CUDA installations found in /usr/local]) - ]) - ]) - - # Try some other locations - for dir in /opt/cuda /usr/local/cuda/cuda /opt/cuda/cuda ; do - AS_IF([test x"$CUDA_TK" = x], [ - AMUSE_CUDA_VERIFY([$dir]) - ]) - done - - # These directories were checked by the old macro, but they're highly obsolete - # so we're not trying them anymore: - # /usr/lib/nvidia, /usr/include/nvidia, /usr/lib/nvidia-current, /usr/include/nvidia-current - - AS_IF([test x"$CUDA_TK" = x], [ - AC_MSG_NOTICE([CUDA not found. Set CUDA_TK if you have it in an odd location.]) - ]) - ]) - - AS_IF([test x"$CUDA_TK" != x], [ - AC_MSG_NOTICE([CUDA found at $CUDA_TK]) - AC_SUBST(CUDA_TK) - AC_SUBST(NVCC) - AC_SUBST(CUDA_FLAGS) - AC_SUBST(CUDA_LDFLAGS) - ]) - - AC_LANG_POP([C]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/amuse_detect_os.m4 b/src/amuse_tidymess/support/shared/m4/amuse_detect_os.m4 deleted file mode 100644 index ad5375e7b2..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_detect_os.m4 +++ /dev/null @@ -1,19 +0,0 @@ -# Macro for detecting the platform we're on -# -# Sets AMUSE_ON_MACOS if we're on macOS, or AMUSE_ON_LINUX if we're on GNU/Linux. -AC_DEFUN([AMUSE_DETECT_OS], [ - AC_CANONICAL_TARGET - if test "x$target_os" == "xlinux-gnu" - then - AMUSE_ON_LINUX=1 - fi - - if test "x$target_vendor" == "xapple" - then - AMUSE_ON_MACOS=1 - fi - - AC_SUBST([AMUSE_ON_LINUX]) - AC_SUBST([AMUSE_ON_MACOS]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/amuse_download.m4 b/src/amuse_tidymess/support/shared/m4/amuse_download.m4 deleted file mode 100644 index 6cd03aee6f..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_download.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# Helper macros for detecting download tools -# -# Some of the community codes aren't included with AMUSE, but are downloaded at build -# time. We need a tool for that, and here is where we find one. -# -# AMUSE_DOWNLOAD() -# -# Searches for a download tool. Two popular and commonly available command line -# download tools are curl and wget. This macro tries to find either one of them -# and sets DOWNLOAD to a command that will take a URL and download its contents to -# standard output. This makes it easier to write that output to a file with a known -# name, which you usually want in a Makefile. -# -# To download a file, use $(DOWNLOAD) https://example.com >example.html -# -AC_DEFUN([AMUSE_DOWNLOAD], [ - AC_CHECK_TOOL(WGET, wget) - AC_CHECK_TOOL(CURL, curl) - - AC_MSG_CHECKING([for a wget or curl to download files with]) - if test "x$WGET" != "x" - then - # The MESA SDK server rejects wget, this is the official work-around - DOWNLOAD="$WGET --progress=bar:force:noscroll --user-agent='' -O -" - AC_MSG_RESULT([yes]) - else - if test "x$CURL" != "x" - then - DOWNLOAD="$CURL -L" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - fi - - AC_SUBST([DOWNLOAD]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/amuse_lib.m4 b/src/amuse_tidymess/support/shared/m4/amuse_lib.m4 deleted file mode 100644 index a378d8de44..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_lib.m4 +++ /dev/null @@ -1,138 +0,0 @@ -# Helper macros for detecting AMUSE libraries. -# -# See https://stackoverflow.com/questions/10220946/pkg-check-modules-considered-harmful -# for some background on why we're not using PKG_CHECK_MODULES directly. Do note that -# PKG_CHECK_MODULES checks for pkg-config and gives a useful error these days, so that -# that page is partially outdated. - -# AMUSE_LIB(prefix, module, library, function) -# -# Searches for an AMUSE library and sets ${prefix}_CFLAGS, ${prefix}_LIBS to the -# appropriate values if it is found. -# -# prefix: prefix for the variables to be set -# module: name of the pkg-config module to search for if needed -# library: name of the library to be searched for -# function: name of a function in the library to use for the link check -AC_DEFUN([AMUSE_LIB], [ - amuse_save_LIBS="$LIBS" - amuse_save_LIB_CFLAGS="$[$1][_CFLAGS]" - amuse_save_LIB_LIBS="$[$1][_LIBS]" - amuse_save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" - - # If we have an active virtualenv, make sure pkg-config searches it - if test "a${VIRTUAL_ENV}" != "a" - then - PKG_CONFIG_PATH="${VIRTUAL_ENV}/lib/pkgconfig:${PKG_CONFIG_PATH}" - fi - - # All AMUSE libs export C symbols - AC_LANG_PUSH([C]) - - # Search for the library, first directly then fall back to pkg-config - AC_SEARCH_LIBS([$4], [$3], [ - FOUND_$1="yes" - $1_LIBS="$LIBS" - $1_CFLAGS="" - ], [ - PKG_CHECK_MODULES([$1], [$2], [ - FOUND_$1="yes" - ], [ - FOUND_$1="no" - ]) - ]) - - AC_LANG_POP([C]) - - PKG_CONFIG_PATH="$amuse_save_PKG_CONFIG_PATH" - LIBS="$amuse_save_LIBS" - - # If we have an active CONDA environment, assume that the lib is coming from - # there and add an additional flag so that .mod files can be found. Only really - # needed for stopcond and forsockets, and hopefully conda-forge will give us a - # better solution soon. - if test "${FOUND_$1}" == "yes" -a "x$CONDA_PREFIX" != "x" - then - $1_CFLAGS="${$1_CFLAGS} -I${CONDA_PREFIX}/include" - fi - - # If the user overrode the variables, go with what they set instead of - # what we just detected. - AS_IF([test "x$amuse_save_LIB_CFLAGS" != "x"], [ - $1_CFLAGS="$amuse_save_LIB_CFLAGS" - ]) - AS_IF([test "x$amuse_save_LIB_LIBS" != "x"], [ - $1_LIBS="$amuse_save_LIB_LIBS" - ]) - - AC_SUBST([FOUND_][$1]) - AC_SUBST([$1][_CFLAGS]) - AC_SUBST([$1][_LIBS]) -]) - - -# AMUSE_LIB_STOPCOND() -# -# Searches for the AMUSE stopping conditions library and sets STOPCOND_CFLAGS -# and STOPCOND_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_STOPCOND], [ - AMUSE_LIB([STOPCOND], [stopcond], [stopcond], [is_condition_enabled]) -]) - - -# AMUSE_LIB_STOPCONDMPI() -# -# Searches for the AMUSE stopping conditions library and sets STOPCONDMPI_CFLAGS -# and STOPCONDMPI_LIBS to the appropriate values if it is found. -# -# We use a different function here, to avoid getting a cached value from -# AMUSE_LIB_STOPCOND if both are used. Seems like it indexes by function name. -AC_DEFUN([AMUSE_LIB_STOPCONDMPI], [ - AMUSE_LIB([STOPCONDMPI], [stopcondmpi], [stopcondmpi], [get_set_conditions_]) -]) - - -# AMUSE_LIB_AMUSE_MPI() -# -# Searches for the AMUSE MPI helper library and sets AMUSE_MPI_CFLAGS and -# AMUSE_MPI_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_AMUSE_MPI], [ - AMUSE_LIB([AMUSE_MPI], [amuse_mpi], [amuse_mpi], [get_comm_world]) -]) - - -# AMUSE_LIB_FORSOCKETS() -# -# Searches for the AMUSE forsockets library and sets FORSOCKETS_CFLAGS and -# FORSOCKETS_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_FORSOCKETS], [ - AMUSE_LIB([FORSOCKETS], [forsockets], [forsockets], [forsockets_close]) -]) - - -# AMUSE_LIB_SIMPLE_HASH() -# -# Searches for the AMUSE simple hash library and sets SIMPLE_HASH_CFLAGS and -# SIMPLE_HASH_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_SIMPLE_HASH], [ - AMUSE_LIB([SIMPLE_HASH], [simple_hash], [simple_hash], [init_hash]) -]) - - -# AMUSE_LIB_G6LIB() -# -# Searches for the g6 library and sets G6LIB_CFLAGS and G6LIB_LIBS to -# the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_G6LIB], [ - AMUSE_LIB([G6LIB], [g6lib], [g6], [g6_npipes]) -]) - - -# AMUSE_LIB_SAPPORO_LIGHT() -# -# Searches for the Sapporo light library and sets SAPPORO_LIGHT_CFLAGS and -# SAPPORO_LIGHT_LIBS to the appropriate values if it is found. -AC_DEFUN([AMUSE_LIB_SAPPORO_LIGHT], [ - AMUSE_LIB([SAPPORO_LIGHT], [sapporo_light], [sapporo], [get_device_count]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/amuse_lib_healpix.m4 b/src/amuse_tidymess/support/shared/m4/amuse_lib_healpix.m4 deleted file mode 100644 index 07b6ef6c5e..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_lib_healpix.m4 +++ /dev/null @@ -1,48 +0,0 @@ -# Helper macro for detecting libhealpix_cxx -# -# AMUSE_LIB_HEALPIX_CXX() -# -# Searches for libhealpix_cxx and sets FOUND_HEALPIX_CXX to "yes" if found. -# -# Also sets HEALPIX_CXX_LIBS to any needed link commands, and HEALPIX_CXX_CFLAGS to any -# needed compiler flags. -# -AC_DEFUN([AMUSE_LIB_HEALPIX_CXX], [ - amuse_lib_healpix_cxx_save_libs="$LIBS" - - AC_MSG_CHECKING([for HEALPix]) - - AC_LANG_PUSH([C++]) - - LIBS="-lhealpix_cxx" - - AC_LINK_IFELSE([ - AC_LANG_PROGRAM([ - #include - ], [ - Healpix_Base hb; - ]) - ], [ - FOUND_HEALPIX_CXX="yes" - HEALPIX_CXX_CFLAGS="" - HEALPIX_CXX_LIBS="$LIBS" - - AC_MSG_RESULT([yes]) - ], - [ - # Not found, try pkg-config instead - PKG_CHECK_MODULES([HEALPIX_CXX], [healpix_cxx], [ - FOUND_HEALPIX_CXX="yes" - AC_MSG_RESULT([yes]) - ], [ - FOUND_HEALPIX_CXX="no" - AC_MSG_RESULT([no]) - ]) - ]) - - AC_LANG_POP([C++]) - - AC_SUBST([HEALPIX_CXX_CFLAGS]) - AC_SUBST([HEALPIX_CXX_LIBS]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/amuse_lib_qhull.m4 b/src/amuse_tidymess/support/shared/m4/amuse_lib_qhull.m4 deleted file mode 100644 index 8761694163..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_lib_qhull.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# Helper macro for detecting libqhull -# -# AMUSE_LIB_QHULL() -# -# Searches for libqhull and sets FOUND_QHULL to "yes" if found. -# -# Also sets QHULL_LIBS to any needed link commands, and QHULL_FLAGS to any needed -# compiler flags. -# -# Recent versions of libqhull have a reentrant libqhull_r and also a libqhull_p, but we -# test only for libqhull. -# -AC_DEFUN([AMUSE_LIB_QHULL], [ - amuse_lib_qhull_save_libs="$LIBS" - - LIBS="" - AC_SEARCH_LIBS([qh_freeqhull], [qhull_r], [ - FOUND_QHULL="yes" - ], []) - QHULL_LIBS="$LIBS" - QHULL_FLAGS="" - - LIBS="$amuse_lib_qhull_save_libs" - - AC_CHECK_HEADERS([libqhull_r/libqhull_r.h], [], [FOUND_QHULL="no"]) - - AC_SUBST([QHULL_LIBS]) - AC_SUBST([QHULL_FLAGS]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/amuse_opencl.m4 b/src/amuse_tidymess/support/shared/m4/amuse_opencl.m4 deleted file mode 100644 index 28b1efcd8e..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_opencl.m4 +++ /dev/null @@ -1,63 +0,0 @@ -# Helper macro for detecting OpenCL for C. - -# AMUSE_OPENCL() -# -# Sets FOUND_OPENCL to "yes" if OpenCL is found, to "no" if it is not. -# Sets OPENCL_CFLAGS and OPENCL_LIBS as needed. -# Calls AC_SUBST on all of the above. -# -AC_DEFUN([AMUSE_OPENCL], [ - amuse_save_CFLAGS="$CFLAGS" - amuse_save_LIBS="$LIBS" - - AC_MSG_CHECKING([for OpenCL]) - - # If the user overrode the variables, then we'll use what they set and verify that - # it works. - AS_IF([test "x$OPENCL_CFLAGS" != "x"], [ - amuse_user_OPENCL_CFLAGS="$OPENCL_CFLAGS" - CFLAGS="$OPENCL_CFLAGS $CFLAGS" - ]) - AS_IF([test "x$OPENCL_LIBS" != "x"], [ - amuse_user_OPENCL_LIBS="$OPENCL_LIBS" - LIBS="$OPENCL_LIBS $LIBS" - ]) - - # We only use OpenCL from C, in huayno - AC_LANG_PUSH([C]) - - # Search for the headers - m4_define([amuse_opencl_test_program], [AC_LANG_PROGRAM([ - #if defined(__APPLE__) || defined(__MACOSX) - #include - #else - #include - #endif - ], [clFinish(0)])]) - - AC_COMPILE_IFELSE([amuse_opencl_test_program], [ - # Search for the library as well - LIBS="-lOpenCL $LIBS" - AC_LINK_IFELSE([amuse_opencl_test_program], [ - FOUND_OPENCL="yes" - OPENCL_LIBS="-lOpenCL" - OPENCL_CFLAGS="" - ], [ - FOUND_OPENCL="no" - ]) - ], [ - FOUND_OPENCL="no" - ]) - - AC_LANG_POP([C]) - - LIBS="$amuse_save_LIBS" - CFLAGS="$amuse_save_CFLAGS" - - AC_MSG_RESULT([$FOUND_OPENCL]) - - AC_SUBST([FOUND_OPENCL]) - AC_SUBST([OPENCL_CFLAGS]) - AC_SUBST([OPENCL_LIBS]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/amuse_venv.m4 b/src/amuse_tidymess/support/shared/m4/amuse_venv.m4 deleted file mode 100644 index 155d88d9d6..0000000000 --- a/src/amuse_tidymess/support/shared/m4/amuse_venv.m4 +++ /dev/null @@ -1,31 +0,0 @@ -# Helper macro for installing into Conda envs and virtualenvs. - -# AMUSE_VENV() -# -# Detect the active Conda env or virtualenv and extend LDFLAGS and -# PKG_CONFIG_PATH to point to it. This then makes it possible to detect the AMUSE -# libraries as installed in the environment and link to them. -# -AC_DEFUN([AMUSE_VENV], [ - AS_IF([test "x$VIRTUAL_ENV" != x], [ - CFLAGS="$CFLAGS -I${VIRTUAL_ENV}/include" - CXXFLAGS="$CXXFLAGS -I${VIRTUAL_ENV}/include" - FFLAGS="$FFLAGS -I${VIRTUAL_ENV}/include" - FCFLAGS="$FCFLAGS -I${VIRTUAL_ENV}/include" - LDFLAGS="$LDFLAGS -L${VIRTUAL_ENV}/lib -Wl,-rpath,${VIRTUAL_ENV}/lib" - PKG_CONFIG_PATH="$VIRTUAL_ENV/lib/pkgconfig:$PKG_CONFIG_PATH" - ]) - - AS_IF([test "x$CONDA_PREFIX" != x], [ - # Conda does not set FCFLAGS, so we copy from FFLAGS here - FCFLAGS="$FFLAGS" - LDFLAGS="$LDFLAGS -L${CONDA_PREFIX}/lib -Wl,-rpath,${CONDA_PREFIX}/lib" - # Conda pkg-config includes this already, but in case we have one from - # the system... - PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${CONDA_PREFIX}/lib/pkgconfig" - ]) - # Needs to be exported or the PKG_CHECK_MODULES macro won't see it - export PKG_CONFIG_PATH - AC_SUBST([FFLAGS]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/ax_blas.m4 b/src/amuse_tidymess/support/shared/m4/ax_blas.m4 deleted file mode 100644 index 95719050a9..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_blas.m4 +++ /dev/null @@ -1,241 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_blas.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_BLAS([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro looks for a library that implements the BLAS linear-algebra -# interface (see http://www.netlib.org/blas/). On success, it sets the -# BLAS_LIBS output variable to hold the requisite library linkages. -# -# To link with BLAS, you should link with: -# -# $BLAS_LIBS $LIBS $FLIBS -# -# in that order. FLIBS is the output variable of the -# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is -# sometimes necessary in order to link with F77 libraries. Users will also -# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same -# reason. -# -# Many libraries are searched for, from ATLAS to CXML to ESSL. The user -# may also use --with-blas= in order to use some specific BLAS -# library . In order to link successfully, however, be aware that you -# will probably need to use the same Fortran compiler (which can be set -# via the F77 env. var.) as was used to compile the BLAS library. -# -# ACTION-IF-FOUND is a list of shell commands to run if a BLAS library is -# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is -# not found. If ACTION-IF-FOUND is not specified, the default action will -# define HAVE_BLAS. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2019 Geoffrey M. Oxberry -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 17 - -AU_ALIAS([ACX_BLAS], [AX_BLAS]) -AC_DEFUN([AX_BLAS], [ -AC_PREREQ([2.55]) -AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS]) -AC_REQUIRE([AC_CANONICAL_HOST]) -ax_blas_ok=no - -AC_ARG_WITH(blas, - [AS_HELP_STRING([--with-blas=], [use BLAS library ])]) -case $with_blas in - yes | "") ;; - no) ax_blas_ok=disable ;; - -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) - BLAS_LIBS="$with_blas" - ;; - *) BLAS_LIBS="-l$with_blas" ;; -esac - -# Get fortran linker names of BLAS functions to check for. -AC_F77_FUNC(sgemm) -AC_F77_FUNC(dgemm) - -ax_blas_save_LIBS="$LIBS" -LIBS="$LIBS $FLIBS" - -# First, check BLAS_LIBS environment variable -if test $ax_blas_ok = no; then -if test "x$BLAS_LIBS" != x; then - save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" - AC_MSG_CHECKING([for $sgemm in $BLAS_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes], [BLAS_LIBS=""]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi -fi - -# BLAS linked to by default? (happens on some supercomputers) -if test $ax_blas_ok = no; then - save_LIBS="$LIBS"; LIBS="$LIBS" - AC_MSG_CHECKING([if $sgemm is being linked in already]) - AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi - -# BLAS in OpenBLAS library? (http://xianyi.github.com/OpenBLAS/) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(openblas, $sgemm, [ax_blas_ok=yes - BLAS_LIBS="-lopenblas"]) -fi - -# BLAS in ATLAS library? (http://math-atlas.sourceforge.net/) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(atlas, ATL_xerbla, - [AC_CHECK_LIB(f77blas, $sgemm, - [AC_CHECK_LIB(cblas, cblas_dgemm, - [ax_blas_ok=yes - BLAS_LIBS="-lcblas -lf77blas -latlas"], - [], [-lf77blas -latlas])], - [], [-latlas])]) -fi - -# BLAS in PhiPACK libraries? (requires generic BLAS lib, too) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, - [AC_CHECK_LIB(dgemm, $dgemm, - [AC_CHECK_LIB(sgemm, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lsgemm -ldgemm -lblas"], - [], [-lblas])], - [], [-lblas])]) -fi - -# BLAS in Intel MKL library? -if test $ax_blas_ok = no; then - # MKL for gfortran - if test x"$ac_cv_fc_compiler_gnu" = xyes; then - # 64 bit - if test $host_cpu = x86_64; then - AC_CHECK_LIB(mkl_gf_lp64, $sgemm, - [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread"],, - [-lmkl_gf_lp64 -lmkl_sequential -lmkl_core -lpthread]) - # 32 bit - elif test $host_cpu = i686; then - AC_CHECK_LIB(mkl_gf, $sgemm, - [ax_blas_ok=yes;BLAS_LIBS="-lmkl_gf -lmkl_sequential -lmkl_core -lpthread"],, - [-lmkl_gf -lmkl_sequential -lmkl_core -lpthread]) - fi - # MKL for other compilers (Intel, PGI, ...?) - else - # 64-bit - if test $host_cpu = x86_64; then - AC_CHECK_LIB(mkl_intel_lp64, $sgemm, - [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread"],, - [-lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lpthread]) - # 32-bit - elif test $host_cpu = i686; then - AC_CHECK_LIB(mkl_intel, $sgemm, - [ax_blas_ok=yes;BLAS_LIBS="-lmkl_intel -lmkl_sequential -lmkl_core -lpthread"],, - [-lmkl_intel -lmkl_sequential -lmkl_core -lpthread]) - fi - fi -fi -# Old versions of MKL -if test $ax_blas_ok = no; then - AC_CHECK_LIB(mkl, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lmkl -lguide -lpthread"],,[-lguide -lpthread]) -fi - -# BLAS in Apple vecLib library? -if test $ax_blas_ok = no; then - save_LIBS="$LIBS"; LIBS="-framework vecLib $LIBS" - AC_MSG_CHECKING([for $sgemm in -framework vecLib]) - AC_LINK_IFELSE([AC_LANG_CALL([], [$sgemm])], [ax_blas_ok=yes;BLAS_LIBS="-framework vecLib"]) - AC_MSG_RESULT($ax_blas_ok) - LIBS="$save_LIBS" -fi - -# BLAS in Alpha CXML library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(cxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-lcxml"]) -fi - -# BLAS in Alpha DXML library? (now called CXML, see above) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(dxml, $sgemm, [ax_blas_ok=yes;BLAS_LIBS="-ldxml"]) -fi - -# BLAS in Sun Performance library? -if test $ax_blas_ok = no; then - if test "x$GCC" != xyes; then # only works with Sun CC - AC_CHECK_LIB(sunmath, acosp, - [AC_CHECK_LIB(sunperf, $sgemm, - [BLAS_LIBS="-xlic_lib=sunperf -lsunmath" - ax_blas_ok=yes],[],[-lsunmath])]) - fi -fi - -# BLAS in SCSL library? (SGI/Cray Scientific Library) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(scs, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lscs"]) -fi - -# BLAS in SGIMATH library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(complib.sgimath, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lcomplib.sgimath"]) -fi - -# BLAS in IBM ESSL library? (requires generic BLAS lib, too) -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, - [AC_CHECK_LIB(essl, $sgemm, - [ax_blas_ok=yes; BLAS_LIBS="-lessl -lblas"], - [], [-lblas $FLIBS])]) -fi - -# Generic BLAS library? -if test $ax_blas_ok = no; then - AC_CHECK_LIB(blas, $sgemm, [ax_blas_ok=yes; BLAS_LIBS="-lblas"]) -fi - -AC_SUBST(BLAS_LIBS) - -LIBS="$ax_blas_save_LIBS" - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_blas_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_BLAS,1,[Define if you have a BLAS library.]),[$1]) - : -else - ax_blas_ok=no - $2 -fi -])dnl AX_BLAS diff --git a/src/amuse_tidymess/support/shared/m4/ax_check_classpath.m4 b/src/amuse_tidymess/support/shared/m4/ax_check_classpath.m4 deleted file mode 100644 index 55b43d93e3..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_check_classpath.m4 +++ /dev/null @@ -1,61 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_classpath.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_CLASSPATH -# -# DESCRIPTION -# -# AX_CHECK_CLASSPATH just displays the CLASSPATH, for the edification of -# the user. -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. The -# general documentation, as well as the sample configure.in, is included -# in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 6 - -AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) -AC_DEFUN([AX_CHECK_CLASSPATH],[ -if test "x$CLASSPATH" = x; then - echo "You have no CLASSPATH, I hope it is good" -else - echo "You have CLASSPATH $CLASSPATH, hope it is correct" -fi -]) - diff --git a/src/amuse_tidymess/support/shared/m4/ax_check_gnu_make.m4 b/src/amuse_tidymess/support/shared/m4/ax_check_gnu_make.m4 deleted file mode 100644 index 71ffe34817..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_check_gnu_make.m4 +++ /dev/null @@ -1,96 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_GNU_MAKE([run-if-true],[run-if-false]) -# -# DESCRIPTION -# -# This macro searches for a GNU version of make. If a match is found: -# -# * The makefile variable `ifGNUmake' is set to the empty string, otherwise -# it is set to "#". This is useful for including a special features in a -# Makefile, which cannot be handled by other versions of make. -# * The makefile variable `ifnGNUmake' is set to #, otherwise -# it is set to the empty string. This is useful for including a special -# features in a Makefile, which can be handled -# by other versions of make or to specify else like clause. -# * The variable `_cv_gnu_make_command` is set to the command to invoke -# GNU make if it exists, the empty string otherwise. -# * The variable `ax_cv_gnu_make_command` is set to the command to invoke -# GNU make by copying `_cv_gnu_make_command`, otherwise it is unset. -# * If GNU Make is found, its version is extracted from the output of -# `make --version` as the last field of a record of space-separated -# columns and saved into the variable `ax_check_gnu_make_version`. -# * Additionally if GNU Make is found, run shell code run-if-true -# else run shell code run-if-false. -# -# Here is an example of its use: -# -# Makefile.in might contain: -# -# # A failsafe way of putting a dependency rule into a makefile -# $(DEPEND): -# $(CC) -MM $(srcdir)/*.c > $(DEPEND) -# -# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) -# @ifGNUmake@ include $(DEPEND) -# @ifGNUmake@ else -# fallback code -# @ifGNUmake@ endif -# -# Then configure.in would normally contain: -# -# AX_CHECK_GNU_MAKE() -# AC_OUTPUT(Makefile) -# -# Then perhaps to cause gnu make to override any other make, we could do -# something like this (note that GNU make always looks for GNUmakefile -# first): -# -# if ! test x$_cv_gnu_make_command = x ; then -# mv Makefile GNUmakefile -# echo .DEFAULT: > Makefile ; -# echo \ $_cv_gnu_make_command \$@ >> Makefile; -# fi -# -# Then, if any (well almost any) other make is called, and GNU make also -# exists, then the other make wraps the GNU make. -# -# LICENSE -# -# Copyright (c) 2008 John Darrington -# Copyright (c) 2015 Enrico M. Crisostomo -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 12 - -AC_DEFUN([AX_CHECK_GNU_MAKE],dnl - [AC_PROG_AWK - AC_CACHE_CHECK([for GNU make],[_cv_gnu_make_command],[dnl - _cv_gnu_make_command="" ; -dnl Search all the common names for GNU make - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then - _cv_gnu_make_command=$a ; - AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make") - ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') - break ; - fi - done ;]) -dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise - AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])]) - AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifnGNUmake], [""])], [AS_VAR_SET([ifnGNUmake], ["#"])]) - AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])]) - AS_VAR_IF([_cv_gnu_make_command], [""],[$2],[$1]) - AC_SUBST([ifGNUmake]) - AC_SUBST([ifnGNUmake]) -]) - diff --git a/src/amuse_tidymess/support/shared/m4/ax_count_cpus.m4 b/src/amuse_tidymess/support/shared/m4/ax_count_cpus.m4 deleted file mode 100644 index 5db8925534..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_count_cpus.m4 +++ /dev/null @@ -1,101 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED]) -# -# DESCRIPTION -# -# Attempt to count the number of logical processor cores (including -# virtual and HT cores) currently available to use on the machine and -# place detected value in CPU_COUNT variable. -# -# On successful detection, ACTION-IF-DETECTED is executed if present. If -# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The -# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1. -# -# LICENSE -# -# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) -# Copyright (c) 2012 Brian Aker -# Copyright (c) 2008 Michael Paul Bailey -# Copyright (c) 2008 Christophe Tournayre -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 22 - - AC_DEFUN([AX_COUNT_CPUS],[dnl - AC_REQUIRE([AC_CANONICAL_HOST])dnl - AC_REQUIRE([AC_PROG_EGREP])dnl - AC_MSG_CHECKING([the number of available CPUs]) - CPU_COUNT="0" - - # Try generic methods - - # 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and - # 'NPROCESSORS_ONLN' are platform-specific - command -v getconf >/dev/null 2>&1 && \ - CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0" - AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl - # 'nproc' is part of GNU Coreutils and is widely available - CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0" - ])dnl - - AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl - # Try platform-specific preferred methods - AS_CASE([[$host_os]],dnl - [[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl - [[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl - [[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl - [[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl - [[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl - [[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl - [[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl - [[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl - )dnl - ])dnl - - AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl - # Try less preferred generic method - # 'hw.ncpu' exist on many platforms, but not on GNU/Linux - CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0" - ])dnl - - AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl - # Try platform-specific fallback methods - # They can be less accurate and slower then preferred methods - AS_CASE([[$host_os]],dnl - [[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl - [[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl - [[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl - [[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \ - CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl - [[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \ - CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl - [[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl - [[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl - [[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl - [[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl - )dnl - ])dnl - - AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl - AC_MSG_RESULT([[$CPU_COUNT]]) - m4_ifvaln([$1],[$1],)dnl - ],[dnl - m4_ifval([$2],[dnl - AS_UNSET([[CPU_COUNT]]) - AC_MSG_RESULT([[unable to detect]]) - $2 - ], [dnl - CPU_COUNT="1" - AC_MSG_RESULT([[unable to detect (assuming 1)]]) - ])dnl - ])dnl - ])dnl diff --git a/src/amuse_tidymess/support/shared/m4/ax_lapack.m4 b/src/amuse_tidymess/support/shared/m4/ax_lapack.m4 deleted file mode 100644 index abaff9d171..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_lapack.m4 +++ /dev/null @@ -1,134 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_lapack.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LAPACK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro looks for a library that implements the LAPACK linear-algebra -# interface (see http://www.netlib.org/lapack/). On success, it sets the -# LAPACK_LIBS output variable to hold the requisite library linkages. -# -# To link with LAPACK, you should link with: -# -# $LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS -# -# in that order. BLAS_LIBS is the output variable of the AX_BLAS macro, -# called automatically. FLIBS is the output variable of the -# AC_F77_LIBRARY_LDFLAGS macro (called if necessary by AX_BLAS), and is -# sometimes necessary in order to link with F77 libraries. Users will also -# need to use AC_F77_DUMMY_MAIN (see the autoconf manual), for the same -# reason. -# -# The user may also use --with-lapack= in order to use some specific -# LAPACK library . In order to link successfully, however, be aware -# that you will probably need to use the same Fortran compiler (which can -# be set via the F77 env. var.) as was used to compile the LAPACK and BLAS -# libraries. -# -# ACTION-IF-FOUND is a list of shell commands to run if a LAPACK library -# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it -# is not found. If ACTION-IF-FOUND is not specified, the default action -# will define HAVE_LAPACK. -# -# LICENSE -# -# Copyright (c) 2009 Steven G. Johnson -# Copyright (c) 2019 Geoffrey M. Oxberry -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 10 - -AU_ALIAS([ACX_LAPACK], [AX_LAPACK]) -AC_DEFUN([AX_LAPACK], [ -AC_REQUIRE([AX_BLAS]) -ax_lapack_ok=no - -AC_ARG_WITH(lapack, - [AS_HELP_STRING([--with-lapack=], [use LAPACK library ])]) -case $with_lapack in - yes | "") ;; - no) ax_lapack_ok=disable ;; - -* | */* | *.a | *.so | *.so.* | *.dylib | *.dylib.* | *.o) - LAPACK_LIBS="$with_lapack" - ;; - *) LAPACK_LIBS="-l$with_lapack" ;; -esac - -# Get fortran linker name of LAPACK function to check for. -AC_F77_FUNC(cheev) - -# We cannot use LAPACK if BLAS is not found -if test "x$ax_blas_ok" != xyes; then - ax_lapack_ok=noblas - LAPACK_LIBS="" -fi - -# First, check LAPACK_LIBS environment variable -if test "x$LAPACK_LIBS" != x; then - save_LIBS="$LIBS"; LIBS="$LAPACK_LIBS $BLAS_LIBS $LIBS $FLIBS" - AC_MSG_CHECKING([for $cheev in $LAPACK_LIBS]) - AC_LINK_IFELSE([AC_LANG_CALL([], [$cheev])], [ax_lapack_ok=yes], [LAPACK_LIBS=""]) - AC_MSG_RESULT($ax_lapack_ok) - LIBS="$save_LIBS" - if test $ax_lapack_ok = no; then - LAPACK_LIBS="" - fi -fi - -# LAPACK linked to by default? (is sometimes included in BLAS lib) -if test $ax_lapack_ok = no; then - save_LIBS="$LIBS"; LIBS="$LIBS $BLAS_LIBS $FLIBS" - AC_CHECK_FUNC($cheev, [ax_lapack_ok=yes]) - LIBS="$save_LIBS" -fi - -# Generic LAPACK library? -for lapack in lapack lapack_rs6k; do - if test $ax_lapack_ok = no; then - save_LIBS="$LIBS"; LIBS="$BLAS_LIBS $LIBS" - AC_CHECK_LIB($lapack, $cheev, - [ax_lapack_ok=yes; LAPACK_LIBS="-l$lapack"], [], [$FLIBS]) - LIBS="$save_LIBS" - fi -done - -AC_SUBST(LAPACK_LIBS) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x"$ax_lapack_ok" = xyes; then - ifelse([$1],,AC_DEFINE(HAVE_LAPACK,1,[Define if you have LAPACK library.]),[$1]) - : -else - ax_lapack_ok=no - $2 -fi -])dnl AX_LAPACK diff --git a/src/amuse_tidymess/support/shared/m4/ax_lib_hdf5.m4 b/src/amuse_tidymess/support/shared/m4/ax_lib_hdf5.m4 deleted file mode 100644 index 074c2a820a..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_lib_hdf5.m4 +++ /dev/null @@ -1,323 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_lib_hdf5.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LIB_HDF5([serial/parallel]) -# -# DESCRIPTION -# -# This macro provides tests of the availability of HDF5 library. -# -# The optional macro argument should be either 'serial' or 'parallel'. The -# former only looks for serial HDF5 installations via h5cc. The latter -# only looks for parallel HDF5 installations via h5pcc. If the optional -# argument is omitted, serial installations will be preferred over -# parallel ones. -# -# The macro adds a --with-hdf5 option accepting one of three values: -# -# no - do not check for the HDF5 library. -# yes - do check for HDF5 library in standard locations. -# path - complete path to the HDF5 helper script h5cc or h5pcc. -# -# If HDF5 is successfully found, this macro calls -# -# AC_SUBST(HDF5_VERSION) -# AC_SUBST(HDF5_CC) -# AC_SUBST(HDF5_CFLAGS) -# AC_SUBST(HDF5_CPPFLAGS) -# AC_SUBST(HDF5_LDFLAGS) -# AC_SUBST(HDF5_LIBS) -# AC_SUBST(HDF5_FC) -# AC_SUBST(HDF5_FFLAGS) -# AC_SUBST(HDF5_FLIBS) -# AC_SUBST(HDF5_TYPE) -# AC_DEFINE(HAVE_HDF5) -# -# and sets with_hdf5="yes". Additionally, the macro sets -# with_hdf5_fortran="yes" if a matching Fortran wrapper script is found. -# Note that Autoconf's Fortran support is not used to perform this check. -# H5CC and H5FC will contain the appropriate serial or parallel HDF5 -# wrapper script locations. -# -# If HDF5 is disabled or not found, this macros sets with_hdf5="no" and -# with_hdf5_fortran="no". -# -# Your configuration script can test $with_hdf to take any further -# actions. HDF5_{C,CPP,LD}FLAGS may be used when building with C or C++. -# HDF5_F{FLAGS,LIBS} should be used when building Fortran applications. -# -# To use the macro, one would code one of the following in "configure.ac" -# before AC_OUTPUT: -# -# 1) dnl Check for HDF5 support -# AX_LIB_HDF5() -# -# 2) dnl Check for serial HDF5 support -# AX_LIB_HDF5([serial]) -# -# 3) dnl Check for parallel HDF5 support -# AX_LIB_HDF5([parallel]) -# -# One could test $with_hdf5 for the outcome or display it as follows -# -# echo "HDF5 support: $with_hdf5" -# -# You could also for example, override the default CC in "configure.ac" to -# enforce compilation with the compiler that HDF5 uses: -# -# AX_LIB_HDF5([parallel]) -# if test "$with_hdf5" = "yes"; then -# CC="$HDF5_CC" -# else -# AC_MSG_ERROR([Unable to find HDF5, we need parallel HDF5.]) -# fi -# -# The HDF5_TYPE environment variable returns "parallel" or "serial", -# depending on which type of library is found. -# -# LICENSE -# -# Copyright (c) 2009 Timothy Brown -# Copyright (c) 2010 Rhys Ulerich -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 20 - -AC_DEFUN([AX_LIB_HDF5], [ - -AC_REQUIRE([AC_PROG_SED]) -AC_REQUIRE([AC_PROG_AWK]) -AC_REQUIRE([AC_PROG_GREP]) - -dnl Check first argument is one of the recognized values. -dnl Fail eagerly if is incorrect as this simplifies case statements below. -if test "m4_normalize(m4_default([$1],[]))" = "" ; then - : # Recognized value -elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then - : # Recognized value -elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then - : # Recognized value -else - AC_MSG_ERROR([ -Unrecognized value for AX[]_LIB_HDF5 within configure.ac. -If supplied, argument 1 must be either 'serial' or 'parallel'. -]) -fi - -dnl Add a default --with-hdf5 configuration option. -AC_ARG_WITH([hdf5], - AS_HELP_STRING( - [--with-hdf5=[yes/no/PATH]], - m4_case(m4_normalize([$1]), - [serial], [location of h5cc for serial HDF5 configuration], - [parallel], [location of h5pcc for parallel HDF5 configuration], - [location of h5cc or h5pcc for HDF5 configuration]) - ), - [if test "$withval" = "no"; then - with_hdf5="no" - elif test "$withval" = "yes"; then - with_hdf5="yes" - else - with_hdf5="yes" - H5CC="$withval" - fi], - [with_hdf5="yes"] -) - -dnl Set defaults to blank -HDF5_CC="" -HDF5_VERSION="" -HDF5_CFLAGS="" -HDF5_CPPFLAGS="" -HDF5_LDFLAGS="" -HDF5_LIBS="" -HDF5_FC="" -HDF5_FFLAGS="" -HDF5_FLIBS="" -HDF5_TYPE="" - -dnl Try and find hdf5 compiler tools and options. -if test "$with_hdf5" = "yes"; then - if test -z "$H5CC"; then - dnl Check to see if H5CC is in the path. - AC_PATH_PROGS( - [H5CC], - m4_case(m4_normalize([$1]), - [serial], [h5cc], - [parallel], [h5pcc], - [h5cc h5pcc]), - []) - else - AC_MSG_CHECKING([Using provided HDF5 C wrapper]) - AC_MSG_RESULT([$H5CC]) - fi - AC_MSG_CHECKING([for HDF5 type]) - AS_CASE([$H5CC], - [*h5pcc], [HDF5_TYPE=parallel], - [*h5cc], [HDF5_TYPE=serial], - [HDF5_TYPE=neither]) - AC_MSG_RESULT([$HDF5_TYPE]) - AC_MSG_CHECKING([for HDF5 libraries]) - if test ! -f "$H5CC" || test ! -x "$H5CC"; then - AC_MSG_RESULT([no]) - AC_MSG_WARN(m4_case(m4_normalize([$1]), - [serial], [ -Unable to locate serial HDF5 compilation helper script 'h5cc'. -Please specify --with-hdf5= as the full path to h5cc. -HDF5 support is being disabled (equivalent to --with-hdf5=no). -], [parallel],[ -Unable to locate parallel HDF5 compilation helper script 'h5pcc'. -Please specify --with-hdf5= as the full path to h5pcc. -HDF5 support is being disabled (equivalent to --with-hdf5=no). -], [ -Unable to locate HDF5 compilation helper scripts 'h5cc' or 'h5pcc'. -Please specify --with-hdf5= as the full path to h5cc or h5pcc. -HDF5 support is being disabled (equivalent to --with-hdf5=no). -])) - with_hdf5="no" - with_hdf5_fortran="no" - else - dnl Get the h5cc output - HDF5_SHOW=$(eval $H5CC -show) - - dnl Get the actual compiler used - HDF5_CC=$(eval $H5CC -show | head -n 1 | $AWK '{print $[]1}') - if test "$HDF5_CC" = "ccache"; then - HDF5_CC=$(eval $H5CC -show | head -n 1 | $AWK '{print $[]2}') - fi - - dnl h5cc provides both AM_ and non-AM_ options - dnl depending on how it was compiled either one of - dnl these are empty. Lets roll them both into one. - - dnl Look for "HDF5 Version: X.Y.Z" - HDF5_VERSION=$(eval $H5CC -showconfig | $GREP 'HDF5 Version:' \ - | $AWK '{print $[]3}') - - dnl A ideal situation would be where everything we needed was - dnl in the AM_* variables. However most systems are not like this - dnl and seem to have the values in the non-AM variables. - dnl - dnl We try the following to find the flags: - dnl (1) Look for "NAME:" tags - dnl (2) Look for "H5_NAME:" tags - dnl (3) Look for "AM_NAME:" tags - dnl - HDF5_tmp_flags=$(eval $H5CC -showconfig \ - | $GREP 'FLAGS\|Extra libraries:' \ - | $AWK -F: '{printf("%s "), $[]2}' ) - - dnl Find the installation directory and append include/ - HDF5_tmp_inst=$(eval $H5CC -showconfig \ - | $GREP 'Installation point:' \ - | $AWK '{print $[]NF}' ) - - dnl Add this to the CPPFLAGS - HDF5_CPPFLAGS="-I${HDF5_tmp_inst}/include" - - dnl Now sort the flags out based upon their prefixes - for arg in $HDF5_SHOW $HDF5_tmp_flags ; do - case "$arg" in - -I*) echo $HDF5_CPPFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ - || HDF5_CPPFLAGS="$HDF5_CPPFLAGS $arg" - ;; - -L*) echo $HDF5_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ - || HDF5_LDFLAGS="$HDF5_LDFLAGS $arg" - ;; - -l*) echo $HDF5_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \ - || HDF5_LIBS="$HDF5_LIBS $arg" - ;; - esac - done - - HDF5_LIBS="-lhdf5 $HDF5_LIBS" - AC_MSG_RESULT([yes (version $[HDF5_VERSION])]) - - dnl See if we can compile - AC_LANG_PUSH([C]) - ax_lib_hdf5_save_CC=$CC - ax_lib_hdf5_save_CPPFLAGS=$CPPFLAGS - ax_lib_hdf5_save_LIBS=$LIBS - ax_lib_hdf5_save_LDFLAGS=$LDFLAGS - CC=$HDF5_CC - CPPFLAGS=$HDF5_CPPFLAGS - LIBS=$HDF5_LIBS - LDFLAGS=$HDF5_LDFLAGS - AC_CHECK_HEADER([hdf5.h], [ac_cv_hadf5_h=yes], [ac_cv_hadf5_h=no]) - AC_CHECK_LIB([hdf5], [H5Fcreate], [ac_cv_libhdf5=yes], - [ac_cv_libhdf5=no]) - if test "$ac_cv_hadf5_h" = "no" && test "$ac_cv_libhdf5" = "no" ; then - AC_MSG_WARN([Unable to compile HDF5 test program]) - fi - dnl Look for HDF5's high level library - AC_HAVE_LIBRARY([hdf5_hl], [HDF5_LIBS="-lhdf5_hl $HDF5_LIBS"], [], []) - - CC=$ax_lib_hdf5_save_CC - CPPFLAGS=$ax_lib_hdf5_save_CPPFLAGS - LIBS=$ax_lib_hdf5_save_LIBS - LDFLAGS=$ax_lib_hdf5_save_LDFLAGS - AC_LANG_POP([C]) - - AC_MSG_CHECKING([for matching HDF5 Fortran wrapper]) - dnl Presume HDF5 Fortran wrapper is just a name variant from H5CC - H5FC=$(eval echo -n $H5CC | $SED -n 's/cc$/fc/p') - if test -x "$H5FC"; then - AC_MSG_RESULT([$H5FC]) - with_hdf5_fortran="yes" - AC_SUBST([H5FC]) - - dnl Again, pry any remaining -Idir/-Ldir from compiler wrapper - for arg in `$H5FC -show` - do - case "$arg" in #( - -I*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \ - || HDF5_FFLAGS="$HDF5_FFLAGS $arg" - ;;#( - -L*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \ - || HDF5_FFLAGS="$HDF5_FFLAGS $arg" - dnl HDF5 installs .mod files in with libraries, - dnl but some compilers need to find them with -I - echo $HDF5_FFLAGS | $GREP -e "-I${arg#-L}" >/dev/null \ - || HDF5_FFLAGS="$HDF5_FFLAGS -I${arg#-L}" - ;; - esac - done - - dnl Make Fortran link line by inserting Fortran libraries - for arg in $HDF5_LIBS - do - case "$arg" in #( - -lhdf5_hl) HDF5_FLIBS="$HDF5_FLIBS -lhdf5hl_fortran $arg" - ;; #( - -lhdf5) HDF5_FLIBS="$HDF5_FLIBS -lhdf5_fortran $arg" - ;; #( - *) HDF5_FLIBS="$HDF5_FLIBS $arg" - ;; - esac - done - else - AC_MSG_RESULT([no]) - with_hdf5_fortran="no" - fi - - AC_SUBST([HDF5_VERSION]) - AC_SUBST([HDF5_CC]) - AC_SUBST([HDF5_CFLAGS]) - AC_SUBST([HDF5_CPPFLAGS]) - AC_SUBST([HDF5_LDFLAGS]) - AC_SUBST([HDF5_LIBS]) - AC_SUBST([HDF5_FC]) - AC_SUBST([HDF5_FFLAGS]) - AC_SUBST([HDF5_FLIBS]) - AC_SUBST([HDF5_TYPE]) - AC_DEFINE([HAVE_HDF5], [1], [Defined if you have HDF5 support]) - fi -fi -]) diff --git a/src/amuse_tidymess/support/shared/m4/ax_lib_netcdf4.m4 b/src/amuse_tidymess/support/shared/m4/ax_lib_netcdf4.m4 deleted file mode 100644 index e9dd487a02..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_lib_netcdf4.m4 +++ /dev/null @@ -1,277 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_lib_netcdf4.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_LIB_NETCDF4([serial/parallel]) -# -# DESCRIPTION -# -# This macro provides tests of the availability of the NetCDF v4 library. -# -# The optional macro argument should be either 'serial' or 'parallel'. The -# macro will call nc-config to check the output of the '--has-pnetcdf' -# option and error out if the requested parallel isn't supported. -# -# If the optional argument is omitted, no check is made to see if NetCDF -# has parallel support. -# -# The macro adds a --with-netcdf4 option accepting one of three values: -# -# no - do not check for the NetCDF4 library. -# yes - do check for NetCDF4 library in standard locations. -# path - installation prefix for NetCDF version 4. -# -# If NetCDF4 is successfully found, this macro calls -# -# AC_SUBST(NETCDF4_VERSION) -# AC_SUBST(NETCDF4_CC) -# AC_SUBST(NETCDF4_CFLAGS) -# AC_SUBST(NETCDF4_CPPFLAGS) -# AC_SUBST(NETCDF4_LDFLAGS) -# AC_SUBST(NETCDF4_LIBS) -# AC_SUBST(NETCDF4_FC) -# AC_SUBST(NETCDF4_FFLAGS) -# AC_SUBST(NETCDF4_FLIBS) -# AC_DEFINE(HAVE_NETCDF4) -# -# It also sets -# -# with_netcdf4="yes" -# with_netcdf4_fortran="yes" (if NetCDF has Fortran support) -# with_netcdf4_parallel="yes" (if NetCDF has MPI support) -# -# If NetCDF4 is disabled or not found, this macros sets -# -# with_netcdf4="no" -# with_netcdf4_fortran="no" -# -# Note it does not set with_netcdf4_parallel in this case. -# -# Your configuration script can test $with_netcdf4 to take any further -# actions. NETCDF4_{C,CPP,LD}FLAGS may be used when building with C or -# C++. NETCDF4_F{FLAGS,LIBS} and NETCDF4_LDFLAGS should be used when -# building Fortran applications. -# -# To use the macro, one would code one of the following in "configure.ac" -# before AC_OUTPUT: -# -# 1) dnl Check for NetCDF4 support -# AX_LIB_NETCDF4() -# -# 2) dnl Check for serial NetCDF4 support -# AX_LIB_NETCDF4([serial]) -# -# 3) dnl Check for parallel NetCDF4 support -# AX_LIB_NETCDF4([parallel]) -# -# One could test $with_netcdf4 for the outcome or display it as follows -# -# echo "NetCDF v4 support: $with_netcdf4" -# -# One could also for example, override the default CC in "configure.ac" to -# enforce compilation with the compiler that NetCDF v4 was built with: -# -# AX_LIB_NETCDF4([parallel]) -# if test "$with_netcdf4" = "yes"; then -# CC="$NETCDF4_CC" -# else -# AC_MSG_ERROR([Unable to find NetCDF4, we need parallel NetCDF4.]) -# fi -# -# LICENSE -# -# Copyright (c) 2016 Timothy Brown -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 2 - -AC_DEFUN([AX_LIB_NETCDF4], [ - -AC_REQUIRE([AC_PROG_SED]) -AC_REQUIRE([AC_PROG_AWK]) -AC_REQUIRE([AC_PROG_GREP]) - -dnl Check first argument is one of the recognized values. -dnl Fail eagerly if is incorrect as this simplifies case statements below. -if test "m4_normalize(m4_default([$1],[]))" = "" ; then - netcdf4_requested_mode="serial" -elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then - netcdf4_requested_mode="serial" -elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then - netcdf4_requested_mode="parallel" -else - AC_MSG_ERROR([ -Unrecognized value for AX[]_LIB_NETCDF4 within configure.ac. -If supplied, argument 1 must be either 'serial' or 'parallel'. -]) -fi - -dnl Add a default --with-netcdf4 configuration option. -AC_ARG_WITH([netcdf4], - AS_HELP_STRING( - [--with-netcdf4=[yes/no/PATH]], - m4_case(m4_normalize([$1]), - [serial], [base directory of serial NetCDF4 installation], - [parallel], [base directory of parallel NetCDF4 installation], - [base directory of NetCDF4 installation]) - ), - [if test "$withval" = "no"; then - with_netcdf4="no" - elif test "$withval" = "yes"; then - with_netcdf4="yes" - else - with_netcdf4="yes" - NETCDF4_PREFIX="${withval}" - NC_CONFIG="${withval}/bin/nc-config" - fi], - [with_netcdf4="yes"] -) - -dnl Set defaults to blank -NETCDF4_CC="" -NETCDF4_VERSION="" -NETCDF4_CFLAGS="" -NETCDF4_CPPFLAGS="" -NETCDF4_LDFLAGS="" -NETCDF4_LIBS="" -NETCDF4_FC="" -NETCDF4_FFLAGS="" -NETCDF4_FLIBS="" - -dnl Try and find NetCDF4 tools and options. -if test "$with_netcdf4" = "yes"; then - if test -z "$NC_CONFIG"; then - dnl Check to see if NC_CONFIG is in the path. - AC_PATH_PROGS([NC_CONFIG], [nc-config], []) - NETCDF4_PREFIX=$(AS_DIRNAME([$(AS_DIRNAME(["$NC_CONFIG"]))])) - else - AC_MSG_CHECKING([Using provided NetCDF4 prefix]) - AC_MSG_RESULT([$NC_CONFIG]) - fi - - AC_MSG_CHECKING([for NetCDF4 libraries]) - - if test ! -f "$NC_CONFIG" || test ! -x "$NC_CONFIG"; then - AC_MSG_RESULT([no]) - AC_MSG_WARN([ - -Unable to locate NetCDF4 compilation helper script 'nc-config'. -Please specify --with-netcdf4= as the full path prefix -where NetCDF4 has been installed. -NetCDF4 support is being disabled (equivalent to --with-netcdf4=no). -]) - with_netcdf4="no" - with_netcdf4_fortran="no" - else - dnl Get the actual compiler used - NETCDF4_CC=$(eval $NC_CONFIG --cc | $AWK '{print $[]1}') - if test "$NETCDF4_CC" = "ccache"; then - NETCDF4_CC=$(eval $NC_CONFIG --cc | $AWK '{print $[]2}') - fi - - dnl Look for version - NETCDF4_VERSION=$(eval $NC_CONFIG --version | $AWK '{print $[]2}') - - dnl Look for the CFLAGS - NETCDF4_CFLAGS=$(eval $NC_CONFIG --cflags) - - dnl Look for the LIBS and LDFLAGS - NETCDF4_tmp_clibs=$(eval $NC_CONFIG --libs) - - dnl Sort out the tmp libs based on their prefixes - for arg in $NETCDF4_tmp_clibs ; do - case "$arg" in - -L*) echo $NETCDF4_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ - || NETCDF4_LDFLAGS="$arg $NETCDF4_LDFLAGS" - ;; - -l*) echo $NETCDF4_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \ - || NETCDF4_LIBS="$arg $NETCDF4_LIBS" - ;; - esac - done - - AC_MSG_RESULT([yes (version $[NETCDF4_VERSION])]) - - dnl See if we need (and have) parallel support - if test "$netcdf4_requested_mode" = "parallel" ; then - with_netcdf4_parallel=$(eval $NC_CONFIG --has-pnetcdf) - if test "$with_netcdf4_parallel" = "no" ; then - AC_MSG_ERROR([ -parallel NetCDF4 is not supported (while it was requested) -]) - fi - fi - - dnl See if we can compile - ax_lib_netcdf4_save_CC=$CC - ax_lib_netcdf4_save_CPPFLAGS=$CPPFLAGS - ax_lib_netcdf4_save_LIBS=$LIBS - ax_lib_netcdf4_save_LDFLAGS=$LDFLAGS - CC=$NETCDF4_CC - CFLAGS=$NETCDF4_CFLAGS - LIBS=$NETCDF4_LIBS - LDFLAGS=$NETCDF4_LDFLAGS - AC_CHECK_HEADER([netcdf.h], [ac_cv_netcdf4_h=yes], [ac_cv_netcdf4_h=no]) - AC_CHECK_LIB([netcdf], [nc_create], [ac_cv_libnetcdf4=yes], - [ac_cv_libnetcdf4=no]) - if test "$ac_cv_netcdf4_h" = "no" && \ - test "$ac_cv_libnetcdf4" = "no" ; then - AC_MSG_WARN([Unable to compile NetCDF4 test program]) - fi - - CC=$ax_lib_netcdf4_save_CC - CFLAGS=$ax_lib_netcdf4_save_CFLAGS - LIBS=$ax_lib_netcdf4_save_LIBS - LDFLAGS=$ax_lib_hdf5_save_LDFLAGS - - - AC_MSG_CHECKING([for matching NetCDF4 Fortran libraries]) - NF_CONFIG="${NETCDF4_PREFIX}/bin/nf-config" - if test ! -f "$NF_CONFIG" || test ! -x "$NF_CONFIG"; then - AC_MSG_RESULT([no]) - with_netcdf4_fortran="no" - else - NETCDF_FVERSION=$(eval $NF_CONFIG --version | $AWK '{print $[]2}') - AC_MSG_RESULT([yes (version $[NETCDF_FVERSION])]) - NETCDF4_FC=$(eval $NF_CONFIG --fc | $AWK '{print $[]1}') - if test "$NETCDF4_FC" = "ccache"; then - NETCDF4_FC=$(eval $NF_CONFIG --fc | $AWK '{print $[]2}') - fi - dnl Look for the FFLAGS - NETCDF4_FFLAGS=$(eval $NC_CONFIG --fflags) - - dnl Look for the FLIBS and LDFLAGS - NETCDF4_tmp_flibs=$(eval $NC_CONFIG --flibs) - - dnl Sort out the tmp libs based on their prefixes - for arg in $NETCDF4_tmp_flibs ; do - case "$arg" in - -L*) echo $NETCDF4_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \ - || NETCDF4_LDFLAGS="$arg $NETCDF4_LDFLAGS" - ;; - -l*) echo $NETCDF4_FLIBS | $GREP -e "$arg" 2>&1 >/dev/null \ - || NETCDF4_FLIBS="$arg $NETCDF4_FLIBS" - ;; - esac - done - with_netcdf4_fortran="yes" - fi - - AC_SUBST([NETCDF4_VERSION]) - AC_SUBST([NETCDF4_CC]) - AC_SUBST([NETCDF4_CFLAGS]) - AC_SUBST([NETCDF4_LDFLAGS]) - AC_SUBST([NETCDF4_LIBS]) - AC_SUBST([NETCDF4_FC]) - AC_SUBST([NETCDF4_FFLAGS]) - AC_SUBST([NETCDF4_FLIBS]) - AC_DEFINE([HAVE_NETCDF4], [1], [Defined if you have NETCDF4 support]) - fi -fi -]) diff --git a/src/amuse_tidymess/support/shared/m4/ax_mpi.m4 b/src/amuse_tidymess/support/shared/m4/ax_mpi.m4 deleted file mode 100644 index dbde02a9c4..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_mpi.m4 +++ /dev/null @@ -1,235 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_mpi.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_MPI([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro tries to find out how to compile programs that use MPI -# (Message Passing Interface), a standard API for parallel process -# communication (see http://www-unix.mcs.anl.gov/mpi/) -# -# On success, it sets the MPICC, MPICXX, MPIF77, or MPIFC output variable -# to the name of the MPI compiler, depending upon the current language. -# (This may just be $CC/$CXX/$F77/$FC, but is more often something like -# mpicc/mpiCC/mpif77/mpif90.) It also sets MPILIBS to any libraries that -# are needed for linking MPI (e.g. -lmpi or -lfmpi, if a special -# MPICC/MPICXX/MPIF77/MPIFC was not found). -# -# If you want to compile everything with MPI, you should use something -# like this for C: -# -# if test -z "$CC" && test -n "$MPICC"; then -# CC="$MPICC" -# fi -# AC_PROG_CC -# AX_MPI -# CC="$MPICC" -# LIBS="$MPILIBS $LIBS" -# -# and similar for C++ (change all instances of CC to CXX), Fortran 77 -# (with F77 instead of CC) or Fortran (with FC instead of CC). -# -# NOTE: The above assumes that you will use $CC (or whatever) for linking -# as well as for compiling. (This is the default for automake and most -# Makefiles.) -# -# The user can force a particular library/compiler by setting the -# MPICC/MPICXX/MPIF77/MPIFC and/or MPILIBS environment variables. -# -# ACTION-IF-FOUND is a list of shell commands to run if an MPI library is -# found, and ACTION-IF-NOT-FOUND is a list of commands to run if it is not -# found. If ACTION-IF-FOUND is not specified, the default action will -# define HAVE_MPI. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2008 Julian C. Cummings -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 7 - -AU_ALIAS([ACX_MPI], [AX_MPI]) -AC_DEFUN([AX_MPI], [ -AC_PREREQ([2.71]) dnl for AC_LANG_CASE - -AC_LANG_CASE([C], [ - AC_REQUIRE([AC_PROG_CC]) - AC_ARG_VAR(MPICC,[MPI C compiler command]) - AC_CHECK_PROGS(MPICC, mpicc hcc mpxlc_r mpxlc mpcc cmpicc, $CC) - ax_mpi_save_CC="$CC" - CC="$MPICC" - AC_SUBST(MPICC) - AC_MSG_CHECKING([checking MPI C flags]) - ax_mpi_c_flags="`$MPICC -showme:compile 2>/dev/null| cut -d\ -f2-`" - ax_mpi_c_libs="`$MPICC -showme:link 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_c_flags" = "x"],[ - ax_mpi_c_flags="`$MPICC -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" - ax_mpi_c_libs="`$MPICC -show 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_c_flags" = "x"],[AC_MSG_RESULT([could not determine c flags from show functions])],[AC_MSG_RESULT([flags found])]) - - ], [ - AC_MSG_RESULT([flags found])]) - MPI_CFLAGS="$ax_mpi_c_flags" - MPI_CLIBS="$ax_mpi_c_libs" - AC_SUBST(MPI_CFLAGS) - AC_SUBST(MPI_CLIBS) - -], -[C++], [ - AC_REQUIRE([AC_PROG_CXX]) - AC_ARG_VAR(MPICXX,[MPI C++ compiler command]) - AC_CHECK_PROGS(MPICXX, mpicxx mpiCC mpic++ hcp mpxlC_r mpxlC mpCC cmpic++, $CXX) - ax_mpi_save_CXX="$CXX" - CXX="$MPICXX" - AC_SUBST(MPICXX) - - AC_MSG_CHECKING([checking MPI C++ flags]) - ax_mpi_cc_flags="`$MPICXX -showme:compile 2>/dev/null| cut -d\ -f2-`" - ax_mpi_cc_libs="`$MPICXX -showme:link 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_cc_flags" = "x"],[ - ax_mpi_cc_flags="`$MPICXX -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" - ax_mpi_cc_libs="`$MPICXX -show 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_cc_flags" = "x"],[AC_MSG_RESULT([could not determine C++ flags from show functions])],[AC_MSG_RESULT([flags found])]) - - ], [ - AC_MSG_RESULT([flags found])]) - MPI_CXXFLAGS="$ax_mpi_cc_flags" - MPI_CXXLIBS="$ax_mpi_cc_libs" - AC_SUBST(MPI_CXXFLAGS) - AC_SUBST(MPI_CXXLIBS) - -], -[Fortran 77], [ - AC_REQUIRE([AC_PROG_F77]) - AC_ARG_VAR(MPIF77,[MPI Fortran 77 compiler command]) - AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf_r mpxlf mpf77 cmpifc, $F77) - ax_mpi_save_F77="$F77" - F77="$MPIF77" - AC_SUBST(MPIF77) -], -[Fortran], [ - AC_REQUIRE([AC_PROG_FC]) - AC_ARG_VAR(MPIFC,[MPI Fortran compiler command]) - AC_CHECK_PROGS(MPIFC, mpif90 mpxlf95_r mpxlf90_r mpxlf95 mpxlf90 mpf90 cmpif90c, $FC) - ax_mpi_save_FC="$FC" - FC="$MPIFC" - AC_SUBST(MPIFC) - AC_MSG_CHECKING([checking MPI Fortran flags]) - ax_mpi_fc_flags="`$MPIFC -showme:compile 2>/dev/null| cut -d\ -f2-`" - ax_mpi_fc_libs="`$MPIFC -showme:link 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_fc_flags" = "x"],[ - ax_mpi_fc_flags="`$MPIFC -show -c 2>/dev/null| cut -d\ -f2-|sed s/-c\ //`" - ax_mpi_fc_libs="`$MPIFC -show 2>/dev/null| cut -d\ -f2-`" - AS_IF([test "x$ax_mpi_fc_flags" = "x"],[AC_MSG_RESULT([could not determine c flags from show functions])],[AC_MSG_RESULT([flags found])]) - - ], [ - AC_MSG_RESULT([flags found])]) - MPI_FCFLAGS="$ax_mpi_fc_flags" - MPI_FCLIBS="$ax_mpi_fc_libs" - AC_SUBST(MPI_FCFLAGS) - AC_SUBST(MPI_FCLIBS) -]) - -if test x = x"$MPILIBS"; then - AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], - [C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])], - [Fortran 77], [AC_MSG_CHECKING([for MPI_Init]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " - AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])], - [Fortran], [AC_MSG_CHECKING([for MPI_Init]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" " - AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])]) -fi -AC_LANG_CASE([Fortran 77], [ - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) - fi - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpich, MPI_Init, [MPILIBS="-lfmpich"]) - fi -], -[Fortran], [ - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"]) - fi - if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpichf90, MPI_Init, [MPILIBS="-lmpichf90"]) - fi - -]) -if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"]) -fi -if test x = x"$MPILIBS"; then - AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"]) -fi - -dnl We have to use AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) and not AC_CHECK_HEADER because the -dnl latter uses $CPP, not $CC (which may be mpicc). -AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpi.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[C++], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpi.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])],[AC_MSG_RESULT(yes)],[MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[Fortran 77], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpif.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" - AC_MSG_RESULT(no)]) -fi], -[Fortran], [if test x != x"$MPILIBS"; then - AC_MSG_CHECKING([for mpif.h]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[ include 'mpif.h'])],[AC_MSG_RESULT(yes)], [MPILIBS="" - AC_MSG_RESULT(no)]) -fi]) - -AC_LANG_CASE([C], [CC="$ax_mpi_save_CC"], - [C++], [CXX="$ax_mpi_save_CXX"], - [Fortran 77], [F77="$ax_mpi_save_F77"], - [Fortran], [FC="$ax_mpi_save_FC"]) - -AC_SUBST(MPILIBS) - -# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: -if test x = x"$MPILIBS"; then - $2 - : -else - ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1]) - : -fi -])dnl AX_MPI diff --git a/src/amuse_tidymess/support/shared/m4/ax_openmp.m4 b/src/amuse_tidymess/support/shared/m4/ax_openmp.m4 deleted file mode 100644 index 866e1d6645..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_openmp.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_openmp.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_OPENMP([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) -# -# DESCRIPTION -# -# This macro tries to find out how to compile programs that use OpenMP a -# standard API and set of compiler directives for parallel programming -# (see http://www-unix.mcs/) -# -# On success, it sets the OPENMP_CFLAGS/OPENMP_CXXFLAGS/OPENMP_F77FLAGS -# output variable to the flag (e.g. -omp) used both to compile *and* link -# OpenMP programs in the current language. -# -# NOTE: You are assumed to not only compile your program with these flags, -# but also link it with them as well. -# -# If you want to compile everything with OpenMP, you should set: -# -# CFLAGS="$CFLAGS $OPENMP_CFLAGS" -# #OR# CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" -# #OR# FFLAGS="$FFLAGS $OPENMP_FFLAGS" -# -# (depending on the selected language). -# -# The user can override the default choice by setting the corresponding -# environment variable (e.g. OPENMP_CFLAGS). -# -# ACTION-IF-FOUND is a list of shell commands to run if an OpenMP flag is -# found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it is -# not found. If ACTION-IF-FOUND is not specified, the default action will -# define HAVE_OPENMP. -# -# LICENSE -# -# Copyright (c) 2008 Steven G. Johnson -# Copyright (c) 2015 John W. Peterson -# Copyright (c) 2016 Nick R. Papior -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 13 - -AC_DEFUN([AX_OPENMP], [ -AC_PREREQ([2.69]) dnl for _AC_LANG_PREFIX - -AC_CACHE_CHECK([for OpenMP flag of _AC_LANG compiler], ax_cv_[]_AC_LANG_ABBREV[]_openmp, [save[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS -ax_cv_[]_AC_LANG_ABBREV[]_openmp=unknown -# Flags to try: -fopenmp (gcc), -mp (SGI & PGI), -# -qopenmp (icc>=15), -openmp (icc), -# -xopenmp (Sun), -omp (Tru64), -# -qsmp=omp (AIX), -# none -ax_openmp_flags="-fopenmp -openmp -qopenmp -mp -xopenmp -omp -qsmp=omp none" -if test "x$OPENMP_[]_AC_LANG_PREFIX[]FLAGS" != x; then - ax_openmp_flags="$OPENMP_[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flags" -fi -for ax_openmp_flag in $ax_openmp_flags; do - case $ax_openmp_flag in - none) []_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[] ;; - *) []_AC_LANG_PREFIX[]FLAGS="$save[]_AC_LANG_PREFIX[]FLAGS $ax_openmp_flag" ;; - esac - AC_LINK_IFELSE([AC_LANG_SOURCE([[ -@%:@include - -static void -parallel_fill(int * data, int n) -{ - int i; -@%:@pragma omp parallel for - for (i = 0; i < n; ++i) - data[i] = i; -} - -int -main() -{ - int arr[100000]; - omp_set_num_threads(2); - parallel_fill(arr, 100000); - return 0; -} -]])],[ax_cv_[]_AC_LANG_ABBREV[]_openmp=$ax_openmp_flag; break],[]) -done -[]_AC_LANG_PREFIX[]FLAGS=$save[]_AC_LANG_PREFIX[]FLAGS -]) -if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" = "xunknown"; then - m4_default([$2],:) -else - if test "x$ax_cv_[]_AC_LANG_ABBREV[]_openmp" != "xnone"; then - OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ax_cv_[]_AC_LANG_ABBREV[]_openmp - fi - m4_default([$1], [AC_DEFINE(HAVE_OPENMP,1,[Define if OpenMP is enabled])]) -fi -])dnl AX_OPENMP diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_jar.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_jar.m4 deleted file mode 100644 index 76ed8147c6..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_prog_jar.m4 +++ /dev/null @@ -1,50 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_jar.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAR -# -# DESCRIPTION -# -# AX_PROG_JAR tests for an existing jar program. It uses the environment -# variable JAR then tests in sequence various common jar programs. -# -# If you want to force a specific compiler: -# -# - at the configure.in level, set JAR=yourcompiler before calling -# AX_PROG_JAR -# -# - at the configure level, setenv JAR -# -# You can use the JAR variable in your Makefile.in, with @JAR@. -# -# Note: This macro depends on the autoconf M4 macros for Java programs. It -# is VERY IMPORTANT that you download that whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. -# -# The general documentation of those macros, as well as the sample -# configure.in, is included in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Egon Willighagen -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 8 - -AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) -AC_DEFUN([AX_PROG_JAR],[ -AS_IF([test "x$JAVAPREFIX" = x], - [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar])], - [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar], [], [$JAVAPREFIX/bin])]) -test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) -AC_PROVIDE([$0])dnl -]) - diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_java.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_java.m4 deleted file mode 100644 index c4312ee8e7..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_prog_java.m4 +++ /dev/null @@ -1,116 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_java.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAVA -# -# DESCRIPTION -# -# Here is a summary of the main macros: -# -# AX_PROG_JAVAC: finds a Java compiler. -# -# AX_PROG_JAVA: finds a Java virtual machine. -# -# AX_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!). -# -# AX_CHECK_RQRD_CLASS: finds if we have the given class and stops -# otherwise. -# -# AX_TRY_COMPILE_JAVA: attempt to compile user given source. -# -# AX_TRY_RUN_JAVA: attempt to compile and run user given source. -# -# AX_JAVA_OPTIONS: adds Java configure options. -# -# AX_PROG_JAVA tests an existing Java virtual machine. It uses the -# environment variable JAVA then tests in sequence various common Java -# virtual machines. For political reasons, it starts with the free ones. -# You *must* call [AX_PROG_JAVAC] before. -# -# If you want to force a specific VM: -# -# - at the configure.in level, set JAVA=yourvm before calling AX_PROG_JAVA -# -# (but after AC_INIT) -# -# - at the configure level, setenv JAVA -# -# You can use the JAVA variable in your Makefile.in, with @JAVA@. -# -# *Warning*: its success or failure can depend on a proper setting of the -# CLASSPATH env. variable. -# -# TODO: allow to exclude virtual machines (rationale: most Java programs -# cannot run with some VM like kaffe). -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. -# -# A Web page, with a link to the latest CVS snapshot is at -# . -# -# This is a sample configure.in Process this file with autoconf to produce -# a configure script. -# -# AC_INIT(UnTag.java) -# -# dnl Checks for programs. -# AC_CHECK_CLASSPATH -# AX_PROG_JAVAC -# AX_PROG_JAVA -# -# dnl Checks for classes -# AX_CHECK_RQRD_CLASS(org.xml.sax.Parser) -# AX_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) -# -# AC_OUTPUT(Makefile) -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 10 - -AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) -AC_DEFUN([AX_PROG_JAVA],[ -m4_define([m4_ax_prog_java_list], [kaffe java])dnl -AS_IF([test "x$JAVAPREFIX" = x], - [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list])], - [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list], [], [$JAVAPREFIX/bin])]) -test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) -m4_undefine([m4_ax_prog_java_list])dnl -AX_PROG_JAVA_WORKS -AC_PROVIDE([$0])dnl -]) - diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_java_works.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_java_works.m4 deleted file mode 100644 index d92b7b8ddc..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_prog_java_works.m4 +++ /dev/null @@ -1,92 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAVA_WORKS -# -# DESCRIPTION -# -# Internal use ONLY. -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. The -# general documentation, as well as the sample configure.in, is included -# in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 11 - -AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) -AC_DEFUN([AX_PROG_JAVA_WORKS], [ - if test x$ac_cv_prog_javac_works = xno; then - AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) - fi - if test x$ac_cv_prog_javac_works = x; then - AX_PROG_JAVAC - fi -AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ -JAVA_TEST=Test.java -CLASS_TEST=Test.class -TEST=Test -changequote(, )dnl -cat << \EOF > $JAVA_TEST -/* [#]line __oline__ "configure" */ -public class Test { -public static void main (String args[]) { - System.exit (0); -} } -EOF -changequote([, ])dnl - if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then - : - else - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat $JAVA_TEST >&AS_MESSAGE_LOG_FD - AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) - fi -if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then - ac_cv_prog_java_works=yes -else - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat $JAVA_TEST >&AS_MESSAGE_LOG_FD - AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) -fi -rm -f $JAVA_TEST $CLASS_TEST -]) -AC_PROVIDE([$0])dnl -] -) - diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_javac.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_javac.m4 deleted file mode 100644 index 9dae89b1bb..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_prog_javac.m4 +++ /dev/null @@ -1,80 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_javac.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAVAC -# -# DESCRIPTION -# -# AX_PROG_JAVAC tests an existing Java compiler. It uses the environment -# variable JAVAC then tests in sequence various common Java compilers. For -# political reasons, it starts with the free ones. -# -# If you want to force a specific compiler: -# -# - at the configure.in level, set JAVAC=yourcompiler before calling -# AX_PROG_JAVAC -# -# - at the configure level, setenv JAVAC -# -# You can use the JAVAC variable in your Makefile.in, with @JAVAC@. -# -# *Warning*: its success or failure can depend on a proper setting of the -# CLASSPATH env. variable. -# -# TODO: allow to exclude compilers (rationale: most Java programs cannot -# compile with some compilers like guavac). -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. The -# general documentation, as well as the sample configure.in, is included -# in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 8 - -AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) -AC_DEFUN([AX_PROG_JAVAC],[ -m4_define([m4_ax_prog_javac_list],["gcj -C" guavac jikes javac])dnl -AS_IF([test "x$JAVAPREFIX" = x], - [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list])], - [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list], [], [$JAVAPREFIX/bin])]) -m4_undefine([m4_ax_prog_javac_list])dnl -test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) -AX_PROG_JAVAC_WORKS -AC_PROVIDE([$0])dnl -]) - diff --git a/src/amuse_tidymess/support/shared/m4/ax_prog_javac_works.m4 b/src/amuse_tidymess/support/shared/m4/ax_prog_javac_works.m4 deleted file mode 100644 index f0efe85342..0000000000 --- a/src/amuse_tidymess/support/shared/m4/ax_prog_javac_works.m4 +++ /dev/null @@ -1,73 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_PROG_JAVAC_WORKS -# -# DESCRIPTION -# -# Internal use ONLY. -# -# Note: This is part of the set of autoconf M4 macros for Java programs. -# It is VERY IMPORTANT that you download the whole set, some macros depend -# on other. Unfortunately, the autoconf archive does not support the -# concept of set of macros, so I had to break it for submission. The -# general documentation, as well as the sample configure.in, is included -# in the AX_PROG_JAVA macro. -# -# LICENSE -# -# Copyright (c) 2008 Stephane Bortzmeyer -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 7 - -AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) -AC_DEFUN([AX_PROG_JAVAC_WORKS],[ -AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ -JAVA_TEST=Test.java -CLASS_TEST=Test.class -cat << \EOF > $JAVA_TEST -/* [#]line __oline__ "configure" */ -public class Test { -} -EOF -if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then - ac_cv_prog_javac_works=yes -else - AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat $JAVA_TEST >&AS_MESSAGE_LOG_FD -fi -rm -f $JAVA_TEST $CLASS_TEST -]) -AC_PROVIDE([$0])dnl -]) - diff --git a/src/amuse_tidymess/support/shared/m4/fftw.m4 b/src/amuse_tidymess/support/shared/m4/fftw.m4 deleted file mode 100644 index 45a55f06fc..0000000000 --- a/src/amuse_tidymess/support/shared/m4/fftw.m4 +++ /dev/null @@ -1,122 +0,0 @@ -# AX_FFTW -# ---------------------------------------------------------- -# set up for FFTW -# -AC_DEFUN([AX_FFTW],[ - AC_ARG_WITH(fftw, - AS_HELP_STRING([--with-fftw=PFX],[Prefix where FFTW has been installed ]), - [ - test "$withval" = no && AC_MSG_WARN([fftw is a required package for some modules]) - test "$withval" = yes || fftw_prefix="$withval" - with_fftw=yes ], - [ with_fftw=yes ] - ) - - AS_IF([test "x$with_fftw" != xno ], - [ - #user override - AS_IF([test "x$FFTW_LIBS" != x && test "x$FFTW_FLAGS" != x ], - [ - have_fftw=yes - FOUND_FFTW="yes" - ], - [ - saved_LIBS="$LIBS" - saved_CXXFLAGS="$CXXFLAGS" - FFTW_LIBS="" - FFTW_FLAGS="" - FOUND_FFTW="no" - if test x$fftw_prefix == x; then - if test x$PREFIX != x; then - fftw_prefix=$PREFIX - fi - fi - if test x$fftw_prefix != x; then - ac_FFTW_CFLAGS="-I$fftw_prefix/include" - ac_FFTW_LDOPTS="-L$fftw_prefix/lib" - - - save_CFLAGS="$CFLAGS" - save_CPPFLAGS="$CPPFLAGS" - CFLAGS="$ac_FFTW_CFLAGS $save_CFLAGS" - CPPFLAGS="$ac_FFTW_CFLAGS $save_CPPFLAGS" - AC_CHECK_HEADER( - [fftw3.h], - [FFTW_FLAGS="$ac_FFTW_CFLAGS" - FOUND_FFTW="yes"], - [AC_MSG_WARN([Cannot find headers (fftw3.h) of the library FFTW in $fftw_prefix/include.])] - ) - CFLAGS="$save_CFLAGS" - CPPFLAGS="$save_CPPFLAGS" - - save_LIBS="$LIBS" - LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads $save_LIBS" - - cache_var=AS_TR_SH([ac_cv_lib_fftw3_fftw_plan_dft_r2c]) - AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], - [FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads"], - [FOUND_FFTW="no"] - ) - $as_unset $cache_var - if test x$FOUND_FFTW != xyes; then - LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm $save_LIBS" - AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], - [FOUND_FFTW="yes" - FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm"], - [AC_MSG_WARN([libfftw3 : library missing. (Cannot find symbol fftw_plan_dft_r2c) in $fftw_prefix. Check if libfftw3 is installed and if the version is correct])] - ) - $as_unset $cache_var - fi - LIBS="$save_LIBS" - fi - - if test x$FOUND_FFTW != xyes; then - PKG_CHECK_MODULES([FFTW],[fftw3 >= 3.2], - [ - FFTW_FLAGS="$FFTW_CFLAGS" - FFTW_LIBS="$FFTW_LIBS -lfftw3_threads" - FOUND_FFTW=yes - ], - [] - ) - fi - - if test x$FOUND_FFTW != xyes; then - AC_CHECK_HEADER( - [fftw3.h], - [FFTW_FLAGS="" - FOUND_FFTW="yes"], - [AC_MSG_WARN([Cannot find headers (fftw3.h) of the library FFTW in $fftw_prefix/include.])] - ) - cache_var=AS_TR_SH([ac_cv_lib_fftw3_fftw_plan_dft_r2c]) - AC_CHECK_LIB( - [fftw3], - [fftw_plan_dft_r2c], - [FFTW_LIBS="-lfftw3 -lfftw3_threads"], - [FOUND_FFTW="no"] - ) - $as_unset $cache_var - - if test x$FOUND_FFTW != xyes; then - - save_LIBS="$LIBS" - LIBS="-lfftw3_threads -lm $save_LIBS" - AC_CHECK_LIB([fftw3], [fftw_plan_dft_r2c], - [FOUND_FFTW="yes" - FFTW_LIBS="$ac_FFTW_LDOPTS -lfftw3 -lfftw3_threads -lm"], - [FOUND_FFTW="no" - AC_MSG_WARN([libfftw3 : library missing. (Cannot find symbol fftw_plan_dft_r2c) in $fftw_prefix. Check if libfftw3 is installed and if the version is correct])] - ) - LIBS="$save_LIBS" - fi - fi - - - ]) - ]) - - AC_SUBST(FOUND_FFTW) - AC_SUBST(FFTW_FLAGS) - AC_SUBST(FFTW_LIBS) - ] -) diff --git a/src/amuse_tidymess/support/shared/m4/fortran.m4 b/src/amuse_tidymess/support/shared/m4/fortran.m4 deleted file mode 100644 index 8b042cd390..0000000000 --- a/src/amuse_tidymess/support/shared/m4/fortran.m4 +++ /dev/null @@ -1,43 +0,0 @@ -AC_DEFUN([AX_FC_WORKS],[ -AC_LANG_PUSH(Fortran) -AC_MSG_CHECKING([whether the Fortran 90 compiler ($FC $FCFLAGS $LDFLAGS) works]) -AC_LINK_IFELSE([ - AC_LANG_SOURCE([ - program conftest - integer, dimension(10) :: n - end - ]) -],[ - ax_cv_prog_fc_works="yes" - AC_MSG_RESULT([$ax_cv_prog_fc_works]) -],[ - ax_cv_prog_fc_works="no" - AC_MSG_WARN([installation or configuration problem: Fortran 90 compiler cannot create executables.]) -]) -# The intel compiler sometimes generates these work.pc and .pcl files -rm -f work.pc work.pcl -AC_LANG_POP(Fortran) -]) - - -AC_DEFUN([AX_FC_ISO_C_BINDING],[ -AC_LANG_PUSH(Fortran) -AC_MSG_CHECKING([if the fortran compiler supports iso c binding]) -AC_LINK_IFELSE([ - AC_LANG_SOURCE([ - program conftest - use ISO_C_BINDING - integer, dimension(10) :: n - end - ]) -],[ - FC_ISO_C_BINDINGS="yes" - AC_MSG_RESULT([$ax_cv_fc_iso_c_bindings]) -],[ - FC_ISO_C_BINDINGS="no" - AC_MSG_RESULT([no, fortran codes and sockets or embedding will not work.]) -]) -# The intel compiler sometimes generates these work.pc and .pcl files -rm -f work.pc work.pcl -AC_LANG_POP(Fortran) -]) diff --git a/src/amuse_tidymess/support/shared/m4/gmp.m4 b/src/amuse_tidymess/support/shared/m4/gmp.m4 deleted file mode 100644 index 584168bd12..0000000000 --- a/src/amuse_tidymess/support/shared/m4/gmp.m4 +++ /dev/null @@ -1,103 +0,0 @@ -# AX_GMP -# ---------------------------------------------------------- -# set up for GMP -# -AC_DEFUN([AX_GMP],[ - AC_ARG_WITH(gmp, - AS_HELP_STRING([--with-gmp=PFX],[Prefix where GMP has been installed ]), - [ - test "$withval" = no && AC_MSG_WARN([gmp is a required package for some modules]) - test "$withval" = yes || gmp_prefix="$withval" - with_gmp=yes ], - [ with_gmp=yes ] - ) - - AS_IF([test "x$with_gmp" != xno ], - [ - #user override - AS_IF([test "x$GMP_LIBS" != x ], - [ - have_gmp=yes - FOUND_GMP="yes" - ], - [ - - - - saved_LIBS="$LIBS" - saved_CXXFLAGS="$CXXFLAGS" - GMP_LIBS="" - GMP_FLAGS="" - FOUND_GMP="no" - if test x$gmp_prefix == x; then - if test x$PREFIX != x; then - gmp_prefix=$PREFIX - fi - fi - if test x$gmp_prefix != x; then - ac_gmp_CFLAGS="-I$gmp_prefix/include" - ac_gmp_LDOPTS="-L$gmp_prefix/lib" - - - save_CFLAGS="$CFLAGS" - save_CPPFLAGS="$CPPFLAGS" - CFLAGS="$ac_gmp_CFLAGS $save_CFLAGS" - CPPFLAGS="$ac_gmp_CFLAGS $save_CPPFLAGS" - AC_CHECK_HEADER( - [gmp.h], - [GMP_FLAGS="$ac_gmp_CFLAGS" - FOUND_GMP="yes"], - [AC_MSG_WARN([Cannot find headers (gmp.h) of the library GMP in $gmp_prefix/include.])] - ) - CFLAGS="$save_CFLAGS" - CPPFLAGS="$save_CPPFLAGS" - - if test x$FOUND_GMP == xyes; then - save_LIBS="$LIBS" - LIBS="$ac_gmp_LDOPTS -lgmp $save_LIBS" - AC_CHECK_LIB([gmp], [__gmpz_init], - [GMP_LIBS="$ac_gmp_LDOPTS -lgmp"], - [FOUND_GMP="no" - AC_MSG_WARN([libgmp : library missing. (Cannot find symbol gmpz_init) in $gmp_prefix. Check if libgmp is installed and if the version is correct])] - ) - LIBS="$save_LIBS" - fi - fi - if test x$FOUND_GMP != xyes; then - PKG_CHECK_MODULES([GMP],[gmp >= 3], - [ - GMP_FLAGS="$GMP_FLAGS" - GMP_LIBS="$GMP_LIBS" - FOUND_GMP=yes - ], - [] - ) - - fi - - if test x$FOUND_GMP != xyes; then - AC_CHECK_HEADER( - [gmp.h], - [GMP_FLAGS="" - FOUND_GMP="yes"], - [AC_MSG_WARN([Cannot find headers (gmp.h) of the library GMP.])] - ) - AC_CHECK_LIB( - [gmp], - [__gmpz_init], - [GMP_LIBS="-lgmp"], - [ - FOUND_GMP="no" - AC_MSG_WARN([libgmp : library missing. (Cannot find symbol gmpz_init). Check if libgmp is installed and if the version is correct])] - ) - fi - - - ]) - ]) - - AC_SUBST(FOUND_GMP) - AC_SUBST(GMP_FLAGS) - AC_SUBST(GMP_LIBS) - ] -) diff --git a/src/amuse_tidymess/support/shared/m4/gsl.m4 b/src/amuse_tidymess/support/shared/m4/gsl.m4 deleted file mode 100644 index 96c3189801..0000000000 --- a/src/amuse_tidymess/support/shared/m4/gsl.m4 +++ /dev/null @@ -1,122 +0,0 @@ -# Configure path for the GNU Scientific Library -# Christopher R. Gabriel , April 2000 - - -AC_DEFUN([AX_PATH_GSL], -[ -AC_ARG_WITH(gsl-prefix,[ --with-gsl-prefix=PFX Prefix where GSL is installed (optional)], - gsl_prefix="$withval", gsl_prefix="") -AC_ARG_WITH(gsl-exec-prefix,[ --with-gsl-exec-prefix=PFX Exec prefix where GSL is installed (optional)], - gsl_exec_prefix="$withval", gsl_exec_prefix="") -AC_ARG_ENABLE(gsltest, [ --disable-gsltest Do not try to compile and run a test GSL program], - , enable_gsltest=yes) - - if test "x${GSL_CONFIG+set}" != xset ; then - if test "x$gsl_prefix" != x ; then - GSL_CONFIG="$gsl_prefix/bin/gsl-config" - fi - if test "x$gsl_exec_prefix" != x ; then - GSL_CONFIG="$gsl_exec_prefix/bin/gsl-config" - fi - fi - - - if test "x${GSL_CONFIG+set}" == xset ; then - if test -x "${GSL_CONFIG}" ; then - gsl_config_exists=yes - else - gsl_config_exists=no - fi - fi - FOUND_GSL=no - if test "x$GSL_CFLAGS" != x ; then - if test "x$GSL_LIBS" != x ; then - GSL_FLAGS="$GSL_CFLAGS" - GSL_LIBS="$GSL_LIBS" - FOUND_GSL=yes - AC_SUBST(GSL_FLAGS) - fi - fi - if test "$FOUND_GSL" = "no"; then - if test "x$gsl_config_exists" != xyes ; then - PKG_CHECK_MODULES([GSL],[gsl >= 1.0], - [ - GSL_FLAGS="$GSL_CFLAGS" - GSL_LIBS="$GSL_LIBS" - FOUND_GSL=yes - AC_SUBST(GSL_FLAGS) - - ifelse([$2], , :, [$2]) - ], - [ - ] - ) - fi - fi - if test "$FOUND_GSL" = "no"; then - AC_PATH_PROG(GSL_CONFIG, gsl-config, no) - min_gsl_version=ifelse([$1], ,0.2.5,$1) - AC_MSG_CHECKING(for GSL - version >= $min_gsl_version) - no_gsl="" - if test "$GSL_CONFIG" = "no" ; then - no_gsl=yes - else - GSL_FLAGS=`$GSL_CONFIG --cflags` - GSL_LIBS=`$GSL_CONFIG --libs` - - gsl_version=`$GSL_CONFIG --version` - AS_VERSION_COMPARE( - [$gsl_version], - [$min_gsl_version], - [no_gsl=yes], - - ) - fi - if test "x$no_gsl" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$GSL_CONFIG" = "no" ; then - echo "*** The gsl-config script installed by GSL could not be found" - echo "*** If GSL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the GSL_CONFIG environment variable to the" - echo "*** full path to gsl-config." - else - if test -f conf.gsltest ; then - : - else - echo "*** Could not run GSL test program, checking why..." - CFLAGS="$CFLAGS $GSL_FLAGS" - LIBS="$LIBS $GSL_LIBS" - AC_LINK_IFELSE([AC_LANG_PROGRAM([[ - #include - ]], [[ return 0; ]])],[ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding GSL or finding the wrong" - echo "*** version of GSL. If it is not finding GSL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],[ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GSL was incorrectly installed" - echo "*** or that you have moved GSL since it was installed. In the latter case, you" - echo "*** may want to edit the gsl-config script: $GSL_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - # GSL_FLAGS="" - # GSL_LIBS="" - ifelse([$3], , :, [$3]) - fi - - fi - AC_SUBST(GSL_FLAGS) - AC_SUBST(GSL_LIBS) - rm -f conf.gsltest - -]) - -AU_ALIAS([AM_PATH_GSL], [AX_PATH_GSL]) diff --git a/src/amuse_tidymess/support/shared/m4/mpfr.m4 b/src/amuse_tidymess/support/shared/m4/mpfr.m4 deleted file mode 100644 index eba25c6dc9..0000000000 --- a/src/amuse_tidymess/support/shared/m4/mpfr.m4 +++ /dev/null @@ -1,109 +0,0 @@ -# AX_MPFR -# ---------------------------------------------------------- -# set up for MPFR -# -AC_DEFUN([AX_MPFR],[ - AC_ARG_WITH(mpfr, - AS_HELP_STRING([--with-mpfr=PFX],[Prefix where MPFR has been installed ]), - [ - test "$withval" = no && AC_MSG_WARN([mpfr is a required package for some modules]) - test "$withval" = yes || mpfr_prefix="$withval" - with_mpfr=yes ], - [ with_mpfr=yes ] - ) - - AS_IF([test "x$with_mpfr" != xno ], - [ - #user override - AS_IF([test "x$MPFR_LIBS" != x ], - [ - have_mpfr=yes - FOUND_MPFR="yes" - ], - [ - - - - saved_LIBS="$LIBS" - saved_CXXFLAGS="$CXXFLAGS" - MPFR_LIBS="" - MPFR_FLAGS="" - FOUND_MPFR="no" - if test x$mpfr_prefix == x; then - if test x$PREFIX != x; then - mpfr_prefix=$PREFIX - fi - fi - if test x$mpfr_prefix != x; then - ac_mpfr_CFLAGS="-I$mpfr_prefix/include" - ac_mpfr_LDOPTS="-L$mpfr_prefix/lib" - - - save_CFLAGS="$CFLAGS" - save_CPPFLAGS="$CPPFLAGS" - CFLAGS="$ac_mpfr_CFLAGS $save_CFLAGS" - CPPFLAGS="$ac_mpfr_CFLAGS $save_CPPFLAGS" - - cache_var=AS_TR_SH([ac_cv_header_mpfr.h]) - AC_CHECK_HEADER( - [mpfr.h], - [MPFR_FLAGS="$ac_mpfr_CFLAGS" - FOUND_MPFR="yes"], - [AC_MSG_WARN([Cannot find headers (mpfr.h) of the library MPFR in $mpfr_prefix/include.])] - ) - $as_unset $cache_var - CFLAGS="$save_CFLAGS" - CPPFLAGS="$save_CPPFLAGS" - - if test x$FOUND_MPFR == xyes; then - save_LIBS="$LIBS" - LIBS="$ac_mpfr_LDOPTS -lmpfr $save_LIBS" - - cache_var=AS_TR_SH([ac_cv_lib_mpfr_mpfr_init]) - AC_CHECK_LIB([mpfr], [mpfr_init], - [MPFR_LIBS="$ac_mpfr_LDOPTS -lmpfr"], - [FOUND_MPFR="no" - AC_MSG_WARN([libmpfr : library missing. (Cannot find symbol mpfr_init) in $mpfr_prefix. Check if libmpfr is installed and if the version is correct])] - ) - LIBS="$save_LIBS" - $as_unset $cache_var - fi - fi - if test x$FOUND_MPFR != xyes; then - PKG_CHECK_MODULES([MPFR],[mpfr >= 3], - [ - MPFR_FLAGS="$MPFR_FLAGS" - MPFR_LIBS="$MPFR_LIBS" - FOUND_MPFR=yes - ], - [] - ) - - fi - - if test x$FOUND_MPFR != xyes; then - AC_CHECK_HEADER( - [mpfr.h], - [MPFR_FLAGS="" - FOUND_MPFR="yes"], - [AC_MSG_WARN([Cannot find headers (mpfr.h) of the library MPFR.])] - ) - AC_CHECK_LIB( - [mpfr], - [mpfr_init], - [MPFR_LIBS="-lmpfr"], - [ - FOUND_MPFR="no" - AC_MSG_WARN([libmpfr : library missing. (Cannot find symbol mpfr_init). Check if libmpfr is installed and if the version is correct])] - ) - fi - - - ]) - ]) - - AC_SUBST(FOUND_MPFR) - AC_SUBST(MPFR_FLAGS) - AC_SUBST(MPFR_LIBS) - ] -) diff --git a/src/amuse_tidymess/support/shared/m4/pkg.m4 b/src/amuse_tidymess/support/shared/m4/pkg.m4 deleted file mode 100644 index d8549a4789..0000000000 --- a/src/amuse_tidymess/support/shared/m4/pkg.m4 +++ /dev/null @@ -1,343 +0,0 @@ -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 11 (pkg-config-0.29.1) - -dnl Copyright © 2004 Scott James Remnant . -dnl Copyright © 2012-2015 Dan Nicholson -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, but -dnl WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -dnl 02111-1307, USA. -dnl -dnl As a special exception to the GNU General Public License, if you -dnl distribute this file as part of a program that contains a -dnl configuration script generated by Autoconf, you may include it under -dnl the same distribution terms that you use for the rest of that -dnl program. - -dnl PKG_PREREQ(MIN-VERSION) -dnl ----------------------- -dnl Since: 0.29 -dnl -dnl Verify that the version of the pkg-config macros are at least -dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's -dnl installed version of pkg-config, this checks the developer's version -dnl of pkg.m4 when generating configure. -dnl -dnl To ensure that this macro is defined, also add: -dnl m4_ifndef([PKG_PREREQ], -dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) -dnl -dnl See the "Since" comment for each macro you use to see what version -dnl of the macros you require. -m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) -m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, - [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) -])dnl PKG_PREREQ - -dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) -dnl ---------------------------------- -dnl Since: 0.16 -dnl -dnl Search for the pkg-config tool and set the PKG_CONFIG variable to -dnl first found in the path. Checks that the version of pkg-config found -dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is -dnl used since that's the first version where most current features of -dnl pkg-config existed. -AC_DEFUN([PKG_PROG_PKG_CONFIG], -[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) -m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=m4_default([$1], [0.9.0]) - AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - PKG_CONFIG="" - fi -fi[]dnl -])dnl PKG_PROG_PKG_CONFIG - -dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl ------------------------------------------------------------------- -dnl Since: 0.18 -dnl -dnl Check to see whether a particular set of modules exists. Similar to -dnl PKG_CHECK_MODULES(), but does not set variables or print errors. -dnl -dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -dnl only at the first occurence in configure.ac, so if the first place -dnl it's called might be skipped (such as if it is within an "if", you -dnl have to call PKG_CHECK_EXISTS manually -AC_DEFUN([PKG_CHECK_EXISTS], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -if test -n "$PKG_CONFIG" && \ - AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) -m4_ifvaln([$3], [else - $3])dnl -fi]) - -dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -dnl --------------------------------------------- -dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting -dnl pkg_failed based on the result. -m4_define([_PKG_CONFIG], -[if test -n "$$1"; then - pkg_cv_[]$1="$$1" - elif test -n "$PKG_CONFIG"; then - PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], - [pkg_failed=yes]) - else - pkg_failed=untried -fi[]dnl -])dnl _PKG_CONFIG - -dnl _PKG_SHORT_ERRORS_SUPPORTED -dnl --------------------------- -dnl Internal check to see if pkg-config supports short errors. -AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi[]dnl -])dnl _PKG_SHORT_ERRORS_SUPPORTED - - -dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND]) -dnl -------------------------------------------------------------- -dnl Since: 0.4.0 -dnl -dnl Note that if there is a possibility the first call to -dnl PKG_CHECK_MODULES might not happen, you should be sure to include an -dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl -AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl - -pkg_failed=no -AC_MSG_CHECKING([for $1]) - -_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) -_PKG_CONFIG([$1][_LIBS], [libs], [$2]) - -m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS -and $1[]_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details.]) - -if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) - _PKG_SHORT_ERRORS_SUPPORTED - if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - - m4_default([$4], [AC_MSG_ERROR( -[Package requirements ($2) were not met: - -$$1_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -_PKG_TEXT])[]dnl - ]) -elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( -[The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -_PKG_TEXT - -To get pkg-config, see .])[]dnl - ]) -else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS - AC_MSG_RESULT([yes]) - $3 -fi[]dnl -])dnl PKG_CHECK_MODULES - - -dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND]) -dnl --------------------------------------------------------------------- -dnl Since: 0.29 -dnl -dnl Checks for existence of MODULES and gathers its build flags with -dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags -dnl and VARIABLE-PREFIX_LIBS from --libs. -dnl -dnl Note that if there is a possibility the first call to -dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to -dnl include an explicit call to PKG_PROG_PKG_CONFIG in your -dnl configure.ac. -AC_DEFUN([PKG_CHECK_MODULES_STATIC], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -_save_PKG_CONFIG=$PKG_CONFIG -PKG_CONFIG="$PKG_CONFIG --static" -PKG_CHECK_MODULES($@) -PKG_CONFIG=$_save_PKG_CONFIG[]dnl -])dnl PKG_CHECK_MODULES_STATIC - - -dnl PKG_INSTALLDIR([DIRECTORY]) -dnl ------------------------- -dnl Since: 0.27 -dnl -dnl Substitutes the variable pkgconfigdir as the location where a module -dnl should install pkg-config .pc files. By default the directory is -dnl $libdir/pkgconfig, but the default can be changed by passing -dnl DIRECTORY. The user can override through the --with-pkgconfigdir -dnl parameter. -AC_DEFUN([PKG_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, - [with_pkgconfigdir=]pkg_default) -AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -])dnl PKG_INSTALLDIR - - -dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) -dnl -------------------------------- -dnl Since: 0.27 -dnl -dnl Substitutes the variable noarch_pkgconfigdir as the location where a -dnl module should install arch-independent pkg-config .pc files. By -dnl default the directory is $datadir/pkgconfig, but the default can be -dnl changed by passing DIRECTORY. The user can override through the -dnl --with-noarch-pkgconfigdir parameter. -AC_DEFUN([PKG_NOARCH_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([noarch-pkgconfigdir], - [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, - [with_noarch_pkgconfigdir=]pkg_default) -AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -])dnl PKG_NOARCH_INSTALLDIR - - -dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl ------------------------------------------- -dnl Since: 0.28 -dnl -dnl Retrieves the value of the pkg-config variable for the given module. -AC_DEFUN([PKG_CHECK_VAR], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl - -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) -AS_VAR_COPY([$1], [pkg_cv_][$1]) - -AS_VAR_IF([$1], [""], [$5], [$4])dnl -])dnl PKG_CHECK_VAR - -dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND], -dnl [DESCRIPTION], [DEFAULT]) -dnl ------------------------------------------ -dnl -dnl Prepare a "--with-" configure option using the lowercase -dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and -dnl PKG_CHECK_MODULES in a single macro. -AC_DEFUN([PKG_WITH_MODULES], -[ -m4_pushdef([with_arg], m4_tolower([$1])) - -m4_pushdef([description], - [m4_default([$5], [build with ]with_arg[ support])]) - -m4_pushdef([def_arg], [m4_default([$6], [auto])]) -m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes]) -m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no]) - -m4_case(def_arg, - [yes],[m4_pushdef([with_without], [--without-]with_arg)], - [m4_pushdef([with_without],[--with-]with_arg)]) - -AC_ARG_WITH(with_arg, - AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),, - [AS_TR_SH([with_]with_arg)=def_arg]) - -AS_CASE([$AS_TR_SH([with_]with_arg)], - [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)], - [auto],[PKG_CHECK_MODULES([$1],[$2], - [m4_n([def_action_if_found]) $3], - [m4_n([def_action_if_not_found]) $4])]) - -m4_popdef([with_arg]) -m4_popdef([description]) -m4_popdef([def_arg]) - -])dnl PKG_WITH_MODULES - -dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [DESCRIPTION], [DEFAULT]) -dnl ----------------------------------------------- -dnl -dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES -dnl check._[VARIABLE-PREFIX] is exported as make variable. -AC_DEFUN([PKG_HAVE_WITH_MODULES], -[ -PKG_WITH_MODULES([$1],[$2],,,[$3],[$4]) - -AM_CONDITIONAL([HAVE_][$1], - [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"]) -])dnl PKG_HAVE_WITH_MODULES - -dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES, -dnl [DESCRIPTION], [DEFAULT]) -dnl ------------------------------------------------------ -dnl -dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after -dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make -dnl and preprocessor variable. -AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES], -[ -PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4]) - -AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"], - [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])]) -])dnl PKG_HAVE_DEFINE_WITH_MODULES diff --git a/src/amuse_tidymess/support/shared/uninstall.sh b/src/amuse_tidymess/support/shared/uninstall.sh deleted file mode 100755 index e08122700e..0000000000 --- a/src/amuse_tidymess/support/shared/uninstall.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -PACKAGE="$1" - -if test -z "${PACKAGE}" ; then - echo " Incorrect usage, please specify a package name as the first argument." - exit 1 -fi - -if test -n "${VIRTUAL_ENV}${CONDA_DEFAULT_ENV}" ; then - pip_package_line=$(pip list | grep "${PACKAGE} ") - if [ "a${pip_package_line}" = "a" ] ; then - printf '%s\n' " Package ${PACKAGE} was not installed, not uninstalling." - exit 0 - fi -fi - -if test -n "${VIRTUAL_ENV}" ; then - # grep -q stops reading when a match is found, which then crashes pip list, so we - # redirect instead. With conda list we can use -q as usual. - if [ "a${pip_package_line}" != "a" ] ; then - pip uninstall -y ${PACKAGE} - fi -fi - -if test -n "${CONDA_DEFAULT_ENV}" ; then - conda_package_line=$(conda list | grep "^${PACKAGE} ") - if printf '%s' "${conda_package_line}" | grep "" >/dev/null 2>&1 ; then - # Conda is showing a pip-installed develop package. However, there may be a - # conda package hidden underneath, so we're going to try to conda uninstall - # anyway to fix that if needed. This will fail if everything is as it should - # be, so we make sure to inhibit the error message to reduce confusion. - EXPECTING_FAIL=true - fi - - if printf '%s' "${conda_package_line}" | grep -v "pypi$" >/dev/null 2>&1 ; then - TMPOUT=$(mktemp) - conda remove -y ${PACKAGE} >${TMPOUT} 2>&1 - err="$?" - # If it failed and we were not expecting it to, print the output - if test "$err" != 0 -a -z "${EXPECTING_FAIL}" ; then - cat ${TMPOUT} - fi - rm ${TMPOUT} - fi - - if [ "a${pip_package_line}" != "a" ] ; then - pip uninstall -y ${PACKAGE} - fi -fi - From 545e1388eef814057d2b8841dce90bed4eb7e9f0 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Fri, 24 Apr 2026 16:53:18 +0200 Subject: [PATCH 131/174] cleaned up tidymess toml --- src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml b/src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml index 5e5135f400..fc32d7b9a6 100644 --- a/src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml +++ b/src/amuse_tidymess/packages/amuse-tidymess/pyproject.toml @@ -5,9 +5,6 @@ version = "0.0.1" # repository # dynamic = ["version"] requires-python = ">=3.7" -#dependencies = [ -# "amuse-framework==2025.9.1.dev14+g24542e9b4.d20251121" -#] dependencies = [ "amuse-framework" ] From e70c6b2fb453e565cb33b40374104521c2263d3b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 10:38:49 +0200 Subject: [PATCH 132/174] cleaned up tidymess tests --- src/amuse_tidymess/tests/test_tidymess.py | 44 ++++++++--------------- 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 61021e59e3..85b5218ef9 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1,17 +1,15 @@ """ Date Created : December 10, 2025 -Last Updated : March 19, 2026 -Test Routine for Tidymess and TidymessInterface +Last Updated : April 24, 2026 +Tests for Tidymess and TidymessInterface """ +from amuse.datamodel import Particles +from amuse.ext.orbital_elements import generate_binaries from amuse.support.testing.amusetest import TestWithMPI +from amuse.units import constants as c, nbody_system, units as u from amuse.units.quantities import VectorQuantity from amuse_tidymess.interface import Tidymess, TidymessInterface -from amuse.units import units as u -from amuse.units import constants as c -from amuse.units import nbody_system -from amuse.datamodel import Particles -from amuse.ext.orbital_elements import generate_binaries import numpy as np @@ -21,7 +19,7 @@ def test1(self): """ Test Tidymess initialization. """ - + print('Test initialization') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None self.assertEqual(0, instance.initialize_code()) @@ -33,29 +31,18 @@ def test2(self): """ Test TidymessInterface setters and getters. """ - + print('Test setters and getters') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None + + self.assertEqual(0, instance.initialize_code()) + self.assertEqual(0, instance.commit_parameters()) + result = instance.get_number_of_particles() self.assertEquals(result['number_of_particles'], 0) - result = instance.new_particle( - 1.0, # mass - 2.0, # x - 3.0, # y - 4.0, # z - 5.0, # vz - 6.0, # vy - 7.0, # vz - 8.0, # radius - 9.0, # xi - 10.0, # kf - 11.0, # tau - 12.0, # wx - 13.0, # wy - 14.0, # wz - 15.0 # a_mb - ) + result = instance.new_particle(*np.arange(1, 16)) + self.assertEquals(result['index_of_the_particle'], 0.0) result = instance.get_state(0) @@ -78,7 +65,6 @@ def test2(self): instance.set_mass(0, 1.5) self.assertEquals(instance.get_mass(0)['mass'], 1.5) - result = instance.get_position(0) instance.set_position(0, 2.5, 3.5, 4.5) result = instance.get_position(0) self.assertEquals(result['x'], 2.5) @@ -137,8 +123,8 @@ def test2(self): result = instance.get_dt_const() self.assertEquals(result['dt_const'], 0.025625) - # result = instance.get_time_step() - # self.assertEquals(result['time_step'], 0) + result = instance.get_time_step() + self.assertEquals(result['time_step'], 0) instance.set_eta(0.625) result = instance.get_eta() From 51f7071cff681fb78b81a6b1b415ce15b57450ca Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 10:42:02 +0200 Subject: [PATCH 133/174] refactored interface.cc to use unique_pointer instead for tidymess --- src/amuse_tidymess/interface.cc | 148 +++++++++++++++----------------- 1 file changed, 69 insertions(+), 79 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 841be8a5ea..2a46ddd215 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -40,16 +40,14 @@ bool print_info = false; * */ -// TIDYMESS HELPER FUNCTIONS /** * Given an AMUSE particle index, find the corresponding - * index of that particle within Tidymess. - * - * @param index_of_the_particle Particle identifier + * index of that particle within Tidymess. This is a helper + * function used by setters and getters. */ int get_body_index_by_id(int index_of_the_particle) { - const std::vector& bodies = tidymess.bodies; + const std::vector& bodies = tidymess->bodies; for (size_t i = 0; i < bodies.size(); i++) { if (bodies[i].id == index_of_the_particle) { @@ -101,7 +99,7 @@ int new_particle( ) { if (!index_of_the_particle) return -1; - std::vector& bodies = tidymess.bodies; + std::vector& bodies = tidymess->bodies; Body newbody( mass, radius, xi, kf, tau, a_mb, @@ -115,18 +113,19 @@ int new_particle( bodies.push_back(newbody); if (print_info) { cerr<<"printing particle in new_particle"<print_particles(false); cerr<<"end print "<& bodies = tidymess.bodies; + std::vector& bodies = tidymess->bodies; int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; @@ -169,7 +168,7 @@ int get_state( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - const Body& body = tidymess.bodies[i]; + const Body& body = tidymess->bodies[i]; *mass = body.m; *x = body.r[0]; @@ -213,7 +212,7 @@ int set_state( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - Body& body = tidymess.bodies[i]; + Body& body = tidymess->bodies[i]; body.m = mass; body.R = radius; @@ -237,7 +236,7 @@ int get_mass(int index_of_the_particle, double* mass) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - *mass = tidymess.bodies[i].m; + *mass = tidymess->bodies[i].m; return 0; } /** @@ -247,7 +246,7 @@ int set_mass(int index_of_the_particle, double mass) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - tidymess.bodies[i].m = mass; + tidymess->bodies[i].m = mass; return 0; } @@ -260,7 +259,7 @@ int get_radius(int index_of_the_particle, double* radius ) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - *radius = tidymess.bodies[i].R; + *radius = tidymess->bodies[i].R; return 0; } /** @@ -270,7 +269,7 @@ int set_radius(int index_of_the_particle, double radius) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - tidymess.bodies[i].R = radius; + tidymess->bodies[i].R = radius; return 0; } @@ -288,7 +287,7 @@ int get_position( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - const Body& body = tidymess.bodies[i]; + const Body& body = tidymess->bodies[i]; *x = body.r[0]; *y = body.r[1]; @@ -307,7 +306,7 @@ int set_position( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - Body& body = tidymess.bodies[i]; + Body& body = tidymess->bodies[i]; body.r = {x, y, z}; return 0; @@ -327,7 +326,7 @@ int get_velocity( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - const Body& body = tidymess.bodies[i]; + const Body& body = tidymess->bodies[i]; *vx = body.v[0]; *vy = body.v[1]; @@ -346,7 +345,7 @@ int set_velocity( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - Body& body = tidymess.bodies[i]; + Body& body = tidymess->bodies[i]; body.v = {vx, vy, vz}; return 0; @@ -361,7 +360,7 @@ int get_xi(int index_of_the_particle, double* xi) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - *xi = tidymess.bodies[i].xi; + *xi = tidymess->bodies[i].xi; return 0; } /** @@ -371,7 +370,7 @@ int set_xi(int index_of_the_particle, double xi) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - tidymess.bodies[i].xi = xi; + tidymess->bodies[i].xi = xi; return 0; } @@ -384,7 +383,7 @@ int get_kf(int index_of_the_particle, double* kf) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - *kf = tidymess.bodies[i].kf; + *kf = tidymess->bodies[i].kf; return 0; } /** @@ -394,7 +393,7 @@ int set_kf(int index_of_the_particle, double kf) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - tidymess.bodies[i].kf = kf; + tidymess->bodies[i].kf = kf; return 0; } @@ -407,7 +406,7 @@ int get_tau(int index_of_the_particle, double* tau) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - *tau = tidymess.bodies[i].tau; + *tau = tidymess->bodies[i].tau; return 0; } /** @@ -417,7 +416,7 @@ int set_tau(int index_of_the_particle, double tau) { int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - tidymess.bodies[i].tau = tau; + tidymess->bodies[i].tau = tau; return 0; } @@ -435,7 +434,7 @@ int get_spin( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - const Body& body = tidymess.bodies[i]; + const Body& body = tidymess->bodies[i]; *wx = body.w[0]; *wy = body.w[1]; @@ -454,7 +453,7 @@ int set_spin( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - Body& body = tidymess.bodies[i]; + Body& body = tidymess->bodies[i]; body.w = {wx, wy, wz}; @@ -465,7 +464,7 @@ int evolve_model(double time) { determine_dt_sgn(time); - tidymess.evolve_model(time); + tidymess->evolve_model(time); return 0; } @@ -475,14 +474,14 @@ int evolve_model(double time) { int get_tidal_model(int* tidal_model) { if (!tidal_model) return -1; - *tidal_model = tidymess.get_tidal_model(); + *tidal_model = tidymess->get_tidal_model(); return 0; } /** * Set Tidymess tidal model parameter */ int set_tidal_model(int tidal_model) { - tidymess.set_tidal_model(tidal_model); + tidymess->set_tidal_model(tidal_model); return 0; } @@ -492,14 +491,14 @@ int set_tidal_model(int tidal_model) { int get_pn_order(int* pn_order) { if (!pn_order) return -1; - *pn_order = tidymess.get_pn_order(); + *pn_order = tidymess->get_pn_order(); return 0; } /** * Set Tidymess pn order parameter */ int set_pn_order(int pn_order) { - tidymess.set_pn_order(pn_order); + tidymess->set_pn_order(pn_order); return 0; } @@ -509,14 +508,14 @@ int set_pn_order(int pn_order) { int get_magnetic_braking(int* magnetic_braking) { if (!magnetic_braking) return -1; - *magnetic_braking = tidymess.get_magnetic_braking(); + *magnetic_braking = tidymess->get_magnetic_braking(); return 0; } /** * Set Tidymess magnetic braking parameter */ int set_magnetic_braking(int magnetic_braking) { - tidymess.set_magnetic_braking(magnetic_braking); + tidymess->set_magnetic_braking(magnetic_braking); return 0; } @@ -526,14 +525,14 @@ int set_magnetic_braking(int magnetic_braking) { int get_speed_of_light(double* speed_of_light) { if (!speed_of_light) return -1; - *speed_of_light = tidymess.get_speed_of_light(); + *speed_of_light = tidymess->get_speed_of_light(); return 0; } /** * Set Tidymess speed of light parameter */ int set_speed_of_light(double speed_of_light) { - tidymess.set_speed_of_light(speed_of_light); + tidymess->set_speed_of_light(speed_of_light); return 0; } @@ -543,14 +542,14 @@ int set_speed_of_light(double speed_of_light) { int get_dt_mode(int* dt_mode) { if (!dt_mode) return -1; - *dt_mode = tidymess.get_dt_mode(); + *dt_mode = tidymess->get_dt_mode(); return 0; } /** * Set Tidymess dt mode parameter */ int set_dt_mode(int dt_mode) { - tidymess.set_dt_mode(dt_mode); + tidymess->set_dt_mode(dt_mode); return 0; } @@ -560,14 +559,14 @@ int set_dt_mode(int dt_mode) { int get_dt_const(double* dt_const) { if (!dt_const) return -1; - *dt_const = tidymess.get_dt_const(); + *dt_const = tidymess->get_dt_const(); return 0; } /** * Set Tidymess constant dt parameter */ int set_dt_const(double dt_const) { - tidymess.set_dt_const(dt_const); + tidymess->set_dt_const(dt_const); return 0; } @@ -577,11 +576,11 @@ int set_dt_const(double dt_const) { int get_time_step(double* time_step) { if (!time_step) return -1; - if (tidymess.get_dt_mode() > 0) { - *time_step = tidymess.get_dt_prev(); + if (tidymess->get_dt_mode() > 0) { + *time_step = tidymess->get_dt_prev(); } else { - *time_step = tidymess.get_dt_const(); + *time_step = tidymess->get_dt_const(); } return 0; @@ -593,14 +592,14 @@ int get_time_step(double* time_step) { int get_eta(double* eta) { if (!eta) return -1; - *eta = tidymess.get_eta(); + *eta = tidymess->get_eta(); return 0; } /** * Set Tidymess eta (accuracy parameter) */ int set_eta(double eta) { - tidymess.set_eta(eta); + tidymess->set_eta(eta); return 0; } @@ -610,14 +609,14 @@ int set_eta(double eta) { int get_n_iter(int* n_iter) { if (!n_iter) return -1; - *n_iter = tidymess.n_iter; + *n_iter = tidymess->n_iter; return 0; } /** * Set Tidymess n iter parameter */ int set_n_iter(int n_iter) { - tidymess.n_iter = n_iter; + tidymess->n_iter = n_iter; return 0; } @@ -642,43 +641,43 @@ int set_initial_shape(int initial_shape) { int get_collision_mode(int* collision_mode) { if (!collision_mode) return -1; - *collision_mode = tidymess.get_collision_mode(); + *collision_mode = tidymess->get_collision_mode(); return 0; } int set_collision_mode(int collision_mode) { - tidymess.set_collision_mode(collision_mode); + tidymess->set_collision_mode(collision_mode); return 0; } int get_roche_mode(int* roche_mode) { if (!roche_mode) return -1; - *roche_mode = tidymess.roche_mode; // doesn't appear in Tidy + *roche_mode = tidymess->roche_mode; // doesn't appear in Tidy return 0; } int set_roche_mode(int roche_mode) { - tidymess.set_roche_mode(roche_mode); - // collision.set_roche_mode(roche_mode); // doesn't appear in Tidy - // collision.setup(); + tidymess->set_roche_mode(roche_mode); + // collision->set_roche_mode(roche_mode); // doesn't appear in Tidy + // collision->setup(); return 0; } int get_breakup_mode(int* breakup_mode) { if (!breakup_mode) return -1; - *breakup_mode = breakup.mode; /// niet in Tidy + *breakup_mode = breakup->mode; /// niet in Tidy return 0; } int set_breakup_mode(int breakup_mode) { - breakup.set_breakup_mode(breakup_mode); - breakup.setup(); + breakup->set_breakup_mode(breakup_mode); + breakup->setup(); return 0; } int get_num_integration_step(int* num_integration_step) { if (!num_integration_step) return -1; - *num_integration_step = tidymess.get_num_integration_step(); + *num_integration_step = tidymess->get_num_integration_step(); return 0; } @@ -689,7 +688,7 @@ int normalize_initial_conditions() { double Cv = 1.0; double Ct = 1.0; - std::vector& bodies = tidymess.bodies; + std::vector& bodies = tidymess->bodies; int N = static_cast(bodies.size()); @@ -876,7 +875,7 @@ int get_kinetic_energy(double* kinetic_energy) { */ int get_potential_energy(double* potential_energy) { if (!potential_energy) return -1; - *potential_energy = tidymess.get_potential_energy(); + *potential_energy = tidymess->get_potential_energy(); return 0; } @@ -885,7 +884,7 @@ int get_potential_energy(double* potential_energy) { */ int get_time(double* time) { if (!time) return -1; - *time = tidymess.get_model_time(); + *time = tidymess->get_model_time(); return 0; } @@ -902,7 +901,7 @@ int get_begin_time(double* time) { */ int set_begin_time(double time) { begin_time = time; - tidymess.set_model_time(begin_time); + tidymess->set_model_time(begin_time); return 0; } @@ -912,7 +911,7 @@ int set_begin_time(double time) { int get_total_mass(double* mass) { if (!mass) return -1; - const std::vector& bodies = tidymess.bodies; + const std::vector& bodies = tidymess->bodies; double total = 0.0; for (size_t i = 0; i < bodies.size(); i++) { @@ -934,7 +933,7 @@ int get_center_of_mass_position( if (!x || !y || !z) { return -1; } - const array position = tidymess.get_center_of_mass(); + const array position = tidymess->get_center_of_mass(); *x = position[0]; *y = position[1]; @@ -954,7 +953,7 @@ int get_center_of_mass_velocity( return -1; } - const array velocity = tidymess.get_center_of_mass_velocity(); + const array velocity = tidymess->get_center_of_mass_velocity(); *vx = velocity[0]; *vy = velocity[1]; @@ -970,7 +969,7 @@ int get_center_of_mass_velocity( int get_total_radius(double* radius) { if (!radius) return -1; - const std::vector& bodies = tidymess.bodies; + const std::vector& bodies = tidymess->bodies; double xcom, ycom, zcom; double rsq_max = 0.0; @@ -1001,7 +1000,7 @@ int get_total_radius(double* radius) { int get_number_of_particles(int* number_of_particles) { if (!number_of_particles) return -1; - const std::vector& bodies = tidymess.bodies; + const std::vector& bodies = tidymess->bodies; *number_of_particles = static_cast(bodies.size()); return 0; @@ -1013,7 +1012,7 @@ int get_number_of_particles(int* number_of_particles) { int get_index_of_first_particle(int* index_of_the_particle) { if (!index_of_the_particle) return -1; - const std::vector& bodies = tidymess.bodies; + const std::vector& bodies = tidymess->bodies; if (bodies.empty()) return -1; *index_of_the_particle = bodies[0].id; @@ -1032,7 +1031,7 @@ int get_index_of_next_particle( int i = get_body_index_by_id(index_of_the_particle); if (i < 0) return -1; - const std::vector& bodies = tidymess.bodies; + const std::vector& bodies = tidymess->bodies; if (static_cast(i + 1) >= bodies.size()) return -1; *index_of_the_next_particle = bodies[i + 1].id; @@ -1071,7 +1070,7 @@ int convert_spin_vectors_to_inertial( w_vec[1] = 0; w_vec[2] = wmag; - w_vec = init.rotZrotX(psi, obl, w_vec); + w_vec = init->rotZrotX(psi, obl, w_vec); *wx = w_vec[0]; *wy = w_vec[1]; @@ -1087,8 +1086,8 @@ int detect_collision( int* index1, int* index2 ) { - *collision_flag = tidymess.get_collision_flag(); - std::vector< array > collided_indices = tidymess.get_collision_indices(); + *collision_flag = tidymess->get_collision_flag(); + std::vector< array > collided_indices = tidymess->get_collision_indices(); *n_collisions = collided_indices.size(); *index1 = 0; *index2 = 0; @@ -1165,15 +1164,6 @@ int get_gravity_at_point( return 0; } -/** - * Needed to compile the interface; - * not implemented yet - */ int synchronize_model() { return 0; } - -int print_particles(bool print_wtides) { - tidymess.print_particles(print_wtides); - return 0; -} From a2cfd62f8f7b4e46e5680d8e4fad1c9012d1b10f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 10:48:34 +0200 Subject: [PATCH 134/174] tidymess interface.cc cleanup, mv functions around --- src/amuse_tidymess/interface.cc | 235 ++++++++++++++++---------------- 1 file changed, 121 insertions(+), 114 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 2a46ddd215..1eb20b4b7f 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -57,20 +57,105 @@ int get_body_index_by_id(int index_of_the_particle) { return -1; } + /** - * Determine sign of dt value - * for integrating foward or backwards - * in time. copied from tidymess.cpp + * Run the initialization for the code, called before + / parameters and particles are set or before any other + / call on the code */ -int determine_dt_sgn(double t_end) { - // ** takes negative time step when evolving to 0, causes problems - if(t_end > tidymess->get_model_time()) { - dt_sign = 1; - } - else { - dt_sign = -1; +int initialize_code() { + tidymess = std::make_unique(); + init = std::make_unique(); + collision = std::make_unique(); + breakup = std::make_unique(); + + //initialize_stopping_conditions(); + + // AMUSE STOPPING CONDITIONS SUPPORT + //set_support_for_condition(COLLISION_DETECTION); + // reset id counter? + //particle_id_counter = 0; + + return 0; +} + +/** + * Deallocate Tidymess objects and data + */ +int cleanup_code() { + // assign pointers to null + tidymess.reset(); + init.reset(); + breakup.reset(); + collision.reset(); + + return 0; +} + +/** + * Perform initialization in the code dependent on the + * values of the parameters.Called after the parameters + * have been set or updated. + */ +int commit_parameters() { + tidymess->set_encounter_mode(); + tidymess->set_pointers(); + tidymess->upload_parameters(); + return 0; +} + +/** + * Commit particles to Tidymess and compute + * tidal tensors based on particle initial conditions + */ +int commit_particles() { + tidymess->set_model_time(begin_time); + + if (tidymess->get_tidal_model() > 0) { + switch(init_shape) { + case 0: + tidymess->set_to_spherical_shape(); + break; + case 1: + tidymess->set_to_equilibrium_shape(); + break; + default: + return -1; + } + tidymess->update_angular_momentum(); + } - tidymess->set_dt_sgn(dt_sign); + tidymess->commit_parameters(); + tidymess->initialize(); + + + const Body& body0 = tidymess->bodies[0]; + const Body& body1 = tidymess->bodies[1]; + + double dx = body1.r[0] - body0.r[0]; + double dy = body1.r[1] - body0.r[1]; + double dz = body1.r[2] - body0.r[2]; + double r = sqrt(dx*dx + dy*dy + dz*dz); + + cerr << "SEPARATION r = " << r << endl; + cerr << "EXPECTED POT = " << -(body0.m * body1.m) / r << endl; + + const array pcom = tidymess->get_center_of_mass(); + const array pvel = tidymess->get_center_of_mass_velocity(); + const double pot = tidymess->get_potential_energy(); + cerr<<"COM "< tidymess->get_model_time()) { + dt_sign = 1; + } + else { + dt_sign = -1; + } + tidymess->set_dt_sgn(dt_sign); + return 0; +} + + + // Tidymess setters and getters /** @@ -719,12 +824,12 @@ int normalize_initial_conditions() { Cv = std::sqrt(Cm / Cr); Ct = Cr / Cv; - tidymess.set_model_time(tidymess.get_model_time() / Ct); - tidymess.set_dt_const(tidymess.get_dt_const() / Ct); - tidymess.set_speed_of_light(tidymess.get_speed_of_light() / Cv); + tidymess->set_model_time(tidymess->get_model_time() / Ct); + tidymess->set_dt_const(tidymess->get_dt_const() / Ct); + tidymess->set_speed_of_light(tidymess->get_speed_of_light() / Cv); - std::cerr<<"model_time= "<& bodies = tidymess->bodies; - tidymess.reset(); // reset to point to Null - // tidymess.bodies.clear(); - - return 0; -} - - -/** - * Perform initialization in the code dependent on the - * values of the parameters.Called after the parameters - * have been set or updated. - */ -int commit_parameters() { - tidymess.set_encounter_mode(); - std::cerr<<"SET_POINTERS NOW!!!!"< 0) { - switch(init_shape) { - case 0: - tidymess.set_to_spherical_shape(); - break; - case 1: - tidymess.set_to_equilibrium_shape(); - break; - default: - return -1; - } - tidymess.update_angular_momentum(); - cerr<<"printing particles after update_angular_momentum"< Date: Tue, 28 Apr 2026 10:49:40 +0200 Subject: [PATCH 135/174] tidymess tests cleanup --- src/amuse_tidymess/tests/test_tidymess.py | 97 ++++++++++++++++------- 1 file changed, 67 insertions(+), 30 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 85b5218ef9..02733c5f5a 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -146,49 +146,32 @@ def test2(self): result = instance.get_breakup_mode() self.assertEquals(result['breakup_mode'], 1) - result = instance.get_num_integration_step() # FIXME + result = instance.get_num_integration_step() self.assertEquals(result['num_integration_step'], 0) - self.assertEqual(0, instance.cleanup_code()) - result = instance.get_number_of_particles() - self.assertEquals(result['number_of_particles'], 0) + self.assertEquals(result['number_of_particles'], 1) + self.assertEqual(0, instance.cleanup_code()) instance.stop() def test3(self): """ Test TidymessInterface creating and deleting particles. """ - + print('Test creating and deleting particles') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None - result = instance.new_particle( - 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, - 1.0, # radius - 1.0, # xi - 1.0, # kf - 1.0, # tau - 1.0, # wx - 1.0, # wy - 1.0, # wz - 1.0, # a_mb - ) + + self.assertEqual(0, instance.initialize_code()) + self.assertEqual(0, instance.commit_parameters()) + + # initialize new particle with all attributes set to 1 + result = instance.new_particle(*np.ones(15)*1) self.assertEqual(result['index_of_the_particle'], 0) - result = instance.new_particle( - 1.1, 1.1, 1.1, 1.1, - 1.1, 1.1, 1.1, - 1.1, # radius - 1.1, # xi - 1.1, # kf - 1.1, # tau - 1.1, # wx - 1.1, # wy - 1.1, # wz - 1.1, # a_mb - ) + # initialize new particle with all attributes set to 1.1 + result = instance.new_particle(*np.ones(15)*1.1) self.assertEqual(result['index_of_the_particle'], 1) # check number of particles @@ -219,6 +202,7 @@ def test4(self): """ Test TidymessInterface evolve_model with an equal mass binary. """ + print('Test evolve_model') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None @@ -390,13 +374,66 @@ def HD80606b_system(self): return HD80606 + def figure8_system(self): + figure8 = Particles(3) + figure8[0].name = 'Star1' + figure8[0].mass = 1 | nbody_system.mass + figure8[0].radius = 5e-2 | nbody_system.length + figure8[0].x = 0 | nbody_system.length + figure8[0].y = 0 | nbody_system.length + figure8[0].z = 0 | nbody_system.length + figure8[0].vx = -0.93240737 | nbody_system.speed + figure8[0].vy = -0.86473146 | nbody_system.speed + figure8[0].vz = 0 | nbody_system.speed + figure8[0].xi = 0.07 + figure8[0].kf = 0.02 + figure8[0].tau = 1e-2 | nbody_system.time + figure8[0].wx = 0 | 1 / nbody_system.time + figure8[0].wy = 0 | 1 / nbody_system.time + figure8[0].wz = 0 | 1 / nbody_system.time + + figure8[1].name = 'Star2' + figure8[1].mass = 1 | nbody_system.mass + figure8[1].radius = 5e-2 | nbody_system.length + figure8[1].x = 0.9700436 | nbody_system.length + figure8[1].y = -0.24308753 | nbody_system.length + figure8[1].z = 0 | nbody_system.length + figure8[1].vx = 0.466203685 | nbody_system.speed + figure8[1].vy = 0.43236573 | nbody_system.speed + figure8[1].vz = 0 | nbody_system.speed + figure8[1].xi = 0.07 + figure8[1].kf = 0.02 + figure8[1].tau = 1e-2 | nbody_system.time + figure8[1].wx = 0 | 1 / nbody_system.time + figure8[1].wy = 0 | 1 / nbody_system.time + figure8[1].wz = 0 | 1 / nbody_system.time + + figure8[2].name = 'Star3' + figure8[2].mass = 1 | nbody_system.mass + figure8[2].radius = 5e-2 | nbody_system.length + figure8[2].x = -0.9700436 | nbody_system.length + figure8[2].y = 0.24308753 | nbody_system.length + figure8[2].z = 0 | nbody_system.length + figure8[2].vx = 0.466203685 | nbody_system.speed + figure8[2].vy = 0.43236573 | nbody_system.speed + figure8[2].vz = 0 | nbody_system.speed + figure8[2].xi = 0.07 + figure8[2].kf = 0.02 + figure8[2].tau = 1e-2 | nbody_system.time + figure8[2].wx = 0 | 1 / nbody_system.time + figure8[2].wy = 0 | 1 / nbody_system.time + figure8[2].wz = 0 | 1 / nbody_system.time + + return figure8 + def test1(self): """ Test Tidymess parameters attribute and their defaults """ + print('Test parameters and their default values') system = self.earth_moon_system() converter = nbody_system.nbody_to_si( - system.mass.sum(), system[0].position.length() + 1 | u.MEarth, 1 | u.AU ) instance = self.new_instance_of_an_optional_code( Tidymess, converter From 2bbd78ad133641192ffb4bf13c3729592cce9191 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 11:24:11 +0200 Subject: [PATCH 136/174] cleaned up tidymess interface.cc --- src/amuse_tidymess/interface.cc | 176 ++++++++++++++++++-------------- 1 file changed, 97 insertions(+), 79 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 1eb20b4b7f..c98d343aac 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -57,7 +57,6 @@ int get_body_index_by_id(int index_of_the_particle) { return -1; } - /** * Run the initialization for the code, called before / parameters and particles are set or before any other @@ -185,42 +184,31 @@ int new_particle( if (!index_of_the_particle) return -1; std::vector& bodies = tidymess->bodies; - Body newbody( mass, radius, xi, kf, tau, a_mb, wx, wy, wz, x, y, z, vx, vy, vz ); - newbody.set_id(particle_id_counter); + bodies.push_back(newbody); *index_of_the_particle = particle_id_counter++; - bodies.push_back(newbody); - if (print_info) { - cerr<<"printing particle in new_particle"<print_particles(false); - cerr<<"end print "<& bodies = tidymess->bodies; int i = get_body_index_by_id(index_of_the_particle); - if (i < 0) return -1; + std::vector& bodies = tidymess->bodies; bodies.erase(bodies.begin() + i); return 0; } - /** * Determine sign of dt value * for integrating foward or backwards @@ -238,9 +226,8 @@ int determine_dt_sgn(double t_end) { return 0; } - - -// Tidymess setters and getters +// Setters and Getters +// ------------------- /** * Get state of a particle @@ -293,6 +280,7 @@ int get_state( return 0; } + /** * Set state of a particle */ @@ -344,6 +332,7 @@ int get_mass(int index_of_the_particle, double* mass) { *mass = tidymess->bodies[i].m; return 0; } + /** * Set mass of a particle */ @@ -367,6 +356,7 @@ int get_radius(int index_of_the_particle, double* radius ) { *radius = tidymess->bodies[i].R; return 0; } + /** * Set radius of a particle */ @@ -399,6 +389,7 @@ int get_position( *z = body.r[2]; return 0; } + /** * Set position of a particle */ @@ -438,6 +429,7 @@ int get_velocity( *vz = body.v[2]; return 0; } + /** * Set velocity of a particle */ @@ -468,6 +460,7 @@ int get_xi(int index_of_the_particle, double* xi) { *xi = tidymess->bodies[i].xi; return 0; } + /** * Set moment of inertia of a particle */ @@ -491,6 +484,7 @@ int get_kf(int index_of_the_particle, double* kf) { *kf = tidymess->bodies[i].kf; return 0; } + /** * Set fluid love number of a particle */ @@ -514,6 +508,7 @@ int get_tau(int index_of_the_particle, double* tau) { *tau = tidymess->bodies[i].tau; return 0; } + /** * Set fluid relaxation time of a particle */ @@ -546,6 +541,7 @@ int get_spin( *wz = body.w[2]; return 0; } + /** * Set spin of a particle */ @@ -565,6 +561,9 @@ int set_spin( return 0; } +/** + * Evolve the model to a specified time + */ int evolve_model(double time) { determine_dt_sgn(time); @@ -582,6 +581,7 @@ int get_tidal_model(int* tidal_model) { *tidal_model = tidymess->get_tidal_model(); return 0; } + /** * Set Tidymess tidal model parameter */ @@ -599,6 +599,7 @@ int get_pn_order(int* pn_order) { *pn_order = tidymess->get_pn_order(); return 0; } + /** * Set Tidymess pn order parameter */ @@ -616,6 +617,7 @@ int get_magnetic_braking(int* magnetic_braking) { *magnetic_braking = tidymess->get_magnetic_braking(); return 0; } + /** * Set Tidymess magnetic braking parameter */ @@ -633,6 +635,7 @@ int get_speed_of_light(double* speed_of_light) { *speed_of_light = tidymess->get_speed_of_light(); return 0; } + /** * Set Tidymess speed of light parameter */ @@ -650,6 +653,7 @@ int get_dt_mode(int* dt_mode) { *dt_mode = tidymess->get_dt_mode(); return 0; } + /** * Set Tidymess dt mode parameter */ @@ -667,6 +671,7 @@ int get_dt_const(double* dt_const) { *dt_const = tidymess->get_dt_const(); return 0; } + /** * Set Tidymess constant dt parameter */ @@ -700,6 +705,7 @@ int get_eta(double* eta) { *eta = tidymess->get_eta(); return 0; } + /** * Set Tidymess eta (accuracy parameter) */ @@ -717,6 +723,7 @@ int get_n_iter(int* n_iter) { *n_iter = tidymess->n_iter; return 0; } + /** * Set Tidymess n iter parameter */ @@ -734,6 +741,7 @@ int get_initial_shape(int* initial_shape) { *initial_shape = init_shape; return 0; } + /** * Set Tidymess initial shape parameter */ @@ -786,92 +794,102 @@ int get_num_integration_step(int* num_integration_step) { return 0; } -int normalize_initial_conditions() { +// int normalize_initial_conditions() { - double Cm = 0.0; - double Cr = 0.0; - double Cv = 1.0; - double Ct = 1.0; +// double Cm = 0.0; +// double Cr = 0.0; +// double Cv = 1.0; +// double Ct = 1.0; - std::vector& bodies = tidymess->bodies; +// std::vector& bodies = tidymess->bodies; - int N = static_cast(bodies.size()); +// int N = static_cast(bodies.size()); - for(int i = 0; i < N; i++) { - Cm += bodies[i].m; - } +// for(int i = 0; i < N; i++) { +// Cm += bodies[i].m; +// } - if(Cm == 0) { - std::cerr<<"The cumulative mass of the N-body system is zero! Please include a non-zero mass body."<set_model_time(tidymess->get_model_time() / Ct); - tidymess->set_dt_const(tidymess->get_dt_const() / Ct); - tidymess->set_speed_of_light(tidymess->get_speed_of_light() / Cv); +// tidymess->set_model_time(tidymess->get_model_time() / Ct); +// tidymess->set_dt_const(tidymess->get_dt_const() / Ct); +// tidymess->set_speed_of_light(tidymess->get_speed_of_light() / Cv); - std::cerr<<"model_time= "<get_model_time()< Date: Tue, 28 Apr 2026 11:25:10 +0200 Subject: [PATCH 138/174] rename get_energy to get_total_energy --- src/amuse_tidymess/interface.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index c98d343aac..207f0ee2e2 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -884,8 +884,9 @@ int set_eps2(double epsilon_squared) { /** * Get total energy */ -int get_energy(double* total_energy) { +int get_total_energy(double* total_energy) { if (!total_energy) return -1; + *total_energy = tidymess->get_energy(); return 0; } From 75f459fc2566e90e159818bd1ecdc87aa15bcda9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 14:23:20 +0200 Subject: [PATCH 139/174] added properties to tidymess interface.py --- src/amuse_tidymess/interface.py | 1 + src/amuse_tidymess/packages/amuse-tidymess/amuse_tidymess | 1 + 2 files changed, 2 insertions(+) create mode 120000 src/amuse_tidymess/packages/amuse-tidymess/amuse_tidymess diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index ef8cda910c..419b079520 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1596,6 +1596,7 @@ def define_parameters(self, handler): def define_properties(self, handler): """Define read only properties of Tidymess""" + GravitationalDynamics.define_properties(self, handler) handler.add_property('get_total_energy', public_name='total_energy') def define_particle_sets(self, handler): diff --git a/src/amuse_tidymess/packages/amuse-tidymess/amuse_tidymess b/src/amuse_tidymess/packages/amuse-tidymess/amuse_tidymess new file mode 120000 index 0000000000..c25bddb6dd --- /dev/null +++ b/src/amuse_tidymess/packages/amuse-tidymess/amuse_tidymess @@ -0,0 +1 @@ +../.. \ No newline at end of file From c0b3884233c5fa08e17571a50979715c3a4fb867 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 14:45:04 +0200 Subject: [PATCH 140/174] def test evolving backwards in time tidymess --- src/amuse_tidymess/tests/test_tidymess.py | 98 ++++++++++++++++++++--- 1 file changed, 87 insertions(+), 11 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 02733c5f5a..50f712f053 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -513,6 +513,7 @@ def test2(self): """ Test Tidymess add_particles method. """ + print('Test adding and deleting particles') system = self.earth_moon_system() converter = nbody_system.nbody_to_si(system.mass.sum(), system[0].position.length()) @@ -538,7 +539,7 @@ def test3(self): """ Test the function for converting spin vectors """ - + print('Test converting spin vectors') converter = nbody_system.nbody_to_si(1 | u.MEarth, 1 | u.REarth) instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None @@ -557,39 +558,114 @@ def test3(self): def test4(self): """ - Test that setting a begin time correctly creates a time offset + Test that setting a begin time correctly creates a time offset. """ + print('Test setting begin_time') dt = 5 | u.yr begin_time = (50 | u.yr).as_quantity_in(u.s) end_time = begin_time + dt system = self.earth_moon_system() converter = nbody_system.nbody_to_si( - system.mass.sum(), 1 | u.au + 1 | u.MEarth, 1 | u.au ) instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None - self.assertEquals(instance.get_begin_time(), instance.model_time) - self.assertEquals(instance.get_begin_time(), 0 | u.s) - instance.parameters.tidal_model = 0 instance.parameters.dt_mode = 2 - instance.parameters.eta = 0.0625 - instance.set_begin_time(begin_time) + instance.parameters.eta = 0.015625 instance.commit_parameters() + self.assertEquals(instance.get_begin_time(), instance.model_time) + self.assertEquals(instance.get_begin_time(), 0 | u.s) + + instance.set_begin_time(begin_time) instance.particles.add_particles(system) - channel = instance.particles.new_channel_to(system) instance.evolve_model(instance.model_time + dt) - self.assertEquals(instance.get_begin_time(), begin_time) - self.assertAlmostEquals(instance.model_time, end_time) + self.assertAlmostEquals(instance.get_begin_time(), begin_time, places=3) + self.assertAlmostEquals(instance.model_time, end_time, places=3) instance.stop() def test5(self): + """ + Test evolving backwards in time. + + 2 identical figure 8 systems are created and evolved to t1. + The second system is then evolved to t2 where t2 > t1. + Finally the second system is evolved 'backwards' back to t1. + System 2 should be identical to system 1 at the end of the + backwards evolution. + """ + print('Test evolving backwards in time') + t1 = 1e3 | nbody_system.time + t2 = 2e3 | nbody_system.time + self.assertFalse(t1 > t2) + + # System 1 + # -------- + system1 = self.figure8_system() + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + instance.parameters.tidal_model = 0 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.015625 + instance.commit_parameters() + + instance.particles.add_particles(system1) + channel1 = instance.particles.new_channel_to(system1) + + instance.evolve_model(t1) + channel1.copy() + self.assertEquals(instance.model_time, t1) + + instance.stop() + + # System 2 + # -------- + system2 = self.figure8_system() + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + instance.parameters.tidal_model = 0 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.015625 + instance.commit_parameters() + + instance.particles.add_particles(system2) + channel2 = instance.particles.new_channel_to(system2) + + instance.evolve_model(t2) + channel2.copy() + self.assertEquals(instance.model_time, t2) + + instance.evolve_model(t1) + channel2.copy() + self.assertEquals(instance.model_time, t1) + + instance.stop() + + attributes = [ + 'x', 'y', 'z', + 'vx', 'vy', 'vz', + 'wx', 'wy', 'wz', + 'mass', 'radius', + 'xi', 'kf', 'tau' + ] + + for attr in attributes: + self.assertAlmostEquals( + getattr(system1, attr), + getattr(system2, attr) + ) + + def test6(self): """ Evolve a system of Particles without tides """ From 2e473cb2e4183fbf58033ca4e02ccbee622a22cb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 14:58:57 +0200 Subject: [PATCH 141/174] def test figure 8 system tidymess --- src/amuse_tidymess/tests/test_tidymess.py | 82 ++++++++++++++++++++++- 1 file changed, 80 insertions(+), 2 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 50f712f053..f3435557c4 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -682,7 +682,7 @@ def test6(self): instance.parameters.tidal_model = 0 instance.parameters.dt_mode = 2 - instance.parameters.eta = 0.0625 + instance.parameters.eta = 0.015625 instance.commit_parameters() instance.particles.add_particles(system) @@ -724,7 +724,85 @@ def test6(self): instance.stop() - def test6(self): + + def test7(self): + """ + Evolve a figure 8 system in N-Body units with tides + """ + print('Test figure 8 system in N-Body units with tidal model 4') + end_time = 2e3 | nbody_system.time + dt_diag = 1 | nbody_system.time + system = self.figure8_system() + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + instance.parameters.tidal_model = 4 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.015625 + instance.parameters.initial_shape = 1 + instance.commit_parameters() + + instance.particles.add_particles(system) + channel = instance.particles.new_channel_to(system) + + while instance.model_time < end_time: + time = instance.model_time + dt_diag + instance.evolve_model(time) + channel.copy() + + self.assertAlmostEquals(instance.model_time, end_time) + + expected_position = [ + (-8.3158513208432949e-1, -3.2772668917477010e-1, 0.0), + (1.0473030710123414, 1.4115693325940498e-1, 0.0), + (-2.1571793896223476e-1, 1.8656975594817923e-1, 0.0) + ] + + for particle, (ex, ey, ez) in zip(instance.particles, expected_position): + self.assertAlmostEquals(particle.x.number, ex) + self.assertAlmostEquals(particle.y.number, ey) + self.assertAlmostEquals(particle.z.number, ez) + + expected_velocity = [ + (-7.7344778284882154e-1, 2.9006761692492700e-1, 0.0), + (-2.3236429722650778e-1, 4.6474040665908695e-1, 0.0), + (1.0058120800752739, -7.5480802358400112e-1, 0.0) + ] + + for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): + self.assertAlmostEquals(particle.vx.number, evx) + self.assertAlmostEquals(particle.vy.number, evy) + self.assertAlmostEquals(particle.vz.number, evz) + + expected_spin = [ + (0.0, 0.0, -1.4197775319236833e-5), + (0.0, 0.0, 2.1862179353662240e-7), + (0.0, 0.0, -1.4059667978211637e-5) + ] + + for particle, (ewx, ewy, ewz) in zip(instance.particles, expected_spin): + self.assertAlmostEquals(particle.wx.number, ewx) + self.assertAlmostEquals(particle.wy.number, ewy) + self.assertAlmostEquals(particle.wz.number, ewz) + + # mass, radius, xi, kf, tau + expected_attributes = [ + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2) + ] + + for particle, (m, r, xi, kf, tau) in zip(instance.particles, expected_attributes): + self.assertAlmostEquals(particle.mass.number, m) + self.assertAlmostEquals(particle.radius.number, r) + self.assertAlmostEquals(particle.xi, xi) + self.assertAlmostEquals(particle.kf, kf) + self.assertAlmostEquals(particle.tau.number, tau) + + instance.stop() + + def test8(self): """ Evolve the HD80606b exoplanet system with tides """ From c89ef15d015d79378275dd51734a8e180b837d5d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 15:00:12 +0200 Subject: [PATCH 142/174] renamed packages/amuse-tidymess/tidymess to packages/amuse-tidymess/amuse_tidymess which caused a bug with pytest --- src/amuse_tidymess/packages/amuse-tidymess/tidymess | 1 - 1 file changed, 1 deletion(-) delete mode 120000 src/amuse_tidymess/packages/amuse-tidymess/tidymess diff --git a/src/amuse_tidymess/packages/amuse-tidymess/tidymess b/src/amuse_tidymess/packages/amuse-tidymess/tidymess deleted file mode 120000 index c25bddb6dd..0000000000 --- a/src/amuse_tidymess/packages/amuse-tidymess/tidymess +++ /dev/null @@ -1 +0,0 @@ -../.. \ No newline at end of file From dcb9bd5a007f45d7fee2a09bdea82cdab54e9271 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 15:03:24 +0200 Subject: [PATCH 143/174] cleaned up tidymess interface.cc --- src/amuse_tidymess/interface.cc | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 207f0ee2e2..70e37f5b7b 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -215,7 +215,6 @@ int delete_particle(int index_of_the_particle) { * in time. copied from tidymess.cpp */ int determine_dt_sgn(double t_end) { - // ** takes negative time step when evolving to 0, causes problems if(t_end > tidymess->get_model_time()) { dt_sign = 1; } @@ -226,6 +225,17 @@ int determine_dt_sgn(double t_end) { return 0; } +/** + * Evolve the model to a specified time + */ +int evolve_model(double time) { + + determine_dt_sgn(time); + + tidymess->evolve_model(time); + return 0; +} + // Setters and Getters // ------------------- @@ -561,17 +571,6 @@ int set_spin( return 0; } -/** - * Evolve the model to a specified time - */ -int evolve_model(double time) { - - determine_dt_sgn(time); - - tidymess->evolve_model(time); - return 0; -} - /** * Get Tidymess tidal model parameter */ From 088bb6cec595c84228280aa1212c1635190e4558 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 15:12:10 +0200 Subject: [PATCH 144/174] tidymess tests cleanup --- src/amuse_tidymess/tests/test_tidymess.py | 27 ++++++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index f3435557c4..562e9809fd 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -375,6 +375,14 @@ def HD80606b_system(self): return HD80606 def figure8_system(self): + """ + Generate initial conditions for a triple system + in a figure 8 configuration. + + This is one of the solutions to the 3-body problem. + The units are in dimensionless N-Body units. + Initial conditions courtesy of Dr. Tjarda Boekholt. + """ figure8 = Particles(3) figure8[0].name = 'Star1' figure8[0].mass = 1 | nbody_system.mass @@ -428,7 +436,13 @@ def figure8_system(self): def test1(self): """ - Test Tidymess parameters attribute and their defaults + Test Tidymess parameters attribute and their defaults. + + Although the default values are technically defined under + parameters in the Tidymess interface.py, in practice these + defaults are overridden by the defaults set in the Tidymess + source code. The defaults in the interface.py were chosen to + match the defaults set in the Tidymess standalone package. """ print('Test parameters and their default values') system = self.earth_moon_system() @@ -460,9 +474,10 @@ def test1(self): instance.parameters.dt_mode = 2 self.assertEquals(instance.parameters.dt_mode, 2) - self.assertEquals(instance.parameters.dt_const, 0.015625) - instance.parameters.dt_const = 0.025625 - self.assertEquals(instance.parameters.dt_const, 0.025625) + dt_const = instance.unit_converter.to_si(0.015625 | nbody_system.time) + self.assertAlmostEquals(instance.parameters.dt_const, dt_const, 3) + instance.parameters.dt_const = 0.025625 | u.s + self.assertAlmostEquals(instance.parameters.dt_const, 0.025625 | u.s, 3) self.assertEquals(instance.parameters.eta, 0.0625) instance.parameters.eta = 0.0726 @@ -499,7 +514,7 @@ def test1(self): self.assertEquals(instance.parameters.magnetic_braking, 1) self.assertEquals(instance.parameters.speed_of_light, 2e100) self.assertEquals(instance.parameters.dt_mode, 2) - self.assertEquals(instance.parameters.dt_const, 0.025625) + self.assertAlmostEquals(instance.parameters.dt_const, 0.025625 | u.s, 3) self.assertEquals(instance.parameters.eta, 0.0726) self.assertEquals(instance.parameters.n_iter, 2) self.assertEquals(instance.parameters.collision_mode, 1) @@ -537,7 +552,7 @@ def test2(self): def test3(self): """ - Test the function for converting spin vectors + Test the function for converting spin vectors. """ print('Test converting spin vectors') converter = nbody_system.nbody_to_si(1 | u.MEarth, 1 | u.REarth) From 12a4aa392ff6e96e0c13012d106cc450ac8a9901 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 18:19:14 +0200 Subject: [PATCH 145/174] tidymess test physical units --- src/amuse_tidymess/tests/test_tidymess.py | 176 +++++++++------------- 1 file changed, 71 insertions(+), 105 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 562e9809fd..7a018c2b57 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1,7 +1,9 @@ """ Date Created : December 10, 2025 -Last Updated : April 24, 2026 +Last Updated : April 28, 2026 Tests for Tidymess and TidymessInterface + +For questions about the tests, contact elkogerville@gmail.com """ from amuse.datamodel import Particles @@ -266,68 +268,6 @@ def earth_moon_system(self): return system - def jupiter_io_system(self): - """ - Ephemeris Pasadena, USA, Horizons - - Jupiter and Io Ephemeris at A.D. 2026-Jan-01 00:00:00.0000 - - Jupiter: - kf from: Dong Lai 2021 Planet. Sci. J. 2 122 DOI 10.3847/PSJ/ac013b - xi from: https://doi.org/10.1016/j.icarus.2011.09.016 - spin vector from: https://radiojove.gsfc.nasa.gov/education/jupiter/basics/jfacts.htm - - Io: - kf from https://doi.org/10.1016/j.icarus.2025.116567 - xi from Schubert et al. 2004 - spin vector from https://doi.org/10.1016/j.icarus.2012.05.020 and ephemeris - - spin vectors were calculated from LOD, OBL, PSI using - the ``Tidymess.convert_spin_vectors_to_inertial()`` method. - - tau values are arbitrary for both bodies. - """ - system = Particles(2) - - system[0].name = 'Jupiter' - system[0].mass = 1898.6e24 | u.kg - system[0].radius = 6371.01 | u.km - system[0].x = -2.538781102425539e8 | u.km - system[0].y = 7.365225847926259e8 | u.km - system[0].z = 2.626628058868796e6 | u.km - system[0].vx = -1.250707427525374e1 | u.kms - system[0].vy = -3.638417682823274 | u.kms - system[0].vz = 2.949797151579847e-1 | u.kms - system[0].kf = 0.565 - system[0].xi = 0.2629 - system[0].tau = 0 | u.s - system[0].wx = 0.0 | 1 / u.s - system[0].wy = -9.60092648806e-6 | 1 / u.s - system[0].wz = 0.000175573560178 | 1 / u.s - system[0].a_mb = 0 - - system[1].name = 'Io' - system[1].mass = 893193797311089e8 | u.kg - system[1].radius = 1821.6 | u.km - system[1].x = -2.535070263728397e8 | u.km - system[1].y = 7.363212379813337e8 | u.km - system[1].z = 2.624656018151939e6 | u.km - system[1].vx = -4.195592326222561 | u.kms - system[1].vy = 1.153726914561471e1 | u.kms - system[1].vz = 9.564081722803852e-1 | u.kms - system[1].kf = 0.125 - system[1].xi = 0.378 - system[1].tau = 0 | u.s - system[1].wx = 0.0 | 1 / u.s - system[1].wy = -1.43416864277e-9 | 1 / u.s - system[1].wz = 4.10859051537e-5 | 1 / u.s - system[1].a_mb = 0 - - system.move_to_center() - - return system - - def HD80606b_system(self): """ Initial conditions for the exoplanet system @@ -573,14 +513,14 @@ def test3(self): def test4(self): """ - Test that setting a begin time correctly creates a time offset. + Test that setting begin_time correctly creates a time offset. """ print('Test setting begin_time') dt = 5 | u.yr begin_time = (50 | u.yr).as_quantity_in(u.s) end_time = begin_time + dt - system = self.earth_moon_system() + system = self.HD80606b_system() converter = nbody_system.nbody_to_si( 1 | u.MEarth, 1 | u.au ) @@ -682,71 +622,97 @@ def test5(self): def test6(self): """ - Evolve a system of Particles without tides - """ - end_time = 1 | u.yr - dt_diag = 1e-4 | u.yr + Evolve a system with tidal effects in physical units. - system = self.earth_moon_system() + The reference values used in this test were generated + using the standalone Tidymess code. Because Tidymess + applies slightly different unit conversion factors in + physical-unit mode, the initial conditions were first + converted to N-body units before running the simulation + in Tidymess. The resulting outputs were then converted + back to physical units for comparison with the AMUSE results. + """ + print('Test evolve model with physical units') + system = self.HD80606b_system() converter = nbody_system.nbody_to_si( - system.mass.sum(), 1 | u.au + system.mass.sum(), system.position[1].length() ) instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None - instance.parameters.tidal_model = 0 + instance.parameters.tidal_model = 4 instance.parameters.dt_mode = 2 instance.parameters.eta = 0.015625 + instance.parameters.initial_shape = 0 instance.commit_parameters() instance.particles.add_particles(system) channel = instance.particles.new_channel_to(system) - times = [] | u.yr - times.append(0.0 | u.yr) - particles = [system.copy()] + instance.evolve_model(converter.to_si(1e3 | nbody_system.time)) + channel.copy() - while instance.model_time < end_time: - time = instance.model_time + dt_diag - instance.evolve_model(time) - channel.copy() + expected_position = [ + (9.2110173492271311e-2, 1.5422660672122340e-2, 0.0), + (-2.3887569837471958e1, -3.9996654911555614, 0.0) + ] - particles.append(system.copy()) - times.append(instance.model_time) + for particle, (ex, ey, ez) in zip(instance.particles, expected_position): + self.assertAlmostRelativeEqual( + particle.x, converter.to_si(ex | nbody_system.length), places=4 + ) + self.assertAlmostRelativeEqual( + particle.y, converter.to_si(ey | nbody_system.length), places=4 + ) + self.assertAlmostRelativeEqual( + particle.z, converter.to_si(ez | nbody_system.length), places=4 + ) - self.assertAlmostEquals( - particles[-1].position[0], - VectorQuantity([3554487.97163, -3026275.21595, 0.0], u.m), - places=1 - ) - self.assertAlmostEquals( - particles[-1].position[1], - VectorQuantity([-289132566.932, 246166178.762, 0.0], u.m), - places=1 - ) - self.assertAlmostEquals( - particles[-1].velocity[0], - VectorQuantity([8.06599003995, 9.47384574385, 0.0], u.ms), - places=1 - ) - self.assertAlmostEquals( - particles[-1].velocity[1], - VectorQuantity([-656.111491645, -770.630639491, 0.0], u.ms), - places=1 - ) - self.assertAlmostRelativeEqual(times[-1], end_time, places=3) + expected_velocity = [ + (-4.5536563347452620e-4, 1.4689234497039288e-4, 0.0), + (1.1809312651138797e-1, -3.8094610122321661e-2, 0.0) + ] - instance.stop() + for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): + self.assertAlmostRelativeEqual( + particle.vx, converter.to_si(evx | nbody_system.speed), places=4 + ) + self.assertAlmostRelativeEqual( + particle.vy, converter.to_si(evy | nbody_system.speed), places=4 + ) + self.assertAlmostRelativeEqual( + particle.vz, converter.to_si(evz | nbody_system.speed), places=4 + ) + + expected_spin = [ + (0.0, 0.0, 7.8439567544949240e-02), + (0.0, 0.0, 3.8166572048686174e+00) + ] + + for particle, (ewx, ewy, ewz) in zip(instance.particles, expected_spin): + self.assertAlmostEqual( + particle.wx, converter.to_si(ewx | 1/nbody_system.time), places=7 + ) + self.assertAlmostEqual( + particle.wy, converter.to_si(ewy | 1/nbody_system.time), places=7 + ) + self.assertAlmostEqual( + particle.wz, converter.to_si(ewz | 1/nbody_system.time), places=7 + ) + instance.stop() def test7(self): """ - Evolve a figure 8 system in N-Body units with tides + Evolve a figure 8 system in N-Body units with tides. + + For the expected values used to compare in this test, + an identical simulation was ran in the Tidymess standalone + package. """ print('Test figure 8 system in N-Body units with tidal model 4') end_time = 2e3 | nbody_system.time - dt_diag = 1 | nbody_system.time system = self.figure8_system() instance = self.new_instance_of_an_optional_code(Tidymess) From 2a33c6b021588f3bb4e7073d042c65a71e70bf64 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 18:20:28 +0200 Subject: [PATCH 146/174] tidymess test that diagnostic output time has no effect on simulation --- src/amuse_tidymess/tests/test_tidymess.py | 80 ++++++++++++++++++++--- 1 file changed, 72 insertions(+), 8 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 7a018c2b57..0a99f159bc 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -727,10 +727,8 @@ def test7(self): instance.particles.add_particles(system) channel = instance.particles.new_channel_to(system) - while instance.model_time < end_time: - time = instance.model_time + dt_diag - instance.evolve_model(time) - channel.copy() + instance.evolve_model(end_time) + channel.copy() self.assertAlmostEquals(instance.model_time, end_time) @@ -752,9 +750,9 @@ def test7(self): ] for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): - self.assertAlmostEquals(particle.vx.number, evx) - self.assertAlmostEquals(particle.vy.number, evy) - self.assertAlmostEquals(particle.vz.number, evz) + self.assertAlmostEquals(particle.vx.number, evx, places=6) + self.assertAlmostEquals(particle.vy.number, evy, places=6) + self.assertAlmostEquals(particle.vz.number, evz, places=6) expected_spin = [ (0.0, 0.0, -1.4197775319236833e-5), @@ -785,7 +783,7 @@ def test7(self): def test8(self): """ - Evolve the HD80606b exoplanet system with tides + Evolve a system without tides. """ end_time = 2e3 | u.yr dt_diag = 1 | u.yr @@ -842,3 +840,69 @@ def test8(self): self.assertAlmostRelativeEqual(times[-1], end_time, places=3) instance.stop() + + def test9(self): + """ + Test that varying diagnostic dt has no change on the result. + This verifies that evolving to t_end in one `evolve_model` + call gives the same answer as evolving to t_end incrementally. + + dt_diag controls how many times AMUSE creates a snapshot. + """ + print('Test Tidymess snapshot dependency') + # System 1 + # -------- + t_end = 2e3 | nbody_system.time + system1 = self.figure8_system() + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + instance.parameters.tidal_model = 4 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.015625 + instance.parameters.initial_shape = 1 + instance.commit_parameters() + + instance.particles.add_particles(system1) + channel1 = instance.particles.new_channel_to(system1) + + instance.evolve_model(t_end) + channel1.copy() + + instance.stop() + + # System 2 + # -------- + dt_diag = 1 | nbody_system.time + system2 = self.figure8_system() + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + instance.parameters.tidal_model = 4 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.015625 + instance.parameters.initial_shape = 1 + instance.commit_parameters() + + instance.particles.add_particles(system2) + channel2 = instance.particles.new_channel_to(system2) + + while instance.model_time < t_end: + time = instance.model_time + dt_diag + instance.evolve_model(time) + channel2.copy() + + instance.stop() + + self.assertAlmostEquals( + system1.position, system2.position + ) + self.assertAlmostEquals( + system1.velocity, system2.velocity, places=6 + ) + self.assertAlmostEquals(system1.wx, system2.wx) + self.assertAlmostEquals(system1.wy, system2.wy) + self.assertAlmostEquals(system1.wz, system2.wz) + self.assertAlmostEquals(system1.mass, system2.mass) + self.assertAlmostEquals(system1.radius, system2.radius) From bbc24975f8f4084ddcc824b5e9c374d7000857ca Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 18:28:33 +0200 Subject: [PATCH 147/174] cleanup tidymess interface.cc --- src/amuse_tidymess/interface.cc | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 70e37f5b7b..c9de193f56 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -32,15 +32,6 @@ int dt_sign = 1; bool print_info = false; -/** - * Check that begin time is an offset - * rn begin time is set in commit parameters but maybe can be moved - * test if u can evolve backwards in time (first w no tides, and if with tides use tidal model 1) - * test that dtconst requires units - * - */ - - /** * Given an AMUSE particle index, find the corresponding * index of that particle within Tidymess. This is a helper @@ -79,10 +70,9 @@ int initialize_code() { } /** - * Deallocate Tidymess objects and data + * Deallocate Tidymess by setting pointers to null */ int cleanup_code() { - // assign pointers to null tidymess.reset(); init.reset(); breakup.reset(); @@ -127,25 +117,6 @@ int commit_particles() { tidymess->commit_parameters(); tidymess->initialize(); - - const Body& body0 = tidymess->bodies[0]; - const Body& body1 = tidymess->bodies[1]; - - double dx = body1.r[0] - body0.r[0]; - double dy = body1.r[1] - body0.r[1]; - double dz = body1.r[2] - body0.r[2]; - double r = sqrt(dx*dx + dy*dy + dz*dz); - - cerr << "SEPARATION r = " << r << endl; - cerr << "EXPECTED POT = " << -(body0.m * body1.m) / r << endl; - - const array pcom = tidymess->get_center_of_mass(); - const array pvel = tidymess->get_center_of_mass_velocity(); - const double pot = tidymess->get_potential_energy(); - cerr<<"COM "< Date: Tue, 28 Apr 2026 18:28:53 +0200 Subject: [PATCH 148/174] cleanup tests tidymess --- src/amuse_tidymess/tests/test_tidymess.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 0a99f159bc..db29f99b17 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -24,6 +24,7 @@ def test1(self): print('Test initialization') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None + self.assertEqual(0, instance.initialize_code()) self.assertEqual(0, instance.commit_parameters()) self.assertEqual(0, instance.cleanup_code()) @@ -567,7 +568,7 @@ def test5(self): instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None - instance.parameters.tidal_model = 0 + instance.parameters.tidal_model = 1 instance.parameters.dt_mode = 2 instance.parameters.eta = 0.015625 instance.commit_parameters() @@ -588,7 +589,7 @@ def test5(self): instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None - instance.parameters.tidal_model = 0 + instance.parameters.tidal_model = 1 instance.parameters.dt_mode = 2 instance.parameters.eta = 0.015625 instance.commit_parameters() From 1bd9804b7e41d130ba86d80f2b133d46076c2958 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 28 Apr 2026 18:33:25 +0200 Subject: [PATCH 149/174] tidymess cleanup interfaces --- src/amuse_tidymess/interface.cc | 82 +-------------------------------- src/amuse_tidymess/interface.py | 1 - 2 files changed, 1 insertion(+), 82 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index c9de193f56..2717cc4663 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -200,10 +200,9 @@ int determine_dt_sgn(double t_end) { * Evolve the model to a specified time */ int evolve_model(double time) { - determine_dt_sgn(time); - tidymess->evolve_model(time); + return 0; } @@ -764,84 +763,6 @@ int get_num_integration_step(int* num_integration_step) { return 0; } -// int normalize_initial_conditions() { - -// double Cm = 0.0; -// double Cr = 0.0; -// double Cv = 1.0; -// double Ct = 1.0; - -// std::vector& bodies = tidymess->bodies; - -// int N = static_cast(bodies.size()); - - -// for(int i = 0; i < N; i++) { -// Cm += bodies[i].m; -// } - -// if(Cm == 0) { -// std::cerr<<"The cumulative mass of the N-body system is zero! Please include a non-zero mass body."<set_model_time(tidymess->get_model_time() / Ct); -// tidymess->set_dt_const(tidymess->get_dt_const() / Ct); -// tidymess->set_speed_of_light(tidymess->get_speed_of_light() / Cv); - -// std::cerr<<"model_time= "<get_model_time()< Date: Wed, 29 Apr 2026 12:27:07 +0200 Subject: [PATCH 151/174] cleaned up tidymess tests, ensured correct assertions are being used --- src/amuse_tidymess/tests/test_tidymess.py | 176 +++++++++------------- 1 file changed, 73 insertions(+), 103 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index db29f99b17..5b1c598a66 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -25,9 +25,9 @@ def test1(self): instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None - self.assertEqual(0, instance.initialize_code()) - self.assertEqual(0, instance.commit_parameters()) - self.assertEqual(0, instance.cleanup_code()) + self.assertEquals(0, instance.initialize_code()) + self.assertEquals(0, instance.commit_parameters()) + self.assertEquals(0, instance.cleanup_code()) instance.stop() def test2(self): @@ -38,8 +38,8 @@ def test2(self): instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None - self.assertEqual(0, instance.initialize_code()) - self.assertEqual(0, instance.commit_parameters()) + self.assertEquals(0, instance.initialize_code()) + self.assertEquals(0, instance.commit_parameters()) result = instance.get_number_of_particles() self.assertEquals(result['number_of_particles'], 0) @@ -155,7 +155,7 @@ def test2(self): result = instance.get_number_of_particles() self.assertEquals(result['number_of_particles'], 1) - self.assertEqual(0, instance.cleanup_code()) + self.assertEquals(0, instance.cleanup_code()) instance.stop() def test3(self): @@ -166,38 +166,38 @@ def test3(self): instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None - self.assertEqual(0, instance.initialize_code()) - self.assertEqual(0, instance.commit_parameters()) + self.assertEquals(0, instance.initialize_code()) + self.assertEquals(0, instance.commit_parameters()) # initialize new particle with all attributes set to 1 result = instance.new_particle(*np.ones(15)*1) - self.assertEqual(result['index_of_the_particle'], 0) + self.assertEquals(result['index_of_the_particle'], 0) # initialize new particle with all attributes set to 1.1 result = instance.new_particle(*np.ones(15)*1.1) - self.assertEqual(result['index_of_the_particle'], 1) + self.assertEquals(result['index_of_the_particle'], 1) # check number of particles result = instance.get_number_of_particles() - self.assertEqual(result['number_of_particles'], 2) + self.assertEquals(result['number_of_particles'], 2) # check that indexes are correct first = instance.get_index_of_first_particle() - self.assertEqual(first['index_of_the_particle'], 0) + self.assertEquals(first['index_of_the_particle'], 0) next = instance.get_index_of_next_particle( first['index_of_the_particle'] ) - self.assertEqual(next['index_of_the_next_particle'], 1) + self.assertEquals(next['index_of_the_next_particle'], 1) # delete particle instance.delete_particle(1) result = instance.get_number_of_particles() - self.assertEqual(result['number_of_particles'], 1) + self.assertEquals(result['number_of_particles'], 1) first = instance.get_index_of_first_particle() - self.assertEqual(first['index_of_the_particle'], 0) + self.assertEquals(first['index_of_the_particle'], 0) instance.stop() @@ -209,70 +209,32 @@ def test4(self): instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None - self.assertEqual(0, instance.initialize_code()) - self.assertEqual(0, instance.commit_parameters()) + self.assertEquals(0, instance.initialize_code()) + self.assertEquals(0, instance.commit_parameters()) - self.assertEqual([0, 0], list(instance.new_particle(0.5, 0.5, 0, 0, 0, 0.5, 0).values())) - self.assertEqual([1, 0], list(instance.new_particle(0.5, -0.5, 0, 0, 0, -0.5, 0).values())) - self.assertEqual(0, instance.commit_particles()) + self.assertEquals([0, 0], list(instance.new_particle(0.5, 0.5, 0, 0, 0, 0.5, 0).values())) + self.assertEquals([1, 0], list(instance.new_particle(0.5, -0.5, 0, 0, 0, -0.5, 0).values())) + self.assertEquals(0, instance.commit_particles()) - self.assertEqual(0, instance.evolve_model(np.pi)) # half an orbit + self.assertEquals(0, instance.evolve_model(np.pi)) # half an orbit for result, expected in zip(instance.get_position(0).values(), [-0.5, 0.0, 0.0, 0]): - self.assertAlmostEqual(result, expected, 5) + self.assertAlmostEquals(result, expected, 5) - self.assertEqual(0, instance.evolve_model(2 * np.pi)) # full orbit + self.assertEquals(0, instance.evolve_model(2 * np.pi)) # full orbit for result, expected in zip(instance.get_position(0).values(), [0.5, 0.0, 0.0, 0]): - self.assertAlmostEqual(result, expected, 5) + self.assertAlmostEquals(result, expected, 5) - self.assertEqual(0, instance.cleanup_code()) + self.assertEquals(0, instance.cleanup_code()) instance.stop() class TestTidymess(TestWithMPI): - def earth_moon_system(self): - """ - Generate a Earth - moon system. - - Returns - ------- - planet, moon : amuse.datamodel.particles.Particles - Particle objects of the system. - """ - system = Particles() - - planet, moon = generate_binaries( - 1 | u.MEarth, - 7.342e22 | u.kg, - 384399e3 | u.m, - G=c.G - ) - - planet.radius = 6371. | u.km - planet.xi = 0.3308 - planet.kf = 0.933 - planet.tau = 180 | u.s - planet.wx = 0.0 | 1/u.yr - planet.wy = 2.3e3 | 1/u.yr - planet.wz = -4.7e6 | 1/u.yr - moon.radius = 1737.4 | u.km - moon.xi = 0.394 - moon.kf = 0 - moon.kf = 0 - moon.wx = 0.0 | 1/u.yr - moon.wy = 8.4e1 | 1/u.yr - moon.wz = 3.8e8 | 1/u.yr - - system.add_particles(planet) - system.add_particles(moon) - system.move_to_center() - - return system - - def HD80606b_system(self): + def generate_HD80606b_system(self): """ Initial conditions for the exoplanet system - HD80606b. Initial conditions from Tidymess. + HD80606b. Initial conditions courtesy of + Dr. Tjarda Boekholt. """ HD80606 = Particles(2) star, planet = generate_binaries( @@ -315,7 +277,7 @@ def HD80606b_system(self): return HD80606 - def figure8_system(self): + def generate_figure8_system(self): """ Generate initial conditions for a triple system in a figure 8 configuration. @@ -386,9 +348,9 @@ def test1(self): match the defaults set in the Tidymess standalone package. """ print('Test parameters and their default values') - system = self.earth_moon_system() + system = self.generate_HD80606b_system() converter = nbody_system.nbody_to_si( - 1 | u.MEarth, 1 | u.AU + system.mass.sum(), system[1].position.length() ) instance = self.new_instance_of_an_optional_code( Tidymess, converter @@ -470,8 +432,10 @@ def test2(self): Test Tidymess add_particles method. """ print('Test adding and deleting particles') - system = self.earth_moon_system() - converter = nbody_system.nbody_to_si(system.mass.sum(), system[0].position.length()) + system = self.generate_HD80606b_system() + converter = nbody_system.nbody_to_si( + system.mass.sum(), system[1].position.length() + ) instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None @@ -482,12 +446,18 @@ def test2(self): self.assertEquals(instance.get_number_of_particles(), 2) self.assertEquals(instance.model_time, 0 | u.s) - self.assertAlmostEquals(instance.get_total_mass(), system[0].mass + system[1].mass) - self.assertAlmostEquals(instance.get_total_radius(), 379730731.968 | u.m, 3) + self.assertAlmostRelativeEquals( + instance.get_total_mass(), + system[0].mass + system[1].mass, + places=6 + ) + self.assertAlmostRelativeEquals( + instance.get_total_radius(), system[1].position.length() + ) instance.delete_particle(1) self.assertEquals(instance.get_number_of_particles(), 1) - self.assertAlmostEquals(instance.get_total_mass(), system[0].mass) + self.assertAlmostRelativeEquals(instance.get_total_mass(), system[0].mass) instance.stop() @@ -506,7 +476,7 @@ def test3(self): spin = instance.convert_spin_vectors_to_inertial(lod, obl, psi) - self.assertAlmostEquals(spin[0], 0 | 1/u.s) + self.assertEquals(spin[0], 0 | 1/u.s) self.assertAlmostEquals(spin[1], -1.26280518349e-5 | 1/u.s) self.assertAlmostEquals(spin[2], 7.16172407885e-5 | 1/u.s) @@ -521,9 +491,9 @@ def test4(self): begin_time = (50 | u.yr).as_quantity_in(u.s) end_time = begin_time + dt - system = self.HD80606b_system() + system = self.generate_HD80606b_system() converter = nbody_system.nbody_to_si( - 1 | u.MEarth, 1 | u.au + system.mass.sum(), system[1].position.length() ) instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None @@ -563,7 +533,7 @@ def test5(self): # System 1 # -------- - system1 = self.figure8_system() + system1 = self.generate_figure8_system() instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None @@ -584,7 +554,7 @@ def test5(self): # System 2 # -------- - system2 = self.figure8_system() + system2 = self.generate_figure8_system() instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None @@ -634,7 +604,7 @@ def test6(self): back to physical units for comparison with the AMUSE results. """ print('Test evolve model with physical units') - system = self.HD80606b_system() + system = self.generate_HD80606b_system() converter = nbody_system.nbody_to_si( system.mass.sum(), system.position[1].length() ) @@ -660,13 +630,13 @@ def test6(self): ] for particle, (ex, ey, ez) in zip(instance.particles, expected_position): - self.assertAlmostRelativeEqual( + self.assertAlmostRelativeEquals( particle.x, converter.to_si(ex | nbody_system.length), places=4 ) - self.assertAlmostRelativeEqual( + self.assertAlmostRelativeEquals( particle.y, converter.to_si(ey | nbody_system.length), places=4 ) - self.assertAlmostRelativeEqual( + self.assertAlmostRelativeEquals( particle.z, converter.to_si(ez | nbody_system.length), places=4 ) @@ -676,13 +646,13 @@ def test6(self): ] for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): - self.assertAlmostRelativeEqual( + self.assertAlmostRelativeEquals( particle.vx, converter.to_si(evx | nbody_system.speed), places=4 ) - self.assertAlmostRelativeEqual( + self.assertAlmostRelativeEquals( particle.vy, converter.to_si(evy | nbody_system.speed), places=4 ) - self.assertAlmostRelativeEqual( + self.assertAlmostRelativeEquals( particle.vz, converter.to_si(evz | nbody_system.speed), places=4 ) @@ -692,13 +662,13 @@ def test6(self): ] for particle, (ewx, ewy, ewz) in zip(instance.particles, expected_spin): - self.assertAlmostEqual( + self.assertAlmostRelativeEquals( particle.wx, converter.to_si(ewx | 1/nbody_system.time), places=7 ) - self.assertAlmostEqual( + self.assertAlmostRelativeEquals( particle.wy, converter.to_si(ewy | 1/nbody_system.time), places=7 ) - self.assertAlmostEqual( + self.assertAlmostRelativeEquals( particle.wz, converter.to_si(ewz | 1/nbody_system.time), places=7 ) @@ -714,7 +684,7 @@ def test7(self): """ print('Test figure 8 system in N-Body units with tidal model 4') end_time = 2e3 | nbody_system.time - system = self.figure8_system() + system = self.generate_figure8_system() instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None @@ -740,9 +710,9 @@ def test7(self): ] for particle, (ex, ey, ez) in zip(instance.particles, expected_position): - self.assertAlmostEquals(particle.x.number, ex) - self.assertAlmostEquals(particle.y.number, ey) - self.assertAlmostEquals(particle.z.number, ez) + self.assertAlmostRelativeEquals(particle.x.number, ex, places=6) + self.assertAlmostRelativeEquals(particle.y.number, ey, places=6) + self.assertAlmostRelativeEquals(particle.z.number, ez, places=6) expected_velocity = [ (-7.7344778284882154e-1, 2.9006761692492700e-1, 0.0), @@ -751,9 +721,9 @@ def test7(self): ] for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): - self.assertAlmostEquals(particle.vx.number, evx, places=6) - self.assertAlmostEquals(particle.vy.number, evy, places=6) - self.assertAlmostEquals(particle.vz.number, evz, places=6) + self.assertAlmostRelativeEquals(particle.vx.number, evx, places=6) + self.assertAlmostRelativeEquals(particle.vy.number, evy, places=6) + self.assertAlmostRelativeEquals(particle.vz.number, evz, places=6) expected_spin = [ (0.0, 0.0, -1.4197775319236833e-5), @@ -762,9 +732,9 @@ def test7(self): ] for particle, (ewx, ewy, ewz) in zip(instance.particles, expected_spin): - self.assertAlmostEquals(particle.wx.number, ewx) - self.assertAlmostEquals(particle.wy.number, ewy) - self.assertAlmostEquals(particle.wz.number, ewz) + self.assertAlmostRelativeEquals(particle.wx.number, ewx, places=5) + self.assertAlmostRelativeEquals(particle.wy.number, ewy, places=5) + self.assertAlmostRelativeEquals(particle.wz.number, ewz, places=5) # mass, radius, xi, kf, tau expected_attributes = [ @@ -789,7 +759,7 @@ def test8(self): end_time = 2e3 | u.yr dt_diag = 1 | u.yr - system = self.HD80606b_system() + system = self.generate_HD80606b_system() converter = nbody_system.nbody_to_si( system.mass.sum(), end_time ) @@ -838,7 +808,7 @@ def test8(self): VectorQuantity([-64.6401899292, 9.37009194233, 0.0], u.kms), places=4 ) - self.assertAlmostRelativeEqual(times[-1], end_time, places=3) + self.assertAlmostRelativeEquals(times[-1], end_time, places=3) instance.stop() @@ -854,7 +824,7 @@ def test9(self): # System 1 # -------- t_end = 2e3 | nbody_system.time - system1 = self.figure8_system() + system1 = self.generate_figure8_system() instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None @@ -876,7 +846,7 @@ def test9(self): # System 2 # -------- dt_diag = 1 | nbody_system.time - system2 = self.figure8_system() + system2 = self.generate_figure8_system() instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None From f8c2d025e76cf65c7e5ec264cf3a1e67fb507841 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 29 Apr 2026 12:38:18 +0200 Subject: [PATCH 152/174] def test tidal model 1 Tidymess --- src/amuse_tidymess/tests/test_tidymess.py | 98 +++++++++++++---------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 5b1c598a66..ede2a227bb 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -754,61 +754,75 @@ def test7(self): def test8(self): """ - Evolve a system without tides. + Evolve a system with tidal model 1. """ - end_time = 2e3 | u.yr - dt_diag = 1 | u.yr - - system = self.generate_HD80606b_system() - converter = nbody_system.nbody_to_si( - system.mass.sum(), end_time - ) + print('Test tidal model 1') + end_time = 2e3 | nbody_system.time + system = self.generate_figure8_system() - instance = self.new_instance_of_an_optional_code(Tidymess, converter) + instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None - instance.parameters.tidal_model = 4 + instance.parameters.tidal_model = 1 instance.parameters.dt_mode = 2 - instance.parameters.eta = 0.0625 + instance.parameters.eta = 0.015625 + instance.parameters.initial_shape = 1 instance.commit_parameters() instance.particles.add_particles(system) channel = instance.particles.new_channel_to(system) - times = [] | u.yr - times.append(0.0 | u.yr) - particles = [system.copy()] + instance.evolve_model(end_time) + channel.copy() - while instance.model_time < end_time: - time = instance.model_time + dt_diag - instance.evolve_model(time) - channel.copy() + self.assertAlmostEquals(instance.model_time, end_time) - particles.append(system.copy()) - times.append(instance.model_time) + expected_position = [ + (-7.9995265821190509e-1, -3.3831974552195199e-1, 0.0), + (1.0558216558327167, 1.2280654135281620e-1, 0.0), + (-2.5586899764154514e-1, 2.1551320418599396e-1, 0.0) + ] - # check that the last snapshot is correct - self.assertAlmostEquals( - particles[-1].position[0], - VectorQuantity([137405.552133, -84398.2017397, 0.0], u.km), - places=4 - ) - self.assertAlmostEquals( - particles[-1].position[1], - VectorQuantity([-35634334.1197, 21887570.4121, 0.0], u.km), - places=4 - ) - self.assertAlmostEquals( - particles[-1].velocity[0], - VectorQuantity([0.249251771924, -0.0361309584992, 0.0], u.kms), - places=4 - ) - self.assertAlmostEquals( - particles[-1].velocity[1], - VectorQuantity([-64.6401899292, 9.37009194233, 0.0], u.kms), - places=4 - ) - self.assertAlmostRelativeEquals(times[-1], end_time, places=3) + for particle, (ex, ey, ez) in zip(instance.particles, expected_position): + self.assertAlmostRelativeEquals(particle.x.number, ex, places=6) + self.assertAlmostRelativeEquals(particle.y.number, ey, places=6) + self.assertAlmostRelativeEquals(particle.z.number, ez, places=6) + + expected_velocity = [ + (-8.3035491348610513e-1, 2.4451495581394561e-1, 0.0), + (-1.9831541938121078e-1, 4.6603950585752918e-1, 0.0), + (1.0286703328671680, -7.1055446167146374e-1, 0.0) + ] + + for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): + self.assertAlmostRelativeEquals(particle.vx.number, evx, places=6) + self.assertAlmostRelativeEquals(particle.vy.number, evy, places=6) + self.assertAlmostRelativeEquals(particle.vz.number, evz, places=6) + + expected_spin = [ + (0.0, 0.0, -5.6414636818972019e-16), + (0.0, 0.0, 7.1678405859281773e-16), + (0.0, 0.0, -2.8946120618110779e-16) + ] + + for particle, (ewx, ewy, ewz) in zip(instance.particles, expected_spin): + self.assertAlmostRelativeEquals(particle.wx.number, ewx, places=5) + self.assertAlmostRelativeEquals(particle.wy.number, ewy, places=5) + self.assertAlmostEquals(particle.wz.number, ewz) + + # mass, radius, xi, kf, tau + expected_attributes = [ + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2) + ] + + for particle, (m, r, xi, kf, tau) in zip(instance.particles, expected_attributes): + self.assertAlmostEquals(particle.mass.number, m) + self.assertAlmostEquals(particle.radius.number, r) + self.assertAlmostEquals(particle.xi, xi) + self.assertAlmostEquals(particle.kf, kf) + self.assertAlmostEquals(particle.tau.number, tau) instance.stop() From 3c005a1968e48c5573191775c79d8455f200ac0d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Wed, 29 Apr 2026 14:09:31 +0200 Subject: [PATCH 153/174] tidymess test tidal models 0,1,2,3, and rename tests to a more descriptive name --- src/amuse_tidymess/tests/test_tidymess.py | 252 +++++++++++++++++++--- 1 file changed, 226 insertions(+), 26 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index ede2a227bb..9e1251dec4 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -17,11 +17,10 @@ class TestTidymessInterface(TestWithMPI): - def test1(self): + def test_initialization(self): """ Test Tidymess initialization. """ - print('Test initialization') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None @@ -30,11 +29,10 @@ def test1(self): self.assertEquals(0, instance.cleanup_code()) instance.stop() - def test2(self): + def test_setters_and_getters(self): """ Test TidymessInterface setters and getters. """ - print('Test setters and getters') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None @@ -158,11 +156,10 @@ def test2(self): self.assertEquals(0, instance.cleanup_code()) instance.stop() - def test3(self): + def test_adding_and_deleting_particles(self): """ Test TidymessInterface creating and deleting particles. """ - print('Test creating and deleting particles') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None @@ -201,11 +198,10 @@ def test3(self): instance.stop() - def test4(self): + def test_evolve_model(self): """ Test TidymessInterface evolve_model with an equal mass binary. """ - print('Test evolve_model') instance = self.new_instance_of_an_optional_code(TidymessInterface) assert instance is not None @@ -337,7 +333,7 @@ def generate_figure8_system(self): return figure8 - def test1(self): + def test_parameters_and_defaults(self): """ Test Tidymess parameters attribute and their defaults. @@ -347,7 +343,6 @@ def test1(self): source code. The defaults in the interface.py were chosen to match the defaults set in the Tidymess standalone package. """ - print('Test parameters and their default values') system = self.generate_HD80606b_system() converter = nbody_system.nbody_to_si( system.mass.sum(), system[1].position.length() @@ -427,11 +422,10 @@ def test1(self): instance.stop() - def test2(self): + def test_adding_and_deleting_particles(self): """ Test Tidymess add_particles method. """ - print('Test adding and deleting particles') system = self.generate_HD80606b_system() converter = nbody_system.nbody_to_si( system.mass.sum(), system[1].position.length() @@ -461,11 +455,10 @@ def test2(self): instance.stop() - def test3(self): + def test_converting_spin_vectors(self): """ Test the function for converting spin vectors. """ - print('Test converting spin vectors') converter = nbody_system.nbody_to_si(1 | u.MEarth, 1 | u.REarth) instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None @@ -482,11 +475,10 @@ def test3(self): instance.stop() - def test4(self): + def test_begin_time(self): """ Test that setting begin_time correctly creates a time offset. """ - print('Test setting begin_time') dt = 5 | u.yr begin_time = (50 | u.yr).as_quantity_in(u.s) end_time = begin_time + dt @@ -516,7 +508,7 @@ def test4(self): instance.stop() - def test5(self): + def test_evolving_backwards_in_time(self): """ Test evolving backwards in time. @@ -526,7 +518,6 @@ def test5(self): System 2 should be identical to system 1 at the end of the backwards evolution. """ - print('Test evolving backwards in time') t1 = 1e3 | nbody_system.time t2 = 2e3 | nbody_system.time self.assertFalse(t1 > t2) @@ -591,7 +582,7 @@ def test5(self): getattr(system2, attr) ) - def test6(self): + def test_physical_units(self): """ Evolve a system with tidal effects in physical units. @@ -603,7 +594,6 @@ def test6(self): in Tidymess. The resulting outputs were then converted back to physical units for comparison with the AMUSE results. """ - print('Test evolve model with physical units') system = self.generate_HD80606b_system() converter = nbody_system.nbody_to_si( system.mass.sum(), system.position[1].length() @@ -674,7 +664,7 @@ def test6(self): instance.stop() - def test7(self): + def test_nbody_units(self): """ Evolve a figure 8 system in N-Body units with tides. @@ -682,7 +672,6 @@ def test7(self): an identical simulation was ran in the Tidymess standalone package. """ - print('Test figure 8 system in N-Body units with tidal model 4') end_time = 2e3 | nbody_system.time system = self.generate_figure8_system() @@ -752,11 +741,10 @@ def test7(self): instance.stop() - def test8(self): + def test_tidal_model_1(self): """ Evolve a system with tidal model 1. """ - print('Test tidal model 1') end_time = 2e3 | nbody_system.time system = self.generate_figure8_system() @@ -826,7 +814,220 @@ def test8(self): instance.stop() - def test9(self): + def test_tidal_model_2(self): + """ + Evolve a system with tidal model 2. + """ + end_time = 2e3 | nbody_system.time + system = self.generate_figure8_system() + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + instance.parameters.tidal_model = 2 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.015625 + instance.parameters.initial_shape = 1 + instance.commit_parameters() + + instance.particles.add_particles(system) + channel = instance.particles.new_channel_to(system) + + instance.evolve_model(end_time) + channel.copy() + + self.assertAlmostEquals(instance.model_time, end_time) + + expected_position = [ + (-8.3176224044049363e-1, -3.2766008362493232e-1, 0.0), + (1.0472496444319142, 1.4126335057475434e-1, 0.0), + (-2.1548740392829080e-1, 1.8639673306541499e-1, 0.0) + ] + + for particle, (ex, ey, ez) in zip(instance.particles, expected_position): + self.assertAlmostRelativeEquals(particle.x.number, ex, places=6) + self.assertAlmostRelativeEquals(particle.y.number, ey, places=6) + self.assertAlmostRelativeEquals(particle.z.number, ez, places=6) + + expected_velocity = [ + (-7.7311529372059096e-1, 2.9031053101895304e-1, 0.0), + (-2.3256699425097455e-1, 4.6473080258147820e-1, 0.0), + (1.0056822879716858, -7.5504133360041215e-1, 0.0) + ] + + for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): + self.assertAlmostRelativeEquals(particle.vx.number, evx, places=6) + self.assertAlmostRelativeEquals(particle.vy.number, evy, places=6) + self.assertAlmostRelativeEquals(particle.vz.number, evz, places=6) + + expected_spin = [ + (0.0, 0.0, -1.4343682408248869e-5), + (0.0, 0.0, 2.2588894429400000e-7), + (0.0, 0.0, -1.4232806418627201e-5) + ] + + for particle, (ewx, ewy, ewz) in zip(instance.particles, expected_spin): + self.assertAlmostRelativeEquals(particle.wx.number, ewx, places=5) + self.assertAlmostRelativeEquals(particle.wy.number, ewy, places=5) + self.assertAlmostEquals(particle.wz.number, ewz) + + # mass, radius, xi, kf, tau + expected_attributes = [ + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2) + ] + + for particle, (m, r, xi, kf, tau) in zip(instance.particles, expected_attributes): + self.assertAlmostEquals(particle.mass.number, m) + self.assertAlmostEquals(particle.radius.number, r) + self.assertAlmostEquals(particle.xi, xi) + self.assertAlmostEquals(particle.kf, kf) + self.assertAlmostEquals(particle.tau.number, tau) + + instance.stop() + + def test_tidal_model_3(self): + """ + Evolve a system with tidal model 3. + """ + end_time = 2e3 | nbody_system.time + system = self.generate_figure8_system() + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + instance.parameters.tidal_model = 3 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.015625 + instance.parameters.initial_shape = 1 + instance.commit_parameters() + + instance.particles.add_particles(system) + channel = instance.particles.new_channel_to(system) + + instance.evolve_model(end_time) + channel.copy() + + self.assertAlmostEquals(instance.model_time, end_time) + + expected_position = [ + (-8.3158556071967982e-1, -3.2772652689780574e-1, 0.0), + (1.0473029428899883, 1.4115718838003757e-1, 0.0), + (-2.1571738128945700e-1, 1.8656933843546966e-1, 0.0) + ] + + for particle, (ex, ey, ez) in zip(instance.particles, expected_position): + self.assertAlmostRelativeEquals(particle.x.number, ex, places=6) + self.assertAlmostRelativeEquals(particle.y.number, ey, places=6) + self.assertAlmostRelativeEquals(particle.z.number, ez, places=6) + + expected_velocity = [ + (-7.7344697876688617e-1, 2.9006820552525181e-1, 0.0), + (-2.3236478600092694e-1, 4.6474038388935018e-1, 0.0), + (1.0058117647681448, -7.5480858941484674e-1, 0.0) + ] + + for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): + self.assertAlmostRelativeEquals(particle.vx.number, evx, places=6) + self.assertAlmostRelativeEquals(particle.vy.number, evy, places=6) + self.assertAlmostRelativeEquals(particle.vz.number, evz, places=6) + + expected_spin = [ + (0.0, 0.0, -1.4197809112719105e-5), + (0.0, 0.0, 2.1862269039698131e-7), + (0.0, 0.0, -1.4059672461331786e-5) + ] + + for particle, (ewx, ewy, ewz) in zip(instance.particles, expected_spin): + self.assertAlmostRelativeEquals(particle.wx.number, ewx, places=5) + self.assertAlmostRelativeEquals(particle.wy.number, ewy, places=5) + self.assertAlmostEquals(particle.wz.number, ewz) + + # mass, radius, xi, kf, tau + expected_attributes = [ + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2) + ] + + for particle, (m, r, xi, kf, tau) in zip(instance.particles, expected_attributes): + self.assertAlmostEquals(particle.mass.number, m) + self.assertAlmostEquals(particle.radius.number, r) + self.assertAlmostEquals(particle.xi, xi) + self.assertAlmostEquals(particle.kf, kf) + self.assertAlmostEquals(particle.tau.number, tau) + + instance.stop() + + def test_tidal_model_0(self): + """ + Evolve a system with tidal model 0. + """ + end_time = 2e3 | nbody_system.time + system = self.generate_figure8_system() + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + instance.parameters.tidal_model = 0 + instance.parameters.dt_mode = 2 + instance.parameters.eta = 0.015625 + instance.parameters.initial_shape = 1 + instance.commit_parameters() + + instance.particles.add_particles(system) + channel = instance.particles.new_channel_to(system) + + instance.evolve_model(end_time) + channel.copy() + + self.assertAlmostEquals(instance.model_time, end_time) + + expected_position = [ + (-7.9971116777386553e-1, -3.3839146769012957e-1, 0.0), + (1.0558794343776374, 1.2267200440402883e-1, 0.0), + (-2.5616826675029120e-1, 2.1571946325892974e-1, 0.0) + ] + + for particle, (ex, ey, ez) in zip(instance.particles, expected_position): + self.assertAlmostRelativeEquals(particle.x.number, ex, places=6) + self.assertAlmostRelativeEquals(particle.y.number, ey, places=6) + self.assertAlmostRelativeEquals(particle.z.number, ez, places=6) + + expected_velocity = [ + (-8.3077006303527656e-1, 2.4415103199669067e-1, 0.0), + (-1.9807071425059053e-1, 4.6604655407076018e-1, 0.0), + (1.0288407772857484, -7.1019758606749461e-1, 0.0) + ] + + for particle, (evx, evy, evz) in zip(instance.particles, expected_velocity): + self.assertAlmostRelativeEquals(particle.vx.number, evx, places=6) + self.assertAlmostRelativeEquals(particle.vy.number, evy, places=6) + self.assertAlmostRelativeEquals(particle.vz.number, evz, places=6) + + for particle in instance.particles: + self.assertEquals(particle.wx.number, 0.0) + self.assertEquals(particle.wy.number, 0.0) + self.assertEquals(particle.wz.number, 0.0) + + # mass, radius, xi, kf, tau + expected_attributes = [ + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2), + (1.0, 5e-2, 7e-2, 2e-2, 1e-2) + ] + + for particle, (m, r, xi, kf, tau) in zip(instance.particles, expected_attributes): + self.assertAlmostEquals(particle.mass.number, m) + self.assertAlmostEquals(particle.radius.number, r) + self.assertAlmostEquals(particle.xi, xi) + self.assertAlmostEquals(particle.kf, kf) + self.assertAlmostEquals(particle.tau.number, tau) + + instance.stop() + + def test_snapshot_dependency(self): """ Test that varying diagnostic dt has no change on the result. This verifies that evolving to t_end in one `evolve_model` @@ -834,7 +1035,6 @@ def test9(self): dt_diag controls how many times AMUSE creates a snapshot. """ - print('Test Tidymess snapshot dependency') # System 1 # -------- t_end = 2e3 | nbody_system.time From df6fa5b84387708468a4b5714559aeddd2dd8de4 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 12 May 2026 17:21:45 +0200 Subject: [PATCH 154/174] fixed bug in tidymess test_converting_spin_vectors --- src/amuse_tidymess/tests/test_tidymess.py | 26 ++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 9e1251dec4..785756477a 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -458,20 +458,36 @@ def test_adding_and_deleting_particles(self): def test_converting_spin_vectors(self): """ Test the function for converting spin vectors. + + The comparison results were computed from an identical + Tidymess standalone simulation. """ - converter = nbody_system.nbody_to_si(1 | u.MEarth, 1 | u.REarth) + system = self.generate_HD80606b_system() + converter = nbody_system.nbody_to_si( + system.mass.sum(), system[1].position.length() + ) instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None - lod = 24 | u.hour - obl = 10 | u.deg + lod = 24.47 | u.day + obl = 0 | u.deg + psi = 0 | u.deg + + spin = instance.convert_spin_vectors_to_inertial(lod, obl, psi) + + self.assertEquals(spin[0], 0 | 1/u.s) + self.assertAlmostEquals(spin[1], 0 | 1/u.s) + self.assertAlmostEquals(spin[2], 2.9718860713702659e-06 | 1/u.s) + + lod = 0.5 | u.day + obl = 0 | u.deg psi = 0 | u.deg spin = instance.convert_spin_vectors_to_inertial(lod, obl, psi) self.assertEquals(spin[0], 0 | 1/u.s) - self.assertAlmostEquals(spin[1], -1.26280518349e-5 | 1/u.s) - self.assertAlmostEquals(spin[2], 7.16172407885e-5 | 1/u.s) + self.assertAlmostEquals(spin[1], 0 | 1/u.s) + self.assertAlmostEquals(spin[2], 1.4544410433286076e-04 | 1/u.s) instance.stop() From c04b2807a0802e6f0403cb66b3f0469525159dcf Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 12 May 2026 17:22:36 +0200 Subject: [PATCH 155/174] fixed bug in converting spin vectors tidymess --- src/amuse_tidymess/interface.py | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index abbcf34284..ec87d6eb06 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1,3 +1,12 @@ +""" +TIdal DYnamics of Multi-body ExtraSolar Systems Interface +Code Author : Tjarda Boekholt & Alexandre Correia (MNRAS 2023, vol. 522, pp. 2885–2900) +Interface Author : Elko Gerville-Reache + +Date Created : Nov 25, 2025 +Last Updated : May 12, 2026 +""" + from amuse.community.interface.gd import GravitationalDynamics from amuse.community.interface.gd import GravitationalDynamicsInterface from amuse.community.interface.gd import GravityFieldInterface @@ -1316,14 +1325,14 @@ def define_methods(self, handler): nbody_system.speed, nbody_system.speed, nbody_system.speed, - nbody_system.length, # radius - handler.NO_UNIT, # xi, moment of inertia factor - handler.NO_UNIT, # kf, fluid Love number for potential - nbody_system.time, # tau, fluid relaxation time - 1 / nbody_system.time, # wx - 1 / nbody_system.time, # wy - 1 / nbody_system.time, # wz - handler.NO_UNIT, # a_mb, magnetic braking coefficient + nbody_system.length, + handler.NO_UNIT, + handler.NO_UNIT, + nbody_system.time, + 1 / nbody_system.time, + 1 / nbody_system.time, + 1 / nbody_system.time, + handler.NO_UNIT, ), (handler.INDEX, handler.ERROR_CODE) ) @@ -1442,8 +1451,8 @@ def define_methods(self, handler): 'convert_spin_vectors_to_inertial', ( nbody_system.time, - u.rad, - u.rad, + u.deg, + u.deg, ), ( 1/nbody_system.time, From 6f0278d8e5f020afa45371c988dd75edbc14969f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 12 May 2026 17:23:54 +0200 Subject: [PATCH 156/174] added missing #include to interface.cc --- src/amuse_tidymess/interface.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 2717cc4663..af350c37e5 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -1,4 +1,5 @@ #include "tidymess_worker.h" +#include #include #include #include @@ -887,7 +888,7 @@ int get_total_radius(double* radius) { if (!radius) return -1; const std::vector& bodies = tidymess->bodies; - double xcom, ycom, zcom; + double xcom = 0, ycom = 0, zcom = 0; double rsq_max = 0.0; if (get_center_of_mass_position(&xcom, &ycom, &zcom) != 0) From 1166afd6a3eb72f621cf2f38f45d8e5a3e2b1bf9 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 11:06:25 +0200 Subject: [PATCH 157/174] enabled stopping conditions in tidymess --- src/amuse_tidymess/interface.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index af350c37e5..25d1728d8e 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -60,12 +60,11 @@ int initialize_code() { collision = std::make_unique(); breakup = std::make_unique(); - //initialize_stopping_conditions(); + particle_id_counter = 0; // AMUSE STOPPING CONDITIONS SUPPORT - //set_support_for_condition(COLLISION_DETECTION); - // reset id counter? - //particle_id_counter = 0; + initialize_stopping_conditions(); + set_support_for_condition(COLLISION_DETECTION); return 0; } From b92c81cb40a5bb95616bacaa196600587f692d5b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 11:06:50 +0200 Subject: [PATCH 158/174] tidymess interface.py cleanup --- src/amuse_tidymess/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index ec87d6eb06..590cd143a1 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -4,7 +4,7 @@ Interface Author : Elko Gerville-Reache Date Created : Nov 25, 2025 -Last Updated : May 12, 2026 +Last Updated : May 13, 2026 """ from amuse.community.interface.gd import GravitationalDynamics From 4ead6495d0c9060f77a815ebffdd5c029a65a32b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 11:33:03 +0200 Subject: [PATCH 159/174] rm detect_collision fn tidymess --- src/amuse_tidymess/interface.py | 38 --------------------------------- 1 file changed, 38 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index 590cd143a1..e748391fe4 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1189,44 +1189,6 @@ def get_total_energy(): return function - # @legacy_function - # def detect_collision(): - # ''' - # ''' - # function = LegacyFunctionSpecification() - # function.addParameter( - # 'collision_flag', - # dtype='int32', - # direction=function.OUT, - # description='' - # ) - # function.addParameter( - # 'n_collisions', - # dtype='int32', - # direction=function.OUT, - # description='' - # ) - # function.addParameter( - # 'index1', - # dtype='int32', - # direction=function.OUT, - # description='' - # ) - # function.addParameter( - # 'index2', - # dtype='int32', - # direction=function.OUT, - # description='' - # ) - # #function.addParameter( - # # 'indices_of_colliding_particles', dtype='int32', direction=function.OUT, - # # description="") - # function.result_type = 'int32' - # function.result_doc = '''''' - - # return function - - @legacy_function def convert_spin_vectors_to_inertial(): """ From 388b6c86f12ad06a056d364731b7a39e9204b6d3 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 11:42:46 +0200 Subject: [PATCH 160/174] implemented collision detection in tidymess.evolve_model and rm detect_collision in interface.cc --- src/amuse_tidymess/interface.cc | 39 ++++++++++++++------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 25d1728d8e..a0a3a1468c 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -1,4 +1,5 @@ #include "tidymess_worker.h" +#include #include #include #include @@ -200,9 +201,25 @@ int determine_dt_sgn(double t_end) { * Evolve the model to a specified time */ int evolve_model(double time) { + reset_stopping_conditions(); + + int is_collision_detection_enabled; + is_stopping_condition_enabled( + COLLISION_DETECTION, + &is_collision_detection_enabled + ); + determine_dt_sgn(time); tidymess->evolve_model(time); + if (is_collision_detection_enabled && tidymess->get_collision_flag()) { + for (const auto& [i, j] : tidymess->get_collision_indices()) { + int stopping_index = next_index_for_stopping_condition(); + set_stopping_condition_info(stopping_index, COLLISION_DETECTION); + set_stopping_condition_particle_index(stopping_index, 0, i); + set_stopping_condition_particle_index(stopping_index, 1, j); + } + } return 0; } @@ -995,28 +1012,6 @@ int convert_spin_vectors_to_inertial( return 0; } -// FIXME -int detect_collision( - int* collision_flag, - int* n_collisions, - int* index1, - int* index2 -) { - *collision_flag = tidymess->get_collision_flag(); - std::vector< array > collided_indices = tidymess->get_collision_indices(); - *n_collisions = collided_indices.size(); - *index1 = 0; - *index2 = 0; - - if (collided_indices.size() > 0) { - array collided_index = collided_indices[0]; - *index1 = collided_index[0]; - *index2 = collided_index[1]; - } - - return 0; -} - /** * Needed to compile the interface; * not implemented yet From 68de88aa3f95e6993e312b7ba4a38fa0e8628a3d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 11:59:15 +0200 Subject: [PATCH 161/174] def test_collision_detection tidymess --- src/amuse_tidymess/tests/test_tidymess.py | 81 +++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 785756477a..245e786c5a 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1107,3 +1107,84 @@ def test_snapshot_dependency(self): self.assertAlmostEquals(system1.wz, system2.wz) self.assertAlmostEquals(system1.mass, system2.mass) self.assertAlmostEquals(system1.radius, system2.radius) + + def test_stopping_conditions(self): + """Test that collision detection works in Tidymess.""" + p = Particles(2) + p[0].name = 'Star 1' + p[0].mass = 10 | nbody_system.mass + p[0].radius = 1 | nbody_system.length + p[0].x = -5 | nbody_system.length + p[0].y = 0 | nbody_system.length + p[0].z = 0 | nbody_system.length + p[0].vx = 0 | nbody_system.speed + p[0].vy = 0 | nbody_system.speed + p[0].vz = 0 | nbody_system.speed + p[0].xi = 0.0 + p[0].kf = 0.0 + p[0].tau = 0.0 | nbody_system.time + p[0].wx = 0.0 | (1 / nbody_system.time) + p[0].wy = 0.0 | (1 / nbody_system.time) + p[0].wz = 0.0 | (1 / nbody_system.time) + + p[1].name = 'Star 2' + p[1].mass = 10 | nbody_system.mass + p[1].radius = 1 | nbody_system.length + p[1].x = 5 | nbody_system.length + p[1].y = 0 | nbody_system.length + p[1].z = 0 | nbody_system.length + p[1].vx = 0 | nbody_system.speed + p[1].vy = 0 | nbody_system.speed + p[1].vz = 0 | nbody_system.speed + p[1].xi = 0.0 + p[1].kf = 0.0 + p[1].tau = 0.0 | nbody_system.time + p[1].wx = 0.0 | (1 / nbody_system.time) + p[1].wy = 0.0 | (1 / nbody_system.time) + p[1].wz = 0.0 | (1 / nbody_system.time) + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + cd = instance.stopping_conditions.collision_detection + cd.enable() + assert cd.is_supported() and cd.is_enabled() + + instance.parameters.collision_mode = 1 + instance.parameters.tidal_model = 0 + instance.parameters.dt_mode = 0 + instance.commit_parameters() + + instance.particles.add_particles(p) + channel = instance.particles.new_channel_to(p) + + collision_hit = False + + dt_diag = 0.01 | nbody_system.time + while instance.model_time < 10 | nbody_system.time: + time = instance.model_time + dt_diag + instance.evolve_model(time) + channel.copy() + + if cd.is_set(): + collision_hit = True + break + + assert collision_hit + p0 = cd.particles(0) + p1 = cd.particles(1) + + assert len(p0) > 0 + assert len(p1) > 0 + assert len(p0) == len(p1) + + # check collision is defined correctly + dr = p0.position - p1.position + dist2 = (dr * dr).sum() + rsum = p0.radius + p1.radius + assert dist2 <= rsum**2 + + cd.disable() + assert not cd.is_enabled() + + instance.stop() From ae86011e828bd685df2633c8c06efe9f2132a4b4 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 12:08:42 +0200 Subject: [PATCH 162/174] added a third, non-colliding star to test_collision_detection tidymess --- src/amuse_tidymess/tests/test_tidymess.py | 29 +++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 245e786c5a..f4ffbf91f1 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1109,8 +1109,13 @@ def test_snapshot_dependency(self): self.assertAlmostEquals(system1.radius, system2.radius) def test_stopping_conditions(self): - """Test that collision detection works in Tidymess.""" - p = Particles(2) + """ + Test that collision detection works in Tidymess. + + A triple star system is initialized, with the expectation + that stars 1 and 2 will collide. + """ + p = Particles(3) p[0].name = 'Star 1' p[0].mass = 10 | nbody_system.mass p[0].radius = 1 | nbody_system.length @@ -1143,6 +1148,22 @@ def test_stopping_conditions(self): p[1].wy = 0.0 | (1 / nbody_system.time) p[1].wz = 0.0 | (1 / nbody_system.time) + p[2].name = 'Star 3' + p[2].mass = 10 | nbody_system.mass + p[2].radius = 1 | nbody_system.length + p[2].x = -500 | nbody_system.length + p[2].y = 0 | nbody_system.length + p[2].z = 0 | nbody_system.length + p[2].vx = 0 | nbody_system.speed + p[2].vy = 0 | nbody_system.speed + p[2].vz = 0 | nbody_system.speed + p[2].xi = 0.0 + p[2].kf = 0.0 + p[2].tau = 0.0 | nbody_system.time + p[2].wx = 0.0 | (1 / nbody_system.time) + p[2].wy = 0.0 | (1 / nbody_system.time) + p[2].wz = 0.0 | (1 / nbody_system.time) + instance = self.new_instance_of_an_optional_code(Tidymess) assert instance is not None @@ -1173,6 +1194,10 @@ def test_stopping_conditions(self): assert collision_hit p0 = cd.particles(0) p1 = cd.particles(1) + assert cd.particles(2).is_empty() + + assert p0[0] == p[0] + assert p1[0] == p[1] assert len(p0) > 0 assert len(p1) > 0 From 28df71609f0590b0725e5f88bae240b77f0dc50f Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 14:19:05 +0200 Subject: [PATCH 163/174] test collisions in tidymess --- src/amuse_tidymess/tests/test_tidymess.py | 131 ++++++++++++++++++++-- 1 file changed, 119 insertions(+), 12 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index f4ffbf91f1..12103e598a 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1192,22 +1192,129 @@ def test_stopping_conditions(self): break assert collision_hit - p0 = cd.particles(0) - p1 = cd.particles(1) - assert cd.particles(2).is_empty() + col1 = cd.particles(0) + col2 = cd.particles(1) - assert p0[0] == p[0] - assert p1[0] == p[1] + assert col1[0] == p[0] + assert col2[0] == p[1] - assert len(p0) > 0 - assert len(p1) > 0 - assert len(p0) == len(p1) + assert len(col1) == 1 + assert len(col1) == len(col2) # check collision is defined correctly - dr = p0.position - p1.position - dist2 = (dr * dr).sum() - rsum = p0.radius + p1.radius - assert dist2 <= rsum**2 + for pi, pj in zip(col1, col2): + dr = pi.position - pj.position + dist2 = (dr * dr).sum() + rsum = pi.radius + pj.radius + assert dist2 <= rsum**2 + + cd.disable() + assert not cd.is_enabled() + + instance.stop() + + def test_triple_collision_stopping_conditions(self): + """ + Initialize a triple star system on an equilateral triangle + with vertices defined as: + (0, 0, 0), (a, 0, 0), (a/2, a*sqrt(3)/2, 0) + """ + a = 10 | nbody_system.length + + p = Particles(3) + p[0].name = 'Star 1' + p[0].mass = 10 | nbody_system.mass + p[0].radius = 1 | nbody_system.length + p[0].x = 0 | nbody_system.length + p[0].y = 0 | nbody_system.length + p[0].z = 0 | nbody_system.length + p[0].vx = 0 | nbody_system.speed + p[0].vy = 0 | nbody_system.speed + p[0].vz = 0 | nbody_system.speed + p[0].xi = 0.0 + p[0].kf = 0.0 + p[0].tau = 0.0 | nbody_system.time + p[0].wx = 0.0 | (1 / nbody_system.time) + p[0].wy = 0.0 | (1 / nbody_system.time) + p[0].wz = 0.0 | (1 / nbody_system.time) + p[1].name = 'Star 2' + p[1].mass = 10 | nbody_system.mass + p[1].radius = 1 | nbody_system.length + p[1].x = a + p[1].y = 0 | nbody_system.length + p[1].z = 0 | nbody_system.length + p[1].vx = 0 | nbody_system.speed + p[1].vy = 0 | nbody_system.speed + p[1].vz = 0 | nbody_system.speed + p[1].xi = 0.0 + p[1].kf = 0.0 + p[1].tau = 0.0 | nbody_system.time + p[1].wx = 0.0 | (1 / nbody_system.time) + p[1].wy = 0.0 | (1 / nbody_system.time) + p[1].wz = 0.0 | (1 / nbody_system.time) + p[2].name = 'Star 3' + p[2].mass = 10 | nbody_system.mass + p[2].radius = 1 | nbody_system.length + p[2].x = (a / 2) + p[2].y = (a * (3**0.5) / 2) + p[2].z = 0 | nbody_system.length + p[2].vx = 0 | nbody_system.speed + p[2].vy = 0 | nbody_system.speed + p[2].vz = 0 | nbody_system.speed + p[2].xi = 0.0 + p[2].kf = 0.0 + p[2].tau = 0.0 | nbody_system.time + p[2].wx = 0.0 | (1 / nbody_system.time) + p[2].wy = 0.0 | (1 / nbody_system.time) + p[2].wz = 0.0 | (1 / nbody_system.time) + + instance = self.new_instance_of_an_optional_code(Tidymess) + assert instance is not None + + cd = instance.stopping_conditions.collision_detection + cd.enable() + assert cd.is_supported() and cd.is_enabled() + + instance.parameters.collision_mode = 1 + instance.parameters.tidal_model = 0 + instance.parameters.dt_mode = 0 + instance.commit_parameters() + + instance.particles.add_particles(p) + channel = instance.particles.new_channel_to(p) + + collision_hit = False + + dt_diag = 0.01 | nbody_system.time + while instance.model_time < 10 | nbody_system.time: + time = instance.model_time + dt_diag + instance.evolve_model(time) + channel.copy() + + if cd.is_set(): + collision_hit = True + break + + assert collision_hit + col1 = cd.particles(0) + col2 = cd.particles(1) + + assert col1[0] == p[0] + assert col1[1] == p[0] + assert col1[2] == p[1] + assert col2[0] == p[1] + assert col2[1] == p[2] + assert col2[2] == p[2] + + assert len(col1) == 3 + assert len(col2) == len(col1) + + # check collision is defined correctly + for pi, pj in zip(col1, col2): + dr = pi.position - pj.position + dist2 = (dr * dr).sum() + rsum = pi.radius + pj.radius + assert dist2 <= rsum**2 cd.disable() assert not cd.is_enabled() From 48438f5fd62d557966d104b1e079d9383b099f67 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 17:21:06 +0200 Subject: [PATCH 164/174] better deletion tests TidymessInterface --- src/amuse_tidymess/tests/test_tidymess.py | 57 ++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 12103e598a..c9e308d9b6 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -166,10 +166,14 @@ def test_adding_and_deleting_particles(self): self.assertEquals(0, instance.initialize_code()) self.assertEquals(0, instance.commit_parameters()) + # FIRST PARTICLE + # -------------- # initialize new particle with all attributes set to 1 result = instance.new_particle(*np.ones(15)*1) self.assertEquals(result['index_of_the_particle'], 0) + # SECOND PARTICLE + # --------------- # initialize new particle with all attributes set to 1.1 result = instance.new_particle(*np.ones(15)*1.1) self.assertEquals(result['index_of_the_particle'], 1) @@ -187,7 +191,8 @@ def test_adding_and_deleting_particles(self): ) self.assertEquals(next['index_of_the_next_particle'], 1) - # delete particle + # DELETE SECOND PARTICLE + # ---------------------- instance.delete_particle(1) result = instance.get_number_of_particles() @@ -196,6 +201,56 @@ def test_adding_and_deleting_particles(self): first = instance.get_index_of_first_particle() self.assertEquals(first['index_of_the_particle'], 0) + # THIRD PARTICLE + # -------------- + result = instance.new_particle(*np.ones(15)*2) + self.assertEquals(result['index_of_the_particle'], 2) + + result = instance.get_number_of_particles() + self.assertEquals(result['number_of_particles'], 2) + + first = instance.get_index_of_first_particle() + self.assertEquals(first['index_of_the_particle'], 0) + + next = instance.get_index_of_next_particle( + first['index_of_the_particle'] + ) + self.assertEquals(next['index_of_the_next_particle'], 2) + + result = instance.get_state(0) + self.assertEquals(result['mass'], 1.0) + self.assertEquals(result['x'], 1.0) + self.assertEquals(result['y'], 1.0) + self.assertEquals(result['z'], 1.0) + self.assertEquals(result['vx'], 1.0) + self.assertEquals(result['vy'], 1.0) + self.assertEquals(result['vz'], 1.0) + self.assertEquals(result['radius'], 1.0) + self.assertEquals(result['xi'], 1.0) + self.assertEquals(result['kf'], 1.0) + self.assertEquals(result['tau'], 1.0) + self.assertEquals(result['wx'], 1.0) + self.assertEquals(result['wy'], 1.0) + self.assertEquals(result['wz'], 1.0) + self.assertEquals(result['a_mb'], 1.0) + + result = instance.get_state(2) + self.assertEquals(result['mass'], 2.0) + self.assertEquals(result['x'], 2.0) + self.assertEquals(result['y'], 2.0) + self.assertEquals(result['z'], 2.0) + self.assertEquals(result['vx'], 2.0) + self.assertEquals(result['vy'], 2.0) + self.assertEquals(result['vz'], 2.0) + self.assertEquals(result['radius'], 2.0) + self.assertEquals(result['xi'], 2.0) + self.assertEquals(result['kf'], 2.0) + self.assertEquals(result['tau'], 2.0) + self.assertEquals(result['wx'], 2.0) + self.assertEquals(result['wy'], 2.0) + self.assertEquals(result['wz'], 2.0) + self.assertEquals(result['a_mb'], 2.0) + instance.stop() def test_evolve_model(self): From 534d4fdcb2a00b5ad4cde1e411a5770ec6fb91ef Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 17:31:47 +0200 Subject: [PATCH 165/174] tidymess interface.cc cleanup --- src/amuse_tidymess/interface.cc | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index a0a3a1468c..e8702a6487 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -1,26 +1,21 @@ -#include "tidymess_worker.h" -#include -#include #include #include #include #include #include +#include +#include +#include -// AMUSE STOPPING CONDITIONS SUPPORT -#include -#include - -#include "Timer.h" -#include "Banner.h" - +#include "tidymess_worker.h" +#include "Tidy.h" +#include "Breakup.h" +#include "Collision.h" #include "Initializer.h" -#include "Output.h" -#include "Tidy.h" +// AMUSE STOPPING CONDITIONS SUPPORT +#include -#include "Collision.h" -#include "Breakup.h" std::unique_ptr tidymess; std::unique_ptr init; @@ -28,10 +23,10 @@ std::unique_ptr collision; std::unique_ptr breakup; int particle_id_counter = 0; +// std::unordered_map bodies_map; double begin_time = 0; int init_shape = 0; int dt_sign = 1; -bool print_info = false; /** @@ -52,8 +47,8 @@ int get_body_index_by_id(int index_of_the_particle) { /** * Run the initialization for the code, called before - / parameters and particles are set or before any other - / call on the code + * parameters and particles are set or before any other + * call on the code */ int initialize_code() { tidymess = std::make_unique(); From 497d308eab86d7375ec6bdff4137625d0a822f4b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 17:33:10 +0200 Subject: [PATCH 166/174] refactored test_adding_and_deleting_particles in TestTidymess --- src/amuse_tidymess/tests/test_tidymess.py | 28 +++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index c9e308d9b6..458d80aa96 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -478,36 +478,44 @@ def test_parameters_and_defaults(self): instance.stop() def test_adding_and_deleting_particles(self): - """ - Test Tidymess add_particles method. - """ - system = self.generate_HD80606b_system() + """Test adding and deleting particles in Tidymess.""" + system1 = self.generate_HD80606b_system() converter = nbody_system.nbody_to_si( - system.mass.sum(), system[1].position.length() + system1.mass.sum(), system1[1].position.length() ) instance = self.new_instance_of_an_optional_code(Tidymess, converter) assert instance is not None instance.parameters.tidal_model = 0 - instance.particles.add_particles(system) + instance.commit_parameters() + + instance.particles.add_particles(system1) self.assertEquals(instance.get_number_of_particles(), 2) self.assertEquals(instance.model_time, 0 | u.s) self.assertAlmostRelativeEquals( instance.get_total_mass(), - system[0].mass + system[1].mass, + system1[0].mass + system1[1].mass, places=6 ) self.assertAlmostRelativeEquals( - instance.get_total_radius(), system[1].position.length() + instance.get_total_radius(), system1[1].position.length() ) - instance.delete_particle(1) + instance.particles.remove_particle(system1[1]) self.assertEquals(instance.get_number_of_particles(), 1) - self.assertAlmostRelativeEquals(instance.get_total_mass(), system[0].mass) + self.assertAlmostRelativeEquals(instance.get_total_mass(), system1[0].mass) + + system2 = self.generate_HD80606b_system() + instance.particles.add_particles(system2) + + self.assertEquals(instance.get_number_of_particles(), 3) + self.assertEquals(instance.particles[0], system1[0]) + self.assertEquals(instance.particles[1], system2[0]) + self.assertEquals(instance.particles[2], system2[1]) instance.stop() def test_converting_spin_vectors(self): From be99f3558b79419d9be5a5f714d658bb67aafc9b Mon Sep 17 00:00:00 2001 From: elkogerville Date: Mon, 18 May 2026 18:23:29 +0200 Subject: [PATCH 167/174] test that collision detection works like standalone collisions --- src/amuse_tidymess/tests/test_tidymess.py | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 458d80aa96..219538f9c9 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1177,6 +1177,9 @@ def test_stopping_conditions(self): A triple star system is initialized, with the expectation that stars 1 and 2 will collide. + + For the expected values, an identical standalone tidymess simulation + was calculated. """ p = Particles(3) p[0].name = 'Star 1' @@ -1245,6 +1248,7 @@ def test_stopping_conditions(self): collision_hit = False dt_diag = 0.01 | nbody_system.time + col_time = [] while instance.model_time < 10 | nbody_system.time: time = instance.model_time + dt_diag instance.evolve_model(time) @@ -1252,6 +1256,7 @@ def test_stopping_conditions(self): if cd.is_set(): collision_hit = True + col_time.append(time) break assert collision_hit @@ -1271,6 +1276,27 @@ def test_stopping_conditions(self): rsum = pi.radius + pj.radius assert dist2 <= rsum**2 + # check that collision is expected from standalone tidymess + expected_pos = [ + (-9.9264497812761021e-1, 0.0, 0.0), + (9.9037034987767159e-1, 0.0, 0.0) + ] + for p, ep in zip((col1, col2), expected_pos): + self.assertAlmostRelativeEquals(p.x[0].number, ep[0], places=7) + self.assertAlmostRelativeEquals(p.y[0].number, ep[1], places=7) + self.assertAlmostRelativeEquals(p.z[0].number, ep[2], places=7) + + expected_vel = [ + (2.0103752196648657, 0.0, 0.0), + (-2.0109785401057181, 0.0, 0.0) + ] + for p, ev in zip((col1, col2), expected_vel): + self.assertAlmostRelativeEquals(p.vx[0].number, ev[0], places=7) + self.assertAlmostRelativeEquals(p.vy[0].number, ev[1], places=7) + self.assertAlmostRelativeEquals(p.vz[0].number, ev[2], places=7) + + self.assertAlmostRelativeEquals(col_time[0].number, 7.5399999999998837, places=7) + cd.disable() assert not cd.is_enabled() From aad8ee7785f8aca67818d9ec74237bb400aa0a8d Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 19 May 2026 11:04:56 +0200 Subject: [PATCH 168/174] tidymess interface.cc cleanup --- src/amuse_tidymess/interface.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index e8702a6487..516486c275 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -149,16 +149,17 @@ int new_particle( double a_mb ) { if (!index_of_the_particle) return -1; + int id = particle_id_counter++; std::vector& bodies = tidymess->bodies; Body newbody( mass, radius, xi, kf, tau, a_mb, wx, wy, wz, x, y, z, vx, vy, vz ); - newbody.set_id(particle_id_counter); + newbody.set_id(id); bodies.push_back(newbody); - *index_of_the_particle = particle_id_counter++; + *index_of_the_particle = id; return 0; } @@ -218,8 +219,8 @@ int evolve_model(double time) { return 0; } -// Setters and Getters -// ------------------- +// PARTICLE GETTERS AND SETTERS +// ---------------------------- /** * Get state of a particle @@ -553,6 +554,9 @@ int set_spin( return 0; } +// PARAMETER GETTERS AND SETTERS +// ----------------------------- + /** * Get Tidymess tidal model parameter */ @@ -590,7 +594,7 @@ int set_pn_order(int pn_order) { } /** - * Get Tidymess magnetic braking paramter + * Get Tidymess magnetic braking parameter */ int get_magnetic_braking(int* magnetic_braking) { if (!magnetic_braking) return -1; From ad5130e2a416d907f0fd77b8275f1b0bfdf84fcb Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 26 May 2026 15:06:51 +0200 Subject: [PATCH 169/174] cleaned up tidymess interface.cc --- src/amuse_tidymess/interface.cc | 65 +++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/src/amuse_tidymess/interface.cc b/src/amuse_tidymess/interface.cc index 516486c275..3769eedf56 100644 --- a/src/amuse_tidymess/interface.cc +++ b/src/amuse_tidymess/interface.cc @@ -7,13 +7,12 @@ #include #include -#include "tidymess_worker.h" #include "Tidy.h" #include "Breakup.h" #include "Collision.h" #include "Initializer.h" -// AMUSE STOPPING CONDITIONS SUPPORT +#include "tidymess_worker.h" #include @@ -23,7 +22,6 @@ std::unique_ptr collision; std::unique_ptr breakup; int particle_id_counter = 0; -// std::unordered_map bodies_map; double begin_time = 0; int init_shape = 0; int dt_sign = 1; @@ -116,19 +114,41 @@ int commit_particles() { return 0; } +/** + * Recommit parameters after commit_parameters has been called + */ int recommit_parameters() { commit_parameters(); return 0; } +/** + * Recommit particles after commit_particles has been called + */ int recommit_particles() { + if (tidymess->get_tidal_model() > 0) { + switch(init_shape) { + case 0: + tidymess->set_to_spherical_shape(); + break; + case 1: + tidymess->set_to_equilibrium_shape(); + break; + default: + return -1; + } + tidymess->update_angular_momentum(); + + } + tidymess->commit_parameters(); + tidymess->initialize(); + return 0; } /** - * Define a new particle in the stellar dynamics code. The particle is - * initialized with the provided mass, radius, position and velocity. - * This function returns an index that can be used to refer to this particle. + * Define a new particle in Tidymess. This function returns an + * index that can be used to refer to this particle. */ int new_particle( int* index_of_the_particle, @@ -735,7 +755,9 @@ int set_initial_shape(int initial_shape) { return 0; } -// FIX +/** + * Get Tidymess collision mode + */ int get_collision_mode(int* collision_mode) { if (!collision_mode) return -1; @@ -743,6 +765,9 @@ int get_collision_mode(int* collision_mode) { return 0; } +/** + * Set Tidymess collision mode + */ int set_collision_mode(int collision_mode) { tidymess->set_collision_mode(collision_mode); return 0; @@ -751,7 +776,7 @@ int set_collision_mode(int collision_mode) { int get_roche_mode(int* roche_mode) { if (!roche_mode) return -1; - *roche_mode = tidymess->roche_mode; // doesn't appear in Tidy + *roche_mode = tidymess->roche_mode; return 0; } int set_roche_mode(int roche_mode) { @@ -779,11 +804,19 @@ int get_num_integration_step(int* num_integration_step) { return 0; } +/** + * Needed to compile the interface; + * not implemented yet + */ int get_eps2(double* epsilon_squared) { if (!epsilon_squared) return -1; return 0; } +/** + * Needed to compile the interface; + * not implemented yet + */ int set_eps2(double epsilon_squared) { return 0; } @@ -797,6 +830,10 @@ int get_total_energy(double* total_energy) { return 0; } +/** + * Needed to compile the interface; + * not implemented yet + */ int get_kinetic_energy(double* kinetic_energy) { if (!kinetic_energy) return -1; return 0; @@ -1046,9 +1083,6 @@ int get_potential_at_point( double* phi, int npoints ) { - // for (int i = 0; i < npoints; i++) { - // phi[i] = 0.0; - // } return 0; } @@ -1066,14 +1100,13 @@ int get_gravity_at_point( double* az, int npoints ) { - // for (int i = 0; i < npoints; i++) { - // ax[i] = 0.0; - // ay[i] = 0.0; - // az[i] = 0.0; - // } return 0; } +/** + * Needed to compile the interface; + * not implemented yet + */ int synchronize_model() { return 0; } From bd84576eb1d575136c30bd8c62c321208cbbef97 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 26 May 2026 15:07:46 +0200 Subject: [PATCH 170/174] cleanup tidymess interface.py --- src/amuse_tidymess/interface.py | 125 ++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 54 deletions(-) diff --git a/src/amuse_tidymess/interface.py b/src/amuse_tidymess/interface.py index e748391fe4..50b6f5d9ca 100644 --- a/src/amuse_tidymess/interface.py +++ b/src/amuse_tidymess/interface.py @@ -1,18 +1,15 @@ -""" -TIdal DYnamics of Multi-body ExtraSolar Systems Interface -Code Author : Tjarda Boekholt & Alexandre Correia (MNRAS 2023, vol. 522, pp. 2885–2900) -Interface Author : Elko Gerville-Reache - -Date Created : Nov 25, 2025 -Last Updated : May 13, 2026 -""" - -from amuse.community.interface.gd import GravitationalDynamics -from amuse.community.interface.gd import GravitationalDynamicsInterface -from amuse.community.interface.gd import GravityFieldInterface -from amuse.community.interface.gd import GravityFieldCode -from amuse.community.interface.stopping_conditions import StoppingConditions, StoppingConditionInterface -from amuse.rfi.core import CodeInterface, legacy_function, LegacyFunctionSpecification +from amuse.community.interface.gd import ( + GravitationalDynamics, + GravitationalDynamicsInterface, + GravityFieldInterface, + GravityFieldCode +) +from amuse.community.interface.stopping_conditions import ( + StoppingConditions, StoppingConditionInterface +) +from amuse.rfi.core import ( + CodeInterface, legacy_function, LegacyFunctionSpecification +) from amuse.support.literature import LiteratureReferencesMixIn from amuse.units import units as u, nbody_system @@ -1019,42 +1016,47 @@ def set_n_iter(): return function @legacy_function - def set_collision_mode(): - ''' - ''' + def get_collision_mode(): + """Get collision mode Tidymess parameter.""" function = LegacyFunctionSpecification() function.addParameter( 'collision_mode', dtype='int32', - direction=function.IN, - description='0=off, 1=flag, 2=exception, 3=replace' - ) + direction=function.OUT, + description='0=off, 1=flag, 2=exception, 3=replace') function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """\ + 0 - OK + collision mode was retrieved + -1 - ERROR + Could not find collision mode + """ return function - @legacy_function - def get_collision_mode(): - ''' - ''' + def set_collision_mode(): + """Set collision mode Tidymess parameter.""" function = LegacyFunctionSpecification() function.addParameter( 'collision_mode', dtype='int32', - direction=function.OUT, - description='0=off, 1=flag, 2=exception, 3=replace') + direction=function.IN, + description='0=off, 1=flag, 2=exception, 3=replace' + ) function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """\ + 0 - OK + collision mode was set + -1 - ERROR + Could not set collision mode + """ return function - @legacy_function def set_roche_mode(): - ''' - ''' + """Set roche mode.""" function = LegacyFunctionSpecification() function.addParameter( 'roche_mode', @@ -1063,15 +1065,18 @@ def set_roche_mode(): description='0=off, 1=flag, 2=exception' ) function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """\ + 0 - OK + Roche mode was set + -1 - ERROR + Could not set roche mode + """ return function - @legacy_function def get_roche_mode(): - """ - """ + """Get roche mode.""" function = LegacyFunctionSpecification() function.addParameter( 'roche_mode', @@ -1080,11 +1085,15 @@ def get_roche_mode(): description='0=off, 1=flag, 2=exception' ) function.result_type = 'int32' - function.result_doc = '''''' + function.result_doc = """\ + 0 - OK + roche mode was retrieved + -1 - ERROR + Could not retrieve roche mode + """ return function - @legacy_function def set_breakup_mode(): """ @@ -1104,7 +1113,6 @@ def set_breakup_mode(): return function - @legacy_function def get_breakup_mode(): """ @@ -1125,36 +1133,42 @@ def get_breakup_mode(): return function @legacy_function - def set_initial_shape(): - """ - Set Tidymess initial shape. - """ + def get_initial_shape(): + """Get Tidymess initial shape value.""" function = LegacyFunctionSpecification() function.addParameter( 'initial_shape', dtype='int32', - direction=function.IN, - description='0=default' + direction=function.OUT, + description='0=sphere, 1=equilibrium' ) function.result_type = 'int32' - function.result_doc = """""" + function.result_doc = """\ + 0 - OK + Initial shape was retrieved + -1 - ERROR + Could not retrieve initial shape + """ return function @legacy_function - def get_initial_shape(): - """ - Get Tidymess initial shape value. - """ + def set_initial_shape(): + """Set Tidymess initial shape.""" function = LegacyFunctionSpecification() function.addParameter( 'initial_shape', dtype='int32', - direction=function.OUT, - description='' + direction=function.IN, + description='0=sphere, 1=equilibrium' ) function.result_type = 'int32' - function.result_doc = """""" + function.result_doc = """\ + 0 - OK + Initial shape was set + -1 - ERROR + Could not set initial shape + """ return function @@ -1259,6 +1273,7 @@ def __init__(self, convert_nbody=None, **options): **options ) + def define_state(self, handler): GravitationalDynamics.define_state(self, handler) GravityFieldCode.define_state(self, handler) @@ -1269,12 +1284,12 @@ def define_state(self, handler): self.stopping_conditions.define_state(handler) + def define_methods(self, handler): """ Map legacy functions in TidymessInterface into Tidymess user methods. """ - GravitationalDynamics.define_methods(self, handler) handler.add_method( @@ -1564,11 +1579,13 @@ def define_parameters(self, handler): self.stopping_conditions.define_parameters(handler) + def define_properties(self, handler): """Define read only properties of Tidymess""" GravitationalDynamics.define_properties(self, handler) handler.add_property('get_total_energy', public_name='total_energy') + def define_particle_sets(self, handler): GravitationalDynamics.define_particle_sets(self, handler) From 5ae0e83668ffb2d86e2486c1c26f2b573fdb951c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 26 May 2026 15:14:49 +0200 Subject: [PATCH 171/174] cleaned up tidymess tests --- src/amuse_tidymess/tests/test_tidymess.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/amuse_tidymess/tests/test_tidymess.py b/src/amuse_tidymess/tests/test_tidymess.py index 219538f9c9..6a0e410152 100644 --- a/src/amuse_tidymess/tests/test_tidymess.py +++ b/src/amuse_tidymess/tests/test_tidymess.py @@ -1,17 +1,8 @@ -""" -Date Created : December 10, 2025 -Last Updated : April 28, 2026 -Tests for Tidymess and TidymessInterface - -For questions about the tests, contact elkogerville@gmail.com -""" - from amuse.datamodel import Particles from amuse.ext.orbital_elements import generate_binaries from amuse.support.testing.amusetest import TestWithMPI -from amuse.units import constants as c, nbody_system, units as u -from amuse.units.quantities import VectorQuantity from amuse_tidymess.interface import Tidymess, TidymessInterface +from amuse.units import constants as c, nbody_system, units as u import numpy as np From 3ec5f528ac5f97f64d2e15fd4ce751dc083c436c Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 26 May 2026 15:17:04 +0200 Subject: [PATCH 172/174] rm unnecessary gitignore params --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 733ed80eac..ab9fc0910f 100644 --- a/.gitignore +++ b/.gitignore @@ -455,7 +455,3 @@ packages/dist # standard directory for a virtualenv env/ - -# macOS -.DS_Store -*tar.gz From da7cd135c336aa9d64b729280f5a3e19cb800b28 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 26 May 2026 15:19:19 +0200 Subject: [PATCH 173/174] rm tidymess gitignore --- src/amuse_tidymess/.gitignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 src/amuse_tidymess/.gitignore diff --git a/src/amuse_tidymess/.gitignore b/src/amuse_tidymess/.gitignore deleted file mode 100644 index ad55827268..0000000000 --- a/src/amuse_tidymess/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -src/tidymess -.clangd From 7e9ebf8daca956cda21cb871db8352688e0dd6b5 Mon Sep 17 00:00:00 2001 From: elkogerville Date: Tue, 26 May 2026 15:20:54 +0200 Subject: [PATCH 174/174] amuse.community.tidymess.interface cleanup --- src/amuse/community/tidymess/interface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amuse/community/tidymess/interface.py b/src/amuse/community/tidymess/interface.py index bcf23b8757..40eccb847d 100644 --- a/src/amuse/community/tidymess/interface.py +++ b/src/amuse/community/tidymess/interface.py @@ -1,4 +1,4 @@ from amuse.support.import_helper import load_code -TidymessInterface = load_code("tidymess", "TidymessInterface") -Tidymess = load_code("tidymess", "Tidymess") +TidymessInterface = load_code('tidymess', 'TidymessInterface') +Tidymess = load_code('tidymess', 'Tidymess')