From 35611a8726637a73a3e2b13670c691f5f87f16fd Mon Sep 17 00:00:00 2001 From: odlomax Date: Thu, 30 Nov 2023 11:33:19 +0000 Subject: [PATCH] Replaced optional compilation with #if ATLAS_HAVE_EIGEN in source file and header. --- src/atlas/CMakeLists.txt | 11 ++--------- src/atlas/interpolation/method/MethodFactory.cc | 8 ++++---- .../method/sphericalvector/SphericalVector.cc | 5 +++++ .../method/sphericalvector/SphericalVector.h | 5 +++++ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/atlas/CMakeLists.txt b/src/atlas/CMakeLists.txt index a98a9b680..4448e3fd0 100644 --- a/src/atlas/CMakeLists.txt +++ b/src/atlas/CMakeLists.txt @@ -632,6 +632,8 @@ interpolation/method/knn/KNearestNeighboursBase.cc interpolation/method/knn/KNearestNeighboursBase.h interpolation/method/knn/NearestNeighbour.cc interpolation/method/knn/NearestNeighbour.h +interpolation/method/sphericalvector/SphericalVector.h +interpolation/method/sphericalvector/SphericalVector.cc interpolation/method/structured/Cubic2D.cc interpolation/method/structured/Cubic2D.h interpolation/method/structured/Cubic3D.cc @@ -669,15 +671,6 @@ interpolation/nonlinear/NonLinear.cc interpolation/nonlinear/NonLinear.h ) -if (atlas_HAVE_EIGEN) - -list (APPEND atlas_interpolation_srcs -interpolation/method/sphericalvector/SphericalVector.h -interpolation/method/sphericalvector/SphericalVector.cc -) - -endif() - list( APPEND atlas_linalg_srcs linalg/Indexing.h linalg/Introspection.h diff --git a/src/atlas/interpolation/method/MethodFactory.cc b/src/atlas/interpolation/method/MethodFactory.cc index ab078f74b..cc30db2bd 100644 --- a/src/atlas/interpolation/method/MethodFactory.cc +++ b/src/atlas/interpolation/method/MethodFactory.cc @@ -8,6 +8,7 @@ * nor does it submit to any jurisdiction. */ +#include "atlas/library/defines.h" #include "MethodFactory.h" // for static linking @@ -16,6 +17,9 @@ #include "knn/GridBoxMaximum.h" #include "knn/KNearestNeighbours.h" #include "knn/NearestNeighbour.h" +#if ATLAS_HAVE_EIGEN +#include "sphericalvector/SphericalVector.h" +#endif #include "structured/Cubic2D.h" #include "structured/Cubic3D.h" #include "structured/Linear2D.h" @@ -25,10 +29,6 @@ #include "unstructured/FiniteElement.h" #include "unstructured/UnstructuredBilinearLonLat.h" -#if ATLAS_HAVE_EIGEN -#include "sphericalvector/SphericalVector.h" -#endif - namespace atlas { namespace interpolation { diff --git a/src/atlas/interpolation/method/sphericalvector/SphericalVector.cc b/src/atlas/interpolation/method/sphericalvector/SphericalVector.cc index 7d2ad7d2b..81450bb33 100644 --- a/src/atlas/interpolation/method/sphericalvector/SphericalVector.cc +++ b/src/atlas/interpolation/method/sphericalvector/SphericalVector.cc @@ -5,6 +5,9 @@ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. */ +#include "atlas/library/defines.h" +#if ATLAS_HAVE_EIGEN + #include #include @@ -237,3 +240,5 @@ void SphericalVector::interpolate_vector_field(const Field& sourceField, } // namespace method } // namespace interpolation } // namespace atlas + +#endif diff --git a/src/atlas/interpolation/method/sphericalvector/SphericalVector.h b/src/atlas/interpolation/method/sphericalvector/SphericalVector.h index de9b65f95..780c43a79 100644 --- a/src/atlas/interpolation/method/sphericalvector/SphericalVector.h +++ b/src/atlas/interpolation/method/sphericalvector/SphericalVector.h @@ -5,6 +5,9 @@ * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. */ +#include "atlas/library/defines.h" +#if ATLAS_HAVE_EIGEN + #pragma once #include @@ -92,3 +95,5 @@ class SphericalVector : public Method { } // namespace method } // namespace interpolation } // namespace atlas + +#endif