use explicit const references
This commit is contained in:
@ -64,10 +64,10 @@ void DumpYAML::write_header(bigint ndump)
|
||||
if (update->ntimestep == th->get_timestep()) {
|
||||
|
||||
thermo_data += "thermo:\n - keywords: [ ";
|
||||
for (auto key : th->get_keywords()) thermo_data += fmt::format("{}, ", key);
|
||||
for (const auto &key : th->get_keywords()) thermo_data += fmt::format("{}, ", key);
|
||||
thermo_data += "]\n - data: [ ";
|
||||
|
||||
for (auto val : th->get_fields()) {
|
||||
for (const auto &val : th->get_fields()) {
|
||||
if (val.type == multitype::DOUBLE)
|
||||
thermo_data += fmt::format("{}, ", val.data.d);
|
||||
else if (val.type == multitype::INT)
|
||||
@ -90,7 +90,7 @@ void DumpYAML::write_header(bigint ndump)
|
||||
|
||||
fmt::print(fp, "natoms: {}\n", ndump);
|
||||
fputs("boundary: [ ", fp);
|
||||
for (const auto bflag : boundary) {
|
||||
for (const auto &bflag : boundary) {
|
||||
if (bflag == ' ') continue;
|
||||
fmt::print(fp, "{}, ", bflag);
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ void DumpNetCDF::openfile()
|
||||
|
||||
// perframe variables
|
||||
if (thermo) {
|
||||
auto keywords = output->thermo->get_keywords();
|
||||
const auto &keywords = output->thermo->get_keywords();
|
||||
int nfield = keywords.size();
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
NCERRX( nc_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() );
|
||||
@ -433,8 +433,8 @@ void DumpNetCDF::openfile()
|
||||
|
||||
// perframe variables
|
||||
if (thermo) {
|
||||
auto fields = output->thermo->get_fields();
|
||||
auto keywords = output->thermo->get_keywords();
|
||||
const auto &fields = output->thermo->get_fields();
|
||||
const auto &keywords = output->thermo->get_keywords();
|
||||
int nfield = fields.size();
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
if (fields[i].type == multitype::DOUBLE) {
|
||||
@ -600,8 +600,8 @@ void DumpNetCDF::write()
|
||||
start[1] = 0;
|
||||
|
||||
if (thermo) {
|
||||
auto keywords = output->thermo->get_keywords();
|
||||
auto fields = output->thermo->get_fields();
|
||||
const auto &keywords = output->thermo->get_keywords();
|
||||
const auto &fields = output->thermo->get_fields();
|
||||
int nfield = fields.size();
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
if (filewriter) {
|
||||
|
||||
@ -318,7 +318,7 @@ void DumpNetCDFMPIIO::openfile()
|
||||
|
||||
// perframe variables
|
||||
if (thermo) {
|
||||
auto keywords = output->thermo->get_keywords();
|
||||
const auto &keywords = output->thermo->get_keywords();
|
||||
int nfield = keywords.size();
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
NCERRX( ncmpi_inq_varid(ncid, keywords[i].c_str(), &thermovar[i]), keywords[i].c_str() );
|
||||
@ -423,8 +423,8 @@ void DumpNetCDFMPIIO::openfile()
|
||||
|
||||
// perframe variables
|
||||
if (thermo) {
|
||||
auto fields = output->thermo->get_fields();
|
||||
auto keywords = output->thermo->get_keywords();
|
||||
const auto &fields = output->thermo->get_fields();
|
||||
const auto &keywords = output->thermo->get_keywords();
|
||||
int nfield = fields.size();
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
if (fields[i].type == multitype::DOUBLE) {
|
||||
@ -593,8 +593,8 @@ void DumpNetCDFMPIIO::write()
|
||||
NCERR( ncmpi_begin_indep_data(ncid) );
|
||||
|
||||
if (thermo) {
|
||||
auto keywords = output->thermo->get_keywords();
|
||||
auto fields = output->thermo->get_fields();
|
||||
const auto &keywords = output->thermo->get_keywords();
|
||||
const auto &fields = output->thermo->get_fields();
|
||||
int nfield = fields.size();
|
||||
for (int i = 0; i < nfield; i++) {
|
||||
if (filewriter) {
|
||||
|
||||
Reference in New Issue
Block a user