Skip to content
Snippets Groups Projects
Commit 809a6a23 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Implementing tnlGridCellNeighbours.

parent d1bf5b54
No related branches found
No related tags found
No related merge requests found
SET( headers tnlGrid1D_impl.h
tnlGrid2D_impl.h
tnlGrid3D_impl.h
tnlGridCellNeighbours_impl.h
tnlTraversal_Grid1D_impl.h
tnlTraversal_Grid2D_impl.h
tnlTraversal_Grid3D_impl.h )
......
/***************************************************************************
tnlGridCellNeighbours_impl.h - description
-------------------
begin : Jul 29, 2014
copyright : (C) 2014 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 TNLGRIDCELLNEIGHBOURS_IMPL_H_
#define TNLGRIDCELLNEIGHBOURS_IMPL_H_
template< typename Real,
typename Device,
typename Index >
tnlGridCellNeighbours< tnlGrid< 1, Real, Device, Index > >::
tnlGridCellNeighbours( const GridType& grid,
const CoordinatesType& cellCoordinates )
{
const IndexType cellIndex = grid.getCellIndex( cellCoordinates );
this->xPredecessor = cellIndex - 1;
this->xSuccessor = cellIndex + 1;
}
template< typename Real,
typename Device,
typename Index >
Index
tnlGridCellNeighbours< tnlGrid< 1, Real, Device, Index > >::
getXPredecessor() const
{
return this->xPredecessor;
}
template< typename Real,
typename Device,
typename Index >
Index
tnlGridCellNeighbours< tnlGrid< 1, Real, Device, Index > >::
getXSuccessor() const
{
return this->xSuccessor;
}
template< typename Real,
typename Device,
typename Index >
tnlGridCellNeighbours< tnlGrid< 2, Real, Device, Index > >::
tnlGridCellNeighbours( const GridType& grid,
const CoordinatesType& cellCoordinates )
{
const IndexType cellIndex = grid.getCellIndex( cellCoordinates );
this->xPredecessor = cellIndex - 1;
this->xSuccessor = cellIndex + 1;
this->yPredecessor = cellIndex - grid.getDimensions().x();
this->ySuccessor = cellIndex + grid.getDimensions().x();
}
template< typename Real,
typename Device,
typename Index >
Index
tnlGridCellNeighbours< tnlGrid< 2, Real, Device, Index > >::
getXPredecessor() const
{
return this->xPredecessor;
}
template< typename Real,
typename Device,
typename Index >
Index
tnlGridCellNeighbours< tnlGrid< 2, Real, Device, Index > >::
getXSuccessor() const
{
return this->xSuccessor;
}
template< typename Real,
typename Device,
typename Index >
Index
tnlGridCellNeighbours< tnlGrid< 2, Real, Device, Index > >::
getYPredecessor() const
{
return this->yPredecessor;
}
template< typename Real,
typename Device,
typename Index >
Index
tnlGridCellNeighbours< tnlGrid< 2, Real, Device, Index > >::
getYSuccessor() const
{
return this->ySuccessor;
}
#endif /* TNLGRIDCELLNEIGHBOURS_IMPL_H_ */
......@@ -4,6 +4,7 @@ ADD_SUBDIRECTORY( traits )
ADD_SUBDIRECTORY( topologies )
SET( headers tnlGrid.h
tnlGridCellNeighbours.h
tnlDummyMesh.h
tnlGnuplotWriter.h
tnlMesh.h
......
/***************************************************************************
tnlGridCellNeighbours.h - description
-------------------
begin : Jul 29, 2014
copyright : (C) 2014 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 TNLGRIDCELLNEIGHBOURS_H_
#define TNLGRIDCELLNEIGHBOURS_H_
#include <mesh/tnlGrid.h>
template< typename Grid >
class tnlGridCellNeighbours{};
template< typename Real,
typename Device,
typename Index >
class tnlGridCellNeighbours< tnlGrid< 1, Real, Device, Index > >
{
public:
typedef tnlGrid< 1, Real, Device, Index > GridType;
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
typedef typename GridType::CoordinatesType CoordinatesType;
enum { Dimensions = GridType::Dimensions };
tnlGridCellNeighbours( const GridType& grid,
const CoordinatesType& cellCoordinates );
const IndexType& getXPredecessor() const;
const IndexType& getXSuccessor() const;
protected:
IndexType xPredecessor, xSuccessor;
};
template< typename Real,
typename Device,
typename Index >
class tnlGridCellNeighbours< tnlGrid< 2, Real, Device, Index > >
{
public:
typedef tnlGrid< 2, Real, Device, Index > GridType;
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
typedef typename GridType::CoordinatesType CoordinatesType;
enum { Dimensions = GridType::Dimensions };
tnlGridCellNeighbours( const GridType& grid,
const CoordinatesType& cellCoordinates );
const IndexType& getXPredecessor() const;
const IndexType& getXSuccessor() const;
const IndexType& getYPredecessor() const;
const IndexType& getYSuccessor() const;
protected:
IndexType xPredecessor, xSuccessor,
yPredecessor, ySuccessor;
};
template< typename Real,
typename Device,
typename Index >
class tnlGridCellNeighbours< tnlGrid< 2, Real, Device, Index > >
{
public:
typedef tnlGrid< 2, Real, Device, Index > GridType;
typedef Real RealType;
typedef Device DeviceType;
typedef Index IndexType;
typedef typename GridType::CoordinatesType CoordinatesType;
enum { Dimensions = GridType::Dimensions };
tnlGridCellNeighbours( const GridType& grid,
const CoordinatesType& cellCoordinates );
const IndexType& getXPredecessor() const;
const IndexType& getXSuccessor() const;
const IndexType& getYPredecessor() const;
const IndexType& getYSuccessor() const;
const IndexType& getZPredecessor() const;
const IndexType& getZSuccessor() const;
protected:
IndexType xPredecessor, xSuccessor,
yPredecessor, ySuccessor,
zPredecessor, zSuccessor;
};
#include <implementation/mesh/tnlGridCellNeighbours_impl.h>
#endif /* TNLGRIDCELLNEIGHBOURS_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment