Skip to content

Commit 4eb451a

Browse files
committed
started section on creating tidymess interface
1 parent cc3f2ff commit 4eb451a

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

doc/tutorial/adding_example_code_tidymess.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,45 @@ Setting up the Makefile
101101
~~~~~~~~~~~~~~~~~~~~~~~
102102
With our build system detection working, we now need to download ``TIDYMESS`` into ``AMUSE``!
103103
This is where the Makefiles come in. ``AMUSE`` packages typically have 2 Makefiles.
104+
105+
106+
Creating the Interfaces
107+
=======================
108+
With ``TIDYMESS`` compiled into ``AMUSE``, we can now begin the process of creating our interface!
109+
The interface system allows community codes, which are all unique and depend on diverse libraries and
110+
programming languages, to communicate with the ``AMUSE`` framework, which is native Python. ``AMUSE``
111+
interfaces define a number of interface functions, which provide a standardized way for ``AMUSE`` to
112+
communicate with each community code. This way, the experience of using any ``AMUSE`` code is identical:
113+
all codes can be evolved with the ``evolve_model`` method, particles are represented as
114+
``amuse.datamodel.particles``, etc... The strength of ``AMUSE`` lies in its ability to prototype quickly:
115+
If the user wants to see what solution a different code would give for the same calculation, all they have
116+
to do is switch which code they are using, and the script most likely does not need to change.
117+
118+
Therefore, our job when creating an interface is to map the community code functions to the ``AMUSE`` interface
119+
functions. The amusifier already created all the files we need: the ``interface.py`` and the ``interface.cc``.
120+
121+
Defining the Python interface
122+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123+
The ``interface.py`` actually defines two classes: the high-level and low-level Python interfaces. The high-level
124+
interface is what the user interacts with when using the community code. This defines the methods, parameters,
125+
and properties of each community code, and defines how the ``amuse.datamodel.particles`` work within that code.
126+
The ``amusifer`` generates a minimal code stub for the ``interface.py``, which is enough to get us started.
127+
The process of defining our interface starts with figuring out what type of code we are adding to ``AMUSE``.
128+
``AMUSE`` has a set of predefined Python interfaces we can use to build our interface from.
129+
130+
131+
+----------------------------------+-------------------------------------------+
132+
| Interface: | Example codes: |
133+
+----------------------------------+-------------------------------------------+
134+
| ``GravitationDynamicsInterface`` | N-body: Tidymess, Ph4, Huyano |
135+
+----------------------------------+-------------------------------------------+
136+
| ``HydrodynamicsInterface`` | Hydrodynamical: Capreole |
137+
+----------------------------------+-------------------------------------------+
138+
| ``MagnetoHydrodynamicsInterface``| MHD: Athena |
139+
+----------------------------------+-------------------------------------------+
140+
| ``StellarEvolutionInterface`` | Stellar: MESA, EVtwin, SeBa |
141+
+----------------------------------+-------------------------------------------+
142+
143+
These interfaces define many
144+
of the required interface functions so that we don't have to.
145+
In this case, ``TIDYMESS`` is a N-Body code, and therefore falls under the

0 commit comments

Comments
 (0)