From 07f757537482e014be2075976866c37053c57f9a Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 21 Nov 2025 14:50:09 +0100 Subject: [PATCH] added: support for newer GoTools --- cmake/IFEMFindDependencies.cmake | 69 ++++++++++++++++++++---------- cmake/IFEMSetupDependencies.cmake | 3 +- src/ASM/ASMs3Dmx.C | 8 ++-- src/ASM/ASMs3Drecovery.C | 4 +- src/ASM/LR/ASMu3D.C | 8 ++-- src/ASM/LR/ASMu3Dmx.C | 6 +-- src/ASM/LR/ASMu3Drecovery.C | 8 ++-- src/ASM/LR/LRSplineField.C | 8 ++-- src/ASM/LR/LRSplineField3D.C | 3 +- src/ASM/LR/LRSplineFields2D.C | 1 + src/ASM/LR/LRSplineFields3D.C | 3 +- src/ASM/LR/LRSplineFields3Dmx.C | 2 +- src/ASM/SplineField.C | 8 ++-- src/ASM/SplineField3D.C | 6 +-- src/ASM/SplineFields3D.C | 2 +- src/ASM/SplineFields3Dmx.C | 2 +- src/ASM/Test/TestPiolaMapping.C | 4 +- src/Utility/SplineUtils.C | 4 +- src/Utility/SplineUtils.h | 21 ++++++++- src/Utility/Test/TestSplineUtils.C | 4 +- 20 files changed, 110 insertions(+), 64 deletions(-) diff --git a/cmake/IFEMFindDependencies.cmake b/cmake/IFEMFindDependencies.cmake index fa69c4624..36db5ef05 100644 --- a/cmake/IFEMFindDependencies.cmake +++ b/cmake/IFEMFindDependencies.cmake @@ -3,26 +3,51 @@ find_package(CBLAS REQUIRED) find_package(LAPACK REQUIRED) -find_package(GoTools REQUIRED) -add_library(GoTools::GoTools INTERFACE IMPORTED) -set(GoTools_LIBRARY_DIRS ${GoTools_LIBRARIES}) -list(FILTER GoTools_LIBRARY_DIRS INCLUDE REGEX -L.*) -list(TRANSFORM GoTools_LIBRARY_DIRS REPLACE "-L" "") -list(FILTER GoTools_LIBRARIES EXCLUDE REGEX -L.*) -target_link_libraries(GoTools::GoTools INTERFACE ${GoTools_LIBRARIES}) -target_include_directories(GoTools::GoTools INTERFACE ${GoTools_INCLUDE_DIRS}) -target_compile_definitions(GoTools::GoTools INTERFACE ${GoTools_CXX_FLAGS}) -target_link_directories(GoTools::GoTools INTERFACE ${GoTools_LIBRARY_DIRS}) - -find_package(GoTrivariate REQUIRED) -add_library(GoTools::GoTrivariate INTERFACE IMPORTED) -set(GoTrivariate_LIBRARY_DIRS ${GoTrivariate_LIBRARIES}) -list(FILTER GoTrivariate_LIBRARY_DIRS INCLUDE REGEX -L.*) -list(TRANSFORM GoTrivariate_LIBRARY_DIRS REPLACE "-L" "") -list(FILTER GoTrivariate_LIBRARIES EXCLUDE REGEX -L.*) -target_include_directories(GoTools::GoTrivariate INTERFACE ${GoTrivariate_INCLUDE_DIRS}) -target_link_libraries(GoTools::GoTrivariate INTERFACE ${GoTrivariate_LIBRARIES} GoTools::GoTools) -target_link_directories(GoTools::GoTrivariate INTERFACE ${GoTrivariate_LIBRARY_DIRS}) +find_package(SISL QUIET) +find_package(GoToolsCore QUIET) +find_package(GoTrivariate QUIET) + +if(TARGET GoToolsCore) + add_library(GoTools::GoToolsCore IMPORTED INTERFACE) + string(REPLACE "." ";" GoVersion ${GoToolsCore_VERSION}) + list(GET GoVersion 0 GoToolsCore_VERSION_MAJOR) + target_compile_definitions(GoTools::GoToolsCore + INTERFACE + GoTools_VERSION_MAJOR=${GoToolsCore_VERSION_MAJOR} + GOTOOLS_HAS_BASISDERIVS_SF3=1 + ) + target_link_libraries(GoTools::GoToolsCore INTERFACE GoToolsCore) + add_library(GoTools::GoTrivariate IMPORTED INTERFACE) + target_link_libraries(GoTools::GoTrivariate INTERFACE GoTrivariate GoTools::GoToolsCore) +else() + find_package(GoTools REQUIRED) + add_library(GoTools::GoToolsCore INTERFACE IMPORTED) + set(GoTools_LIBRARY_DIRS ${GoTools_LIBRARIES}) + list(FILTER GoTools_LIBRARY_DIRS INCLUDE REGEX -L.*) + list(TRANSFORM GoTools_LIBRARY_DIRS REPLACE "-L" "") + list(FILTER GoTools_LIBRARIES EXCLUDE REGEX -L.*) + target_link_libraries(GoTools::GoToolsCore INTERFACE ${GoTools_LIBRARIES}) + target_include_directories(GoTools::GoToolsCore INTERFACE ${GoTools_INCLUDE_DIRS}) + target_compile_definitions( + GoTools::GoToolsCore INTERFACE ${GoTools_CXX_FLAGS} GoTools_VERSION_MAJOR=4) + target_link_directories(GoTools::GoToolsCore INTERFACE ${GoTools_LIBRARY_DIRS}) + include(CheckTypeSize) + set(CMAKE_EXTRA_INCLUDE_FILES "GoTools/geometry/SplineSurface.h") + set(CMAKE_REQUIRED_FLAGS -std=c++11) + check_type_size(Go::BasisDerivsSf3 HAS_BD3 LANGUAGE CXX) + if(HAS_BD3) + target_compile_definitions(GoTools::GoToolsCore INTERFACE GOTOOLS_HAS_BASISDERIVS_SF3=1) + endif() + + add_library(GoTools::GoTrivariate INTERFACE IMPORTED) + set(GoTrivariate_LIBRARY_DIRS ${GoTrivariate_LIBRARIES}) + list(FILTER GoTrivariate_LIBRARY_DIRS INCLUDE REGEX -L.*) + list(TRANSFORM GoTrivariate_LIBRARY_DIRS REPLACE "-L" "") + list(FILTER GoTrivariate_LIBRARIES EXCLUDE REGEX -L.*) + target_include_directories(GoTools::GoTrivariate INTERFACE ${GoTrivariate_INCLUDE_DIRS}) + target_link_libraries(GoTools::GoTrivariate INTERFACE ${GoTrivariate_LIBRARIES} GoTools::GoToolsCore) + target_link_directories(GoTools::GoTrivariate INTERFACE ${GoTrivariate_LIBRARY_DIRS}) +endif() find_package(ARPACK REQUIRED) find_package(TinyXML2 REQUIRED) @@ -33,7 +58,7 @@ endif() if(IFEM_USE_LRSPLINES) find_package(LRSpline) - if(LRSpline_FOUND) + if(LRSpline_FOUND AND NOT TARGET LRSpline::LRSpline) add_library(LRSpline::LRSpline INTERFACE IMPORTED) set(LRSpline_LIBRARY_DIRS ${LRSpline_LIBRARIES}) list(FILTER LRSpline_LIBRARY_DIRS INCLUDE REGEX -L.*) @@ -41,7 +66,7 @@ if(IFEM_USE_LRSPLINES) list(FILTER LRSpline_LIBRARIES EXCLUDE REGEX -L.*) target_link_libraries(LRSpline::LRSpline INTERFACE ${LRSpline_LIBRARIES}) target_include_directories(LRSpline::LRSpline INTERFACE ${LRSpline_INCLUDE_DIRS}) - target_compile_definitions(LRSpline::LRSpline INTERFACE ${LRSpline_DEFINITIONS} HAS_LRSPLINE=1) + target_compile_definitions(LRSpline::LRSpline INTERFACE ${LRSpline_DEFINITIONS}) target_link_directories(LRSpline::LRSpline INTERFACE ${LRSpline_LIBRARY_DIRS}) endif() endif() diff --git a/cmake/IFEMSetupDependencies.cmake b/cmake/IFEMSetupDependencies.cmake index f44b19097..ce328159c 100644 --- a/cmake/IFEMSetupDependencies.cmake +++ b/cmake/IFEMSetupDependencies.cmake @@ -5,7 +5,7 @@ include(IFEMFindDependencies) target_link_libraries(IFEM PUBLIC CBLAS::CBLAS LAPACK::LAPACK - GoTools::GoTools + GoTools::GoToolsCore GoTools::GoTrivariate ARPACK::ARPACK tinyxml2::tinyxml2 @@ -27,6 +27,7 @@ endif() if(IFEM_USE_LRSPLINES) if(TARGET LRSpline::LRSpline) target_link_libraries(IFEM PUBLIC LRSpline::LRSpline) + target_compile_definitions(IFEM PUBLIC HAS_LRSPLINE=1) endif() endif() diff --git a/src/ASM/ASMs3Dmx.C b/src/ASM/ASMs3Dmx.C index 09cc683cb..60304650e 100644 --- a/src/ASM/ASMs3Dmx.C +++ b/src/ASM/ASMs3Dmx.C @@ -687,7 +687,7 @@ bool ASMs3Dmx::integrate (Integrand& integrand, int lIndex, integrand.setNeumannOrder(1 + lIndex/10); // Evaluate basis function derivatives at all integration points - std::vector> splinex(m_basis.size() + separateGeometry); + std::vector> splinex(m_basis.size() + separateGeometry); #pragma omp parallel for schedule(static) for (size_t i = 0; i < m_basis.size(); ++i) m_basis[i]->computeBasisGrid(gpar[0],gpar[1],gpar[2],splinex[i]); @@ -1036,7 +1036,7 @@ bool ASMs3Dmx::integrate (Integrand& integrand, // Fetch basis function derivatives at current integration point BasisValues bfs(2*nB); for (size_t b = 1; b <= nB; b++) { - Go::BasisDerivs spline; + GoBasisDerivsVol spline; this->getBasis(b)->computeBasis(fe.u,fe.v,fe.w,spline,faceDir < 0); SplineUtils::extractBasis(spline,fe.basis(b),bfs[b-1].dNdu); this->getBasis(b)->computeBasis(fe.u,fe.v,fe.w,spline,faceDir > 0); @@ -1100,7 +1100,7 @@ bool ASMs3Dmx::evalSolution (Matrix& sField, const Vector& locSol, bool regular, int, int nf) const { // Evaluate the basis functions at all points - std::vector> splinex(m_basis.size()); + std::vector> splinex(m_basis.size()); if (regular) { for (size_t b = 0; b < m_basis.size(); ++b) @@ -1168,7 +1168,7 @@ bool ASMs3Dmx::evalSolution (Matrix& sField, const IntegrandBase& integrand, const bool separateGeometry = geo != svol.get(); // Evaluate the basis functions and their derivatives at all points - std::vector> splinex(m_basis.size() + separateGeometry); + std::vector> splinex(m_basis.size() + separateGeometry); if (regular) { for (size_t b = 0; b < m_basis.size(); ++b) diff --git a/src/ASM/ASMs3Drecovery.C b/src/ASM/ASMs3Drecovery.C index e36715b04..57ba6cc4e 100644 --- a/src/ASM/ASMs3Drecovery.C +++ b/src/ASM/ASMs3Drecovery.C @@ -194,8 +194,8 @@ bool ASMs3D::assembleL2matrices (SystemMatrix& A, SystemVector& B, SplineUtils::getGaussParameters(gpar[2],ng3,zg,proj->basis(2)); // Evaluate basis functions at all integration points - std::vector spl1; - std::vector spl2; + std::vector spl1; + std::vector spl2; if (continuous) geo->computeBasisGrid(gpar[0],gpar[1],gpar[2],spl2); diff --git a/src/ASM/LR/ASMu3D.C b/src/ASM/LR/ASMu3D.C index 15c9a6986..75fac96c7 100644 --- a/src/ASM/LR/ASMu3D.C +++ b/src/ASM/LR/ASMu3D.C @@ -1367,7 +1367,7 @@ bool ASMu3D::diracPoint (Integrand& integrand, GlobalIntegral& glInt, fe.u = param[0]; fe.v = param[1]; fe.w = param[2]; - Go::BasisPts pt; + GoBasisPtsVol pt; this->getBasis()->computeBasis(fe.u, fe.v, fe.w, pt, iel); fe.N = pt.basisValues; @@ -1559,9 +1559,9 @@ bool ASMu3D::evalSolution (Matrix& sField, const Vector& locSol, Matrix dNdu, dNdX, Jac, Xnod, eSol, ptDer; Matrix3D d2Ndu2, d2NdX2, Hess, ptDer2; - Go::BasisPts spline0; - Go::BasisDerivs spline1; - Go::BasisDerivs2 spline2; + GoBasisPtsVol spline0; + GoBasisDerivsVol spline1; + GoBasisDerivsVol2 spline2; int lel = -1; // Evaluate the primary solution field at each point diff --git a/src/ASM/LR/ASMu3Dmx.C b/src/ASM/LR/ASMu3Dmx.C index c239b3c7e..1438706cf 100644 --- a/src/ASM/LR/ASMu3Dmx.C +++ b/src/ASM/LR/ASMu3Dmx.C @@ -711,7 +711,7 @@ bool ASMu3Dmx::evalSolution (Matrix& sField, const Vector& locSol, if (nPoints != gpar[1].size() || nPoints != gpar[2].size()) return false; - Go::BasisPts spline; + GoBasisPtsVol spline; std::vector nc(nfx.size(), 0); if (nf) @@ -790,7 +790,7 @@ bool ASMu3Dmx::evalSolution (Matrix& sField, const IntegrandBase& integrand, Matrix3D Hess; if (use2ndDer) for (size_t b = 0; b < bfs.size(); ++b) { - Go::BasisDerivs2 spline; + GoBasisDerivsVol2 spline; const LR::LRSplineVolume* sv = b < m_basis.size() ? m_basis[b].get() : geo; sv->computeBasis(gpar[0][i],gpar[1][i],gpar[2][i],spline,els[b]-1); SplineUtils::extractBasis(spline, @@ -799,7 +799,7 @@ bool ASMu3Dmx::evalSolution (Matrix& sField, const IntegrandBase& integrand, } else for (size_t b = 0; b < bfs.size(); ++b) { - Go::BasisDerivs spline; + GoBasisDerivsVol spline; const LR::LRSplineVolume* sv = b < m_basis.size() ? m_basis[b].get() : geo; sv->computeBasis(gpar[0][i],gpar[1][i],gpar[2][i],spline,els[b]-1); SplineUtils::extractBasis(spline, diff --git a/src/ASM/LR/ASMu3Drecovery.C b/src/ASM/LR/ASMu3Drecovery.C index 6c2e02d00..6efa2c3a6 100644 --- a/src/ASM/LR/ASMu3Drecovery.C +++ b/src/ASM/LR/ASMu3Drecovery.C @@ -143,8 +143,8 @@ bool ASMu3D::assembleL2matrices (SystemMatrix& A, SystemVector& B, double dV = 0.0; Vector phi; Matrix dNdu, Xnod, Jac; - Go::BasisPts spl1; - Go::BasisDerivs spl2; + GoBasisPtsVol spl1; + GoBasisDerivsVol spl2; const LR::Element* elm = proj->getElement(ielp); int iel = lrspline->getElementContaining(elm->midpoint()) + 1; int ielG = geo->getElementContaining(elm->midpoint()) + 1; @@ -438,7 +438,7 @@ LR::LRSplineVolume* ASMu3D::regularInterpolation (const RealArray& upar, A.resize(nBasis, nBasis); Matrix B2(points,true); // transpose to get one vector per field StdVector B(B2); - Go::BasisPts splineValues; + GoBasisPtsVol splineValues; // Evaluate all basis functions at all points, stored in the A-matrix // (same row = same evaluation point) @@ -579,7 +579,7 @@ bool ASMu3D::faceL2projection (const DirichletFace& face, if (face.lr != geo) { // different lrspline instances enumerate elements differently - Go::BasisDerivs spline; + GoBasisDerivsVol spline; face.lr->computeBasis(u, v, w, spline, face.lr->getElementContaining(u,v,w)); SplineUtils::extractBasis(spline,N,dNdu); diff --git a/src/ASM/LR/LRSplineField.C b/src/ASM/LR/LRSplineField.C index 340644b55..8719e915e 100644 --- a/src/ASM/LR/LRSplineField.C +++ b/src/ASM/LR/LRSplineField.C @@ -114,11 +114,11 @@ bool LRSplineField::evalMapping (const LR::LRSplineVolume& vol, Matrix dNdu; Matrix3D d2Ndu2; if (Hess) { - Go::BasisDerivs2 spline2; + GoBasisDerivsVol2 spline2; vol.computeBasis(x.u,x.v,x.w,spline2,iel); SplineUtils::extractBasis(spline2, N, dNdu, d2Ndu2); } else { - Go::BasisDerivs spline; + GoBasisDerivsVol spline; vol.computeBasis(x.u,x.v,x.w,spline,iel); SplineUtils::extractBasis(spline, N, dNdu); } @@ -154,11 +154,11 @@ bool LRSplineField::evalBasis (const LR::LRSplineVolume& vol, Matrix dNdu; Matrix3D d2Ndu2; if (Hess) { - Go::BasisDerivs2 spline2; + GoBasisDerivsVol2 spline2; vol.computeBasis(x.u,x.v,x.w,spline2,iel); SplineUtils::extractBasis(spline2, N, dNdu, d2Ndu2); } else { - Go::BasisDerivs spline; + GoBasisDerivsVol spline; vol.computeBasis(x.u,x.v,x.w,spline,iel); SplineUtils::extractBasis(spline, N, dNdu); } diff --git a/src/ASM/LR/LRSplineField3D.C b/src/ASM/LR/LRSplineField3D.C index 0c211f0f9..bdf4dcf68 100644 --- a/src/ASM/LR/LRSplineField3D.C +++ b/src/ASM/LR/LRSplineField3D.C @@ -18,6 +18,7 @@ #include "ASMu3D.h" #include "ItgPoint.h" +#include "SplineUtils.h" #include "Vec3.h" @@ -71,7 +72,7 @@ double LRSplineField3D::valueFE (const ItgPoint& x) const // Evaluate the basis functions at the given point int iel = basis->getElementContaining(x.u,x.v,x.w); auto elm = basis->getElement(iel); - Go::BasisPts spline; + GoBasisPtsVol spline; basis->computeBasis(x.u,x.v,x.w,spline,iel); Vector Vnod; diff --git a/src/ASM/LR/LRSplineFields2D.C b/src/ASM/LR/LRSplineFields2D.C index 779bfec3b..4a36015c9 100644 --- a/src/ASM/LR/LRSplineFields2D.C +++ b/src/ASM/LR/LRSplineFields2D.C @@ -16,6 +16,7 @@ #include "LRSplineFields2D.h" #include "LRSplineField.h" + #include "ASMu2D.h" #include "ItgPoint.h" #include "Vec3.h" diff --git a/src/ASM/LR/LRSplineFields3D.C b/src/ASM/LR/LRSplineFields3D.C index de53ada14..86863022c 100644 --- a/src/ASM/LR/LRSplineFields3D.C +++ b/src/ASM/LR/LRSplineFields3D.C @@ -15,6 +15,7 @@ #include "LRSplineFields3D.h" #include "LRSplineField.h" +#include "SplineUtils.h" #include "ASMu3D.h" #include "ItgPoint.h" @@ -81,7 +82,7 @@ bool LRSplineFields3D::valueFE (const ItgPoint& x, Vector& vals) const int iel = basis->getElementContaining(x.u,x.v,x.w); auto elm = basis->getElement(iel); - Go::BasisPts spline; + GoBasisPtsVol spline; basis->computeBasis(x.u,x.v,x.w,spline,iel); // Evaluate the solution field at the given point diff --git a/src/ASM/LR/LRSplineFields3Dmx.C b/src/ASM/LR/LRSplineFields3Dmx.C index f48547366..99ebf9745 100644 --- a/src/ASM/LR/LRSplineFields3Dmx.C +++ b/src/ASM/LR/LRSplineFields3Dmx.C @@ -82,7 +82,7 @@ bool LRSplineFields3Dmx::valueFE (const ItgPoint& x, Vector& vals) const int iel = basis->getElementContaining(x.u,x.v,x.w); const LR::Element* elm = basis->getElement(iel); - Go::BasisPts spline; + GoBasisPtsVol spline; basis->computeBasis(x.u,x.v,x.w,spline,iel); // Evaluate the solution field at the given point diff --git a/src/ASM/SplineField.C b/src/ASM/SplineField.C index 4bd56778d..17b91e000 100644 --- a/src/ASM/SplineField.C +++ b/src/ASM/SplineField.C @@ -119,7 +119,7 @@ bool SplineField::evalMapping (const Go::SplineVolume& vol, Matrix3D d2Ndu2; if (Hess) { - Go::BasisDerivs2 spline2; + GoBasisDerivsVol2 spline2; #pragma omp critical vol.computeBasis(x.u,x.v,x.w,spline2); SplineUtils::extractBasis(spline2, N, dNdu, d2Ndu2); @@ -128,7 +128,7 @@ bool SplineField::evalMapping (const Go::SplineVolume& vol, spline2.left_idx,ip); } else { - Go::BasisDerivs spline; + GoBasisDerivsVol spline; #pragma omp critical vol.computeBasis(x.u,x.v,x.w,spline); SplineUtils::extractBasis(spline, N, dNdu); @@ -163,7 +163,7 @@ bool SplineField::evalBasis (const Go::SplineVolume& vol, ip.clear(); if (Hess) { - Go::BasisDerivs2 spline2; + GoBasisDerivsVol2 spline2; #pragma omp critical vol.computeBasis(x.u,x.v,x.w,spline2); SplineUtils::extractBasis(spline2, N, dNdu, d2Ndu2); @@ -171,7 +171,7 @@ bool SplineField::evalBasis (const Go::SplineVolume& vol, vol.order(0),vol.order(1),vol.order(2), spline2.left_idx,ip); } else { - Go::BasisDerivs spline; + GoBasisDerivsVol spline; #pragma omp critical vol.computeBasis(x.u,x.v,x.w,spline); SplineUtils::extractBasis(spline, N, dNdu); diff --git a/src/ASM/SplineField3D.C b/src/ASM/SplineField3D.C index 7f614a02f..85a6aec87 100644 --- a/src/ASM/SplineField3D.C +++ b/src/ASM/SplineField3D.C @@ -62,7 +62,7 @@ SplineField3D::SplineField3D (const ASMs3D* patch, SplineField3D::SplineField3D (const Go::SplineVolume* svol, const RealArray& v, const char* name) - : FieldBase(name), basis(svol), vol(svol) + : FieldBase(name), basis(svol), vol(svol), nsd(3) { values = v; } @@ -79,7 +79,7 @@ double SplineField3D::valueFE (const ItgPoint& x) const if (!basis) return false; // Evaluate the basis functions at the given point - Go::BasisPts spline; + GoBasisPtsVol spline; #pragma omp critical basis->computeBasis(x.u,x.v,x.w,spline); @@ -148,7 +148,7 @@ bool SplineField3D::valueGrid (RealArray& val, const int* npe) const for (double v : gpar[1]) for (double u : gpar[0]) { - Go::BasisPts spline; + GoBasisPtsVol spline; #pragma omp critical basis->computeBasis(u,v,w,spline); diff --git a/src/ASM/SplineFields3D.C b/src/ASM/SplineFields3D.C index 7c4e8b75a..65da75a38 100644 --- a/src/ASM/SplineFields3D.C +++ b/src/ASM/SplineFields3D.C @@ -89,7 +89,7 @@ bool SplineFields3D::valueFE (const ItgPoint& x, Vector& vals) const if (!basis) return false; // Evaluate the basis functions at the given point - Go::BasisPts spline; + GoBasisPtsVol spline; #pragma omp critical basis->computeBasis(x.u,x.v,x.w,spline); diff --git a/src/ASM/SplineFields3Dmx.C b/src/ASM/SplineFields3Dmx.C index 98e41387b..ce8a45771 100644 --- a/src/ASM/SplineFields3Dmx.C +++ b/src/ASM/SplineFields3Dmx.C @@ -85,7 +85,7 @@ bool SplineFields3Dmx::valueFE (const ItgPoint& x, Vector& vals) const auto rit = vals.begin(); for (int b : bases) { const Go::SplineVolume* basis = svol->getBasis(b); - Go::BasisPts spline; + GoBasisPtsVol spline; #pragma omp critical basis->computeBasis(x.u,x.v,x.w,spline); diff --git a/src/ASM/Test/TestPiolaMapping.C b/src/ASM/Test/TestPiolaMapping.C index 359bed44f..850082711 100644 --- a/src/ASM/Test/TestPiolaMapping.C +++ b/src/ASM/Test/TestPiolaMapping.C @@ -511,7 +511,7 @@ TEST_CASE("TestPiolaMapping.Basis3D") double detJ = utl::Jacobian(Ji, dNdX, X, dNdu, true); J.multiply(X,dNdu); // J = X * dNdu - Go::BasisPts spline1, spline2, spline3; + GoBasisPtsVol spline1, spline2, spline3; b.getBasis(1)->computeBasis(u,v,w,spline1); b.getBasis(2)->computeBasis(u,v,w,spline2); b.getBasis(3)->computeBasis(u,v,w,spline3); @@ -591,7 +591,7 @@ TEST_CASE("TestPiolaMapping.Gradient3D") H.multiply(X,bfs.back().d2Ndu2); J.multiply(X,bfs.back().dNdu); // J = X * dNdu - Go::BasisDerivs spline1, spline2, spline3; + GoBasisDerivsVol spline1, spline2, spline3; b.getBasis(1)->computeBasis(u,v,w,spline1); b.getBasis(2)->computeBasis(u,v,w,spline2); b.getBasis(3)->computeBasis(u,v,w,spline3); diff --git a/src/Utility/SplineUtils.C b/src/Utility/SplineUtils.C index 747cab65e..301911b6d 100644 --- a/src/Utility/SplineUtils.C +++ b/src/Utility/SplineUtils.C @@ -137,7 +137,7 @@ void SplineUtils::extractBasis (const Go::BasisDerivsSf3& spline, } -void SplineUtils::extractBasis (const Go::BasisDerivs& spline, +void SplineUtils::extractBasis (const GoBasisDerivsVol& spline, Vector& N, Matrix& dNdu) { N .resize(spline.basisValues.size()); @@ -154,7 +154,7 @@ void SplineUtils::extractBasis (const Go::BasisDerivs& spline, } -void SplineUtils::extractBasis (const Go::BasisDerivs2& spline, +void SplineUtils::extractBasis (const GoBasisDerivsVol2& spline, Vector& N, Matrix& dNdu, Matrix3D& d2Ndu2) { N .resize(spline.basisValues.size()); diff --git a/src/Utility/SplineUtils.h b/src/Utility/SplineUtils.h index 8d879585c..0ca701d39 100644 --- a/src/Utility/SplineUtils.h +++ b/src/Utility/SplineUtils.h @@ -25,14 +25,31 @@ namespace Go { struct BasisDerivsSf; struct BasisDerivsSf2; struct BasisDerivsSf3; +#if GoTools_VERSION_MAJOR > 4 + struct BasisDerivsVol; + struct BasisDerivsVol2; + struct BasisPtsVol; +#else struct BasisDerivs; struct BasisDerivs2; + struct BasisPts; +#endif class BsplineBasis; class SplineCurve; class SplineSurface; class SplineVolume; } +#if GoTools_VERSION_MAJOR > 4 +using GoBasisPtsVol = Go::BasisPtsVol; //!< Forward for new version +using GoBasisDerivsVol = Go::BasisDerivsVol; //!< Forward for new version +using GoBasisDerivsVol2 = Go::BasisDerivsVol2; //!< Forward for new version +#else +using GoBasisPtsVol = Go::BasisPts; //!< Type alias for old version +using GoBasisDerivsVol = Go::BasisDerivs; //!< Type alias for old version +using GoBasisDerivsVol2 = Go::BasisDerivs2; //!< Type alias for old version +#endif + namespace SplineUtils //! Various utility functions on spline objects. { @@ -62,10 +79,10 @@ namespace SplineUtils //! Various utility functions on spline objects. Matrix3D& d2Ndu2, Matrix4D& d3Ndu3); //! \brief Establishes matrices with basis functions and 1st derivatives. - void extractBasis(const Go::BasisDerivs& spline, + void extractBasis(const GoBasisDerivsVol& spline, Vector& N, Matrix& dNdu); //! \brief Establishes matrices with basis functions, 1st and 2nd derivatives. - void extractBasis(const Go::BasisDerivs2& spline, + void extractBasis(const GoBasisDerivsVol2& spline, Vector& N, Matrix& dNdu, Matrix3D& d2Ndu2); //! \brief Extracts parameter values of the Gauss points for a spline basis. diff --git a/src/Utility/Test/TestSplineUtils.C b/src/Utility/Test/TestSplineUtils.C index 2cacf7c19..5c5b18e8c 100644 --- a/src/Utility/Test/TestSplineUtils.C +++ b/src/Utility/Test/TestSplineUtils.C @@ -166,8 +166,8 @@ TEST_CASE("TestSplineUtils.ExtractBasisVolume") Go::SplineVolume* vol = sphere.geometryVolume(); vol->setParameterDomain(0.0, 1.0, 0.0, 1.0, 0.0, 1.0); - std::vector spline; - std::vector spline2; + std::vector spline; + std::vector spline2; Matrix gpar(1, 1); gpar(1,1) = 0.3; vol->computeBasisGrid(gpar,gpar,gpar,spline);