Report Typos and Errors    
Semi-Lagrangian Library
Modular library for kinetic and gyrokinetic simulations of plasmas in fusion energy devices.
sll_m_assert.F90
Go to the documentation of this file.
1 !**************************************************************
2 ! Copyright INRIA
3 ! Authors :
4 ! CALVI project team
5 !
6 ! This code SeLaLib (for Semi-Lagrangian-Library)
7 ! is a parallel library for simulating the plasma turbulence
8 ! in a tokamak.
9 !
10 ! This software is governed by the CeCILL-B license
11 ! under French law and abiding by the rules of distribution
12 ! of free software. You can use, modify and redistribute
13 ! the software under the terms of the CeCILL-B license as
14 ! circulated by CEA, CNRS and INRIA at the following URL
15 ! "http://www.cecill.info".
16 !**************************************************************
17 #ifndef DOXYGEN_SHOULD_SKIP_THIS
18 
19 module sll_m_assert
20 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifdef MPI_VERSION
22  use mpi
23 #endif
24  implicit none
25 
26  public :: &
27  sll_s_assertion
28 
29  private
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32  ! Instead of using the non-standard subroutine abort() provided by the compiler,
33  ! use abort() from the C standard library "stdlib.h"
34  interface
35  subroutine c_abort() bind(C, name="abort")
36  end subroutine
37  end interface
38 
39 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
40 contains
41 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
42 
43  ! This routine just takes the information about the assertion error and
44  ! writes it on the screen.
45  ! This function is only meant to be used by the assert macro. No Doxygen
46  ! documentation needed.
47  subroutine sll_s_assertion(msg, file, line)
48  character(len=*), intent(in) :: msg
49  character(len=*), intent(in) :: file
50  integer, intent(in) :: line
51 
52  write (*, *)
53  write (*, '(a)') "ASSERTION FAILURE: condition ( "//trim(msg)//" ) is not satisfied."
54  write (*, '(a,i0)') 'Triggered at '//file//':', line
55 
56 #ifdef MPI_VERSION
57  call mpi_abort()
58 #else
59  call c_abort()
60 #endif
61 
62  end subroutine sll_s_assertion
63 
64 end module sll_m_assert
65 
66 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
    Report Typos and Errors