LCOV - code coverage report
Current view: top level - src/grpp - grpp_init_finalize.c (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:b4bd748) Lines: 8 13 61.5 %
Date: 2025-03-09 07:56:22 Functions: 2 3 66.7 %

          Line data    Source code
       1             : /*----------------------------------------------------------------------------*/
       2             : /*  CP2K: A general program to perform molecular dynamics simulations         */
       3             : /*  Copyright 2000-2025 CP2K developers group <https://cp2k.org>              */
       4             : /*                                                                            */
       5             : /*  SPDX-License-Identifier: MIT                                              */
       6             : /*----------------------------------------------------------------------------*/
       7             : 
       8             : /*
       9             :  *  libgrpp - a library for the evaluation of integrals over
      10             :  *            generalized relativistic pseudopotentials.
      11             :  *
      12             :  *  Copyright (C) 2021-2023 Alexander Oleynichenko
      13             :  */
      14             : 
      15             : #include "libgrpp.h"
      16             : 
      17             : void libgrpp_create_real_spherical_harmonic_coeffs_tables(int Lmax);
      18             : void libgrpp_pretabulate_bessel();
      19             : 
      20             : static int libgrpp_initialized = 0;
      21             : 
      22             : /**
      23             :  * thread-safe initialization
      24             :  */
      25       11380 : void libgrpp_init() {
      26       22760 : #pragma omp critical
      27             :   {
      28       11380 :     if (libgrpp_initialized == 0) {
      29          14 :       libgrpp_create_real_spherical_harmonic_coeffs_tables(40);
      30          14 :       libgrpp_pretabulate_bessel();
      31             : 
      32          14 :       libgrpp_initialized = 1;
      33             :     }
      34             :   }
      35       11380 : }
      36             : 
      37      149632 : int libgrpp_is_initialized() { return libgrpp_initialized; }
      38             : 
      39             : /**
      40             :  * thread-safe finalization
      41             :  */
      42           0 : void libgrpp_finalize() {
      43           0 : #pragma omp critical
      44             :   {
      45           0 :     if (libgrpp_initialized == 1) {
      46           0 :       libgrpp_initialized = 0;
      47             :     }
      48             :   }
      49           0 : }

Generated by: LCOV version 1.15