Loading src/functors/tnlFunctionDiscretizer_impl.h +1 −2 Original line number Diff line number Diff line Loading @@ -32,8 +32,7 @@ void tnlFunctionDiscretizer< Mesh, Function, Vector >::discretize( const Mesh& m { while( i < mesh.template getEntitiesCount< Mesh::Cells >() ) { VertexType v; v = mesh.template getEntityCenter< Mesh::Dimensions, VertexType >( mesh.template getEntity< Mesh::Dimensions >( i ) ); VertexType v = mesh.template getEntity< Mesh::Cells >( i ).getCenter(); discreteFunction[ i ] = function.template getValue< XDiffOrder, YDiffOrder, ZDiffOrder >( v, time ); i++; } Loading src/mesh/grids/tnlBoundaryGridEntityChecker.h 0 → 100644 +210 −0 Original line number Diff line number Diff line /*************************************************************************** tnlBoundaryGridEntityChecker.h - description ------------------- begin : Dec 2, 2015 copyright : (C) 2015 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLBOUNDARYGRIDENTITYCHECKER_H #define TNLBOUNDARYGRIDENTITYCHECKER_H template< typename GridEntity > class tnlBoundaryGridEntityChecker { }; /*** * 1D grids */ template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 1 > > { public: typedef tnlGrid< 1, Real, Device, Index > GridType; typedef tnlGridEntity< GridType,1 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - 1 ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 0 > > { public: typedef tnlGrid< 1, Real, Device, Index > GridType; typedef tnlGridEntity< GridType,1 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() ); } }; /**** * 2D grids */ template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 2 > > { public: typedef tnlGrid< 2, Real, Device, Index > GridType; typedef tnlGridEntity< GridType, 2 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - 1 || entity.getCoordinates().y() == entity.grid.getDimensions().y() - 1 ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 1 > > { public: typedef tnlGrid< 2, Real, Device, Index > GridType; typedef tnlGridEntity< GridType,2 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - entity.getBasis().x() || entity.getCoordinates().y() == entity.grid.getDimensions().y() - entity.getBasis().y() ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 0 > > { public: typedef tnlGrid< 2, Real, Device, Index > GridType; typedef tnlGridEntity< GridType,2 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() || entity.getCoordinates().y() == entity.grid.getDimensions().y() ); } }; /*** * 3D grid */ template< typename Real, typename Device, typename Index, int EntityDimensions > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, EntityDimensions > > { public: typedef tnlGrid< 3, Real, Device, Index > GridType; typedef tnlGridEntity< GridType, 3 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().z() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - entity.getBasis().x() || entity.getCoordinates().y() == entity.grid.getDimensions().y() - entity.getBasis().y() || entity.getCoordinates().z() == entity.grid.getDimensions().z() - entity.getBasis().z() ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3 > > { public: typedef tnlGrid< 3, Real, Device, Index > GridType; typedef tnlGridEntity< GridType, 3 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().z() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - 1 || entity.getCoordinates().y() == entity.grid.getDimensions().y() - 1 || entity.getCoordinates().z() == entity.grid.getDimensions().z() - 1 ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 0 > > { public: typedef tnlGrid< 3, Real, Device, Index > GridType; typedef tnlGridEntity< GridType, 3 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().z() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() || entity.getCoordinates().y() == entity.grid.getDimensions().y() || entity.getCoordinates().z() == entity.grid.getDimensions().z() ); } }; #endif /* TNLBOUNDARYGRIDENTITYCHECKER_H */ src/mesh/grids/tnlGrid1D.h +4 −37 Original line number Diff line number Diff line Loading @@ -91,34 +91,11 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject __cuda_callable__ inline Index getEntityIndex( const GridEntity< EntityDimensions >& entity ) const; /**** * The type Vertex can have different Real type. */ #ifdef HAVE_NOT_CXX11 template< int EntityDimensions , typename Vertex > #else template< int EntityDimensions, typename Vertex = VertexType > #endif __cuda_callable__ inline Vertex getEntityCenter( const GridEntity< EntityDimensions >& entity ) const; template< typename GridEntity, int NeighbourEntityDimensions = GridEntity::entityDimensions > __cuda_callable__ inline tnlNeighbourGridEntityGetter< GridEntity, NeighbourEntityDimensions > getNeighbourEntities( const GridEntity& entity ) const; inline VertexType getSpaceSteps() const; /*template< int dx > __cuda_callable__ inline IndexType getCellNextToCell( const IndexType& cellIndex ) const; */ __cuda_callable__ inline const RealType& getHx() const; Loading @@ -135,18 +112,6 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject inline RealType getSmallestSpaceStep() const; __cuda_callable__ inline Index getNumberOfVertices() const; __cuda_callable__ inline bool isBoundaryCell( const CoordinatesType& cellCoordinates ) const; __cuda_callable__ inline bool isBoundaryCell( const IndexType& cellIndex ) const; __cuda_callable__ inline bool isBoundaryVertex( const CoordinatesType& vertexCoordinates ) const; template< typename GridFunction > typename GridFunction::RealType getDifferenceAbsMax( const GridFunction& f1, const GridFunction& f2 ) const; Loading Loading @@ -190,7 +155,9 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject IndexType numberOfCells, numberOfVertices; RealType hx, hxSquare, hxInverse, hxSquareInverse; VertexType spaceSteps, spaceStepsSquare, spaceStepsInverse, spaceStepsSquareInverse; //RealType hx, hxSquare, hxInverse, hxSquareInverse; }; Loading src/mesh/grids/tnlGrid1D_impl.h +2 −147 Original line number Diff line number Diff line Loading @@ -211,6 +211,7 @@ getEntityIndex( const GridEntity< EntityDimensions >& entity ) const return tnlGridEntityGetter< ThisType, EntityDimensions >::getEntityIndex( *this, entity ); } /* template< typename Real, typename Device, typename Index > Loading Loading @@ -241,25 +242,9 @@ getNeighbourEntities( const GridEntityType& entity ) const { return tnlNeighbourGridEntityGetter< GridEntityType, NeighbourEntityDimensions >( *this, entity ); } */ /*template< typename Real, typename Device, typename Index > template< int dx > __cuda_callable__ inline Index tnlGrid< 1, Real, Device, Index > :: getCellNextToCell( const IndexType& cellIndex ) const { tnlAssert( cellIndex + dx >= 0 && cellIndex + dx < this->template getEntitiesCount< Cells >(), cerr << " cellIndex = " << cellIndex << " dx = " << dx << " this->template getEntitiesCount< Cells >() = " << this->template getEntitiesCount< Cells >() ); return cellIndex + dx; }*/ template< typename Real, typename Device, typename Index > Loading Loading @@ -305,136 +290,6 @@ Real tnlGrid< 1, Real, Device, Index > :: getSmallestSpaceStep() const return this->hx; } /*template< typename Real, typename Device, typename Index > template< typename EntityTopology, typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index > :: getEntityCenter( const CoordinatesType& coordinates ) const { static_assert( EntityTopology::entityDimensions <= 1 && EntityTopology::entityDimensions >= 0, "Wrong grid entity dimensions." ); tnlAssert( coordinates.x() >= 0 && coordinates.x() <= this->getDimensions().x() - EntityTopology::EntityProportions::i1, cerr << "coordinates.x() = " << coordinates.x() << " this->getDimensions().x() = " << this->getDimensions().x() << " EntityTopology::EntityProportions::i1 = " << EntityTopology::EntityProportions::i1 ); return this->origin.x() + ( coordinates.x() + 0.5 * EntityTopology::EntityProportions::i1 ) * this->cellProportions.x(); } template< typename Real, typename Device, typename Index > template< typename EntityTopology, typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index > :: getEntityCenter( const IndexType& index ) const { static_assert( EntityTopology::entityDimensions <= 1 && EntityTopology::entityDimensions >= 0, "Wrong grid entity dimensions." ); // TODO: add assertions if( EntityTopology::entityDimensions == Dimensions ) return this->getCellCenter( index ); if( EntityTopology::entityDimensions == Dimensions - 1 ) return this->template getVertex( index ); } template< typename Real, typename Device, typename Index > template< typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index >::getCellCenter( const CoordinatesType& cellCoordinates ) const { tnlAssert( cellCoordinates.x() >= 0 && cellCoordinates.x() < this->getDimensions().x(), cerr << "cellCoordinates.x() = " << cellCoordinates.x() << " this->getDimensions().x() = " << this->getDimensions().x() ); return this->origin.x() + ( cellCoordinates.x() + 0.5 ) * this->cellProportions.x(); } template< typename Real, typename Device, typename Index > template< typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index >::getCellCenter( const IndexType& cellIndex ) const { tnlAssert( cellIndex >= 0 && cellIndex < this->template getEntitiesCount< Cells >(), cerr << " cellIndex = " << cellIndex << " this->template getEntitiesCount< Cells >() = " << this->template getEntitiesCount< Cells >() ); return this->getCellCenter< VertexType >( this->getCellCoordinates( cellIndex ) ); } template< typename Real, typename Device, typename Index > template< typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index >::getVertex( const CoordinatesType& vertexCoordinates ) const { tnlAssert( vertexCoordinates.x() >= 0 && vertexCoordinates.x() < this->getDimensions().x() + 1, cerr << "vertexCoordinates.x() = " << vertexCoordinates.x() << " this->getDimensions().x() = " << this->getDimensions().x() ); return Vertex( this->origin.x() + vertexCoordinates.x() * this->cellProportions.x() ); } */ template< typename Real, typename Device, typename Index > __cuda_callable__ inline Index tnlGrid< 1, Real, Device, Index > :: getNumberOfVertices() const { return this->numberOfVertices; }; template< typename Real, typename Device, typename Index > __cuda_callable__ inline bool tnlGrid< 1, Real, Device, Index > :: isBoundaryCell( const CoordinatesType& cellCoordinates ) const { tnlAssert( cellCoordinates.x() >= 0 && cellCoordinates.x() < this->getDimensions().x(), cerr << "cellCoordinates.x() = " << cellCoordinates.x() << " this->getDimensions().x() = " << this->getDimensions().x() ); if( cellCoordinates.x() == 0 || cellCoordinates.x() == this->getDimensions().x() - 1 ) return true; return false; } template< typename Real, typename Device, typename Index > __cuda_callable__ inline bool tnlGrid< 1, Real, Device, Index >:: isBoundaryCell( const IndexType& cellIndex ) const { tnlAssert( cellIndex >= 0 && cellIndex < this->template getEntitiesCount< Cells >(), cerr << " cellIndex = " << cellIndex << " this->template getEntitiesCount< Cells >() = " << this->template getEntitiesCount< Cells >() ); return this->isBoundaryCell( this->template getEntity< Cells >( cellIndex ).getCoordinates() ); } template< typename Real, typename Device, typename Index > __cuda_callable__ inline bool tnlGrid< 1, Real, Device, Index > :: isBoundaryVertex( const CoordinatesType& vertexCoordinates ) const { tnlAssert( vertexCoordinates.x() >= 0 && vertexCoordinates.x() < this->getDimensions().x() + 1, cerr << "vertexCoordinates.x() = " << vertexCoordinates.x() << " this->getDimensions().x() + 1 = " << this->getDimensions().x() + 1 ); if( vertexCoordinates.x() == 0 || vertexCoordinates.x() == this->getDimensions().x() ) return true; return false; } template< typename Real, typename Device, typename Index > Loading src/mesh/grids/tnlGrid2D.h +0 −13 Original line number Diff line number Diff line Loading @@ -142,19 +142,6 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject __cuda_callable__ inline bool isBoundaryCell( const CoordinatesType& cellCoordinates ) const; __cuda_callable__ inline bool isBoundaryCell( const IndexType& cellIndex ) const; template< int nx, int ny > __cuda_callable__ inline bool isBoundaryFace( const CoordinatesType& faceCoordinates ) const; __cuda_callable__ inline bool isBoundaryVertex( const CoordinatesType& vertexCoordinates ) const; template< typename GridFunction > typename GridFunction::RealType getAbsMax( const GridFunction& f ) const; Loading Loading
src/functors/tnlFunctionDiscretizer_impl.h +1 −2 Original line number Diff line number Diff line Loading @@ -32,8 +32,7 @@ void tnlFunctionDiscretizer< Mesh, Function, Vector >::discretize( const Mesh& m { while( i < mesh.template getEntitiesCount< Mesh::Cells >() ) { VertexType v; v = mesh.template getEntityCenter< Mesh::Dimensions, VertexType >( mesh.template getEntity< Mesh::Dimensions >( i ) ); VertexType v = mesh.template getEntity< Mesh::Cells >( i ).getCenter(); discreteFunction[ i ] = function.template getValue< XDiffOrder, YDiffOrder, ZDiffOrder >( v, time ); i++; } Loading
src/mesh/grids/tnlBoundaryGridEntityChecker.h 0 → 100644 +210 −0 Original line number Diff line number Diff line /*************************************************************************** tnlBoundaryGridEntityChecker.h - description ------------------- begin : Dec 2, 2015 copyright : (C) 2015 by Tomas Oberhuber email : tomas.oberhuber@fjfi.cvut.cz ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef TNLBOUNDARYGRIDENTITYCHECKER_H #define TNLBOUNDARYGRIDENTITYCHECKER_H template< typename GridEntity > class tnlBoundaryGridEntityChecker { }; /*** * 1D grids */ template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 1 > > { public: typedef tnlGrid< 1, Real, Device, Index > GridType; typedef tnlGridEntity< GridType,1 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - 1 ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 1, Real, Device, Index >, 0 > > { public: typedef tnlGrid< 1, Real, Device, Index > GridType; typedef tnlGridEntity< GridType,1 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() ); } }; /**** * 2D grids */ template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 2 > > { public: typedef tnlGrid< 2, Real, Device, Index > GridType; typedef tnlGridEntity< GridType, 2 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - 1 || entity.getCoordinates().y() == entity.grid.getDimensions().y() - 1 ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 1 > > { public: typedef tnlGrid< 2, Real, Device, Index > GridType; typedef tnlGridEntity< GridType,2 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - entity.getBasis().x() || entity.getCoordinates().y() == entity.grid.getDimensions().y() - entity.getBasis().y() ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 2, Real, Device, Index >, 0 > > { public: typedef tnlGrid< 2, Real, Device, Index > GridType; typedef tnlGridEntity< GridType,2 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() || entity.getCoordinates().y() == entity.grid.getDimensions().y() ); } }; /*** * 3D grid */ template< typename Real, typename Device, typename Index, int EntityDimensions > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, EntityDimensions > > { public: typedef tnlGrid< 3, Real, Device, Index > GridType; typedef tnlGridEntity< GridType, 3 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().z() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - entity.getBasis().x() || entity.getCoordinates().y() == entity.grid.getDimensions().y() - entity.getBasis().y() || entity.getCoordinates().z() == entity.grid.getDimensions().z() - entity.getBasis().z() ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 3 > > { public: typedef tnlGrid< 3, Real, Device, Index > GridType; typedef tnlGridEntity< GridType, 3 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().z() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() - 1 || entity.getCoordinates().y() == entity.grid.getDimensions().y() - 1 || entity.getCoordinates().z() == entity.grid.getDimensions().z() - 1 ); } }; template< typename Real, typename Device, typename Index > class tnlBoundaryGridEntityChecker< tnlGridEntity< tnlGrid< 3, Real, Device, Index >, 0 > > { public: typedef tnlGrid< 3, Real, Device, Index > GridType; typedef tnlGridEntity< GridType, 3 > GridEntityType; __cuda_callable__ inline static bool isBoundaryEntity( const GridEntityType& entity ) { return( entity.getCoordinates().x() == 0 || entity.getCoordinates().y() == 0 || entity.getCoordinates().z() == 0 || entity.getCoordinates().x() == entity.grid.getDimensions().x() || entity.getCoordinates().y() == entity.grid.getDimensions().y() || entity.getCoordinates().z() == entity.grid.getDimensions().z() ); } }; #endif /* TNLBOUNDARYGRIDENTITYCHECKER_H */
src/mesh/grids/tnlGrid1D.h +4 −37 Original line number Diff line number Diff line Loading @@ -91,34 +91,11 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject __cuda_callable__ inline Index getEntityIndex( const GridEntity< EntityDimensions >& entity ) const; /**** * The type Vertex can have different Real type. */ #ifdef HAVE_NOT_CXX11 template< int EntityDimensions , typename Vertex > #else template< int EntityDimensions, typename Vertex = VertexType > #endif __cuda_callable__ inline Vertex getEntityCenter( const GridEntity< EntityDimensions >& entity ) const; template< typename GridEntity, int NeighbourEntityDimensions = GridEntity::entityDimensions > __cuda_callable__ inline tnlNeighbourGridEntityGetter< GridEntity, NeighbourEntityDimensions > getNeighbourEntities( const GridEntity& entity ) const; inline VertexType getSpaceSteps() const; /*template< int dx > __cuda_callable__ inline IndexType getCellNextToCell( const IndexType& cellIndex ) const; */ __cuda_callable__ inline const RealType& getHx() const; Loading @@ -135,18 +112,6 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject inline RealType getSmallestSpaceStep() const; __cuda_callable__ inline Index getNumberOfVertices() const; __cuda_callable__ inline bool isBoundaryCell( const CoordinatesType& cellCoordinates ) const; __cuda_callable__ inline bool isBoundaryCell( const IndexType& cellIndex ) const; __cuda_callable__ inline bool isBoundaryVertex( const CoordinatesType& vertexCoordinates ) const; template< typename GridFunction > typename GridFunction::RealType getDifferenceAbsMax( const GridFunction& f1, const GridFunction& f2 ) const; Loading Loading @@ -190,7 +155,9 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject IndexType numberOfCells, numberOfVertices; RealType hx, hxSquare, hxInverse, hxSquareInverse; VertexType spaceSteps, spaceStepsSquare, spaceStepsInverse, spaceStepsSquareInverse; //RealType hx, hxSquare, hxInverse, hxSquareInverse; }; Loading
src/mesh/grids/tnlGrid1D_impl.h +2 −147 Original line number Diff line number Diff line Loading @@ -211,6 +211,7 @@ getEntityIndex( const GridEntity< EntityDimensions >& entity ) const return tnlGridEntityGetter< ThisType, EntityDimensions >::getEntityIndex( *this, entity ); } /* template< typename Real, typename Device, typename Index > Loading Loading @@ -241,25 +242,9 @@ getNeighbourEntities( const GridEntityType& entity ) const { return tnlNeighbourGridEntityGetter< GridEntityType, NeighbourEntityDimensions >( *this, entity ); } */ /*template< typename Real, typename Device, typename Index > template< int dx > __cuda_callable__ inline Index tnlGrid< 1, Real, Device, Index > :: getCellNextToCell( const IndexType& cellIndex ) const { tnlAssert( cellIndex + dx >= 0 && cellIndex + dx < this->template getEntitiesCount< Cells >(), cerr << " cellIndex = " << cellIndex << " dx = " << dx << " this->template getEntitiesCount< Cells >() = " << this->template getEntitiesCount< Cells >() ); return cellIndex + dx; }*/ template< typename Real, typename Device, typename Index > Loading Loading @@ -305,136 +290,6 @@ Real tnlGrid< 1, Real, Device, Index > :: getSmallestSpaceStep() const return this->hx; } /*template< typename Real, typename Device, typename Index > template< typename EntityTopology, typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index > :: getEntityCenter( const CoordinatesType& coordinates ) const { static_assert( EntityTopology::entityDimensions <= 1 && EntityTopology::entityDimensions >= 0, "Wrong grid entity dimensions." ); tnlAssert( coordinates.x() >= 0 && coordinates.x() <= this->getDimensions().x() - EntityTopology::EntityProportions::i1, cerr << "coordinates.x() = " << coordinates.x() << " this->getDimensions().x() = " << this->getDimensions().x() << " EntityTopology::EntityProportions::i1 = " << EntityTopology::EntityProportions::i1 ); return this->origin.x() + ( coordinates.x() + 0.5 * EntityTopology::EntityProportions::i1 ) * this->cellProportions.x(); } template< typename Real, typename Device, typename Index > template< typename EntityTopology, typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index > :: getEntityCenter( const IndexType& index ) const { static_assert( EntityTopology::entityDimensions <= 1 && EntityTopology::entityDimensions >= 0, "Wrong grid entity dimensions." ); // TODO: add assertions if( EntityTopology::entityDimensions == Dimensions ) return this->getCellCenter( index ); if( EntityTopology::entityDimensions == Dimensions - 1 ) return this->template getVertex( index ); } template< typename Real, typename Device, typename Index > template< typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index >::getCellCenter( const CoordinatesType& cellCoordinates ) const { tnlAssert( cellCoordinates.x() >= 0 && cellCoordinates.x() < this->getDimensions().x(), cerr << "cellCoordinates.x() = " << cellCoordinates.x() << " this->getDimensions().x() = " << this->getDimensions().x() ); return this->origin.x() + ( cellCoordinates.x() + 0.5 ) * this->cellProportions.x(); } template< typename Real, typename Device, typename Index > template< typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index >::getCellCenter( const IndexType& cellIndex ) const { tnlAssert( cellIndex >= 0 && cellIndex < this->template getEntitiesCount< Cells >(), cerr << " cellIndex = " << cellIndex << " this->template getEntitiesCount< Cells >() = " << this->template getEntitiesCount< Cells >() ); return this->getCellCenter< VertexType >( this->getCellCoordinates( cellIndex ) ); } template< typename Real, typename Device, typename Index > template< typename Vertex > __cuda_callable__ Vertex tnlGrid< 1, Real, Device, Index >::getVertex( const CoordinatesType& vertexCoordinates ) const { tnlAssert( vertexCoordinates.x() >= 0 && vertexCoordinates.x() < this->getDimensions().x() + 1, cerr << "vertexCoordinates.x() = " << vertexCoordinates.x() << " this->getDimensions().x() = " << this->getDimensions().x() ); return Vertex( this->origin.x() + vertexCoordinates.x() * this->cellProportions.x() ); } */ template< typename Real, typename Device, typename Index > __cuda_callable__ inline Index tnlGrid< 1, Real, Device, Index > :: getNumberOfVertices() const { return this->numberOfVertices; }; template< typename Real, typename Device, typename Index > __cuda_callable__ inline bool tnlGrid< 1, Real, Device, Index > :: isBoundaryCell( const CoordinatesType& cellCoordinates ) const { tnlAssert( cellCoordinates.x() >= 0 && cellCoordinates.x() < this->getDimensions().x(), cerr << "cellCoordinates.x() = " << cellCoordinates.x() << " this->getDimensions().x() = " << this->getDimensions().x() ); if( cellCoordinates.x() == 0 || cellCoordinates.x() == this->getDimensions().x() - 1 ) return true; return false; } template< typename Real, typename Device, typename Index > __cuda_callable__ inline bool tnlGrid< 1, Real, Device, Index >:: isBoundaryCell( const IndexType& cellIndex ) const { tnlAssert( cellIndex >= 0 && cellIndex < this->template getEntitiesCount< Cells >(), cerr << " cellIndex = " << cellIndex << " this->template getEntitiesCount< Cells >() = " << this->template getEntitiesCount< Cells >() ); return this->isBoundaryCell( this->template getEntity< Cells >( cellIndex ).getCoordinates() ); } template< typename Real, typename Device, typename Index > __cuda_callable__ inline bool tnlGrid< 1, Real, Device, Index > :: isBoundaryVertex( const CoordinatesType& vertexCoordinates ) const { tnlAssert( vertexCoordinates.x() >= 0 && vertexCoordinates.x() < this->getDimensions().x() + 1, cerr << "vertexCoordinates.x() = " << vertexCoordinates.x() << " this->getDimensions().x() + 1 = " << this->getDimensions().x() + 1 ); if( vertexCoordinates.x() == 0 || vertexCoordinates.x() == this->getDimensions().x() ) return true; return false; } template< typename Real, typename Device, typename Index > Loading
src/mesh/grids/tnlGrid2D.h +0 −13 Original line number Diff line number Diff line Loading @@ -142,19 +142,6 @@ class tnlGrid< 2, Real, Device, Index > : public tnlObject __cuda_callable__ inline bool isBoundaryCell( const CoordinatesType& cellCoordinates ) const; __cuda_callable__ inline bool isBoundaryCell( const IndexType& cellIndex ) const; template< int nx, int ny > __cuda_callable__ inline bool isBoundaryFace( const CoordinatesType& faceCoordinates ) const; __cuda_callable__ inline bool isBoundaryVertex( const CoordinatesType& vertexCoordinates ) const; template< typename GridFunction > typename GridFunction::RealType getAbsMax( const GridFunction& f ) const; Loading