diff --git a/CMakeLists.txt b/CMakeLists.txt index 15062d443e36cc76f9eb243570ea9094e50e9713..13e414bd9b0393efd51e7b8b61fc8b59a3634140 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,6 +73,7 @@ option(OGS_USE_MPI "Use MPI" OFF) # Eigen option(OGS_USE_EIGEN "Use EIGEN for local matrix and vector" ON) +option(OGS_EIGEN_DYNAMIC "Use dynamically allocated shape matrices" OFF) option(EIGEN_NO_DEBUG "Disables Eigen's assertions" OFF) # Logging @@ -130,6 +131,9 @@ if(OGS_USE_EIGEN) if (EIGEN_NO_DEBUG) add_definitions(-DEIGEN_NO_DEBUG) endif() + if(OGS_EIGEN_DYNAMIC) + add_definitions(-DEIGEN_DYNAMIC_MATRICES) + endif() endif() ###################### diff --git a/NumLib/Fem/ShapeMatrixPolicy.h b/NumLib/Fem/ShapeMatrixPolicy.h index 5309b6d6b0766a36c4f11cb762fb0d7ad08d3426..47a5f06fd8f33d5f4dafeab671866563f45ac0ce 100644 --- a/NumLib/Fem/ShapeMatrixPolicy.h +++ b/NumLib/Fem/ShapeMatrixPolicy.h @@ -107,8 +107,11 @@ struct EigenDynamicShapeMatrixPolicy /// Default choice of the ShapeMatrixPolicy. template <typename ShapeFunction, unsigned GlobalDim> +#if EIGEN_DYNAMIC_MATRICES +using ShapeMatrixPolicyType = EigenDynamicShapeMatrixPolicy<ShapeFunction, GlobalDim>; +#else using ShapeMatrixPolicyType = EigenFixedShapeMatrixPolicy<ShapeFunction, GlobalDim>; -//using ShapeMatrixPolicyType = EigenDynamicShapeMatrixPolicy<ShapeFunction, GlobalDim>; +#endif #endif // OGS_USE_EIGEN