diff --git a/examples/advection/advectionProblem.h b/examples/advection/advectionProblem.h index 76ed86b45d2f56ca1b63c7a3219a1eb775706972..73d34dcf2e050c00efc73d669485fcc3997c3df3 100644 --- a/examples/advection/advectionProblem.h +++ b/examples/advection/advectionProblem.h @@ -14,11 +14,10 @@ template< typename Mesh, typename RightHandSide, typename DifferentialOperator > class advectionProblem: - public tnlPDEProblem< Mesh, - TimeDependentProblem, - typename DifferentialOperator::RealType, - typename Mesh::DeviceType, - typename DifferentialOperator::IndexType > +public PDEProblem< Mesh, + typename DifferentialOperator::RealType, + typename Mesh::DeviceType, + typename DifferentialOperator::IndexType > { public: @@ -31,9 +30,6 @@ class advectionProblem: typedef SharedPointer< DifferentialOperator > DifferentialOperatorPointer; typedef SharedPointer< BoundaryCondition > BoundaryConditionPointer; typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer; - - typedef tnlMeshFunction< Mesh > MeshFunctionType; - typedef tnlPDEProblem< Mesh, TimeDependentProblem, RealType, DeviceType, IndexType > BaseType; using typename BaseType::MeshType; using typename BaseType::MeshPointer; diff --git a/examples/inviscid-flow/1d/eulerProblem.h b/examples/inviscid-flow/1d/eulerProblem.h index ae6d4cd714cba3e776470a4aac6f35dd9ca3ee97..f687ee5460accc7a593bb8f6e034872f8d8e6eda 100644 --- a/examples/inviscid-flow/1d/eulerProblem.h +++ b/examples/inviscid-flow/1d/eulerProblem.h @@ -12,8 +12,7 @@ template< typename Mesh, typename RightHandSide, typename DifferentialOperator > class eulerProblem: - public tnlPDEProblem< Mesh, - TimeDependentProblem, + public PDEProblem< Mesh, typename DifferentialOperator::RealType, typename Mesh::DeviceType, typename DifferentialOperator::IndexType > @@ -30,9 +29,6 @@ class eulerProblem: typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer; typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType; - typedef tnlMeshFunction< Mesh > MeshFunctionType; - typedef tnlPDEProblem< Mesh, TimeDependentProblem, RealType, DeviceType, IndexType > BaseType; - using typename BaseType::MeshType; using typename BaseType::MeshPointer; using typename BaseType::DofVectorType; diff --git a/examples/inviscid-flow/2d/eulerProblem.h b/examples/inviscid-flow/2d/eulerProblem.h index f0c43a9c513c1d59adcc5bb362023a526e844838..71a9a7a7c1b71f96afd3c289258f27225337f854 100644 --- a/examples/inviscid-flow/2d/eulerProblem.h +++ b/examples/inviscid-flow/2d/eulerProblem.h @@ -12,8 +12,7 @@ template< typename Mesh, typename RightHandSide, typename DifferentialOperator > class eulerProblem: - public tnlPDEProblem< Mesh, - TimeDependentProblem, + public PDEProblem< Mesh, typename DifferentialOperator::RealType, typename Mesh::DeviceType, typename DifferentialOperator::IndexType > @@ -30,9 +29,6 @@ class eulerProblem: typedef SharedPointer< RightHandSide, DeviceType > RightHandSidePointer; typedef PDEProblem< Mesh, RealType, DeviceType, IndexType > BaseType; - typedef tnlMeshFunction< Mesh > MeshFunctionType; - typedef tnlPDEProblem< Mesh, TimeDependentProblem, RealType, DeviceType, IndexType > BaseType; - using typename BaseType::MeshType; using typename BaseType::MeshPointer; using typename BaseType::DofVectorType; diff --git a/examples/narrow-band/tnlNarrowBand2D_CUDA_v4_impl.h b/examples/narrow-band/tnlNarrowBand2D_CUDA_v4_impl.h index 016b12ba7847f63b12a0a4b6223145a2cad6d905..e532bca7774c9c42648bf43f648a07ebbf20eb78 100644 --- a/examples/narrow-band/tnlNarrowBand2D_CUDA_v4_impl.h +++ b/examples/narrow-band/tnlNarrowBand2D_CUDA_v4_impl.h @@ -306,9 +306,9 @@ void tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: u if(abs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); // cudaDofVector2[Entity.getIndex()] = fabsMin(value, tmp); atomicFabsMin(&(cudaDofVector2[Entity.getIndex()]), tmp); @@ -355,30 +355,30 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i int gid = Entity.getIndex(); if(abs(cudaDofVector2[gid]) > 1.5*h) - cudaDofVector2[gid] = INT_MAX*Sign(cudaDofVector2[gid]); + cudaDofVector2[gid] = INT_MAX*sign(cudaDofVector2[gid]); // if (i >0 && j > 0 && i+1 < Mesh.getDimensions().x() && j+1 < Mesh.getDimensions().y()) // { // if(cudaDofVector2[gid]*cudaDofVector2[gid+1] <= 0 ) // { -// cudaDofVector2[gid] = Sign(cudaDofVector2[gid])*0.5*h; -// cudaDofVector2[gid+1] = Sign(cudaDofVector2[gid+1])*0.5*h; +// cudaDofVector2[gid] = sign(cudaDofVector2[gid])*0.5*h; +// cudaDofVector2[gid+1] = sign(cudaDofVector2[gid+1])*0.5*h; // } // if( cudaDofVector2[gid]*cudaDofVector2[gid+Mesh.getDimensions().x()] <= 0 ) // { -// cudaDofVector2[gid] = Sign(cudaDofVector2[gid])*0.5*h; -// cudaDofVector2[gid+Mesh.getDimensions().x()] = Sign(cudaDofVector2[gid+Mesh.getDimensions().x()])*0.5*h; +// cudaDofVector2[gid] = sign(cudaDofVector2[gid])*0.5*h; +// cudaDofVector2[gid+Mesh.getDimensions().x()] = sign(cudaDofVector2[gid+Mesh.getDimensions().x()])*0.5*h; // } // // if(cudaDofVector2[gid]*cudaDofVector2[gid-1] <= 0 ) // { -// cudaDofVector2[gid] = Sign(cudaDofVector2[gid])*0.5*h; -// cudaDofVector2[gid-1] = Sign(cudaDofVector2[gid-1])*0.5*h; +// cudaDofVector2[gid] = sign(cudaDofVector2[gid])*0.5*h; +// cudaDofVector2[gid-1] = sign(cudaDofVector2[gid-1])*0.5*h; // } // if( cudaDofVector2[gid]*cudaDofVector2[gid-Mesh.getDimensions().x()] <= 0 ) // { -// cudaDofVector2[gid] = Sign(cudaDofVector2[gid])*0.5*h; -// cudaDofVector2[gid-Mesh.getDimensions().x()] = Sign(cudaDofVector2[gid-Mesh.getDimensions().x()])*0.5*h; +// cudaDofVector2[gid] = sign(cudaDofVector2[gid])*0.5*h; +// cudaDofVector2[gid-Mesh.getDimensions().x()] = sign(cudaDofVector2[gid-Mesh.getDimensions().x()])*0.5*h; // } // } @@ -733,7 +733,7 @@ __global__ void runNarrowBandCUDA(tnlNarrowBand< tnlGrid< 2,double, tnlHost, int - if(Sign(value) >= 0.0) + if(sign(value) >= 0.0) { xf = solver->negativePart(xf); diff --git a/examples/narrow-band/tnlNarrowBand2D_CUDA_v5_impl.h b/examples/narrow-band/tnlNarrowBand2D_CUDA_v5_impl.h index 3d044567833c7c96e4e8333e737cb6c71f30213f..2d1296058391a0685d9385047469acb41a40b765 100644 --- a/examples/narrow-band/tnlNarrowBand2D_CUDA_v5_impl.h +++ b/examples/narrow-band/tnlNarrowBand2D_CUDA_v5_impl.h @@ -305,9 +305,9 @@ void tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: u if(abs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); // cudaDofVector2[Entity.getIndex()] = fabsMin(value, tmp); atomicFabsMin(&(cudaDofVector2[Entity.getIndex()]), tmp); @@ -353,30 +353,30 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i int gid = Entity.getIndex(); - cudaDofVector2[gid] = INT_MAX*Sign(cudaDofVector2[gid]); + cudaDofVector2[gid] = INT_MAX*sign(cudaDofVector2[gid]); if (i >0 && j > 0 && i+1 < Mesh.getDimensions().x() && j+1 < Mesh.getDimensions().y()) { if(cudaDofVector2[gid]*cudaDofVector2[gid+1] <= 0 ) { - cudaDofVector2[gid] = Sign(cudaDofVector2[gid])*0.5*h; - cudaDofVector2[gid+1] = Sign(cudaDofVector2[gid+1])*0.5*h; + cudaDofVector2[gid] = sign(cudaDofVector2[gid])*0.5*h; + cudaDofVector2[gid+1] = sign(cudaDofVector2[gid+1])*0.5*h; } if( cudaDofVector2[gid]*cudaDofVector2[gid+Mesh.getDimensions().x()] <= 0 ) { - cudaDofVector2[gid] = Sign(cudaDofVector2[gid])*0.5*h; - cudaDofVector2[gid+Mesh.getDimensions().x()] = Sign(cudaDofVector2[gid+Mesh.getDimensions().x()])*0.5*h; + cudaDofVector2[gid] = sign(cudaDofVector2[gid])*0.5*h; + cudaDofVector2[gid+Mesh.getDimensions().x()] = sign(cudaDofVector2[gid+Mesh.getDimensions().x()])*0.5*h; } if(cudaDofVector2[gid]*cudaDofVector2[gid-1] <= 0 ) { - cudaDofVector2[gid] = Sign(cudaDofVector2[gid])*0.5*h; - cudaDofVector2[gid-1] = Sign(cudaDofVector2[gid-1])*0.5*h; + cudaDofVector2[gid] = sign(cudaDofVector2[gid])*0.5*h; + cudaDofVector2[gid-1] = sign(cudaDofVector2[gid-1])*0.5*h; } if( cudaDofVector2[gid]*cudaDofVector2[gid-Mesh.getDimensions().x()] <= 0 ) { - cudaDofVector2[gid] = Sign(cudaDofVector2[gid])*0.5*h; - cudaDofVector2[gid-Mesh.getDimensions().x()] = Sign(cudaDofVector2[gid-Mesh.getDimensions().x()])*0.5*h; + cudaDofVector2[gid] = sign(cudaDofVector2[gid])*0.5*h; + cudaDofVector2[gid-Mesh.getDimensions().x()] = sign(cudaDofVector2[gid-Mesh.getDimensions().x()])*0.5*h; } } @@ -729,7 +729,7 @@ __global__ void runNarrowBandCUDA(tnlNarrowBand< tnlGrid< 2,double, tnlHost, int - if(Sign(value) > 0.0) + if(sign(value) > 0.0) { xf = solver->negativePart(xf); diff --git a/examples/narrow-band/tnlNarrowBand2D_impl.h b/examples/narrow-band/tnlNarrowBand2D_impl.h index 311d67ed77fc3fa2040ba2cd13b86ebba37d5205..8248baa0949862de6ebcee797e6916c9634de72e 100644 --- a/examples/narrow-band/tnlNarrowBand2D_impl.h +++ b/examples/narrow-band/tnlNarrowBand2D_impl.h @@ -96,7 +96,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 2, tnlGridEntityNoStencilStorage >,2> neighbourEntities(Entity); for(int i=0; i< Mesh.getDimensions().x()*Mesh.getDimensions().x();i++) { - dofVector2[i]=INT_MAX*Sign(dofVector[i]); + dofVector2[i]=INT_MAX*sign(dofVector[i]); } for(int i = 0 ; i < Mesh.getDimensions().x()-1; i++) @@ -192,7 +192,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // if(!exactInput) // { // for(Index i = 0; i < Mesh.getDimensions().x()*Mesh.getDimensions().y(); i++) -// dofVector[i]=0.5*h*Sign(dofVector[i]); +// dofVector[i]=0.5*h*sign(dofVector[i]); // } // // @@ -200,7 +200,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // { // for(Index j = 1; j < Mesh.getDimensions().y()-1; j++) // { -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // if(tmp == 0.0) // {} @@ -219,7 +219,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // for(int i = 1; i < Mesh.getDimensions().x()-1; i++) // { // Index j = 0; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // // if(tmp == 0.0) @@ -235,7 +235,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // for(int i = 1; i < Mesh.getDimensions().x()-1; i++) // { // Index j = Mesh.getDimensions().y() - 1; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // // if(tmp == 0.0) @@ -251,7 +251,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // for(int j = 1; j < Mesh.getDimensions().y()-1; j++) // { // Index i = 0; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // // if(tmp == 0.0) @@ -267,7 +267,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // for(int j = 1; j < Mesh.getDimensions().y()-1; j++) // { // Index i = Mesh.getDimensions().x() - 1; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // // if(tmp == 0.0) @@ -284,7 +284,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // Index i = Mesh.getDimensions().x() - 1; // Index j = Mesh.getDimensions().y() - 1; // -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // if(dofVector[Mesh.getCellIndex(CoordinatesType(i-1,j))]*tmp > 0.0 && // dofVector[Mesh.getCellIndex(CoordinatesType(i,j-1))]*tmp > 0.0) // @@ -293,7 +293,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // // // j = 0; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // if(dofVector[Mesh.getCellIndex(CoordinatesType(i-1,j))]*tmp > 0.0 && // dofVector[Mesh.getCellIndex(CoordinatesType(i,j+1))]*tmp > 0.0) // @@ -303,7 +303,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // // i = 0; // j = Mesh.getDimensions().y() -1; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // if(dofVector[Mesh.getCellIndex(CoordinatesType(i+1,j))]*tmp > 0.0 && // dofVector[Mesh.getCellIndex(CoordinatesType(i,j-1))]*tmp > 0.0) // @@ -312,7 +312,7 @@ bool tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i // // // j = 0; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // if(dofVector[Mesh.getCellIndex(CoordinatesType(i+1,j))]*tmp > 0.0 && // dofVector[Mesh.getCellIndex(CoordinatesType(i,j+1))]*tmp > 0.0) // @@ -424,9 +424,9 @@ void tnlNarrowBand< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: u if(fabs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); dofVector2[Entity.getIndex()] = fabsMin(value, tmp); diff --git a/examples/narrow-band/tnlNarrowBand3D_CUDA_impl.h b/examples/narrow-band/tnlNarrowBand3D_CUDA_impl.h index c2973f2dbe6f4c40c6aa85a45059ea6b1814d9a9..ac8a023d7d93060f63858892c0541f5eda0ee706 100644 --- a/examples/narrow-band/tnlNarrowBand3D_CUDA_impl.h +++ b/examples/narrow-band/tnlNarrowBand3D_CUDA_impl.h @@ -205,9 +205,9 @@ void tnlNarrowBand< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > :: u Real hD = 3.0*h*h - 2.0*(a*a + b*b + c*c - a*b - a*c - b*c); if(hD < 0.0) - tmp = fabsMin(a,fabsMin(b,c)) + Sign(value)*h; + tmp = fabsMin(a,fabsMin(b,c)) + sign(value)*h; else - tmp = (1.0/3.0) * ( a + b + c + Sign(value)*sqrt(hD) ); + tmp = (1.0/3.0) * ( a + b + c + sign(value)*sqrt(hD) ); atomicFabsMin(&cudaDofVector2[Entity.getIndex()],tmp); @@ -230,7 +230,7 @@ bool tnlNarrowBand< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > :: i if(abs(cudaDofVector[gid]) < 1.8*h) cudaDofVector2[gid] = cudaDofVector[gid]; else - cudaDofVector2[gid] = INT_MAX*Sign(cudaDofVector[gid]); + cudaDofVector2[gid] = INT_MAX*sign(cudaDofVector[gid]); return true; } diff --git a/examples/narrow-band/tnlNarrowBand3D_impl.h b/examples/narrow-band/tnlNarrowBand3D_impl.h index 6535b7c836c2fa73070c44beaa13e2e9aa532655..eb446d9d2831967e9016b3eaaf326baf6751ab7c 100644 --- a/examples/narrow-band/tnlNarrowBand3D_impl.h +++ b/examples/narrow-band/tnlNarrowBand3D_impl.h @@ -95,7 +95,7 @@ bool tnlNarrowBand< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > :: i if (abs(dofVector[i]) < 1.8*h) dofVector2[i]=dofVector[i]; else - dofVector2[i]=INT_MAX*Sign(dofVector[i]); + dofVector2[i]=INT_MAX*sign(dofVector[i]); } return true; @@ -274,9 +274,9 @@ void tnlNarrowBand< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > :: u Real hD = 3.0*h*h - 2.0*(a*a+b*b+c*c-a*b-a*c-b*c); if(hD < 0.0) - tmp = fabsMin(a,fabsMin(b,c)) + Sign(value)*h; + tmp = fabsMin(a,fabsMin(b,c)) + sign(value)*h; else - tmp = (1.0/3.0) * ( a + b + c + Sign(value)*sqrt(hD) ); + tmp = (1.0/3.0) * ( a + b + c + sign(value)*sqrt(hD) ); dofVector2[Entity.getIndex()] = fabsMin(value, tmp); diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/CMakeLists.txt b/src/TNL/Experimental/Hamilton-Jacobi/Operators/CMakeLists.txt index d2f1d09ec0aac8f1d3023eabd1210aee5f86006b..8ee63a0ac16a88e13ecb964013435160464e38b1 100755 --- a/src/TNL/Experimental/Hamilton-Jacobi/Operators/CMakeLists.txt +++ b/src/TNL/Experimental/Hamilton-Jacobi/Operators/CMakeLists.txt @@ -1 +1 @@ -ADD_SUBDIRECTORY( hamilton-jacobi ) +ADD_SUBDIRECTORY( Hamilton-Jacobi ) diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/CMakeLists.txt b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..bce61025f2bae120464881216c62091e40604836 --- /dev/null +++ b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/CMakeLists.txt @@ -0,0 +1,2 @@ +ADD_SUBDIRECTORY( Godunov ) +ADD_SUBDIRECTORY( Godunov-Eikonal ) diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov/CMakeLists.txt b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Eikonal/CMakeLists.txt old mode 100755 new mode 100644 similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov/CMakeLists.txt rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Eikonal/CMakeLists.txt diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunovEikonal.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Eikonal/godunovEikonal.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunovEikonal.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Eikonal/godunovEikonal.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/CMakeLists.txt b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/CMakeLists.txt similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/CMakeLists.txt rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/CMakeLists.txt diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/godunovEikonal.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/godunovEikonal.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/godunovEikonal.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/godunovEikonal.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/godunovEikonal1D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/godunovEikonal1D_impl.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/godunovEikonal1D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/godunovEikonal1D_impl.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/godunovEikonal2D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/godunovEikonal2D_impl.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/godunovEikonal2D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/godunovEikonal2D_impl.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/godunovEikonal3D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/godunovEikonal3D_impl.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/godunovEikonal3D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/godunovEikonal3D_impl.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal1D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal1D_impl.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal1D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal1D_impl.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal2D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal2D_impl.h similarity index 99% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal2D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal2D_impl.h index e4ba5f44f99fa5621ef0fdd34fe8d7b0053ffebc..29738ab330e3b951d6b8a9bd6be89b5606c0f5b0 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal2D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal2D_impl.h @@ -243,8 +243,8 @@ Real parallelGodunovEikonalScheme< tnlGrid< 2, MeshReal, Device, MeshIndex >, Re c =(1.0 - sqrt(a*a+b*b)*ihx ); - if(Sign(c) > 0.0 ) - return Sign(u[cellIndex])*c; + if(sign(c) > 0.0 ) + return sign(u[cellIndex])*c; else return signui*c; @@ -408,7 +408,7 @@ Real parallelGodunovEikonalScheme< tnlGrid< 2, MeshReal, Device, MeshIndex >, Re if(boundaryCondition == 0) signui = sign(u[cellIndex],/*(boundaryCondition != 0) * */this->epsilon); else - signui = Sign(u[cellIndex]); + signui = sign(u[cellIndex]); RealType xb = u[cellIndex]; RealType xf = -u[cellIndex]; @@ -475,7 +475,7 @@ Real parallelGodunovEikonalScheme< tnlGrid< 2, MeshReal, Device, MeshIndex >, Re // c =(1.0 - sqrt(a*a+b*b)*ihx ); // if(c > 0.0 ) -// return Sign(u[cellIndex])*c; +// return sign(u[cellIndex])*c; // else return signui*(1.0 - sqrt(a*a+b*b)*ihx ); } diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal3D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal3D_impl.h similarity index 98% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal3D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal3D_impl.h index 0874975aaef98b745f22846187a631ee6cb98e2d..3aa8aeed5357e7a4f0b0f176e9002c89a4295a84 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovEikonal3D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovEikonal3D_impl.h @@ -239,8 +239,8 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re // d = 1.0 - sqrt(xf*xf + xb*xb + yf*yf + yb*yb + zf*zf + zb*zb)*ihx; /*upwind*/ - if(Sign(d) > 0.0 ) - return Sign(u[cellIndex])*d; + if(sign(d) > 0.0 ) + return sign(u[cellIndex])*d; else return signui*d; } @@ -360,8 +360,8 @@ Real parallelGodunovEikonalScheme< tnlGrid< 3, MeshReal, Device, MeshIndex >, Re // d = 1.0 - sqrt(xf*xf + xb*xb + yf*yf + yb*yb + zf*zf + zb*zb)*ihx; /*upwind*/ - if(Sign(d) > 0.0 ) - return Sign(u[cellIndex])*d; + if(sign(d) > 0.0 ) + return sign(u[cellIndex])*d; else return signui*d; } diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovMap.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovMap.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovMap.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovMap.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovMap2D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovMap2D_impl.h similarity index 97% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovMap2D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovMap2D_impl.h index e74774a53bdde8ed098e500ba3b6c77b6932a7f5..c5f7d613497e7f61b449a2e16190c18988a12c3f 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov-eikonal/parallelGodunovMap2D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov-Eikonal/parallelGodunovMap2D_impl.h @@ -169,13 +169,13 @@ Real parallelGodunovMapScheme< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, // if(boundaryCondition == 0) signui = sign(u[cellIndex],/*(boundaryCondition != 0) * */this->epsilon); // else -// signui = Sign(u[cellIndex]); +// signui = sign(u[cellIndex]); RealType value; // if(map[cellIndex] == 0.0) // { //// value = INT_MAX; -// u[cellIndex] = Sign(u[cellIndex])*INT_MAX; +// u[cellIndex] = sign(u[cellIndex])*INT_MAX; // return 0.0; // } // else @@ -256,7 +256,7 @@ Real parallelGodunovMapScheme< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, c =(value - sqrt(a*a+b*b)*ihx ); if(c > 0.0 ) - return Sign(u[cellIndex])*c; + return sign(u[cellIndex])*c; else return signui*c; @@ -295,13 +295,13 @@ Real parallelGodunovMapScheme< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, if(boundaryCondition == 0) signui = sign(u[cellIndex],/*(boundaryCondition != 0) * */this->epsilon); else - signui = Sign(u[cellIndex]); + signui = sign(u[cellIndex]); // RealType value; // if(map[cellIndex] == 0.0) // { //// value = INT_MAX; -// u[cellIndex] = Sign(u[cellIndex])*INT_MAX; +// u[cellIndex] = sign(u[cellIndex])*INT_MAX; // return 0.0; // } // else @@ -382,7 +382,7 @@ Real parallelGodunovMapScheme< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, c = (value - sqrt(a*a+b*b)*ihx ); // if(c > 0.0 ) -// return Sign(u[cellIndex])*c; +// return sign(u[cellIndex])*c; // else return signui*c; } diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/CMakeLists.txt b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/CMakeLists.txt new file mode 100755 index 0000000000000000000000000000000000000000..202550179b61cbf4a47bca43f96f751d0e2510eb --- /dev/null +++ b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/CMakeLists.txt @@ -0,0 +1,18 @@ +set( headers godunov.h + godunov1D_impl.h + godunov2D_impl.h + godunov3D_impl.h) + +SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/implementation/operators/godunov ) + +if( BUILD_CUDA) + set( tnl_implementation_operators_godunov_CUDA__SOURCES + ${common_SOURCES} + PARENT_SCOPE ) +endif() + +set( tnl_implementation_operators_godunov_SOURCES + ${common_SOURCES} + PARENT_SCOPE ) + +INSTALL( FILES ${headers} DESTINATION include/tnl-${tnlVersion}/implementation/operators/godunov ) diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov/godunov1D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/godunov1D_impl.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov/godunov1D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/godunov1D_impl.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov/godunov2D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/godunov2D_impl.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov/godunov2D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/godunov2D_impl.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov/godunov3D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/godunov3D_impl.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/godunov/godunov3D_impl.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/Godunov/godunov3D_impl.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/tnlEikonalOperator.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/tnlEikonalOperator.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/tnlEikonalOperator.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/tnlEikonalOperator.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/upwindEikonal.h b/src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/upwindEikonal.h similarity index 100% rename from src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/upwindEikonal.h rename to src/TNL/Experimental/Hamilton-Jacobi/Operators/Hamilton-Jacobi/upwindEikonal.h diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/CMakeLists.txt b/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/CMakeLists.txt deleted file mode 100644 index 68f3385268ac13f850f37ab286822c2ba7118bf3..0000000000000000000000000000000000000000 --- a/src/TNL/Experimental/Hamilton-Jacobi/Operators/hamilton-jacobi/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -ADD_SUBDIRECTORY( godunov ) -ADD_SUBDIRECTORY( godunov-eikonal ) diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping-map/tnlFastSweepingMap2D_CUDA_v4_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping-map/tnlFastSweepingMap2D_CUDA_v4_impl.h index 6e195e2463e4f05094858b2d12cd428799491212..5e9d11b5264e301d8eb9a30b625861bf6a79ad2b 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping-map/tnlFastSweepingMap2D_CUDA_v4_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping-map/tnlFastSweepingMap2D_CUDA_v4_impl.h @@ -240,9 +240,9 @@ void tnlFastSweepingMap< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > if(abs(a-b) >= im*h) - tmp = fabsMin(a,b) + Sign(value)*im*h; + tmp = fabsMin(a,b) + sign(value)*im*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * im * h * im * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * im * h * im * h - (a - b) * (a - b) ) ); // cudaDofVector2[Entity.getIndex()] = fabsMin(value, tmp); atomicFabsMin(&(cudaDofVector2[Entity.getIndex()]), tmp); @@ -277,7 +277,7 @@ bool tnlFastSweepingMap< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > int gid = Entity.getIndex(); - cudaDofVector2[gid] = INT_MAX*Sign(cudaDofVector[gid]); + cudaDofVector2[gid] = INT_MAX*sign(cudaDofVector[gid]); if(abs(cudaDofVector[gid]) < 1.01*h) { diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping-map/tnlFastSweepingMap2D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping-map/tnlFastSweepingMap2D_impl.h index f35733cefd7203d1d82d981a5472dc880fdad746..adff615fd43cd012ba5e45095140d7c2e0e5fbf0 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping-map/tnlFastSweepingMap2D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping-map/tnlFastSweepingMap2D_impl.h @@ -106,7 +106,7 @@ bool tnlFastSweepingMap< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 2, tnlGridEntityNoStencilStorage >,2> neighbourEntities(Entity); for(int i=0; i< Mesh.getDimensions().x()*Mesh.getDimensions().x();i++) { - dofVector2[i]=INT_MAX*Sign(dofVector[i]); + dofVector2[i]=INT_MAX*sign(dofVector[i]); if(abs(dofVector[i]) < 1.01*h) { @@ -315,9 +315,9 @@ void tnlFastSweepingMap< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > if(fabs(a-b) >= im*h) - tmp = fabsMin(a,b) + Sign(value)*im*h; + tmp = fabsMin(a,b) + sign(value)*im*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * im * h * im * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * im * h * im * h - (a - b) * (a - b) ) ); if(abs(value)-abs(tmp) > 0.0) something_changed = 1; diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_impl.h index 791df8efd07825f092ad843f88d6735004cc775b..48cbba5cb2e247296d41d3b7c2f935c8f75ce960 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_impl.h @@ -232,9 +232,9 @@ void tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(abs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); cudaDofVector[index] = fabsMin(value, tmp); @@ -260,12 +260,12 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Real tmp = 0.0; int flag = 0; counter = 0; - tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); + tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(!exactInput) { - cudaDofVector[gid]=cudaDofVector[gid]=0.5*h*Sign(cudaDofVector[gid]); + cudaDofVector[gid]=cudaDofVector[gid]=0.5*h*sign(cudaDofVector[gid]); } __threadfence(); // printf("-----------------------------------------------------------------------------------\n"); @@ -279,7 +279,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Index j = gy; Index i = gx; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) {} @@ -301,7 +301,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // printf("gx: %d, gy: %d, gid: %d \n", gx, gy,gid); Index j = 0; Index i = gx; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -319,7 +319,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index i = gx; Index j = Mesh.getDimensions().y() - 1; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -337,7 +337,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index j = gy; Index i = 0; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -354,7 +354,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index j = gy; Index i = Mesh.getDimensions().x() - 1; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -372,7 +372,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == Mesh.getDimensions().y() - 1) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx-1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy-1))]*tmp > 0.0) @@ -382,7 +382,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == 0) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx-1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy+1))]*tmp > 0.0) @@ -393,7 +393,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == Mesh.getDimensions().y() - 1) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx+1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy-1))]*tmp > 0.0) @@ -402,7 +402,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(gx == 0 && gy == 0) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx+1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy+1))]*tmp > 0.0) diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v2_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v2_impl.h index 4d44b2f4e56311f902e39a57c35a278e710b04ec..e6b20eb4153b04248a3bf72b2198d923aa21d748 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v2_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v2_impl.h @@ -232,9 +232,9 @@ void tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(abs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); cudaDofVector[index] = fabsMin(value, tmp); @@ -260,12 +260,12 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Real tmp = 0.0; int flag = 0; counter = 0; - tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); + tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(!exactInput) { - cudaDofVector[gid]=cudaDofVector[gid]=0.5*h*Sign(cudaDofVector[gid]); + cudaDofVector[gid]=cudaDofVector[gid]=0.5*h*sign(cudaDofVector[gid]); } __threadfence(); // printf("-----------------------------------------------------------------------------------\n"); @@ -279,7 +279,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Index j = gy; Index i = gx; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) {} @@ -301,7 +301,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // printf("gx: %d, gy: %d, gid: %d \n", gx, gy,gid); Index j = 0; Index i = gx; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -319,7 +319,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index i = gx; Index j = Mesh.getDimensions().y() - 1; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -337,7 +337,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index j = gy; Index i = 0; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -354,7 +354,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index j = gy; Index i = Mesh.getDimensions().x() - 1; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -372,7 +372,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == Mesh.getDimensions().y() - 1) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx-1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy-1))]*tmp > 0.0) @@ -382,7 +382,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == 0) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx-1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy+1))]*tmp > 0.0) @@ -393,7 +393,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == Mesh.getDimensions().y() - 1) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx+1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy-1))]*tmp > 0.0) @@ -402,7 +402,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(gx == 0 && gy == 0) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx+1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy+1))]*tmp > 0.0) diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v3_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v3_impl.h index 7b411f96431e7d3d4357cd54195718cbc7d7db44..d05b649f29d222bc96649d3d6ed92a7fa11cf14e 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v3_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v3_impl.h @@ -286,9 +286,9 @@ void tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(abs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); atomicSet(&cudaDofVector[index],fabsMin(value, tmp)); @@ -314,12 +314,12 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Real tmp = 0.0; int flag = 0; counter = 0; - tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); + tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(!exactInput) { - cudaDofVector[gid]=cudaDofVector[gid]=0.5*h*Sign(cudaDofVector[gid]); + cudaDofVector[gid]=cudaDofVector[gid]=0.5*h*sign(cudaDofVector[gid]); } __threadfence(); // printf("-----------------------------------------------------------------------------------\n"); @@ -333,7 +333,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Index j = gy; Index i = gx; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) {} @@ -355,7 +355,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // printf("gx: %d, gy: %d, gid: %d \n", gx, gy,gid); Index j = 0; Index i = gx; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -373,7 +373,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index i = gx; Index j = Mesh.getDimensions().y() - 1; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -391,7 +391,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index j = gy; Index i = 0; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -408,7 +408,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index j = gy; Index i = Mesh.getDimensions().x() - 1; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -426,7 +426,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == Mesh.getDimensions().y() - 1) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx-1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy-1))]*tmp > 0.0) @@ -436,7 +436,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == 0) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx-1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy+1))]*tmp > 0.0) @@ -447,7 +447,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == Mesh.getDimensions().y() - 1) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx+1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy-1))]*tmp > 0.0) @@ -456,7 +456,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(gx == 0 && gy == 0) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx+1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy+1))]*tmp > 0.0) diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v4_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v4_impl.h index 40c129bb8f4e40c5a166c07461ee99fa9432b0a4..230b6ce436bb53c40172eb43cf8b7e668f4bf891 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v4_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v4_impl.h @@ -206,9 +206,9 @@ void tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(abs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); // cudaDofVector2[Entity.getIndex()] = fabsMin(value, tmp); atomicFabsMin(&(cudaDofVector2[Entity.getIndex()]), tmp); @@ -235,7 +235,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: int gid = Entity.getIndex(); - cudaDofVector2[gid] = INT_MAX*Sign(cudaDofVector[gid]); + cudaDofVector2[gid] = INT_MAX*sign(cudaDofVector[gid]); // // if(abs(cudaDofVector[gid]) < 1.01*h) // cudaDofVector2[gid] = cudaDofVector[gid]; diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v5_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v5_impl.h index dcc51272a26308726c4b160eb9fdeebec24fb972..f9f3e28f63fc7a3ad88b98980a4454035fd299b4 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v5_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_CUDA_v5_impl.h @@ -231,9 +231,9 @@ void tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(abs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); cudaDofVector[index] = fabsMin(value, tmp); @@ -281,9 +281,9 @@ void tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(abs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); // sharedMem[k3+1][threadIdx.y] = this->fabsMin(value, tmp); // atomicFabsMin(&(cudaDofVector[index]), tmp); @@ -312,12 +312,12 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Real tmp = 0.0; int flag = 0; counter = 0; - tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); + tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(!exactInput) { - cudaDofVector[gid]=cudaDofVector[gid]=0.5*h*Sign(cudaDofVector[gid]); + cudaDofVector[gid]=cudaDofVector[gid]=0.5*h*sign(cudaDofVector[gid]); } __threadfence(); // printf("-----------------------------------------------------------------------------------\n"); @@ -331,7 +331,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Index j = gy; Index i = gx; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) {} @@ -353,7 +353,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // printf("gx: %d, gy: %d, gid: %d \n", gx, gy,gid); Index j = 0; Index i = gx; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -371,7 +371,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index i = gx; Index j = Mesh.getDimensions().y() - 1; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -389,7 +389,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index j = gy; Index i = 0; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -406,7 +406,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { Index j = gy; Index i = Mesh.getDimensions().x() - 1; -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -424,7 +424,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == Mesh.getDimensions().y() - 1) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx-1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy-1))]*tmp > 0.0) @@ -434,7 +434,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == 0) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx-1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy+1))]*tmp > 0.0) @@ -445,7 +445,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: gy == Mesh.getDimensions().y() - 1) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx+1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy-1))]*tmp > 0.0) @@ -454,7 +454,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(gx == 0 && gy == 0) { -// tmp = Sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); +// tmp = sign(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy))]); if(cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx+1,gy))]*tmp > 0.0 && cudaDofVector[Mesh.getCellIndex(CoordinatesType(gx,gy+1))]*tmp > 0.0) diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_impl.h index 0d7ad587c442a3fa9e653a23359cff6c2dead7d6..920806c211483d1c8cc3dabd2e194704dbb560bd 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_impl.h @@ -96,7 +96,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: tnlNeighbourGridEntityGetter<tnlGridEntity< MeshType, 2, tnlGridEntityNoStencilStorage >,2> neighbourEntities(Entity); for(int i=0; i< Mesh.getDimensions().x()*Mesh.getDimensions().x();i++) { - dofVector2[i]=INT_MAX*Sign(dofVector[i]); + dofVector2[i]=INT_MAX*sign(dofVector[i]); } for(int i = 0 ; i < Mesh.getDimensions().x()-1; i++) @@ -192,7 +192,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // if(!exactInput) // { // for(Index i = 0; i < Mesh.getDimensions().x()*Mesh.getDimensions().y(); i++) -// dofVector[i]=0.5*h*Sign(dofVector[i]); +// dofVector[i]=0.5*h*sign(dofVector[i]); // } // // @@ -200,7 +200,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // { // for(Index j = 1; j < Mesh.getDimensions().y()-1; j++) // { -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // if(tmp == 0.0) // {} @@ -219,7 +219,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // for(int i = 1; i < Mesh.getDimensions().x()-1; i++) // { // Index j = 0; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // // if(tmp == 0.0) @@ -235,7 +235,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // for(int i = 1; i < Mesh.getDimensions().x()-1; i++) // { // Index j = Mesh.getDimensions().y() - 1; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // // if(tmp == 0.0) @@ -251,7 +251,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // for(int j = 1; j < Mesh.getDimensions().y()-1; j++) // { // Index i = 0; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // // if(tmp == 0.0) @@ -267,7 +267,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // for(int j = 1; j < Mesh.getDimensions().y()-1; j++) // { // Index i = Mesh.getDimensions().x() - 1; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // // // if(tmp == 0.0) @@ -284,7 +284,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // Index i = Mesh.getDimensions().x() - 1; // Index j = Mesh.getDimensions().y() - 1; // -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // if(dofVector[Mesh.getCellIndex(CoordinatesType(i-1,j))]*tmp > 0.0 && // dofVector[Mesh.getCellIndex(CoordinatesType(i,j-1))]*tmp > 0.0) // @@ -293,7 +293,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // // // j = 0; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // if(dofVector[Mesh.getCellIndex(CoordinatesType(i-1,j))]*tmp > 0.0 && // dofVector[Mesh.getCellIndex(CoordinatesType(i,j+1))]*tmp > 0.0) // @@ -303,7 +303,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // // i = 0; // j = Mesh.getDimensions().y() -1; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // if(dofVector[Mesh.getCellIndex(CoordinatesType(i+1,j))]*tmp > 0.0 && // dofVector[Mesh.getCellIndex(CoordinatesType(i,j-1))]*tmp > 0.0) // @@ -312,7 +312,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: // // // j = 0; -// tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); +// tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); // if(dofVector[Mesh.getCellIndex(CoordinatesType(i+1,j))]*tmp > 0.0 && // dofVector[Mesh.getCellIndex(CoordinatesType(i,j+1))]*tmp > 0.0) // @@ -424,9 +424,9 @@ void tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(fabs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); dofVector2[Entity.getIndex()] = fabsMin(value, tmp); diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_openMP_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_openMP_impl.h index e754ad9490ecfa8061d92735d13018ffe4b5fbc7..d766c62c528b76b61312c5c485692d6655ff8f90 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_openMP_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping2D_openMP_impl.h @@ -91,7 +91,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(!exactInput) { for(Index i = 0; i < Mesh.getDimensions().x()*Mesh.getDimensions().y(); i++) - dofVector[i]=0.5*h*Sign(dofVector[i]); + dofVector[i]=0.5*h*sign(dofVector[i]); } @@ -99,7 +99,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: { for(Index j = 1; j < Mesh.getDimensions().y()-1; j++) { - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -119,7 +119,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: for(int i = 1; i < Mesh.getDimensions().x()-1; i++) { Index j = 0; - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -135,7 +135,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: for(int i = 1; i < Mesh.getDimensions().x()-1; i++) { Index j = Mesh.getDimensions().y() - 1; - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -151,7 +151,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: for(int j = 1; j < Mesh.getDimensions().y()-1; j++) { Index i = 0; - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -167,7 +167,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: for(int j = 1; j < Mesh.getDimensions().y()-1; j++) { Index i = Mesh.getDimensions().x() - 1; - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(tmp == 0.0) @@ -184,7 +184,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: Index i = Mesh.getDimensions().x() - 1; Index j = Mesh.getDimensions().y() - 1; - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(dofVector[Mesh.getCellIndex(CoordinatesType(i-1,j))]*tmp > 0.0 && dofVector[Mesh.getCellIndex(CoordinatesType(i,j-1))]*tmp > 0.0) @@ -193,7 +193,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: j = 0; - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(dofVector[Mesh.getCellIndex(CoordinatesType(i-1,j))]*tmp > 0.0 && dofVector[Mesh.getCellIndex(CoordinatesType(i,j+1))]*tmp > 0.0) @@ -203,7 +203,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: i = 0; j = Mesh.getDimensions().y() -1; - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(dofVector[Mesh.getCellIndex(CoordinatesType(i+1,j))]*tmp > 0.0 && dofVector[Mesh.getCellIndex(CoordinatesType(i,j-1))]*tmp > 0.0) @@ -212,7 +212,7 @@ bool tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: j = 0; - tmp = Sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); + tmp = sign(dofVector[Mesh.getCellIndex(CoordinatesType(i,j))]); if(dofVector[Mesh.getCellIndex(CoordinatesType(i+1,j))]*tmp > 0.0 && dofVector[Mesh.getCellIndex(CoordinatesType(i,j+1))]*tmp > 0.0) @@ -359,9 +359,9 @@ void tnlFastSweeping< tnlGrid< 2,MeshReal, Device, MeshIndex >, Real, Index > :: if(fabs(a-b) >= h) - tmp = fabsMin(a,b) + Sign(value)*h; + tmp = fabsMin(a,b) + sign(value)*h; else - tmp = 0.5 * (a + b + Sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); + tmp = 0.5 * (a + b + sign(value)*sqrt(2.0 * h * h - (a - b) * (a - b) ) ); #ifdef HAVE_OPENMP // omp_set_lock(&gridLock[index]); diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping3D_CUDA_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping3D_CUDA_impl.h index 91ec7d9ed7986f530c09d553da10f66e5707c824..da045676ae1f119e73cc4539732b31d5d632ca23 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping3D_CUDA_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping3D_CUDA_impl.h @@ -205,9 +205,9 @@ void tnlFastSweeping< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > :: Real hD = 3.0*h*h - 2.0*(a*a + b*b + c*c - a*b - a*c - b*c); if(hD < 0.0) - tmp = fabsMin(a,fabsMin(b,c)) + Sign(value)*h; + tmp = fabsMin(a,fabsMin(b,c)) + sign(value)*h; else - tmp = (1.0/3.0) * ( a + b + c + Sign(value)*sqrt(hD) ); + tmp = (1.0/3.0) * ( a + b + c + sign(value)*sqrt(hD) ); atomicFabsMin(&cudaDofVector2[Entity.getIndex()],tmp); @@ -230,7 +230,7 @@ bool tnlFastSweeping< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > :: if(abs(cudaDofVector[gid]) < 1.0*h) cudaDofVector2[gid] = 0.5*h;//cudaDofVector[gid]; else - cudaDofVector2[gid] = INT_MAX*Sign(cudaDofVector[gid]); + cudaDofVector2[gid] = INT_MAX*sign(cudaDofVector[gid]); return true; } diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping3D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping3D_impl.h index c5c7c40c39f02dbc4015d13e4c2fde1e4adf2d75..dd5681e6d88b3fa666f210d0fe24f2423ac78b68 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping3D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/fast-sweeping/tnlFastSweeping3D_impl.h @@ -95,7 +95,7 @@ bool tnlFastSweeping< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > :: if (abs(dofVector[i]) < 1.8*h) dofVector2[i]=dofVector[i]; else - dofVector2[i]=INT_MAX*Sign(dofVector[i]); + dofVector2[i]=INT_MAX*sign(dofVector[i]); } return true; @@ -274,9 +274,9 @@ void tnlFastSweeping< tnlGrid< 3,MeshReal, Device, MeshIndex >, Real, Index > :: Real hD = 3.0*h*h - 2.0*(a*a+b*b+c*c-a*b-a*c-b*c); if(hD < 0.0) - tmp = fabsMin(a,fabsMin(b,c)) + Sign(value)*h; + tmp = fabsMin(a,fabsMin(b,c)) + sign(value)*h; else - tmp = (1.0/3.0) * ( a + b + c + Sign(value)*sqrt(hD) ); + tmp = (1.0/3.0) * ( a + b + c + sign(value)*sqrt(hD) ); dofVector2[Entity.getIndex()] = fabsMin(value, tmp); diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel-map/tnlParallelMapSolver2D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel-map/tnlParallelMapSolver2D_impl.h index f0aef873aa3cf01690bfa4b34c0c53f57990db7b..2ca90768e7d325c631f9aa75a56520b3d270b1a6 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel-map/tnlParallelMapSolver2D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel-map/tnlParallelMapSolver2D_impl.h @@ -605,7 +605,7 @@ void tnlParallelMapSolver<2,SchemeHost, SchemeDevice, Device, double, int>::stre if(fabs(this->u0[i-k]) < mesh.template getSpaceStepsProducts< 1, 0 >()+mesh.template getSpaceStepsProducts< 0, 1 >() ) this->work_u[i] = this->u0[i-k]; else - this->work_u[i] = Sign(this->u0[i-k])*MAP_SOLVER_MAX_VALUE; + this->work_u[i] = sign(this->u0[i-k])*MAP_SOLVER_MAX_VALUE; this->map_stretched[i] = this->map[i-k]; } @@ -693,7 +693,7 @@ tnlParallelMapSolver<2,SchemeHost, SchemeDevice, Device, double, int>::runSubgri } - double value = Sign(u[0]) * u.absMax(); + double value = sign(u[0]) * u.absMax(); if(tmp) {} @@ -744,7 +744,7 @@ tnlParallelMapSolver<2,SchemeHost, SchemeDevice, Device, double, int>::runSubgri { if(map[i] == 0.0) { - u[i] = /*Sign(u[l])**/MAP_SOLVER_MAX_VALUE; + u[i] = /*sign(u[l])**/MAP_SOLVER_MAX_VALUE; } } @@ -888,13 +888,13 @@ void tnlParallelMapSolver<2,SchemeHost, SchemeDevice, Device, double, int>::runS if(computeFU) { if(boundaryCondition == 4) - u[l] = u[threadIdx.y * blockDim.x] ;//+ Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.x); + u[l] = u[threadIdx.y * blockDim.x] ;//+ sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.x); else if(boundaryCondition == 2) - u[l] = u[threadIdx.y * blockDim.x + blockDim.x - 1] ;//+ Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(this->n - 1 - threadIdx.x); + u[l] = u[threadIdx.y * blockDim.x + blockDim.x - 1] ;//+ sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(this->n - 1 - threadIdx.x); else if(boundaryCondition == 8) - u[l] = u[threadIdx.x] ;//+ Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.y); + u[l] = u[threadIdx.x] ;//+ sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.y); else if(boundaryCondition == 1) - u[l] = u[(blockDim.y - 1)* blockDim.x + threadIdx.x] ;//+ Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(this->n - 1 - threadIdx.y); + u[l] = u[(blockDim.y - 1)* blockDim.x + threadIdx.x] ;//+ sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(this->n - 1 - threadIdx.y); } } @@ -917,7 +917,7 @@ void tnlParallelMapSolver<2,SchemeHost, SchemeDevice, Device, double, int>::runS if(map_local[l] == 0.0) { - u[l] = /*Sign(u[l])**/MAP_SOLVER_MAX_VALUE; + u[l] = /*sign(u[l])**/MAP_SOLVER_MAX_VALUE; computeFU = false; } __syncthreads(); diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel/tnlParallelEikonalSolver2D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel/tnlParallelEikonalSolver2D_impl.h index ec1eaffcacdc6f204a570989429f88f41bffea0c..171a4046f2108ea655745442382387f00104aca6 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel/tnlParallelEikonalSolver2D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel/tnlParallelEikonalSolver2D_impl.h @@ -892,7 +892,7 @@ tnlParallelEikonalSolver<2,SchemeHost, SchemeDevice, Device, double, int>::runSu //tmp = true; - double value = Sign(u[0]) * u.absMax(); + double value = sign(u[0]) * u.absMax(); if(tmp) {} @@ -1157,7 +1157,7 @@ void tnlParallelEikonalSolver<2,SchemeHost, SchemeDevice, Device, double, int>:: // if(l < 8) absVal[l] = Max(absVal[l],absVal[l+8]); // if(l < 4) absVal[l] = Max(absVal[l],absVal[l+4]); // if(l < 2) absVal[l] = Max(absVal[l],absVal[l+2]); -// if(l < 1) value = Sign(u[0])*Max(absVal[l],absVal[l+1]); +// if(l < 1) value = sign(u[0])*Max(absVal[l],absVal[l+1]); // __syncthreads(); // // if(computeFU) @@ -1165,13 +1165,13 @@ void tnlParallelEikonalSolver<2,SchemeHost, SchemeDevice, Device, double, int>:: if(computeFU) { if(boundaryCondition == 4) - u[l] = u[threadIdx.y * blockDim.x] + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.x) ;//+ 2*Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.x+this->n); + u[l] = u[threadIdx.y * blockDim.x] + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.x) ;//+ 2*sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.x+this->n); else if(boundaryCondition == 2) - u[l] = u[threadIdx.y * blockDim.x + blockDim.x - 1] + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(this->n - 1 - threadIdx.x);//+ 2*Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(blockDim.x - threadIdx.x - 1+this->n); + u[l] = u[threadIdx.y * blockDim.x + blockDim.x - 1] + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(this->n - 1 - threadIdx.x);//+ 2*sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(blockDim.x - threadIdx.x - 1+this->n); else if(boundaryCondition == 8) - u[l] = u[threadIdx.x] + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.y) ;//+ 2*Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.y+this->n); + u[l] = u[threadIdx.x] + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.y) ;//+ 2*sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(threadIdx.y+this->n); else if(boundaryCondition == 1) - u[l] = u[(blockDim.y - 1)* blockDim.x + threadIdx.x] + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(this->n - 1 - threadIdx.y) ;//+ Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(blockDim.y - threadIdx.y - 1 +this->n); + u[l] = u[(blockDim.y - 1)* blockDim.x + threadIdx.x] + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(this->n - 1 - threadIdx.y) ;//+ sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0 >()*(blockDim.y - threadIdx.y - 1 +this->n); } } @@ -1209,7 +1209,7 @@ void tnlParallelEikonalSolver<2,SchemeHost, SchemeDevice, Device, double, int>:: if( time + sharedTau[l] > finalTime ) sharedTau[l] = finalTime - time; -// if( (Sign(u[l]+sharedTau[l]*fu) != Sign(u[l])) && fu != 0.0 && fu != -0.0) +// if( (sign(u[l]+sharedTau[l]*fu) != sign(u[l])) && fu != 0.0 && fu != -0.0) // { // printf("orig: %10f", sharedTau[l]); // sharedTau[l]=abs(u[l]/(1.1*fu)) ; diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel/tnlParallelEikonalSolver3D_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel/tnlParallelEikonalSolver3D_impl.h index 81e1c2e6457e9a70d9b876ae7212fbc87790f853..33e758a1be9cccf90c04e8c6fbe2517e20b3167a 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel/tnlParallelEikonalSolver3D_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi-parallel/tnlParallelEikonalSolver3D_impl.h @@ -868,7 +868,7 @@ tnlParallelEikonalSolver<3,SchemeHost, SchemeDevice, Device, double, int>::runSu //tmp = true; - double value = Sign(u[0]) * u.absMax(); + double value = sign(u[0]) * u.absMax(); if(tmp) {} @@ -1142,7 +1142,7 @@ void tnlParallelEikonalSolver<3,SchemeHost, SchemeDevice, Device, double, int>:: // if(l < 8) absVal[l] = Max(absVal[l],absVal[l+8]); // if(l < 4) absVal[l] = Max(absVal[l],absVal[l+4]); // if(l < 2) absVal[l] = Max(absVal[l],absVal[l+2]); -// if(l < 1) value = Sign(u[0])*Max(absVal[l],absVal[l+1]); +// if(l < 1) value = sign(u[0])*Max(absVal[l],absVal[l+1]); // __syncthreads(); // // if(computeFU) @@ -1154,37 +1154,37 @@ void tnlParallelEikonalSolver<3,SchemeHost, SchemeDevice, Device, double, int>:: { Ent.setCoordinates(Containers::StaticVector<3,int>(0,j,k)); Ent.refresh(); - u[l] = u[Ent.getIndex()];// + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(threadIdx.x) ;//+ 2*Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(threadIdx.x+this->n); + u[l] = u[Ent.getIndex()];// + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(threadIdx.x) ;//+ 2*sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(threadIdx.x+this->n); } else if(boundaryCondition == 2) { Ent.setCoordinates(Containers::StaticVector<3,int>(blockDim.x - 1,j,k)); Ent.refresh(); - u[l] = u[Ent.getIndex()];// + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(this->n - 1 - threadIdx.x);//+ 2*Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(blockDim.x - threadIdx.x - 1+this->n); + u[l] = u[Ent.getIndex()];// + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(this->n - 1 - threadIdx.x);//+ 2*sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(blockDim.x - threadIdx.x - 1+this->n); } else if(boundaryCondition == 8) { Ent.setCoordinates(Containers::StaticVector<3,int>(i,0,k)); Ent.refresh(); - u[l] = u[Ent.getIndex()];// + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 0, 1, 0 >()*(threadIdx.y) ;//+ 2*Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(threadIdx.y+this->n); + u[l] = u[Ent.getIndex()];// + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 0, 1, 0 >()*(threadIdx.y) ;//+ 2*sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(threadIdx.y+this->n); } else if(boundaryCondition == 1) { Ent.setCoordinates(Containers::StaticVector<3,int>(i,blockDim.y - 1,k)); Ent.refresh(); - u[l] = u[Ent.getIndex()];// + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 0, 1, 0 >()*(this->n - 1 - threadIdx.y) ;//+ Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(blockDim.y - threadIdx.y - 1 +this->n); + u[l] = u[Ent.getIndex()];// + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 0, 1, 0 >()*(this->n - 1 - threadIdx.y) ;//+ sign(u[0])*this->subMesh.template getSpaceStepsProducts< 1, 0, 0 >()*(blockDim.y - threadIdx.y - 1 +this->n); } else if(boundaryCondition == 32) { Ent.setCoordinates(Containers::StaticVector<3,int>(i,j,0)); Ent.refresh(); - u[l] = u[Ent.getIndex()];// + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 0, 0, 1 >()*(threadIdx.z); + u[l] = u[Ent.getIndex()];// + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 0, 0, 1 >()*(threadIdx.z); } else if(boundaryCondition == 16) { Ent.setCoordinates(Containers::StaticVector<3,int>(i,j,blockDim.z - 1)); Ent.refresh(); - u[l] = u[Ent.getIndex()];// + Sign(u[0])*this->subMesh.template getSpaceStepsProducts< 0, 0, 1 >()*(this->n - 1 - threadIdx.z) ; + u[l] = u[Ent.getIndex()];// + sign(u[0])*this->subMesh.template getSpaceStepsProducts< 0, 0, 1 >()*(this->n - 1 - threadIdx.z) ; } } } diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/tnlDirectEikonalMethodsBase_impl.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/tnlDirectEikonalMethodsBase_impl.h index 11d6a564713778864dbba996ab5cc68bc678df53..c2983fac2c12e1b7791bd86973a712a5fcc6c948 100644 --- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/tnlDirectEikonalMethodsBase_impl.h +++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/tnlDirectEikonalMethodsBase_impl.h @@ -147,22 +147,22 @@ updateCell( MeshFunctionType& u, fabs( b ) == tnlTypeInfo< Real >::getMaxValue() || fabs( a - b ) >= h ) { - tmp = ArgAbsMin( a, b ) + Sign( value ) * h; + tmp = ArgAbsMin( a, b ) + sign( value ) * h; /* std::cerr << "a = " << a << " b = " << b << " h = " << h - << " ArgAbsMin( a, b ) = " << ArgAbsMin( a, b ) << " Sign( value ) = " << Sign( value ) - << " Sign( value ) * h = " << Sign( value ) * h - << " ArgAbsMin( a, b ) + Sign( value ) * h = " << ArgAbsMin( a, b ) + Sign( value ) * h + << " ArgAbsMin( a, b ) = " << ArgAbsMin( a, b ) << " sign( value ) = " << sign( value ) + << " sign( value ) * h = " << sign( value ) * h + << " ArgAbsMin( a, b ) + sign( value ) * h = " << ArgAbsMin( a, b ) + sign( value ) * h << " tmp = " << tmp << std::endl; - tmp = ArgAbsMin( a, b ) + Sign( value ) * h; - tmp = ArgAbsMin( a, b ) + Sign( value ) * h; - tmp = ArgAbsMin( a, b ) + Sign( value ) * h; - res = ArgAbsMin( a, b ) + Sign( value ) * h; + tmp = ArgAbsMin( a, b ) + sign( value ) * h; + tmp = ArgAbsMin( a, b ) + sign( value ) * h; + tmp = ArgAbsMin( a, b ) + sign( value ) * h; + res = ArgAbsMin( a, b ) + sign( value ) * h; std::cerr << " tmp = " << tmp << std::endl; std::cerr << " res = " << res << std::endl;*/ } else - tmp = 0.5 * ( a + b + Sign( value ) * sqrt( 2.0 * h * h - ( a - b ) * ( a - b ) ) ); + tmp = 0.5 * ( a + b + sign( value ) * sqrt( 2.0 * h * h - ( a - b ) * ( a - b ) ) ); u[ cell.getIndex() ] = ArgAbsMin( value, tmp ); //std::cerr << ArgAbsMin( value, tmp ) << " "; diff --git a/src/TNL/Functions/Analytic/Blob.h b/src/TNL/Functions/Analytic/Blob.h index 56c6e22b7eab001f03b45137b23ba6f2582d4798..c436254d6af11f4563a2eb49db8f33149f4bdd8e 100644 --- a/src/TNL/Functions/Analytic/Blob.h +++ b/src/TNL/Functions/Analytic/Blob.h @@ -1,5 +1,5 @@ /*************************************************************************** - ExpBump.h - description + Blob.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber diff --git a/src/TNL/Functions/Analytic/Blob_impl.h b/src/TNL/Functions/Analytic/Blob_impl.h index c6d969d38527cfab69858a39f3d2fac3b340287e..00328818b266d1e9c40674e3701c86116391a9c4 100644 --- a/src/TNL/Functions/Analytic/Blob_impl.h +++ b/src/TNL/Functions/Analytic/Blob_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - ExpBump_impl.h - description + Blob_impl.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber diff --git a/src/TNL/Functions/Analytic/CMakeLists.txt b/src/TNL/Functions/Analytic/CMakeLists.txt index 01c91a1542b9b1cfdbb1bae7c2e37c4ce44fdb91..744345453d919ac82f2ef2a39186774f90c1b652 100755 --- a/src/TNL/Functions/Analytic/CMakeLists.txt +++ b/src/TNL/Functions/Analytic/CMakeLists.txt @@ -7,13 +7,21 @@ SET( headers Blob.h ExpBump.h ExpBump_impl.h Flowerpot.h - Flowerpot_impl.h + Flowerpot_impl.h + Paraboloid.h + Paraboloid_impl.h + ParaboloidSDF.h + ParaboloidSDF_impl.h PseudoSquare.h PseudoSquare_impl.h SinBumps.h SinBumps_impl.h + SinBumpsSDF.h + SinBumpsSDF_impl.h SinWave.h SinWave_impl.h + SinWaveSDF.h + SinWaveSDF_impl.h Twins.h Twins_impl.h ) diff --git a/src/functions/tnlParaboloid.h b/src/TNL/Functions/Analytic/Paraboloid.h similarity index 74% rename from src/functions/tnlParaboloid.h rename to src/TNL/Functions/Analytic/Paraboloid.h index 83c221f91a997e5e13723115cfea771cb6b631a3..0d514345e4b5378da09de32c17dafe5f4ee3dbca 100644 --- a/src/functions/tnlParaboloid.h +++ b/src/TNL/Functions/Analytic/Paraboloid.h @@ -1,19 +1,12 @@ /*************************************************************************** - tnlParaboloid.h - description + Paraboloid.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ #pragma once @@ -21,13 +14,17 @@ #include <TNL/Containers/StaticVector.h> #include <TNL/Functions/Domain.h> +namespace TNL { + namespace Functions { + namespace Analytic { + template< int dimensions, typename Real = double > -class tnlParaboloidBase : public Functions::Domain< dimensions, SpaceDomain > +class ParaboloidBase : public Functions::Domain< dimensions, SpaceDomain > { public: - tnlParaboloidBase(); + ParaboloidBase(); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); @@ -58,12 +55,12 @@ class tnlParaboloidBase : public Functions::Domain< dimensions, SpaceDomain > }; template< int Dimensions, typename Real > -class tnlParaboloid +class Paraboloid { }; template< typename Real > -class tnlParaboloid< 1, Real > : public tnlParaboloidBase< 1, Real > +class Paraboloid< 1, Real > : public ParaboloidBase< 1, Real > { public: @@ -90,7 +87,7 @@ class tnlParaboloid< 1, Real > : public tnlParaboloidBase< 1, Real > }; template< typename Real > -class tnlParaboloid< 2, Real > : public tnlParaboloidBase< 2, Real > +class Paraboloid< 2, Real > : public ParaboloidBase< 2, Real > { public: @@ -117,7 +114,7 @@ class tnlParaboloid< 2, Real > : public tnlParaboloidBase< 2, Real > }; template< typename Real > -class tnlParaboloid< 3, Real > : public tnlParaboloidBase< 3, Real > +class Paraboloid< 3, Real > : public ParaboloidBase< 3, Real > { public: @@ -147,12 +144,16 @@ class tnlParaboloid< 3, Real > : public tnlParaboloidBase< 3, Real > template< int Dimensions, typename Real > -ostream& operator << ( ostream& str, const tnlParaboloid< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const Paraboloid< Dimensions, Real >& f ) { str << "SDF Paraboloid function: amplitude = " << f.getCoefficient() << " offset = " << f.getOffset(); return str; } + + } // namespace Analytic + } // namespace Functions +} // namespace TNL -#include <functions/tnlParaboloid_impl.h> +#include <TNL/Functions/Analytic/Paraboloid_impl.h> diff --git a/src/functions/tnlParaboloidSDF.h b/src/TNL/Functions/Analytic/ParaboloidSDF.h similarity index 73% rename from src/functions/tnlParaboloidSDF.h rename to src/TNL/Functions/Analytic/ParaboloidSDF.h index 8dfe0980eacea0c5aa92bdedc0ec28fb28acdaaf..c13e8869c189f3aa298385d72a026c50dfabee0b 100644 --- a/src/functions/tnlParaboloidSDF.h +++ b/src/TNL/Functions/Analytic/ParaboloidSDF.h @@ -1,19 +1,12 @@ /*************************************************************************** - tnlParaboloidSDF.h - description + ParaboloidSDF.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ #pragma once @@ -21,13 +14,17 @@ #include <TNL/Containers/StaticVector.h> #include <TNL/Functions/Domain.h> +namespace TNL { + namespace Functions { + namespace Analytic { + template< int dimensions, typename Real = double > -class tnlParaboloidSDFBase : public Functions::Domain< dimensions, SpaceDomain > +class ParaboloidSDFBase : public Functions::Domain< dimensions, SpaceDomain > { public: - tnlParaboloidSDFBase(); + ParaboloidSDFBase(); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); @@ -58,12 +55,12 @@ class tnlParaboloidSDFBase : public Functions::Domain< dimensions, SpaceDomain > }; template< int Dimensions, typename Real > -class tnlParaboloidSDF +class ParaboloidSDF { }; template< typename Real > -class tnlParaboloidSDF< 1, Real > : public tnlParaboloidSDFBase< 1, Real > +class ParaboloidSDF< 1, Real > : public ParaboloidSDFBase< 1, Real > { public: @@ -90,7 +87,7 @@ class tnlParaboloidSDF< 1, Real > : public tnlParaboloidSDFBase< 1, Real > }; template< typename Real > -class tnlParaboloidSDF< 2, Real > : public tnlParaboloidSDFBase< 2, Real > +class ParaboloidSDF< 2, Real > : public ParaboloidSDFBase< 2, Real > { public: @@ -117,7 +114,7 @@ class tnlParaboloidSDF< 2, Real > : public tnlParaboloidSDFBase< 2, Real > }; template< typename Real > -class tnlParaboloidSDF< 3, Real > : public tnlParaboloidSDFBase< 3, Real > +class ParaboloidSDF< 3, Real > : public ParaboloidSDFBase< 3, Real > { public: @@ -147,12 +144,17 @@ class tnlParaboloidSDF< 3, Real > : public tnlParaboloidSDFBase< 3, Real > template< int Dimensions, typename Real > -std::ostream& operator << ( std::ostream& str, const tnlParaboloidSDF< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const ParaboloidSDF< Dimensions, Real >& f ) { str << "SDF Paraboloid SDF function: amplitude = " << f.getCoefficient() << " offset = " << f.getOffset(); return str; } + + } // namespace Analytic + } // namespace Functions +} // namespace TNL + -#include <functions/tnlParaboloidSDF_impl.h> +#include <TNL/Functions/Analytic/ParaboloidSDF_impl.h> diff --git a/src/functions/tnlParaboloidSDF_impl.h b/src/TNL/Functions/Analytic/ParaboloidSDF_impl.h similarity index 60% rename from src/functions/tnlParaboloidSDF_impl.h rename to src/TNL/Functions/Analytic/ParaboloidSDF_impl.h index 0d23e60a1fa78ab677529e763ba95186be857fd0..d6ab2c04f3f90dfe648e09396515953836c584c9 100644 --- a/src/functions/tnlParaboloidSDF_impl.h +++ b/src/TNL/Functions/Analytic/ParaboloidSDF_impl.h @@ -1,33 +1,30 @@ /*************************************************************************** - tnlParaboloidSDFSDF_impl.h - description + ParaboloidSDFSDF_impl.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ #pragma once -#include <functions/tnlParaboloidSDF.h> +#include <TNL/Functions/Analytic/ParaboloidSDF.h> + +namespace TNL { + namespace Functions { + namespace Analytic { template< int dimensions, typename Real > -tnlParaboloidSDFBase< dimensions, Real >::tnlParaboloidSDFBase() +ParaboloidSDFBase< dimensions, Real >::ParaboloidSDFBase() : xCentre( 0 ), yCentre( 0 ), zCentre( 0 ), coefficient( 1 ), radius ( 0 ) { } template< int dimensions, typename Real > -bool tnlParaboloidSDFBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, +bool ParaboloidSDFBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix) { this->xCentre = parameters.getParameter< double >( "x-centre" ); @@ -40,60 +37,60 @@ bool tnlParaboloidSDFBase< dimensions, Real >::setup( const Config::ParameterCon } template< int dimensions, typename Real > -void tnlParaboloidSDFBase< dimensions, Real >::setXCentre( const Real& xCentre ) +void ParaboloidSDFBase< dimensions, Real >::setXCentre( const Real& xCentre ) { this->xCentre = xCentre; } template< int dimensions, typename Real > -Real tnlParaboloidSDFBase< dimensions, Real >::getXCentre() const +Real ParaboloidSDFBase< dimensions, Real >::getXCentre() const { return this->xCentre; } template< int dimensions, typename Real > -void tnlParaboloidSDFBase< dimensions, Real >::setYCentre( const Real& yCentre ) +void ParaboloidSDFBase< dimensions, Real >::setYCentre( const Real& yCentre ) { this->yCentre = yCentre; } template< int dimensions, typename Real > -Real tnlParaboloidSDFBase< dimensions, Real >::getYCentre() const +Real ParaboloidSDFBase< dimensions, Real >::getYCentre() const { return this->yCentre; } template< int dimensions, typename Real > -void tnlParaboloidSDFBase< dimensions, Real >::setZCentre( const Real& zCentre ) +void ParaboloidSDFBase< dimensions, Real >::setZCentre( const Real& zCentre ) { this->zCentre = zCentre; } template< int dimensions, typename Real > -Real tnlParaboloidSDFBase< dimensions, Real >::getZCentre() const +Real ParaboloidSDFBase< dimensions, Real >::getZCentre() const { return this->zCentre; } template< int dimensions, typename Real > -void tnlParaboloidSDFBase< dimensions, Real >::setCoefficient( const Real& amplitude ) +void ParaboloidSDFBase< dimensions, Real >::setCoefficient( const Real& amplitude ) { this->coefficient = coefficient; } template< int dimensions, typename Real > -Real tnlParaboloidSDFBase< dimensions, Real >::getCoefficient() const +Real ParaboloidSDFBase< dimensions, Real >::getCoefficient() const { return this->coefficient; } template< int dimensions, typename Real > -void tnlParaboloidSDFBase< dimensions, Real >::setOffset( const Real& offset ) +void ParaboloidSDFBase< dimensions, Real >::setOffset( const Real& offset ) { this->radius = offset; } template< int dimensions, typename Real > -Real tnlParaboloidSDFBase< dimensions, Real >::getOffset() const +Real ParaboloidSDFBase< dimensions, Real >::getOffset() const { return this->radius; } @@ -104,7 +101,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlParaboloidSDF< 1, Real >:: +ParaboloidSDF< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -112,7 +109,7 @@ getPartialDerivative( const VertexType& v, if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) - return sqrt( ( x - this -> xCentre ) * ( x - this -> xCentre ) ) - this->radius; + return ::sqrt( ( x - this -> xCentre ) * ( x - this -> xCentre ) ) - this->radius; if( XDiffOrder == 1 ) return 1.0; return 0.0; @@ -125,7 +122,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlParaboloidSDF< 2, Real >:: +ParaboloidSDF< 2, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -133,7 +130,7 @@ getPartialDerivative( const VertexType& v, const Real& y = v.y(); if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) { - return sqrt ( ( x - this -> xCentre ) * ( x - this -> xCentre ) + return ::sqrt ( ( x - this -> xCentre ) * ( x - this -> xCentre ) + ( y - this -> yCentre ) * ( y - this -> yCentre ) ) - this->radius; } return 0.0; @@ -145,7 +142,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlParaboloidSDF< 3, Real >:: +ParaboloidSDF< 3, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -154,9 +151,13 @@ getPartialDerivative( const VertexType& v, const Real& z = v.z(); if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) { - return sqrt( ( x - this -> xCentre ) * ( x - this -> xCentre ) + return ::sqrt( ( x - this -> xCentre ) * ( x - this -> xCentre ) + ( y - this -> yCentre ) * ( y - this -> yCentre ) + ( z - this -> zCentre ) * ( z - this -> zCentre ) ) - this->radius; } return 0.0; } + + } //namespace Analytic + } // namepsace Functions +} // namespace TNL diff --git a/src/functions/tnlParaboloid_impl.h b/src/TNL/Functions/Analytic/Paraboloid_impl.h similarity index 72% rename from src/functions/tnlParaboloid_impl.h rename to src/TNL/Functions/Analytic/Paraboloid_impl.h index 20a56b9928f928d55321a0150f10c37ff36274bd..a93720de595dea72615c55f9bed06a125be1da49 100644 --- a/src/functions/tnlParaboloid_impl.h +++ b/src/TNL/Functions/Analytic/Paraboloid_impl.h @@ -1,33 +1,30 @@ /*************************************************************************** - tnlParaboloid_impl.h - description + Paraboloid_impl.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ #pragma once -#include <functions/tnlParaboloid.h> +#include <TNL/Functions/Analytic/Paraboloid.h> + +namespace TNL { + namespace Functions { + namespace Analytic { template< int dimensions, typename Real > -tnlParaboloidBase< dimensions, Real >::tnlParaboloidBase() +ParaboloidBase< dimensions, Real >::ParaboloidBase() : xCentre( 0 ), yCentre( 0 ), zCentre( 0 ), coefficient( 1 ), radius ( 0 ) { } template< int dimensions, typename Real > -bool tnlParaboloidBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, +bool ParaboloidBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix) { this->xCentre = parameters.getParameter< double >( "x-centre" ); @@ -40,60 +37,60 @@ bool tnlParaboloidBase< dimensions, Real >::setup( const Config::ParameterContai } template< int dimensions, typename Real > -void tnlParaboloidBase< dimensions, Real >::setXCentre( const Real& xCentre ) +void ParaboloidBase< dimensions, Real >::setXCentre( const Real& xCentre ) { this->xCentre = xCentre; } template< int dimensions, typename Real > -Real tnlParaboloidBase< dimensions, Real >::getXCentre() const +Real ParaboloidBase< dimensions, Real >::getXCentre() const { return this->xCentre; } template< int dimensions, typename Real > -void tnlParaboloidBase< dimensions, Real >::setYCentre( const Real& yCentre ) +void ParaboloidBase< dimensions, Real >::setYCentre( const Real& yCentre ) { this->yCentre = yCentre; } template< int dimensions, typename Real > -Real tnlParaboloidBase< dimensions, Real >::getYCentre() const +Real ParaboloidBase< dimensions, Real >::getYCentre() const { return this->yCentre; } template< int dimensions, typename Real > -void tnlParaboloidBase< dimensions, Real >::setZCentre( const Real& zCentre ) +void ParaboloidBase< dimensions, Real >::setZCentre( const Real& zCentre ) { this->zCentre = zCentre; } template< int dimensions, typename Real > -Real tnlParaboloidBase< dimensions, Real >::getZCentre() const +Real ParaboloidBase< dimensions, Real >::getZCentre() const { return this->zCentre; } template< int dimensions, typename Real > -void tnlParaboloidBase< dimensions, Real >::setCoefficient( const Real& amplitude ) +void ParaboloidBase< dimensions, Real >::setCoefficient( const Real& amplitude ) { this->coefficient = coefficient; } template< int dimensions, typename Real > -Real tnlParaboloidBase< dimensions, Real >::getCoefficient() const +Real ParaboloidBase< dimensions, Real >::getCoefficient() const { return this->coefficient; } template< int dimensions, typename Real > -void tnlParaboloidBase< dimensions, Real >::setOffset( const Real& offset ) +void ParaboloidBase< dimensions, Real >::setOffset( const Real& offset ) { this->radius = offset; } template< int dimensions, typename Real > -Real tnlParaboloidBase< dimensions, Real >::getOffset() const +Real ParaboloidBase< dimensions, Real >::getOffset() const { return this->radius; } @@ -104,7 +101,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlParaboloid< 1, Real >:: +Paraboloid< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -125,7 +122,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlParaboloid< 2, Real >:: +Paraboloid< 2, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -155,7 +152,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlParaboloid< 3, Real >:: +Paraboloid< 3, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -182,3 +179,7 @@ getPartialDerivative( const VertexType& v, return 2.0 * this->coefficient; return 0.0; } + + } // namespace Analytic + } // namedspace Functions +} // namespace TNL diff --git a/src/TNL/Functions/Analytic/PseudoSquare.h b/src/TNL/Functions/Analytic/PseudoSquare.h index 26d3086f23b1fa855acec067dc0b72a5ba878e1e..7f58906597338b78588cdf6e40940bd6b3b87d0b 100644 --- a/src/TNL/Functions/Analytic/PseudoSquare.h +++ b/src/TNL/Functions/Analytic/PseudoSquare.h @@ -1,5 +1,5 @@ /*************************************************************************** - ExpBump.h - description + PseudoSquare.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber diff --git a/src/TNL/Functions/Analytic/PseudoSquare_impl.h b/src/TNL/Functions/Analytic/PseudoSquare_impl.h index 378e11ac11c720b573a46d922b4d66cdb63ee66b..ab81b85f0b3144f4cb8507f8a83cdfd1dbedf097 100644 --- a/src/TNL/Functions/Analytic/PseudoSquare_impl.h +++ b/src/TNL/Functions/Analytic/PseudoSquare_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - ExpBump_impl.h - description + PseudoSquare_impl.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber diff --git a/src/functions/tnlSDFSchemeTest.h b/src/TNL/Functions/Analytic/SDFSchemeTest.h similarity index 61% rename from src/functions/tnlSDFSchemeTest.h rename to src/TNL/Functions/Analytic/SDFSchemeTest.h index fce138f8aed2bdc593c20db256a4b04a5aebefa6..d3720fcb12f2a70c0593a1eafe7eeb8d00a58b0c 100644 --- a/src/functions/tnlSDFSchemeTest.h +++ b/src/TNL/Functions/Analytic/SDFSchemeTest.h @@ -1,39 +1,35 @@ /*************************************************************************** - tnlSinWaveFunction.h - description + SDFSchemeTest.h - description ------------------- begin : Nov 19, 2013 copyright : (C) 2013 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ -#ifndef TNLSDFSCHEMETEST_H_ -#define TNLSDFSCHEMETEST_H_ +#pragma once #include <TNL/Config/ParameterContainer.h> #include <TNL/Containers/StaticVector.h> #include <functions/tnlSDFSinWaveFunction.h> #include <functions/tnlSDFSinWaveFunctionSDF.h> -#include <functions/tnlSDFSinBumpsFunction.h> -#include <functions/tnlSDFSinBumpsFunctionSDF.h> +#include <functions/tnlSDFSinBumps.h> +#include <functions/tnlSDFSinBumpsSDF.h> #include <functions/tnlExpBumpFunction.h> #include <functions/tnlSDFParaboloid.h> #include <functions/tnlSDFParaboloidSDF.h> +namespace TNL { + namespace Functions { + namespace Analytic { + template< typename function, typename Real = double > -class tnlSDFSchemeTestBase +class SDFSchemeTestBase { public: - tnlSDFSchemeTestBase(); + SDFSchemeTestBase(); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); @@ -43,13 +39,13 @@ class tnlSDFSchemeTestBase }; template< typename function, int Dimensions, typename Real > -class tnlSDFSchemeTest +class SDFSchemeTest { }; template< typename function, int Dimensions, typename Real > -class tnlSDFSchemeTest< function, 1, Real > : public tnlSDFSchemeTestBase< function, Real > +class SDFSchemeTest< function, 1, Real > : public SDFSchemeTestBase< function, Real > { public: @@ -69,7 +65,7 @@ class tnlSDFSchemeTest< function, 1, Real > : public tnlSDFSchemeTestBase< funct }; template< typename function, int Dimensions, typename Real > -class tnlSDFSchemeTest< function, 2, Real > : public tnlSDFSchemeTestBase< function, Real > +class SDFSchemeTest< function, 2, Real > : public SDFSchemeTestBase< function, Real > { public: @@ -88,7 +84,7 @@ class tnlSDFSchemeTest< function, 2, Real > : public tnlSDFSchemeTestBase< funct }; template< typename function, int Dimensions, typename Real > -class tnlSDFSchemeTest< function, 3, Real > : public tnlSDFSchemeTestBase< function, Real > +class SDFSchemeTest< function, 3, Real > : public SDFSchemeTestBase< function, Real > { public: @@ -105,6 +101,8 @@ class tnlSDFSchemeTest< function, 3, Real > : public tnlSDFSchemeTestBase< funct }; -#include <functions/tnlSDFSchemeTest_impl.h> + } // namespace Analytic + } // namespace Functions +} // namespace TNL -#endif /* TNLSDFSCHEMETEST_H_ */ +#include <functions/SDFSchemeTest_impl.h> diff --git a/src/functions/tnlSDFSchemeTest_impl.h b/src/TNL/Functions/Analytic/SDFSchemeTest_impl.h similarity index 56% rename from src/functions/tnlSDFSchemeTest_impl.h rename to src/TNL/Functions/Analytic/SDFSchemeTest_impl.h index dddc59787994e5391f9fd458209c233287fb4ce3..c2be9ef3433847562134f29aff2680d410378e3b 100644 --- a/src/functions/tnlSDFSchemeTest_impl.h +++ b/src/TNL/Functions/Analytic/SDFSchemeTest_impl.h @@ -1,32 +1,28 @@ /*************************************************************************** - tnlSDFSchemeTest_impl.h - description + SDFSchemeTest_impl.h - description ------------------- begin : Nov 19, 2013 copyright : (C) 2013 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ -#ifndef TNLSDFSCHEMETEST_IMPL_H_ -#define TNLSDFSCHEMETEST_IMPL_H_ +#pragma once -#include <functions/tnlSDFSchemeTest.h> +#include <functions/SDFSchemeTest.h> + +namespace TNL { + namespace Functions { + namespace Analytic { template< typename function, typename Real > -tnlSDFSchemeTestBase< function, Real >::tnlSDFSchemeTestBase() +SDFSchemeTestBase< function, Real >::SDFSchemeTestBase() { } template< typename function, typename Real > -bool tnlSDFSchemeTestBase< function, Real >::v( const Config::ParameterContainer& parameters, +bool SDFSchemeTestBase< function, Real >::v( const Config::ParameterContainer& parameters, const String& prefix = "" ) { f.init(parameters); @@ -38,42 +34,45 @@ bool tnlSDFSchemeTestBase< function, Real >::v( const Config::ParameterContainer template< typename function, int Dimensions, typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > -Real tnlSDFSchemeTest< function, 1, Real >::getValue( const Vertex& v, +Real SDFSchemeTest< function, 1, Real >::getValue( const Vertex& v, const Real& time = 0.0 ) const { if( YDiffOrder != 0 || ZDiffOrder != 0 || XDiffOrder != 0 ) return 0.0; - return Sign( this->f.getValue<0,0,0>(v))* + return sign( this->f.getValue<0,0,0>(v))* ( 1-sqrt(this->f.getValue<1,0,0>(v)*this->f.getValue<1,0,0>(v)) ); } template< typename function, int Dimensions, typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > -Real tnlSDFSchemeTest< function, 2, Real >::getValue( const Vertex& v, +Real SDFSchemeTest< function, 2, Real >::getValue( const Vertex& v, const Real& time = 0.0 ) const { if( YDiffOrder != 0 || ZDiffOrder != 0 || XDiffOrder != 0 ) return 0.0; - return Sign( this->f.getValue<0,0,0>(v))* + return sign( this->f.getValue<0,0,0>(v))* ( 1-sqrt(this->f.getValue<1,0,0>(v)*this->f.getValue<1,0,0>(v) + this->f.getValue<0,1,0>(v)*this->f.getValue<0,1,0>(v)) ); } template< typename function, int Dimensions, typename Real > template< int XDiffOrder, int YDiffOrder, int ZDiffOrder > -Real tnlSDFSchemeTest< function, 3, Real >::getValue( const Vertex& v, +Real SDFSchemeTest< function, 3, Real >::getValue( const Vertex& v, const Real& time = 0.0 ) const { if( YDiffOrder != 0 || ZDiffOrder != 0 || XDiffOrder != 0 ) return 0.0; - return Sign( this->f.getValue<0,0,0>(v))* + return sign( this->f.getValue<0,0,0>(v))* ( 1.0-sqrt(this->f.getValue<1,0,0>(v)*this->f.getValue<1,0,0>(v) + this->f.getValue<0,1,0>(v)*this->f.getValue<0,1,0>(v) + this->f.getValue<0,0,1>(v)*this->f.getValue<0,0,1>(v)) ); } -#endif /* TNLSDFSCHEMETEST_IMPL_H_ */ + } // namespace Analytic + } // namespace Functions +} // namespace TNL + diff --git a/src/functions/tnlSinBumpsFunctionSDF.h b/src/TNL/Functions/Analytic/SinBumpsSDF.h similarity index 73% rename from src/functions/tnlSinBumpsFunctionSDF.h rename to src/TNL/Functions/Analytic/SinBumpsSDF.h index 6d1ac5192d6737690b05b80ad9d6c849fe3de55c..e402872d27958478e5adca8a0d17e6f24e12fa2e 100644 --- a/src/functions/tnlSinBumpsFunctionSDF.h +++ b/src/TNL/Functions/Analytic/SinBumpsSDF.h @@ -1,19 +1,12 @@ /*************************************************************************** - tnlSinBumpsFunctionSDFSDF.h - description + SinBumpsSDF.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ #pragma once @@ -27,7 +20,7 @@ namespace TNL { template< typename Vertex > -class tnlSinBumpsFunctionSDFBase : public Domain< Vertex::size, SpaceDomain > +class SinBumpsSDFBase : public Domain< Vertex::size, SpaceDomain > { public: @@ -59,12 +52,12 @@ class tnlSinBumpsFunctionSDFBase : public Domain< Vertex::size, SpaceDomain > }; template< int Dimensions, typename Real > -class tnlSinBumpsFunctionSDF +class SinBumpsSDF { }; template< typename Real > -class tnlSinBumpsFunctionSDF< 1, Real > : public tnlSinBumpsFunctionSDFBase< Containers::StaticVector< 1, Real > > +class SinBumpsSDF< 1, Real > : public SinBumpsSDFBase< Containers::StaticVector< 1, Real > > { public: @@ -72,7 +65,7 @@ class tnlSinBumpsFunctionSDF< 1, Real > : public tnlSinBumpsFunctionSDFBase< Co typedef Containers::StaticVector< 1, RealType > VertexType; - tnlSinBumpsFunctionSDF(); + SinBumpsSDF(); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); @@ -97,7 +90,7 @@ class tnlSinBumpsFunctionSDF< 1, Real > : public tnlSinBumpsFunctionSDFBase< Co }; template< typename Real > -class tnlSinBumpsFunctionSDF< 2, Real > : public tnlSinBumpsFunctionSDFBase< Containers::StaticVector< 2, Real > > +class SinBumpsSDF< 2, Real > : public SinBumpsSDFBase< Containers::StaticVector< 2, Real > > { public: @@ -105,7 +98,7 @@ class tnlSinBumpsFunctionSDF< 2, Real > : public tnlSinBumpsFunctionSDFBase< Con typedef Containers::StaticVector< 2, RealType > VertexType; - tnlSinBumpsFunctionSDF(); + SinBumpsSDF(); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); @@ -130,14 +123,14 @@ class tnlSinBumpsFunctionSDF< 2, Real > : public tnlSinBumpsFunctionSDFBase< Con }; template< typename Real > -class tnlSinBumpsFunctionSDF< 3, Real > : public tnlSinBumpsFunctionSDFBase< Containers::StaticVector< 3, Real > > +class SinBumpsSDF< 3, Real > : public SinBumpsSDFBase< Containers::StaticVector< 3, Real > > { public: typedef Real RealType; typedef Containers::StaticVector< 3, RealType > VertexType; - tnlSinBumpsFunctionSDF(); + SinBumpsSDF(); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); @@ -163,7 +156,7 @@ class tnlSinBumpsFunctionSDF< 3, Real > : public tnlSinBumpsFunctionSDFBase< Con template< int Dimensions, typename Real > -std::ostream& operator << ( std::ostream& str, const tnlSinBumpsFunctionSDF< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const SinBumpsSDF< Dimensions, Real >& f ) { str << "SDF Sin Bumps SDF. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength() @@ -176,4 +169,4 @@ std::ostream& operator << ( std::ostream& str, const tnlSinBumpsFunctionSDF< Dim } // namespace Functions } // namespace TNL -#include <functions/tnlSinBumpsFunctionSDF_impl.h> +#include <TNL/Functions/Analytic/SinBumpsSDF_impl.h> diff --git a/src/functions/tnlSinBumpsFunctionSDF_impl.h b/src/TNL/Functions/Analytic/SinBumpsSDF_impl.h similarity index 64% rename from src/functions/tnlSinBumpsFunctionSDF_impl.h rename to src/TNL/Functions/Analytic/SinBumpsSDF_impl.h index 25193165ba0e0b63eaec4a5cfa7c941a1f5c14e8..6b38ae51238dfdca01404bcbb4002a663f409211 100644 --- a/src/functions/tnlSinBumpsFunctionSDF_impl.h +++ b/src/TNL/Functions/Analytic/SinBumpsSDF_impl.h @@ -1,60 +1,53 @@ /*************************************************************************** - tnlSinBumpsFunctionSDFSDF_impl.h - description + SinBumpsSDFSDF_impl.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ #pragma once -#include <functions/tnlSinBumpsFunctionSDF.h> +#include <TNL/Functions/Analytic/SinBumpsSDF.h> namespace TNL { namespace Functions { namespace Analytic { template< typename Vertex > -void tnlSinBumpsFunctionSDFBase< Vertex >::setWaveLength( const Vertex& waveLength ) +void SinBumpsSDFBase< Vertex >::setWaveLength( const Vertex& waveLength ) { this->waveLength = waveLength; } template< typename Vertex > -const Vertex& tnlSinBumpsFunctionSDFBase< Vertex >::getWaveLength() const +const Vertex& SinBumpsSDFBase< Vertex >::getWaveLength() const { return this->waveLength; } template< typename Vertex > -void tnlSinBumpsFunctionSDFBase< Vertex >::setAmplitude( const typename Vertex::RealType& amplitude ) +void SinBumpsSDFBase< Vertex >::setAmplitude( const typename Vertex::RealType& amplitude ) { this->amplitude = amplitude; } template< typename Vertex > -const typename Vertex::RealType& tnlSinBumpsFunctionSDFBase< Vertex >::getAmplitude() const +const typename Vertex::RealType& SinBumpsSDFBase< Vertex >::getAmplitude() const { return this->amplitude; } template< typename Vertex > -void tnlSinBumpsFunctionSDFBase< Vertex >::setPhase( const Vertex& phase ) +void SinBumpsSDFBase< Vertex >::setPhase( const Vertex& phase ) { this->phase = phase; } template< typename Vertex > -const Vertex& tnlSinBumpsFunctionSDFBase< Vertex >::getPhase() const +const Vertex& SinBumpsSDFBase< Vertex >::getPhase() const { return this->phase; } @@ -64,12 +57,12 @@ const Vertex& tnlSinBumpsFunctionSDFBase< Vertex >::getPhase() const */ template< typename Real > -tnlSinBumpsFunctionSDF< 1, Real >::tnlSinBumpsFunctionSDF() +SinBumpsSDF< 1, Real >::SinBumpsSDF() { } template< typename Real > -bool tnlSinBumpsFunctionSDF< 1, Real >::setup( const Config::ParameterContainer& parameters, +bool SinBumpsSDF< 1, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix) { this->amplitude = parameters.getParameter< double >( prefix+"amplitude" ); @@ -88,20 +81,20 @@ template< typename Real > int ZDiffOrder > __cuda_callable__ Real -tnlSinBumpsFunctionSDF< 1, Real >:: +SinBumpsSDF< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { const RealType& x = v.x(); - RealType xp = fabs( x ) + Sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0*M_PI ); + RealType xp = ::fabs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / ( 2.0*M_PI ); if( this->wavesNumber.x() != 0.0 && xp > this->wavesNumber.x() * this->waveLength.x() ) return 0.0; if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; if( XDiffOrder == 0 ) - return Sign( xp - round( (2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 ) + return sign( xp - round( (2.0 * xp ) / this->waveLength.x() ) * this->waveLength.x() / 2.0 ) * ( xp- round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) - * Sign(sin(this-> phase.x() + 2.0 * M_PI * x / this->waveLength.x())); + * sign( ::sin(this-> phase.x() + 2.0 * M_PI * x / this->waveLength.x())); if( XDiffOrder == 1 ) return 1.0; return 0.0; @@ -112,12 +105,12 @@ getPartialDerivative( const VertexType& v, */ template< typename Real > -tnlSinBumpsFunctionSDF< 2, Real >::tnlSinBumpsFunctionSDF() +SinBumpsSDF< 2, Real >::SinBumpsSDF() { } template< typename Real > -bool tnlSinBumpsFunctionSDF< 2, Real >::setup( const Config::ParameterContainer& parameters, +bool SinBumpsSDF< 2, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix ) { this->amplitude = parameters.getParameter< double >( prefix+"amplitude" ); @@ -141,20 +134,20 @@ template< typename Real > int ZDiffOrder > __cuda_callable__ Real -tnlSinBumpsFunctionSDF< 2, Real >:: +SinBumpsSDF< 2, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { const RealType& x = v.x(); const RealType& y = v.y(); - RealType xp = sqrt(x*x) + Sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); - RealType yp = sqrt(y*y) + Sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); + RealType xp = ::sqrt(x*x) + sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); + RealType yp = ::sqrt(y*y) + sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); if( ( xp > this->wavesNumber.x()*this->waveLength.x() && this->wavesNumber.x() != 0.0 ) || ( yp > this->wavesNumber.y()*this->waveLength.y() && this->wavesNumber.y() != 0.0 ) ) return 0.0; - const RealType sx = Sign(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) + const RealType sx = sign(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) *(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0); - const RealType sy = Sign(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0) + const RealType sy = sign(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0) *(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0); RealType sxy; if(sx < sy) @@ -163,8 +156,8 @@ getPartialDerivative( const VertexType& v, sxy = sy; if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) { - return sxy * Sign( sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) - * sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) ); + return sxy * sign( ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) + * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) ); } return 0.0; } @@ -174,12 +167,12 @@ getPartialDerivative( const VertexType& v, */ template< typename Real > -tnlSinBumpsFunctionSDF< 3, Real >::tnlSinBumpsFunctionSDF() +SinBumpsSDF< 3, Real >::SinBumpsSDF() { } template< typename Real > -bool tnlSinBumpsFunctionSDF< 3, Real >::setup( const Config::ParameterContainer& parameters, +bool SinBumpsSDF< 3, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix ) { this->amplitude = parameters.getParameter< double >( prefix+"amplitude" ); @@ -208,25 +201,25 @@ template< typename Real > int ZDiffOrder > __cuda_callable__ Real -tnlSinBumpsFunctionSDF< 3, Real >:: +SinBumpsSDF< 3, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { const RealType& x = v.x(); const RealType& y = v.y(); const RealType& z = v.z(); - RealType xp = sqrt(x*x) + Sign(x)*(this->phase.x())*(this->waveLength.x())/(2.0*M_PI); - RealType yp = sqrt(y*y) + Sign(y)*(this->phase.y())*(this->waveLength.y())/(2.0*M_PI); - RealType zp = sqrt(z*z) + Sign(z)*(this->phase.z())*(this->waveLength.z())/(2.0*M_PI); + RealType xp = ::sqrt(x*x) + sign(x)*(this->phase.x())*(this->waveLength.x())/(2.0*M_PI); + RealType yp = ::sqrt(y*y) + sign(y)*(this->phase.y())*(this->waveLength.y())/(2.0*M_PI); + RealType zp = ::sqrt(z*z) + sign(z)*(this->phase.z())*(this->waveLength.z())/(2.0*M_PI); if ( ( xp > this->wavesNumber.x()*this->waveLength.x() && this->wavesNumber.x() != 0.0 ) || (yp > this->wavesNumber.y()*this->waveLength.y() && this->wavesNumber.y() != 0.0 ) || - (sqrt(z*z) > this->wavesNumber.z()*this->waveLength.z() && this->wavesNumber.z() != 0.0 ) ) + (::sqrt(z*z) > this->wavesNumber.z()*this->waveLength.z() && this->wavesNumber.z() != 0.0 ) ) return 0.0; - const RealType sx = Sign(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) + const RealType sx = sign(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0) *(xp - round((2.0 * xp)/this->waveLength.x())* this->waveLength.x()/2.0); - const RealType sy = Sign(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0) + const RealType sy = sign(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0) *(yp - round((2.0 * yp)/this->waveLength.y())* this->waveLength.y()/2.0); - const RealType sz = Sign(zp - round((2.0 * zp)/this->waveLength.z())* this->waveLength.z()/2.0) + const RealType sz = sign(zp - round((2.0 * zp)/this->waveLength.z())* this->waveLength.z()/2.0) *(zp - round((2.0 * zp)/this->waveLength.z())* this->waveLength.z()/2.0); RealType sxyz; if(sx <= sy && sx <= sz) @@ -237,9 +230,9 @@ getPartialDerivative( const VertexType& v, sxyz = sz; if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) { - return sxyz * Sign( sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) - * sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) - * sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() ) ); + return sxyz * sign( ::sin( this->phase.x() + 2.0 * M_PI * x / this->waveLength.x() ) + * ::sin( this->phase.y() + 2.0 * M_PI * y / this->waveLength.y() ) + * ::sin( this->phase.z() + 2.0 * M_PI * z / this->waveLength.z() ) ); } return 0.0; } diff --git a/src/TNL/Functions/Analytic/SinBumps_impl.h b/src/TNL/Functions/Analytic/SinBumps_impl.h index b308e5aedaf29397df2773d3ecbf296fcf39a901..337b7db27296a1f72ae3d874f93a6979fb4fc434 100644 --- a/src/TNL/Functions/Analytic/SinBumps_impl.h +++ b/src/TNL/Functions/Analytic/SinBumps_impl.h @@ -101,7 +101,7 @@ getPartialDerivative( const VertexType& v, return 0.0; const RealType& x = v.x(); - const RealType xp = fabs( x ) + Sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); + const RealType xp = ::fabs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); if( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() ) return 0.0; @@ -162,8 +162,8 @@ getPartialDerivative( const VertexType& v, const RealType& x = v.x(); const RealType& y = v.y(); - const RealType xp = fabs( x ) + Sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); - const RealType yp = fabs( y ) + Sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); + const RealType xp = ::fabs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); + const RealType yp = ::fabs( y ) + sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); //std::cerr << "this->wavesNumber.x() = " << this->wavesNumber.x() << "fabs( x ) = " << fabs( x ) << " 2.0*M_PI * this->waveLength.x() * this->wavesNumber.x() = " << 2.0*M_PI * this->waveLength.x() * this->wavesNumber.x() << std::endl; if( ( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() ) || ( this->wavesNumber.y() != 0.0 && yp > this->waveLength.y() * this->wavesNumber.y() ) ) @@ -235,9 +235,9 @@ getPartialDerivative( const VertexType& v, const RealType& y = v.y(); const RealType& z = v.z(); - const RealType xp = fabs( x ) + Sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); - const RealType yp = fabs( y ) + Sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); - const RealType zp = fabs( z ) + Sign( z ) * this->phase.z() * this->waveLength.z() / (2.0*M_PI); + const RealType xp = ::fabs( x ) + sign( x ) * this->phase.x() * this->waveLength.x() / (2.0*M_PI); + const RealType yp = ::fabs( y ) + sign( y ) * this->phase.y() * this->waveLength.y() / (2.0*M_PI); + const RealType zp = ::fabs( z ) + sign( z ) * this->phase.z() * this->waveLength.z() / (2.0*M_PI); if( ( this->wavesNumber.x() != 0.0 && xp > this->waveLength.x() * this->wavesNumber.x() ) || ( this->wavesNumber.y() != 0.0 && yp > this->waveLength.y() * this->wavesNumber.y() ) || diff --git a/src/functions/tnlSinWaveFunctionSDF.h b/src/TNL/Functions/Analytic/SinWaveSDF.h similarity index 73% rename from src/functions/tnlSinWaveFunctionSDF.h rename to src/TNL/Functions/Analytic/SinWaveSDF.h index 1ed6d602f067569092f53ee2c16384f0cf335413..29278c35878b7b5c8f5eba6630959ee80b8df75f 100644 --- a/src/functions/tnlSinWaveFunctionSDF.h +++ b/src/TNL/Functions/Analytic/SinWaveSDF.h @@ -1,19 +1,12 @@ /*************************************************************************** - tnlSinWaveFunctionSDFSDF.h - description + SinWaveSDF.h - description ------------------- begin : Oct 13, 2014 copyright : (C) 2014 by Tomas Sobotik ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ #pragma once @@ -21,13 +14,17 @@ #include <TNL/Containers/StaticVector.h> #include <TNL/Functions/Domain.h> +namespace TNL { + namespace Functions { + namespace Analytic { + template< int dimensions, typename Real = double > -class tnlSinWaveFunctionSDFBase : public Functions::Domain< dimensions, SpaceDomain > +class SinWaveSDFBase : public Functions::Domain< dimensions, SpaceDomain > { public: - tnlSinWaveFunctionSDFBase(); + SinWaveSDFBase(); bool setup( const Config::ParameterContainer& parameters, const String& prefix = "" ); @@ -57,12 +54,12 @@ class tnlSinWaveFunctionSDFBase : public Functions::Domain< dimensions, SpaceDom }; template< int Dimensions, typename Real > -class tnlSinWaveFunctionSDF +class SinWaveSDF { }; template< typename Real > -class tnlSinWaveFunctionSDF< 1, Real > : public tnlSinWaveFunctionSDFBase< 1, Real > +class SinWaveSDF< 1, Real > : public SinWaveSDFBase< 1, Real > { public: @@ -89,7 +86,7 @@ class tnlSinWaveFunctionSDF< 1, Real > : public tnlSinWaveFunctionSDFBase< 1, Re }; template< typename Real > -class tnlSinWaveFunctionSDF< 2, Real > : public tnlSinWaveFunctionSDFBase< 2, Real > +class SinWaveSDF< 2, Real > : public SinWaveSDFBase< 2, Real > { public: @@ -116,7 +113,7 @@ class tnlSinWaveFunctionSDF< 2, Real > : public tnlSinWaveFunctionSDFBase< 2, Re }; template< typename Real > -class tnlSinWaveFunctionSDF< 3, Real > : public tnlSinWaveFunctionSDFBase< 3, Real > +class SinWaveSDF< 3, Real > : public SinWaveSDFBase< 3, Real > { public: @@ -146,7 +143,7 @@ class tnlSinWaveFunctionSDF< 3, Real > : public tnlSinWaveFunctionSDFBase< 3, Re template< int Dimensions, typename Real > -std::ostream& operator << ( std::ostream& str, const tnlSinWaveFunctionSDF< Dimensions, Real >& f ) +std::ostream& operator << ( std::ostream& str, const SinWaveSDF< Dimensions, Real >& f ) { str << "SDF Sin Wave SDF. function: amplitude = " << f.getAmplitude() << " wavelength = " << f.getWaveLength() @@ -154,5 +151,9 @@ std::ostream& operator << ( std::ostream& str, const tnlSinWaveFunctionSDF< Dime << " # of waves = " << f.getWavesNumber(); return str; } + + } // namespace Analytic + } // namespace Functions +} // namespace TNL -#include <functions/tnlSinWaveFunctionSDF_impl.h> +#include <TNL/Functions/Analytic/SinWaveSDF_impl.h> diff --git a/src/functions/tnlSinWaveFunctionSDF_impl.h b/src/TNL/Functions/Analytic/SinWaveSDF_impl.h similarity index 59% rename from src/functions/tnlSinWaveFunctionSDF_impl.h rename to src/TNL/Functions/Analytic/SinWaveSDF_impl.h index ab06a74215ccf4077c9dee503e7d34cd8a7453ef..5d010df173f833e1d480c28a92886ada7c59e460 100644 --- a/src/functions/tnlSinWaveFunctionSDF_impl.h +++ b/src/TNL/Functions/Analytic/SinWaveSDF_impl.h @@ -6,21 +6,18 @@ ***************************************************************************/ -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* See Copyright Notice in tnl/Copyright */ #pragma once -#include <functions/tnlSinWaveFunctionSDF.h> +#include <TNL/Functions/Analytic/SinWaveSDF.h> + +namespace TNL { + namespace Functions { + namespace Analytic { template< int dimensions, typename Real > -tnlSinWaveFunctionSDFBase< dimensions, Real >::tnlSinWaveFunctionSDFBase() +SinWaveSDFBase< dimensions, Real >::SinWaveSDFBase() : waveLength( 1.0 ), amplitude( 1.0 ), phase( 0 ), @@ -29,7 +26,7 @@ tnlSinWaveFunctionSDFBase< dimensions, Real >::tnlSinWaveFunctionSDFBase() } template< int dimensions, typename Real > -bool tnlSinWaveFunctionSDFBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, +bool SinWaveSDFBase< dimensions, Real >::setup( const Config::ParameterContainer& parameters, const String& prefix ) { this->waveLength = parameters.getParameter< double >( prefix + "wave-length" ); @@ -42,61 +39,61 @@ bool tnlSinWaveFunctionSDFBase< dimensions, Real >::setup( const Config::Paramet } template< int dimensions, typename Real > -void tnlSinWaveFunctionSDFBase< dimensions, Real >::setWaveLength( const Real& waveLength ) +void SinWaveSDFBase< dimensions, Real >::setWaveLength( const Real& waveLength ) { this->waveLength = waveLength; } template< int dimensions, typename Real > -Real tnlSinWaveFunctionSDFBase< dimensions, Real >::getWaveLength() const +Real SinWaveSDFBase< dimensions, Real >::getWaveLength() const { return this->waveLength; } template< int dimensions, typename Real > -void tnlSinWaveFunctionSDFBase< dimensions, Real >::setAmplitude( const Real& amplitude ) +void SinWaveSDFBase< dimensions, Real >::setAmplitude( const Real& amplitude ) { this->amplitude = amplitude; } template< int dimensions, typename Real > -Real tnlSinWaveFunctionSDFBase< dimensions, Real >::getAmplitude() const +Real SinWaveSDFBase< dimensions, Real >::getAmplitude() const { return this->amplitude; } template< int dimensions, typename Real > -void tnlSinWaveFunctionSDFBase< dimensions, Real >::setPhase( const Real& phase ) +void SinWaveSDFBase< dimensions, Real >::setPhase( const Real& phase ) { this->phase = phase; } template< int dimensions, typename Real > -Real tnlSinWaveFunctionSDFBase< dimensions, Real >::getPhase() const +Real SinWaveSDFBase< dimensions, Real >::getPhase() const { return this->phase; } template< int dimensions, typename Real > -void tnlSinWaveFunctionSDFBase< dimensions, Real >::setWavesNumber( const Real& wavesNumber ) +void SinWaveSDFBase< dimensions, Real >::setWavesNumber( const Real& wavesNumber ) { this->wavesNumber = wavesNumber; } template< int dimensions, typename Real > -Real tnlSinWaveFunctionSDFBase< dimensions, Real >::getWavesNumber() const +Real SinWaveSDFBase< dimensions, Real >::getWavesNumber() const { return this->wavesNumber; } template< int dimensions, typename Real > __cuda_callable__ -Real tnlSinWaveFunctionSDFBase< dimensions, Real >::sinWaveFunctionSDF( const Real& r ) const +Real SinWaveSDFBase< dimensions, Real >::sinWaveFunctionSDF( const Real& r ) const { if( this->wavesNumber == 0.0 || r < this->wavesNumber * this->waveLength ) - return Sign( r - round( 2.0 * r / this->waveLength ) * this->waveLength / 2.0 ) + return sign( r - round( 2.0 * r / this->waveLength ) * this->waveLength / 2.0 ) * ( r - round( 2.0 * r / this->waveLength ) * this->waveLength / 2.0 ) - * Sign( sin( 2.0 * M_PI * r / this->waveLength ) ); + * sign( ::sin( 2.0 * M_PI * r / this->waveLength ) ); else return r - this->wavesNumber * this->waveLength; } @@ -108,17 +105,17 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSinWaveFunctionSDF< 1, Real >:: +SinWaveSDF< 1, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { if( YDiffOrder != 0 || ZDiffOrder != 0 ) return 0.0; const RealType& x = v.x(); - const RealType distance = sqrt( x * x ) + this->phase * this->waveLength / (2.0*M_PI); + const RealType distance = ::sqrt( x * x ) + this->phase * this->waveLength / (2.0*M_PI); if( XDiffOrder == 0 ) return this->sinWaveFunctionSDF( distance ); - TNL_ASSERT( false, "TODO: implement this" ); + TNL_ASSERT( false, std::cerr << "TODO: implement this" ); return 0.0; } @@ -129,7 +126,7 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSinWaveFunctionSDF< 2, Real >:: +SinWaveSDF< 2, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { @@ -138,10 +135,10 @@ getPartialDerivative( const VertexType& v, const RealType& x = v.x(); const RealType& y = v.y(); - const RealType distance = sqrt( x * x + y * y ) + this->phase * this->waveLength / (2.0*M_PI); + const RealType distance = ::sqrt( x * x + y * y ) + this->phase * this->waveLength / (2.0*M_PI); if( XDiffOrder == 0 && YDiffOrder == 0) return this->sinWaveFunctionSDF( distance ); - TNL_ASSERT( false, "TODO: implement this" ); + TNL_ASSERT( false, std::cerr << "TODO: implement this" ); return 0.0; } @@ -151,16 +148,20 @@ template< typename Real > int ZDiffOrder> __cuda_callable__ Real -tnlSinWaveFunctionSDF< 3, Real >:: +SinWaveSDF< 3, Real >:: getPartialDerivative( const VertexType& v, const Real& time ) const { const RealType& x = v.x(); const RealType& y = v.y(); const RealType& z = v.z(); - const RealType distance = sqrt( x * x + y * y + z * z ) + this->phase * this->waveLength / (2.0*M_PI); + const RealType distance = ::sqrt( x * x + y * y + z * z ) + this->phase * this->waveLength / (2.0*M_PI); if( XDiffOrder == 0 && YDiffOrder == 0 && ZDiffOrder == 0 ) return this->sinWaveFunctionSDF( distance ); - TNL_ASSERT( false, "TODO: implement this" ); + TNL_ASSERT( false, std::cerr << "TODO: implement this" ); return 0.0; } + + } // namespace Analytic + } // namespace Functions +} // namespace TNL diff --git a/src/TNL/Functions/Analytic/Twins.h b/src/TNL/Functions/Analytic/Twins.h index ebdb507ac79e84681396715254ff4d4e30ff1b9e..d6627cdef82b7f28e69b202c48fe9bd1f91870ed 100644 --- a/src/TNL/Functions/Analytic/Twins.h +++ b/src/TNL/Functions/Analytic/Twins.h @@ -1,5 +1,5 @@ /*************************************************************************** - ExpBump.h - description + Twins.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber diff --git a/src/TNL/Functions/Analytic/Twins_impl.h b/src/TNL/Functions/Analytic/Twins_impl.h index 222f9a452adf289bcc9282c75cf2014ecc23c289..2b294320fed642d15cc9b2d7355ff2aa3f7f7a02 100644 --- a/src/TNL/Functions/Analytic/Twins_impl.h +++ b/src/TNL/Functions/Analytic/Twins_impl.h @@ -1,5 +1,5 @@ /*************************************************************************** - ExpBump_impl.h - description + Twins_impl.h - description ------------------- begin : Dec 5, 2013 copyright : (C) 2013 by Tomas Oberhuber diff --git a/src/TNL/Functions/TestFunction_impl.h b/src/TNL/Functions/TestFunction_impl.h index f6ffc4087e3cbcac82699904a655f0bba874ce40..f6629600dade5880f77f68e76ac7b2a1bdfec67a 100644 --- a/src/TNL/Functions/TestFunction_impl.h +++ b/src/TNL/Functions/TestFunction_impl.h @@ -24,16 +24,17 @@ #include <TNL/Functions/Analytic/Twins.h> #include <TNL/Functions/Analytic/Blob.h> #include <TNL/Functions/Analytic/PseudoSquare.h> +#include <TNL/Functions/Analytic/Paraboloid.h> +/**** + * The signed distance test functions + */ +#include <TNL/Functions/Analytic/SinBumpsSDF.h> +#include <TNL/Functions/Analytic/SinWaveSDF.h> +#include <TNL/Functions/Analytic/ParaboloidSDF.h> namespace TNL { namespace Functions { -/**** - * The signed distance test functions - */ -#include <functions/tnlSinBumpsFunctionSDF.h> -#include <functions/tnlSinWaveFunctionSDF.h> -#include <functions/tnlParaboloidSDF.h> template< int FunctionDimensions, typename Real, @@ -166,7 +167,7 @@ setup( const Config::ParameterContainer& parameters, } if( testFunction == "paraboloid" ) { - typedef tnlParaboloid< Dimensions, Real > FunctionType; + typedef Paraboloid< Dimensions, Real > FunctionType; functionType = paraboloid; return setupFunction< FunctionType >( parameters ); } @@ -271,13 +272,13 @@ operator = ( const TestFunction& function ) break; case paraboloidSDF: - this->copyFunction< tnlParaboloid< FunctionDimensions, Real > >( function.function ); + this->copyFunction< Paraboloid< FunctionDimensions, Real > >( function.function ); break; case sinBumpsSDF: - this->copyFunction< tnlSinBumpsFunctionSDF< FunctionDimensions, Real > >( function.function ); + this->copyFunction< SinBumpsSDF< FunctionDimensions, Real > >( function.function ); break; case sinWaveSDF: - this->copyFunction< tnlSinWaveFunctionSDF< FunctionDimensions, Real > >( function.function ); + this->copyFunction< SinWaveSDF< FunctionDimensions, Real > >( function.function ); break; default: TNL_ASSERT( false, ); @@ -383,7 +384,7 @@ getTimeDerivative( const VertexType& vertex, return scale * ( ( Constant< Dimensions, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case paraboloid: - return scale * ( ( tnlParaboloid< Dimensions, Real >* ) function )-> + return scale * ( ( Paraboloid< Dimensions, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case expBump: return scale * ( ( ExpBump< Dimensions, Real >* ) function )-> @@ -418,13 +419,13 @@ getTimeDerivative( const VertexType& vertex, case paraboloidSDF: - return scale * ( ( tnlParaboloidSDF< Dimensions, Real >* ) function )-> + return scale * ( ( ParaboloidSDF< Dimensions, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case sinBumpsSDF: - return scale * ( ( tnlSinBumpsFunctionSDF< Dimensions, Real >* ) function )-> + return scale * ( ( SinBumpsSDF< Dimensions, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); case sinWaveSDF: - return scale * ( ( tnlSinWaveFunctionSDF< Dimensions, Real >* ) function )-> + return scale * ( ( SinWaveSDF< Dimensions, Real >* ) function )-> getPartialDerivative< XDiffOrder, YDiffOrder, ZDiffOrder >( vertex, time ); default: return 0.0; @@ -465,7 +466,7 @@ deleteFunctions() deleteFunction< Constant< Dimensions, Real> >(); break; case paraboloid: - deleteFunction< tnlParaboloid< Dimensions, Real> >(); + deleteFunction< Paraboloid< Dimensions, Real> >(); break; case expBump: deleteFunction< ExpBump< Dimensions, Real> >(); @@ -493,13 +494,13 @@ deleteFunctions() break; case paraboloidSDF: - deleteFunction< tnlParaboloidSDF< Dimensions, Real> >(); + deleteFunction< ParaboloidSDF< Dimensions, Real> >(); break; case sinBumpsSDF: - deleteFunction< tnlSinBumpsFunctionSDF< Dimensions, Real> >(); + deleteFunction< SinBumpsSDF< Dimensions, Real> >(); break; case sinWaveSDF: - deleteFunction< tnlSinWaveFunctionSDF< Dimensions, Real> >(); + deleteFunction< SinWaveSDF< Dimensions, Real> >(); break; } } diff --git a/src/TNL/Operators/NeumannBoundaryConditions.h b/src/TNL/Operators/NeumannBoundaryConditions.h index 8d7b889fed7cadd019b0fcf011b5c6df2a61bf3f..f39eb64744df7ecf29823ca79e92bdb494711d53 100644 --- a/src/TNL/Operators/NeumannBoundaryConditions.h +++ b/src/TNL/Operators/NeumannBoundaryConditions.h @@ -49,7 +49,7 @@ class NeumannBoundaryConditionsBase return Functions::FunctionAdapter< typename MeshPointer::ObjectType, FunctionType >::setup( this->function, meshPointer, parameters, prefix ); } - static void configSetup( tnlConfigDescription& config, + static void configSetup( Config::ConfigDescription& config, const String& prefix = "" ) { Function::configSetup( config, prefix ); @@ -125,7 +125,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, const IndexType& index = entity.getIndex(); if( entity.getCoordinates().x() == 0 ) return u[ neighbourEntities.template getEntityIndex< 1 >() ] + entity.getMesh().getSpaceSteps().x() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); else return u[ neighbourEntities.template getEntityIndex< -1 >() ] + entity.getMesh().getSpaceSteps().x() * Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); @@ -162,7 +162,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 1, MeshReal, Device, MeshIndex >, matrixRow.setElement( 0, index, 1.0 ); matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1 >(), -1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().x() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } else { @@ -220,7 +220,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, if( entity.getCoordinates().x() == 0 ) { return u[ neighbourEntities.template getEntityIndex< 1, 0 >() ] + entity.getMesh().getSpaceSteps().x() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) { @@ -230,7 +230,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, if( entity.getCoordinates().y() == 0 ) { return u[ neighbourEntities.template getEntityIndex< 0, 1 >() ] + entity.getMesh().getSpaceSteps().y() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } // The following line is commented to avoid compiler warning //if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ) @@ -269,7 +269,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, matrixRow.setElement( 0, index, 1.0 ); matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1, 0 >(), -1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().x() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) { @@ -283,7 +283,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 2, MeshReal, Device, MeshIndex >, matrixRow.setElement( 0, index, 1.0 ); matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 1 >(), -1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().y() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ) { @@ -339,7 +339,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, if( entity.getCoordinates().x() == 0 ) { return u[ neighbourEntities.template getEntityIndex< 1, 0, 0 >() ] + entity.getMesh().getSpaceSteps().x() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) { @@ -349,7 +349,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, if( entity.getCoordinates().y() == 0 ) { return u[ neighbourEntities.template getEntityIndex< 0, 1, 0 >() ] + entity.getMesh().getSpaceSteps().y() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ) { @@ -359,7 +359,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, if( entity.getCoordinates().z() == 0 ) { return u[ neighbourEntities.template getEntityIndex< 0, 0, 1 >() ] + entity.getMesh().getSpaceSteps().z() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } // The following line is commented to avoid compiler warning //if( entity.getCoordinates().z() == entity.getMesh().getDimensions().z() - 1 ) @@ -399,7 +399,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, matrixRow.setElement( 0, index, 1.0 ); matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 1, 0, 0 >(), -1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().x() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().x() == entity.getMesh().getDimensions().x() - 1 ) { @@ -413,7 +413,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, matrixRow.setElement( 0, index, 1.0 ); matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 1, 0 >(), -1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().y() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().y() == entity.getMesh().getDimensions().y() - 1 ) { @@ -427,7 +427,7 @@ class NeumannBoundaryConditions< Meshes::Grid< 3, MeshReal, Device, MeshIndex >, matrixRow.setElement( 0, index, 1.0 ); matrixRow.setElement( 1, neighbourEntities.template getEntityIndex< 0, 0, 1 >(), -1.0 ); b[ index ] = entity.getMesh().getSpaceSteps().z() * - tnlFunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); + Functions::FunctionAdapter< MeshType, FunctionType >::getValue( this->function, entity, time ); } if( entity.getCoordinates().z() == entity.getMesh().getDimensions().z() - 1 ) { diff --git a/src/TNL/Solvers/ODE/ExplicitSolver.h b/src/TNL/Solvers/ODE/ExplicitSolver.h index c988e4092444c659b248df0b77656aae98ec1dc8..4c1743c66471c04fa4707730d9d629e9d02f6f50 100644 --- a/src/TNL/Solvers/ODE/ExplicitSolver.h +++ b/src/TNL/Solvers/ODE/ExplicitSolver.h @@ -76,7 +76,7 @@ class ExplicitSolver : public IterativeSolver< typename Problem::RealType, void setRefreshRate( const IndexType& refreshRate ); - void refreshSolverMonitor(); + void refreshSolverMonitor( bool force = false ); protected: diff --git a/src/TNL/Solvers/ODE/ExplicitSolver_impl.h b/src/TNL/Solvers/ODE/ExplicitSolver_impl.h index b9d4966e2412fe4c3404eadbb160e83de1b55f5e..11cd7f19285e21d92ddeeb4bcff98897ab59f0d9 100644 --- a/src/TNL/Solvers/ODE/ExplicitSolver_impl.h +++ b/src/TNL/Solvers/ODE/ExplicitSolver_impl.h @@ -150,7 +150,7 @@ setTimer( Timer* timer ) template< class Problem > void ExplicitSolver< Problem >:: -refreshSolverMonitor() +refreshSolverMonitor( bool force ) { if( this->solverMonitor ) { diff --git a/src/TNL/Solvers/SolverConfig_impl.h b/src/TNL/Solvers/SolverConfig_impl.h index 8f95938d5fd311abd361dc246e155491f28dde88..9b5ac6e0d8751c6a5c3ecc8be1bd0115f3cb6ec5 100644 --- a/src/TNL/Solvers/SolverConfig_impl.h +++ b/src/TNL/Solvers/SolverConfig_impl.h @@ -79,7 +79,7 @@ bool SolverConfig< ConfigTag, ProblemConfig >::configSetup( Config::ConfigDescri */ config.addDelimiter( " === Time discretisation parameters ==== " ); typedef PDE::ExplicitTimeStepper< DummyProblemType, ODE::Euler > ExplicitTimeStepper; - PDE::PDESolver< DummyProblemType, ExplicitTimeStepper >::configSetup( config ); + PDE::TimeDependentPDESolver< DummyProblemType, ExplicitTimeStepper >::configSetup( config ); ExplicitTimeStepper::configSetup( config ); if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled || ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled || diff --git a/src/TNL/Solvers/SolverStarter_impl.h b/src/TNL/Solvers/SolverStarter_impl.h index 72f49c3b4632afb3538bdc4ebec82999ae25b31d..516dab97d42bf11b0aa4185bc1acf01db2ab1542 100644 --- a/src/TNL/Solvers/SolverStarter_impl.h +++ b/src/TNL/Solvers/SolverStarter_impl.h @@ -358,7 +358,7 @@ bool SolverStarter< ConfigTag > :: runPDESolver( Problem& problem, /**** * Set-up the PDE solver */ - PDE::PDESolver< Problem, TimeStepper > solver; + PDE::TimeDependentPDESolver< Problem, TimeStepper > solver; solver.setProblem( problem ); solver.setTimeStepper( timeStepper ); if( ! solver.setup( parameters ) ) diff --git a/src/functions/tnlSDFGridValue.h b/src/functions/tnlSDFGridValue.h deleted file mode 100644 index 2bef800099477f73054ec5ba2267e86da6d487e6..0000000000000000000000000000000000000000 --- a/src/functions/tnlSDFGridValue.h +++ /dev/null @@ -1,173 +0,0 @@ -/*************************************************************************** - tnlSDFGridValue.h - description - ------------------- - begin : Nov 22, 2014 - copyright : (C) 2014 by Tomas Sobotik - - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef TNLSDFGRIDVALUE_H_ -#define TNLSDFGRIDVALUE_H_ - -#include <TNL/Config/ParameterContainer.h> -#include <TNL/Containers/StaticVector.h> -#include <core/vectors/tnlVector.h> -#include <core/vectors/tnlSharedVector.h> -#include <mesh/tnlGrid.h> - -template< typename Real = double > -class tnlSDFGridValueBase -{ - public: - - tnlSDFGridValueBase(); - - -}; - -template< typename Mesh, int Dimensions, typename Real > -class tnlSDFGridValue -{ -}; - -template< typename Mesh, typename Real > -class tnlSDFGridValue< Mesh, 1, Real > : public tnlSDFGridValueBase< Real > -{ - public: - - enum { Dimensions = 1 }; - typedef Containers::StaticVector< 1, Real > VertexType; - typedef Real RealType; - typedef typename Mesh::RealType RealType2; - typedef typename Mesh::DeviceType DeviceType; - typedef typename Mesh::IndexType IndexType; - typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType; - typedef typename Mesh::CoordinatesType CoordinatesType; - - bool setup( const Config::ParameterContainer& parameters, - const String& prefix = "" ); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#endif - - private: - - VertexType origin; - RealType2 hx; - Mesh mesh; - DofVectorType u; - -}; - -template< typename Mesh, typename Real > -class tnlSDFGridValue< Mesh, 2, Real > : public tnlSDFGridValueBase< Real > -{ - public: - - enum { Dimensions = 2 }; - typedef Containers::StaticVector< 2, Real > VertexType; - typedef Real RealType; - typedef typename Mesh::RealType RealType2; - typedef typename Mesh::DeviceType DeviceType; - typedef typename Mesh::IndexType IndexType; - typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType; - typedef typename Mesh::CoordinatesType CoordinatesType; - - bool setup( const Config::ParameterContainer& parameters, - const String& prefix = "" ); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#endif - - private: - - CoordinatesType dimensions; - VertexType origin; - RealType2 hx, hy; - Mesh mesh; - DofVectorType u; - -}; - -template< typename Mesh, typename Real > -class tnlSDFGridValue< Mesh, 3, Real > : public tnlSDFGridValueBase< Real > -{ - public: - - enum { Dimensions = 3 }; - typedef Containers::StaticVector< 3, Real > VertexType; - typedef Real RealType; - typedef typename Mesh::RealType RealType2; - typedef typename Mesh::DeviceType DeviceType; - typedef typename Mesh::IndexType IndexType; - typedef tnlVector< RealType2, DeviceType, IndexType> DofVectorType; - typedef typename Mesh::CoordinatesType CoordinatesType; - - bool setup( const Config::ParameterContainer& parameters, - const String& prefix = "" ); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#endif - - private: - - CoordinatesType dimensions; - VertexType origin; - RealType2 hx, hy, hz; - Mesh mesh; - DofVectorType u; - -}; - -#include <functions/tnlSDFGridValue_impl.h> - -#endif /* TNLSDFGRIDVALUE_H_ */ - diff --git a/src/functions/tnlSDFGridValue_impl.h b/src/functions/tnlSDFGridValue_impl.h deleted file mode 100644 index 85a8c1fbc3ae2f512f29a66bb6d0ede982059a72..0000000000000000000000000000000000000000 --- a/src/functions/tnlSDFGridValue_impl.h +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************** - tnlSDFGridValue_impl.h - description - ------------------- - begin : Oct 13, 2014 - copyright : (C) 2014 by Tomas Sobotik - - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef TNLSDFGRIDVALUE_IMPL_H_ -#define TNLSDFGRIDVALUE_IMPL_H_ - -#include <functions/tnlSDFGridValue.h> - -template< typename Real > -tnlSDFGridValueBase< Real >::tnlSDFGridValueBase() -{ -} - -template< typename Mesh, typename Real > -bool tnlSDFGridValue< Mesh, 1, Real >::setup( const Config::ParameterContainer& parameters, - const String& prefix) -{ - this->mesh.load(parameters.getParameter< String >( "mesh" )); - this->u.load(parameters.getParameter< String >( "initial-condition" )); - return true; -} -template< typename Mesh, typename Real > -bool tnlSDFGridValue< Mesh, 2, Real >::setup( const Config::ParameterContainer& parameters, - const String& prefix) -{ - this->mesh.load(parameters.getParameter< String >( "mesh" )); - this->u.load(parameters.getParameter< String >( "initial-condition" )); - return true; -} -template< typename Mesh, typename Real > -bool tnlSDFGridValue< Mesh, 3, Real >::setup( const Config::ParameterContainer& parameters, - const String& prefix) -{ - this->mesh.load(parameters.getParameter< String >( "mesh" )); - this->u.load(parameters.getParameter< String >( "initial-condition" )); - return true; -} - - - -template< typename Mesh, typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -Real tnlSDFGridValue< Mesh, 1, Real >::getValue( const Vertex& v, - const Real& time) const -{ - - const Real& x = (v.x() - this->mesh.getOrigin().x() ) / this->mesh.getSpaceSteps().x(); - - if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - else - return u[x]; -} - - -template< typename Mesh, typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -Real tnlSDFGridValue< Mesh, 2, Real >::getValue( const Vertex& v, - const Real& time) const -{ - - const IndexType& x = ((v.x() - this->mesh.getOrigin().x()) / this->mesh.getSpaceSteps().x()); - const IndexType& y = ((v.y() - this->mesh.getOrigin().y()) / this->mesh.getSpaceSteps().y()); - - if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - else - return u[y * this->mesh.getDimensions().x() + x]; -} - -template< typename Mesh, typename Real > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -Real tnlSDFGridValue< Mesh, 3, Real >::getValue( const Vertex& v, - const Real& time) const -{ - const Real& x = floor( (v.x() - this->mesh.getOrigin().x()) / this->mesh.getSpaceSteps().x()); - const Real& y = floor( (v.y() - this->mesh.getOrigin().y()) / this->mesh.getSpaceSteps().y()); - const Real& z = floor( (v.z() - this->mesh.getOrigin().z()) / this->mesh.getSpaceSteps().z()); - if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0 ) - return 0.0; - else - return u[( z * this->mesh.getDimensions().y() + y ) * this->mesh.getDimensions().x() + x]; -} - -#endif /* TNLSDFGRIDVALUE_IMPL_H_ */ diff --git a/src/functions/tnlSDFSign.h b/src/functions/tnlSDFSign.h deleted file mode 100644 index 62aa5305f13bcb1a127ed9fbf528a3b8782a20f4..0000000000000000000000000000000000000000 --- a/src/functions/tnlSDFSign.h +++ /dev/null @@ -1,151 +0,0 @@ -/*************************************************************************** - tnlSDFSign.h - description - ------------------- - begin : Nov 22, 2014 - copyright : (C) 2014 by Tomas Sobotik - - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef TNLSDFSIGN_H_ -#define TNLSDFSIGN_H_ - -#include <TNL/Config/ParameterContainer.h> -#include <TNL/Containers/StaticVector.h> - -template< typename Real = double > -class tnlSDFSignBase -{ - public: - - tnlSDFSignBase(); - - - void setEpsilon( const Real& epsilon ); - - Real getEpsilon() const; - - protected: - - Real epsilon; -}; - -template< typename Mesh, int Dimensions, typename Real, typename FunctionType, int SignMod > -class tnlSDFSign -{ -}; - -template< typename Mesh, typename Real, typename FunctionType, int SignMod > -class tnlSDFSign< Mesh, 1, Real, FunctionType, SignMod > : public tnlSDFSignBase< Real > -{ - public: - - enum { Dimensions = 1 }; - typedef Containers::StaticVector< 1, Real > VertexType; - typedef Real RealType; - - bool setup( const Config::ParameterContainer& parameters, - const String& prefix = "" ); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#endif - - protected: - - FunctionType function; - -}; - -template< typename Mesh, typename Real, typename FunctionType, int SignMod > -class tnlSDFSign< Mesh, 2, Real, FunctionType, SignMod > : public tnlSDFSignBase< Real > -{ - public: - - enum { Dimensions = 2 }; - typedef Containers::StaticVector< 2, Real > VertexType; - typedef Real RealType; - - bool setup( const Config::ParameterContainer& parameters, - const String& prefix = "" ); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#endif - - protected: - - FunctionType function; - -}; - -template< typename Mesh, typename Real, typename FunctionType, int SignMod > -class tnlSDFSign< Mesh, 3, Real, FunctionType, SignMod > : public tnlSDFSignBase< Real > -{ - public: - - enum { Dimensions = 3 }; - typedef Containers::StaticVector< 3, Real > VertexType; - typedef Real RealType; - - bool setup( const Config::ParameterContainer& parameters, - const String& prefix = "" ); - -#ifdef HAVE_NOT_CXX11 - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#else - template< int XDiffOrder = 0, - int YDiffOrder = 0, - int ZDiffOrder = 0, - typename Vertex = VertexType > - RealType getValue( const Vertex& v, - const Real& time = 0.0 ) const; -#endif - - protected: - - FunctionType function; - -}; - -#include <functions/tnlSDFSign_impl.h> - -#endif /* TNLSDFSIGN_H_ */ - diff --git a/src/functions/tnlSDFSign_impl.h b/src/functions/tnlSDFSign_impl.h deleted file mode 100644 index e447a09fe62cd439722c8d405367a4d25df2d442..0000000000000000000000000000000000000000 --- a/src/functions/tnlSDFSign_impl.h +++ /dev/null @@ -1,157 +0,0 @@ -/*************************************************************************** - tnlSDFSign_impl.h - description - ------------------- - begin : Oct 13, 2014 - copyright : (C) 2014 by Tomas Sobotik - - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#ifndef TNLSDFSIGN_IMPL_H_ -#define TNLSDFSIGN_IMPL_H_ - -#include <functions/tnlSDFSign.h> - -template< typename Real > -tnlSDFSignBase< Real >::tnlSDFSignBase() -: epsilon( 0 ) -{ -} - -template< typename Mesh, typename Real, typename FunctionType, int SignMod > -bool tnlSDFSign< Mesh, 1, Real, FunctionType, SignMod >::setup( const Config::ParameterContainer& parameters, - const String& prefix) -{ - this->epsilon = parameters.getParameter< double >( "epsilon" ); - Mesh mesh; - mesh.load(parameters.getParameter< String >( "mesh" )); - this->epsilon*=mesh.getSpaceSteps().x(); - this->function.setup(parameters, prefix); - - return true; -} -template< typename Mesh, typename Real, typename FunctionType, int SignMod > -bool tnlSDFSign< Mesh, 2, Real, FunctionType, SignMod >::setup( const Config::ParameterContainer& parameters, - const String& prefix) -{ - this->epsilon = parameters.getParameter< double >( "epsilon" ); - Mesh mesh; - mesh.load(parameters.getParameter< String >( "mesh" )); - this->epsilon=this->epsilon*sqrt(mesh.getSpaceSteps().x()*mesh.getSpaceSteps().x() + mesh.getSpaceSteps().y()*mesh.getSpaceSteps().y()); - this->function.setup(parameters, prefix); - - return true; -} -template< typename Mesh, typename Real, typename FunctionType, int SignMod > -bool tnlSDFSign< Mesh, 3, Real, FunctionType, SignMod >::setup( const Config::ParameterContainer& parameters, - const String& prefix) -{ - this->epsilon = parameters.getParameter< double >( "epsilon" ); - Mesh mesh; - mesh.load(parameters.getParameter< String >( "mesh" )); - this->epsilon*=sqrt(mesh.getSpaceSteps().x()*mesh.getSpaceSteps().x() + mesh.getSpaceSteps().y()*mesh.getSpaceSteps().y() + mesh.getSpaceSteps().z()*mesh.getSpaceSteps().z()); - this->function.setup(parameters, prefix); - - return true; -} - - -template< typename Real > -void tnlSDFSignBase< Real >::setEpsilon( const Real& epsilon ) -{ - this->epsilon = epsilon; -} - -template< typename Real > -Real tnlSDFSignBase< Real >::getEpsilon() const -{ - return this->epsilon; -} - - -template< typename Mesh, typename Real, typename FunctionType, int SignMod > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -Real tnlSDFSign< Mesh, 1, Real, FunctionType, SignMod >::getValue( const Vertex& v, - const Real& time) const -{ - const Real& x = this->function.getValue(v, time); - if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0) - return 0.0; - else - { - if(x > this->epsilon) - return (Real)SignMod*1.0; - else if (x < -this->epsilon) - return (Real)SignMod*(-1.0); - - if(this->epsilon == 0.0) - return 0.0; - - return (Real)SignMod*sin( ( M_PI * x ) / (2 * this->epsilon) ); - } -} - - -template< typename Mesh, typename Real, typename FunctionType, int SignMod > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -Real tnlSDFSign< Mesh, 2, Real, FunctionType, SignMod >::getValue( const Vertex& v, - const Real& time) const -{ - - const Real& x = this->function.getValue(v, time); - if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0) - return 0.0; - else - { - if(x > this->epsilon) - return (Real)SignMod*1.0; - else if (x < -this->epsilon) - return (Real)SignMod*(-1.0); - - if(this->epsilon == 0.0) - return 0.0; - - return (Real)SignMod*sin( ( M_PI * x ) / (2 * this->epsilon) ); - } -} - -template< typename Mesh, typename Real, typename FunctionType, int SignMod > - template< int XDiffOrder, - int YDiffOrder, - int ZDiffOrder, - typename Vertex > -Real tnlSDFSign< Mesh, 3, Real, FunctionType, SignMod >::getValue( const Vertex& v, - const Real& time) const -{ - const Real& x = this->function.getValue(v, time); - if( XDiffOrder != 0 || YDiffOrder != 0 || ZDiffOrder != 0) - return 0.0; - else - { - if(x > this->epsilon) - return (Real)SignMod*1.0; - else if (x < -this->epsilon) - return (Real)SignMod*(-1.0); - - if(this->epsilon == 0.0) - return 0.0; - - return (Real)SignMod*sin( ( M_PI * x ) / (2 * this->epsilon) ); - } -} - -#endif /* TNLSDFSIGN_IMPL_H_ */