Skip to content
GitLab
Explore
Sign in
Giacomo Mulas
NP_TMcode
Compare revisions
7a63a072a17ca1b22613e27aa858db026944b9a3 to bd60eab6b95523af89e899a099a7466ee3ebbd9d
Commits on Source (2)
Pass constant string arguments by reference
· 990dc0cf
Giovanni La Mura
authored
Apr 23, 2024
990dc0cf
Fix documentation of FileSchema public function interface
· bd60eab6
Giovanni La Mura
authored
Apr 23, 2024
bd60eab6
Hide whitespace changes
Inline
Side-by-side
src/include/Configuration.h
View file @
bd60eab6
...
@@ -158,7 +158,7 @@ public:
...
@@ -158,7 +158,7 @@ public:
* \return config: `GeometryConfiguration*` Pointer to object containing the
* \return config: `GeometryConfiguration*` Pointer to object containing the
* configuration data.
* configuration data.
*/
*/
static
GeometryConfiguration
*
from_legacy
(
std
::
string
file_name
);
static
GeometryConfiguration
*
from_legacy
(
const
std
::
string
&
file_name
);
/*! \brief Get the value of a parameter by name.
/*! \brief Get the value of a parameter by name.
*
*
...
@@ -172,7 +172,7 @@ public:
...
@@ -172,7 +172,7 @@ public:
* \param param_name: `string` Name of the parameter to be retrieved.
* \param param_name: `string` Name of the parameter to be retrieved.
* \return value: `double` Value of the requested parameter.
* \return value: `double` Value of the requested parameter.
*/
*/
double
get_param
(
std
::
string
param_name
);
double
get_param
(
const
std
::
string
&
param_name
);
/*! \brief Get the X coordinate of a sphere by its index.
/*! \brief Get the X coordinate of a sphere by its index.
*
*
...
@@ -255,7 +255,7 @@ protected:
...
@@ -255,7 +255,7 @@ protected:
* \return config: `ScattererConfiguration*` Pointer to object containing the
* \return config: `ScattererConfiguration*` Pointer to object containing the
* scatterer configuration data.
* scatterer configuration data.
*/
*/
static
ScattererConfiguration
*
from_hdf5
(
std
::
string
file_name
);
static
ScattererConfiguration
*
from_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Build configuration from legacy binary input file.
/*! \brief Build configuration from legacy binary input file.
*
*
...
@@ -268,7 +268,7 @@ protected:
...
@@ -268,7 +268,7 @@ protected:
* \return config: `ScattererConfiguration*` Pointer to object containing the
* \return config: `ScattererConfiguration*` Pointer to object containing the
* scatterer configuration data.
* scatterer configuration data.
*/
*/
static
ScattererConfiguration
*
from_legacy
(
std
::
string
file_name
);
static
ScattererConfiguration
*
from_legacy
(
const
std
::
string
&
file_name
);
/*! \brief Write the scatterer configuration data to HDF5 binary output.
/*! \brief Write the scatterer configuration data to HDF5 binary output.
*
*
...
@@ -278,7 +278,7 @@ protected:
...
@@ -278,7 +278,7 @@ protected:
*
*
* \param file_name: `string` Name of the binary configuration data file.
* \param file_name: `string` Name of the binary configuration data file.
*/
*/
void
write_hdf5
(
std
::
string
file_name
);
void
write_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Write the scatterer configuration data to legacy binary output.
/*! \brief Write the scatterer configuration data to legacy binary output.
*
*
...
@@ -289,7 +289,7 @@ protected:
...
@@ -289,7 +289,7 @@ protected:
*
*
* \param file_name: `string` Name of the binary configuration data file.
* \param file_name: `string` Name of the binary configuration data file.
*/
*/
void
write_legacy
(
std
::
string
file_name
);
void
write_legacy
(
const
std
::
string
&
file_name
);
public:
public:
/*! \brief Build a scatterer configuration structure.
/*! \brief Build a scatterer configuration structure.
*
*
...
@@ -318,7 +318,7 @@ public:
...
@@ -318,7 +318,7 @@ public:
int
configs
,
int
configs
,
double
*
scale_vector
,
double
*
scale_vector
,
int
nxi
,
int
nxi
,
std
::
string
variable_name
,
const
std
::
string
&
variable_name
,
int
*
iog_vector
,
int
*
iog_vector
,
double
*
ros_vector
,
double
*
ros_vector
,
int
*
nshl_vector
,
int
*
nshl_vector
,
...
@@ -373,7 +373,7 @@ public:
...
@@ -373,7 +373,7 @@ public:
* \return config: `ScattererConfiguration*` Pointer to object containing the
* \return config: `ScattererConfiguration*` Pointer to object containing the
* scatterer configuration data.
* scatterer configuration data.
*/
*/
static
ScattererConfiguration
*
from_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
static
ScattererConfiguration
*
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Build scatterer configuration from legacy configuration input file.
/*! \brief Build scatterer configuration from legacy configuration input file.
*
*
...
@@ -386,7 +386,7 @@ public:
...
@@ -386,7 +386,7 @@ public:
* \return config: `ScattererConfiguration*` Pointer to object containing the
* \return config: `ScattererConfiguration*` Pointer to object containing the
* scatterer configuration data.
* scatterer configuration data.
*/
*/
static
ScattererConfiguration
*
from_dedfb
(
std
::
string
file_name
);
static
ScattererConfiguration
*
from_dedfb
(
const
std
::
string
&
file_name
);
/*! \brief Get the dielectric constant of a material for a specific wavelength.
/*! \brief Get the dielectric constant of a material for a specific wavelength.
*
*
...
@@ -433,7 +433,7 @@ public:
...
@@ -433,7 +433,7 @@ public:
* \param param_name: `string` Name of the parameter to be retrieved.
* \param param_name: `string` Name of the parameter to be retrieved.
* \return value: `double` Value of the requested parameter.
* \return value: `double` Value of the requested parameter.
*/
*/
double
get_param
(
std
::
string
param_name
);
double
get_param
(
const
std
::
string
&
param_name
);
/*! \brief Get the radius of a sphere by its index.
/*! \brief Get the radius of a sphere by its index.
*
*
...
@@ -495,7 +495,7 @@ public:
...
@@ -495,7 +495,7 @@ public:
* \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional
* \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional
* (default is "LEGACY").
* (default is "LEGACY").
*/
*/
void
write_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
void
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Write the scatterer configuration data to formatted text output.
/*! \brief Write the scatterer configuration data to formatted text output.
*
*
...
@@ -507,7 +507,7 @@ public:
...
@@ -507,7 +507,7 @@ public:
*
*
* \param file_name: `string` Name of the file to be written.
* \param file_name: `string` Name of the file to be written.
*/
*/
void
write_formatted
(
std
::
string
file_name
);
void
write_formatted
(
const
std
::
string
&
file_name
);
/*! \brief Test whether two instances of ScattererConfiguration are equal.
/*! \brief Test whether two instances of ScattererConfiguration are equal.
*
*
...
@@ -520,7 +520,7 @@ public:
...
@@ -520,7 +520,7 @@ public:
* \param other: `ScattererConfiguration &` Reference to the instance to be compared with.
* \param other: `ScattererConfiguration &` Reference to the instance to be compared with.
* \return result: `bool` True, if the two instances are equal, false otherwise.
* \return result: `bool` True, if the two instances are equal, false otherwise.
*/
*/
bool
operator
==
(
ScattererConfiguration
&
other
);
bool
operator
==
(
const
ScattererConfiguration
&
other
);
};
};
#endif
#endif
src/include/Parsers.h
View file @
bd60eab6
...
@@ -32,6 +32,6 @@
...
@@ -32,6 +32,6 @@
* \return array_lines `string*` An array of strings, one for each input
* \return array_lines `string*` An array of strings, one for each input
* file line.
* file line.
*/
*/
std
::
string
*
load_file
(
std
::
string
file_name
,
int
*
count
);
std
::
string
*
load_file
(
const
std
::
string
&
file_name
,
int
*
count
);
#endif
/* INCLUDE_PARSERS_H_ */
#endif
/* INCLUDE_PARSERS_H_ */
src/include/TransitionMatrix.h
View file @
bd60eab6
...
@@ -36,7 +36,7 @@ class TransitionMatrix {
...
@@ -36,7 +36,7 @@ class TransitionMatrix {
* \return config: `TransitionMatrix *` Pointer to object containing the
* \return config: `TransitionMatrix *` Pointer to object containing the
* transition matrix data.
* transition matrix data.
*/
*/
static
TransitionMatrix
*
from_hdf5
(
std
::
string
file_name
);
static
TransitionMatrix
*
from_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Build transition matrix from a legacy binary input file.
/*! \brief Build transition matrix from a legacy binary input file.
*
*
...
@@ -44,7 +44,7 @@ class TransitionMatrix {
...
@@ -44,7 +44,7 @@ class TransitionMatrix {
* \return config: `TransitionMatrix *` Pointer to object containing the
* \return config: `TransitionMatrix *` Pointer to object containing the
* transition matrix data.
* transition matrix data.
*/
*/
static
TransitionMatrix
*
from_legacy
(
std
::
string
file_name
);
static
TransitionMatrix
*
from_legacy
(
const
std
::
string
&
file_name
);
/*! \brief Write the Transition Matrix to HDF5 binary output.
/*! \brief Write the Transition Matrix to HDF5 binary output.
*
*
...
@@ -54,7 +54,7 @@ class TransitionMatrix {
...
@@ -54,7 +54,7 @@ class TransitionMatrix {
*
*
* \param file_name: `string` Name of the binary configuration data file.
* \param file_name: `string` Name of the binary configuration data file.
*/
*/
void
write_hdf5
(
std
::
string
file_name
);
void
write_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Write transition matrix data to HDF5 binary output.
/*! \brief Write transition matrix data to HDF5 binary output.
*
*
...
@@ -71,7 +71,7 @@ class TransitionMatrix {
...
@@ -71,7 +71,7 @@ class TransitionMatrix {
* \param _am0m: `complex double **`
* \param _am0m: `complex double **`
*/
*/
static
void
write_hdf5
(
static
void
write_hdf5
(
std
::
string
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
const
std
::
string
&
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_am0m
double
_exri
,
dcomplex
**
_am0m
);
);
...
@@ -91,7 +91,7 @@ class TransitionMatrix {
...
@@ -91,7 +91,7 @@ class TransitionMatrix {
* \param _sphere_radius: `double` Radius of the sphere.
* \param _sphere_radius: `double` Radius of the sphere.
*/
*/
static
void
write_hdf5
(
static
void
write_hdf5
(
std
::
string
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
const
std
::
string
&
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
);
);
...
@@ -99,7 +99,7 @@ class TransitionMatrix {
...
@@ -99,7 +99,7 @@ class TransitionMatrix {
*
*
* \param file_name: `string` Name of the binary configuration data file.
* \param file_name: `string` Name of the binary configuration data file.
*/
*/
void
write_legacy
(
std
::
string
file_name
);
void
write_legacy
(
const
std
::
string
&
file_name
);
/*! \brief Write transition matrix data to binary output using legacy format.
/*! \brief Write transition matrix data to binary output using legacy format.
*
*
...
@@ -116,7 +116,7 @@ class TransitionMatrix {
...
@@ -116,7 +116,7 @@ class TransitionMatrix {
* \param _am0m: `complex double **`
* \param _am0m: `complex double **`
*/
*/
static
void
write_legacy
(
static
void
write_legacy
(
std
::
string
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
const
std
::
string
&
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_am0m
double
_exri
,
dcomplex
**
_am0m
);
);
...
@@ -136,7 +136,7 @@ class TransitionMatrix {
...
@@ -136,7 +136,7 @@ class TransitionMatrix {
* \param _sphere_radius: `double` Radius of the sphere.
* \param _sphere_radius: `double` Radius of the sphere.
*/
*/
static
void
write_legacy
(
static
void
write_legacy
(
std
::
string
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
const
std
::
string
&
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
);
);
...
@@ -205,7 +205,7 @@ class TransitionMatrix {
...
@@ -205,7 +205,7 @@ class TransitionMatrix {
* \return config: `TransitionMatrix *` Pointer to object containing the transition
* \return config: `TransitionMatrix *` Pointer to object containing the transition
* matrix data.
* matrix data.
*/
*/
static
TransitionMatrix
*
from_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
static
TransitionMatrix
*
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Write the Transition Matrix to a binary file.
/*! \brief Write the Transition Matrix to a binary file.
*
*
...
@@ -219,7 +219,7 @@ class TransitionMatrix {
...
@@ -219,7 +219,7 @@ class TransitionMatrix {
* \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional
* \param mode: `string` Binary encoding. Can be one of ["LEGACY", "HDF5"] . Optional
* (default is "LEGACY").
* (default is "LEGACY").
*/
*/
void
write_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
void
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Write a cluster Transition Matrix to a binary file without instanciating it.
/*! \brief Write a cluster Transition Matrix to a binary file without instanciating it.
*
*
...
@@ -244,8 +244,8 @@ class TransitionMatrix {
...
@@ -244,8 +244,8 @@ class TransitionMatrix {
* (default is "LEGACY").
* (default is "LEGACY").
*/
*/
static
void
write_binary
(
static
void
write_binary
(
std
::
string
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
const
std
::
string
&
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_am0m
,
std
::
string
mode
=
"LEGACY"
double
_exri
,
dcomplex
**
_am0m
,
const
std
::
string
&
mode
=
"LEGACY"
);
);
/*! \brief Write a single sphere Transition Matrix to a binary file without instanciating it.
/*! \brief Write a single sphere Transition Matrix to a binary file without instanciating it.
...
@@ -272,9 +272,9 @@ class TransitionMatrix {
...
@@ -272,9 +272,9 @@ class TransitionMatrix {
* (default is "LEGACY").
* (default is "LEGACY").
*/
*/
static
void
write_binary
(
static
void
write_binary
(
std
::
string
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
const
std
::
string
&
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
,
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
,
std
::
string
mode
=
"LEGACY"
const
std
::
string
&
mode
=
"LEGACY"
);
);
/*! \brief Test whether two instances of TransitionMatrix are equal.
/*! \brief Test whether two instances of TransitionMatrix are equal.
...
...
src/include/errors.h
View file @
bd60eab6
...
@@ -64,7 +64,7 @@ public:
...
@@ -64,7 +64,7 @@ public:
*
*
* \param name: `string` Name of the file that was accessed.
* \param name: `string` Name of the file that was accessed.
*/
*/
OpenConfigurationFileException
(
std
::
string
name
)
{
file_name
=
name
;
}
OpenConfigurationFileException
(
const
std
::
string
&
name
)
{
file_name
=
name
;
}
/**
/**
* \brief Exception message.
* \brief Exception message.
...
@@ -86,7 +86,7 @@ public:
...
@@ -86,7 +86,7 @@ public:
*
*
* \param problem: `string` Description of the problem that occurred.
* \param problem: `string` Description of the problem that occurred.
*/
*/
MatrixOutOfBoundsException
(
std
::
string
problem
)
{
message
=
problem
;
}
MatrixOutOfBoundsException
(
const
std
::
string
&
problem
)
{
message
=
problem
;
}
/**
/**
* \brief Exception message.
* \brief Exception message.
*/
*/
...
@@ -107,7 +107,7 @@ public:
...
@@ -107,7 +107,7 @@ public:
*
*
* \param problem: `string` Description of the problem that occurred.
* \param problem: `string` Description of the problem that occurred.
*/
*/
UnrecognizedConfigurationException
(
std
::
string
problem
)
{
message
=
problem
;
}
UnrecognizedConfigurationException
(
const
std
::
string
&
problem
)
{
message
=
problem
;
}
/**
/**
* \brief Exception message.
* \brief Exception message.
*/
*/
...
@@ -128,7 +128,7 @@ public:
...
@@ -128,7 +128,7 @@ public:
*
*
* \param problem: `string` Description of the problem that occurred.
* \param problem: `string` Description of the problem that occurred.
*/
*/
UnrecognizedFormatException
(
std
::
string
problem
)
{
message
=
problem
;
}
UnrecognizedFormatException
(
const
std
::
string
&
problem
)
{
message
=
problem
;
}
/**
/**
* \brief Exception message.
* \brief Exception message.
*/
*/
...
@@ -149,7 +149,7 @@ public:
...
@@ -149,7 +149,7 @@ public:
*
*
* \param problem: `string` Description of the problem that occurred.
* \param problem: `string` Description of the problem that occurred.
*/
*/
UnrecognizedParameterException
(
std
::
string
problem
)
{
message
=
problem
;
}
UnrecognizedParameterException
(
const
std
::
string
&
problem
)
{
message
=
problem
;
}
/**
/**
* \brief Exception message.
* \brief Exception message.
*/
*/
...
...
src/include/file_io.h
View file @
bd60eab6
...
@@ -31,7 +31,7 @@ class FileSchema {
...
@@ -31,7 +31,7 @@ class FileSchema {
* \param rec_types: `string *` Description of the records in the file.
* \param rec_types: `string *` Description of the records in the file.
* \param rec_names: `string *` Names of the records in the file.
* \param rec_names: `string *` Names of the records in the file.
*/
*/
FileSchema
(
int
num_rec
,
std
::
string
*
rec_types
,
std
::
string
*
rec_names
=
NULL
);
FileSchema
(
int
num_rec
,
const
std
::
string
*
rec_types
,
const
std
::
string
*
rec_names
=
NULL
);
/*! \brief FileSchema instance destroyer.
/*! \brief FileSchema instance destroyer.
*/
*/
...
@@ -43,12 +43,13 @@ class FileSchema {
...
@@ -43,12 +43,13 @@ class FileSchema {
*/
*/
int
get_record_number
()
{
return
num_records
;
}
int
get_record_number
()
{
return
num_records
;
}
/*! \brief Get a copy of the record
typ
es.
/*! \brief Get a copy of the record
nam
es.
*
*
* \return rec_types: `string *` A new vector of strings with description of records.
* \return rec_types: `string *` A new vector of strings with description of records.
*/
*/
std
::
string
*
get_record_names
();
std
::
string
*
get_record_names
();
/*! \brief Get a copy of the record names.
/*! \brief Get a copy of the record types.
*
*
* \return rec_names: `string *` A new vector of strings with record names.
* \return rec_names: `string *` A new vector of strings with record names.
*/
*/
...
@@ -83,7 +84,7 @@ class HDFFile {
...
@@ -83,7 +84,7 @@ class HDFFile {
* \param fapl_id: `hid_t` File access property list identifier (default is `H5P_DEFAULT`).
* \param fapl_id: `hid_t` File access property list identifier (default is `H5P_DEFAULT`).
*/
*/
HDFFile
(
HDFFile
(
std
::
string
name
,
unsigned
int
flags
=
H5F_ACC_EXCL
,
const
std
::
string
&
name
,
unsigned
int
flags
=
H5F_ACC_EXCL
,
hid_t
fcpl_id
=
H5P_DEFAULT
,
hid_t
fapl_id
=
H5P_DEFAULT
hid_t
fcpl_id
=
H5P_DEFAULT
,
hid_t
fapl_id
=
H5P_DEFAULT
);
);
...
@@ -105,7 +106,7 @@ class HDFFile {
...
@@ -105,7 +106,7 @@ class HDFFile {
* \return hdf_file: `HDFFile *` Pointer to a new, open HDF5 file.
* \return hdf_file: `HDFFile *` Pointer to a new, open HDF5 file.
*/
*/
static
HDFFile
*
from_schema
(
static
HDFFile
*
from_schema
(
FileSchema
&
schema
,
std
::
string
name
,
unsigned
int
flags
=
H5F_ACC_EXCL
,
FileSchema
&
schema
,
const
std
::
string
&
name
,
unsigned
int
flags
=
H5F_ACC_EXCL
,
hid_t
fcpl_id
=
H5P_DEFAULT
,
hid_t
fapl_id
=
H5P_DEFAULT
hid_t
fcpl_id
=
H5P_DEFAULT
,
hid_t
fapl_id
=
H5P_DEFAULT
);
);
...
@@ -133,7 +134,7 @@ class HDFFile {
...
@@ -133,7 +134,7 @@ class HDFFile {
* \return status: `herr_t` Exit status of the operation.
* \return status: `herr_t` Exit status of the operation.
*/
*/
herr_t
read
(
herr_t
read
(
std
::
string
dataset_name
,
std
::
string
data_type
,
void
*
buffer
,
const
std
::
string
&
dataset_name
,
const
std
::
string
&
data_type
,
void
*
buffer
,
hid_t
mem_space_id
=
H5S_ALL
,
hid_t
file_space_id
=
H5S_ALL
,
hid_t
mem_space_id
=
H5S_ALL
,
hid_t
file_space_id
=
H5S_ALL
,
hid_t
dapl_id
=
H5P_DEFAULT
,
hid_t
dxpl_id
=
H5P_DEFAULT
hid_t
dapl_id
=
H5P_DEFAULT
,
hid_t
dxpl_id
=
H5P_DEFAULT
);
);
...
@@ -150,7 +151,7 @@ class HDFFile {
...
@@ -150,7 +151,7 @@ class HDFFile {
* \return status: `herr_t` Exit status of the operation.
* \return status: `herr_t` Exit status of the operation.
*/
*/
herr_t
write
(
herr_t
write
(
std
::
string
dataset_name
,
std
::
string
data_type
,
const
void
*
buffer
,
const
std
::
string
&
dataset_name
,
const
std
::
string
&
data_type
,
const
void
*
buffer
,
hid_t
mem_space_id
=
H5S_ALL
,
hid_t
file_space_id
=
H5S_ALL
,
hid_t
mem_space_id
=
H5S_ALL
,
hid_t
file_space_id
=
H5S_ALL
,
hid_t
dapl_id
=
H5P_DEFAULT
,
hid_t
dxpl_id
=
H5P_DEFAULT
hid_t
dapl_id
=
H5P_DEFAULT
,
hid_t
dxpl_id
=
H5P_DEFAULT
);
);
...
...
src/include/logging.h
View file @
bd60eab6
...
@@ -67,7 +67,7 @@ class Logger {
...
@@ -67,7 +67,7 @@ class Logger {
*
*
* \param message: `string` The message to be printed.
* \param message: `string` The message to be printed.
*/
*/
void
err
(
std
::
string
message
);
void
err
(
const
std
::
string
&
message
);
/*! \brief Print a summary of recurrent messages and clear the stack.
/*! \brief Print a summary of recurrent messages and clear the stack.
*
*
...
@@ -80,7 +80,7 @@ class Logger {
...
@@ -80,7 +80,7 @@ class Logger {
* \param message: `string` The message to be printed.
* \param message: `string` The message to be printed.
* \param level: `int` The priority level (default is `LOG_INFO = 1`).
* \param level: `int` The priority level (default is `LOG_INFO = 1`).
*/
*/
void
log
(
std
::
string
message
,
int
level
=
LOG_INFO
);
void
log
(
const
std
::
string
&
message
,
int
level
=
LOG_INFO
);
/*! \brief Push a recurrent message to the message stack.
/*! \brief Push a recurrent message to the message stack.
*
*
...
@@ -92,7 +92,7 @@ class Logger {
...
@@ -92,7 +92,7 @@ class Logger {
*
*
* \param message: `string` The message to be stacked.
* \param message: `string` The message to be stacked.
*/
*/
void
push
(
std
::
string
message
);
void
push
(
const
std
::
string
&
message
);
};
};
#endif
#endif
src/include/tfrfme.h
View file @
bd60eab6
...
@@ -27,26 +27,26 @@ protected:
...
@@ -27,26 +27,26 @@ protected:
* \param file_name: `string` Name of the file to be loaded.
* \param file_name: `string` Name of the file to be loaded.
* \return instance: `Swap1 *` Pointer to a new Swap1 instance.
* \return instance: `Swap1 *` Pointer to a new Swap1 instance.
*/
*/
static
Swap1
*
from_hdf5
(
std
::
string
file_name
);
static
Swap1
*
from_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Load a Swap1 instance from a legacy binary file.
/*! \brief Load a Swap1 instance from a legacy binary file.
*
*
* \param file_name: `string` Name of the file to be loaded.
* \param file_name: `string` Name of the file to be loaded.
* \return instance: `Swap1 *` Pointer to a new Swap1 instance.
* \return instance: `Swap1 *` Pointer to a new Swap1 instance.
*/
*/
static
Swap1
*
from_legacy
(
std
::
string
file_name
);
static
Swap1
*
from_legacy
(
const
std
::
string
&
file_name
);
/*! \brief Save a Swap1 instance to a HDF5 binary file.
/*! \brief Save a Swap1 instance to a HDF5 binary file.
*
*
* \param file_name: `string` Name of the file to be written.
* \param file_name: `string` Name of the file to be written.
*/
*/
void
write_hdf5
(
std
::
string
file_name
);
void
write_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Save a Swap1 instance to a legacy binary file.
/*! \brief Save a Swap1 instance to a legacy binary file.
*
*
* \param file_name: `string` Name of the file to be written.
* \param file_name: `string` Name of the file to be written.
*/
*/
void
write_legacy
(
std
::
string
file_name
);
void
write_legacy
(
const
std
::
string
&
file_name
);
public:
public:
/*! \brief Swap1 instance constructor.
/*! \brief Swap1 instance constructor.
...
@@ -73,7 +73,7 @@ public:
...
@@ -73,7 +73,7 @@ public:
* or "LGEACY". Default is "LEGACY").
* or "LGEACY". Default is "LEGACY").
* \return instance: `Swap1 *` Pointer to a newly created Swap1 instance.
* \return instance: `Swap1 *` Pointer to a newly created Swap1 instance.
*/
*/
static
Swap1
*
from_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
static
Swap1
*
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Calculate the necessary amount of memory to create a new instance.
/*! \brief Calculate the necessary amount of memory to create a new instance.
*
*
...
@@ -99,7 +99,7 @@ public:
...
@@ -99,7 +99,7 @@ public:
* \param mode: `string` Format of the file (can be either "HDF5"
* \param mode: `string` Format of the file (can be either "HDF5"
* or "LGEACY". Default is "LEGACY").
* or "LGEACY". Default is "LEGACY").
*/
*/
void
write_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
void
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Test whether two instances of Swap1 are equal.
/*! \brief Test whether two instances of Swap1 are equal.
*
*
...
@@ -157,26 +157,26 @@ protected:
...
@@ -157,26 +157,26 @@ protected:
* \param file_name: `string` Name of the file to be loaded.
* \param file_name: `string` Name of the file to be loaded.
* \return instance: `Swap2 *` Pointer to a new Swap2 instance.
* \return instance: `Swap2 *` Pointer to a new Swap2 instance.
*/
*/
static
Swap2
*
from_hdf5
(
std
::
string
file_name
);
static
Swap2
*
from_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Load a Swap2 instance from a legacy binary file.
/*! \brief Load a Swap2 instance from a legacy binary file.
*
*
* \param file_name: `string` Name of the file to be loaded.
* \param file_name: `string` Name of the file to be loaded.
* \return instance: `Swap2 *` Pointer to a new Swap2 instance.
* \return instance: `Swap2 *` Pointer to a new Swap2 instance.
*/
*/
static
Swap2
*
from_legacy
(
std
::
string
file_name
);
static
Swap2
*
from_legacy
(
const
std
::
string
&
file_name
);
/*! \brief Save a Swap2 instance to a HDF5 binary file.
/*! \brief Save a Swap2 instance to a HDF5 binary file.
*
*
* \param file_name: `string` Name of the file to be written.
* \param file_name: `string` Name of the file to be written.
*/
*/
void
write_hdf5
(
std
::
string
file_name
);
void
write_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Save a Swap2 instance to a legacy binary file.
/*! \brief Save a Swap2 instance to a legacy binary file.
*
*
* \param file_name: `string` Name of the file to be written.
* \param file_name: `string` Name of the file to be written.
*/
*/
void
write_legacy
(
std
::
string
file_name
);
void
write_legacy
(
const
std
::
string
&
file_name
);
public:
public:
/*! \brief Swap2 instance constructor.
/*! \brief Swap2 instance constructor.
...
@@ -196,7 +196,7 @@ public:
...
@@ -196,7 +196,7 @@ public:
* or "LGEACY". Default is "LEGACY").
* or "LGEACY". Default is "LEGACY").
* \return instance: `Swap2 *` Pointer to a newly created Swap2 instance.
* \return instance: `Swap2 *` Pointer to a newly created Swap2 instance.
*/
*/
static
Swap2
*
from_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
static
Swap2
*
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Get the pointer to the VKZM matrix.
/*! \brief Get the pointer to the VKZM matrix.
*
*
...
@@ -216,7 +216,7 @@ public:
...
@@ -216,7 +216,7 @@ public:
* \param param_name: `string` Name of the parameter.
* \param param_name: `string` Name of the parameter.
* \return value: `double` The value of the requested parameter.
* \return value: `double` The value of the requested parameter.
*/
*/
double
get_param
(
std
::
string
param_name
);
double
get_param
(
const
std
::
string
&
param_name
);
/*! \brief Get the pointer to the VKV vector.
/*! \brief Get the pointer to the VKV vector.
*
*
...
@@ -249,7 +249,7 @@ public:
...
@@ -249,7 +249,7 @@ public:
* \param param_name: `string` Name of the parameter.
* \param param_name: `string` Name of the parameter.
* \param value: `double` The value of the parameter.
* \param value: `double` The value of the parameter.
*/
*/
void
set_param
(
std
::
string
param_name
,
double
value
);
void
set_param
(
const
std
::
string
&
param_name
,
double
value
);
/*! \brief Write a Swap2 instance to binary file.
/*! \brief Write a Swap2 instance to binary file.
*
*
...
@@ -257,7 +257,7 @@ public:
...
@@ -257,7 +257,7 @@ public:
* \param mode: `string` Format of the file (can be either "HDF5"
* \param mode: `string` Format of the file (can be either "HDF5"
* or "LGEACY". Default is "LEGACY").
* or "LGEACY". Default is "LEGACY").
*/
*/
void
write_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
void
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Test whether two instances of Swap2 are equal.
/*! \brief Test whether two instances of Swap2 are equal.
*
*
...
@@ -321,7 +321,7 @@ protected:
...
@@ -321,7 +321,7 @@ protected:
* \return instance: `TFRFME *` Pointer to a new trapping configuration
* \return instance: `TFRFME *` Pointer to a new trapping configuration
* instance.
* instance.
*/
*/
static
TFRFME
*
from_hdf5
(
std
::
string
file_name
);
static
TFRFME
*
from_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Load a configuration instance from a legacy binary file.
/*! \brief Load a configuration instance from a legacy binary file.
*
*
...
@@ -329,19 +329,19 @@ protected:
...
@@ -329,19 +329,19 @@ protected:
* \return instance: `TFRFME *` Pointer to a new trapping configuration
* \return instance: `TFRFME *` Pointer to a new trapping configuration
* instance.
* instance.
*/
*/
static
TFRFME
*
from_legacy
(
std
::
string
file_name
);
static
TFRFME
*
from_legacy
(
const
std
::
string
&
file_name
);
/*! \brief Save a configuration instance to a HDF5 binary file.
/*! \brief Save a configuration instance to a HDF5 binary file.
*
*
* \param file_name: `string` Name of the file to be written.
* \param file_name: `string` Name of the file to be written.
*/
*/
void
write_hdf5
(
std
::
string
file_name
);
void
write_hdf5
(
const
std
::
string
&
file_name
);
/*! \brief Save a configuration instance to a legacy binary file.
/*! \brief Save a configuration instance to a legacy binary file.
*
*
* \param file_name: `string` Name of the file to be written.
* \param file_name: `string` Name of the file to be written.
*/
*/
void
write_legacy
(
std
::
string
file_name
);
void
write_legacy
(
const
std
::
string
&
file_name
);
public:
public:
/*! \brief Trapping configuration instance constructor.
/*! \brief Trapping configuration instance constructor.
...
@@ -369,7 +369,7 @@ public:
...
@@ -369,7 +369,7 @@ public:
* \return instance: `TFRFME *` Pointer to a newly created configuration
* \return instance: `TFRFME *` Pointer to a newly created configuration
* instance.
* instance.
*/
*/
static
TFRFME
*
from_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
static
TFRFME
*
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Get the pointer to the WSUM matrix.
/*! \brief Get the pointer to the WSUM matrix.
*
*
...
@@ -397,7 +397,7 @@ public:
...
@@ -397,7 +397,7 @@ public:
* \param param_name: `string` Name of the parameter.
* \param param_name: `string` Name of the parameter.
* \return value: `double` The value of the requested parameter.
* \return value: `double` The value of the requested parameter.
*/
*/
double
get_param
(
std
::
string
param_name
);
double
get_param
(
const
std
::
string
&
param_name
);
/*! \brief Get the pointer to the X coordinates vector.
/*! \brief Get the pointer to the X coordinates vector.
*
*
...
@@ -422,7 +422,7 @@ public:
...
@@ -422,7 +422,7 @@ public:
* \param param_name: `string` Name of the parameter.
* \param param_name: `string` Name of the parameter.
* \param value: `double` Value to be stored as parameter.
* \param value: `double` Value to be stored as parameter.
*/
*/
void
set_param
(
std
::
string
param_name
,
double
value
);
void
set_param
(
const
std
::
string
&
param_name
,
double
value
);
/*! \brief Write a trapping configuration instance to binary file.
/*! \brief Write a trapping configuration instance to binary file.
*
*
...
@@ -430,7 +430,7 @@ public:
...
@@ -430,7 +430,7 @@ public:
* \param mode: `string` Format of the file (can be either "HDF5"
* \param mode: `string` Format of the file (can be either "HDF5"
* or "LGEACY". Default is "LEGACY").
* or "LGEACY". Default is "LEGACY").
*/
*/
void
write_binary
(
std
::
string
file_name
,
std
::
string
mode
=
"LEGACY"
);
void
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
=
"LEGACY"
);
/*! \brief Test whether two instances of configuration are equal.
/*! \brief Test whether two instances of configuration are equal.
*
*
...
@@ -439,6 +439,6 @@ public:
...
@@ -439,6 +439,6 @@ public:
* \return result: `bool` True, if the two instances are equal,
* \return result: `bool` True, if the two instances are equal,
* false otherwise.
* false otherwise.
*/
*/
bool
operator
==
(
TFRFME
&
other
);
bool
operator
==
(
const
TFRFME
&
other
);
};
};
#endif
#endif
src/libnptm/Configuration.cpp
View file @
bd60eab6
...
@@ -77,7 +77,7 @@ GeometryConfiguration::GeometryConfiguration(
...
@@ -77,7 +77,7 @@ GeometryConfiguration::GeometryConfiguration(
sph_z
=
z
;
sph_z
=
z
;
}
}
GeometryConfiguration
::
GeometryConfiguration
(
const
GeometryConfiguration
&
rhs
)
GeometryConfiguration
::
GeometryConfiguration
(
const
GeometryConfiguration
&
rhs
)
{
{
number_of_spheres
=
rhs
.
number_of_spheres
;
number_of_spheres
=
rhs
.
number_of_spheres
;
l_max
=
rhs
.
l_max
;
l_max
=
rhs
.
l_max
;
...
@@ -118,7 +118,7 @@ GeometryConfiguration::~GeometryConfiguration() {
...
@@ -118,7 +118,7 @@ GeometryConfiguration::~GeometryConfiguration() {
delete
[]
sph_z
;
delete
[]
sph_z
;
}
}
GeometryConfiguration
*
GeometryConfiguration
::
from_legacy
(
string
file_name
)
{
GeometryConfiguration
*
GeometryConfiguration
::
from_legacy
(
const
std
::
string
&
file_name
)
{
int
num_lines
=
0
;
int
num_lines
=
0
;
int
last_read_line
=
0
;
int
last_read_line
=
0
;
string
*
file_lines
;
string
*
file_lines
;
...
@@ -233,7 +233,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) {
...
@@ -233,7 +233,7 @@ GeometryConfiguration* GeometryConfiguration::from_legacy(string file_name) {
return
conf
;
return
conf
;
}
}
double
GeometryConfiguration
::
get_param
(
std
::
string
param_name
)
{
double
GeometryConfiguration
::
get_param
(
const
std
::
string
&
param_name
)
{
double
value
;
double
value
;
if
(
param_name
.
compare
(
"number_of_spheres"
)
==
0
)
value
=
(
double
)
number_of_spheres
;
if
(
param_name
.
compare
(
"number_of_spheres"
)
==
0
)
value
=
(
double
)
number_of_spheres
;
else
if
(
param_name
.
compare
(
"nsph"
)
==
0
)
value
=
(
double
)
number_of_spheres
;
else
if
(
param_name
.
compare
(
"nsph"
)
==
0
)
value
=
(
double
)
number_of_spheres
;
...
@@ -271,7 +271,7 @@ ScattererConfiguration::ScattererConfiguration(
...
@@ -271,7 +271,7 @@ ScattererConfiguration::ScattererConfiguration(
int
configs
,
int
configs
,
double
*
scale_vector
,
double
*
scale_vector
,
int
nxi
,
int
nxi
,
string
variable_name
,
const
std
::
string
&
variable_name
,
int
*
iog_vector
,
int
*
iog_vector
,
double
*
ros_vector
,
double
*
ros_vector
,
int
*
nshl_vector
,
int
*
nshl_vector
,
...
@@ -314,7 +314,7 @@ ScattererConfiguration::ScattererConfiguration(
...
@@ -314,7 +314,7 @@ ScattererConfiguration::ScattererConfiguration(
}
}
}
}
ScattererConfiguration
::
ScattererConfiguration
(
const
ScattererConfiguration
&
rhs
)
ScattererConfiguration
::
ScattererConfiguration
(
const
ScattererConfiguration
&
rhs
)
{
{
number_of_spheres
=
rhs
.
number_of_spheres
;
number_of_spheres
=
rhs
.
number_of_spheres
;
configurations
=
rhs
.
configurations
;
configurations
=
rhs
.
configurations
;
...
@@ -372,7 +372,7 @@ ScattererConfiguration::~ScattererConfiguration() {
...
@@ -372,7 +372,7 @@ ScattererConfiguration::~ScattererConfiguration() {
delete
[]
scale_vec
;
delete
[]
scale_vec
;
}
}
ScattererConfiguration
*
ScattererConfiguration
::
from_binary
(
string
file_name
,
string
mode
)
{
ScattererConfiguration
*
ScattererConfiguration
::
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
ScattererConfiguration
*
conf
=
NULL
;
ScattererConfiguration
*
conf
=
NULL
;
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
conf
=
ScattererConfiguration
::
from_legacy
(
file_name
);
conf
=
ScattererConfiguration
::
from_legacy
(
file_name
);
...
@@ -385,7 +385,7 @@ ScattererConfiguration* ScattererConfiguration::from_binary(string file_name, st
...
@@ -385,7 +385,7 @@ ScattererConfiguration* ScattererConfiguration::from_binary(string file_name, st
return
conf
;
return
conf
;
}
}
ScattererConfiguration
*
ScattererConfiguration
::
from_dedfb
(
string
dedfb_file_name
)
{
ScattererConfiguration
*
ScattererConfiguration
::
from_dedfb
(
const
std
::
string
&
dedfb_file_name
)
{
int
num_lines
=
0
;
int
num_lines
=
0
;
int
last_read_line
=
0
;
int
last_read_line
=
0
;
string
*
file_lines
;
string
*
file_lines
;
...
@@ -648,7 +648,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam
...
@@ -648,7 +648,7 @@ ScattererConfiguration* ScattererConfiguration::from_dedfb(string dedfb_file_nam
return
config
;
return
config
;
}
}
ScattererConfiguration
*
ScattererConfiguration
::
from_hdf5
(
string
file_name
)
{
ScattererConfiguration
*
ScattererConfiguration
::
from_hdf5
(
const
std
::
string
&
file_name
)
{
ScattererConfiguration
*
conf
=
NULL
;
ScattererConfiguration
*
conf
=
NULL
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
...
@@ -745,7 +745,7 @@ ScattererConfiguration* ScattererConfiguration::from_hdf5(string file_name) {
...
@@ -745,7 +745,7 @@ ScattererConfiguration* ScattererConfiguration::from_hdf5(string file_name) {
return
conf
;
return
conf
;
}
}
ScattererConfiguration
*
ScattererConfiguration
::
from_legacy
(
string
file_name
)
{
ScattererConfiguration
*
ScattererConfiguration
::
from_legacy
(
const
std
::
string
&
file_name
)
{
int
_nsph
;
int
_nsph
;
int
*
_iog_vec
;
int
*
_iog_vec
;
int
_ies
;
int
_ies
;
...
@@ -832,7 +832,7 @@ ScattererConfiguration* ScattererConfiguration::from_legacy(string file_name) {
...
@@ -832,7 +832,7 @@ ScattererConfiguration* ScattererConfiguration::from_legacy(string file_name) {
return
conf
;
return
conf
;
}
}
double
ScattererConfiguration
::
get_param
(
string
param_name
)
{
double
ScattererConfiguration
::
get_param
(
const
std
::
string
&
param_name
)
{
double
value
;
double
value
;
if
(
param_name
.
compare
(
"number_of_spheres"
)
==
0
)
value
=
(
double
)
number_of_spheres
;
if
(
param_name
.
compare
(
"number_of_spheres"
)
==
0
)
value
=
(
double
)
number_of_spheres
;
else
if
(
param_name
.
compare
(
"nsph"
)
==
0
)
value
=
(
double
)
number_of_spheres
;
else
if
(
param_name
.
compare
(
"nsph"
)
==
0
)
value
=
(
double
)
number_of_spheres
;
...
@@ -899,7 +899,7 @@ void ScattererConfiguration::print() {
...
@@ -899,7 +899,7 @@ void ScattererConfiguration::print() {
printf
(
" ]
\n
"
);
printf
(
" ]
\n
"
);
}
}
void
ScattererConfiguration
::
write_binary
(
string
file_name
,
string
mode
)
{
void
ScattererConfiguration
::
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
write_legacy
(
file_name
);
write_legacy
(
file_name
);
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
...
@@ -910,7 +910,7 @@ void ScattererConfiguration::write_binary(string file_name, string mode) {
...
@@ -910,7 +910,7 @@ void ScattererConfiguration::write_binary(string file_name, string mode) {
}
}
}
}
void
ScattererConfiguration
::
write_hdf5
(
string
file_name
)
{
void
ScattererConfiguration
::
write_hdf5
(
const
std
::
string
&
file_name
)
{
int
ies
=
(
use_external_sphere
)
?
1
:
0
;
int
ies
=
(
use_external_sphere
)
?
1
:
0
;
List
<
string
>
*
rec_name_list
=
new
List
<
string
>
(
1
);
List
<
string
>
*
rec_name_list
=
new
List
<
string
>
(
1
);
List
<
string
>
*
rec_type_list
=
new
List
<
string
>
(
1
);
List
<
string
>
*
rec_type_list
=
new
List
<
string
>
(
1
);
...
@@ -1016,7 +1016,7 @@ void ScattererConfiguration::write_hdf5(string file_name) {
...
@@ -1016,7 +1016,7 @@ void ScattererConfiguration::write_hdf5(string file_name) {
delete
hdf_file
;
delete
hdf_file
;
}
}
void
ScattererConfiguration
::
write_legacy
(
string
file_name
)
{
void
ScattererConfiguration
::
write_legacy
(
const
std
::
string
&
file_name
)
{
fstream
output
;
fstream
output
;
int
ies
=
(
use_external_sphere
)
?
1
:
0
;
int
ies
=
(
use_external_sphere
)
?
1
:
0
;
output
.
open
(
file_name
.
c_str
(),
ios
::
out
|
ios
::
binary
);
output
.
open
(
file_name
.
c_str
(),
ios
::
out
|
ios
::
binary
);
...
@@ -1062,7 +1062,7 @@ void ScattererConfiguration::write_legacy(string file_name) {
...
@@ -1062,7 +1062,7 @@ void ScattererConfiguration::write_legacy(string file_name) {
output
.
close
();
output
.
close
();
}
}
void
ScattererConfiguration
::
write_formatted
(
string
file_name
)
{
void
ScattererConfiguration
::
write_formatted
(
const
std
::
string
&
file_name
)
{
const
double
evc
=
6.5821188e-16
;
const
double
evc
=
6.5821188e-16
;
const
double
two_pi
=
acos
(
0.0
)
*
4.0
;
const
double
two_pi
=
acos
(
0.0
)
*
4.0
;
double
*
xi_vec
;
double
*
xi_vec
;
...
@@ -1244,7 +1244,7 @@ void ScattererConfiguration::write_formatted(string file_name) {
...
@@ -1244,7 +1244,7 @@ void ScattererConfiguration::write_formatted(string file_name) {
fclose
(
output
);
fclose
(
output
);
}
}
bool
ScattererConfiguration
::
operator
==
(
ScattererConfiguration
&
other
)
{
bool
ScattererConfiguration
::
operator
==
(
const
ScattererConfiguration
&
other
)
{
if
(
number_of_spheres
!=
other
.
number_of_spheres
)
{
if
(
number_of_spheres
!=
other
.
number_of_spheres
)
{
return
false
;
return
false
;
}
}
...
...
src/libnptm/Parsers.cpp
View file @
bd60eab6
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include
"../include/Parsers.h"
#include
"../include/Parsers.h"
#endif
#endif
std
::
string
*
load_file
(
std
::
string
file_name
,
int
*
count
=
0
)
{
std
::
string
*
load_file
(
const
std
::
string
&
file_name
,
int
*
count
=
0
)
{
std
::
fstream
input_file
(
file_name
.
c_str
(),
std
::
ios
::
in
);
std
::
fstream
input_file
(
file_name
.
c_str
(),
std
::
ios
::
in
);
List
<
std
::
string
>
*
file_lines
=
new
List
<
std
::
string
>
();
List
<
std
::
string
>
*
file_lines
=
new
List
<
std
::
string
>
();
std
::
string
line
;
std
::
string
line
;
...
...
src/libnptm/TransitionMatrix.cpp
View file @
bd60eab6
...
@@ -94,7 +94,7 @@ TransitionMatrix::TransitionMatrix(
...
@@ -94,7 +94,7 @@ TransitionMatrix::TransitionMatrix(
}
}
}
}
TransitionMatrix
*
TransitionMatrix
::
from_binary
(
std
::
string
file_name
,
std
::
string
mode
)
{
TransitionMatrix
*
TransitionMatrix
::
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
TransitionMatrix
*
tm
=
NULL
;
TransitionMatrix
*
tm
=
NULL
;
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
tm
=
TransitionMatrix
::
from_legacy
(
file_name
);
tm
=
TransitionMatrix
::
from_legacy
(
file_name
);
...
@@ -107,7 +107,7 @@ TransitionMatrix* TransitionMatrix::from_binary(std::string file_name, std::stri
...
@@ -107,7 +107,7 @@ TransitionMatrix* TransitionMatrix::from_binary(std::string file_name, std::stri
return
tm
;
return
tm
;
}
}
TransitionMatrix
*
TransitionMatrix
::
from_hdf5
(
std
::
string
file_name
)
{
TransitionMatrix
*
TransitionMatrix
::
from_hdf5
(
const
std
::
string
&
file_name
)
{
TransitionMatrix
*
tm
=
NULL
;
TransitionMatrix
*
tm
=
NULL
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
...
@@ -160,7 +160,7 @@ TransitionMatrix* TransitionMatrix::from_hdf5(std::string file_name) {
...
@@ -160,7 +160,7 @@ TransitionMatrix* TransitionMatrix::from_hdf5(std::string file_name) {
return
tm
;
return
tm
;
}
}
TransitionMatrix
*
TransitionMatrix
::
from_legacy
(
std
::
string
file_name
)
{
TransitionMatrix
*
TransitionMatrix
::
from_legacy
(
const
std
::
string
&
file_name
)
{
fstream
ttms
;
fstream
ttms
;
TransitionMatrix
*
tm
=
NULL
;
TransitionMatrix
*
tm
=
NULL
;
ttms
.
open
(
file_name
,
ios
::
binary
|
ios
::
in
);
ttms
.
open
(
file_name
,
ios
::
binary
|
ios
::
in
);
...
@@ -207,7 +207,7 @@ TransitionMatrix* TransitionMatrix::from_legacy(std::string file_name) {
...
@@ -207,7 +207,7 @@ TransitionMatrix* TransitionMatrix::from_legacy(std::string file_name) {
return
tm
;
return
tm
;
}
}
void
TransitionMatrix
::
write_binary
(
std
::
string
file_name
,
std
::
string
mode
)
{
void
TransitionMatrix
::
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
write_legacy
(
file_name
);
write_legacy
(
file_name
);
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
...
@@ -219,8 +219,8 @@ void TransitionMatrix::write_binary(std::string file_name, std::string mode) {
...
@@ -219,8 +219,8 @@ void TransitionMatrix::write_binary(std::string file_name, std::string mode) {
}
}
void
TransitionMatrix
::
write_binary
(
void
TransitionMatrix
::
write_binary
(
std
::
string
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
const
std
::
string
&
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_am0m
,
std
::
string
mode
double
_exri
,
dcomplex
**
_am0m
,
const
std
::
string
&
mode
)
{
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
write_legacy
(
file_name
,
_nlemt
,
_lm
,
_vk
,
_exri
,
_am0m
);
write_legacy
(
file_name
,
_nlemt
,
_lm
,
_vk
,
_exri
,
_am0m
);
...
@@ -233,9 +233,9 @@ void TransitionMatrix::write_binary(
...
@@ -233,9 +233,9 @@ void TransitionMatrix::write_binary(
}
}
void
TransitionMatrix
::
write_binary
(
void
TransitionMatrix
::
write_binary
(
std
::
string
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
const
std
::
string
&
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
,
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
,
std
::
string
mode
const
std
::
string
&
mode
)
{
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
write_legacy
(
file_name
,
_lm
,
_vk
,
_exri
,
_rmi
,
_rei
,
_sphere_radius
);
write_legacy
(
file_name
,
_lm
,
_vk
,
_exri
,
_rmi
,
_rei
,
_sphere_radius
);
...
@@ -247,7 +247,7 @@ void TransitionMatrix::write_binary(
...
@@ -247,7 +247,7 @@ void TransitionMatrix::write_binary(
}
}
}
}
void
TransitionMatrix
::
write_hdf5
(
std
::
string
file_name
)
{
void
TransitionMatrix
::
write_hdf5
(
const
std
::
string
&
file_name
)
{
if
(
is
==
1
||
is
==
1111
)
{
if
(
is
==
1
||
is
==
1111
)
{
List
<
string
>
rec_name_list
(
1
);
List
<
string
>
rec_name_list
(
1
);
List
<
string
>
rec_type_list
(
1
);
List
<
string
>
rec_type_list
(
1
);
...
@@ -298,7 +298,7 @@ void TransitionMatrix::write_hdf5(std::string file_name) {
...
@@ -298,7 +298,7 @@ void TransitionMatrix::write_hdf5(std::string file_name) {
}
}
void
TransitionMatrix
::
write_hdf5
(
void
TransitionMatrix
::
write_hdf5
(
std
::
string
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
const
std
::
string
&
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_am0m
double
_exri
,
dcomplex
**
_am0m
)
{
)
{
int
is
=
1
;
int
is
=
1
;
...
@@ -344,7 +344,7 @@ void TransitionMatrix::write_hdf5(
...
@@ -344,7 +344,7 @@ void TransitionMatrix::write_hdf5(
}
}
void
TransitionMatrix
::
write_hdf5
(
void
TransitionMatrix
::
write_hdf5
(
std
::
string
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
const
std
::
string
&
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
)
{
)
{
int
is
=
1111
;
int
is
=
1111
;
...
@@ -394,7 +394,7 @@ void TransitionMatrix::write_hdf5(
...
@@ -394,7 +394,7 @@ void TransitionMatrix::write_hdf5(
delete
hdf_file
;
delete
hdf_file
;
}
}
void
TransitionMatrix
::
write_legacy
(
std
::
string
file_name
)
{
void
TransitionMatrix
::
write_legacy
(
const
std
::
string
&
file_name
)
{
fstream
ttms
;
fstream
ttms
;
if
(
is
==
1111
||
is
==
1
)
{
if
(
is
==
1111
||
is
==
1
)
{
ttms
.
open
(
file_name
,
ios
::
binary
|
ios
::
out
);
ttms
.
open
(
file_name
,
ios
::
binary
|
ios
::
out
);
...
@@ -428,7 +428,7 @@ void TransitionMatrix::write_legacy(std::string file_name) {
...
@@ -428,7 +428,7 @@ void TransitionMatrix::write_legacy(std::string file_name) {
}
}
void
TransitionMatrix
::
write_legacy
(
void
TransitionMatrix
::
write_legacy
(
std
::
string
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
const
std
::
string
&
file_name
,
np_int
_nlemt
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_am0m
double
_exri
,
dcomplex
**
_am0m
)
{
)
{
fstream
ttms
;
fstream
ttms
;
...
@@ -455,7 +455,7 @@ void TransitionMatrix::write_legacy(
...
@@ -455,7 +455,7 @@ void TransitionMatrix::write_legacy(
}
}
void
TransitionMatrix
::
write_legacy
(
void
TransitionMatrix
::
write_legacy
(
std
::
string
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
const
std
::
string
&
file_name
,
int
_lm
,
double
_vk
,
double
_exri
,
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
dcomplex
**
_rmi
,
dcomplex
**
_rei
,
double
_sphere_radius
)
{
)
{
fstream
ttms
;
fstream
ttms
;
...
...
src/libnptm/file_io.cpp
View file @
bd60eab6
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
using
namespace
std
;
using
namespace
std
;
FileSchema
::
FileSchema
(
int
num_rec
,
string
*
rec_types
,
string
*
rec_names
)
{
FileSchema
::
FileSchema
(
int
num_rec
,
const
std
::
string
*
rec_types
,
const
std
::
string
*
rec_names
)
{
num_records
=
num_rec
;
num_records
=
num_rec
;
record_types
=
new
string
[
num_rec
];
record_types
=
new
string
[
num_rec
];
record_names
=
new
string
[
num_rec
];
record_names
=
new
string
[
num_rec
];
...
@@ -49,7 +49,7 @@ string* FileSchema::get_record_types() {
...
@@ -49,7 +49,7 @@ string* FileSchema::get_record_types() {
return
rec_types
;
return
rec_types
;
}
}
HDFFile
::
HDFFile
(
string
name
,
unsigned
int
flags
,
hid_t
fcpl_id
,
hid_t
fapl_id
)
{
HDFFile
::
HDFFile
(
const
std
::
string
&
name
,
unsigned
int
flags
,
hid_t
fcpl_id
,
hid_t
fapl_id
)
{
file_name
=
name
;
file_name
=
name
;
if
(
flags
==
H5F_ACC_EXCL
||
flags
==
H5F_ACC_TRUNC
)
if
(
flags
==
H5F_ACC_EXCL
||
flags
==
H5F_ACC_TRUNC
)
file_id
=
H5Fcreate
(
name
.
c_str
(),
flags
,
fcpl_id
,
fapl_id
);
file_id
=
H5Fcreate
(
name
.
c_str
(),
flags
,
fcpl_id
,
fapl_id
);
...
@@ -73,7 +73,7 @@ herr_t HDFFile::close() {
...
@@ -73,7 +73,7 @@ herr_t HDFFile::close() {
}
}
HDFFile
*
HDFFile
::
from_schema
(
HDFFile
*
HDFFile
::
from_schema
(
FileSchema
&
schema
,
string
name
,
unsigned
int
flags
,
FileSchema
&
schema
,
const
std
::
string
&
name
,
unsigned
int
flags
,
hid_t
fcpl_id
,
hid_t
fapl_id
hid_t
fcpl_id
,
hid_t
fapl_id
)
{
)
{
HDFFile
*
hdf_file
=
new
HDFFile
(
name
,
flags
,
fcpl_id
,
fapl_id
);
HDFFile
*
hdf_file
=
new
HDFFile
(
name
,
flags
,
fcpl_id
,
fapl_id
);
...
@@ -144,9 +144,9 @@ HDFFile* HDFFile::from_schema(
...
@@ -144,9 +144,9 @@ HDFFile* HDFFile::from_schema(
}
}
herr_t
HDFFile
::
read
(
herr_t
HDFFile
::
read
(
string
dataset_name
,
string
data_type
,
void
*
buffer
,
const
std
::
string
&
dataset_name
,
const
std
::
string
&
data_type
,
void
*
buffer
,
hid_t
mem_space_id
,
hid_t
file_space_id
,
hid_t
dapl_id
,
hid_t
mem_space_id
,
hid_t
file_space_id
,
hid_t
dapl_id
,
hid_t
dxpl_id
hid_t
dxpl_id
)
{
)
{
string
known_types
[]
=
{
"INT32"
,
"FLOAT64"
};
string
known_types
[]
=
{
"INT32"
,
"FLOAT64"
};
regex
re
;
regex
re
;
...
@@ -183,7 +183,7 @@ herr_t HDFFile::read(
...
@@ -183,7 +183,7 @@ herr_t HDFFile::read(
}
}
herr_t
HDFFile
::
write
(
herr_t
HDFFile
::
write
(
string
dataset_name
,
string
data_type
,
const
void
*
buffer
,
const
std
::
string
&
dataset_name
,
const
std
::
string
&
data_type
,
const
void
*
buffer
,
hid_t
mem_space_id
,
hid_t
file_space_id
,
hid_t
dapl_id
,
hid_t
mem_space_id
,
hid_t
file_space_id
,
hid_t
dapl_id
,
hid_t
dxpl_id
hid_t
dxpl_id
)
{
)
{
...
...
src/libnptm/logging.cpp
View file @
bd60eab6
...
@@ -25,7 +25,7 @@ Logger::~Logger() {
...
@@ -25,7 +25,7 @@ Logger::~Logger() {
delete
last_message
;
delete
last_message
;
}
}
void
Logger
::
err
(
std
::
string
message
)
{
void
Logger
::
err
(
const
std
::
string
&
message
)
{
#pragma omp critical
#pragma omp critical
{
{
fprintf
(
err_output
,
"%s"
,
message
.
c_str
());
fprintf
(
err_output
,
"%s"
,
message
.
c_str
());
...
@@ -52,7 +52,7 @@ void Logger::flush(int level) {
...
@@ -52,7 +52,7 @@ void Logger::flush(int level) {
}
}
}
}
void
Logger
::
log
(
std
::
string
message
,
int
level
)
{
void
Logger
::
log
(
const
std
::
string
&
message
,
int
level
)
{
#pragma omp critical
#pragma omp critical
{
{
if
(
level
==
LOG_ERRO
)
err
(
message
);
if
(
level
==
LOG_ERRO
)
err
(
message
);
...
@@ -65,7 +65,7 @@ void Logger::log(std::string message, int level) {
...
@@ -65,7 +65,7 @@ void Logger::log(std::string message, int level) {
}
}
}
}
void
Logger
::
push
(
std
::
string
message
)
{
void
Logger
::
push
(
const
std
::
string
&
message
)
{
#pragma omp critical
#pragma omp critical
{
{
if
(
repetitions
>
0
)
{
if
(
repetitions
>
0
)
{
...
...
src/libnptm/tfrfme.cpp
View file @
bd60eab6
...
@@ -41,7 +41,7 @@ Swap1::Swap1(int lm, int _nkv) {
...
@@ -41,7 +41,7 @@ Swap1::Swap1(int lm, int _nkv) {
last_index
=
0
;
last_index
=
0
;
}
}
Swap1
*
Swap1
::
from_binary
(
string
file_name
,
string
mode
)
{
Swap1
*
Swap1
::
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
Swap1
*
instance
=
NULL
;
Swap1
*
instance
=
NULL
;
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
instance
=
from_legacy
(
file_name
);
instance
=
from_legacy
(
file_name
);
...
@@ -54,7 +54,7 @@ Swap1* Swap1::from_binary(string file_name, string mode) {
...
@@ -54,7 +54,7 @@ Swap1* Swap1::from_binary(string file_name, string mode) {
return
instance
;
return
instance
;
}
}
Swap1
*
Swap1
::
from_hdf5
(
string
file_name
)
{
Swap1
*
Swap1
::
from_hdf5
(
const
std
::
string
&
file_name
)
{
Swap1
*
instance
=
NULL
;
Swap1
*
instance
=
NULL
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
...
@@ -86,7 +86,7 @@ Swap1* Swap1::from_hdf5(string file_name) {
...
@@ -86,7 +86,7 @@ Swap1* Swap1::from_hdf5(string file_name) {
return
instance
;
return
instance
;
}
}
Swap1
*
Swap1
::
from_legacy
(
string
file_name
)
{
Swap1
*
Swap1
::
from_legacy
(
const
std
::
string
&
file_name
)
{
fstream
input
;
fstream
input
;
Swap1
*
instance
=
NULL
;
Swap1
*
instance
=
NULL
;
dcomplex
*
_wk
=
NULL
;
dcomplex
*
_wk
=
NULL
;
...
@@ -118,7 +118,7 @@ long Swap1::get_memory_requirement(int lm, int _nkv) {
...
@@ -118,7 +118,7 @@ long Swap1::get_memory_requirement(int lm, int _nkv) {
return
size
;
return
size
;
}
}
void
Swap1
::
write_binary
(
string
file_name
,
string
mode
)
{
void
Swap1
::
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
write_legacy
(
file_name
);
write_legacy
(
file_name
);
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
...
@@ -129,7 +129,7 @@ void Swap1::write_binary(string file_name, string mode) {
...
@@ -129,7 +129,7 @@ void Swap1::write_binary(string file_name, string mode) {
}
}
}
}
void
Swap1
::
write_hdf5
(
string
file_name
)
{
void
Swap1
::
write_hdf5
(
const
std
::
string
&
file_name
)
{
List
<
string
>
rec_name_list
(
1
);
List
<
string
>
rec_name_list
(
1
);
List
<
string
>
rec_type_list
(
1
);
List
<
string
>
rec_type_list
(
1
);
List
<
void
*>
rec_ptr_list
(
1
);
List
<
void
*>
rec_ptr_list
(
1
);
...
@@ -169,7 +169,7 @@ void Swap1::write_hdf5(string file_name) {
...
@@ -169,7 +169,7 @@ void Swap1::write_hdf5(string file_name) {
delete
hdf_file
;
delete
hdf_file
;
}
}
void
Swap1
::
write_legacy
(
string
file_name
)
{
void
Swap1
::
write_legacy
(
const
std
::
string
&
file_name
)
{
fstream
output
;
fstream
output
;
double
rval
,
ival
;
double
rval
,
ival
;
output
.
open
(
file_name
.
c_str
(),
ios
::
out
|
ios
::
binary
);
output
.
open
(
file_name
.
c_str
(),
ios
::
out
|
ios
::
binary
);
...
@@ -222,7 +222,7 @@ Swap2::~Swap2() {
...
@@ -222,7 +222,7 @@ Swap2::~Swap2() {
delete
[]
vkzm
;
delete
[]
vkzm
;
}
}
Swap2
*
Swap2
::
from_binary
(
string
file_name
,
string
mode
)
{
Swap2
*
Swap2
::
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
Swap2
*
instance
=
NULL
;
Swap2
*
instance
=
NULL
;
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
instance
=
from_legacy
(
file_name
);
instance
=
from_legacy
(
file_name
);
...
@@ -235,7 +235,7 @@ Swap2* Swap2::from_binary(string file_name, string mode) {
...
@@ -235,7 +235,7 @@ Swap2* Swap2::from_binary(string file_name, string mode) {
return
instance
;
return
instance
;
}
}
Swap2
*
Swap2
::
from_hdf5
(
string
file_name
)
{
Swap2
*
Swap2
::
from_hdf5
(
const
std
::
string
&
file_name
)
{
Swap2
*
instance
=
NULL
;
Swap2
*
instance
=
NULL
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
...
@@ -282,7 +282,7 @@ Swap2* Swap2::from_hdf5(string file_name) {
...
@@ -282,7 +282,7 @@ Swap2* Swap2::from_hdf5(string file_name) {
return
instance
;
return
instance
;
}
}
Swap2
*
Swap2
::
from_legacy
(
string
file_name
)
{
Swap2
*
Swap2
::
from_legacy
(
const
std
::
string
&
file_name
)
{
fstream
input
;
fstream
input
;
Swap2
*
instance
=
NULL
;
Swap2
*
instance
=
NULL
;
int
_nkv
,
_nlmmt
,
_nrvc
;
int
_nkv
,
_nlmmt
,
_nrvc
;
...
@@ -344,7 +344,7 @@ long Swap2::get_memory_requirement(int _nkv) {
...
@@ -344,7 +344,7 @@ long Swap2::get_memory_requirement(int _nkv) {
return
size
;
return
size
;
}
}
double
Swap2
::
get_param
(
string
param_name
)
{
double
Swap2
::
get_param
(
const
std
::
string
&
param_name
)
{
double
value
;
double
value
;
if
(
param_name
.
compare
(
"nkv"
)
==
0
)
value
=
1.0
*
nkv
;
if
(
param_name
.
compare
(
"nkv"
)
==
0
)
value
=
1.0
*
nkv
;
else
if
(
param_name
.
compare
(
"apfafa"
)
==
0
)
value
=
apfafa
;
else
if
(
param_name
.
compare
(
"apfafa"
)
==
0
)
value
=
apfafa
;
...
@@ -374,7 +374,7 @@ void Swap2::push_matrix(double value) {
...
@@ -374,7 +374,7 @@ void Swap2::push_matrix(double value) {
last_matrix
++
;
last_matrix
++
;
}
}
void
Swap2
::
set_param
(
string
param_name
,
double
value
)
{
void
Swap2
::
set_param
(
const
std
::
string
&
param_name
,
double
value
)
{
if
(
param_name
.
compare
(
"nkv"
)
==
0
)
nkv
=
(
int
)
value
;
if
(
param_name
.
compare
(
"nkv"
)
==
0
)
nkv
=
(
int
)
value
;
else
if
(
param_name
.
compare
(
"apfafa"
)
==
0
)
apfafa
=
value
;
else
if
(
param_name
.
compare
(
"apfafa"
)
==
0
)
apfafa
=
value
;
else
if
(
param_name
.
compare
(
"pmf"
)
==
0
)
pmf
=
value
;
else
if
(
param_name
.
compare
(
"pmf"
)
==
0
)
pmf
=
value
;
...
@@ -395,7 +395,7 @@ void Swap2::set_param(string param_name, double value) {
...
@@ -395,7 +395,7 @@ void Swap2::set_param(string param_name, double value) {
}
}
}
}
void
Swap2
::
write_binary
(
string
file_name
,
string
mode
)
{
void
Swap2
::
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
write_legacy
(
file_name
);
write_legacy
(
file_name
);
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
...
@@ -406,7 +406,7 @@ void Swap2::write_binary(string file_name, string mode) {
...
@@ -406,7 +406,7 @@ void Swap2::write_binary(string file_name, string mode) {
}
}
}
}
void
Swap2
::
write_hdf5
(
string
file_name
)
{
void
Swap2
::
write_hdf5
(
const
std
::
string
&
file_name
)
{
List
<
string
>
rec_name_list
(
1
);
List
<
string
>
rec_name_list
(
1
);
List
<
string
>
rec_type_list
(
1
);
List
<
string
>
rec_type_list
(
1
);
List
<
void
*>
rec_ptr_list
(
1
);
List
<
void
*>
rec_ptr_list
(
1
);
...
@@ -479,7 +479,7 @@ void Swap2::write_hdf5(string file_name) {
...
@@ -479,7 +479,7 @@ void Swap2::write_hdf5(string file_name) {
delete
hdf_file
;
delete
hdf_file
;
}
}
void
Swap2
::
write_legacy
(
string
file_name
)
{
void
Swap2
::
write_legacy
(
const
std
::
string
&
file_name
)
{
fstream
output
;
fstream
output
;
double
value
;
double
value
;
output
.
open
(
file_name
.
c_str
(),
ios
::
out
|
ios
::
binary
);
output
.
open
(
file_name
.
c_str
(),
ios
::
out
|
ios
::
binary
);
...
@@ -608,7 +608,7 @@ TFRFME::~TFRFME() {
...
@@ -608,7 +608,7 @@ TFRFME::~TFRFME() {
delete
[]
wsum
;
delete
[]
wsum
;
}
}
TFRFME
*
TFRFME
::
from_binary
(
string
file_name
,
string
mode
)
{
TFRFME
*
TFRFME
::
from_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
TFRFME
*
instance
=
NULL
;
TFRFME
*
instance
=
NULL
;
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
instance
=
from_legacy
(
file_name
);
instance
=
from_legacy
(
file_name
);
...
@@ -621,7 +621,7 @@ TFRFME* TFRFME::from_binary(string file_name, string mode) {
...
@@ -621,7 +621,7 @@ TFRFME* TFRFME::from_binary(string file_name, string mode) {
return
instance
;
return
instance
;
}
}
TFRFME
*
TFRFME
::
from_hdf5
(
string
file_name
)
{
TFRFME
*
TFRFME
::
from_hdf5
(
const
std
::
string
&
file_name
)
{
TFRFME
*
instance
=
NULL
;
TFRFME
*
instance
=
NULL
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
unsigned
int
flags
=
H5F_ACC_RDONLY
;
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
HDFFile
*
hdf_file
=
new
HDFFile
(
file_name
,
flags
);
...
@@ -685,7 +685,7 @@ TFRFME* TFRFME::from_hdf5(string file_name) {
...
@@ -685,7 +685,7 @@ TFRFME* TFRFME::from_hdf5(string file_name) {
return
instance
;
return
instance
;
}
}
TFRFME
*
TFRFME
::
from_legacy
(
string
file_name
)
{
TFRFME
*
TFRFME
::
from_legacy
(
const
std
::
string
&
file_name
)
{
fstream
input
;
fstream
input
;
TFRFME
*
instance
=
NULL
;
TFRFME
*
instance
=
NULL
;
dcomplex
**
_wsum
=
NULL
;
dcomplex
**
_wsum
=
NULL
;
...
@@ -763,7 +763,7 @@ long TFRFME::get_memory_requirement(
...
@@ -763,7 +763,7 @@ long TFRFME::get_memory_requirement(
return
size
;
return
size
;
}
}
double
TFRFME
::
get_param
(
string
param_name
)
{
double
TFRFME
::
get_param
(
const
std
::
string
&
param_name
)
{
double
value
;
double
value
;
if
(
param_name
.
compare
(
"vk"
)
==
0
)
value
=
vk
;
if
(
param_name
.
compare
(
"vk"
)
==
0
)
value
=
vk
;
else
if
(
param_name
.
compare
(
"exri"
)
==
0
)
value
=
exri
;
else
if
(
param_name
.
compare
(
"exri"
)
==
0
)
value
=
exri
;
...
@@ -786,7 +786,7 @@ double TFRFME::get_param(string param_name) {
...
@@ -786,7 +786,7 @@ double TFRFME::get_param(string param_name) {
return
value
;
return
value
;
}
}
void
TFRFME
::
set_param
(
string
param_name
,
double
value
)
{
void
TFRFME
::
set_param
(
const
std
::
string
&
param_name
,
double
value
)
{
if
(
param_name
.
compare
(
"vk"
)
==
0
)
vk
=
value
;
if
(
param_name
.
compare
(
"vk"
)
==
0
)
vk
=
value
;
else
if
(
param_name
.
compare
(
"exri"
)
==
0
)
exri
=
value
;
else
if
(
param_name
.
compare
(
"exri"
)
==
0
)
exri
=
value
;
else
if
(
param_name
.
compare
(
"an"
)
==
0
)
an
=
value
;
else
if
(
param_name
.
compare
(
"an"
)
==
0
)
an
=
value
;
...
@@ -801,7 +801,7 @@ void TFRFME::set_param(string param_name, double value) {
...
@@ -801,7 +801,7 @@ void TFRFME::set_param(string param_name, double value) {
}
}
}
}
void
TFRFME
::
write_binary
(
string
file_name
,
string
mode
)
{
void
TFRFME
::
write_binary
(
const
std
::
string
&
file_name
,
const
std
::
string
&
mode
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
if
(
mode
.
compare
(
"LEGACY"
)
==
0
)
{
write_legacy
(
file_name
);
write_legacy
(
file_name
);
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
}
else
if
(
mode
.
compare
(
"HDF5"
)
==
0
)
{
...
@@ -812,7 +812,7 @@ void TFRFME::write_binary(string file_name, string mode) {
...
@@ -812,7 +812,7 @@ void TFRFME::write_binary(string file_name, string mode) {
}
}
}
}
void
TFRFME
::
write_hdf5
(
string
file_name
)
{
void
TFRFME
::
write_hdf5
(
const
std
::
string
&
file_name
)
{
List
<
string
>
rec_name_list
(
1
);
List
<
string
>
rec_name_list
(
1
);
List
<
string
>
rec_type_list
(
1
);
List
<
string
>
rec_type_list
(
1
);
List
<
void
*>
rec_ptr_list
(
1
);
List
<
void
*>
rec_ptr_list
(
1
);
...
@@ -905,7 +905,7 @@ void TFRFME::write_hdf5(string file_name) {
...
@@ -905,7 +905,7 @@ void TFRFME::write_hdf5(string file_name) {
delete
hdf_file
;
delete
hdf_file
;
}
}
void
TFRFME
::
write_legacy
(
string
file_name
)
{
void
TFRFME
::
write_legacy
(
const
std
::
string
&
file_name
)
{
fstream
output
;
fstream
output
;
output
.
open
(
file_name
.
c_str
(),
ios
::
out
|
ios
::
binary
);
output
.
open
(
file_name
.
c_str
(),
ios
::
out
|
ios
::
binary
);
if
(
output
.
is_open
())
{
if
(
output
.
is_open
())
{
...
@@ -943,7 +943,7 @@ void TFRFME::write_legacy(string file_name) {
...
@@ -943,7 +943,7 @@ void TFRFME::write_legacy(string file_name) {
}
}
}
}
bool
TFRFME
::
operator
==
(
TFRFME
&
other
)
{
bool
TFRFME
::
operator
==
(
const
TFRFME
&
other
)
{
if
(
lmode
!=
other
.
lmode
)
{
if
(
lmode
!=
other
.
lmode
)
{
return
false
;
return
false
;
}
}
...
...