walberla::geometry::initializer::ScalarFieldFromGrayScaleImage Class Reference

Detailed Description

Initializes a scalar field, using the pixel values from a gray scale image The real_t field is initialized with values between 0 and 1.

Example:

   <InitializerId> {
      file                 domain.png;
      extrusionCoordinate  1; // y coordinate
      lowerExtrusionLimit  5;
      upperExtrusionLimit  10;
      xOffset              5;
      yOffset              6;
   }

#include <ScalarFieldFromGrayScaleImage.h>

+ Inheritance diagram for walberla::geometry::initializer::ScalarFieldFromGrayScaleImage:

Public Member Functions

 ScalarFieldFromGrayScaleImage (StructuredBlockStorage &blocks, BlockDataID scalarFieldID)
 
void init (BlockStorage &blockStorage, const Config::BlockHandle &block) override
 Initializes the scalar field using parameters of config block for syntax see class documentation. More...
 
void init (const GrayScaleImage &img, uint_t extrusionCoord, cell_idx_t xOffset, cell_idx_t yOffset, cell_idx_t lowerExtrusionLimit=std::numeric_limits< cell_idx_t >::min(), cell_idx_t upperExtrusionLimit=std::numeric_limits< cell_idx_t >::max())
 Initializes scalar field using a gray scale image. More...
 
void init (const GrayScaleImage &img, uint_t extrusionCoord, bool rescaleToDomain=true, cell_idx_t lowerExtrusionLimit=std::numeric_limits< cell_idx_t >::min(), cell_idx_t upperExtrusionLimit=std::numeric_limits< cell_idx_t >::max())
 Initializes scalar field using a gray scale image. More...
 
- Public Member Functions inherited from walberla::geometry::initializer::Initializer
virtual ~Initializer ()=default
 

Protected Attributes

StructuredBlockStoragestructuredBlockStorage_
 
BlockDataID scalarFieldID_
 

Constructor & Destructor Documentation

◆ ScalarFieldFromGrayScaleImage()

walberla::geometry::initializer::ScalarFieldFromGrayScaleImage::ScalarFieldFromGrayScaleImage ( StructuredBlockStorage blocks,
BlockDataID  scalarFieldID 
)

Member Function Documentation

◆ init() [1/3]

void walberla::geometry::initializer::ScalarFieldFromGrayScaleImage::init ( BlockStorage blockStorage,
const Config::BlockHandle block 
)
overridevirtual

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

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

◆ init() [2/3]

void walberla::geometry::initializer::ScalarFieldFromGrayScaleImage::init ( const GrayScaleImage img,
uint_t  extrusionCoord,
bool  rescaleToDomain = true,
cell_idx_t  lowerExtrusionLimit = std::numeric_limits<cell_idx_t>::min(),
cell_idx_t  upperExtrusionLimit = std::numeric_limits<cell_idx_t>::max() 
)

Initializes scalar field using a gray scale image.

Parameters
rescaleToDomainif true the image is first rescaled to match the size of the domain other parameters as for function above

◆ init() [3/3]

void walberla::geometry::initializer::ScalarFieldFromGrayScaleImage::init ( const GrayScaleImage img,
uint_t  extrusionCoord,
cell_idx_t  xOffset,
cell_idx_t  yOffset,
cell_idx_t  lowerExtrusionLimit = std::numeric_limits<cell_idx_t>::min(),
cell_idx_t  upperExtrusionLimit = std::numeric_limits<cell_idx_t>::max() 
)

Initializes scalar field using a gray scale image.

Parameters
imgthe image
extrusionCoordthe image is set in slices where extrusionCoord is constant
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

Member Data Documentation

◆ scalarFieldID_

BlockDataID walberla::geometry::initializer::ScalarFieldFromGrayScaleImage::scalarFieldID_
protected

◆ structuredBlockStorage_

StructuredBlockStorage& walberla::geometry::initializer::ScalarFieldFromGrayScaleImage::structuredBlockStorage_
protected

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