Octopus 16.0
real-space, real-time, TDDFT code
global.h File Reference
#include "config_F90.h"
#include "options.h"
#include "defaults.h"
Include dependency graph for global.h:

Go to the source code of this file.

Macros

#define _newline_   \newline
 
#define _anl_   & \newline
 
#define CARDINAL   _newline_
 
#define ACARDINAL   _anl_
 
#define ASSERT(expr)
 
#define FC_SIZEOF(x)   1
 
#define SAFE_ALLOCATE_PROFILE(x)
 
#define SAFE_ALLOCATE(x)
 
#define SAFE_ALLOCATE_TYPE(type, x)
 
#define SAFE_ALLOCATE_TYPE_ARRAY(type, x, bounds)
 
#define SAFE_ALLOCATE_SOURCE_P(x, y)
 
#define SAFE_ALLOCATE_SOURCE_A(x, y)
 
#define SAFE_ALLOCATE_SOURCE(x, y)
 
#define MY_DEALLOCATE(x)
 
#define SAFE_DEALLOCATE_P(x)
 
#define SAFE_DEALLOCATE_A(x)
 
#define SAFE_TOL(x, tol)   sign(max(abs(x),tol),x)
 
#define STRINGIFY(x)   #x
 
#define TOSTRING(x)   STRINGIFY(x)
 
#define PUSH_SUB(routine)
 
#define POP_SUB(routine)
 
#define PUSH_SUB_WITH_PROFILE(routine)
 
#define POP_SUB_WITH_PROFILE(routine)
 

Functions

 !Copyright (C) 2003-2006 M. Marques
 
either or (at your option) !! any later version. !! !! This program is distributed in the hope that it will be useful
 
!The assertions are ignored if the code is compiled in not debug mode (NDEBUG ! is defined). Otherwise it is merely a logical assertion that
 
!In one should normally use the SAFE_ (DE) ALLOCATE macros below
 
!Some versions of GCC have a bug in the sizeof () function such that the compiler crashes with a ICE ! when passing a polymorphic variable to the function and explicit array bounds are given. ! The workaround is not to pass the bounds to sizeof. Otherwise we could just use SAFE_ALLOCATE_TYPE. ! the TOSTRING macro converts a macro into a string ! do not use the STRINGIFY macro ! Whenever a procedure is not called too many times
 

Variables

Castro
 
A A Rubio
 
A A G Bertsch !This program is free software
 
you can redistribute it and or modify !it under the terms of the GNU General Public License as published by !the Free Software Foundation
 
either version
 
either !but WITHOUT ANY WARRANTY
 
without even the implied warranty of !MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the !GNU General Public License for more details !You should have received a copy of the GNU General Public License !along with this program
 
if not
 
if write to the Free Software !Foundation
 
if write to the Free Software Inc
 
if write to the Free Software Franklin Street
 
if write to the Free Software Franklin Fifth Floor
 
if write to the Free Software Franklin Fifth Boston
 
if write to the Free Software Franklin Fifth MA
 
if write to the Free Software Franklin Fifth USA !If the compiler accepts long Fortran lines
 
if write to the Free Software Franklin Fifth USA !If the compiler accepts long Fortran it is better to use that !capacity
 
if write to the Free Software Franklin Fifth USA !If the compiler accepts long Fortran it is better to use that and build all the preprocessor definitions in one line In !this way
 
!If the compiler accepts line number markers
 
!If the compiler accepts line number then CARDINAL and ACARDINAL !will put them Otherwise
 
!The assertions are ignored if the code is compiled in not debug when fails
 
!The assertions are ignored if the code is compiled in not debug when !prints out the assertion string
 
!The assertions are ignored if the code is compiled in not debug when !prints out the assertion the file
 
!In octopus
 
!in the code
 
!Some versions of GCC have a bug in the one should start it !and finish it with the PUSH_SUB and POP_SUB macros
 

Macro Definition Documentation

◆ _newline_

#define _newline_   \newline

◆ _anl_

#define _anl_   & \newline

◆ CARDINAL

#define CARDINAL   _newline_

◆ ACARDINAL

#define ACARDINAL   _anl_

◆ ASSERT

#define ASSERT (   expr)
Value:
if(.not.(expr)) ACARDINAL \
call assert_die(TOSTRING(expr), ACARDINAL __FILE__, ACARDINAL __LINE__) \
#define ACARDINAL
Definition: global.h:51
#define CARDINAL
Definition: global.h:50
#define TOSTRING(x)
if not
Definition: global.h:14

◆ FC_SIZEOF

#define FC_SIZEOF (   x)    1

◆ SAFE_ALLOCATE_PROFILE

#define SAFE_ALLOCATE_PROFILE (   x)
Value:
if(not_in_openmp() .and. iand(prof_vars%mode, PROFILING_MEMORY).ne.0 .or. global_alloc_err.ne.0) ACARDINAL \
if(iand(prof_vars%mode, PROFILING_MEMORY).ne.0) ACARDINAL \
call profiling_memory_allocate(ACARDINAL TOSTRING(x), ACARDINAL __FILE__, ACARDINAL __LINE__, ACARDINAL global_sizeof); CARDINAL \
if(global_alloc_err.ne.0) ACARDINAL \
call alloc_error(global_sizeof, ACARDINAL __FILE__, ACARDINAL __LINE__); \
#define FC_SIZEOF(x)
Definition: global.h:75
!The assertions are ignored if the code is compiled in not debug mode(NDEBUG ! is defined). Otherwise it is merely a logical assertion that
if(it==(*map) ->end())
Definition: iihash_low.cc:52
void const double * x
Definition: spline_low.cc:50

◆ SAFE_ALLOCATE

#define SAFE_ALLOCATE (   x)
Value:
allocate( ACARDINAL x, ACARDINAL stat=global_alloc_err); CARDINAL \
#define SAFE_ALLOCATE_PROFILE(x)
Definition: global.h:124

◆ SAFE_ALLOCATE_TYPE

#define SAFE_ALLOCATE_TYPE (   type,
  x 
)
Value:
allocate( ACARDINAL type::x, ACARDINAL stat=global_alloc_err); CARDINAL \

◆ SAFE_ALLOCATE_TYPE_ARRAY

#define SAFE_ALLOCATE_TYPE_ARRAY (   type,
  x,
  bounds 
)
Value:
allocate( ACARDINAL type::x bounds, ACARDINAL stat=global_alloc_err); CARDINAL \
if(not_in_openmp() .and. iand(prof_vars%mode, PROFILING_MEMORY).ne.0 .or. global_alloc_err.ne.0) ACARDINAL \
if(iand(prof_vars%mode, PROFILING_MEMORY).ne.0) ACARDINAL \
call profiling_memory_allocate(ACARDINAL TOSTRING(x)+TOSTRING(bounds), ACARDINAL __FILE__, ACARDINAL __LINE__, ACARDINAL global_sizeof); CARDINAL \
if(global_alloc_err.ne.0) ACARDINAL \
call alloc_error(global_sizeof, ACARDINAL __FILE__, ACARDINAL __LINE__); \

◆ SAFE_ALLOCATE_SOURCE_P

#define SAFE_ALLOCATE_SOURCE_P (   x,
  y 
)
Value:
if(associated(y)) then; CARDINAL \
allocate( ACARDINAL x, ACARDINAL source=y, ACARDINAL stat=global_alloc_err); CARDINAL \
else; CARDINAL \
nullify(x); CARDINAL \
end if; \
CARDINAL
else
Definition: iihash_low.cc:54
void const double const double * y
Definition: spline_low.cc:51

◆ SAFE_ALLOCATE_SOURCE_A

#define SAFE_ALLOCATE_SOURCE_A (   x,
  y 
)
Value:
if(allocated(y)) then; CARDINAL \
allocate( ACARDINAL x, ACARDINAL source=y, ACARDINAL stat=global_alloc_err); CARDINAL \
end if; \
CARDINAL

◆ SAFE_ALLOCATE_SOURCE

#define SAFE_ALLOCATE_SOURCE (   x,
  y 
)
Value:
allocate( ACARDINAL x, ACARDINAL source=y, ACARDINAL stat=global_alloc_err); CARDINAL \
CARDINAL

◆ MY_DEALLOCATE

#define MY_DEALLOCATE (   x)
Value:
global_sizeof = FC_SIZEOF(x) ; \
CARDINAL \
deallocate(x, stat=global_alloc_err, errmsg=global_alloc_errmsg); CARDINAL \
if(not_in_openmp() .and. iand(prof_vars%mode, PROFILING_MEMORY).ne.0) ACARDINAL \
call profiling_memory_deallocate(TOSTRING(x), ACARDINAL __FILE__, ACARDINAL __LINE__, ACARDINAL global_sizeof); CARDINAL \
if(global_alloc_err.ne.0) then; CARDINAL \
write(stderr,'(a)') global_alloc_errmsg; CARDINAL \
call dealloc_error(global_sizeof, ACARDINAL __FILE__, ACARDINAL __LINE__); CARDINAL \
end if; \
double const double * a
Definition: spline_low.cc:120

