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

Refactoring grid.

parent 3cde9e64
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -291,13 +291,31 @@ typename Vector1 :: RealType tnlVectorOperations< tnlHost > :: getScalarProduct(
   tnlAssert( v1. getSize() > 0, );
   tnlAssert( v1. getSize() == v2. getSize(), );

   Real result = 0;
   Real result( 0.0 );
   const Index n = v1. getSize();
#ifdef HAVE_OPENMP
  #pragma omp parallel for reduction(+:result) if( n > OpenMPVectorOperationsThreshold ) // TODO: check this threshold
#endif     
   for( Index i = 0; i < n; i++ )
      result += v1[ i ] * v2[ i ];
   /*Real result1( 0.0 ), result2( 0.0 ), result3( 0.0 ), result4( 0.0 ),
        result5( 0.0 ), result6( 0.0 ), result7( 0.0 ), result8( 0.0 );
   Index i( 0 );
   while( i + 8 < n )
   {
      result1 += v1[ i ] * v2[ i ];
      result2 += v1[ i + 1 ] * v2[ i + 1 ];
      result3 += v1[ i + 2 ] * v2[ i + 2 ];
      result4 += v1[ i + 3 ] * v2[ i + 3 ];
      result5 += v1[ i + 4 ] * v2[ i + 4 ];
      result6 += v1[ i + 5 ] * v2[ i + 5 ];
      result7 += v1[ i + 6 ] * v2[ i + 6 ];
      result8 += v1[ i + 7 ] * v2[ i + 7 ];
      i += 8;
   }
   Real result = result1 + result2 + result3 + result4 + result5 +result6 +result7 +result8;
   while( i < n )
      result += v1[ i ] * v2[ i++ ];*/
   return result;
}

+2 −1
Original line number Diff line number Diff line
@@ -114,9 +114,10 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject
   
   

   template< int dx >
   /*template< int dx >
   __cuda_callable__
   inline IndexType getCellNextToCell( const IndexType& cellIndex ) const;
    */

   __cuda_callable__
   inline const RealType& getHx() const;
+2 −2
Original line number Diff line number Diff line
@@ -245,7 +245,7 @@ getNeighbourEntities( const GridEntityType& entity ) const



template< typename Real,
/*template< typename Real,
          typename Device,
          typename Index >
   template< int dx >
@@ -258,7 +258,7 @@ Index tnlGrid< 1, Real, Device, Index > :: getCellNextToCell( const IndexType& c
                   << " dx = " << dx
                   << " this->template getEntitiesCount< Cells >() = " << this->template getEntitiesCount< Cells >() );
   return cellIndex + dx;
}
}*/

template< typename Real,
          typename Device,
+2 −2
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ class tnlGrid< 3, Real, Device, Index > : public tnlObject
   
   
   
   template< int dx, int dy, int dz >
   /*template< int dx, int dy, int dz >
   __cuda_callable__
   inline IndexType getCellNextToCell( const IndexType& cellIndex ) const;

@@ -114,7 +114,7 @@ class tnlGrid< 3, Real, Device, Index > : public tnlObject

   template< int nx, int ny, int nz >
   __cuda_callable__
   inline IndexType getCellNextToFace( const IndexType& cellIndex ) const;
   inline IndexType getCellNextToFace( const IndexType& cellIndex ) const;*/

   __cuda_callable__
   inline const RealType& getHx() const;
+5 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <iomanip>
#include <core/tnlAssert.h>
#include <mesh/grids/tnlGridEntityGetter_impl.h>
#include <mesh/grids/tnlNeighbourGridEntityGetter3D_impl.h>
#include <mesh/grids/tnlGrid3D.h>

template< typename Real,
@@ -280,7 +281,7 @@ Vertex tnlGrid< 3, Real, Device, Index > :: getEntityCenter( const GridEntity< E
}


template< typename Real,
/*template< typename Real,
          typename Device,
          typename Index >
   template< int dx, int dy, int dz >
@@ -343,7 +344,7 @@ Index tnlGrid< 3, Real, Device, Index >::getCellNextToFace( const IndexType& fac
#ifndef NDEBUG
   int _nx, _ny, _nz;
#endif
   /*tnlAssert( ( nx + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() >= 0 &&
   tnlAssert( ( nx + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() >= 0 &&
                nx + this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() <= this->getDimensions().x() ),
              cerr << " nx = " << nx
                   << " this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x() = " << this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).x()
@@ -358,7 +359,7 @@ Index tnlGrid< 3, Real, Device, Index >::getCellNextToFace( const IndexType& fac
              cerr << " nz = " << nz
                   << " this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z() = " << this->getFaceCoordinates( faceIndex, _nx, _ny, _nz ).z()
                   << " this->getDimensions().z()  = " << this->getDimensions().z() );
   */
   

   IndexType result;
   if( nx )
@@ -378,7 +379,7 @@ Index tnlGrid< 3, Real, Device, Index >::getCellNextToFace( const IndexType& fac
                   << " nz = " << nz
                   << " this->template getEntitiesCount< Cells >() = " << this->template getEntitiesCount< Cells >() );
   return result;
}
}*/

template< typename Real,
          typename Device,
Loading