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
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
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
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 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
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
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
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
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
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 example_function(): """ Example template for the other functions defined in this specification. All functions should follow this example.. """ function = LegacyFunctionSpecification() function.addParameter( 'input', dtype='int32', direction=function.IN, description=( "Typical input parameter, the argument is passed by value " "to the function.")) function.addParameter( 'output', dtype='float64', direction=function.OUT, description=( "Typical output parameter, the argument is passed " "by reference.\n" "The argument should point to a valid memory location.")) function.addParameter( 'inout', dtype='float64', direction=function.INOUT, description=( "Some arguments can be both input as well as output. " "The function will update the value of the passed argument.")) function.result_type = 'int32' function.result_doc = "Function will return an error code." return function
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
def specification(self): specification = LegacyFunctionSpecification() specification.name ='test' specification.addParameter('one','d',specification.IN, 'first parameter') specification.result_type = 'i' specification.result_doc = 'an integer' specification.description = 'Example function' return specification
def specification(self): specification = LegacyFunctionSpecification() specification.name = 'test' specification.addParameter('one', 'd', specification.IN, 'first parameter') specification.result_type = 'i' specification.result_doc = 'an integer' specification.description = 'Example function' return specification
def test7(self): print "Testing __str__ of Legacy Function" specification = LegacyFunctionSpecification() specification.name ='test' specification.addParameter('one','f',specification.IN, 'first parameter, type: float') specification.addParameter('two','d',specification.OUT, 'second parameter, type double') specification.result_type = 'i' specification.result_doc = 'an integer' specification.description = 'Example function' self.assertEquals(str(specification),"function: int test(float one)\noutput: double two, int __result")
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 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 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 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 synchronize_model(): """ After an evolve the particles may be at different simulation times. Synchronize the particles to a consistent stat at the current simulation time """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK """ 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
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
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
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_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
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 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 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 synchronize_model(): """ After an evolve the particles may be at different simulation times. Synchronize the particles to a consistent stat at the current simulation time """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK """ 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
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 initialize_code(): """ Let the code perform initialization actions after all parameters have been set. Should be called once per running code instance. """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK Code is initialized -1 - ERROR Error happened during initialization, this error needs to be further specified by every code implemention """ return function
def test6(self): print "Testing description of Legacy Function with output parameter" specification = LegacyFunctionSpecification() specification.name ='test' specification.addParameter('one','d',specification.OUT, 'first parameter') specification.result_type = 'i' specification.result_doc = 'an integer' specification.description = 'Example function' x = create_definition.CreateDescriptionOfAFunctionSpecification() x.specification = specification x.start() self.assertTrue(x.out.string.find('int32 test(float64 * one)') > 0) self.assertTrue(x.out.string.find(':returns:') > 0)
def test7(self): print("Testing __str__ of Legacy Function") specification = LegacyFunctionSpecification() specification.name = 'test' specification.addParameter('one', 'f', specification.IN, 'first parameter, type: float') specification.addParameter('two', 'd', specification.OUT, 'second parameter, type double') specification.result_type = 'i' specification.result_doc = 'an integer' specification.description = 'Example function' self.assertEqual( str(specification), "function: int test(float one)\noutput: double two, int __result")
def get_number_of_particles(): """ Retrieve the total number of particles define d in the code """ function = LegacyFunctionSpecification() function.addParameter('number_of_particles', dtype='int32', direction=function.OUT, description = "Count of the particles in the code") function.result_type = 'int32' function.result_doc = """ 0 - OK Count could be determined -1 - ERROR Unable to determine the count """ return function
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
def get_time_step(): """ Retrieve the model timestep. """ function = LegacyFunctionSpecification() function.addParameter('time_step', dtype='float64', direction=function.OUT, description = "The current model timestep") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the time step was retrieved -1 - ERROR The code does not have support for querying the time """ return function
def get_number_of_particles(): """ Retrieve the total number of particles define d in the code """ function = LegacyFunctionSpecification() function.addParameter('number_of_particles', dtype='int32', direction=function.OUT, description = "Count of the particles in the code") function.result_type = 'int32' function.result_doc = """ 0 - OK Count could be determined -1 - ERROR Unable to determine the count """ return function
def test6(self): print("Testing description of Legacy Function with output parameter") specification = LegacyFunctionSpecification() specification.name = 'test' specification.addParameter('one', 'd', specification.OUT, 'first parameter') specification.result_type = 'i' specification.result_doc = 'an integer' specification.description = 'Example function' x = create_definition.CreateDescriptionOfAFunctionSpecification() x.specification = specification x.start() self.assertTrue(x.out.string.find('int32 test(float64 * one)') > 0) self.assertTrue(x.out.string.find(':returns:') > 0)
def get_begin_time(): """ Retrieve the model time to start the evolution at. """ function = LegacyFunctionSpecification() function.addParameter('time', dtype='float64', direction=function.OUT, description = "The begin time", unit = nbody_system.time) function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the time was retrieved -2 - ERROR The code does not have support for querying the begin time """ return function
def get_potential_energy(): """ Retrieve the current potential energy of the model """ function = LegacyFunctionSpecification() function.addParameter('potential_energy', dtype='float64', direction=function.OUT, description = "The potential energy of the model") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the potential energy was set -1 - ERROR Kinetic potential could not be provided """ return function
def get_begin_time(): """ Retrieve the model time to start the evolution at. """ function = LegacyFunctionSpecification() function.addParameter('time', dtype='float64', direction=function.OUT, description = "The begin time", unit = nbody_system.time) function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the time was retrieved -2 - ERROR The code does not have support for querying the begin time """ return function
def get_potential_energy(): """ Retrieve the current potential energy of the model """ function = LegacyFunctionSpecification() function.addParameter('potential_energy', dtype='float64', direction=function.OUT, description = "The potential energy of the model") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the potential energy was set -1 - ERROR Kinetic potential could not be provided """ return function
def set_eps2(): """ Update the value of the squared smoothing parameter. """ function = LegacyFunctionSpecification() function.addParameter('epsilon_squared', dtype='float64', direction=function.IN, description = "The new value of the smooting parameter, squared.") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the smoothing parameter was set -1 - ERROR The code does not have support for a smoothing parameter """ return function
def test4(self): specification = LegacyFunctionSpecification() specification.name ='test' specification.addParameter('one','d',specification.IN, 'first parameter') specification.result_type = 'i' specification.result_doc = 'an integer' specification.description = 'Example function' x = create_definition.CreateFortranStub() x.specification = specification x.start() self.assertTrue(x.out.string.find('FUNCTION test(one)') >= 0) self.assertTrue(x.out.string.find('END FUNCTION') > 0) self.assertTrue(x.out.string.find('DOUBLE PRECISION :: one') > 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
def set_eps2(): """ Update the value of the squared smoothing parameter. """ function = LegacyFunctionSpecification() function.addParameter('epsilon_squared', dtype='float64', direction=function.IN, description = "The new value of the smooting parameter, squared.") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the smoothing parameter was set -1 - ERROR The code does not have support for a smoothing parameter """ return function
def get_time_step(): """ Retrieve the model timestep. """ function = LegacyFunctionSpecification() function.addParameter('time_step', dtype='float64', direction=function.OUT, description = "The current model timestep") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the time step was retrieved -1 - ERROR The code does not have support for querying the time """ return function
def test4(self): specification = LegacyFunctionSpecification() specification.name = 'test' specification.addParameter('one', 'd', specification.IN, 'first parameter') specification.result_type = 'i' specification.result_doc = 'an integer' specification.description = 'Example function' x = create_definition.CreateFortranStub() x.specification = specification x.start() self.assertTrue(x.out.string.find('FUNCTION test(one)') >= 0) self.assertTrue(x.out.string.find('END FUNCTION') > 0) self.assertTrue(x.out.string.find('DOUBLE PRECISION :: one') > 0)
def get_total_radius(): """ Return the radius of the sphere, centered on the center of mass that contains all the particles. *get_size?* """ function = LegacyFunctionSpecification() function.addParameter('radius', dtype='float64', direction=function.OUT, description = "The maximum distance from a star to the center of mass of the model") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the radius was retrieved -1 - ERROR The value could not be provided """ return function
def commit_particles(): """ Let the code perform initialization actions after all particles have been loaded in the model. Should be called before the first evolve call and after the last new_particle call. """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK Model is initialized and evolution can start -1 - ERROR Error happened during initialization, this error needs to be further specified by every code implemention """ return function
def recommit_parameters(): """ Perform initialization actions after parameters have been updated (after commit_parameters and particles have been loaded). """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK Model is initialized and evolution can start -1 - ERROR Error happened during initialization, this error needs to be further specified by every code implemention """ return function
def commit_particles(): """ Let the code perform initialization actions after all particles have been loaded in the model. Should be called before the first evolve call and after the last new_particle call. """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK Model is initialized and evolution can start -1 - ERROR Error happened during initialization, this error needs to be further specified by every code implemention """ return function
def recommit_particles(): """ Let the code perform initialization actions after the number of particles have been updated or particle attributes have been updated from the script. """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK Model is initialized and evolution can start -1 - ERROR Error happened during initialization, this error needs to be further specified by every code implemention """ return function
def initialize_code(): """ Let the code perform initialization actions after all parameters have been set. Should be called once per running code instance. """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK Code is initialized -1 - ERROR Error happened during initialization, this error needs to be further specified by every code implemention """ return function
def set_begin_time(): """ Set the model time to start the evolution at. This is an offset for all further calculations in the code. """ 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 begin time """ return function
def get_total_radius(): """ Return the radius of the sphere, centered on the center of mass that contains all the particles. *get_size?* """ function = LegacyFunctionSpecification() function.addParameter('radius', dtype='float64', direction=function.OUT, description = "The maximum distance from a star to the center of mass of the model") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the radius was retrieved -1 - ERROR The value could not be provided """ return function
def set_begin_time(): """ Set the model time to start the evolution at. This is an offset for all further calculations in the code. """ 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 begin time """ return function
def set_example_parameter(): """ Update the value of the parameter. The type of the new value argument must be the same as the :meth:`get_example_parameter` function. """ function = LegacyFunctionSpecification() function.addParameter('value', dtype='float64', direction=function.IN, description = "The new value of the parameter.") function.result_type = 'int32' function.result_doc = """ 0 - OK New value of the parameter was set -1 - ERROR The code does not have support for this parameter """ return function
def recommit_particles(): """ Let the code perform initialization actions after the number of particles have been updated or particle attributes have been updated from the script. """ function = LegacyFunctionSpecification() function.result_type = 'int32' function.result_doc = """ 0 - OK Model is initialized and evolution can start -1 - ERROR Error happened during initialization, this error needs to be further specified by every code implemention """ return function