Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove set_acceleration from all interfaces #994

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ functions must get or set one scalar property (1 argument) or a vector property


.. autoclass:: amuse.community.interface.gd.GravitationalDynamicsInterface
:members: get_mass, set_mass, get_position, set_position, set_acceleration, get_acceleration, get_potential
:members: get_mass, set_mass, get_position, set_position, get_acceleration, get_potential


Model evolution
Expand Down
2 changes: 0 additions & 2 deletions doc/tutorial/simplegrav/interface_1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ int get_total_radius (double *radius) { return -2; }

int get_acceleration (int index_of_the_particle, double *ax, double *ay, double *az) { return -2; }

int set_acceleration (int index_of_the_particle, double ax, double ay, double az) { return -2; }

int get_potential (int index_of_the_particle, double *potential) { return -2; }

int get_kinetic_energy (double *kinetic_energy) { return -1; }
Expand Down
1 change: 0 additions & 1 deletion src/amuse/community/adaptb/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -443,5 +443,4 @@ int get_kinetic_energy(double* ek){return -2;}
int get_potential_energy(double* ep){return -2;}
int get_center_of_mass_velocity(double* vx, double* vy, double* vz){return -2;}
int get_acceleration(int id, double* ax, double* ay, double* az){return -2;}
int set_acceleration(int id, double ax, double ay, double az){return -2;}

6 changes: 0 additions & 6 deletions src/amuse/community/bhtree/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,6 @@ int get_number_of_particles(int *number_of_particles)
return 0;
}

int set_acceleration(int index_of_the_particle, double ax, double ay, double az)
{
return -2;
}