◆ SAFE_DEALLOCATE_P

#define SAFE_DEALLOCATE_P (   x)
Value:
if(associated(x)) then; CARDINAL \
MY_DEALLOCATE(x); CARDINAL \
nullify(x); CARDINAL \
end if; \
CARDINAL
#define MY_DEALLOCATE(x)

◆ SAFE_DEALLOCATE_A

#define SAFE_DEALLOCATE_A (   x)
Value:
if(allocated(x)) then; CARDINAL \
MY_DEALLOCATE(x); CARDINAL \
end if; \
CARDINAL

◆ SAFE_TOL

#define SAFE_TOL (   x,
  tol 
)    sign(max(abs(x),tol),x)

◆ STRINGIFY

#define STRINGIFY (   x)    #x

◆ TOSTRING

#define TOSTRING (   x)    STRINGIFY(x)

◆ PUSH_SUB

#define PUSH_SUB (   routine)
Value:
if(debug%trace .or. debug%instrument) then; if(not_in_openmp()) then; CARDINAL \
call debug_push_sub(__FILE__+"." ACARDINAL +TOSTRING(routine)); CARDINAL \
endif; endif; \
CARDINAL
either or(at your option) !! any later version. !! !! This program is distributed in the hope that it will be useful

◆ POP_SUB

#define POP_SUB (   routine)
Value:
if(debug%trace .or. debug%instrument) then; if(not_in_openmp()) then; CARDINAL \
call debug_pop_sub(__FILE__+"." ACARDINAL +TOSTRING(routine)); CARDINAL \
endif; endif; \
CARDINAL

◆ PUSH_SUB_WITH_PROFILE

#define PUSH_SUB_WITH_PROFILE (   routine)
Value:
PUSH_SUB(routine) CARDINAL \
call profiling_in(TOSTRING(routine)); CARDINAL
#define PUSH_SUB(routine)
Definition: global.h:218

◆ POP_SUB_WITH_PROFILE

#define POP_SUB_WITH_PROFILE (   routine)
Value:
call profiling_out(TOSTRING(routine)); CARDINAL \
#define POP_SUB(routine)
Definition: global.h:223

Function Documentation

◆ !Copyright()

!Copyright ( )

◆ or()

either or ( at your  option)

◆ mode()

!The assertions are ignored if the code is compiled in not debug mode ( NDEBUG ! is  defined)

◆ SAFE_()

!In one should normally use the SAFE_ ( DE  )

◆ sizeof()

!Some versions of GCC have a bug in the sizeof ( )

Variable Documentation

◆ Castro

A Castro

◆ Rubio

A A Rubio

◆ software

A A G Bertsch !This program is free software

◆ Foundation

you can redistribute it and or modify !it under the terms of the GNU General Public License as published by !the Free Software Foundation

◆ version

either version

◆ WARRANTY

either !but WITHOUT ANY WARRANTY

◆ program

without even the implied warranty of !MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE See the !GNU General Public License for more details !You should have received a copy of the GNU General Public License !along with this program

◆ not

if not

◆ !Foundation

if write to the Free Software !Foundation

◆ Inc

if write to the Free Software Inc

◆ Street

if write to the Free Software Franklin Street

◆ Floor

if write to the Free Software Franklin Fifth Floor

◆ Boston

if write to the Free Software Franklin Fifth Boston

◆ MA

if write to the Free Software Franklin Fifth MA

◆ lines

if write to the Free Software Franklin Fifth USA !If the compiler accepts long Fortran lines

◆ !capacity

if write to the Free Software Franklin Fifth USA !If the compiler accepts long Fortran it is better to use that !capacity

◆ way

if write to the Free Software Franklin Fifth USA !If the compiler accepts long Fortran it is better to use that and build all the preprocessor definitions in one line In !this way

◆ markers

!If the compiler accepts line number markers

◆ Otherwise

!If the compiler accepts line number then CARDINAL and ACARDINAL !will put them Otherwise

◆ fails

!The assertions are ignored if the code is compiled in not debug when fails

◆ string

!The assertions are ignored if the code is compiled in not debug when !prints out the assertion string

◆ file

!In one should normally use the which emit !a helpful error if the allocation or deallocation fails They also take care of !calling the memory profiler The MY_DEALLOCATE macro is only used in this file

◆ octopus

!In octopus

◆ code

!in the code

◆ macros

!Some versions of GCC have a bug in the one should start it !and finish it with the PUSH_SUB and POP_SUB macros