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

Fixing the fast marching method.

parent bf0e7caa
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ updateCell( MeshFunctionType& u,
       fabs( a - b ) >= h )
   {
      tmp = ArgAbsMin( a, b ) + Sign( value ) * h;
         std::cerr << "a = " << a << " b = " << b << " h = " << 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           
@@ -156,7 +156,9 @@ updateCell( MeshFunctionType& u,
      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
+65 −60
Original line number Diff line number Diff line
@@ -64,10 +64,14 @@ solve( const MeshType& mesh,
   interfaceMap.setMesh( mesh );
   std::cout << "Initiating the interface cells ..." << std::endl;
   BaseType::initInterface( u, aux, interfaceMap );
   aux.save( "aux-ini.tnl" );
   //aux.save( "aux-ini.tnl" );

   typename MeshType::Cell cell( mesh );
   
   IndexType iteration( 0 );
   while( iteration < this->maxIterations )
   {

      for( cell.getCoordinates().y() = 0;
           cell.getCoordinates().y() < mesh.getDimensions().y();
           cell.getCoordinates().y()++ )
@@ -76,15 +80,14 @@ solve( const MeshType& mesh,
              cell.getCoordinates().x() < mesh.getDimensions().x();
              cell.getCoordinates().x()++ )
            {
            //std::cerr << "1 -> ";
               cell.refresh();
               if( ! interfaceMap( cell ) )
                  this->updateCell( aux, cell );
            }
      }
   aux.save( "aux-1.tnl" );
      //aux.save( "aux-1.tnl" );

   /*for( cell.getCoordinates().y() = 0;
      for( cell.getCoordinates().y() = 0;
           cell.getCoordinates().y() < mesh.getDimensions().y();
           cell.getCoordinates().y()++ )
      {
@@ -98,7 +101,7 @@ solve( const MeshType& mesh,
                  this->updateCell( aux, cell );
            }
      }
   aux.save( "aux-2.tnl" );
      //aux.save( "aux-2.tnl" );

      for( cell.getCoordinates().y() = mesh.getDimensions().y() - 1;
           cell.getCoordinates().y() >= 0 ;
@@ -114,7 +117,7 @@ solve( const MeshType& mesh,
                  this->updateCell( aux, cell );
            }
         }
   aux.save( "aux-3.tnl" );
      //aux.save( "aux-3.tnl" );


      for( cell.getCoordinates().y() = mesh.getDimensions().y() - 1;
@@ -131,6 +134,8 @@ solve( const MeshType& mesh,
                  this->updateCell( aux, cell );
            }
         }   
   aux.save( "aux-4.tnl" );*/
      //aux.save( "aux-4.tnl" );
      iteration++;
   }
}
+9 −9
Original line number Diff line number Diff line
@@ -68,29 +68,29 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject

   void setDimensions( const CoordinatesType& dimensions );

   __cuda_callable__ inline
   __cuda_callable__
   const CoordinatesType& getDimensions() const;

   void setDomain( const VertexType& origin,
                   const VertexType& proportions );

   __cuda_callable__
   inline const VertexType& getOrigin() const;
   const VertexType& getOrigin() const;

   __cuda_callable__
   inline const VertexType& getProportions() const;
   const VertexType& getProportions() const;
   
   template< typename EntityType >
   __cuda_callable__
   inline IndexType getEntitiesCount() const;
   IndexType getEntitiesCount() const;
   
   template< typename EntityType >
   __cuda_callable__
   inline EntityType getEntity( const IndexType& entityIndex ) const;
   EntityType getEntity( const IndexType& entityIndex ) const;
   
   template< typename EntityType >
   __cuda_callable__
   inline Index getEntityIndex( const EntityType& entity ) const;
   Index getEntityIndex( const EntityType& entity ) const;
   
   template< typename EntityType >
   __cuda_callable__
@@ -100,14 +100,14 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject
   RealType getCellMeasure() const;
   
   __cuda_callable__
   inline VertexType getSpaceSteps() const;
   const VertexType& getSpaceSteps() const;

   template< int xPow >
   __cuda_callable__
   inline const RealType& getSpaceStepsProducts() const;
   const RealType& getSpaceStepsProducts() const;
   
   __cuda_callable__
   inline RealType getSmallestSpaceStep() const;
   RealType getSmallestSpaceStep() const;


   template< typename GridFunction >
+1 −1
Original line number Diff line number Diff line
@@ -232,7 +232,7 @@ template< typename Real,
          typename Device,
          typename Index >
__cuda_callable__ inline
typename tnlGrid< 1, Real, Device, Index >::VertexType
const typename tnlGrid< 1, Real, Device, Index >::VertexType&
tnlGrid< 1, Real, Device, Index >::
getSpaceSteps() const
{
+10 −13
Original line number Diff line number Diff line
@@ -15,8 +15,7 @@
 *                                                                         *
 ***************************************************************************/

#ifndef SRC_MESH_TNLGRID2D_H_
#define SRC_MESH_TNLGRID2D_H_
#pragma once

#include <mesh/tnlGrid.h>
#include <mesh/grids/tnlGridEntityTopology.h>
@@ -66,27 +65,27 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject
   void setDimensions( const CoordinatesType& dimensions );

   __cuda_callable__
   inline const CoordinatesType& getDimensions() const;
   const CoordinatesType& getDimensions() const;

   void setDomain( const VertexType& origin,
                   const VertexType& proportions );
   __cuda_callable__
   inline const VertexType& getOrigin() const;
   const VertexType& getOrigin() const;

   __cuda_callable__
   inline const VertexType& getProportions() const;
   const VertexType& getProportions() const;

   template< typename EntityType >
   __cuda_callable__
   inline IndexType getEntitiesCount() const;
   IndexType getEntitiesCount() const;
   
   template< typename EntityType >
   __cuda_callable__
   inline EntityType getEntity( const IndexType& entityIndex ) const;
   EntityType getEntity( const IndexType& entityIndex ) const;
   
   template< typename EntityType >
   __cuda_callable__
   inline Index getEntityIndex( const EntityType& entity ) const;
   Index getEntityIndex( const EntityType& entity ) const;

   template< typename EntityType >
   __cuda_callable__
@@ -96,14 +95,14 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject
   RealType getCellMeasure() const;
   
   __cuda_callable__
   inline VertexType getSpaceSteps() const;
   const VertexType& getSpaceSteps() const;

   template< int xPow, int yPow >
   __cuda_callable__
   inline const RealType& getSpaceStepsProducts() const;
   const RealType& getSpaceStepsProducts() const;
   
   __cuda_callable__
   inline RealType getSmallestSpaceStep() const;
   RealType getSmallestSpaceStep() const;

   
   template< typename GridFunction >
@@ -162,5 +161,3 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject
};

#include <mesh/grids/tnlGrid2D_impl.h>

#endif /* SRC_MESH_TNLGRID2D_H_ */
Loading