Commit 8e9cde1d authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Refactoring the eikonal solver.

parent f0651446
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 );
      }
};
+5 −3
Original line number Diff line number Diff line
@@ -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,
@@ -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 );
      }
+9 −4
Original line number Diff line number Diff line
@@ -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;

}

@@ -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;
@@ -191,4 +193,7 @@ getExplicitRHS( const RealType& time,
	                                                            this->rightHandSide,
	                                                            u,
	                                                            fu );
   //fu.save( "fu.tnl" );
   //std::cerr << "Enter." << std::endl;
   //getchar();
}
+2 −1
Original line number Diff line number Diff line
@@ -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
+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