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 139 of file JsonIO.h.

140 {
141  if constexpr (Rows == 1 || Cols == 1)
142  {
143  std::vector<Scalar> values(matrix.data(), matrix.data() + matrix.rows() * matrix.cols());
144  nlohmann::to_json(json, values);
145  }
146  else
147  {
148  const auto nrows = matrix.rows();
149  const auto ncols = matrix.cols();
150  std::vector<std::vector<Scalar>> values(nrows, std::vector<Scalar>(ncols));
151  for (const auto i : make_range(nrows))
152  for (const auto j : make_range(ncols))
153  values[i][j] = matrix(i, j);
154  nlohmann::to_json(json, values);
155  }
156 }
IntRange< T > make_range(T beg, T end)
void to_json(nlohmann::json &json, const MooseApp &app)
Definition: JsonIO.C:22