1 /* 2 * This file is part of the GROMACS molecular simulation package. 3 * 4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands. 5 * Copyright (c) 2001-2004, The GROMACS development team. 6 * Copyright (c) 2012,2014,2015,2017,2019,2020, by the GROMACS development team, led by 7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, 8 * and including many others, as listed in the AUTHORS file in the 9 * top-level source directory and at http://www.gromacs.org. 10 * 11 * GROMACS is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU Lesser General Public License 13 * as published by the Free Software Foundation; either version 2.1 14 * of the License, or (at your option) any later version. 15 * 16 * GROMACS is distributed in the hope that it will be useful, 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public 22 * License along with GROMACS; if not, see 23 * http://www.gnu.org/licenses, or write to the Free Software Foundation, 24 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 25 * 26 * If you want to redistribute modifications to GROMACS, please 27 * consider that scientific software is very special. Version 28 * control is crucial - bugs must be traceable. We will be happy to 29 * consider code for inclusion in the official distribution, but 30 * derived work must not be called official GROMACS. Details are found 31 * in the README & COPYING files - if they are missing, get the 32 * official version at http://www.gromacs.org. 33 * 34 * To help us fund GROMACS development, we humbly ask that you cite 35 * the research papers on the package. Check out http://www.gromacs.org. 36 */ 37 #ifndef GMX_FILEIO_OENV_H 38 #define GMX_FILEIO_OENV_H 39 40 #include <string> 41 42 #include "gromacs/utility/basedefinitions.h" 43 #include "gromacs/utility/real.h" 44 45 struct gmx_output_env_t; 46 47 /* output_env member functions */ 48 49 /* The output_env structure holds information about program name, cmd 50 line, default times, etc. along with verbosity levels for code 51 components that use this structure for regulating output. 52 53 There are still legacy functions for the program name, and the command 54 line, but the output_env versions are now preferred.*/ 55 56 namespace gmx 57 { 58 59 /*! \brief 60 * Time values for TimeUnitManager and legacy oenv module. 61 * 62 * \inpublicapi 63 */ 64 enum class TimeUnit : int 65 { 66 Femtoseconds, 67 Picoseconds, 68 Nanoseconds, 69 Microseconds, 70 Milliseconds, 71 Seconds, 72 Count, 73 Default = Picoseconds 74 }; 75 76 } // namespace gmx 77 78 //! The xvg output format 79 enum class XvgFormat : int 80 { 81 // Select, 82 Xmgrace, 83 Xmgr, 84 None, 85 Count 86 }; 87 88 void output_env_init_default(gmx_output_env_t** oenvp); 89 /* initialize an output_env structure, with reasonable default settings. 90 (the time unit is set to time_ps, which means no conversion). */ 91 92 void output_env_done(gmx_output_env_t* oenv); 93 /* free memory allocated for an output_env structure. */ 94 95 96 int output_env_get_verbosity(const gmx_output_env_t* oenv); 97 /* return the verbosity */ 98 99 int output_env_get_trajectory_io_verbosity(const gmx_output_env_t* oenv); 100 /* return the verbosity for trajectory IO handling */ 101 102 std::string output_env_get_time_unit(const gmx_output_env_t* oenv); 103 /* return time unit (e.g. ps or ns) */ 104 105 std::string output_env_get_time_label(const gmx_output_env_t* oenv); 106 /* return time unit label (e.g. "Time (ps)") */ 107 108 std::string output_env_get_xvgr_tlabel(const gmx_output_env_t* oenv); 109 /* return x-axis time label for xmgr */ 110 111 real output_env_get_time_factor(const gmx_output_env_t* oenv); 112 /* return time conversion factor from ps (i.e. 1e-3 for ps->ns) */ 113 114 real output_env_get_time_invfactor(const gmx_output_env_t* oenv); 115 /* return inverse time conversion factor to ps (i.e. 1e3 for ns->ps) */ 116 117 real output_env_conv_time(const gmx_output_env_t* oenv, real time); 118 /* return converted time */ 119 120 void output_env_conv_times(const gmx_output_env_t* oenv, int n, real* time); 121 /* convert array of times */ 122 123 gmx_bool output_env_get_view(const gmx_output_env_t* oenv); 124 /* Return TRUE when user requested viewing of the file */ 125 126 XvgFormat output_env_get_xvg_format(const gmx_output_env_t* oenv); 127 /* Returns enum (see above) for xvg output formatting */ 128 129 /*! \brief 130 * Returns display name for the currently running program. 131 */ 132 const char* output_env_get_program_display_name(const gmx_output_env_t* oenv); 133 134 namespace gmx 135 { 136 class IProgramContext; 137 } // namespace gmx 138 139 void output_env_init(gmx_output_env_t** oenvp, 140 const gmx::IProgramContext& context, 141 gmx::TimeUnit tmu, 142 gmx_bool view, 143 XvgFormat xvgFormat, 144 int verbosity); 145 /* initialize an output_env structure, setting the command line, 146 the default time value a gmx_boolean view that is set to TRUE when the 147 user requests direct viewing of graphs, 148 the graph formatting type, the verbosity, and debug level */ 149 150 /*! \brief 151 * Returns gmx::IProgramContext from an output_env structure. 152 */ 153 const gmx::IProgramContext& output_env_get_program_context(const gmx_output_env_t* oenv); 154 155 #endif 156