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_has_external_gravitational_potential(): """ Returns true if an external gravitational potential is enabled. """ function = LegacyFunctionSpecification() function.addParameter('value', dtype='int32', direction=function.OUT) function.result_type = 'i' return function
def evolve_model(): """ Evolve the model until the given end time (or just before). """ function = LegacyFunctionSpecification() function.addParameter('value', dtype='float64', direction=function.IN) function.result_type = 'i' return function
def get_time(): """ Returns the current model time. """ function = LegacyFunctionSpecification() function.addParameter('value', dtype='float64', direction=function.OUT) function.result_type = 'i' return function
def initialize_grid(): """ Perform accounting before evolving the model. This method will be called after setting the parameters and filling the grid points but just before evolving the system """ function = LegacyFunctionSpecification() function.result_type = 'i' return function
def evolve_model(): """ Evolve the model until the given time, or until a stopping condition is set. """ function = LegacyFunctionSpecification() function.addParameter('time', dtype='float64', direction=function.IN, description = "Model time to evolve the code to. The model will be " "evolved until this time is reached exactly or just after.") function.result_type = 'int32' return function
def get_fiducial_radius(): """ CG02 model fiducial radius where the density amplitude and initial phase are measured R_0 in eqn(1--3) of CG02 """ function = LegacyFunctionSpecification() function.addParameter('fiducial_radius', dtype='float64', direction=function.OUT, unit=units.kpc, description='CG02 model fiducial radius where the density amplitude and initial phase are measured') function.result_type = 'int32' return function
def get_scale_height(): """ CG02 model spiral arms scale height H in eqn(1) of CG02 """ function = LegacyFunctionSpecification() function.addParameter('scale_height', dtype='float64', direction=function.OUT, unit=units.kpc, description='CG02 model spiral arms scale height') function.result_type = 'int32' return function
def get_spiral_density_amplitude(): """ CG02 model spiral arms density amplitude, measured at fiducial radius rho_0 in eqn(1--3) of CG02 """ function = LegacyFunctionSpecification() function.addParameter('spiral_density_amplitude', dtype='float64', direction=function.OUT, unit=2.32e7*units.MSun/units.kpc**3, description='CG02 model spiral arms density amplitude, measured at fiducial radius') function.result_type = 'int32' return function
def get_spiral_model(): """ set model of spiral arms 0 -- TWA (2D) 1 -- Cox and Gomez (3D) 2 -- Lepine (2D) """ function = LegacyFunctionSpecification() function.addParameter('spiral_model', dtype='int32', direction=function.OUT, description='model of spiral arms (default: 0; TWA 2D arms)') function.result_type = 'int32' 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 test2(self): specification = LegacyFunctionSpecification() specification.name ='test' specification.addParameter('one','d',specification.IN, 'first parameter') specification.description = 'Example function' x = create_definition.CreateDescriptionOfAFunctionSpecification() x.specification = specification x.start() self.assertTrue(x.out.string.find('void test(float64 one)') > 0) self.assertTrue(x.out.string.find('Example function') >= 0) self.assertTrue(x.out.string.find(':param one:') > 0)
def set_has_external_gravitational_potential(): """ When True enables the script to set and external gravitational potential. note:: Not every hydrodynamics code supports an external gravitational potential """ function = LegacyFunctionSpecification() function.addParameter('value', dtype='int32', direction=function.IN) function.result_type = 'i' return function
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_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_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_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_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 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 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 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_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 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 get_potential(): """ Retrieves the gravitational potential on the given gridpoint (only for codes supporting an external gravitational potential). """ function = LegacyFunctionSpecification() function.must_handle_array = True for x in ['i','j','k']: function.addParameter(x, dtype='i', direction=function.IN) function.addParameter('potential', dtype='d', direction=function.OUT) function.addParameter('number_of_points', 'i', function.LENGTH) function.result_type = 'i' return function
def get_total_mass(): """ Retrieve the sum of the masses of all particles. """ function = LegacyFunctionSpecification() function.addParameter('mass', dtype='float64', direction=function.OUT, description = "The total mass of the model") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the kinetic mass was retrieved -1 - ERROR Total mass could not be provided -2 - ERROR not yet implemented """ return function
def get_time(): """ Retrieve the model time. This time should be close to the end time specified in the evolve code. Or, when a collision was detected, it will be the model time of the collision. """ function = LegacyFunctionSpecification() function.addParameter('time', dtype='float64', direction=function.OUT, description = "The current model time") function.result_type = 'int32' function.result_doc = """ 0 - OK Current value of the time was retrieved -1 - ERROR The code does not have support for querying the time """ return function
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
def get_tidal_tensor(): """ Retrieve the second derivatives of the total force at a given point and at a given time. """ function = LegacyFunctionSpecification() function.can_handle_array = True 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('Fxx', dtype='float64', direction=function.OUT , description="fxx",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('Fyx', dtype='float64', direction=function.OUT , description="fyx",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('Fzx', dtype='float64', direction=function.OUT , description="fzx",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('Fxy', dtype='float64', direction=function.OUT , description="fxy",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('Fyy', dtype='float64', direction=function.OUT , description="fyy",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('Fzy', dtype='float64', direction=function.OUT , description="fzy",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('Fxz', dtype='float64', direction=function.OUT , description="fxz",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('Fyz', dtype='float64', direction=function.OUT , description="fyz",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('Fzz', dtype='float64', direction=function.OUT , description="fzz",unit=100*units.kms**2/units.kpc**2 ) function.addParameter('npoints', dtype='i', direction=function.LENGTH) function.result_type = 'int32' return function
def get_tidal_radius(): """ Retrieve the tidal radius of a star cluster """ function = LegacyFunctionSpecification() function.can_handle_array = True 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('mc', dtype='float64', direction=function.IN , description="initial cluster mass",unit=2.32e7*units.MSun) function.addParameter('rt', dtype='float64', direction=function.OUT , description="tidal radius",unit= units.kpc) function.addParameter('npoints', dtype='i', direction=function.LENGTH) function.result_type = 'int32' return function
def get_axis_ratio_bar(): function = LegacyFunctionSpecification() function.addParameter('axis_ratio_bar', dtype='float64', direction=function.OUT) function.result_type = 'int32' return function;
def get_nbt(): function = LegacyFunctionSpecification() function.addParameter('nbt', dtype='float64', direction=function.OUT) function.result_type = 'int32' return function;
def set_mass_bulge(): function = LegacyFunctionSpecification() function.addParameter('mass_bulge', dtype='float64', direction=function.IN, unit=2.32e7*units.MSun) function.result_type = 'int32' return function;
def get_phi21(): function = LegacyFunctionSpecification() function.addParameter('phi21_spiral', dtype='float64', direction=function.OUT) function.result_type = 'int32' return function;
def set_m2(): function = LegacyFunctionSpecification() function.addParameter('m2', dtype='float64', direction=function.IN) function.result_type = 'int32' return function;
def get_tan_pitch_angle2(): function = LegacyFunctionSpecification() function.addParameter('tan_pitch_angle2', dtype='float64', direction=function.OUT) function.result_type = 'int32' return function;
def get_omega_spiral2(): function = LegacyFunctionSpecification() function.addParameter('omega_spiral2', dtype='float64', direction=function.OUT, unit=10.*units.km/(units.s*units.kpc)) function.result_type = 'int32' return function;
def get_sigma_s(): function = LegacyFunctionSpecification() function.addParameter('sigma_s', dtype='float64', direction=function.OUT, unit=97781310.5721*units.yr) function.result_type = 'int32' return function;
def set_t_sim(): function = LegacyFunctionSpecification() function.addParameter('t_sim', dtype='float64', direction=function.IN, unit= 97781310.5721*units.yr ) function.result_type = 'int32' return function;
def set_b_disk(): function = LegacyFunctionSpecification() function.addParameter('b_disk', dtype='float64', direction=function.IN,unit=units.kpc) function.result_type = 'int32' return function;
def set_omega_bar(): function = LegacyFunctionSpecification() function.addParameter('omega_bar', dtype='float64', direction=function.IN, unit=10.*units.km/(units.s*units.kpc)) function.result_type = 'int32' return function;
def get_mass_halo(): function = LegacyFunctionSpecification() function.addParameter('mass_halo', dtype='float64', direction=function.OUT,unit=2.32e7*units.MSun) function.result_type = 'int32' return function;
def get_initial_phase(): function = LegacyFunctionSpecification() function.addParameter('initial_phase', dtype='float64', direction=function.OUT ) function.result_type = 'int32' return function;
def get_a_halo(): function = LegacyFunctionSpecification() function.addParameter('a_halo', dtype='float64', direction=function.OUT,unit=units.kpc) function.result_type = 'int32' return function;
def get_eigen_values(): """ Retrieve the eigen values of the tidal tensor. """ function = LegacyFunctionSpecification() function.can_handle_array = True 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('lambda1', dtype='float64', direction=function.OUT , description="eigen values",unit= 100*units.kms**2/units.kpc**2) function.addParameter('lambda2', dtype='float64', direction=function.OUT , description="eigen values",unit= 100*units.kms**2/units.kpc**2) function.addParameter('lambda3', dtype='float64', direction=function.OUT , description="eigen values",unit= 100*units.kms**2/units.kpc**2) function.addParameter('npoints', dtype='i', direction=function.LENGTH) function.result_type = 'int32' return function
def set_spiral_contribution(): function = LegacyFunctionSpecification() function.addParameter('spiral_contribution', dtype='int32', direction=function.IN) function.result_type = 'int32' return function;
def get_bar_contribution(): function = LegacyFunctionSpecification() function.addParameter('bar_contribution', dtype='int32', direction=function.OUT) function.result_type = 'int32' return function;
def get_transient_spiral(): function = LegacyFunctionSpecification() function.addParameter('transient_spiral', dtype='int32', direction=function.OUT) function.result_type = 'int32' return function;
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
def get_grid_energy_density(): """ Retreives the energy densitity at the given grid-point """ function = LegacyFunctionSpecification() function.must_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 [ 'en', ]: function.addParameter(x, dtype='d', direction=function.OUT) function.addParameter('number_of_points', 'i', function.LENGTH) function.result_type = 'i' 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 set_grid_momentum_density(): function = LegacyFunctionSpecification() function.must_handle_array = True for x in ['i', 'j', 'k']: function.addParameter(x, dtype='i', direction=function.IN) for x in [ 'rhovx', 'rhovy', 'rhovz', ]: function.addParameter(x, dtype='d', direction=function.IN) function.addParameter('index_of_grid', dtype='i', direction=function.IN, default=1) function.addParameter('number_of_points', 'i', function.LENGTH) function.result_type = 'i' return function
def set_stopping_condition_maximum_density_parameter(): function = LegacyFunctionSpecification() function.addParameter('value', dtype='float64', direction=function.IN) function.result_type = 'int32' return function
def get_number_of_grids(): function = LegacyFunctionSpecification() function.addParameter('n', dtype='i', direction=function.OUT) function.result_type = 'i' return function
def get_amplitude2(): function = LegacyFunctionSpecification() function.addParameter('amplitude2', dtype='float64', direction=function.OUT, unit= 100*units.kms**2/units.kpc) function.result_type = 'int32' return function;
def set_omega_spiral(): function = LegacyFunctionSpecification() function.addParameter('omega_spiral', dtype='float64', direction=function.IN, unit=10*units.kms/units.kpc) function.result_type = 'int32' return function;