From 078c6bff27c236d731cdecd82917d61a7e52b9a8 Mon Sep 17 00:00:00 2001 From: Chichi Lalescu <chichilalescu@gmail.com> Date: Mon, 19 Jun 2017 23:37:27 +0200 Subject: [PATCH] begin basic documentation --- bfps/cpp/field.hpp | 29 +++++++++++++++++++++-------- bfps/cpp/full_code/code_base.hpp | 15 +++++++++++++++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/bfps/cpp/field.hpp b/bfps/cpp/field.hpp index 29c078bb..82ce7afa 100644 --- a/bfps/cpp/field.hpp +++ b/bfps/cpp/field.hpp @@ -35,6 +35,20 @@ #define FIELD_HPP +/** \class field + * \brief Holds field data, performs FFTs and HDF5 I/O operations. + * + * The purpose of this class is to manage memory for field data, create/destroy + * FFT plans for them, and compute HDF5 input/output operations. + * + * FFTW recommendations are to create different plans for different arrays, + * hence the plans are member variables. + * All plans are for in-place transforms, since even with out-of-place transforms + * there are no guarantees that input data is not messed up by an inverse FFT, so + * there's no point in wasting the memory. + * + * + */ template <typename rnumber, field_backend be, @@ -42,19 +56,18 @@ template <typename rnumber, class field { private: - /* data arrays */ - rnumber *__restrict__ data; + rnumber *__restrict__ data; /**< data array */ public: - hsize_t npoints; - bool real_space_representation; - /* basic MPI information */ - int myrank, nprocs; - MPI_Comm comm; + hsize_t npoints; /**< total number of grid points. Useful for normalization. */ + bool real_space_representation; /**< `true` if field is in real space representation. */ + + int myrank, nprocs; /**< basic MPI information. */ + MPI_Comm comm; /**< MPI communicator this fields lives in. */ /* descriptions of field layout and distribution */ /* for the FFTW backend, at least, the real space field requires more * space to be allocated than strictly needed for the data, hence the - * two layout descriptors. + * two real space layout descriptors. * */ field_layout<fc> *clayout, *rlayout, *rmemlayout; diff --git a/bfps/cpp/full_code/code_base.hpp b/bfps/cpp/full_code/code_base.hpp index 08a234b7..cf0521e2 100644 --- a/bfps/cpp/full_code/code_base.hpp +++ b/bfps/cpp/full_code/code_base.hpp @@ -32,6 +32,21 @@ #include <sys/stat.h> #include "base.hpp" +/** \class code_base + * \brief Defines basic timer and method to check stopping condition. + * + * Any computational task will consist of a loop over temporal snapshots, be it + * a simulation or a postprocessing job. + * This class declares the three required methods (initialize, step and finalize + * functionalities). + * Implementation should be done in children classes, since it will be different + * for simulations or postprocessing jobs. + * + * What the class actually implements is a basic timer (calls to system clock), + * and a method to check for a stopping condition. + * These are meant to be used by children classes as needed. + */ + class code_base { private: -- GitLab