def set_locations(self, pores=[], throats=[], mode='add'):
        r"""
        Assign or unassign a Physics object to specified locations

        Parameters
        ----------
        pores : array_like
            The pore locations in the Network where this Physics is to apply

        throats : array_like
            The throat locations in the Network where this Physics is to apply

        mode : string
            Either 'add' (default) or 'remove' the object from the specified
            locations

        Examples
        --------
        >>> import OpenPNM

        """
        if mode == 'add':
            # Check if any constant values exist on the object
            for item in self.props():
                if (item not in self.models.keys()) or \
                   (self.models[item]['regen_mode'] == 'constant'):
                    raise Exception('Constant properties found on object, ' +
                                    'cannot increase size')
            if sp.size(pores) > 0:
                Tools.SetLocations.add(obj=self, element='pore',
                                       locations=pores)
            if sp.size(throats) > 0:
                Tools.SetLocations.add(obj=self, element='throat',
                                       locations=throats)
        if mode == 'remove':
            if sp.size(pores) > 0:
                Tools.SetLocations.drop(obj=self, element='pore',
                                        locations=pores)
            if throats is not None:
                Tools.SetLocations.drop(obj=self, element='throat',
                                        locations=throats)
        # Finally, regenerate models to correct the length of all arrays
        self.models.regenerate()
dataset/ETHPy150Open PMEAL/OpenPNM/OpenPNM/Physics/__GenericPhysics__.py/GenericPhysics.set_locations/original