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

Refactoring the fast sweeping method.

parent b089877e
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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 );
@@ -69,6 +70,8 @@ class tnlDirectEikonalProblem
         
         MeshFunctionType u;
         
         MeshFunctionType initialData;

};

#include "tnlDirectEikonalProblem_impl.h"
+17 −2
Original line number Diff line number Diff line
@@ -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
+58 −0
Original line number Diff line number Diff line
/*
 * 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"
+62 −0
Original line number Diff line number Diff line
/*
 * 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 )
{
   
}