Skip to content

Commit

Permalink
Make C comments Doxygen compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed Sep 3, 2020
1 parent cb12269 commit 0f62ca9
Show file tree
Hide file tree
Showing 35 changed files with 972 additions and 972 deletions.
18 changes: 9 additions & 9 deletions src/base/machine_cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
extern "C" {
#endif

//******************************************************************************
// \brief This routine determines the CPUID according to the given compiler
// flags (expected to be similar to Fortran). Similar to other Fortran
// compilers, "gfortran -E -dM -mavx - < /dev/null | grep AVX" defines a
// variety of predefined macros (also similar to C). However, with a
// Fortran translation unit only a subset of these definitions disappears
// ("gfortran -E -dM -mavx my.F | grep AVX")
// hence an implementation in C is used.
//******************************************************************************
/*******************************************************************************
* \brief This routine determines the CPUID according to the given compiler
* flags (expected to be similar to Fortran). Similar to other Fortran
* compilers, "gfortran -E -dM -mavx - < /dev/null | grep AVX" defines a
* variety of predefined macros (also similar to C). However, with a
* Fortran translation unit only a subset of these definitions disappears
* ("gfortran -E -dM -mavx my.F | grep AVX")
* hence an implementation in C is used.
******************************************************************************/
int m_cpuid_static(void); /* avoid pedantic warning about missing prototype */
int m_cpuid_static(void) {
#if (__AVX512F__ && __AVX512CD__ && __AVX2__ && __FMA__ && __AVX__ && \
Expand Down
18 changes: 9 additions & 9 deletions src/grid/common/grid_basis_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

#include "grid_basis_set.h"

//******************************************************************************
// \brief Allocates a basis set which can be passed to grid_create_task_list.
// See grid_task_list.h for details.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Allocates a basis set which can be passed to grid_create_task_list.
* See grid_task_list.h for details.
* \author Ole Schuett
******************************************************************************/
void grid_create_basis_set(const int nset, const int nsgf, const int maxco,
const int maxpgf, const int lmin[nset],
const int lmax[nset], const int npgf[nset],
Expand Down Expand Up @@ -51,10 +51,10 @@ void grid_create_basis_set(const int nset, const int nsgf, const int maxco,
*basis_set_out = basis_set;
}

//******************************************************************************
// \brief Deallocates given basis set.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Deallocates given basis set.
* \author Ole Schuett
******************************************************************************/
void grid_free_basis_set(grid_basis_set *basis_set) {
free(basis_set->lmin);
free(basis_set->lmax);
Expand Down
60 changes: 30 additions & 30 deletions src/grid/common/grid_basis_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
#ifndef GRID_BASIS_SET_H
#define GRID_BASIS_SET_H

//******************************************************************************
// \brief Internal representation of a basis set.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Internal representation of a basis set.
* \author Ole Schuett
******************************************************************************/
typedef struct {
int nset;
int nsgf;
Expand All @@ -25,28 +25,28 @@ typedef struct {
double *zet;
} grid_basis_set;

//******************************************************************************
// \brief Allocates a basis set which can be passed to grid_create_task_list.
//
// \param nset Number of sets this basis is composed of.
// \param nsgf Size of contracted spherical basis, ie. the block size
// \param maxco Maximum number of Cartesian functions across all sets.
// \param maxpgf Maximum number of primitive Gaussians across all sets.
//
// The following params are given for each set:
//
// \param lmin Lowest angular momentum.
// \param lmax Highest angular momentum.
// \param npgf Number of primitive Gaussians, ie. exponents.
// \param nsgf_set Number of spherical basis functions
// \param first_sgf Index of first spherical basis function (one based).
// \param sphi Transformation matrix for (de-)contracting the basis.
// \param zet Exponents of primitive Gaussians.
//
// \param basis_set Handle to the created basis set.
//
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Allocates a basis set which can be passed to grid_create_task_list.
*
* \param nset Number of sets this basis is composed of.
* \param nsgf Size of contracted spherical basis, ie. the block size
* \param maxco Maximum number of Cartesian functions across all sets.
* \param maxpgf Maximum number of primitive Gaussians across all sets.
*
* The following params are given for each set:
*
* \param lmin Lowest angular momentum.
* \param lmax Highest angular momentum.
* \param npgf Number of primitive Gaussians, ie. exponents.
* \param nsgf_set Number of spherical basis functions
* \param first_sgf Index of first spherical basis function (one based).
* \param sphi Transformation matrix for (de-)contracting the basis.
* \param zet Exponents of primitive Gaussians.
*
* \param basis_set Handle to the created basis set.
*
* \author Ole Schuett
******************************************************************************/
void grid_create_basis_set(const int nset, const int nsgf, const int maxco,
const int maxpgf, const int lmin[nset],
const int lmax[nset], const int npgf[nset],
Expand All @@ -55,10 +55,10 @@ void grid_create_basis_set(const int nset, const int nsgf, const int maxco,
const double zet[nset][maxpgf],
grid_basis_set **basis_set);

//******************************************************************************
// \brief Deallocates given basis set.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Deallocates given basis set.
* \author Ole Schuett
******************************************************************************/
void grid_free_basis_set(grid_basis_set *basis_set);

#endif
Expand Down
34 changes: 17 additions & 17 deletions src/grid/common/grid_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
#ifndef GRID_COMMON_H
#define GRID_COMMON_H

//******************************************************************************
// \brief Number of Cartesian orbitals up to given angular momentum quantum.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Number of Cartesian orbitals up to given angular momentum quantum.
* \author Ole Schuett
******************************************************************************/
static const int ncoset[] = {1, // l=0
4, // l=1
10, // l=2 ...
20, 35, 56, 84, 120, 165, 220, 286,
364, 455, 560, 680, 816, 969, 1140, 1330};

//******************************************************************************
// \brief Tabulation of the Factorial function, e.g. 5! = fac[5] = 120.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Tabulation of the Factorial function, e.g. 5! = fac[5] = 120.
* \author Ole Schuett
******************************************************************************/
static const double fac[] = {
0.10000000000000000000E+01, 0.10000000000000000000E+01,
0.20000000000000000000E+01, 0.60000000000000000000E+01,
Expand All @@ -39,18 +39,18 @@ static const double fac[] = {
0.30488834461171386050E+30, 0.88417619937397019545E+31,
0.26525285981219105864E+33};

//******************************************************************************
// \brief Minimum and maximum for integers (missing from the C standard)
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Minimum and maximum for integers (missing from the C standard)
* \author Ole Schuett
******************************************************************************/
static inline int imin(int x, int y) { return (x < y ? x : y); }
static inline int imax(int x, int y) { return (x > y ? x : y); }

//******************************************************************************
// \brief Equivalent of Fortran's MODULO, which always return a positive number.
// https://gcc.gnu.org/onlinedocs/gfortran/MODULO.html
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Equivalent of Fortran's MODULO, which always return a positive number.
* https://gcc.gnu.org/onlinedocs/gfortran/MODULO.html
* \author Ole Schuett
******************************************************************************/
static inline int modulo(int a, int m) { return ((a % m + m) % m); }

#endif // GRID_COMMON_H
Expand Down
56 changes: 28 additions & 28 deletions src/grid/common/grid_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ static bool library_initialized = false;
static grid_library_config config = {.backend = GRID_BACKEND_AUTO,
.validate = false};

//******************************************************************************
// \brief Initializes the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Initializes the grid library.
* \author Ole Schuett
******************************************************************************/
void grid_library_init() {
if (library_initialized) {
printf("Error: Grid library was already initialized.\n");
Expand All @@ -44,10 +44,10 @@ void grid_library_init() {
library_initialized = true;
}

//******************************************************************************
// \brief Finalizes the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Finalizes the grid library.
* \author Ole Schuett
******************************************************************************/
void grid_library_finalize() {
if (!library_initialized) {
printf("Error: Grid library is not initialized.\n");
Expand All @@ -62,35 +62,35 @@ void grid_library_finalize() {
library_initialized = false;
}

//******************************************************************************
// \brief Configures the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Configures the grid library.
* \author Ole Schuett
******************************************************************************/
void grid_library_set_config(const int backend, const bool validate) {
config.backend = backend;
config.validate = validate;
}

//******************************************************************************
// \brief Returns the library config.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Returns the library config.
* \author Ole Schuett
******************************************************************************/
grid_library_config grid_library_get_config() { return config; }

//******************************************************************************
// \brief Internal helper for summing two sets of counters.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Internal helper for summing two sets of counters.
* \author Ole Schuett
******************************************************************************/
static void sum_stats(const grid_library_stats increment,
grid_library_stats *accumulator) {
accumulator->ref_collocate_ortho += increment.ref_collocate_ortho;
accumulator->ref_collocate_general += increment.ref_collocate_general;
}

//******************************************************************************
// \brief Increment global counters by given values.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Increment global counters by given values.
* \author Ole Schuett
******************************************************************************/
void grid_library_gather_stats(const grid_library_stats increment) {
if (!library_initialized) {
printf("Error: Grid library is not initialized.\n");
Expand All @@ -99,10 +99,10 @@ void grid_library_gather_stats(const grid_library_stats increment) {
sum_stats(increment, per_thread_stats[omp_get_thread_num()]);
}

//******************************************************************************
// \brief Prints statistics gathered by the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Prints statistics gathered by the grid library.
* \author Ole Schuett
******************************************************************************/
void grid_library_print_stats(void (*mpi_sum_func)(long *, int),
const int mpi_comm,
void (*print_func)(char *, int),
Expand Down
66 changes: 33 additions & 33 deletions src/grid/common/grid_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,60 @@

#include <stdbool.h>

//******************************************************************************
// \brief Initializes the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Initializes the grid library.
* \author Ole Schuett
******************************************************************************/
void grid_library_init();

//******************************************************************************
// \brief Finalizes the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Finalizes the grid library.
* \author Ole Schuett
******************************************************************************/
void grid_library_finalize();

//******************************************************************************
// \brief Configuration of the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Configuration of the grid library.
* \author Ole Schuett
******************************************************************************/
typedef struct {
int backend; // Selectes the backend to be used by the grid library.
bool validate; // When true the reference backend runs in shadow mode.
} grid_library_config;

//******************************************************************************
// \brief Configures the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Configures the grid library.
* \author Ole Schuett
******************************************************************************/
void grid_library_set_config(int backend, bool validate);

//******************************************************************************
// \brief Returns the library config.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Returns the library config.
* \author Ole Schuett
******************************************************************************/
grid_library_config grid_library_get_config();

//******************************************************************************
// \brief Prints statistics gathered by the grid library.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Prints statistics gathered by the grid library.
* \author Ole Schuett
******************************************************************************/
void grid_library_print_stats(void (*mpi_sum_func)(long *, int), int mpi_comm,
void (*print_func)(char *, int), int output_unit);

//******************************************************************************
// \brief All exiting counters. When adding a counter also update functions
// internal_add_stats() and grid_library_print_counters().
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief All exiting counters. When adding a counter also update functions
* internal_add_stats() and grid_library_print_counters().
* \author Ole Schuett
******************************************************************************/
typedef struct {
long ref_collocate_ortho;
long ref_collocate_general;
} grid_library_stats;

//******************************************************************************
// \brief Increment global counters by given values.
// \author Ole Schuett
//******************************************************************************
/*******************************************************************************
* \brief Increment global counters by given values.
* \author Ole Schuett
******************************************************************************/
void grid_library_gather_stats(grid_library_stats increment);

#endif // GRID_LIBRARY_H
Expand Down

0 comments on commit 0f62ca9

Please sign in to comment.