Skip to content
Snippets Groups Projects
addingtasks.rst 4.04 KiB

How to add a new task to SWIFT?

This tutorial will step through how to add a new task to swift. First we will go through the idealology of adding a new task to SWIFT. This will be followed by an example of how to add a task for an imposed external gravitational field to SWIFT and a task to include "cooling" to the gas particles.

In the simplest case adding a new tasks requires changes to five files, namely:

  • task.h
  • cell.h
  • timers.h
  • task.c
  • engine.c

Further, implementation details of what the task will then do should be added to another file (for example runner_myviptask.c) which will contain the actual task implementation.

So now lets look at what needs to change in each of the files above, starting with task.h

task.h

Within task.h there exists a structure of the form:

/* The different task types. */
enum task_types {
    task_type_none = 0,
    task_type_sort,
    task_type_self,
    task_type_pair,
          .
          .
          .
    task_type_my_new_task,
    task_type_psort,
    task_type_split_cell,
    task_type_count
};