Exemplo n.º 1
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def set_state():
     """
     Update the current state of a particle. The *minimal* information of a stellar
     dynamics particle (mass, radius, position and velocity) is updated.
     """
     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", default = 0)
     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
Exemplo n.º 2
0
    def has_stopping_condition():
        """
        Return 1 if the stopping condition with
        the given index is supported by the code,
        0 otherwise.
        """
        function = LegacyFunctionSpecification()
        function.can_handle_array = True
        function.addParameter(
            'type',
            dtype='int32',
            direction=function.IN,
            description="The type index  of the stopping condition")
        function.addParameter(
            'result',
            dtype='int32',
            direction=function.OUT,
            description="1 if the stopping condition is supported")

        function.result_type = 'int32'
        function.result_doc = """
        0 - OK
        -1 - ERROR
        """
        return function
Exemplo n.º 3
0
    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)
            """
            )

        function.addParameter('mass', dtype='float64', direction=function.IN, description = "The mass of the particle")
        function.addParameter('x', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
        function.addParameter('y', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
        function.addParameter('z', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
        function.addParameter('vx', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
        function.addParameter('vy', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
        function.addParameter('vz', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
        function.addParameter('radius', dtype='float64', direction=function.IN, description = "The radius of the particle", default = 0)
        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
 def get_x():
     function = LegacyFunctionSpecification()
     function.addParameter('index', dtype='int32', direction=function.IN)
     function.addParameter('x', dtype='float64', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     return function
Exemplo n.º 5
0
Arquivo: gd.py Projeto: Ingwar/amuse
    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)
            """
            )

        function.addParameter('mass', dtype='float64', direction=function.IN, description = "The mass of the particle")
        function.addParameter('x', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
        function.addParameter('y', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
        function.addParameter('z', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
        function.addParameter('vx', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
        function.addParameter('vy', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
        function.addParameter('vz', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
        function.addParameter('radius', dtype='float64', direction=function.IN, description = "The radius of the particle", default = 0)
        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
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
 def set_state():
     """
     Update the current state of a particle. The *minimal* information of a stellar
     dynamics particle (mass, radius, position and velocity) is updated.
     """
     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", default = 0)
     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
Exemplo n.º 8
0
 def get_state():
     """
     Retrieve the current state of a particle. The *minimal* information of a stellar
     dynamics particle (mass, radius, position and velocity) is returned.
     """
     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.result_type = 'int32'
     function.result_doc = """
     0 - OK
         particle was removed from the model
     -1 - ERROR
         particle could not be found
     """
     return function
Exemplo n.º 9
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def get_state():
     """
     Retrieve the current state of a particle. The *minimal* information of a stellar
     dynamics particle (mass, radius, position and velocity) is returned.
     """
     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.result_type = 'int32'
     function.result_doc = """
     0 - OK
         particle was removed from the model
     -1 - ERROR
         particle could not be found
     """
     return function
Exemplo n.º 10
0
 def copy_over_interface():
     function = LegacyFunctionSpecification()
     function.addParameter('comm_identifier', dtype='int32', direction=function.IN)
     function.addParameter('encoded_interface', dtype='string', direction=function.IN)
     function.result_type = 'int32'
     function.can_handle_array = False
     return function
Exemplo n.º 11
0
 def get_stopping_condition_particle_index():
     """
     For collision detection
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = True
     function.addParameter(
         'index',
         dtype='int32',
         direction=function.IN,
         description=
         "Index in the array[0,number_of_stopping_conditions_set>")
     function.addParameter(
         'index_of_the_column',
         dtype='int32',
         direction=function.IN,
         description=
         "Column index involved in the condition (for pair collisons 0 and 1 are possible)"
     )
     function.addParameter(
         'index_of_particle',
         dtype='int32',
         direction=function.OUT,
         description=
         "Set to the identifier of particle[index_of_the_column][index]")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
Exemplo n.º 12
0
 def deep_echo_string():
     function = LegacyFunctionSpecification()
     function.addParameter('string_in', dtype='string', direction=function.IN)
     function.addParameter('string_out', dtype='string', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     return function
Exemplo n.º 13
0
Arquivo: gd.py Projeto: Ingwar/amuse
 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
Exemplo n.º 14
0
 def get_stopping_condition_info():
     """
     Generic function for getting the information connected to
     a stopping condition. Index can be between 0 and
     the result of the :method:`get_number_of_stopping_conditions_set`
     method.
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = True
     function.addParameter(
         'index',
         dtype='int32',
         direction=function.IN,
         description=
         "Index in the array[0,number_of_stopping_conditions_set>")
     function.addParameter(
         'type',
         dtype='int32',
         direction=function.OUT,
         description=
         "Kind of the condition, can be used to retrieve specific information"
     )
     function.addParameter(
         'number_of_particles',
         dtype='int32',
         direction=function.OUT,
         description="Number of particles that met this condition")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
Exemplo n.º 15
0
 def echo_int():
     function = LegacyFunctionSpecification()
     function.addParameter('int_in', dtype='int32', direction=function.IN)
     function.addParameter('int_out', dtype='int32', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     function.id = 12
     return function
Exemplo n.º 16
0
 def new_particle():
     function = LegacyFunctionSpecification()
     function.addParameter('mass', dtype='float64', direction=function.IN, description="The new mass of the particle")
     function.addParameter('other', dtype='int32', direction=function.IN)
     function.addParameter('index_of_the_particle', dtype='int32', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     return function
Exemplo n.º 17
0
 def get_mass():
     function = LegacyFunctionSpecification()
     function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN)
     function.addParameter('mass', dtype='float64', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     function.id = 10
     return function
Exemplo n.º 18
0
 def echo_double():
     function = LegacyFunctionSpecification()
     function.addParameter('double_in', dtype='float64', direction=function.IN)
     function.addParameter('double_out', dtype='float64', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     function.id = 13
     return function
Exemplo n.º 19
0
 def multiply_ints():
     function = LegacyFunctionSpecification()
     function.addParameter('int_in1', dtype='int32', direction=function.IN)
     function.addParameter('int_in2', dtype='int32', direction=function.IN)
     function.addParameter('int_out', dtype='int32', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     return function
Exemplo n.º 20
0
 def echo_strings():
     function = LegacyFunctionSpecification()
     function.addParameter('string_inout1', dtype='string', direction=function.INOUT)
     function.addParameter('string_inout2', dtype='string', direction=function.INOUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     function.id = 15
     return function
Exemplo n.º 21
0
 def sum_doubles():
     function = LegacyFunctionSpecification()
     function.addParameter('double_in1', dtype='float64', direction=function.IN)
     function.addParameter('double_in2', dtype='float64', direction=function.IN, default=1.0)
     function.addParameter('double_out', dtype='float64', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     return function
Exemplo n.º 22
0
 def echo_quantity():
     function = LegacyFunctionSpecification()
     function.addParameter('quantity_in', dtype='float64', direction=function.IN)
     function.addParameter('quantity_out', dtype='float64', direction=function.OUT)
     function.result_type = 'int32'
     function.can_handle_array = True
     function.has_units = True
     function.id = 23
     return function
Exemplo n.º 23
0
 def get_interpolated_gravitational_potential():
     """
     Return the interpolated gravitational potential.
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = True
     for x in ['x', 'y', 'z']:
         function.addParameter(x, dtype='d', direction=function.IN)
     function.addParameter('potential', dtype='d', direction=function.OUT)
     function.result_type = 'i'
     return function
Exemplo n.º 24
0
 def get_interpolated_gravitational_potential():
     """
     Return the interpolated gravitational potential.
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True
     for x in ['x','y','z']:
         function.addParameter(x, dtype='d', direction=function.IN)
     function.addParameter('potential', dtype='d', direction=function.OUT)
     function.result_type = 'i'
     return function
Exemplo n.º 25
0
 def set_stopping_condition_out_of_box_use_center_of_mass_parameter():
     """
     If True use the center of mass to determine the location of the box, if False use (0,0,0)
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = False
     function.addParameter('value', dtype='bool', direction=function.IN, description = "True if detection should use center of mass")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - Value out of range
     """
     return function
Exemplo n.º 26
0
 def get_velcirc():
     """
     Retrieve the circular velocity due to the axisymmetric potetial at a given point
     """
     function = LegacyFunctionSpecification()
     function.addParameter('x', dtype='float64', direction=function.IN, description="x position", unit=units.kpc)
     function.addParameter('y', dtype='float64', direction=function.IN, description="y position", unit=units.kpc)
     function.addParameter('z', dtype='float64', direction=function.IN, description="z position", unit=units.kpc)
     function.addParameter('vel_circ', dtype='float64', direction=function.OUT, description="circular velocity", unit=10*units.km/units.s)
     function.addParameter('npoints', dtype='i', direction=function.LENGTH)
     function.result_type = 'int32'
     function.can_handle_array = True
     return function
Exemplo n.º 27
0
 def get_stopping_condition_timeout_parameter():
     """
     Retrieve max computer time available (in seconds).
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = False 
     function.addParameter('value', dtype='float64', direction=function.OUT, description = "Current value of avaible wallclock time in seconds")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
 def get_stopping_condition_timeout_parameter():
     """
     Retrieve max computer time available (in seconds).
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = False 
     function.addParameter('value', dtype='float64', direction=function.OUT, description = "Current value of avaible wallclock time in seconds")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
 def get_stopping_condition_out_of_box_parameter():
     """
     Get size of box
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = False
     function.addParameter('value', dtype='float64', direction=function.OUT, description = "Size of box")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - Value out of range
     """
     return function
Exemplo n.º 30
0
 def disable_stopping_condition():
     """
     Will disable the stopping if it is supported
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True 
     function.addParameter('type', dtype='int32', direction=function.IN, description = "The index of the stopping condition")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function 
Exemplo n.º 31
0
 def get_stopping_condition_number_of_steps_parameter():
     """
     Retrieve max inner loop evaluations.
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = False 
     function.addParameter('value', dtype='int32', direction=function.OUT, description = "Current number of avaible inner loop evaluations")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
Exemplo n.º 32
0
 def get_stopping_condition_out_of_box_parameter():
     """
     Get size of box
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = False
     function.addParameter('value', dtype='float64', direction=function.OUT, description = "Size of box")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - Value out of range
     """
     return function
 def set_stopping_condition_number_of_steps_parameter():
     """
     Set max inner loop evaluations.
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = False
     function.addParameter('value', dtype='int32', direction=function.IN, description = "Available inner loop evaluations")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - Value out of range
     """
     return function
 def disable_stopping_condition():
     """
     Will disable the stopping if it is supported
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True 
     function.addParameter('type', dtype='int32', direction=function.IN, description = "The index of the stopping condition")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function 
 def set_stopping_condition_out_of_box_use_center_of_mass_parameter():
     """
     If True use the center of mass to determine the location of the box, if False use (0,0,0)
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = False
     function.addParameter('value', dtype='bool', direction=function.IN, description = "True if detection should use center of mass")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - Value out of range
     """
     return function
Exemplo n.º 36
0
 def set_stopping_condition_timeout_parameter():
     """
     Set max computer time available (in seconds).
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = False 
     function.addParameter('value', dtype='float64', direction=function.IN, description = "Available wallclock time in seconds")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - Value out of range
     """
     return function
 def set_stopping_condition_timeout_parameter():
     """
     Set max computer time available (in seconds).
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = False 
     function.addParameter('value', dtype='float64', direction=function.IN, description = "Available wallclock time in seconds")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - Value out of range
     """
     return function
 def get_stopping_condition_number_of_steps_parameter():
     """
     Retrieve max inner loop evaluations.
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = False 
     function.addParameter('value', dtype='int32', direction=function.OUT, description = "Current number of avaible inner loop evaluations")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
Exemplo n.º 39
0
 def set_stopping_condition_number_of_steps_parameter():
     """
     Set max inner loop evaluations.
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = False
     function.addParameter('value', dtype='int32', direction=function.IN, description = "Available inner loop evaluations")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - Value out of range
     """
     return function
Exemplo n.º 40
0
 def get_stopping_condition_particle_index():
     """
     For collision detection
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True 
     function.addParameter('index', dtype='int32', direction=function.IN, description = "Index in the array[0,number_of_stopping_conditions_set>")
     function.addParameter('index_of_the_column', dtype='int32', direction=function.IN, description = "Column index involved in the condition (for pair collisons 0 and 1 are possible)")
     function.addParameter('index_of_particle', dtype='int32', direction=function.OUT, description = "Set to the identifier of particle[index_of_the_column][index]")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
Exemplo n.º 41
0
 def get_position_of_index():
     """
     Retrieves the x, y and z position of the center of
     the cell with coordinates i, j, k in the grid specified
     by the index_of_grid
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True
     for x in ['i','j','k']:
         function.addParameter(x, dtype='i', direction=function.IN)
     function.addParameter('index_of_grid', dtype='i', direction=function.IN, default = 1)
     for x in ['x','y','z']:
         function.addParameter(x, dtype='d', direction=function.OUT)
     function.result_type = 'i'
     return function
Exemplo n.º 42
0
 def is_stopping_condition_set():
     """
     Return 1 if the stopping condition with
     the given index is enabled,0 otherwise.    
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True 
     function.addParameter('type', dtype='int32', direction=function.IN, description = "The index of the stopping condition")
     function.addParameter('result', dtype='int32', direction=function.OUT, description = "1 if the stopping condition is enabled")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function 
Exemplo n.º 43
0
 def get_index_of_position():
     """
     Retrieves the i,j and k index of the grid cell containing the
     given x, y and z position. The cell is looked up
     in the grid specified by index_of_grid.
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True
     for x in ['x','y','z']:
         function.addParameter(x, dtype='d', direction=function.IN)
     
     function.addParameter('index_of_grid', dtype='i', direction=function.IN, default = 1)
     
     for x in ['i','j','k']:
         function.addParameter(x, dtype='d', direction=function.OUT)
     function.result_type = 'i'
     return function
Exemplo n.º 44
0
 def get_velcirc():
    """
    Retrieve the circular velocity due to the axisymmetric potetial at a given point
    """
    function = LegacyFunctionSpecification() 
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)
    function.addParameter('vel_circ', dtype='float64', direction=function.OUT
                          , description="circular velocity",unit= 10*units.km/units.s)
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    function.can_handle_array = True 
    return function
Exemplo n.º 45
0
 def get_spiral_density():
    """
    Retrieve the density of the 3D spiral arms at a given point
    """
    function = LegacyFunctionSpecification() 
    function.can_handle_array = True 
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)
    function.addParameter('dens', dtype='float64', direction=function.OUT
                          , description="epicyclic freq",unit= 2.32e7*units.MSun/units.kpc**3)
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    return function
Exemplo n.º 46
0
 def get_epifreq():
    """
    Retrieve the epicyclic frequency due to the axisymmetric potetial at a given point
    """
    function = LegacyFunctionSpecification() 
    function.can_handle_array = True 
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)
    function.addParameter('k', dtype='float64', direction=function.OUT
                          , description="epicyclic freq",unit= 10*units.kms)
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    return function
Exemplo n.º 47
0
 def set_radius():
     """
     Set the radius of a particle. Radius is a scalar property of a particle.
     """
     function = LegacyFunctionSpecification()
     function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN,
         description = "Index of the particle to get the radius of. This index must have been returned by an earlier call to :meth:`new_particle`")
     function.addParameter('radius', dtype='float64', direction=function.IN, description = "The new radius 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 retreived
     -1 - ERROR
         particle could not be found
     """
     return function
Exemplo n.º 48
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def set_radius():
     """
     Set the radius of a particle. Radius is a scalar property of a particle.
     """
     function = LegacyFunctionSpecification()
     function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN,
         description = "Index of the particle to get the radius of. This index must have been returned by an earlier call to :meth:`new_particle`")
     function.addParameter('radius', dtype='float64', direction=function.IN, description = "The new radius 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 retreived
     -1 - ERROR
         particle could not be found
     """
     return function
Exemplo n.º 49
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def get_mass():
     """
     Retrieve the mass of a particle. Mass is a scalar property of a particle,
     this function has one OUT argument.
     """
     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('mass', dtype='float64', direction=function.OUT, description = "The current mass of the particle")
     function.result_type = 'int32'
     function.can_handle_array = True
     function.result_doc = """
     0 - OK
         particle was removed from the model
     -1 - ERROR
         particle could not be found
     """
     return function
Exemplo n.º 50
0
 def get_stopping_condition_info():
     """
     Generic function for getting the information connected to
     a stopping condition. Index can be between 0 and
     the result of the :method:`get_number_of_stopping_conditions_set`
     method.
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True 
     function.addParameter('index', dtype='int32', direction=function.IN, description = "Index in the array[0,number_of_stopping_conditions_set>")
     function.addParameter('type', dtype='int32', direction=function.OUT, description = "Kind of the condition, can be used to retrieve specific information")
     function.addParameter('number_of_particles', dtype='int32', direction=function.OUT, description = "Number of particles that met this condition")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
Exemplo n.º 51
0
 def get_local_density():
    """
    Retrieve the local stellar density at a given point
    """
    function = LegacyFunctionSpecification()
    function.addParameter('t', dtype='float64', direction=function.IN
                          , description="time",unit=97781310.5721*units.yr)
    function.addParameter('x', dtype='float64', direction=function.IN
                          , description="x position",unit=units.kpc)
    function.addParameter('y', dtype='float64', direction=function.IN
                          , description="y position",unit=units.kpc)
    function.addParameter('z', dtype='float64', direction=function.IN
                          , description="z position",unit=units.kpc)
    function.addParameter('density', dtype='float64', direction=function.OUT
                          , description="local density",unit= 2.32e7*units.MSun/units.kpc**3)
    function.addParameter('npoints', dtype='i', direction=function.LENGTH)
    function.result_type = 'int32'
    function.can_handle_array = True 
    return function
Exemplo n.º 52
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def set_mass():
     """
     Update the mass of a particle. Mass is a scalar property of a particle.
     """
     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('mass', dtype='float64', direction=function.IN, description = "The new mass 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
     """
     return function
Exemplo n.º 53
0
 def get_number_of_stopping_conditions_set():
     """
     Return the number of stopping conditions set, one
     condition can be set multiple times.   
     
     Stopping conditions are set when the code determines
     that the conditions are met. The objects or or information
     about the condition can be retrieved with
     the get_stopping_condition_info method.
     """
     function = LegacyFunctionSpecification()  
     function.can_handle_array = True 
     function.addParameter('result', dtype='int32', direction=function.OUT, description = "> 1 if any stopping condition is set")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
     -1 - ERROR
     """
     return function
Exemplo n.º 54
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def delete_particle():
     """
     Remove the definition of particle from the code. After calling this function the particle is
     no longer part of the model evolution. It is up to the code if the index will be reused.
     This function is optional.
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = True
     function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN,
         description = "Index of the particle to be removed. This index must have been returned by an earlier call to :meth:`new_particle`")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
         particle was removed from the model
     -1 - ERROR
         particle could not be removed
     -2 - ERROR
         not yet implemented
     """
     return function
Exemplo n.º 55
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def get_center_of_mass_velocity():
     """
     Retrieve the velocity of the center of mass of all particles. This
     velocity is mass weighted mean of the velocity of all particles.
     """
     function = LegacyFunctionSpecification()
     function.can_handle_array = True
     function.addParameter('vx', dtype='float64', direction=function.OUT,
         description = "The mean velocity of the model")
     function.addParameter('vy', dtype='float64', direction=function.OUT,
         description = "The mean velocity of the model")
     function.addParameter('vz', dtype='float64', direction=function.OUT,
         description = "The mean velocity  of the model")
     function.result_type = 'int32'
     function.result_doc = """
     0 - OK
         Current value of the center of mass velocity was retrieved
     -1 - ERROR
         The value could not be provided
     """
     return function
Exemplo n.º 56
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def get_potential():
     """
     Retrieve the potential at a particle position, for retrieving the potential anywhere in
     the field use get_potential_at_point.
     """
     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('potential', dtype='float64', direction=function.OUT, description = "The current scalar potential...")
     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
Exemplo n.º 57
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def set_velocity():
     """
     Set the velocity vector 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('vx', dtype='float64', direction=function.IN, description = "The current x component of the velocity vector of the particle")
     function.addParameter('vy', dtype='float64', direction=function.IN, description = "The current y component of the velocity vector of the particle")
     function.addParameter('vz', dtype='float64', direction=function.IN, description = "The current z component of the velocity 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
Exemplo n.º 58
0
Arquivo: gd.py Projeto: Ingwar/amuse
 def get_acceleration():
     """
     Retrieve the acceleration vector of a particle. Second time derivative of the position.
     """
     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('ax', dtype='float64', direction=function.OUT, description = "The current position vector of the particle")
     function.addParameter('ay', dtype='float64', direction=function.OUT, description = "The current position vector of the particle")
     function.addParameter('az', dtype='float64', direction=function.OUT, description = "The current position 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