int get_center_of_mass_position(double *x, double *y, double *z)
{
nbody_particle *np = bhtcs.get_particle_pointer();
Expand Down
25 changes: 0 additions & 25 deletions src/amuse/community/bonsai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,31 +143,6 @@ def set_velocity():
"""
return function

@legacy_function
def set_acceleration():
"""
Set the velocity vector of a particle.
"""
function = LegacyFunctionSpecification()
function.must_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('ax', dtype='float64', direction=function.IN, description = "The current x component of the velocity vector of the particle")
function.addParameter('ay', dtype='float64', direction=function.IN, description = "The current y component of the velocity vector of the particle")
function.addParameter('az', dtype='float64', direction=function.IN, description = "The current z component of the velocity vector of the particle")
function.addParameter('length', 'int32', function.LENGTH)
function.result_type = 'int32'
function.result_doc = """
0 - OK
current value was retrieved
-1 - ERROR
particle could not be found
-2 - ERROR
not yet implemented
"""
return function


@legacy_function
def get_theta_for_tree():
"""
Expand Down
18 changes: 0 additions & 18 deletions src/amuse/community/bonsai/libraryInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,24 +550,6 @@ int get_potential(int id, double * potential){
return 0;
}

int set_acceleration(int *id, double *ax, double *ay, double *az, int length){
getCurrentStateToHost();

for(int i=0; i < length; i++)
{
int index_of_the_particle = getIdxFromId(id[i]);
if(index_of_the_particle < 0) return -3;

bonsai->localTree.bodies_acc1[index_of_the_particle].x = ax[i];
bonsai->localTree.bodies_acc1[index_of_the_particle].y = ay[i];
bonsai->localTree.bodies_acc1[index_of_the_particle].z = az[i];
}

bonsai->localTree.bodies_acc1.h2d();

return 0;
}

int get_acceleration(int id, double * ax, double * ay, double * az){
getCurrentStateToHost();
int index_of_the_particle = getIdxFromId(id);
Expand Down
25 changes: 0 additions & 25 deletions src/amuse/community/bonsai2/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,6 @@ def set_velocity():
"""
return function

@legacy_function
def set_acceleration():
"""
Set the velocity vector of a particle.
"""
function = LegacyFunctionSpecification()
function.must_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('ax', dtype='float64', direction=function.IN, description = "The current x component of the velocity vector of the particle")
function.addParameter('ay', dtype='float64', direction=function.IN, description = "The current y component of the velocity vector of the particle")
function.addParameter('az', dtype='float64', direction=function.IN, description = "The current z component of the velocity vector of the particle")
function.addParameter('length', 'int32', function.LENGTH)
function.result_type = 'int32'
function.result_doc = """
0 - OK
current value was retrieved
-1 - ERROR
particle could not be found
-2 - ERROR
not yet implemented
"""
return function


@legacy_function
def get_theta_for_tree():
"""
Expand Down
18 changes: 0 additions & 18 deletions src/amuse/community/bonsai2/libraryInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,24 +592,6 @@ int get_potential(int id, double * potential){
return 0;
}

int set_acceleration(int *id, double *ax, double *ay, double *az, int length){
getCurrentStateToHost();

for(int i=0; i < length; i++)
{
int index_of_the_particle = getIdxFromId(id[i]);
if(index_of_the_particle < 0) return -3;

bonsai->localTree.bodies_acc1[index_of_the_particle].x = ax[i];
bonsai->localTree.bodies_acc1[index_of_the_particle].y = ay[i];
bonsai->localTree.bodies_acc1[index_of_the_particle].z = az[i];
}

bonsai->localTree.bodies_acc1.h2d();

return 0;
}

int get_acceleration(int id, double * ax, double * ay, double * az){
getCurrentStateToHost();
int index_of_the_particle = getIdxFromId(id);
Expand Down
2 changes: 0 additions & 2 deletions src/amuse/community/brutus/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -675,5 +675,3 @@ int get_center_of_mass_velocity(double* vx, double* vy, double* vz){
}

int get_acceleration(int id, double* ax, double* ay, double* az){return -2;}
int set_acceleration(int id, double ax, double ay, double az){return -2;}

6 changes: 1 addition & 5 deletions src/amuse/community/etics/interface.cu
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,6 @@ int recommit_particles() {
return -2;
}

int set_acceleration(int index_of_the_particle, double ax, double ay, double az) {
return -2;
}

int get_center_of_mass_position(double *x, double *y, double *z) {
// vec3 CenterMass = thrust::transform_reduce(PPPPP.begin(), PPPPP.end(), CenterMassFunctor(mass), vec3(0,0,0), thrust::plus<vec3>());
// CenterMass = CenterMass * (1.0/N); //ugly should divide by the total mass
Expand Down Expand Up @@ -375,4 +371,4 @@ int update_force_potential_arrays(double tttt) {
#warning time shouldnt be a parameter to this one
// ForceSCF(N, PTR(PotPotPot), PTR(PPPPP), PTR(F0xxxxxx));
return 0;
}
}
1 change: 0 additions & 1 deletion src/amuse/community/fi/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class FiInterface(
get_total_mass=None
get_center_of_mass_position=None
get_center_of_mass_velocity=None
set_acceleration=None
get_acceleration=None

use_modules=['StoppingConditions','AmuseInterface']
Expand Down
4 changes: 0 additions & 4 deletions src/amuse/community/gadget2/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2114,10 +2114,6 @@ int get_acceleration(int *index, double * ax, double * ay, double * az, int leng
return result;
}

int set_acceleration(int index, double ax, double ay, double az){
return -2;
}

int get_internal_energy(int *index, double *internal_energy, int length){
int errors = 0;
double *buffer = new double[length];
Expand Down
14 changes: 0 additions & 14 deletions src/amuse/community/hacs64/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,20 +592,6 @@ int get_velocity(int index_of_the_particle,

/****************/

int set_acceleration(int index_of_the_particle,
double ax, double ay, double az)
{
try
{
assert(nbody_ptr != NULL);
assert(nbody_ptr->is_sane());
return -1;
}
catch(assert_failed ex)
{
return handle_assert_failed(ex);
}
}
int get_acceleration(int index_of_the_particle,
double * ax, double * ay, double * az)
{
Expand Down
18 changes: 0 additions & 18 deletions src/amuse/community/hermite/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1287,24 +1287,6 @@ int get_acceleration(int id, double *ax, double *ay, double *az)
}
}

int set_acceleration(int id, double ax, double ay, double az)
{
unsigned int i = find(ident.begin(), ident.end(), id) - ident.begin();
if (i < ident.size())
{
acc[i][0] = ax;
acc[i][1] = ay;
acc[i][2] = az;
return 0;
}
else
{
return -2;
}

return -3;
}

int evolve_not_on_root() {

#ifndef NOMPI
Expand Down
9 changes: 0 additions & 9 deletions src/amuse/community/higpus/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -593,15 +593,6 @@ int recommit_particles(){
return 0;
}

int set_acceleration(int index_of_the_particle, double ax, double ay, double az){
index_of_the_particle = 0;
ax = 0;
ay = 0;
az = 0;
if (rank_higpus == 0) cout<<"accelerations are stored only on GPU, you can't set it"<<endl;
return 0;
}

int get_center_of_mass_position(double * x, double * y, double * z){
unsigned int ppG = (unsigned int) ceil ( (double) M / size_higpus);
double *sum = new double[4];
Expand Down
5 changes: 0 additions & 5 deletions src/amuse/community/huayno/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,6 @@ int get_potential(int id, double *pot)
return 0;
}

int set_acceleration(int id, double ax, double ay, double az)
{
return -2;
}

int get_acceleration(int id, double *ax, double *ay, double *az)
{
return -2;
Expand Down
40 changes: 0 additions & 40 deletions src/amuse/community/interface/gd.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,46 +506,6 @@ def get_acceleration():
"""
return function

@legacy_function
def set_acceleration():
"""
Update the acceleration of a particle.
*Defined for symetry with the get_acceleration function.*
*Should be removed if physaccily unsound*
*Maybe moved to snapshot support functionality*
"""
function = LegacyFunctionSpecification()
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(
'ax', dtype='float64', direction=function.IN,
description="The new acceleration vector of the particle")
function.addParameter(
'ay', dtype='float64', direction=function.IN,
description="The new acceleration vector of the particle")
function.addParameter(
'az', dtype='float64', direction=function.IN,
description="The new acceleration vector of the particle")
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
-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_potential():
"""
Expand Down
4 changes: 0 additions & 4 deletions src/amuse/community/kepler_orbiters/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ int cleanup_code()
return 0;
}

int set_acceleration(int particle_identifier, double ax, double ay, double az) {
return -2; // Not implemented
}

int get_acceleration(int particle_identifier, double *ax, double *ay, double *az) {
return -2; // Not implemented
}
Expand Down
4 changes: 0 additions & 4 deletions src/amuse/community/mi6/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,6 @@ int get_state(int particle_identifier, double *mass,
return -3; // Not found!
}

int set_acceleration(int particle_identifier, double ax, double ay, double az) {
return -2; // Not implemented
}

int get_acceleration(int particle_identifier, double *ax, double *ay, double *az) {
int index;
if (found_particle(particle_identifier, &index)){
Expand Down
8 changes: 0 additions & 8 deletions src/amuse/community/mikkola/interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,6 @@ FUNCTION get_number_of_particles(number_of_particles)
get_number_of_particles=number_of_particles_allocated
END FUNCTION

FUNCTION set_acceleration(index_of_the_particle, ax, ay, az)
IMPLICIT NONE
INTEGER :: set_acceleration
INTEGER :: index_of_the_particle
DOUBLE PRECISION :: ax, ay, az
set_acceleration=0
END FUNCTION

FUNCTION get_indices_of_colliding_particles(index_of_particle1, &
index_of_particle2)
IMPLICIT NONE
Expand Down
7 changes: 0 additions & 7 deletions src/amuse/community/nbody6xx/interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,6 @@ FUNCTION get_acceleration(index_of_the_particle, ax_amuse,
get_acceleration = 0
END FUNCTION

FUNCTION set_acceleration(index_of_the_particle, ax, ay, az)
INTEGER :: index_of_the_particle
DOUBLE PRECISION :: ax, ay, az
INTEGER :: set_acceleration
set_acceleration = -2
END FUNCTION

FUNCTION get_potential(index_of_the_particle, potential)
INCLUDE 'src/common6.h'
INTEGER :: index_of_the_particle
Expand Down
5 changes: 0 additions & 5 deletions src/amuse/community/octgrav/interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,6 @@ int set_eps2(double epsilon_squared)
return 0;
}

int set_acceleration(int index_of_the_particle, double ax, double ay, double az)
{
return -2;
}

int synchronize_model()
{
return 0;
Expand Down
Loading
Loading