Commit a10f1e42 authored by Alain O' Miniussi's avatar Alain O' Miniussi
Browse files

map loop syntax

parent f8b9e6ef
......@@ -738,9 +738,8 @@ namespace fargOCA {
fields.insert(pair("radiative_energy", *radiativeEnergy()));
fields.insert(pair("radiative_energy_derivative", *radiativeEnergyDerivative()));
}
for (auto const& p : myTracers) {
for (auto const&[k,f] : myTracers) {
using namespace boost;
ScalarField const& f = p.second;
fields.insert(pair(str(format("tracers/%1%")%f.name()), f));
}
for (auto& uf : myUserFields) {
......@@ -748,10 +747,8 @@ namespace fargOCA {
fmt << "/user/" << uf.first;
fields.insert(pair(fmt.str(), uf.second));
}
for(auto const& p : fields ) {
std::string path = p.first;
ScalarField const& field = p.second;
auto data = field.merged(writer);
for(auto const&[path, field] : fields ) {
std::optional<arr3d<real const>> data = field.merged(writer);
if (group) {
H5::Group root = group->openGroup("/");
H5::Group group = h5::createSubGroup(root, path);
......@@ -889,11 +886,11 @@ namespace fargOCA {
myRadiativeEnergy->rebind(nextGrid, interpolators);
myRadiativeEnergyDerivative->rebind(nextGrid, interpolators);
}
for (auto& p : myTracers) {
p.second.rebind(nextGrid, interpolators);
for (auto&[key,field] : myTracers) {
field.rebind(nextGrid, interpolators);
}
for (auto& p : myUserFields) {
p.second.rebind(nextGrid, interpolators);
for (auto&[key,field] : myUserFields) {
field.rebind(nextGrid, interpolators);
}
cleanGasMinimums();
......@@ -1401,18 +1398,16 @@ namespace fargOCA {
}
{
std::string section("tracers");
for (auto const& p : disk.tracers()) {
std::string key = p.first;
for (auto const&[key, field] : disk.tracers()) {
std::string path = section + "/" + key;
myMap.insert(pair(path, p.second));
myMap.insert(pair(path, field));
}
}
{
std::string section("user");
for (auto const& p : disk.myUserFields) {
std::string key = p.first;
for (auto const&[key, field] : disk.myUserFields) {
std::string path = section + "/" + key;
myMap.insert(pair(path, p.second));
myMap.insert(pair(path, field));
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment