You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the problem you are trying to solve.
At the time of writing, Eigen is responsible for around 40% of our overall compile time of preCICE.
Primary offender are the uses of Eigen::VectorXd all around the code-base. It is not possible to use anything related to meshes, vertices or data, without (transitively) including Eigen/Core.
A common recommendation to solve this problem is to use Eigen only inside compute-heavy compilation units and use something else for storing data. In practise, this means that data storage is handled by std::vector and then interfaced with using Eigen::Map.
Describe the solution you propose.
Remove the use of Eigen from all central headers of preCICE (related to mesh and data):
Use span<const double> where ranges of doubles need to be accepted or exposed.
Use std::vector<double> to store data-values and gradients.
Move Eigen accessor functions to separate headers that can be included if necessary:
Instead of Eigen::VectorXd mesh::Vertex::getCoords(), implement Eigen::Vector toCoords(const mesh::Vertex&); and Eigen::Map<const Eigen::VectorXd> asCoords(const meah::Vertex&) in a separate header.
Move utility functions such as Eigen::VectorXd getCenter(const Edge&) to a utility header.
Replace unnecessary use of Eigen in Tests:
Use mesh.createVertex({1, 2, 3}) instead of mesh.createVertex(Eigen::Vertex3d{1, 2, 3})
Use std::vector<double> expectedValues{1,2,3,4} instead of Eigen::VectorXd expected(4); expected << 1, 2, 3, 4;
If necessary, write custom comparators which internally use Eigen.
Describe alternatives you've considered
Precompiled headers could help with this, but this needs some serious testing.
Please describe the problem you are trying to solve.
At the time of writing, Eigen is responsible for around 40% of our overall compile time of preCICE.
Primary offender are the uses of
Eigen::VectorXd
all around the code-base. It is not possible to use anything related to meshes, vertices or data, without (transitively) includingEigen/Core
.A common recommendation to solve this problem is to use Eigen only inside compute-heavy compilation units and use something else for storing data. In practise, this means that data storage is handled by
std::vector
and then interfaced with usingEigen::Map
.Describe the solution you propose.
Remove the use of Eigen from all central headers of preCICE (related to mesh and data):
span<const double>
where ranges of doubles need to be accepted or exposed.std::vector<double>
to store data-values and gradients.Move Eigen accessor functions to separate headers that can be included if necessary:
Eigen::VectorXd mesh::Vertex::getCoords()
, implementEigen::Vector toCoords(const mesh::Vertex&);
andEigen::Map<const Eigen::VectorXd> asCoords(const meah::Vertex&)
in a separate header.Eigen::VectorXd getCenter(const Edge&)
to a utility header.Replace unnecessary use of Eigen in Tests:
mesh.createVertex({1, 2, 3})
instead ofmesh.createVertex(Eigen::Vertex3d{1, 2, 3})
std::vector<double> expectedValues{1,2,3,4}
instead ofEigen::VectorXd expected(4); expected << 1, 2, 3, 4;
Describe alternatives you've considered
Precompiled headers could help with this, but this needs some serious testing.
Additional context
#1973
The text was updated successfully, but these errors were encountered: