Skip to content

Commit 9b2206c

Browse files
committed
Bugfix: skip skipped compoments
1 parent 2cbf3ec commit 9b2206c

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

src/Mesh.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ void Mesh::read()
607607
<< "' and will skip it due to read error:\n"
608608
<< err.what() << std::endl;
609609
map.forget(component);
610+
continue;
610611
}
611612
homogenizeExtents.check_extent(*this, rc);
612613
}
@@ -635,6 +636,7 @@ void Mesh::read()
635636
<< "' and will skip it due to read error:\n"
636637
<< err.what() << std::endl;
637638
map.forget(component);
639+
continue;
638640
}
639641
homogenizeExtents.check_extent(*this, rc);
640642
}

src/ParticleSpecies.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ void ParticleSpecies::read()
9898
<< err.what() << std::endl;
9999

100100
map.forget(record_name);
101+
continue;
101102
}
102103
homogenizeExtents.merge(*this, std::move(recordExtents));
103104
}
@@ -143,6 +144,7 @@ void ParticleSpecies::read()
143144
map.forget(record_name);
144145
//(*this)[record_name].erase(RecordComponent::SCALAR);
145146
// this->erase(record_name);
147+
continue;
146148
}
147149
homogenizeExtents.merge(*this, std::move(recordExtents));
148150
}

src/Record.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,22 @@ auto Record::read() -> internal::HomogenizeExtents
113113
};
114114
if (scalar())
115115
{
116-
/* using operator[] will incorrectly update parent */
117-
try
118-
{
119-
T_RecordComponent::read(/* require_unit_si = */ true);
120-
}
121-
catch (error::ReadError const &err)
122-
{
123-
std::cerr << "Cannot read scalar record component and will skip it "
124-
"due to read error:\n"
125-
<< err.what() << std::endl;
126-
}
127-
check_extent(*this);
116+
[&]() {
117+
/* using operator[] will incorrectly update parent */
118+
try
119+
{
120+
T_RecordComponent::read(/* require_unit_si = */ true);
121+
}
122+
catch (error::ReadError const &err)
123+
{
124+
std::cerr
125+
<< "Cannot read scalar record component and will skip it "
126+
"due to read error:\n"
127+
<< err.what() << std::endl;
128+
return; // from lambda
129+
}
130+
check_extent(*this);
131+
}();
128132
}
129133
else
130134
{
@@ -149,6 +153,7 @@ auto Record::read() -> internal::HomogenizeExtents
149153
<< "' and will skip it due to read error:\n"
150154
<< err.what() << std::endl;
151155
this->container().erase(component);
156+
continue;
152157
}
153158
check_extent(rc);
154159
}
@@ -177,6 +182,7 @@ auto Record::read() -> internal::HomogenizeExtents
177182
<< "' and will skip it due to read error:\n"
178183
<< err.what() << std::endl;
179184
this->container().erase(component);
185+
continue;
180186
}
181187
check_extent(rc);
182188
}

0 commit comments

Comments
 (0)