Skip to content

Commit 52b817c

Browse files
committed
Fix merge
Include changes from commit: "Return `std::optional` from `invert3x3`" SHA-1: c42dc24 which was not merged due to splitting files.
1 parent 4b5bee3 commit 52b817c

5 files changed

Lines changed: 439 additions & 376 deletions

File tree

include/bout/mesh.hxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Mesh;
5656
#include "bout/options.hxx"
5757
#include "bout/region.hxx"
5858
#include "bout/sys/range.hxx" // RangeIterator
59+
#include <bout/griddata.hxx>
5960
#include "bout/unused.hxx"
6061

6162
#include "mpi.h"

src/mesh/coordinates.cxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <bout/fft.hxx>
1717
#include <bout/interpolation.hxx>
1818
#include <bout/output_bout_types.hxx>
19-
#include "invert3x3.hxx"
2019
#include "parallel/fci.hxx"
2120
#include "parallel/shiftedmetricinterp.hxx"
2221
#include "bout/derivs.hxx"

src/mesh/metric_tensor.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "bout/metric_tensor.hxx"
22
#include "fmt/core.h"
33
#include "bout/bout_types.hxx"
4+
#include "invert3x3.hxx"
45
#include "bout/boutexception.hxx"
56
#include "bout/field2d.hxx"
67
#include "bout/mesh.hxx"
@@ -95,9 +96,10 @@ MetricTensor MetricTensor::inverse(const std::string& region, const bool communi
9596
matrix(1, 2) = matrix(2, 1) = g23_m[i];
9697
matrix(0, 2) = matrix(2, 0) = g13_m[i];
9798

98-
if (invert3x3(matrix) != 0) {
99+
if (const auto det = bout::invert3x3(matrix); det.has_value()) {
99100
const auto error_message = fmt::format(
100-
"\tERROR: metric tensor is singular at ({:d}, {:d})\n", i.x(), i.y());
101+
"\tERROR: metric tensor is singular at ({:d}, {:d}), determinant: {:d}\n",
102+
i.x(), i.y(), det.value());
101103
output_error.write(error_message);
102104
throw BoutException(error_message);
103105
}

0 commit comments

Comments
 (0)