From b068b5ff6e819ced3786c7bc8fcfd2416a1cf4a2 Mon Sep 17 00:00:00 2001 From: Randolph Settgast Date: Sat, 13 Sep 2025 10:10:08 +0900 Subject: [PATCH 1/5] update shiva hash --- src/Shiva | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shiva b/src/Shiva index 8abcdf3..8f80a5e 160000 --- a/src/Shiva +++ b/src/Shiva @@ -1 +1 @@ -Subproject commit 8abcdf3846bdb5c88fd921d8240736a2f1dca99a +Subproject commit 8f80a5ee0c51fb79b5256e05fae6ce03ad24cda3 From 2747d6ce83b24a4340539f860fc4080c30dcb57d Mon Sep 17 00:00:00 2001 From: Randolph Settgast Date: Sun, 14 Sep 2025 02:33:08 +0900 Subject: [PATCH 2/5] optional BLT --- src/CMakeLists.txt | 10 ++++++++-- src/Shiva | 2 +- src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0dffaea..a90df22 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,11 @@ + +message( "Adding SHIVA" ) + add_subdirectory(Shiva) -shiva_add_code_checks( PREFIX SEMKernels - EXCLUDES "Shiva/*" ) +if( SHIVA_ENABLE_BLT ) + shiva_add_code_checks( PREFIX SEMKernels + EXCLUDES "Shiva/*" ) +endif() + add_subdirectory(finiteElement) diff --git a/src/Shiva b/src/Shiva index 8f80a5e..2c8d063 160000 --- a/src/Shiva +++ b/src/Shiva @@ -1 +1 @@ -Subproject commit 8f80a5ee0c51fb79b5256e05fae6ce03ad24cda3 +Subproject commit 2c8d063e29d3cb5a89d1d25b911e9e7b04db3fbd diff --git a/src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp b/src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp index bee051c..6c66e1e 100644 --- a/src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp +++ b/src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp @@ -303,7 +303,7 @@ class SEMQkGLIntegralsClassic constexpr int mapping[8] = {0, 1, 3, 2, 4, 5, 7, 6}; - float reordered_corners[8][3]; + float reordered_corners[8][3] = {0}; for(int i = 0; i < 8; i++) { for(int coord = 0; coord < 3; coord++) { reordered_corners[i][coord] = corners[mapping[i]][coord]; From 4ccfe36b47e34ab4d8fb706b17dc3c28143b5232 Mon Sep 17 00:00:00 2001 From: Randolph Settgast Date: Sun, 14 Sep 2025 03:23:26 +0900 Subject: [PATCH 3/5] change order to template argument for classic --- .../classic/SEMQkGLBasisFunctionsClassic.hpp | 79 +++++++++---------- .../classic/SEMQkGLIntegralsClassic.hpp | 11 ++- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/src/finiteElement/classic/SEMQkGLBasisFunctionsClassic.hpp b/src/finiteElement/classic/SEMQkGLBasisFunctionsClassic.hpp index ae8468f..a938dad 100644 --- a/src/finiteElement/classic/SEMQkGLBasisFunctionsClassic.hpp +++ b/src/finiteElement/classic/SEMQkGLBasisFunctionsClassic.hpp @@ -7,10 +7,10 @@ using namespace std; /** * This class is the basis class for the hexahedron finite element cells with shape functions defined on Gauss-Lobatto quadrature points. */ +template< int ORDER > class SEMQkGLBasisFunctionsClassic { private: - int order; public: PROXY_HOST_DEVICE SEMQkGLBasisFunctionsClassic(){}; @@ -19,35 +19,38 @@ class SEMQkGLBasisFunctionsClassic template< typename TYPE > PROXY_HOST_DEVICE - static void gaussLobattoQuadraturePoints( int order, TYPE & quadraturePoints ) //const + static void gaussLobattoQuadraturePoints( TYPE & quadraturePoints ) //const { - switch( order ) - { - case 1: + if constexpr ( ORDER==1) + { quadraturePoints[0]=-1.; quadraturePoints[1]=1.; - break; - case 2: + } + else if constexpr ( ORDER==2) + { quadraturePoints[0]=-1.; quadraturePoints[1]=0.; quadraturePoints[2]=1.; - break; - case 3: + } + else if constexpr ( ORDER==3) + { static constexpr double sqrt5 = 2.2360679774997897; quadraturePoints[0] = -1.0; quadraturePoints[1] = -1./sqrt5; quadraturePoints[2] = 1./sqrt5; quadraturePoints[3] = 1.; - break; - case 4: + } + else if constexpr ( ORDER==4) + { static constexpr double sqrt3_7 = 0.6546536707079771; quadraturePoints[0] = -1.0; quadraturePoints[1] = -sqrt3_7; quadraturePoints[2] = 0.0; quadraturePoints[3] = sqrt3_7; quadraturePoints[4] = 1.0; - break; - case 5: + } + else if constexpr ( ORDER==5) + { static constexpr double sqrt__7_plus_2sqrt7__ = 3.50592393273573196; static constexpr double sqrt__7_mins_2sqrt7__ = 1.30709501485960033; static constexpr double sqrt_inv21 = 0.218217890235992381; @@ -57,35 +60,32 @@ class SEMQkGLBasisFunctionsClassic quadraturePoints[3] = sqrt_inv21*sqrt__7_mins_2sqrt7__; quadraturePoints[4] = sqrt_inv21*sqrt__7_plus_2sqrt7__; quadraturePoints[5] = 1.0; - break; - default: - break; - } + } } template< typename TYPE > PROXY_HOST_DEVICE - static void gaussLobattoQuadratureWeights( int order, TYPE & weights ) + static void gaussLobattoQuadratureWeights( TYPE & weights ) { - if( order == 1 ) + if constexpr ( ORDER == 1 ) { weights[0]=1.0; weights[1]=1.0; } - if( order == 2 ) + if constexpr ( ORDER == 2 ) { weights[0]=0.33333333; weights[1]=1.33333333; weights[2]= 0.33333333; } - if( order == 3 ) + if constexpr ( ORDER == 3 ) { weights[0]=0.16666667; weights[1]=0.83333333; weights[2]=0.83333333; weights[3]=0.16666667; } - if( order == 4 ) + if constexpr ( ORDER == 4 ) { weights[0]=0.1; weights[1]=0.54444444; @@ -93,7 +93,7 @@ class SEMQkGLBasisFunctionsClassic weights[3]=0.54444444; weights[4]=0.1; } - if( order == 5 ) + if constexpr ( ORDER == 5 ) { weights[0]=0.06666667; weights[1]=0.37847496; @@ -105,21 +105,21 @@ class SEMQkGLBasisFunctionsClassic } PROXY_HOST_DEVICE - static vector< double > shapeFunction1D( int order, double xi ) + static vector< double > shapeFunction1D( double xi ) { - std::vector< double > shapeFunction( order+1 ); - if( order==1 ) + std::vector< double > shapeFunction( ORDER+1 ); + if constexpr ( ORDER==1 ) { shapeFunction[0]=0.5*(1.0-xi); shapeFunction[1]=0.5*(1.0+xi); } - if( order==2 ) + if constexpr ( ORDER==2 ) { shapeFunction[0]= -1.0*xi*(0.5 - 0.5*xi); shapeFunction[1]=(1.0 - 1.0*xi)*(1.0*xi + 1.0); shapeFunction[2]= 1.0*xi*(0.5*xi + 0.5); } - if( order==3 ) + if constexpr ( ORDER==3 ) { shapeFunction[0]=(0.309016994374947 - 0.690983005625053*xi)*(0.5 - 0.5*xi) *(-1.80901699437495*xi - 0.809016994374947); @@ -130,7 +130,7 @@ class SEMQkGLBasisFunctionsClassic shapeFunction[3]=(0.5*xi + 0.5)*(0.690983005625053*xi + 0.309016994374947) *(1.80901699437495*xi - 0.809016994374947); } - if( order==4 ) + if constexpr ( ORDER==4 ) { shapeFunction[0]=1.0*xi*(0.39564392373896 - 0.60435607626104*xi)*(0.5 - 0.5*xi) *(-2.89564392373896*xi - 1.89564392373896); @@ -142,7 +142,7 @@ class SEMQkGLBasisFunctionsClassic shapeFunction[4]= 1.0*xi*(0.5*xi + 0.5)*(0.60435607626104*xi + 0.39564392373896) *(2.89564392373896*xi - 1.89564392373896); } - if( order==5 ) + if constexpr ( ORDER==5 ) { shapeFunction[0]=(0.221930066935875 - 0.778069933064125*xi)*(0.433445520691247 - 0.566554479308753*xi) *(0.5 - 0.5*xi)*(-4.25632117622354*xi - 3.25632117622354) @@ -169,20 +169,20 @@ class SEMQkGLBasisFunctionsClassic PROXY_HOST_DEVICE static - void derivativeShapeFunction1D( int order, double xi, float * const derivativeShapeFunction ) + void derivativeShapeFunction1D( double xi, float * const derivativeShapeFunction ) { - if( order == 1 ) + if constexpr ( ORDER == 1 ) { derivativeShapeFunction[0]=-0.5; derivativeShapeFunction[1]=0.5; } - if( order == 2 ) + if constexpr ( ORDER == 2 ) { derivativeShapeFunction[0]=1.0*xi - 0.5; derivativeShapeFunction[1]=-2.0*xi; derivativeShapeFunction[2]=1.0*xi + 0.5; } - if( order == 3 ) + if constexpr ( ORDER == 3 ) { derivativeShapeFunction[0]=-1.80901699437495*(0.309016994374947 - 0.690983005625053*xi)*(0.5 - 0.5*xi) + (-1.80901699437495*xi - 0.809016994374947)*(0.345491502812526*xi - 0.345491502812526) @@ -200,7 +200,7 @@ class SEMQkGLBasisFunctionsClassic (0.345491502812526*xi + 0.345491502812526)*(1.80901699437495*xi - 0.809016994374947) + 1.80901699437495*(0.5*xi + 0.5)*(0.690983005625053*xi + 0.309016994374947); } - if( order == 4 ) + if constexpr ( ORDER == 4 ) { derivativeShapeFunction[0]=2.89564392373896*xi*(0.39564392373896 - 0.60435607626104*xi)*(0.5 - 0.5*xi) + 0.5*xi*(0.39564392373896 - 0.60435607626104*xi)*(-2.89564392373896*xi - 1.89564392373896) @@ -229,7 +229,7 @@ class SEMQkGLBasisFunctionsClassic + 0.5*xi*(0.60435607626104*xi + 0.39564392373896)*(2.89564392373896*xi - 1.89564392373896) + (0.5*xi + 0.5)*(0.60435607626104*xi + 0.39564392373896)*(2.89564392373896*xi - 1.89564392373896); } - if( order == 5 ) + if constexpr ( ORDER == 5 ) { derivativeShapeFunction[0]=-1.39905441140358*(0.221930066935875 - 0.778069933064125*xi)*(0.433445520691247 - 0.566554479308753*xi) *(0.5 - 0.5*xi)*(-4.25632117622354*xi - 3.25632117622354) @@ -300,15 +300,14 @@ class SEMQkGLBasisFunctionsClassic template< typename T1, typename T2 > PROXY_HOST_DEVICE - static void getDerivativeBasisFunction1D( int order, - T1 const & quadraturePoints, + static void getDerivativeBasisFunction1D( T1 const & quadraturePoints, T2 & derivativeBasisFunction1D ) { // loop over quadrature points - for( int q = 0; q < order+1; q++ ) + for( int q = 0; q < ORDER+1; q++ ) { //extract all basis functions for current quadrature point - derivativeShapeFunction1D( order, quadraturePoints[q], derivativeBasisFunction1D[q] ); + derivativeShapeFunction1D( quadraturePoints[q], derivativeBasisFunction1D[q] ); } } }; diff --git a/src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp b/src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp index 6c66e1e..0fc83a5 100644 --- a/src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp +++ b/src/finiteElement/classic/SEMQkGLIntegralsClassic.hpp @@ -13,7 +13,7 @@ template < int ORDER > class SEMQkGLIntegralsClassic { private: - SEMQkGLBasisFunctionsClassic GLBasis; + SEMQkGLBasisFunctionsClassic GLBasis; public: constexpr static bool isClassic = true; @@ -30,13 +30,12 @@ class SEMQkGLIntegralsClassic static void init( PrecomputedData & precomputedData ) { // initialize quadrature points and weights - SEMQkGLBasisFunctionsClassic::gaussLobattoQuadraturePoints( ORDER, precomputedData.quadraturePoints ); - SEMQkGLBasisFunctionsClassic::gaussLobattoQuadratureWeights( ORDER, precomputedData.weights ); + SEMQkGLBasisFunctionsClassic::gaussLobattoQuadraturePoints( precomputedData.quadraturePoints ); + SEMQkGLBasisFunctionsClassic::gaussLobattoQuadratureWeights( precomputedData.weights ); // initialize derivative basis function - SEMQkGLBasisFunctionsClassic::getDerivativeBasisFunction1D( ORDER, - precomputedData.quadraturePoints, - precomputedData.derivativeBasisFunction1D ); + SEMQkGLBasisFunctionsClassic::getDerivativeBasisFunction1D( precomputedData.quadraturePoints, + precomputedData.derivativeBasisFunction1D ); } PROXY_HOST_DEVICE SEMQkGLIntegralsClassic(){}; From 3c22791fa727c94731b28a6097c62bf8d150ba6b Mon Sep 17 00:00:00 2001 From: Randolph Settgast Date: Mon, 15 Sep 2025 01:56:42 -0700 Subject: [PATCH 4/5] revisions for changed interface for shiva --- src/CMakeLists.txt | 13 +++++++----- src/Shiva | 2 +- .../optim/SEMQkGLIntegralsOptim.hpp | 2 +- .../shiva/SEMQkGLIntegralsShiva.hpp | 20 +++++++++---------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a90df22..a643c60 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,14 @@ -message( "Adding SHIVA" ) +set( SHIVA_ENABLE_UNIT_TESTS OFF CACHE BOOL "" FORCE ) +set( SHIVA_ENABLE_BENCHMARKS OFF CACHE BOOL "" FORCE ) +set( SHIVA_ENABLE_EXAMPLES OFF CACHE BOOL "" FORCE ) +set( SHIVA_ENABLE_BLT OFF CACHE BOOL "" FORCE ) +set( SHIVA_ENABLE_CAMP OFF CACHE BOOL "" FORCE ) +set( SHIVA_ENABLE_BOUNDS_CHECKS OFF CACHE BOOL "" FORCE ) + add_subdirectory(Shiva) -if( SHIVA_ENABLE_BLT ) - shiva_add_code_checks( PREFIX SEMKernels - EXCLUDES "Shiva/*" ) -endif() + add_subdirectory(finiteElement) diff --git a/src/Shiva b/src/Shiva index 2c8d063..51397ad 160000 --- a/src/Shiva +++ b/src/Shiva @@ -1 +1 @@ -Subproject commit 2c8d063e29d3cb5a89d1d25b911e9e7b04db3fbd +Subproject commit 51397ad7a831ad72aa25eee89a9b450549eda384 diff --git a/src/finiteElement/optim/SEMQkGLIntegralsOptim.hpp b/src/finiteElement/optim/SEMQkGLIntegralsOptim.hpp index ec1aab2..4819acb 100644 --- a/src/finiteElement/optim/SEMQkGLIntegralsOptim.hpp +++ b/src/finiteElement/optim/SEMQkGLIntegralsOptim.hpp @@ -3,7 +3,7 @@ #include "SEMQkGLBasisFunctionsOptim.hpp" #include "common/mathUtilites.hpp" -#include "common/CArray.hpp" +#include "shiva/common/CArray.hpp" #include diff --git a/src/finiteElement/shiva/SEMQkGLIntegralsShiva.hpp b/src/finiteElement/shiva/SEMQkGLIntegralsShiva.hpp index 8e40062..0bdabea 100644 --- a/src/finiteElement/shiva/SEMQkGLIntegralsShiva.hpp +++ b/src/finiteElement/shiva/SEMQkGLIntegralsShiva.hpp @@ -3,16 +3,16 @@ #include "common/macros.hpp" #include "common/mathUtilites.hpp" -#include "functions/bases/LagrangeBasis.hpp" -#include "functions/quadrature/Quadrature.hpp" -#include "functions/spacing/Spacing.hpp" -#include "geometry/shapes/NCube.hpp" -#include "geometry/shapes/InterpolatedShape.hpp" -#include "geometry/mapping/LinearTransform.hpp" -#include "common/ShivaMacros.hpp" -#include "common/pmpl.hpp" -#include "common/types.hpp" -#include "discretizations/finiteElementMethod/parentElements/ParentElement.hpp" +#include "shiva/functions/bases/LagrangeBasis.hpp" +#include "shiva/functions/quadrature/Quadrature.hpp" +#include "shiva/functions/spacing/Spacing.hpp" +#include "shiva/geometry/shapes/NCube.hpp" +#include "shiva/geometry/shapes/InterpolatedShape.hpp" +#include "shiva/geometry/mapping/LinearTransform.hpp" +#include "shiva/common/ShivaMacros.hpp" +#include "shiva/common/pmpl.hpp" +#include "shiva/common/types.hpp" +#include "shiva/discretizations/finiteElementMethod/parentElements/ParentElement.hpp" #include From e6cddc8bfb8f2793e5481a5a41b543a13a88818b Mon Sep 17 00:00:00 2001 From: Randolph Settgast Date: Thu, 25 Sep 2025 22:00:49 -0700 Subject: [PATCH 5/5] update submodule --- src/Shiva | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Shiva b/src/Shiva index 6c9bdf7..9034f3f 160000 --- a/src/Shiva +++ b/src/Shiva @@ -1 +1 @@ -Subproject commit 6c9bdf78c347e805223359bc0732610c7b6e0031 +Subproject commit 9034f3fb66559f6117b6a08a883cb61688ed86f1