31template <
typename Matrix>
 
   33                                      Eigen::MatrixXd::Index rows,
 
   34                                      Eigen::MatrixXd::Index cols)
 
   36    static_assert(Matrix::IsRowMajor || Matrix::IsVectorAtCompileTime,
 
   37                  "The default storage order in OGS is row major storage for " 
   39    assert(Matrix::RowsAtCompileTime == Eigen::Dynamic ||
 
   40           Matrix::RowsAtCompileTime == rows);
 
   41    assert(Matrix::ColsAtCompileTime == Eigen::Dynamic ||
 
   42           Matrix::ColsAtCompileTime == cols);
 
   45    data.resize(rows * cols);
 
   46    return {data.data(), rows, cols};
 
 
   56    Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>
 
   58                   Eigen::MatrixXd::Index rows,
 
   59                   Eigen::MatrixXd::Index cols)
 
   62        Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
 
 
   71template <
typename Matrix>
 
   72Eigen::Map<const Matrix> 
toMatrix(std::vector<double> 
const& data,
 
   73                                  Eigen::MatrixXd::Index rows,
 
   74                                  Eigen::MatrixXd::Index cols)
 
   76    static_assert(Matrix::IsRowMajor || Matrix::IsVectorAtCompileTime,
 
   77                  "The default storage order in OGS is row major storage for " 
   79    assert(Matrix::RowsAtCompileTime == Eigen::Dynamic ||
 
   80           Matrix::RowsAtCompileTime == rows);
 
   81    assert(Matrix::ColsAtCompileTime == Eigen::Dynamic ||
 
   82           Matrix::ColsAtCompileTime == cols);
 
   83    assert(
static_cast<Eigen::MatrixXd::Index
>(data.size()) == rows * cols);
 
   85    return {data.data(), rows, cols};
 
 
   95        Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>
 
   97         Eigen::MatrixXd::Index rows,
 
   98         Eigen::MatrixXd::Index cols)
 
  101        Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
 
 
  110template <
typename Matrix>
 
  111Eigen::Map<Matrix> 
toMatrix(std::vector<double>& data,
 
  112                            Eigen::MatrixXd::Index rows,
 
  113                            Eigen::MatrixXd::Index cols)
 
  115    static_assert(Matrix::IsRowMajor || Matrix::IsVectorAtCompileTime,
 
  116                  "The default storage order in OGS is row major storage for " 
  118    assert(Matrix::RowsAtCompileTime == Eigen::Dynamic ||
 
  119           Matrix::RowsAtCompileTime == rows);
 
  120    assert(Matrix::ColsAtCompileTime == Eigen::Dynamic ||
 
  121           Matrix::ColsAtCompileTime == cols);
 
  122    assert(
static_cast<Eigen::MatrixXd::Index
>(data.size()) == rows * cols);
 
  124    return {data.data(), rows, cols};
 
 
  133    Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>
 
  135         Eigen::MatrixXd::Index rows,
 
  136         Eigen::MatrixXd::Index cols)
 
  139        Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>>(
 
 
  152template <
typename Vector>
 
  154                                      Eigen::VectorXd::Index size)
 
  156    static_assert(Vector::IsVectorAtCompileTime, 
"A vector type is required.");
 
  157    assert(Vector::SizeAtCompileTime == Eigen::Dynamic ||
 
  158           Vector::SizeAtCompileTime == size);
 
  159    assert(data.empty());  
 
  162    return {data.data(), size};
 
 
  166template <
typename Vector>
 
  167Eigen::Map<const Vector> 
toVector(std::vector<double> 
const& data,
 
  168                                  Eigen::VectorXd::Index size)
 
  170    static_assert(Vector::IsVectorAtCompileTime, 
"A vector type is required.");
 
  171    assert(Vector::SizeAtCompileTime == Eigen::Dynamic ||
 
  172           Vector::SizeAtCompileTime == size);
 
  173    assert(
static_cast<Eigen::VectorXd::Index
>(data.size()) == size);
 
  175    return {data.data(), size};
 
 
  179template <
typename Vector>
 
  180Eigen::Map<Vector> 
toVector(std::vector<double>& data,
 
  181                            Eigen::VectorXd::Index size)
 
  183    static_assert(Vector::IsVectorAtCompileTime, 
"A vector type is required.");
 
  184    assert(Vector::SizeAtCompileTime == Eigen::Dynamic ||
 
  185           Vector::SizeAtCompileTime == size);
 
  186    assert(
static_cast<Eigen::VectorXd::Index
>(data.size()) == size);
 
  188    return {data.data(), size};
 
 
  197    std::vector<double> 
const& data)
 
  199    return {data.data(), 
static_cast<Eigen::VectorXd::Index
>(data.size())};
 
 
  207inline Eigen::Map<Eigen::VectorXd> 
toVector(std::vector<double>& data)
 
  209    return {data.data(), 
static_cast<Eigen::VectorXd::Index
>(data.size())};
 
 
Eigen::Map< Vector > createZeroedVector(std::vector< double > &data, Eigen::VectorXd::Index size)
 
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
 
Eigen::Map< Matrix > createZeroedMatrix(std::vector< double > &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
 
Eigen::Map< const Matrix > toMatrix(std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)