diff --git a/examples/hamilton-jacobi/tnlDirectEikonalProblem.h b/examples/hamilton-jacobi/tnlDirectEikonalProblem.h index 7de0ceed4cb45eb0800fc6423328b1511dae5ef7..654c775ea9bc0d05a23722ec7b6b641db7123f9e 100644 --- a/examples/hamilton-jacobi/tnlDirectEikonalProblem.h +++ b/examples/hamilton-jacobi/tnlDirectEikonalProblem.h @@ -15,6 +15,7 @@ #include <problems/tnlPDEProblem.h> #include <functions/tnlMeshFunction.h> +#include "tnlFastSweepingMethod.h" template< typename Mesh, typename Anisotropy, @@ -59,7 +60,7 @@ class tnlDirectEikonalProblem bool setInitialData( const tnlParameterContainer& parameters, const MeshType& mesh, DofVectorType& dofs, - MeshDependentData& meshdependentData ) + MeshDependentDataType& meshdependentData ); bool solve( const MeshType& mesh, DofVectorType& dosf ); @@ -68,7 +69,9 @@ class tnlDirectEikonalProblem protected: MeshFunctionType u; + + MeshFunctionType initialData; }; -#include "tnlDirectEikonalProblem_impl.h" \ No newline at end of file +#include "tnlDirectEikonalProblem_impl.h" diff --git a/examples/hamilton-jacobi/tnlDirectEikonalProblem_impl.h b/examples/hamilton-jacobi/tnlDirectEikonalProblem_impl.h index f3b2259c9cf88f2e17f2d993f09c0873eceed2ae..1a9f7bcf46ecb26113fbb626b84b588e43c501f0 100644 --- a/examples/hamilton-jacobi/tnlDirectEikonalProblem_impl.h +++ b/examples/hamilton-jacobi/tnlDirectEikonalProblem_impl.h @@ -77,7 +77,7 @@ Index tnlDirectEikonalProblem< Mesh, Anisotropy, Real, Index >:: getDofs( const MeshType& mesh ) const { - + return mesh.getEntitiesCount(); } template< typename Mesh, @@ -89,16 +89,31 @@ tnlDirectEikonalProblem< Mesh, Anisotropy, Real, Index >:: bindDofs( const MeshType& mesh, const DofVectorType& dofs ) { + this->u.bind( mesh, dofs ); +} + +bool +setInitialData( const tnlParameterContainer& parameters, + const MeshType& mesh, + DofVectorType& dofs, + MeshDependentDataType& meshdependentData ) +{ + tnlString inputFile = parameters.getParameter< tnlString >( "input-file" ); + this->initialData.setMesh( mesh ); + if( !this->initialData.boundLoad( inputFile ) ) + return false; } + template< typename Mesh, typename Anisotropy, typename Real, typename Index > bool tnlDirectEikonalProblem< Mesh, Anisotropy, Real, Index >:: -solve() +solve( const MeshType& mesh, + DofVectorType& dosf ) { } \ No newline at end of file diff --git a/examples/hamilton-jacobi/tnlFastSweepingMethod.h b/examples/hamilton-jacobi/tnlFastSweepingMethod.h new file mode 100644 index 0000000000000000000000000000000000000000..0234111ea59b35048d05fd373fad8681ab61fda7 --- /dev/null +++ b/examples/hamilton-jacobi/tnlFastSweepingMethod.h @@ -0,0 +1,58 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * File: tnlFastSweepingMethod.h + * Author: oberhuber + * + * Created on July 14, 2016, 10:04 AM + */ + +#pragma once + +#include <mesh/tnlGrid.h> +#include <functions/tnlConstantFunction.h> + +template< typename Mesh, + typename Anisotropy = tnlConstantFunction< Mesh::getMeshDimensions(), typename Mesh::RealType > +class tnlFastSweepingMethod +{ +}; + +template< typename Real, + typename Device, + typename Index, + typename Anisotropy > +class tnlFastSweepingMethod< tnlGrid< 2, Real, Device, Index >, Anisotropy > +{ + static_assert( std::is_same< Device, tnlHost >::value, "The fast sweeping method works only on CPU." ); + + public: + + typedef tnlGrid< 2, Real, Device, Index > MeshType; + typedef Real RealType; + typedef tnlHost DeviceType; + typedef Index IndexType; + typedef Anisotropy AnisotropyType; + typedef tnlMeshFunction< MeshType > MeshFunctionType; + + tnlFastSweepingMethod(); + + const IndexType& getMaxIterations() const; + + void setMaxIterations( const IndexType& maxIterations ); + + void solve( const MeshType& mesh, + const AnisotropyType& anisotropy, + MeshFunctionType& u ); + + + protected: + + const IndexType maxIterations; +}; + +#include "tnlFastSweepingMethod2D_impl.h" diff --git a/examples/hamilton-jacobi/tnlFastSweepingMethod2D_impl.h b/examples/hamilton-jacobi/tnlFastSweepingMethod2D_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..1959be39fa9220aac4f472b9f480ecad4b874b16 --- /dev/null +++ b/examples/hamilton-jacobi/tnlFastSweepingMethod2D_impl.h @@ -0,0 +1,62 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * File: tnlFastSweepingMethod2D_impl.h + * Author: oberhuber + * + * Created on July 14, 2016, 10:32 AM + */ + +#pragma once + +#include "tnlFastSweepingMethod.h" + +template< typename Real, + typename Device, + typename Index, + typename Anisotropy > +tnlFastSweepingMethod< tnlGrid< 2, Real, Device, Index >, Anisotropy >:: +tnlFastSweepingMethod() +{ + +} + +template< typename Real, + typename Device, + typename Index, + typename Anisotropy > +const Index& +tnlFastSweepingMethod< tnlGrid< 2, Real, Device, Index >, Anisotropy >:: +getMaxIterations() const +{ + +} + +template< typename Real, + typename Device, + typename Index, + typename Anisotropy > +void +tnlFastSweepingMethod< tnlGrid< 2, Real, Device, Index >, Anisotropy >:: +setMaxIterations( const IndexType& maxIterations ) +{ + +} + +template< typename Real, + typename Device, + typename Index, + typename Anisotropy > +void +tnlFastSweepingMethod< tnlGrid< 2, Real, Device, Index >, Anisotropy >:: +solve( const MeshType& mesh, + const AnisotropyType& anisotropy, + MeshFunctionType& u ) +{ + +} +