Gromacs  2025.0-dev-20241011-013a99c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions
#include <filesystem>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include "gromacs/fileio/filetypes.h"
+ Include dependency graph for filenm.h:
+ This graph shows which files directly or indirectly include this file:

Description

Declares t_filenm for old-style command-line parsing of file name options.

Classes

class  gmx::ArrayRef< typename >
 STL-like interface to a C array of T (or part of a std container of T). More...
 
struct  t_filenm
 File name option definition for C code. More...
 

Macros

#define ffSET   1 << 0
 Whether a file name option is set.
 
#define ffREAD   1 << 1
 Whether a file name option specifies an input file.
 
#define ffWRITE   1 << 2
 Whether a file name option specifies an output file.
 
#define ffOPT   1 << 3
 Whether a file name option specifies an optional file.
 
#define ffLIB   1 << 4
 Whether a file name option specifies a library file.
 
#define ffMULT   1 << 5
 Whether a file name option accepts multiple file names.
 
#define ffALLOW_MISSING   1 << 6
 Whether an input file name option accepts non-existent files.
 
#define ffRW   (ffREAD | ffWRITE)
 Convenience flag for an input/output file.
 
#define ffOPTRD   (ffREAD | ffOPT)
 Convenience flag for an optional input file.
 
#define ffOPTWR   (ffWRITE | ffOPT)
 Convenience flag for an optional output file.
 
#define ffOPTRW   (ffRW | ffOPT)
 Convenience flag for an optional input/output file.
 
#define ffLIBRD   (ffREAD | ffLIB)
 Convenience flag for a library input file.
 
#define ffLIBOPTRD   (ffOPTRD | ffLIB)
 Convenience flag for an optional library input file.
 
#define ffRDMULT   (ffREAD | ffMULT)
 Convenience flag for an input file that accepts multiple files.
 
#define ffOPTRDMULT   (ffRDMULT | ffOPT)
 Convenience flag for an optional input file that accepts multiple files.
 
#define ffWRMULT   (ffWRITE | ffMULT)
 Convenience flag for an output file that accepts multiple files.
 
#define ffOPTWRMULT   (ffWRMULT | ffOPT)
 Convenience flag for an optional output file that accepts multiple files.
 
#define opt2FILE(opt, nfile, fnm, mode)   gmx_ffopen(opt2fn(opt, nfile, fnm), mode)
 Returns a file pointer from the filename.
 
#define ftp2FILE(ftp, nfile, fnm, mode)   gmx_ffopen(ftp2fn(ftp, nfile, fnm), mode)
 Returns a file pointer from the file type.
 

Functions

const char * opt2fn (const char *opt, int nfile, const t_filenm fnm[])
 Returns the filename belonging to cmd-line option opt, or NULL when no such option.
 
gmx::ArrayRef< const std::string > opt2fns (const char *opt, int nfile, const t_filenm fnm[])
 Returns the filenames belonging to cmd-line option opt. More...
 
gmx::ArrayRef< const std::string > opt2fnsIfOptionSet (const char *opt, int nfile, const t_filenm fnm[])
 Returns the filenames belonging to cmd-line option opt when set, returns an empty vector when the option is not set. More...
 
const char * ftp2fn (int ftp, int nfile, const t_filenm fnm[])
 Returns the first file name with type ftp, or NULL when none found.
 
gmx::ArrayRef< const std::string > ftp2fns (int ftp, int nfile, const t_filenm fnm[])
 Returns the filenames for the first option with type ftp. More...
 
bool ftp2bSet (int ftp, int nfile, const t_filenm fnm[])
 Returns TRUE when this file type has been found on the cmd-line.
 
bool opt2bSet (const char *opt, int nfile, const t_filenm fnm[])
 Returns TRUE when this option has been found on the cmd-line.
 
const char * opt2fn_null (const char *opt, int nfile, const t_filenm fnm[])
 DEPRECATED Returns the file name belonging top cmd-line option opt, or NULL when no such option. More...
 
std::optional
< std::filesystem::path > 
opt2path_optional (const char *opt, int nfile, const t_filenm fnm[])
 Returns the file name belonging top cmd-line option opt, or std::nullopt when no such option. More...
 
const char * ftp2fn_null (int ftp, int nfile, const t_filenm fnm[])
 DEPRECATED Returns the first file name with type ftp, or NULL when none found. More...
 
std::optional
< std::filesystem::path > 
ftp2path_optional (int ftp, int nfile, const t_filenm fnm[])
 Returns the first file name with type ftp, or std::nullopt when none found. More...
 
bool is_optional (const t_filenm *fnm)
 Returns whether or not this filenm is optional.
 
bool is_output (const t_filenm *fnm)
 Returns whether or not this filenm is output.
 
bool is_set (const t_filenm *fnm)
 Returns whether or not this filenm is set.
 
bool hasSuffixFromNoAppend (std::string_view filename)
 Return whether filename might have been produced by mdrun -noappend. More...
 
int add_suffix_to_output_names (t_filenm *fnm, int nfile, const char *suffix)
 When we do checkpointing, this routine is called to check for previous output files and append a '.partNNNN' suffix before the (output) file extensions. If there was already a '.partNNNN' suffix before the file extension, that is removed before the new suffix is added.