Skip to content
Snippets Groups Projects
Commit 2aac55c2 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Fixed NeighborEntityGetter for 3D grids

parent 21a79b0d
No related branches found
No related tags found
No related merge requests found
......@@ -63,9 +63,10 @@ class NeighborGridEntityGetter<
std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY )
<< " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
<< " EntityDimension = " << EntityDimension );
return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX,
entity.getCoordinates().y() + stepY,
entity.getCoordinates().z() + stepZ ) );
return NeighborGridEntityType( this->entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX,
entity.getCoordinates().y() + stepY,
entity.getCoordinates().z() + stepZ ) );
}
template< int stepX, int stepY, int stepZ >
......@@ -143,9 +144,10 @@ class NeighborGridEntityGetter<
std::cerr << "entity.getCoordinates() + CoordinatesType( stepX, stepY ) = " << entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ )
<< " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
<< " EntityDimension = " << EntityDimension );
return NeighborGridEntityType( this->entity.getMesh(), CoordinatesType( entity.getCoordinates().x() + stepX,
entity.getCoordinates().y() + stepY,
entity.getCoordinates().z() + stepZ ) );
return NeighborGridEntityType( this->entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX,
entity.getCoordinates().y() + stepY,
entity.getCoordinates().z() + stepZ ) );
}
template< int stepX, int stepY, int stepZ >
......@@ -296,13 +298,13 @@ class NeighborGridEntityGetter<
<< " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
<< " EntityDimension = " << EntityDimension );
return NeighborGridEntityType( this->entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
entity.getCoordinates().y() + stepY + ( stepY < 0 ),
entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
EntityOrientationType( stepX ? (stepX > 0 ? 1 : -1) : 0,
stepY ? (stepY > 0 ? 1 : -1) : 0,
stepZ ? (stepZ > 0 ? 1 : -1) : 0 ),
EntityBasisType( ! stepX, !stepY, !stepZ ) );
CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
entity.getCoordinates().y() + stepY + ( stepY < 0 ),
entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
EntityOrientationType( stepX ? (stepX > 0 ? 1 : -1) : 0,
stepY ? (stepY > 0 ? 1 : -1) : 0,
stepZ ? (stepZ > 0 ? 1 : -1) : 0 ),
EntityBasisType( ! stepX, !stepY, !stepZ ) );
}
template< int stepX, int stepY, int stepZ >
......@@ -379,13 +381,13 @@ class NeighborGridEntityGetter<
<< " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
<< " EntityDimension = " << EntityDimension );
return NeighborGridEntityType( this->entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
entity.getCoordinates().y() + stepY + ( stepY < 0 ),
entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
EntityOrientationType( stepX ? (stepX > 0 ? 1 : -1) : 0,
stepY ? (stepY > 0 ? 1 : -1) : 0,
stepZ ? (stepZ > 0 ? 1 : -1) : 0 ),
EntityBasisType( ! stepX, !stepY, !stepZ ) );
CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
entity.getCoordinates().y() + stepY + ( stepY < 0 ),
entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
EntityOrientationType( stepX ? (stepX > 0 ? 1 : -1) : 0,
stepY ? (stepY > 0 ? 1 : -1) : 0,
stepZ ? (stepZ > 0 ? 1 : -1) : 0 ),
EntityBasisType( ! stepX, !stepY, !stepZ ) );
}
template< int stepX, int stepY, int stepZ >
......@@ -462,18 +464,19 @@ class NeighborGridEntityGetter<
<< entity.getCoordinates() + CoordinatesType( stepX + ( stepX < 0 ), stepY + ( stepY < 0 ), stepZ + ( stepZ < 0 ) )
<< " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
<< " EntityDimension = " << EntityDimension );
return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
entity.getCoordinates().y() + stepY + ( stepY < 0 ),
entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
EntityOrientationType( !!stepX, !!stepY, !!stepZ ),
EntityBasisType( !stepX, !stepY, !stepZ ));
return NeighborGridEntityType( this->entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
entity.getCoordinates().y() + stepY + ( stepY < 0 ),
entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ),
EntityOrientationType( !!stepX, !!stepY, !!stepZ ),
EntityBasisType( !stepX, !stepY, !stepZ ));
}
template< int stepX, int stepY, int stepZ >
__cuda_callable__ inline
IndexType getEntityIndex() const
{
return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >( entity ) );
return GridEntityGetterType::getEntityIndex( this->entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
}
__cuda_callable__
......@@ -545,16 +548,17 @@ class NeighborGridEntityGetter<
<< " entity.getMesh().getDimensions() + CoordinatesType( sign( stepX ), sign( stepY ), sign( stepZ ) ) = "
<< entity.getMesh().getDimensions() + CoordinatesType( sign( stepX ), sign( stepY ), sign( stepZ ) )
<< " EntityDimension = " << EntityDimension );
return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
entity.getCoordinates().y() + stepY + ( stepY < 0 ),
entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ) );
return NeighborGridEntityType( this->entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX + ( stepX < 0 ),
entity.getCoordinates().y() + stepY + ( stepY < 0 ),
entity.getCoordinates().z() + stepZ + ( stepZ < 0 ) ) );
}
template< int stepX, int stepY, int stepZ >
__cuda_callable__ inline
IndexType getEntityIndex() const
{
return GridEntityGetterType::getEntityIndex( entity.getMesh(), getEntity< stepX, stepY, stepZ >( entity ) );
return GridEntityGetterType::getEntityIndex( entity.getMesh(), getEntity< stepX, stepY, stepZ >() );
}
__cuda_callable__
......@@ -627,10 +631,10 @@ class NeighborGridEntityGetter<
stepZ + ( stepZ < 0 ) * ( entity.getOrientation().z() != 0.0 ) )
<< " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
<< " EntityDimension = " << EntityDimension );
return NeighborGridEntityType( entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
entity.getCoordinates().y() + stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
entity.getCoordinates().z() + stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) );
return NeighborGridEntityType( this->entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX - ( stepX > 0 ) * ( entity.getOrientation().x() != 0.0 ),
entity.getCoordinates().y() + stepY - ( stepY > 0 ) * ( entity.getOrientation().y() != 0.0 ),
entity.getCoordinates().z() + stepZ - ( stepZ > 0 ) * ( entity.getOrientation().z() != 0.0 ) ) );
}
template< int stepX, int stepY, int stepZ >
......@@ -695,9 +699,10 @@ class NeighborGridEntityGetter<
<< entity.getCoordinates() + CoordinatesType( stepX, stepY, stepZ )
<< " entity.getMesh().getDimensions() = " << entity.getMesh().getDimensions()
<< " EntityDimension = " << EntityDimension );
return NeighborGridEntity( CoordinatesType( entity.getCoordinates().x() + stepX,
entity.getCoordinates().y() + stepY,
entity.getCoordinates().z() + stepZ ) );
return NeighborGridEntityType( this->entity.getMesh(),
CoordinatesType( entity.getCoordinates().x() + stepX,
entity.getCoordinates().y() + stepY,
entity.getCoordinates().z() + stepZ ) );
}
template< int stepX, int stepY, int stepZ >
......@@ -727,4 +732,4 @@ class NeighborGridEntityGetter<
};
} // namespace Meshes
} // namespace TNL
\ No newline at end of file
} // namespace TNL
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