Skip to content
Snippets Groups Projects
Commit 7373aa55 authored by Martin Bauer's avatar Martin Bauer
Browse files

pystencils_walberla: same interface for overlap & non-overlap sweeps

parent 5c4fd515
No related branches found
No related tags found
No related merge requests found
......@@ -53,6 +53,24 @@ void {{class_name}}::operator() ( IBlock * block{%if target is equalto 'gpu'%} ,
}
void {{class_name}}::runOnCellInterval( const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval,
cell_idx_t ghostLayers,
IBlock * block{%if target is equalto 'gpu'%} , cudaStream_t stream{% endif %} )
{
CellInterval ci = globalCellInterval;
CellInterval blockBB = blocks->getBlockCellBB( *block);
blockBB.expand( ghostLayers );
ci.intersect( blockBB );
blocks->transformGlobalToBlockLocalCellInterval( ci, *block );
if( ci.empty() )
return;
{{kernel|generate_block_data_to_field_extraction|indent(4)}}
{{kernel|generate_call(stream='stream', cell_interval='ci')|indent(4)}}
{{kernel|generate_swaps|indent(4)}}
}
void {{class_name}}::inner( IBlock * block{%if target is equalto 'gpu'%} , cudaStream_t stream{% endif %} )
{
......
......@@ -17,6 +17,7 @@
//! \\author pystencils
//======================================================================================================================
#pragma once
#include "core/DataTypes.h"
{% if target is equalto 'cpu' -%}
......@@ -28,7 +29,7 @@
#include "field/SwapableCompare.h"
#include "domain_decomposition/BlockDataID.h"
#include "domain_decomposition/IBlock.h"
#include "domain_decomposition/StructuredBlockStorage.h"
#include <set>
#ifdef __GNUC__
......@@ -60,6 +61,28 @@ public:
void operator() ( IBlock * block{%if target is equalto 'gpu'%} , cudaStream_t stream = 0{% endif %} );
void runOnCellInterval(const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval, cell_idx_t ghostLayers, IBlock * block
{%if target is equalto 'gpu'%} , cudaStream_t stream = 0{% endif %});
static std::function<void (IBlock*)> getSweep(const shared_ptr<{{class_name}}> & kernel) {
return [kernel](IBlock * b) { (*kernel)(b); };
}
static std::function<void (IBlock*{%if target is equalto 'gpu'%} , cudaStream_t {% endif %})>
getSweepOnCellInterval(const shared_ptr<{{class_name}}> & kernel,
const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval,
cell_idx_t ghostLayers=1 )
{
return [kernel, blocks, globalCellInterval, ghostLayers] (IBlock * b{%if target is equalto 'gpu'%} , cudaStream_t stream = 0{% endif %}) {
kernel->runOnCellInterval(blocks, globalCellInterval, ghostLayers, b{%if target is equalto 'gpu'%},stream {% endif %});
};
}
void inner( IBlock * block{%if target is equalto 'gpu'%} , cudaStream_t stream = 0{% endif %} );
void outer( IBlock * block{%if target is equalto 'gpu'%} , cudaStream_t stream = 0{% endif %} );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment