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

waLBerla sweep generation - directly callable cellinterval-version

parent 9eb8c473
Branches
Tags
No related merge requests found
......@@ -51,7 +51,7 @@ namespace {{namespace}} {
{{kernel|generate_definition}}
void {{class_name}}::sweep( IBlock * block )
void {{class_name}}::operator()( IBlock * block )
{
{{kernel|generate_block_data_to_field_extraction|indent(4)}}
{{kernel|generate_call(stream='stream_')|indent(4)}}
......@@ -59,10 +59,10 @@ void {{class_name}}::sweep( IBlock * block )
}
void {{class_name}}::sweepOnCellInterval( const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval,
cell_idx_t ghostLayers,
IBlock * block )
void {{class_name}}::runOnCellInterval( const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval,
cell_idx_t ghostLayers,
IBlock * block )
{
CellInterval ci = globalCellInterval;
CellInterval blockBB = blocks->getBlockCellBB( *block);
......
......@@ -57,28 +57,29 @@ public:
{{ kernel| generate_destructor(class_name) |indent(4) }}
void operator()(IBlock * b) { sweep(b); }
void operator()(IBlock * b);
void runOnCellInterval(const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval, cell_idx_t ghostLayers, IBlock * block);
std::function<void (IBlock*)> getSweep() {
return [this](IBlock * b) { this->sweep(b); };
static std::function<void (IBlock*)> getSweep(const shared_ptr<{{class_name}}> & kernel) {
return [kernel](IBlock * b) { (*kernel)(b); };
}
std::function<void (IBlock*)> getSweepOnCellInterval(const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval,
cell_idx_t ghostLayers=1 )
static std::function<void (IBlock*)> getSweepOnCellInterval(const shared_ptr<{{class_name}}> & kernel,
const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval,
cell_idx_t ghostLayers=1 )
{
return [this, blocks, globalCellInterval, ghostLayers] (IBlock * b) {
this->sweepOnCellInterval(blocks, globalCellInterval, ghostLayers, b);
return [kernel, blocks, globalCellInterval, ghostLayers] (IBlock * b) {
kernel->runOnCellInterval(blocks, globalCellInterval, ghostLayers, b);
};
}
{{ kernel|generate_members|indent(4) }}
private:
void sweep( IBlock * block );
void sweepOnCellInterval(const shared_ptr<StructuredBlockStorage> & blocks,
const CellInterval & globalCellInterval, cell_idx_t ghostLayers, IBlock * block );
{%if target is equalto 'gpu'%}
cudaStream_t stream_;
{% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment