src/amuse/datamodel/particles.py
def add_particles(self, particles):
        """
        Adds particles from the supplied set to this set. Attributes
        and values are copied over.

        .. note::
            For performance reasons the particles
            are not checked for duplicates. When the same particle
            is part of both sets errors may occur.

        :parameter particles: set of particles to copy values from

        >>> particles1 = Particles(2)
        >>> particles1.x = [1.0, 2.0] | units.m
        >>> particles2 = Particles(2)
        >>> particles2.x = [3.0, 4.0] | units.m
        >>> particles1.add_particles(particles2)  # doctest:+ELLIPSIS
        <amuse.datamodel.particles.ParticlesSubset object at 0x...>
        >>> print len(particles1)
        4
        >>> print particles1.x
        [1.0, 2.0, 3.0, 4.0] m
        """
        if len(particles) == 0:
            return ParticlesSubset(self._original_set(),[])

        attributes = particles.get_attribute_names_defined_in_store()
        attributes= [x for x in attributes if x not in self._derived_attributes]
        
        indices = particles.get_all_indices_in_store()
        keys =  particles.get_all_keys_in_store()
        values = particles.get_values_in_store(indices, attributes)
        values = map(self._convert_from_entities_or_quantities, values)
        converted = []
        for x in values:
            if isinstance(x, LinkedArray):
                converted.append(x.copy_with_link_transfer(particles, self))
            else:
                converted.append(x)
        try:
            self.add_particles_to_store(keys, attributes, converted)
        except exceptions.MissingAttributesAmuseException as caught_exception:
            for attribute_name in caught_exception.missing_attributes:
                if attribute_name in particles._derived_attributes:
                    attributes.append(attribute_name)
                    converted.append(getattr(particles, attribute_name))
                else:
                    raise
            self.add_particles_to_store(keys, attributes, converted)
        return ParticlesSubset(self._original_set(),keys)

        Adds particles from the supplied set to this set. Attributes
        and values are copied over.

        .. note::
            For performance reasons the particles
            are not checked for duplicates. When the same particle
            is part of both sets errors may occur.

        :parameter particles: set of particles to copy values from

        >>> particles1 = Particles(2)
        >>> particles1.x = [1.0, 2.0] | units.m
        >>> particles2 = Particles(2)
        >>> particles2.x = [3.0, 4.0] | units.m
        >>> particles1.add_particles(particles2)  # doctest:+ELLIPSIS
        <amuse.datamodel.particles.ParticlesSubset object at 0x...>
        >>> print len(particles1)
        4
        >>> print particles1.x
        [1.0, 2.0, 3.0, 4.0] m
        
Adds particles from the supplied set to this set. Attributes
and values are copied over.

:
For performance reasons the particles
are not checked for duplicates. When the same particle
is part of both sets errors may occur.
Adds particles from the supplied set to this set . Attributes and values are copied over . : For performance reasons the particles are not checked for duplicates . When the same particle is part of both sets errors may occur .
def add_particles(self, particles):
        if len(particles) == 0:
            return ParticlesSubset(self._original_set(),[])
        attributes = particles.get_attribute_names_defined_in_store()
        attributes= [x for x in attributes if x not in self._derived_attributes]
        indices = particles.get_all_indices_in_store()
        keys =  particles.get_all_keys_in_store()
        values = particles.get_values_in_store(indices, attributes)
        values = map(self._convert_from_entities_or_quantities, values)
        converted = []
        for x in values:
            if isinstance(x, LinkedArray):
                converted.append(x.copy_with_link_transfer(particles, self))
            else:
                converted.append(x)
        try:
            self.add_particles_to_store(keys, attributes, converted)
        except exceptions.MissingAttributesAmuseException as caught_exception:
            for attribute_name in caught_exception.missing_attributes:
                if attribute_name in particles._derived_attributes:
                    attributes.append(attribute_name)
                    converted.append(getattr(particles, attribute_name))
                else:
                    raise
            self.add_particles_to_store(keys, attributes, converted)
        return ParticlesSubset(self._original_set(),keys)
def add_particles ( self , particles ) : if len ( particles ) == 0 : return ParticlesSubset ( self . _original_set ( ) , [ ] ) attributes = particles . get_attribute_names_defined_in_store ( ) attributes = [ x for x in attributes if x not in self . _derived_attributes ] indices = particles . get_all_indices_in_store ( ) keys = particles . get_all_keys_in_store ( ) values = particles . get_values_in_store ( indices , attributes ) values = map ( self . _convert_from_entities_or_quantities , values ) converted = [ ] for x in values : if isinstance ( x , LinkedArray ) : converted . append ( x . copy_with_link_transfer ( particles , self ) ) else : converted . append ( x ) try : self . add_particles_to_store ( keys , attributes , converted ) except exceptions . MissingAttributesAmuseException as caught_exception : for attribute_name in caught_exception . missing_attributes : if attribute_name in particles . _derived_attributes : attributes . append ( attribute_name ) converted . append ( getattr ( particles , attribute_name ) ) else : raise self . add_particles_to_store ( keys , attributes , converted ) return ParticlesSubset ( self . _original_set ( ) , keys )
Adds particles from the supplied set to this set.
Adds particles from the supplied set to this set .
"""
        Adds particles from the supplied set to this set. Attributes
        and values are copied over.

        .. note::
            For performance reasons the particles
            are not checked for duplicates. When the same particle
            is part of both sets errors may occur.

        :parameter particles: set of particles to copy values from

        >>> particles1 = Particles(2)
        >>> particles1.x = [1.0, 2.0] | units.m
        >>> particles2 = Particles(2)
        >>> particles2.x = [3.0, 4.0] | units.m
        >>> particles1.add_particles(particles2)  # doctest:+ELLIPSIS
        <amuse.datamodel.particles.ParticlesSubset object at 0x...>
        >>> print len(particles1)
        4
        >>> print particles1.x
        [1.0, 2.0, 3.0, 4.0] m
        """
self
particles
set of particles to copy values from
>>> particles1 = Particles(2)
>>> particles1.x = [1.0, 2.0] | units.m
>>> particles2 = Particles(2)
>>> particles2.x = [3.0, 4.0] | units.m
>>> particles1.add_particles(particles2)  # doctest:+ELLIPSIS

>>> print len(particles1)
4
>>> print particles1.x
[1.0, 2.0, 3.0, 4.0] m
set of particles to copy values from >>> particles1 = Particles ( 2 ) >>> particles1 . x = [ 1 . 0 2 . 0 ] | units . m >>> particles2 = Particles ( 2 ) >>> particles2 . x = [ 3 . 0 4 . 0 ] | units . m >>> particles1 . add_particles ( particles2 ) # doctest : + ELLIPSIS >>> print len ( particles1 ) 4 >>> print particles1 . x [ 1 . 0 2 . 0 3 . 0 4 . 0 ] m