Newer
Older
/***************************************************************************
tnlGridEntity_impl.h - description
-------------------
begin : Nov 20, 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 TNLGRIDENTITY_IMPL_H
#define TNLGRIDENTITY_IMPL_H
#include <mesh/grids/tnlBoundaryGridEntityChecker.h>
#include <mesh/grids/tnlGridEntityCenterGetter.h>
#include <mesh/grids/tnlGridEntity.h>
template< int Dimensions,
typename Real,
typename Device,
typename Index,
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
{
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
int EntityDimensions >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
tnlGridEntity( const tnlGrid< Dimensions, Real, Device, Index >& grid )
: grid( grid ),
template< int Dimensions,
typename Real,
typename Device,
typename Index,
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
tnlGridEntity( const tnlGrid< Dimensions, Real, Device, Index >& grid,
const CoordinatesType& coordinates,
const EntityOrientationType& orientation,
const EntityBasisType& basis )
orientation( orientation ),
basis( basis )
{
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::CoordinatesType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
getCoordinates() const
{
return this->coordinates;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::CoordinatesType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
getCoordinates()
{
return this->coordinates;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
int EntityDimensions >
void
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
setCoordinates( const CoordinatesType& coordinates )
{
this->coordinates = coordinates;
}
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
template< int Dimensions,
typename Real,
typename Device,
typename Index,
int EntityDimensions >
__cuda_callable__ inline
void
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
setIndex( IndexType entityIndex )
{
tnlAssert( entityIndex >= 0 &&
entityIndex < grid.template getEntitiesCount< EntityDimensions >(),
cerr << "entityIndex = " << entityIndex
<< " grid.template getEntitiesCount< EntityDimensions >() = " << grid.template getEntitiesCount< EntityDimensions >() );
this->entityIndex = entityIndex;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
int EntityDimensions >
__cuda_callable__ inline
Index
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
getIndex() const
{
tnlAssert( this->entityIndex >= 0 &&
this-> entityIndex < grid.template getEntitiesCount< EntityDimensions >(),
cerr << "this->entityIndex = " << this->entityIndex
<< " grid.template getEntitiesCount< EntityDimensions >() = " << grid.template getEntitiesCount< EntityDimensions >() );
tnlAssert( this->entityIndex == grid.getEntityIndex( *this ),
cerr << "this->entityIndex = " << this->entityIndex
<< " grid.getEntityIndex( *this ) = " << grid.getEntityIndex( *this ) );
return this->entityIndex;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::EntityOrientationType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
getOrientation() const
{
return this->orientation;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
setOrientation( const EntityOrientationType& orientation )
{
this->orientation = orientation;
this->basis = EntityBasisType( 1 ) - tnlAbs( orientation );
template< int Dimensions,
typename Real,
typename Device,
typename Index,
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::EntityBasisType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
getBasis() const
{
return this->basis;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
setBasis( const EntityBasisType& basis )
{
this->basis = basis;
this->orientation = EntityOrientationType( 1 ) - tnlAbs( basis );
template< int Dimensions,
typename Real,
typename Device,
typename Index,
int EntityDimensions >
template< int NeighbourEntityDimensions >
tnlNeighbourGridEntityGetter<
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >,
NeighbourEntityDimensions >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
getNeighbourEntities() const
{
return tnlNeighbourGridEntityGetter< ThisType, NeighbourEntityDimensions >( this->grid, *this );
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
template< int Dimensions,
typename Real,
typename Device,
typename Index,
int EntityDimensions >
__cuda_callable__ inline
bool
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
isBoundaryEntity() const
{
return tnlBoundaryGridEntityChecker< ThisType >::isBoundaryEntity( *this );
}
template< int Dimensions,
typename Real,
typename Device,
typename Index,
int EntityDimensions >
__cuda_callable__ inline
typename tnlGrid< Dimensions, Real, Device, Index >::VertexType
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions >::
getCenter() const
{
return tnlGridEntityCenterGetter< ThisType >::getEntityCenter( *this );
}
/****
* Specialization for cells
*/
template< int Dimensions,
typename Real,
typename Device,
typename Index >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
tnlGridEntity()
{
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
tnlGridEntity( const GridType& grid )
: grid( grid ),
entityIndex( -1 )
this->coordinates = CoordinatesType( ( Index ) 0 );
this->orientation = EntityOrientationType( ( Index ) 0 );
this->basis = EntityBasisType( ( Index ) 1 );
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
tnlGridEntity( const GridType& grid,
const CoordinatesType& coordinates,
const EntityOrientationType& orientation,
const EntityBasisType& basis )
{
this->orientation = EntityOrientationType( ( Index ) 0 );
this->basis = EntityBasisType( ( Index ) 1 );
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::CoordinatesType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
getCoordinates() const
{
return this->coordinates;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::CoordinatesType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
getCoordinates()
{
return this->coordinates;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
void
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
setCoordinates( const CoordinatesType& coordinates )
{
this->coordinates = coordinates;
}
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
void
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
setIndex( IndexType entityIndex )
{
tnlAssert( entityIndex >= 0 &&
entityIndex < grid.template getEntitiesCount< Dimensions >(),
cerr << "entityIndex = " << entityIndex
<< " grid.template getEntitiesCount< Dimensions >() = " << grid.template getEntitiesCount< Dimensions >() );
this->entityIndex = entityIndex;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
Index
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
getIndex() const
{
tnlAssert( this->entityIndex >= 0 &&
this-> entityIndex < grid.template getEntitiesCount< Dimensions >(),
cerr << "this->entityIndex = " << this->entityIndex
<< " grid.template getEntitiesCount< Dimensions >() = " << grid.template getEntitiesCount< Dimensions >() );
tnlAssert( this->entityIndex == grid.getEntityIndex( *this ),
cerr << "this->index = " << this->entityIndex
<< " grid.getEntityIndex( *this ) = " << grid.getEntityIndex( *this ) );
return this->entityIndex;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::EntityOrientationType
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
getOrientation() const
{
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::EntityBasisType
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
getBasis() const
template< int Dimensions,
typename Real,
typename Device,
typename Index >
template< int NeighbourEntityDimensions >
tnlNeighbourGridEntityGetter<
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >,
NeighbourEntityDimensions >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
getNeighbourEntities() const
{
return tnlNeighbourGridEntityGetter< ThisType, NeighbourEntityDimensions >( this->grid, *this );
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
bool
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
isBoundaryEntity() const
{
return tnlBoundaryGridEntityChecker< ThisType >::isBoundaryEntity( *this );
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
typename tnlGrid< Dimensions, Real, Device, Index >::VertexType
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
getCenter() const
{
return tnlGridEntityCenterGetter< ThisType >::getEntityCenter( *this );
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::VertexType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions >::
getEntityProportions() const
{
return grid.getSpaceSteps();
}
/****
* Specialization for vertices
*/
template< int Dimensions,
typename Real,
typename Device,
typename Index >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
tnlGridEntity()
{
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
tnlGridEntity( const GridType& grid )
: grid( grid ),
template< int Dimensions,
typename Real,
typename Device,
typename Index >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
tnlGridEntity( const GridType& grid,
const CoordinatesType& coordinates,
const EntityOrientationType& orientation,
const EntityBasisType& basis )
{
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::CoordinatesType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
getCoordinates() const
{
return this->coordinates;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::CoordinatesType&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
getCoordinates()
{
return this->coordinates;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
void
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
setCoordinates( const CoordinatesType& coordinates )
{
this->coordinates = coordinates;
}
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
void
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
setIndex( IndexType entityIndex ) const
{
tnlAssert( entityIndex >= 0 &&
entityIndex < grid.template getEntitiesCount< 0 >(),
cerr << "entityIndex = " << entityIndex
<< " grid.template getEntitiesCount< 0 >() = " << grid.template getEntitiesCount< 0 >() );
this->entityIndex = entityIndex;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
Index
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
getIndex() const
{
tnlAssert( this->entityIndex >= 0 &&
this-> entityIndex < grid.template getEntitiesCount< 0 >(),
cerr << "this->entityIndex = " << this->entityIndex
<< " grid.template getEntitiesCount< 0 >() = " << grid.template getEntitiesCount< 0 >() );
tnlAssert( this->entityIndex == grid.getEntityIndex( *this ),
cerr << "this->entityIndex = " << this->entityIndex
<< " grid.getEntityIndex( *this ) = " << grid.getEntityIndex( *this ) );
return this->entityIndex;
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::EntityOrientationType
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
getOrientation() const
{
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::EntityBasisType
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
getBasis() const
{
template< int Dimensions,
typename Real,
typename Device,
typename Index >
template< int NeighbourEntityDimensions >
tnlNeighbourGridEntityGetter<
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >,
NeighbourEntityDimensions >
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
getNeighbourEntities() const
{
return tnlNeighbourGridEntityGetter< ThisType, NeighbourEntityDimensions >( this->grid, *this );
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
bool
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
isBoundaryEntity() const
{
return tnlBoundaryGridEntityChecker< ThisType >::isBoundaryEntity( *this );
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
typename tnlGrid< Dimensions, Real, Device, Index >::VertexType
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
getCenter() const
{
return tnlGridEntityCenterGetter< ThisType >::getEntityCenter( *this );
}
template< int Dimensions,
typename Real,
typename Device,
typename Index >
__cuda_callable__ inline
typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::VertexType
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0 >::
getEntityProportions() const
{
return VertexType( 0.0 );
}