Skip to content

How_do_I_write_a_new_node?

Gijs Molenaar edited this page Feb 13, 2014 · 2 revisions

The Mechanics:

Although it is unlikely that end users will want to create their own specialized nodes, there may well be a requirement for a computer programmer to do so. Here are the instructions for a developer to create his or her own Meq nodes inside the LOFAR environment.

Enter the directory where the source code for the nodes are kept:

   cd ~/Timba/MeqNodes/src

Create the source code for the node. As much as possible you should just cannibalize some existing code. This is easily done if, for example, you just want to add a new Vells math mode. See ["Detailed Example Code"] for a more complicated example of adding your own record elements.

Follow the steps:

create/edit <node>.cc and <node.h>
Add the code to the subversion repository:
   svn add <node>.cc
   svn add <node>.h

Go to the directory:

   cd ~/Timba/MeqNodes

and edit CMakeLists.txt, adding your node's *.h and *.cc files (to one place each)

In the same directory, issue the command

   ../DMI/aid/build_aid_maps.pl ../DMI/aid/Global.aidlist src/*h

When you have created a new node, the build_aid_maps script that you have just called will register the new type and allocate identifiers for it. This regenerates a few source files, most notably AID-MeqNodes.h, TID-MeqNodes.h, AID-MeqNodes-Registry.cc, and TypeIter-MeqNodes.h in ~/Timba/!MeqNodes/src, and Global.aidlist in ~/Timba/DMI/aid.

The system should automagically check in the Global.aidlist for you. But you need to commit the other files that have been updated (including the CMakeLists.txt file that you modified earlier) manually. These commits should only be done after you have tested that your new node works as expected - see the following.

Sometimes the call to build_aid_maps.pl may not complete properly. In that case you should do:

cd ~/Timba/DMI
rm aid/Global.aidlist
svn up aid

Then go back to the ~/Timba/MeqNodes directory and repeat the call to build_aid_maps.pl

cd ~/Timba/MeqNodes
../DMI/aid/build_aid_maps.pl ../DMI/aid/Global.aidlist src/*h

Now, make sure that your code is up to date with regard to everyone else's check-ins. A `svn up' Timba/!MeqNodes should be sufficient.

Finally, a rebuild is needed for MeqNodes, and all packages depending on it. These days, this is normally done in ~/Timba/build/release; that should build everything that needs an update.

So, to make and link with the LOFAR system:

cd ~/Timba/build/release

If you are on the LOFAR cluster you can do a parallel make by issuing the command

   make -j40

otherwise, just issue the command

   make

When you are sure that your new node works properly you should check in the regenerated files mentioned above along with the new node classes.

Clone this wiki locally