Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 47 additions & 22 deletions cmake/IFEMFindDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -33,15 +58,15 @@ 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.*)
list(TRANSFORM LRSpline_LIBRARY_DIRS REPLACE "-L" "")
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()
Expand Down
3 changes: 2 additions & 1 deletion cmake/IFEMSetupDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()

Expand Down
8 changes: 4 additions & 4 deletions src/ASM/ASMs3Dmx.C
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::vector<Go::BasisDerivs>> splinex(m_basis.size() + separateGeometry);
std::vector<std::vector<GoBasisDerivsVol>> 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]);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<std::vector<Go::BasisPts>> splinex(m_basis.size());
std::vector<std::vector<GoBasisPtsVol>> splinex(m_basis.size());
if (regular)
{
for (size_t b = 0; b < m_basis.size(); ++b)
Expand Down Expand Up @@ -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<std::vector<Go::BasisDerivs>> splinex(m_basis.size() + separateGeometry);
std::vector<std::vector<GoBasisDerivsVol>> splinex(m_basis.size() + separateGeometry);
if (regular)
{
for (size_t b = 0; b < m_basis.size(); ++b)
Expand Down
4 changes: 2 additions & 2 deletions src/ASM/ASMs3Drecovery.C
Original file line number Diff line number Diff line change
Expand Up @@ -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<Go::BasisPts> spl1;
std::vector<Go::BasisDerivs> spl2;
std::vector<GoBasisPtsVol> spl1;
std::vector<GoBasisDerivsVol> spl2;
if (continuous)
geo->computeBasisGrid(gpar[0],gpar[1],gpar[2],spl2);

Expand Down
8 changes: 4 additions & 4 deletions src/ASM/LR/ASMu3D.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/ASM/LR/ASMu3Dmx.C
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t> nc(nfx.size(), 0);
if (nf)
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/ASM/LR/ASMu3Drecovery.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/ASM/LR/LRSplineField.C
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion src/ASM/LR/LRSplineField3D.C
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "ASMu3D.h"
#include "ItgPoint.h"
#include "SplineUtils.h"
#include "Vec3.h"


Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/ASM/LR/LRSplineFields2D.C
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "LRSplineFields2D.h"
#include "LRSplineField.h"


#include "ASMu2D.h"
#include "ItgPoint.h"
#include "Vec3.h"
Expand Down
3 changes: 2 additions & 1 deletion src/ASM/LR/LRSplineFields3D.C
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "LRSplineFields3D.h"
#include "LRSplineField.h"
#include "SplineUtils.h"

#include "ASMu3D.h"
#include "ItgPoint.h"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ASM/LR/LRSplineFields3Dmx.C
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/ASM/SplineField.C
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -163,15 +163,15 @@ 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);
ASMs3D::scatterInd(vol.numCoefs(0),vol.numCoefs(1),vol.numCoefs(2),
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);
Expand Down
6 changes: 3 additions & 3 deletions src/ASM/SplineField3D.C
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/ASM/SplineFields3D.C
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/ASM/SplineFields3Dmx.C
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading