Commit d2d88282 authored by Jan Hönig's avatar Jan Hönig
Browse files

Fixed walberla generation

parent 247ad9f9
......@@ -13,7 +13,7 @@
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \\file {{className}}.h
//! \\file {{class_name}}.h
//! \\author pystencils
//======================================================================================================================
......@@ -45,19 +45,19 @@ namespace walberla {
namespace {{namespace}} {
class {{className}}
class {{class_name}}
{
public:
{{StructDeclaration|indent(4)}}
typedef std::vector<{{StructName}}> IndexVector;
{{className}}( const shared_ptr<StructuredBlockForest> & blocks,
{{class_name}}( const shared_ptr<StructuredBlockForest> & blocks,
{{kernel|generate_constructor_parameters(['indexVector', 'indexVectorSize'])}} )
: {{ kernel|generate_constructor_initializer_list(['indexVector', 'indexVectorSize']) }}
{
auto createIdxVector = []( IBlock * const , StructuredBlockStorage * const ) { return new IndexVector(); };
indexVectorID = blocks->addStructuredBlockData< IndexVector >( createIdxVector, "IndexField_{{className}}");
indexVectorID = blocks->addStructuredBlockData< IndexVector >( createIdxVector, "IndexField_{{class_name}}");
};
void operator() ( IBlock * block );
......
......@@ -22,7 +22,7 @@
#include "core/Macros.h"
#include "lbm/field/PdfField.h"
#include "lbm/sweeps/Streaming.h"
#include "{{className}}.h"
#include "{{class_name}}.h"
#ifdef _MSC_VER
# pragma warning( disable : 4458 )
......@@ -44,14 +44,14 @@ namespace {{namespace}} {
{{stream_kernel|generate_definition}}
const real_t {{className}}::w[{{Q}}] = { {{weights}} };
const real_t {{className}}::wInv[{{Q}}] = { {{inverse_weights}} };
const real_t {{class_name}}::w[{{Q}}] = { {{weights}} };
const real_t {{class_name}}::wInv[{{Q}}] = { {{inverse_weights}} };
void {{className}}::Sweep::streamCollide( IBlock * block, const uint_t numberOfGhostLayersToInclude )
void {{class_name}}::Sweep::streamCollide( IBlock * block, const uint_t numberOfGhostLayersToInclude )
{
{{stream_collide_kernel|generate_block_data_to_field_extraction(parameters=['pdfs', 'pdfs_tmp'])|indent(4)}}
auto & lm = dynamic_cast< lbm::PdfField<{{className}}> * > (pdfs)->latticeModel();
auto & lm = dynamic_cast< lbm::PdfField<{{class_name}}> * > (pdfs)->latticeModel();
lm.configureBlock(block);
{{stream_collide_kernel|generate_refs_for_kernel_parameters(prefix='lm.', parameters_to_ignore=['pdfs', 'pdfs_tmp'])|indent(4) }}
......@@ -59,11 +59,11 @@ void {{className}}::Sweep::streamCollide( IBlock * block, const uint_t numberOfG
{{stream_collide_kernel|generate_swaps|indent(4)}}
}
void {{className}}::Sweep::collide( IBlock * block, const uint_t numberOfGhostLayersToInclude )
void {{class_name}}::Sweep::collide( IBlock * block, const uint_t numberOfGhostLayersToInclude )
{
{{collide_kernel|generate_block_data_to_field_extraction(parameters=['pdfs'])|indent(4)}}
auto & lm = dynamic_cast< lbm::PdfField<{{className}}> * > (pdfs)->latticeModel();
auto & lm = dynamic_cast< lbm::PdfField<{{class_name}}> * > (pdfs)->latticeModel();
lm.configureBlock(block);
{{collide_kernel|generate_refs_for_kernel_parameters(prefix='lm.', parameters_to_ignore=['pdfs', 'pdfs_tmp'])|indent(4) }}
......@@ -71,7 +71,7 @@ void {{className}}::Sweep::collide( IBlock * block, const uint_t numberOfGhostLa
}
void {{className}}::Sweep::stream( IBlock * block, const uint_t numberOfGhostLayersToInclude )
void {{class_name}}::Sweep::stream( IBlock * block, const uint_t numberOfGhostLayersToInclude )
{
{{stream_kernel|generate_block_data_to_field_extraction(parameters=['pdfs', 'pdfs_tmp'])|indent(4)}}
......@@ -92,13 +92,13 @@ void {{className}}::Sweep::stream( IBlock * block, const uint_t numberOfGhostLay
namespace walberla {
namespace mpi {
mpi::SendBuffer & operator<< (mpi::SendBuffer & buf, const ::walberla::{{namespace}}::{{className}} & lm)
mpi::SendBuffer & operator<< (mpi::SendBuffer & buf, const ::walberla::{{namespace}}::{{class_name}} & lm)
{
buf << lm.currentLevel;
return buf;
}
mpi::RecvBuffer & operator>> (mpi::RecvBuffer & buf, ::walberla::{{namespace}}::{{className}} & lm)
mpi::RecvBuffer & operator>> (mpi::RecvBuffer & buf, ::walberla::{{namespace}}::{{class_name}} & lm)
{
buf >> lm.currentLevel;
return buf;
......
......@@ -96,7 +96,7 @@ public:
static const real_t wInv[{{Q}}];
static const bool compressible = {{compressible}};
static const int equilibriumAccuracyOrder = {{equilibriumAccuracyOrder}};
static const int equilibriumAccuracyOrder = {{equilibrium_order}};
class Sweep
{
......@@ -133,11 +133,11 @@ private:
if( targetLevel != currentLevel )
{
real_t levelScaleFactor(1);
real_t level_scale_factor(1);
if( currentLevel < targetLevel )
levelScaleFactor = real_c( uint_t(1) << ( targetLevel - currentLevel ) );
level_scale_factor = real_c( uint_t(1) << ( targetLevel - currentLevel ) );
else // currentLevel > targetLevel
levelScaleFactor = real_t(1) / real_c( uint_t(1) << ( currentLevel - targetLevel ) );
level_scale_factor = real_t(1) / real_c( uint_t(1) << ( currentLevel - targetLevel ) );
{% for scalingType, name, expression in refinement_scaling.scaling_info -%}
{% if scalingType == 'normal' %}
......@@ -342,7 +342,7 @@ struct DensityAndVelocity<{{class_name}}>
{
template< typename FieldPtrOrIterator >
static void set( FieldPtrOrIterator & it, const {{class_name}} & lm,
const Vector3< real_t > & u = Vector3< real_t >( real_t(0.0) ), const real_t rhoIn = real_t(1.0) )
const Vector3< real_t > & u = Vector3< real_t >( real_t(0.0) ), const real_t rho_in = real_t(1.0) )
{
auto x = it.x();
auto y = it.y();
......@@ -358,7 +358,7 @@ struct DensityAndVelocity<{{class_name}}>
template< typename PdfField_T >
static void set( PdfField_T & pdf, const cell_idx_t x, const cell_idx_t y, const cell_idx_t z, const {{class_name}} & lm,
const Vector3< real_t > & u = Vector3< real_t >( real_t(0.0) ), const real_t rhoIn = real_t(1.0) )
const Vector3< real_t > & u = Vector3< real_t >( real_t(0.0) ), const real_t rho_in = real_t(1.0) )
{
{{density_velocity_setter_macroscopic_values | indent(8)}}
{% if D == 2 -%}
......@@ -376,7 +376,7 @@ struct DensityAndVelocityRange<{{class_name}}, FieldIteratorXYZ>
{
static void set( FieldIteratorXYZ & begin, const FieldIteratorXYZ & end, const {{class_name}} & lm,
const Vector3< real_t > & u = Vector3< real_t >( real_t(0.0) ), const real_t rhoIn = real_t(1.0) )
const Vector3< real_t > & u = Vector3< real_t >( real_t(0.0) ), const real_t rho_in = real_t(1.0) )
{
for( auto cellIt = begin; cellIt != end; ++cellIt )
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment