14 #include "nlohmann/json.h" 16 #include "libmesh/libmesh_common.h" 42 void to_json(nlohmann::json & json,
const Point & p);
50 template <
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
51 void to_json(nlohmann::json & json,
52 const Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> & matrix);
58 struct adl_serializer<
std::unique_ptr<T>>
64 static void to_json(json & j,
const std::unique_ptr<T> & v)
66 if constexpr (std::is_constructible_v<nlohmann::json, T>)
74 mooseAssert(
false,
"Should not get to this");
81 template <
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
83 to_json(nlohmann::json & json,
const Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> & matrix)
85 if constexpr (Rows == 1 || Cols == 1)
87 std::vector<Scalar> values(matrix.data(), matrix.data() + matrix.rows() * matrix.cols());
92 const auto nrows = matrix.rows();
93 const auto ncols = matrix.cols();
94 std::vector<std::vector<Scalar>> values(nrows, std::vector<Scalar>(ncols));
97 values[i][j] = matrix(i, j);
template class LIBMESH_EXPORT DenseVector< Real >
Base class for MOOSE-based applications.
void to_json(nlohmann::json &json, const Point &p)
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
static void to_json(json &j, const std::unique_ptr< T > &v)
Serializer that will output a unique ptr if it exists.
IntRange< T > make_range(T beg, T end)
void to_json(nlohmann::json &json, const MooseApp &app)
void to_json(nlohmann::json &json, const Matrix< Scalar, Rows, Cols, Options, MaxRows, MaxCols > &matrix)