Alamo
FileNameParse.H
Go to the documentation of this file.
1//
2// ============================================
3// :fas:`file-code;fa-fw` Filename parsing
4// ============================================
5//
6// The :code:`plot_file` input defines the simulation output directory. Alamo
7// supports time and dimension wildcards, input-variable substitution, and
8// Slurm environment substitution in this value.
9//
10// Time and dimension wildcards
11// ----------------------------
12//
13// The following wildcard strings are available:
14//
15// .. code-block:: text
16//
17// %Y Four-digit year
18// %m Two-digit month (01-12)
19// %d Two-digit day of the month (01-31)
20// %H Two-digit hour (00-23)
21// %M Two-digit minute (00-59)
22// %S Two-digit second (00-59)
23// %f Microseconds within the current second
24// %D Spatial dimension
25//
26// For example:
27//
28// .. code-block:: makefile
29//
30// plot_file = output_%Y%m%d_%H%M%S
31//
32// may resolve to:
33//
34// .. code-block:: text
35//
36// output_20250307_211201
37//
38// Input variable substitution
39// ---------------------------
40//
41// Use braces to substitute a variable from the input file:
42//
43// .. code-block:: makefile
44//
45// myinput.value = 3
46// plot_file = output_{myinput.value}
47//
48// This resolves the output directory to:
49//
50// .. code-block:: text
51//
52// output_3
53//
54// Slurm environment substitution
55// ------------------------------
56//
57// Any brace-delimited variable whose name begins with :code:`SLURM_` is read
58// from the process environment. Common substitutions include:
59//
60// .. code-block:: text
61//
62// {SLURM_JOB_ID}
63// {SLURM_JOB_NAME}
64// {SLURM_JOB_PARTITION}
65// {SLURM_CLUSTER_NAME}
66// {SLURM_ARRAY_TASK_ID}
67//
68// For example:
69//
70// .. code-block:: makefile
71//
72// plot_file = output_{SLURM_JOB_ID}
73//
74// may resolve to:
75//
76// .. code-block:: text
77//
78// output_314159
79//
80// If the requested variable is unavailable or empty, its name is retained
81// without braces:
82//
83// .. code-block:: text
84//
85// output_SLURM_JOB_ID
86
87#ifndef IO_FILENAMEPARSE_H
88#define IO_FILENAMEPARSE_H
89
90#include <string>
91
92
93namespace IO
94{
95
96void FileNameParse(std::string &filename);
97
98}
99
100#endif
void FileNameParse(std::string &filename)
Internal function to do processing of the file name.