Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Seitosh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Seitosh
Seitosh
Commits
ee7fac4d
Commit
ee7fac4d
authored
Oct 31, 2019
by
thomas.forbriger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
randomseries [NEW][WP]: start new program randomseries
parent
bdb5ad13
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
158 additions
and
1 deletion
+158
-1
src/synt/misc/Makefile
src/synt/misc/Makefile
+6
-1
src/synt/misc/randomseries.cc
src/synt/misc/randomseries.cc
+152
-0
No files found.
src/synt/misc/Makefile
View file @
ee7fac4d
...
...
@@ -35,7 +35,8 @@
PROGRAMS
=
dispfield kette planefield coupledoscillators
\
dispfieldx lamb lambx modeinterference
\
siggen tesiff teswf hamres siggenx phasedsignals
siggen tesiff teswf hamres siggenx phasedsignals
\
randomseries
# gez does not compile correctly
.PHONY
:
all
...
...
@@ -109,6 +110,10 @@ siggenx: %x: %.o
modeinterference
:
modeinterference.o
$(FC)
-o
$@
$<
-ltf
$(TF_LINK_PGPLOT)
$(LDFLAGS)
-L
$(LOCLIBDIR)
randomseries
:
randomseries.o
$(CXX)
-o
$@
$<
-ltfxx
-ldatrwxx
-lsffxx
-lgsexx
-ltime
++
-laff
\
-lgsl
-lgslcblas
$(LDFLAGS)
-L
$(LOCLIBDIR)
.PHONY
:
list-libraries
list-libraries
:
grep
' -l'
Makefile |
tr
' '
'\n'
| egrep
'^-l'
|sort |
uniq
...
...
src/synt/misc/randomseries.cc
0 → 100644
View file @
ee7fac4d
/*! \file randomseries.cc
* \brief provide time series of incoherent random numbers
*
* ----------------------------------------------------------------------------
*
* \author Thomas Forbriger
* \date 31/10/2019
*
* provide time series of incoherent random numbers
*
* Copyright (c) 2019 by Thomas Forbriger (BFO Schiltach)
*
* REVISIONS and CHANGES
* - 31/10/2019 V1.0 Thomas Forbriger
*
* ============================================================================
*/
#define RANDOMSERIES_VERSION \
"RANDOMSERIES V1.0 provide time series of incoherent random numbers"
#include <iostream>
#include <tfxx/commandline.h>
#include <tfxx/seitosh.h>
#include <datrwxx/writeany.h>
using
std
::
cout
;
using
std
::
cerr
;
using
std
::
endl
;
int
main
(
int
iargc
,
char
*
argv
[])
{
// define usage information
char
usage_text
[]
=
{
RANDOMSERIES_VERSION
"
\n
"
"usage: randomseries filename [-v] [-t type] [-o]"
"
\n
"
" [-nseries n] [-nsamples n]"
"
\n
"
" [-std v] [-mean v] [-seed n]"
"
\n
"
" or: randomseries --help|-h"
"
\n
"
" or: randomseries --help|-h"
"
\n
"
" or: randomseries --xhelp[=type]
\n
"
};
// define full help text
char
help_text
[]
=
{
"-help print description
\n
"
"-xhelp[=type] print detailed information regarding file formats
\n
"
" if 'type' is specified, just print text for file format 'type'
\n
"
"
\n
"
"filename name of output file
\n
"
"-v be verbose
\n
"
"-o overwrite existing output file
\n
"
"-t type select output file type
\n
"
"-nseries n produce 'n' time series
\n
"
"-nsamples n produce 'n' samples per series
\n
"
"-seed n initialize random number generator with 'n'
\n
"
"-std v set standard deviation to 'v'
\n
"
"-mean v set mean value of samples to 'v'
\n
"
};
// define commandline options
using
namespace
tfxx
::
cmdline
;
static
Declare
options
[]
=
{
// 0: print help
{
"help"
,
arg_no
,
"-"
},
// 1: verbose mode
{
"v"
,
arg_no
,
"-"
},
// 2: overwrite existing output file
{
"o"
,
arg_no
,
"-"
},
// 3: select output file type
{
"t"
,
arg_yes
,
"sff"
},
// 4: select output file type
{
"nseries"
,
arg_yes
,
"1"
},
// 5: select output file type
{
"nsamples"
,
arg_yes
,
"10000"
},
// 6: select output file type
{
"seed"
,
arg_yes
,
"1"
},
// 7: select output file type
{
"std"
,
arg_yes
,
"1."
},
// 8: select output file type
{
"mean"
,
arg_yes
,
"0."
},
// 9: output file format
{
"xhelp"
,
arg_opt
,
"all"
},
{
NULL
}
};
// no arguments? print usage...
if
(
iargc
<
2
)
{
cerr
<<
usage_text
<<
endl
;
cerr
<<
endl
<<
tfxx
::
seitosh
::
repository_reference
<<
endl
;
exit
(
0
);
}
// collect options from commandline
Commandline
cmdline
(
iargc
,
argv
,
options
);
// help requested? print full help text...
if
(
cmdline
.
optset
(
0
))
{
cerr
<<
usage_text
<<
endl
;
cerr
<<
help_text
<<
endl
;
cerr
<<
endl
;
cerr
<<
"supported output data file types:"
<<
endl
;
datrw
::
supported_output_data_types
(
cerr
);
cerr
<<
endl
<<
tfxx
::
seitosh
::
repository_reference
<<
endl
;
exit
(
0
);
}
// help on file format details requested?
if
(
cmdline
.
optset
(
9
))
{
cerr
<<
usage_text
<<
endl
;
cerr
<<
endl
;
if
(
cmdline
.
string_arg
(
9
)
==
"all"
)
{
datrw
::
online_help
(
cerr
);
}
else
{
datrw
::
online_help
(
cmdline
.
string_arg
(
9
),
cerr
);
}
exit
(
0
);
}
// dummy operation: print option settings
for
(
int
iopt
=
0
;
iopt
<
2
;
iopt
++
)
{
cout
<<
"option: '"
<<
options
[
iopt
].
opt_string
<<
"'"
<<
endl
;
if
(
cmdline
.
optset
(
iopt
))
{
cout
<<
" option was set"
;
}
else
{
cout
<<
"option was not set"
;
}
cout
<<
endl
;
cout
<<
" argument (string): '"
<<
cmdline
.
string_arg
(
iopt
)
<<
"'"
<<
endl
;
cout
<<
" argument (int): '"
<<
cmdline
.
int_arg
(
iopt
)
<<
"'"
<<
endl
;
cout
<<
" argument (long): '"
<<
cmdline
.
long_arg
(
iopt
)
<<
"'"
<<
endl
;
cout
<<
" argument (float): '"
<<
cmdline
.
float_arg
(
iopt
)
<<
"'"
<<
endl
;
cout
<<
" argument (double): '"
<<
cmdline
.
double_arg
(
iopt
)
<<
"'"
<<
endl
;
cout
<<
" argument (bool): '"
;
if
(
cmdline
.
bool_arg
(
iopt
))
{
cout
<<
"true"
;
}
else
{
cout
<<
"false"
;
}
cout
<<
"'"
<<
endl
;
}
while
(
cmdline
.
extra
())
{
cout
<<
cmdline
.
next
()
<<
endl
;
}
// dummy operation: print rest of command line
while
(
cmdline
.
extra
())
{
cout
<<
cmdline
.
next
()
<<
endl
;
}
}
/* ----- END OF randomseries.cc ----- */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment