From c9dfd0a59bedc3a50c4d648d839e07512bb70dd8 Mon Sep 17 00:00:00 2001 From: Gareth Tribello <gt@eider.asg> Date: Fri, 6 Dec 2013 18:50:52 +0000 Subject: [PATCH] Added functionality to tell users what module a piece of code is part of in user documentation --- user-doc/Modules.txt | 52 ++++++--------------- user-doc/extract | 105 +++++++++++++++++++++++-------------------- 2 files changed, 71 insertions(+), 86 deletions(-) diff --git a/user-doc/Modules.txt b/user-doc/Modules.txt index 0b6d9c560..f4996b6cb 100644 --- a/user-doc/Modules.txt +++ b/user-doc/Modules.txt @@ -1,47 +1,23 @@ /** -@page mymodules Modules +@page mymodules module -PLUMED 2 is written and maintained by five core developers none of whom work full -time on the maintanence and upkeep of the code. From our point of view it is thus -desirable to keep the core of the code small. In addition, we are very keen that -users who contribute functionality to PLUMED get the plaudits that they deserve. -For these reasons many of PLUMED's more advanced functionalities are provided in -modules that users can download. To download a module you simply change to the -<c> plumed2/mymodules </c> directory and issue the following command: +The functionality in PLUMED 2 is divided into a small number of modules. Some +users may only wish to use a subset of the functionality available within the +code while others may wish to use some of PLUMED's more complicated features. +For this reason the plumed source code is divided into modules, which users can +activate or deactivate to their hearts content. -\verbatim -./plumed-get-module.sh <name of module> -\endverbatim +- To activate a module add a file called modulename.on to the plumed2/src directory +- To deactivate a module add a file called modulename.off to the plumed2/src directory -The following optional modules can be added to PLUMED 2: +Obviously, in the above instructions modulename should be replaced by the name of the +module that you would like to activate or deactivate. -@MODULES@ - -\section addmodule Adding a module - -If you have a PLUMED module that you would like us to advertise on the website -you should copy the directory structure from <c> plumed2/template-module </c> -as well as all the files inside that directory and place your source and regtest -files in appropriate directories. You are responsible for finding a suitable -web repository to host the code that you have developed (we use http://www.assembla.com -for PLUMED). You do not need to give us write access to your repository as ensuring that -your code keeps working with any new release of PLUMED is YOUR responsibility. - -Once you are ready to release your code simply send any email to one of the developers -with a txt file that contains the following information in the following format: - -\verbatim -NAME: <the name of your module> +Some modules are active by default in the version of PLUMED 2 that you download from +the website while others are inactive. The following lists all of the modules that +are available in plumed and tells you whether or not they are active by default. -AUTHOR: <the list of people involved in the development of the module> - -REPOSITORY: <the command that retreives the code e.g. git clone git@git.assembla.com:plumed2.git> - -DESCRIPTION: - -<a short description of what it is your module calculates> -<citations and equations can be included using the usual doxygen commands> -\endverbatim +@MODULES@ */ diff --git a/user-doc/extract b/user-doc/extract index 6443e5d4d..a8944b12d 100755 --- a/user-doc/extract +++ b/user-doc/extract @@ -105,53 +105,62 @@ done # Find what modules the user has installed # Find the list of modules -if [ -d ../mymodules ] ; then - sed -i '' -e 's/type="user" visible="no" url="mymodules.html"/type="user" visible="yes" url="mymodules.html"/' PlumedLayout.xml - for file in `ls ../mymodules/available-modules/` - do - #Â Check if module has been installed - if [ -d "../mymodules/$file" ] ; then - # Generate documentation and accreditation on modules page - echo "\section $file" >> automatic/mymodules.list - echo >> automatic/mymodules.list - echo "<table align=center frame=void width=95%% celpadding=5%%>" >> automatic/mymodules.list - echo "<tr> <td width=70%%> </td> </tr> <td>" >> automatic/mymodules.list - author=`grep AUTHOR: ../mymodules/available-modules/"$file" | sed -e 's/AUTHOR://'` - echo "<b> author: $author </b>" >> automatic/mymodules.list - echo "</td> </tr>" >> automatic/mymodules.list - echo "<tr> <td colspan="2">" >> automatic/mymodules.list - dline=`grep -n DESCRIPTION: ../mymodules/available-modules/"$file" | sed -n 's/^\([0-9]*\)[:].*/\1/p'` >> automatic/mymodules.list - tail -n +$(($dline+1)) ../mymodules/available-modules/"$file" >> automatic/mymodules.list - echo "</td> </tr> </table>" >> automatic/mymodules.list - echo >> automatic/mymodules.list - echo >> automatic/mymodules.list - - # Find src files in module and add a link to the module description - for srcfile in `ls ../mymodules/"$file"/src/*cpp` ; do - ndocs=`grep PLUMEDOC "$srcfile" | wc -l | awk '{print $1}'` - for ((line=1;line<$ndocs;++line)) ; do - docfile=`grep PLUMEDOC "$srcfile" | grep -v END | head -n $line | tail -n 1 | awk '{print $3}'` - cat automatic/"$docfile".tmp | - { - while read -r LINE ; do - if `echo $LINE | grep "\section $docfile" 1>/dev/null 2>&1` - then - echo $LINE - echo "<table align=center frame=void width=95%% celpadding=5%%>" - echo "<tr> <td width=70%%> </td> <td>" - echo "<b> This is part of the \ref $file module </b>" - echo "</td> </tr> </table>" - else - echo "$LINE" - fi - done - } > automatic/"$docfile"1.tmp - mv automatic/"$docfile"1.tmp automatic/"$docfile".tmp - done - done - fi - done -fi +# if [ -d ../mymodules ] ; then +# sed -i '' -e 's/type="user" visible="no" url="mymodules.html"/type="user" visible="yes" url="mymodules.html"/' PlumedLayout.xml +echo "<table align=center frame=void width=65%% cellpadding=5%%>" > automatic/modules.list +echo "<tr> <td> <b> Module name </b> </td> <td> <b> Default behavior </b> </td> </tr>" >> automatic/modules.list +for file in `ls ../src/*/module.type | sed -e 's/..\/src\///' | sed -e 's/\/module.type//'` +do + dstr=`head ../src/$file/module.type` + if [ "$dstr" != "always" ] ; then + echo "<tr> <td> $file </td>" >> automatic/modules.list + if [ "$dstr" == "default-on" ] ; then + echo "<td> on </td> </tr>" >> automatic/modules.list + else + echo "<td> off </td> </tr>" >> automatic/modules.list + fi +# # Generate documentation and accreditation on modules page +# echo "\section $file" >> automatic/mymodules.list +# echo >> automatic/mymodules.list +# echo "<table align=center frame=void width=95%% celpadding=5%%>" >> automatic/mymodules.list +# echo "<tr> <td width=70%%> </td> </tr> <td>" >> automatic/mymodules.list +# author=`grep AUTHOR: ../mymodules/available-modules/"$file" | sed -e 's/AUTHOR://'` +# echo "<b> author: $author </b>" >> automatic/mymodules.list +# echo "</td> </tr>" >> automatic/mymodules.list +# echo "<tr> <td colspan="2">" >> automatic/mymodules.list +# dline=`grep -n DESCRIPTION: ../mymodules/available-modules/"$file" | sed -n 's/^\([0-9]*\)[:].*/\1/p'` >> automatic/mymodules.list +# tail -n +$(($dline+1)) ../mymodules/available-modules/"$file" >> automatic/mymodules.list +# echo "</td> </tr> </table>" >> automatic/mymodules.list +# echo >> automatic/mymodules.list +# echo >> automatic/mymodules.list + + # Find src files in module and add a link to the module description + for srcfile in `ls ../src/"$file"/*cpp` ; do + ndocs=`grep PLUMEDOC "$srcfile" | wc -l | awk '{print $1}'` + for ((line=1;line<$ndocs;++line)) ; do + docfile=`grep PLUMEDOC "$srcfile" | grep -v END | head -n $line | tail -n 1 | awk '{print $3}'` + cat automatic/"$docfile".tmp | + { + while read -r LINE ; do + if `echo $LINE | grep "section $docfile" 1>/dev/null 2>&1` + then + echo $LINE + echo "<table align=center frame=void width=95%% celpadding=5%%>" + echo "<tr> <td width=70%%> </td> <td>" + echo "<b> This is part of the $file \\ref mymodules </b>" + echo "</td> </tr> </table>" + else + echo "$LINE" + fi + done + } > automatic/"$docfile"1.tmp + mv automatic/"$docfile"1.tmp automatic/"$docfile".tmp + done + done + fi +done +echo "</table>" >> automatic/modules.list +# fi # Generate all the documentation from keywords source ../sourceme.sh @@ -237,7 +246,7 @@ cat $file.txt | echo "</table>" elif [ "$LINE" = "@MODULES@" ] then - cat automatic/mymodules.list + cat automatic/modules.list elif [ "$LINE" = "@FUNCTION@" ] then echo "<table align=center frame=void width=95%% cellpadding=5%%>" -- GitLab