Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
1e80f6da
Commit
1e80f6da
authored
1 year ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Start migrating LFFFT to C++
parent
f70fe40d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/include/tra_subs.h
+10
-0
10 additions, 0 deletions
src/include/tra_subs.h
src/trapping/frfme.cpp
+0
-1
0 additions, 1 deletion
src/trapping/frfme.cpp
src/trapping/lffft.cpp
+85
-0
85 additions, 0 deletions
src/trapping/lffft.cpp
with
95 additions
and
1 deletion
src/include/tra_subs.h
+
10
−
0
View file @
1e80f6da
...
@@ -6,6 +6,16 @@
...
@@ -6,6 +6,16 @@
#define INCLUDE_TRA_SUBS_H_
#define INCLUDE_TRA_SUBS_H_
#endif
#endif
//Structures for TRAPPING (that will probably move to Commons)
struct
cil
{
int
le
,
nlem
,
nlemt
,
mxmpo
,
mxim
;
};
struct
ccr
{
double
cof
,
cimu
;
};
//End of TRAPPING structures
//Externally defined subroutines
//Externally defined subroutines
extern
std
::
complex
<
double
>
dconjg
(
std
::
complex
<
double
>
z
);
extern
std
::
complex
<
double
>
dconjg
(
std
::
complex
<
double
>
z
);
extern
void
sphar
(
extern
void
sphar
(
...
...
This diff is collapsed.
Click to expand it.
src/trapping/frfme.cpp
+
0
−
1
View file @
1e80f6da
...
@@ -20,7 +20,6 @@ using namespace std;
...
@@ -20,7 +20,6 @@ using namespace std;
* \param data_file: `string` Name of the input data file.
* \param data_file: `string` Name of the input data file.
* \param output_path: `string` Directory to write the output files in.
* \param output_path: `string` Directory to write the output files in.
*/
*/
//void frfme(string data_file, string output_path) {
int
main
()
{
int
main
()
{
string
data_file
=
"../../test_data/trapping/DFRFME"
;
string
data_file
=
"../../test_data/trapping/DFRFME"
;
string
output_path
=
"."
;
string
output_path
=
"."
;
...
...
This diff is collapsed.
Click to expand it.
src/trapping/lffft.cpp
0 → 100644
+
85
−
0
View file @
1e80f6da
#include
<cstdio>
#include
<fstream>
#include
<regex>
#include
<string>
#include
<complex>
#ifndef INCLUDE_PARSERS_H_
#include
"../include/Parsers.h"
#endif
//#ifndef INCLUDE_SPH_SUBS_H_
//#include "../include/sph_subs.h"
//#endif
#ifndef INCLUDE_TRA_SUBS_H_
#include
"../include/tra_subs.h"
#endif
using
namespace
std
;
/*! \brief C++ implementation of FRFME
*
* \param data_file: `string` Name of the input data file.
* \param output_path: `string` Directory to write the output files in.
*/
int
main
()
{
string
data_file
=
"../../test_data/trapping/DLFFFT"
;
string
output_path
=
"."
;
double
****
zpv
=
NULL
,
*
ac
=
NULL
;
complex
<
double
>
*
ws
=
NULL
;
double
*
fffe
=
NULL
,
*
fffs
=
NULL
;
double
*
ffte
=
NULL
,
*
ffts
=
NULL
;
double
*
xv
=
NULL
,
*
yv
=
NULL
,
*
zv
=
NULL
;
complex
<
double
>
*
wsl
=
NULL
;
complex
<
double
>
**
am0m
=
NULL
;
complex
<
double
>
**
amd
=
NULL
;
int
**
indam
=
NULL
;
complex
<
double
>
*
tmsm
=
NULL
,
*
tmse
=
NULL
,
*
tms
=
NULL
;
int
jft
,
jss
,
jtw
;
int
is
,
le
;
double
vks
,
exris
;
int
num_lines
=
0
;
string
*
file_lines
=
load_file
(
data_file
,
&
num_lines
);
regex
re
=
regex
(
"-?[0-9]+"
);
smatch
m
;
string
str_target
=
file_lines
[
0
];
for
(
int
mi
=
0
;
mi
<
3
;
mi
++
)
{
regex_search
(
str_target
,
m
,
re
);
if
(
mi
==
0
)
jft
=
stoi
(
m
.
str
());
else
if
(
mi
==
1
)
jss
=
stoi
(
m
.
str
());
else
if
(
mi
==
2
)
jtw
=
stoi
(
m
.
str
());
str_target
=
m
.
suffix
().
str
();
}
// mi loop
string
ttms_name
=
output_path
+
"/c_TTMS"
;
fstream
ttms
;
ttms
.
open
(
ttms_name
,
ios
::
in
|
ios
::
binary
);
if
(
ttms
.
is_open
())
{
ttms
.
read
(
reinterpret_cast
<
char
*>
(
&
is
),
sizeof
(
int
));
ttms
.
read
(
reinterpret_cast
<
char
*>
(
&
le
),
sizeof
(
int
));
ttms
.
read
(
reinterpret_cast
<
char
*>
(
&
vks
),
sizeof
(
double
));
ttms
.
read
(
reinterpret_cast
<
char
*>
(
&
exris
),
sizeof
(
double
));
const
int
nlem
=
le
*
(
le
+
2
);
const
int
nlemt
=
nlem
+
nlem
;
printf
(
"DEBUG: is = %d
\n
"
,
is
);
printf
(
"DEBUG: le = %d
\n
"
,
le
);
printf
(
"DEBUG: vks = %lE
\n
"
,
vks
);
printf
(
"DEBUG: exris = %lE
\n
"
,
exris
);
}
else
{
printf
(
"ERROR: could not open TTMS file.
\n
"
);
}
// Clean up memory
if
(
ac
!=
NULL
)
delete
[]
ac
;
if
(
ws
!=
NULL
)
delete
[]
ws
;
if
(
fffe
!=
NULL
)
delete
[]
fffe
;
if
(
ffte
!=
NULL
)
delete
[]
ffte
;
if
(
fffs
!=
NULL
)
delete
[]
fffs
;
if
(
ffts
!=
NULL
)
delete
[]
ffts
;
if
(
xv
!=
NULL
)
delete
[]
xv
;
if
(
yv
!=
NULL
)
delete
[]
yv
;
if
(
zv
!=
NULL
)
delete
[]
zv
;
if
(
wsl
!=
NULL
)
delete
[]
wsl
;
if
(
tmsm
!=
NULL
)
delete
[]
tmsm
;
if
(
tmse
!=
NULL
)
delete
[]
tmse
;
if
(
tms
!=
NULL
)
delete
[]
tms
;
printf
(
"Done.
\n
"
);
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