Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalFMM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
solverstack
ScalFMM
Commits
38606790
Commit
38606790
authored
10 years ago
by
BRAMAS Berenger
Browse files
Options
Downloads
Patches
Plain Diff
Add a show info (host and time) and do not quit if show info or show compile is call
parent
a1123352
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Src/Utils/FParameterNames.hpp
+27
-6
27 additions, 6 deletions
Src/Utils/FParameterNames.hpp
with
27 additions
and
6 deletions
Src/Utils/FParameterNames.hpp
+
27
−
6
View file @
38606790
...
...
@@ -24,6 +24,8 @@
#include
<iostream>
#include
<vector>
#include
<chrono>
#include
<unistd.h>
/**
* This file contains some useful classes/functions to manage the parameters,
...
...
@@ -50,6 +52,11 @@ static const FParameterNames Compile = {
"To have the list of flags and lib linked to scalfmm."
};
static
const
FParameterNames
DateHost
=
{
{
"-show-info"
,
"--show-host"
,
"--datehost"
}
,
"To have to print the current host and the execution date."
};
static
const
FParameterNames
NbParticles
=
{
{
"-nb"
,
"--number-of-particles"
,
"-N"
}
,
"The number of particles if they are generated by the executable."
...
...
@@ -185,8 +192,18 @@ inline void PrintUsedOptions(const std::vector<FParameterNames>& options){
inline
void
PrintFlags
(){
std
::
cout
<<
"This executable has been compiled with:
\n
"
;
std
::
cout
<<
"Flags = "
<<
SCALFMMCompileFlags
<<
"
\n
"
;
std
::
cout
<<
"Libs = "
<<
SCALFMMCompileLibs
<<
"
\n
"
;
std
::
cout
<<
"× Flags = "
<<
SCALFMMCompileFlags
<<
"
\n
"
;
std
::
cout
<<
"× Libs = "
<<
SCALFMMCompileLibs
<<
"
\n
"
;
std
::
cout
.
flush
();
}
inline
void
PrintDateHost
(){
std
::
cout
<<
"This execution is on:
\n
"
;
std
::
time_t
now
=
std
::
chrono
::
system_clock
::
to_time_t
(
std
::
chrono
::
system_clock
::
now
());
std
::
cout
<<
"× Date = "
<<
std
::
ctime
(
&
now
)
<<
"
\n
"
;
char
hostname
[
1024
];
gethostname
(
hostname
,
1024
);
std
::
cout
<<
"× Host = "
<<
hostname
<<
"
\n
"
;
std
::
cout
.
flush
();
}
...
...
@@ -198,10 +215,12 @@ inline void PrintFlags(){
#define FHelpAndExit(argc, argv, ...) \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::Compile.options)) {\
FParameterDefinitions::PrintFlags();\
return 0;\
} \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::DateHost.options)) {\
FParameterDefinitions::PrintDateHost();\
} \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::Help.options)) {\
const std::vector<FParameterNames> optionsvec = {__VA_ARGS__};\
const std::vector<FParameterNames> optionsvec = {
FParameterDefinitions::Compile, FParameterDefinitions::DateHost,
__VA_ARGS__};\
FParameterDefinitions::PrintUsedOptions(optionsvec);\
return 0;\
} \
...
...
@@ -214,11 +233,13 @@ inline void PrintFlags(){
#define FHelpDescribeAndExit(argc, argv, description, ...) \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::Compile.options)) {\
FParameterDefinitions::PrintFlags();\
return 0;\
} \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::DateHost.options)) {\
FParameterDefinitions::PrintDateHost();\
} \
if(FParameters::existParameter(argc, argv, FParameterDefinitions::Help.options)) {\
std::cout << argv[0] << " : " << description << "\n"; \
const std::vector<FParameterNames> optionsvec = {__VA_ARGS__};\
const std::vector<FParameterNames> optionsvec = {
FParameterDefinitions::Compile, FParameterDefinitions::DateHost,
__VA_ARGS__};\
FParameterDefinitions::PrintUsedOptions(optionsvec);\
return 0;\
} \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment