metawards.utils.call_function_on_network(network: Union[metawards._network.Network, metawards._networks.Networks], infections: metawards._infections.Infections, workspace: metawards._workspace.Workspace, population: metawards._population.Population, func: Optional[Callable[[...], None]] = None, parallel: Optional[Callable[[...], None]] = None, nthreads: int = 1, switch_to_parallel: int = 2, call_on_overall: bool = False, **kwargs)[source]

Call either ‘func’ or ‘parallel’ (depending on the number of threads, nthreads) on the passed Network, or on all demographic subnetworks

  • network (Network or Networks) – The network that is being modelled

  • nthreads (int) – The number of threads to use to perform the work

  • func (MetaFunction) – Function that performs the work in serial

  • parallel (MetaFunction) – Function that performs the work in parallel

  • switch_to_parallel (int) – Use the parallel function when nthreads is greater or equal to this value