Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/field/field_data.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,11 @@ void FieldData::addBndryGenerator(FieldGeneratorPtr gen, BndryLoc location) {
}

FieldGeneratorPtr FieldData::getBndryGenerator(BndryLoc location) {
auto it = bndry_generator.find(location);
if (it == bndry_generator.end()) {
return nullptr;
if (const auto it = bndry_generator.find(location); it != bndry_generator.end()) {
return it->second;
}

return it->second;
return nullptr;
}

Mesh* FieldData::getMesh() const {
Expand Down
12 changes: 4 additions & 8 deletions src/field/field_factory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ Field3D FieldFactory::create3D(FieldGeneratorPtr gen, Mesh* localmesh, CELL_LOC
};

if (transform_from_field_aligned) {
auto coords = result.getCoordinates();
if (coords == nullptr) {
if (auto coords = result.getCoordinates(); coords == nullptr) {
// Should not lead to issues. If called from the coordinates
// constructor, then this is expected, and the result will be
// transformed. Otherwise, if the field is used untransformed,
Expand Down Expand Up @@ -352,8 +351,7 @@ FieldPerp FieldFactory::createPerp(FieldGeneratorPtr gen, Mesh* localmesh, CELL_
};

if (transform_from_field_aligned) {
auto coords = result.getCoordinates();
if (coords == nullptr) {
if (auto coords = result.getCoordinates(); coords == nullptr) {
// Should not lead to issues. If called from the coordinates
// constructor, then this is expected, and the result will be
// transformed. Otherwise, if the field is used untransformed,
Expand All @@ -376,8 +374,7 @@ const Options* FieldFactory::findOption(const Options* opt, const std::string& n
const Options* result = opt;

// Check if name contains a section separator ':'
size_t pos = name.find(':');
if (pos == std::string::npos) {
if (auto pos = name.find(':'); pos == std::string::npos) {
// No separator. Try this section, and then go through parents

while (!result->isSet(name)) {
Expand Down Expand Up @@ -517,8 +514,7 @@ FieldGeneratorPtr FieldFactory::parse(const std::string& input,
key = opt->str() + key; // Include options context in key
}

auto it = cache.find(key);
if (it != cache.end()) {
if (auto it = cache.find(key); it != cache.end()) {
return it->second;
}

Expand Down
3 changes: 1 addition & 2 deletions src/mesh/coordinates_accessor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ CoordinatesAccessor::CoordinatesAccessor(const Coordinates* coords) {
Mesh* mesh = coords->dx.getMesh();
mesh_nz = mesh->LocalNz;

auto search = coords_store.find(coords);
if (search != coords_store.end()) {
if (const auto search = coords_store.find(coords); search != coords_store.end()) {
// Found, so get the pointer to the data
data = search->second.begin();
return;
Expand Down
Loading