Skip to content

Commit 61196bf

Browse files
committed
Eliminate some unnecessary local variables
1 parent b276d74 commit 61196bf

2 files changed

Lines changed: 8 additions & 14 deletions

File tree

src/mesh/coordinates.cxx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,16 +1450,14 @@ Field2D Coordinates::Laplace_perpXY([[maybe_unused]] const Field2D& A,
14501450

14511451
ChristoffelSymbols& Coordinates::christoffel_symbols() {
14521452
if (christoffel_symbols_cache == nullptr) {
1453-
auto ptr = std::make_unique<ChristoffelSymbols>(*this);
1454-
christoffel_symbols_cache = std::move(ptr);
1453+
christoffel_symbols_cache = std::make_unique<ChristoffelSymbols>(*this);
14551454
}
14561455
return *christoffel_symbols_cache;
14571456
}
14581457

14591458
GValues& Coordinates::g_values() const {
14601459
if (g_values_cache == nullptr) {
1461-
auto ptr = std::make_unique<GValues>(*this);
1462-
g_values_cache = std::move(ptr);
1460+
g_values_cache = std::make_unique<GValues>(*this);
14631461
}
14641462
return *g_values_cache;
14651463
}
@@ -1501,8 +1499,7 @@ void Coordinates::checkContravariant() {
15011499

15021500
FieldMetric& Coordinates::J() const {
15031501
if (jacobian_cache == nullptr) {
1504-
const auto j = recalculateJacobian();
1505-
jacobian_cache = std::make_unique<FieldMetric>(j);
1502+
jacobian_cache = std::make_unique<FieldMetric>(recalculateJacobian());
15061503
}
15071504
return *jacobian_cache;
15081505
}

src/mesh/mesh.cxx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -578,17 +578,14 @@ std::shared_ptr<Coordinates>
578578
Mesh::createDefaultCoordinates(const CELL_LOC location,
579579
bool force_interpolate_from_centre) {
580580

581-
std::shared_ptr<Coordinates> new_coordinates;
582581
if (location == CELL_CENTRE || location == CELL_DEFAULT) {
583582
// Initialize coordinates from input
584-
new_coordinates = std::make_shared<Coordinates>(this, options);
585-
} else {
586-
// Interpolate coordinates from CELL_CENTRE version
587-
new_coordinates = std::make_shared<Coordinates>(this, options, location,
588-
getCoordinates(CELL_CENTRE),
589-
force_interpolate_from_centre);
583+
return std::make_shared<Coordinates>(this, options);
590584
}
591-
return new_coordinates;
585+
// Interpolate coordinates from CELL_CENTRE version
586+
return std::make_shared<Coordinates>(this, options, location,
587+
getCoordinates(CELL_CENTRE),
588+
force_interpolate_from_centre);
592589
}
593590

594591
const Region<>& Mesh::getRegion3D(const std::string& region_name) const {

0 commit comments

Comments
 (0)