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

Adding grid entity topology.

parent c176b1cb
No related branches found
No related tags found
No related merge requests found
/***************************************************************************
tnlGridTopologies.h - description
tnlStaticMultiIndex.h - description
-------------------
begin : Nov 13, 2015
copyright : (C) 2015 by Tomas Oberhuber
......@@ -15,30 +15,44 @@
* *
***************************************************************************/
#ifndef TNLGRIDTOPOLOGIES_H
#define TNLGRIDTOPOLOGIES_H
#ifndef TNLSTATICMULTIINDEX_H
#define TNLSTATICMULTIINDEX_H
template< typename Grid,
int EntityDimenisons >
class tnlGridEntityTopology
template< int i1_ >
class tnlStaticMultiIndex1D
{
static_assert( false );
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
class tnlGridCell< tnlGrid< Dimensions, Real, Device, Index > >
public:
static const int i1 = i1_;
};
template< int i1_,
int i2_ >
class tnlStaticMultiIndex1D
{
public:
static const int dimensions = Dimensions;
static constexpr int getDimensions() { return dimensions; }
static const int i1 = i1_;
static const int i2 = i2_;
};
template< >
template< int i1_,
int i2_,
int i3_ >
class tnlStaticMultiIndex1D
{
public:
static const int i1 = i1_;
static const int i2 = i2_;
static const int i3 = i3_;
};
#endif /* TNLGRIDTOPOLOGIES_H */
#endif /* TNLSTATICMULTIINDEX_H */
......@@ -49,12 +49,13 @@ class tnlFunctionAdapter< Mesh, Function, tnlAnalyticFunction >
typedef typename MeshType::IndexType IndexType;
typedef typename FunctionType::VertexType VertexType;
template< int EntityDimensions >
static RealType getValue( const MeshType& mesh,
const FunctionType& function,
const IndexType meshEntityIndex,
const RealType& time )
{
return function.getValue( mesh.getCellCenter( meshEntityIndex ), time );
return function.getValue( mesh.template getEntityCenter< EntityDimensions >( meshEntityIndex ), time );
};
};
......@@ -76,13 +77,14 @@ class tnlFunctionAdapter< tnlGrid< Dimensions, Real, Device, Index >, Function,
typedef typename MeshType::IndexType IndexType;
typedef typename MeshType::CoordinatesType CoordinatesType;
template< int EntityDimensions >
static RealType getValue( const MeshType& mesh,
const FunctionType& function,
const IndexType meshEntytiIndex,
const CoordinatesType& coordinates,
const RealType& time )
{
return function.getValue( mesh.getCellCenter( coordinates ), time );
return function.getValue( mesh.template getEntityCenter< EntityDimensions >( coordinates ), time );
}
};
......
......@@ -18,6 +18,9 @@
#ifndef SRC_MESH_TNLGRID1D_H_
#define SRC_MESH_TNLGRID1D_H_
#include <mesh/grids/tnlGridEntityTopology.h>
#include <core/tnlStaticMultiIndex.h>
template< typename Real,
typename Device,
typename Index >
......@@ -29,10 +32,18 @@ class tnlGrid< 1, Real, Device, Index > : public tnlObject
typedef Device DeviceType;
typedef Index IndexType;
typedef tnlStaticVector< 1, Real > VertexType;
typedef tnlStaticVector< 1, Index > CoordinatesType;
typedef tnlStaticVector< 1, Index > CoordinatesType;
typedef tnlGrid< 1, Real, tnlHost, Index > HostType;
typedef tnlGrid< 1, Real, tnlCuda, Index > CudaType;
typedef tnlGrid< 1, Real, Device, Index > ThisType;
template< int i > using MultiIndex = tnlStaticMultiIndex1D< i >;
typedef tnlGridEntityTopology< ThisType, 0, MultiIndex< 0 > > Cell;
typedef tnlGridEntityTopology< ThisType, 1, MultiIndex< 1 > > EastFace;
typedef tnlGridEntityTopology< ThisType, 1, MultiIndex< -1 > > WestFace;
typedef tnlGridEntityTopology< ThisType, 1, MultiIndex< 0 > > Vertex;
enum { Dimensions = 1};
tnlGrid();
......
/***************************************************************************
tnlGridEntityTopology.h - description
-------------------
begin : Nov 13, 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 TNLGRIDTOPOLOGIES_H
#define TNLGRIDTOPOLOGIES_H
template< typename Grid,
int EntityCodimensions,
typename EntityOrientation >
class tnlGridEntityTopology
{
static_assert( false, "" );
};
template< int MeshDimensions,
typename Real,
typename Device,
typename Index,
int EntityCodimensions,
typename EntityOrientation_ >
class tnlGridEntityTopology< tnlGrid< MeshDimensions, Real, Device, Index >,
EntityCodimensions,
EntityOrientation_ >
{
static_assert( MeshDimensions == EntityOrientation_::size, "Entity orientation is not a proper static multiindex." );
public:
typedef tnlGrid< MeshDimensions, Real, Device, Index > Grid;
static const int meshDimensions = MeshDimensions;
static const int entityCodimensions = EntityCodimensions;
typedef EntityOrientation_ EntityOrientation;
};
#endif /* TNLGRIDTOPOLOGIES_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment