https://mooseframework.inl.gov
Namespaces | Classes | Functions
Eigen Namespace Reference

Namespaces

 internal
 

Classes

struct  NumTraits< MetaPhysicL::DualNumber< V, D, asd > >
 
struct  ScalarBinaryOpTraits< MetaPhysicL::DualNumber< V, D, asd >, Real, BinaryOp >
 
struct  ScalarBinaryOpTraits< Real, MetaPhysicL::DualNumber< V, D, asd >, BinaryOp >
 

Functions

template<typename Scalar , int Rows, int Cols, int Options, int MaxRows, int MaxCols>
void to_json (nlohmann::json &json, const Matrix< Scalar, Rows, Cols, Options, MaxRows, MaxCols > &matrix)
 

Function Documentation

◆ to_json()

template<typename Scalar , int Rows, int Cols, int Options, int MaxRows, int MaxCols>
void Eigen::to_json ( nlohmann::json &  json,
const Matrix< Scalar, Rows, Cols, Options, MaxRows, MaxCols > &  matrix 
)

Definition at line 83 of file JsonIO.h.

84 {
85  if constexpr (Rows == 1 || Cols == 1)
86  {
87  std::vector<Scalar> values(matrix.data(), matrix.data() + matrix.rows() * matrix.cols());
88  nlohmann::to_json(json, values);
89  }
90  else
91  {
92  const auto nrows = matrix.rows();
93  const auto ncols = matrix.cols();
94  std::vector<std::vector<Scalar>> values(nrows, std::vector<Scalar>(ncols));
95  for (const auto i : make_range(nrows))
96  for (const auto j : make_range(ncols))
97  values[i][j] = matrix(i, j);
98  nlohmann::to_json(json, values);
99  }
100 }
IntRange< T > make_range(T beg, T end)
void to_json(nlohmann::json &json, const MooseApp &app)
Definition: JsonIO.C:22