Loading examples/hamilton-jacobi/HamiltonJacobiProblemConfig.h +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ class HamiltonJacobiProblemConfig config.addEntryEnum( "upwind" ); config.addEntryEnum( "godunov2" ); config.addEntryEnum( "upwind2" ); config.addEntry < double > ( "epsilon", "This defines epsilon for smoothening of sign().", 0.0 ); config.addEntry < double > ( "epsilon", "This defines epsilon for smoothening of sign().", 3.0 ); config.addEntry < double > ( "-value", "Constant value of RHS.", 0.0 ); } }; Loading examples/hamilton-jacobi/HamiltonJacobiProblemSetter_impl.h +5 −3 Original line number Diff line number Diff line Loading @@ -24,8 +24,9 @@ //#include <operators/hamilton-jacobi/godunov-eikonal/godunovEikonal.h> //#include <operators/hamilton-jacobi/upwind/upwind.h> //#include <operators/hamilton-jacobi/godunov/godunov.h> #include <functions/tnlSDFSign.h> #include <functions/tnlSDFGridValue.h> //#include <functions/tnlSDFSign.h> //#include <functions/tnlSDFGridValue.h> #include <operators/hamilton-jacobi/tnlEikonalOperator.h> template< typename RealType, Loading Loading @@ -55,8 +56,9 @@ bool HamiltonJacobiProblemSetter< RealType, DeviceType, IndexType, MeshType, Con if( schemeName == "upwind" ) { typedef upwindEikonalScheme< MeshType, RealType, IndexType > Operator; typedef upwindEikonalScheme< MeshType, RealType, IndexType > GradientNormOperator; typedef tnlConstantFunction< Dimensions, RealType > RightHandSide; typedef tnlEikonalOperator< GradientNormOperator, RightHandSide > Operator; typedef HamiltonJacobiProblem< MeshType, Operator, BoundaryConditions, RightHandSide > Solver; return solverStarter.template run< Solver >( parameters ); } Loading examples/hamilton-jacobi/HamiltonJacobiProblem_impl.h +9 −4 Original line number Diff line number Diff line Loading @@ -78,7 +78,9 @@ bool HamiltonJacobiProblem< Mesh,HamiltonJacobi,BoundaryCondition,RightHandSide this -> v. bind( & dofVector. getData()[ 1 * dofs ], dofs ); */ return differentialOperator.init(parameters); differentialOperator.getAnisotropy().setConstant( 1.0 ); //setup( parameters ); differentialOperator.setSmoothing( 1.0 ); return true; } Loading Loading @@ -121,7 +123,7 @@ setInitialCondition( const tnlParameterContainer& parameters, { this->bindDofs( mesh, dofs ); const tnlString& initialConditionFile = parameters.getParameter< tnlString >( "initial-condition" ); if( ! this->solution.load( initialConditionFile ) ) if( ! this->solution.boundLoad( initialConditionFile ) ) { cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl; return false; Loading Loading @@ -191,4 +193,7 @@ getExplicitRHS( const RealType& time, this->rightHandSide, u, fu ); //fu.save( "fu.tnl" ); //std::cerr << "Enter." << std::endl; //getchar(); } src/functions/CMakeLists.txt +2 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ SET( headers tnlConstantFunction.h tnlParaboloidSDF_impl.h tnlSDFSchemeTest_impl.h tnlSDFSign_impl.h tnlSDFGridValue_impl.h ) tnlSDFGridValue_impl.h tnlFunctions.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/functions ) set( common_SOURCES Loading src/functions/tnlFunctions.h 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * File: tnlFunctions.h * Author: oberhuber * * Created on July 11, 2016, 6:01 PM */ #ifndef TNLFUNCTIONS_H #define TNLFUNCTIONS_H #include <core/tnlCuda.h> template< typename Real > __cuda_callable__ Real sign( const Real& x, const Real& smoothing = 0.0 ) { if( x > smoothing ) return 1.0; else if( x < -smoothing ) return -1.0; if( smoothing == 0.0 ) return 0.0; return sin( ( M_PI * x ) / ( 2.0 * smoothing ) ); } template< typename Real > __cuda_callable__ Real positivePart( const Real& arg) { return arg > 0.0 ? arg : 0.0; } template< typename Real > __cuda_callable__ Real negativePart( const Real& arg) { return arg < 0.0 ? arg : 0.0; } #endif /* TNLFUNCTIONS_H */ Loading
examples/hamilton-jacobi/HamiltonJacobiProblemConfig.h +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ class HamiltonJacobiProblemConfig config.addEntryEnum( "upwind" ); config.addEntryEnum( "godunov2" ); config.addEntryEnum( "upwind2" ); config.addEntry < double > ( "epsilon", "This defines epsilon for smoothening of sign().", 0.0 ); config.addEntry < double > ( "epsilon", "This defines epsilon for smoothening of sign().", 3.0 ); config.addEntry < double > ( "-value", "Constant value of RHS.", 0.0 ); } }; Loading
examples/hamilton-jacobi/HamiltonJacobiProblemSetter_impl.h +5 −3 Original line number Diff line number Diff line Loading @@ -24,8 +24,9 @@ //#include <operators/hamilton-jacobi/godunov-eikonal/godunovEikonal.h> //#include <operators/hamilton-jacobi/upwind/upwind.h> //#include <operators/hamilton-jacobi/godunov/godunov.h> #include <functions/tnlSDFSign.h> #include <functions/tnlSDFGridValue.h> //#include <functions/tnlSDFSign.h> //#include <functions/tnlSDFGridValue.h> #include <operators/hamilton-jacobi/tnlEikonalOperator.h> template< typename RealType, Loading Loading @@ -55,8 +56,9 @@ bool HamiltonJacobiProblemSetter< RealType, DeviceType, IndexType, MeshType, Con if( schemeName == "upwind" ) { typedef upwindEikonalScheme< MeshType, RealType, IndexType > Operator; typedef upwindEikonalScheme< MeshType, RealType, IndexType > GradientNormOperator; typedef tnlConstantFunction< Dimensions, RealType > RightHandSide; typedef tnlEikonalOperator< GradientNormOperator, RightHandSide > Operator; typedef HamiltonJacobiProblem< MeshType, Operator, BoundaryConditions, RightHandSide > Solver; return solverStarter.template run< Solver >( parameters ); } Loading
examples/hamilton-jacobi/HamiltonJacobiProblem_impl.h +9 −4 Original line number Diff line number Diff line Loading @@ -78,7 +78,9 @@ bool HamiltonJacobiProblem< Mesh,HamiltonJacobi,BoundaryCondition,RightHandSide this -> v. bind( & dofVector. getData()[ 1 * dofs ], dofs ); */ return differentialOperator.init(parameters); differentialOperator.getAnisotropy().setConstant( 1.0 ); //setup( parameters ); differentialOperator.setSmoothing( 1.0 ); return true; } Loading Loading @@ -121,7 +123,7 @@ setInitialCondition( const tnlParameterContainer& parameters, { this->bindDofs( mesh, dofs ); const tnlString& initialConditionFile = parameters.getParameter< tnlString >( "initial-condition" ); if( ! this->solution.load( initialConditionFile ) ) if( ! this->solution.boundLoad( initialConditionFile ) ) { cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl; return false; Loading Loading @@ -191,4 +193,7 @@ getExplicitRHS( const RealType& time, this->rightHandSide, u, fu ); //fu.save( "fu.tnl" ); //std::cerr << "Enter." << std::endl; //getchar(); }
src/functions/CMakeLists.txt +2 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ SET( headers tnlConstantFunction.h tnlParaboloidSDF_impl.h tnlSDFSchemeTest_impl.h tnlSDFSign_impl.h tnlSDFGridValue_impl.h ) tnlSDFGridValue_impl.h tnlFunctions.h ) SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/functions ) set( common_SOURCES Loading
src/functions/tnlFunctions.h 0 → 100644 +41 −0 Original line number Diff line number Diff line /* * File: tnlFunctions.h * Author: oberhuber * * Created on July 11, 2016, 6:01 PM */ #ifndef TNLFUNCTIONS_H #define TNLFUNCTIONS_H #include <core/tnlCuda.h> template< typename Real > __cuda_callable__ Real sign( const Real& x, const Real& smoothing = 0.0 ) { if( x > smoothing ) return 1.0; else if( x < -smoothing ) return -1.0; if( smoothing == 0.0 ) return 0.0; return sin( ( M_PI * x ) / ( 2.0 * smoothing ) ); } template< typename Real > __cuda_callable__ Real positivePart( const Real& arg) { return arg > 0.0 ? arg : 0.0; } template< typename Real > __cuda_callable__ Real negativePart( const Real& arg) { return arg < 0.0 ? arg : 0.0; } #endif /* TNLFUNCTIONS_H */