Class to converts OpenFOAM objects into Eigen and viceversa. More...
#include <Foam2Eigen.H>
Public Member Functions | |
template<> | |
Eigen::VectorXd | field2Eigen (const Field< scalar > &field) |
template<> | |
Eigen::VectorXd | field2Eigen (const Field< vector > &field) |
template<> | |
Eigen::VectorXd | field2Eigen (const Field< tensor > &field) |
template<> | |
Eigen::VectorXd | field2Eigen (const DimensionedField< scalar, Foam::volMesh > &field) |
template<> | |
volScalarField | Eigen2field (volScalarField &field_in, Eigen::VectorXd &eigen_vector, bool correctBC) |
template<> | |
Field< scalar > | Eigen2field (Field< scalar > &field, Eigen::MatrixXd &matrix, bool correctBC) |
template<> | |
Field< vector > | Eigen2field (Field< vector > &field, Eigen::MatrixXd &matrix, bool correctBC) |
template<> | |
Field< tensor > | Eigen2field (Field< tensor > &field, Eigen::MatrixXd &matrix, bool correctBC) |
template<> | |
void | fvMatrix2Eigen (fvMatrix< scalar > foam_matrix, Eigen::MatrixXd &A, Eigen::VectorXd &b) |
template<> | |
void | fvMatrix2Eigen (fvMatrix< vector > foam_matrix, Eigen::MatrixXd &A, Eigen::VectorXd &b) |
template<> | |
void | fvMatrix2Eigen (fvMatrix< scalar > foam_matrix, Eigen::SparseMatrix< double > &A, Eigen::VectorXd &b) |
template<> | |
void | fvMatrix2Eigen (fvMatrix< vector > foam_matrix, Eigen::SparseMatrix< double > &A, Eigen::VectorXd &b) |
template<> | |
void | fvMatrix2EigenM (fvMatrix< scalar > &foam_matrix, Eigen::MatrixXd &A) |
template<> | |
void | fvMatrix2EigenM (fvMatrix< scalar > &foam_matrix, Eigen::SparseMatrix< double > &A) |
template<> | |
void | fvMatrix2EigenM (fvMatrix< vector > &foam_matrix, Eigen::MatrixXd &A) |
template<> | |
void | fvMatrix2EigenM (fvMatrix< vector > &foam_matrix, Eigen::SparseMatrix< double > &A) |
template<> | |
void | fvMatrix2EigenV (fvMatrix< scalar > &foam_matrix, Eigen::VectorXd &b) |
template<> | |
void | fvMatrix2EigenV (fvMatrix< vector > &foam_matrix, Eigen::VectorXd &b) |
template<> | |
Eigen::MatrixXd | field2Eigen (const List< vector > &field) |
template<> | |
Eigen::MatrixXd | field2Eigen (const List< scalar > &field) |
Static Public Member Functions | |
template<class type_foam_matrix , class type_A , class type_B > | |
static void | fvMatrix2Eigen (fvMatrix< type_foam_matrix > foam_matrix, type_A &A, type_B &b) |
Convert a FvMatrix OpenFOAM matrix (Linear System) into a Eigen Matrix A and a source vector b. | |
template<class type_foam_matrix , class type_A > | |
static void | fvMatrix2EigenM (fvMatrix< type_foam_matrix > &foam_matrix, type_A &A) |
Convert a ldu OpenFOAM matrix into a Eigen Matrix A. | |
template<class type_foam_matrix , class type_B > | |
static void | fvMatrix2EigenV (fvMatrix< type_foam_matrix > &foam_matrix, type_B &b) |
Convert a ldu OpenFOAM matrix into a source vector b. | |
template<class Type , template< class > class PatchField, class GeoMesh > | |
static Eigen::MatrixXd | PtrList2Eigen (PtrList< GeometricField< Type, PatchField, GeoMesh > > &fields, label Nfields=-1) |
Convert a PtrList of snapshots to Eigen matrix (only internal field) | |
template<template< class > class PatchField, class GeoMesh > | |
static Eigen::VectorXd | field2Eigen (GeometricField< tensor, PatchField, GeoMesh > &field) |
Convert a vector OpenFOAM field into an Eigen Vector. | |
template<template< class > class PatchField, class GeoMesh > | |
static Eigen::VectorXd | field2Eigen (GeometricField< vector, PatchField, GeoMesh > &field) |
Convert a vector OpenFOAM field into an Eigen Vector. | |
template<template< class > class PatchField, class GeoMesh > | |
static Eigen::VectorXd | field2Eigen (GeometricField< scalar, PatchField, GeoMesh > &field) |
Convert a scalar OpenFOAM field into an Eigen Vector. | |
template<template< class > class PatchField, class GeoMesh > | |
static Eigen::Map< Eigen::MatrixXd > | field2EigenMap (GeometricField< scalar, PatchField, GeoMesh > &field) |
Convert a scalar OpenFOAM field into an Eigen Vector. | |
template<template< class > class PatchField, class GeoMesh > | |
static Eigen::Map< Eigen::MatrixXd > | field2EigenMapBC (GeometricField< scalar, PatchField, GeoMesh > &field, int BC_index) |
Map a scalar OpenFOAM field boundary into an Eigen Matrix. | |
template<class Type , class GeoMesh > | |
static Eigen::VectorXd | field2Eigen (const DimensionedField< Type, GeoMesh > &field) |
Convert an OpenFOAM field into an Eigen Vector. | |
template<class Type > | |
static Eigen::VectorXd | field2Eigen (const Field< Type > &field) |
Convert an OpenFOAM field into an Eigen Vector. | |
template<template< class > class PatchField, class GeoMesh > | |
static List< Eigen::VectorXd > | field2EigenBC (GeometricField< scalar, PatchField, GeoMesh > &field) |
Convert an OpenFOAM scalar field to a List of Eigen Vectors, one for each boundary. | |
template<template< class > class PatchField, class GeoMesh > | |
static List< Eigen::VectorXd > | field2EigenBC (GeometricField< vector, PatchField, GeoMesh > &field) |
Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary. | |
template<template< class > class PatchField, class GeoMesh > | |
static List< Eigen::VectorXd > | field2EigenBC (GeometricField< tensor, PatchField, GeoMesh > &field) |
Convert an OpenFOAM tensor field to a List of Eigen Vectors, one for each boundary. | |
template<template< class > class PatchField, class GeoMesh > | |
static List< Eigen::MatrixXd > | PtrList2EigenBC (PtrList< GeometricField< scalar, PatchField, GeoMesh > > &fields, label Nfields=-1) |
Convert an OpenFOAM scalar field to a List of Eigen Vectors, one for each boundary. | |
template<template< class > class PatchField, class GeoMesh > | |
static List< Eigen::MatrixXd > | PtrList2EigenBC (PtrList< GeometricField< vector, PatchField, GeoMesh > > &fields, label Nfields=-1) |
Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary. | |
template<template< class > class PatchField, class GeoMesh > | |
static List< Eigen::MatrixXd > | PtrList2EigenBC (PtrList< GeometricField< tensor, PatchField, GeoMesh > > &fields, label Nfields=-1) |
Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary. | |
template<template< class > class PatchField, class GeoMesh > | |
static GeometricField< scalar, PatchField, GeoMesh > | Eigen2field (GeometricField< scalar, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, bool correctBC=true) |
Convert a vector in Eigen format into an OpenFOAM scalar GeometricField. | |
template<template< class > class PatchField, class GeoMesh > | |
static GeometricField< vector, PatchField, GeoMesh > | Eigen2field (GeometricField< vector, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, bool correctBC=true) |
Convert a vector in Eigen format into an OpenFOAM vector GeometricField. | |
template<template< class > class PatchField, class GeoMesh > | |
static GeometricField< scalar, PatchField, GeoMesh > | Eigen2field (GeometricField< scalar, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, List< Eigen::VectorXd > &eigen_vector_boundary) |
Convert a vector in Eigen format into an OpenFOAM scalar GeometricField. | |
template<template< class > class PatchField, class GeoMesh > | |
static GeometricField< vector, PatchField, GeoMesh > | Eigen2field (GeometricField< vector, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, List< Eigen::VectorXd > &eigen_vector_boundary) |
Convert a vector in Eigen format into an OpenFOAM vector GeometricField. | |
template<template< class > class PatchField, class GeoMesh > | |
static GeometricField< tensor, PatchField, GeoMesh > | Eigen2field (GeometricField< tensor, PatchField, GeoMesh > &field, Eigen::VectorXd &eigen_vector, bool correctBC=true) |
Convert a vector in Eigen format into an OpenFOAM tensor GeometricField. | |
template<class Type > | |
static Field< Type > | Eigen2field (Field< Type > &field, Eigen::MatrixXd &matrix, bool correctBC=true) |
Converts a matrix in Eigen format into an OpenFOAM Field. | |
template<class Type , template< class > class PatchField, class GeoMesh > | |
static std::tuple< Eigen::MatrixXd, Eigen::VectorXd > | projectFvMatrix (fvMatrix< Type > &matrix, PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, label Nmodes) |
Obtain the Mass Matrix from a list of reduced basis. | |
template<class Type , template< class > class PatchField, class GeoMesh > | |
static Eigen::VectorXd | projectField (GeometricField< Type, PatchField, GeoMesh > &field, PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, label Nmodes) |
Perform the projection of an OpenFOAM field onto a set of modes using the Eigen matrix multiplication. | |
template<class Type , template< class > class PatchField, class GeoMesh > | |
static Eigen::MatrixXd | MassMatrix (PtrList< GeometricField< Type, PatchField, GeoMesh > > &modes, label Nmodes) |
Obtain the Mass Matrix from a list of reduced basis. | |
template<class Type > | |
static std::tuple< List< Eigen::SparseMatrix< double > >, List< Eigen::VectorXd > > | LFvMatrix2LSM (PtrList< fvMatrix< Type > > &MatrixList) |
Convert a PtrList of OpenFOAM fvMatrix into a tuple of lists of Eigen Sparse Matrices and source vectors. | |
template<class type_matrix > | |
static Eigen::Matrix< type_matrix, Eigen::Dynamic, Eigen::Dynamic > | List2EigenMatrix (List< type_matrix > list) |
Convert a Foam List into an Eigen matrix with one column. | |
template<class type_matrix > | |
static List< type_matrix > | EigenMatrix2List (Eigen::Matrix< type_matrix, Eigen::Dynamic, Eigen::Dynamic > matrix) |
Convert an Eigen matrix with one column into a Foam List. | |
template<class type_list > | |
static Eigen::MatrixXd | field2Eigen (const List< type_list > &list) |
Function to convert an OpenFOAM list to an Eigen Matrix. | |
Class to converts OpenFOAM objects into Eigen and viceversa.
Definition at line 58 of file Foam2Eigen.H.
Field< scalar > Foam2Eigen::Eigen2field | ( | Field< scalar > & | field, |
Eigen::MatrixXd & | matrix, | ||
bool | correctBC ) |
Definition at line 556 of file Foam2Eigen.C.
Field< tensor > Foam2Eigen::Eigen2field | ( | Field< tensor > & | field, |
Eigen::MatrixXd & | matrix, | ||
bool | correctBC ) |
Definition at line 617 of file Foam2Eigen.C.
|
static |
Field< vector > Foam2Eigen::Eigen2field | ( | Field< vector > & | field, |
Eigen::MatrixXd & | matrix, | ||
bool | correctBC ) |
Definition at line 585 of file Foam2Eigen.C.
|
static |
Convert a vector in Eigen format into an OpenFOAM scalar GeometricField.
[in/out] | field OpenFOAM GeometricField | |
[in] | eigen_vector | Vector in Eigen format |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 517 of file Foam2Eigen.C.
|
static |
Convert a vector in Eigen format into an OpenFOAM scalar GeometricField.
[in/out] | field OpenFOAM GeometricField | |
[in] | eigen_vector | Vector in Eigen format |
[in] | eigen_vector_boundary | Vector in Eigen format |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 465 of file Foam2Eigen.C.
|
static |
Convert a vector in Eigen format into an OpenFOAM tensor GeometricField.
[in/out] | field OpenFOAM GeometricField | |
[in] | eigen_vector | Vector in Eigen format |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 410 of file Foam2Eigen.C.
|
static |
Convert a vector in Eigen format into an OpenFOAM vector GeometricField.
[in/out] | field OpenFOAM GeometricField | |
[in] | eigen_vector | Vector in Eigen format |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 491 of file Foam2Eigen.C.
|
static |
Convert a vector in Eigen format into an OpenFOAM vector GeometricField.
[in/out] | field OpenFOAM GeometricField | |
[in] | eigen_vector | Vector in Eigen format |
[in] | eigen_vector_boundary | Vector in Eigen format |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 436 of file Foam2Eigen.C.
volScalarField Foam2Eigen::Eigen2field | ( | volScalarField & | field_in, |
Eigen::VectorXd & | eigen_vector, | ||
bool | correctBC ) |
Definition at line 537 of file Foam2Eigen.C.
|
static |
Eigen::VectorXd Foam2Eigen::field2Eigen | ( | const DimensionedField< scalar, Foam::volMesh > & | field | ) |
Definition at line 172 of file Foam2Eigen.C.
|
static |
Eigen::VectorXd Foam2Eigen::field2Eigen | ( | const Field< scalar > & | field | ) |
Definition at line 124 of file Foam2Eigen.C.
Eigen::VectorXd Foam2Eigen::field2Eigen | ( | const Field< tensor > & | field | ) |
Definition at line 155 of file Foam2Eigen.C.
|
static |
Eigen::VectorXd Foam2Eigen::field2Eigen | ( | const Field< vector > & | field | ) |
Definition at line 138 of file Foam2Eigen.C.
Eigen::MatrixXd Foam2Eigen::field2Eigen | ( | const List< scalar > & | field | ) |
Definition at line 1288 of file Foam2Eigen.C.
|
static |
Function to convert an OpenFOAM list to an Eigen Matrix.
[in] | list | The OpenFOAM list |
type_list | The type of the list, only scalar and vector are supported |
Eigen::MatrixXd Foam2Eigen::field2Eigen | ( | const List< vector > & | field | ) |
Definition at line 1271 of file Foam2Eigen.C.
|
static |
Convert a scalar OpenFOAM field into an Eigen Vector.
[in] | field | The field |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 82 of file Foam2Eigen.C.
|
static |
Convert a vector OpenFOAM field into an Eigen Vector.
[in] | field | The field |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 40 of file Foam2Eigen.C.
|
static |
Convert a vector OpenFOAM field into an Eigen Vector.
[in] | field | The field |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 61 of file Foam2Eigen.C.
|
static |
Convert an OpenFOAM scalar field to a List of Eigen Vectors, one for each boundary.
[in] | field | The field |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 244 of file Foam2Eigen.C.
|
static |
Convert an OpenFOAM tensor field to a List of Eigen Vectors, one for each boundary.
[in] | field | The field |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 187 of file Foam2Eigen.C.
|
static |
Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.
[in] | field | The field |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 215 of file Foam2Eigen.C.
|
static |
Convert a scalar OpenFOAM field into an Eigen Vector.
[in] | field | The field |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 97 of file Foam2Eigen.C.
|
static |
Map a scalar OpenFOAM field boundary into an Eigen Matrix.
[in] | field | The field |
[in] | BC_index | The index of the BC you want to Map |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 105 of file Foam2Eigen.C.
void Foam2Eigen::fvMatrix2Eigen | ( | fvMatrix< scalar > | foam_matrix, |
Eigen::MatrixXd & | A, | ||
Eigen::VectorXd & | b ) |
Definition at line 695 of file Foam2Eigen.C.
void Foam2Eigen::fvMatrix2Eigen | ( | fvMatrix< scalar > | foam_matrix, |
Eigen::SparseMatrix< double > & | A, | ||
Eigen::VectorXd & | b ) |
Definition at line 778 of file Foam2Eigen.C.
|
static |
Convert a FvMatrix OpenFOAM matrix (Linear System) into a Eigen Matrix A and a source vector b.
[in] | foam_matrix | The foam matrix can be fvScalarMatrix or fvVectorMatrix |
[out] | A | The matrix or the list of matrices, can be dense or sparse |
[out] | b | The source term vector or the list of source term vectors, always dense |
type_foam_matrix | The type of foam matrix can be scalar or vector |
type_A | The type of matrix or the list of matrices, can be dense (Eigen::MatrixXd) or sparse (Eigen::SparseMatrix<double>) or a List of them |
type_B | The type source term vector or the list can be Eigen::VectorXd or List<Eigen::VectorXd> |
void Foam2Eigen::fvMatrix2Eigen | ( | fvMatrix< vector > | foam_matrix, |
Eigen::MatrixXd & | A, | ||
Eigen::VectorXd & | b ) |
Definition at line 731 of file Foam2Eigen.C.
void Foam2Eigen::fvMatrix2Eigen | ( | fvMatrix< vector > | foam_matrix, |
Eigen::SparseMatrix< double > & | A, | ||
Eigen::VectorXd & | b ) |
Definition at line 819 of file Foam2Eigen.C.
void Foam2Eigen::fvMatrix2EigenM | ( | fvMatrix< scalar > & | foam_matrix, |
Eigen::MatrixXd & | A ) |
Definition at line 879 of file Foam2Eigen.C.
void Foam2Eigen::fvMatrix2EigenM | ( | fvMatrix< scalar > & | foam_matrix, |
Eigen::SparseMatrix< double > & | A ) |
Definition at line 910 of file Foam2Eigen.C.
|
static |
Convert a ldu OpenFOAM matrix into a Eigen Matrix A.
[in] | foam_matrix | The foam matrix can be fvScalarMatrix or fvVectorMatrix |
[out] | A | The matrix or the list of matrices, can be dense or sparse |
type_foam_matrix | The type of foam matrix can be fvScalarMatrix or fvVectorMatrix |
type_A | The type of matrix or the list of matrices, can be dense (Eigen::MatrixXd) or sparse (Eigen::SparseMatrix<double>) or a List of them |
void Foam2Eigen::fvMatrix2EigenM | ( | fvMatrix< vector > & | foam_matrix, |
Eigen::MatrixXd & | A ) |
Definition at line 948 of file Foam2Eigen.C.
void Foam2Eigen::fvMatrix2EigenM | ( | fvMatrix< vector > & | foam_matrix, |
Eigen::SparseMatrix< double > & | A ) |
Definition at line 988 of file Foam2Eigen.C.
void Foam2Eigen::fvMatrix2EigenV | ( | fvMatrix< scalar > & | foam_matrix, |
Eigen::VectorXd & | b ) |
Definition at line 1041 of file Foam2Eigen.C.
|
static |
Convert a ldu OpenFOAM matrix into a source vector b.
[in] | foam_matrix | The foam matrix can be fvScalarMatrix or fvVectorMatrix |
[out] | b | The source term vector or the list of source term vectors, always dense |
type_foam_matrix | The type of foam matrix can be fvScalarMatrix or fvVectorMatrix |
type_B | The type source term vector or the list can be Eigen::VectorXd or List<Eigen::VectorXd> |
void Foam2Eigen::fvMatrix2EigenV | ( | fvMatrix< vector > & | foam_matrix, |
Eigen::VectorXd & | b ) |
Definition at line 1064 of file Foam2Eigen.C.
|
static |
Convert a PtrList of OpenFOAM fvMatrix into a tuple of lists of Eigen Sparse Matrices and source vectors.
[in] | MatrixList | The matrix list |
Type | { description } |
[in] | Type type of fvMatrix can be either scalar or vectorial |
Definition at line 1195 of file Foam2Eigen.C.
|
static |
|
static |
Obtain the Mass Matrix from a list of reduced basis.
modes | The OpenFOAM modes contained in a PtrList | |
[in] | Nmodes | The number of requested modes |
Type | vector or scalar. |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 1159 of file Foam2Eigen.C.
|
static |
Perform the projection of an OpenFOAM field onto a set of modes using the Eigen matrix multiplication.
It is the standard Galerkin projection of a field onto a reduced basis:
\[ \mathbf{f} \in R^{Nx1} , \mathbf{f_r} \in R^{nx1} , \mathbf{M} \in R^{Nxn} \]
@f[ \mathbf{f_r} = \mathbf{M^T f}
@f]
[in] | field | The f OpenFOAM field |
[in] | modes | The M OpenFOAM modes contained in a PtrList |
[in] | Nmodes | The n number of modes you want to use (The size of input modes can be bigger than the requested number of modes) |
Type | vector or scalar. |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 1091 of file Foam2Eigen.C.
|
static |
Obtain the Mass Matrix from a list of reduced basis.
matrix | The matrix | |
[in] | modes | The OpenFOAM modes contained in a PtrList |
[in] | Nmodes | Number of requested modes |
Type | vector or scalar. |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 1116 of file Foam2Eigen.C.
|
static |
Convert a PtrList of snapshots to Eigen matrix (only internal field)
[in] | fields | The fields can be a PtrList<volScalarField> or PtrList<volVectorField> |
[in] | Nfields | The nfields |
Type | vector or scalar. |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 649 of file Foam2Eigen.C.
|
static |
Convert an OpenFOAM scalar field to a List of Eigen Vectors, one for each boundary.
[in] | fields | The field |
[in] | Nfields | The nfields |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 268 of file Foam2Eigen.C.
|
static |
Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.
[in] | fields | The field |
[in] | Nfields | The nfields |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 364 of file Foam2Eigen.C.
|
static |
Convert an OpenFOAM vector field to a List of Eigen Vectors, one for each boundary.
[in] | fields | The field |
[in] | Nfields | The nfields |
PatchField | fvPatchField or fvsPatchField. |
GeoMesh | volMesh or surfaceMesh. |
Definition at line 317 of file Foam2Eigen.C.