walberla::geometry::initializer::BoundaryFromImage< BoundaryHandling_T, Image_T > Class Template Reference

Detailed Description

template<typename BoundaryHandling_T, typename Image_T>
class walberla::geometry::initializer::BoundaryFromImage< BoundaryHandling_T, Image_T >

Sets boundary conditions according to a gray scale image.

Example:

   <InitializerId> {
      file                 domain.png;
      extrusionCoordinate  1;  // defaults to 2
      lowerExtrusionLimit  5   // defaults to 0
      upperExtrusionLimit  10; // defaults to maximum of extrusionCoordinate

      xOffset              5; // "x" offset of the image in the domain
      yOffset              6; // "y" offset of the image in the domain
      // or
      rescaleToDomain  true;

      BoundaryValueMapping {
         <BoundaryUID> { <boundary Config> } // boundary name i.e. name of boundary flag
         #or
         flag <FlagUID>;

         value      ff0000;                  // boundary is set in cells where image has exactly
                                             // this value ( here: red)
                                             // value has to be specified in hex notation
                                             // for rgba images the format is ff11aaff
                                             // ( red=255, green=11, blue=aa, alpha=ff)
                                             // where the alpha channel is optional
                                             // for grayscale images only the gray value has to be specified:
                                             // for example "ff" for white
      }

      BoundaryValueMapping {
         NoSlip     {}
         value      125;
      }
   }

#include <BoundaryFromImage.h>

+ Inheritance diagram for walberla::geometry::initializer::BoundaryFromImage< BoundaryHandling_T, Image_T >:

Public Types

using pixel_t = typename Image_T::pixel_t
 
using BoundarySetters = std::map< pixel_t, BoundarySetter< BoundaryHandling_T > >
 

Public Member Functions

 BoundaryFromImage (StructuredBlockStorage &blocks, BlockDataID handlerBlockDataID)
 
void init (BlockStorage &, const Config::BlockHandle &block) override
 Initializes the scalar field using parameters of config block for syntax see class documentation. More...
 
void init (const Config::BlockHandle &block)
 
void init (const Image_T &img, uint_t extrusionCoord, BoundarySetters &boundarySetters, cell_idx_t xOffset, cell_idx_t yOffset, cell_idx_t lowerExtrusionLimit, cell_idx_t upperExtrusionLimit)
 Initializes boundary values using an image. More...
 
- Public Member Functions inherited from walberla::geometry::initializer::Initializer
virtual ~Initializer ()=default
 

Protected Member Functions

Image_T resizeImageToDomain (const Image_T &img, uint_t extrusionCoord) const
 

Protected Attributes

StructuredBlockStoragestructuredBlockStorage_
 
BlockDataID handlingID_
 

Member Typedef Documentation

◆ BoundarySetters

template<typename BoundaryHandling_T , typename Image_T >
using walberla::geometry::initializer::BoundaryFromImage< BoundaryHandling_T, Image_T >::BoundarySetters = std::map<pixel_t, BoundarySetter<BoundaryHandling_T> >

◆ pixel_t

template<typename BoundaryHandling_T , typename Image_T >
using walberla::geometry::initializer::BoundaryFromImage< BoundaryHandling_T, Image_T >::pixel_t = typename Image_T::pixel_t

Constructor & Destructor Documentation

◆ BoundaryFromImage()

template<typename Handling , typename Image_T >
walberla::geometry::initializer::BoundaryFromImage< Handling, Image_T >::BoundaryFromImage ( StructuredBlockStorage blocks,
BlockDataID  handlerBlockDataID 
)

Member Function Documentation

◆ init() [1/3]

template<typename BoundaryHandling_T , typename Image_T >
void walberla::geometry::initializer::BoundaryFromImage< BoundaryHandling_T, Image_T >::init ( BlockStorage ,
const Config::BlockHandle block 
)
inlineoverridevirtual

Initializes the scalar field using parameters of config block for syntax see class documentation.

Implements walberla::geometry::initializer::Initializer.

◆ init() [2/3]

template<typename Handling , typename Image_T >
void walberla::geometry::initializer::BoundaryFromImage< Handling, Image_T >::init ( const Config::BlockHandle block)

◆ init() [3/3]

template<typename Handling , typename Image_T >
void walberla::geometry::initializer::BoundaryFromImage< Handling, Image_T >::init ( const Image_T &  img,
uint_t  extrusionCoord,
BoundarySetters boundarySetters,
cell_idx_t  xOffset,
cell_idx_t  yOffset,
cell_idx_t  lowerExtrusionLimit,
cell_idx_t  upperExtrusionLimit 
)

Initializes boundary values using an image.

Parameters
imgthe image
extrusionCoordthe image is set in slices where extrusionCoord is constant
boundarySettersa map from pixel value to boundary information
xOffsetoffset for the x IMAGE coordinate ( not cell coordinates )
yOffsetoffset for the y IMAGE coordinate ( not cell coordinates )
lowerExtrusionLimitonly cells where extrusionCoord is bigger than this parameter are modified
upperExtrusionLimitonly cells where extrusionCoord is smaller than this parameter are modified

◆ resizeImageToDomain()

template<typename Handling , typename Image_T >
Image_T walberla::geometry::initializer::BoundaryFromImage< Handling, Image_T >::resizeImageToDomain ( const Image_T &  img,
uint_t  extrusionCoord 
) const
protected

Member Data Documentation

◆ handlingID_

template<typename BoundaryHandling_T , typename Image_T >
BlockDataID walberla::geometry::initializer::BoundaryFromImage< BoundaryHandling_T, Image_T >::handlingID_
protected

◆ structuredBlockStorage_

template<typename BoundaryHandling_T , typename Image_T >
StructuredBlockStorage& walberla::geometry::initializer::BoundaryFromImage< BoundaryHandling_T, Image_T >::structuredBlockStorage_
protected

The documentation for this class was generated from the following files: