Clone wiki

codeaster-src / Tutorial

Table of contents:

Need help ? Please read the Getting support page.

Configuration of your development environment

You have to check this only once.

Configure your Mercurial options

If you already know Mercurial, your ~/.hgrc is probably already configured.

Here is an example of a ~/.hgrc file. You must at least edit the section [ui] section to enter your real name and email address.

# enter your real name and your email address
username = FirstName Lastname <>
editor = gedit
merge = meld

meld.args = $local $base $other

color =
rebase =
purge =
mq =
extdiff =
graphlog =
histedit =
patchbomb =

#translation = false
#test.nbmaxnook = 5

lg = log -G --template="{rev}:{node|short} {branch}: {desc|firstline} <{author|email}> ({phase})\n"
ll = lg -l 10

You can check that your username and email are correctly set:

$ hg showconfig ui.username
FirstName Lastname <>

Clone the source and devtools repositories

devtools will provide some tools to check our source coding conventions (it is recommended if you plan to send pull-requests and contribute to the project).

Note: devtools is mainly designed for internal purpose. It may contain specific configurations and some commands may be unusable. It is not clear, feedback is welcome.

Note: In this tutorial, you will clone the code_aster repositories. See the Bitbucket documentation if you created your own forks on Bitbucket.

Make your clones using:

mkdir -p $HOME/dev/codeaster && cd $HOME/dev/codeaster
hg clone devtools
hg clone src

Please be patient, the size of src is about 350 MB...

If you don't want to use $HOME/dev/codeaster, you must change it in the following examples.

Configuration of the repository

You can skip this step if you will keep your changes private.

This step will fill the .hg/hgrc file in the src repository.

It will enable the aster extension.

$HOME/dev/codeaster/devtools/bin/install_env --internet

Update: the script has now a --internet option for use without EDF servers. You can force reinitialization adding the --reset option.

You will probably have to source the environment of devtools to be able to load the extension. Add this line into your ~.bashrc:

. $HOME/dev/codeaster/devtools/etc/

Configuration and first build of code_aster

For more details, see the Build code_aster page.

To build code_aster you need install its prerequisites (mumps, hdf5, med, blas, compilers...).

In this tutorial we suppose that you have already install the last code_aster package of the testing version (for example, ASTER_VERSION=13.4). During the installation of this version, location of the prerequisites has been automatically registered in $ASTER_ROOT/$ASTER_VERSION/share/aster/ as a configuration file for waf.

For the following command lines you will use $ASTER_ROOT variable (change it with the value used during the installation of the aster-full-src package):


Here, we are using the prerequisites built by the aster-full setup. The command lines are:

cd $HOME/dev/codeaster/src
source $ASTER_ROOT/$ASTER_VERSION/share/aster/
./waf configure --use-config-dir=$ASTER_ROOT/$ASTER_VERSION/share/aster --use-config=aster_full_config --prefix=../install/std
./waf install -p

If later you want to build a parallel version, you will use --prefix=../install/mpi.

Now we can check this installation by running a small testcase:

$ cd $HOME/dev/codeaster/src
$ ./waf test -n sslp114a
Waf: Entering directory `/home/courtois/dev/codeaster/src/build/release'
destination of output files: /tmp/runtest_jb04OK
running zzzz100b in 'release'
`- output in /tmp/runtest_jb04OK/zzzz100b.output
`- exit 0
Waf: Leaving directory `/home/courtois/dev/codeaster/src/build/release'
'test' finished successfully (2.307s)

Using this development version in salome_meca

In order to prepare commands files with the syntax of your development version, all you need is to add it using the menu entry File/Preferences/AsterStudy/Catalogs. Use dev as label and enter the path up to lib/aster, for example: $HOME/dev/codeaster/install/std/lib/aster

This version should appeared with the label dev. To be available for execution on localhost, apply the following point for as_run.

Add this development version in astk/as_run

Just add these lines in your ~/.astkrc/prefs file (example with a sequential and a parallel versions):

vers : DEV:$HOME/dev/codeaster/install/std/share/aster
vers : DEV_MPI:$HOME/dev/codeaster/install/mpi/share/aster

Restart astk or refresh the configuration of the local server. The added versions should appear in the versions scroll-list.

In salome_meca, just click on the refresh icon near the server name to reload the server configuration.

Make your first development

Note: It is highly recommended to start every new development from the head of the default branch, after pulling the newer changesets:

cd $HOME/dev/codeaster/src
hg pull
hg up reference

Change the source code. For example, add a print in bibfor/op/op0001.F90

diff --git a/bibfor/op/op0001.F90 b/bibfor/op/op0001.F90
--- a/bibfor/op/op0001.F90
+++ b/bibfor/op/op0001.F90
@@ -89,6 +89,7 @@
     call infniv(ifm, niv)
     call getres(nomu, concep, cmd)
+    print *, "this print has been added in the LIRE_MAILLAGE operator"
     call getvis(' ', 'UNITE', 0, iarg, 1,&
                 ifl, iaux)

Rebuild code_aster to see your changes

./waf install

Without the -p/--progress option, the output is verbosy. If you scroll back, you can see the only the changed file has been recompiled:

[5052/7165] fc: bibfor/op/op0001.F90 -> build/release/bibfor/op/op0001.F90.1.o

Check and validate your changes on a relevant testcase

./waf test -n sslp114a

You can also run this testcase or a study of your choice in astk with your personal version.

Now use the power of Mercurial to commit your changes, share them by sending a pull-request...

If you enabled the aster extension the commit message must mention a bug id. You can use a trivial id for your personal work (for example [#0000] add a new feature).