walberla::geometry::initializer::OverlapFieldFromBody Class Reference

Detailed Description

Initializes a scalar field from a geometric body.

Currently supported are Sphere, Ellipsoid and Box (= AABB)

Example:

       <InitializerUID> {
            initialFill : drop;
            someArbitraryId {
               shape sphere;
               bubble;

               midpoint < 3,4,5>;
               radius 4;
            }
            object2 {
               shape box;
               drop;

               min <1,2,3>;
               max <3,4,5>;
            }
            object3_ellipse {
               bubble;
               shape ellipsoid;
               midpoint < 3,4,2>;
               axis1    <1,0,0>;
               axis2    <0,1,0>;
               radii    <1,1,4>;
            }
       }
* 

#include <OverlapFieldFromBody.h>

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

Public Member Functions

 OverlapFieldFromBody (StructuredBlockStorage &structuredBlockStorage, BlockDataID scalarFieldID, const std::string &addKeyword="drop", const std::string &subtractKeyword="bubble")
 Constructor. More...
 
void init (BlockStorage &blockStorage, const Config::BlockHandle &blockHandle) override
 Interface implementation for Initializer - sets a body on a scalar field with options from configuration file. More...
 
template<typename Body >
void init (const Body &body, bool addOrSubtract, uint_t superSamplingDepth=4)
 Sets a body on the scalar field. More...
 
- Public Member Functions inherited from walberla::geometry::initializer::Initializer
virtual ~Initializer ()=default
 

Protected Attributes

StructuredBlockStoragestructuredBlockStorage_
 
BlockDataID scalarFieldID_
 
std::string addKeyword_
 
std::string subtractKeyword_
 

Constructor & Destructor Documentation

◆ OverlapFieldFromBody()

walberla::geometry::initializer::OverlapFieldFromBody::OverlapFieldFromBody ( StructuredBlockStorage structuredBlockStorage,
BlockDataID  scalarFieldID,
const std::string &  addKeyword = "drop",
const std::string &  subtractKeyword = "bubble" 
)

Constructor.

Parameters
scalarFieldIDthe scalar field to initialize
addKeywordused when parsing a configuration block, and determining the addOrSubtract parameter for ScalarFieldFromBody::init(const Body&, bool) -> see documentation of this function. If the addKeyword is defined in the block, the overlapFraction is added to the cells otherwise subtracted
subtractKeywordsee above

Member Function Documentation

◆ init() [1/2]

void walberla::geometry::initializer::OverlapFieldFromBody::init ( BlockStorage blockStorage,
const Config::BlockHandle blockHandle 
)
overridevirtual

Interface implementation for Initializer - sets a body on a scalar field with options from configuration file.

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

◆ init() [2/2]

template<typename Body >
void walberla::geometry::initializer::OverlapFieldFromBody::init ( const Body &  body,
bool  addOrSubtract,
uint_t  superSamplingDepth = 4 
)

Sets a body on the scalar field.

Parameters
bodyThe body object - has to implement either overlapFraction(...), or contains(...) see BodyOverlapFunctions for detailed body concept
addOrSubtractif true the overlap between body and cell (fraction between 0 and 1) is added to scalar field, and if result is greater 1, then the value is set to one if false, the overlap is subtracted, and minimum value is zero

Supported bodies are Sphere, Ellipsoid, AABB. To add a new supported body implement concept defined in BodyOverlapFunctions.h, and add an explicit template instantiation in ScalarFieldFromBody.cpp for the new body.

Member Data Documentation

◆ addKeyword_

std::string walberla::geometry::initializer::OverlapFieldFromBody::addKeyword_
protected

◆ scalarFieldID_

BlockDataID walberla::geometry::initializer::OverlapFieldFromBody::scalarFieldID_
protected

◆ structuredBlockStorage_

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

◆ subtractKeyword_

std::string walberla::geometry::initializer::OverlapFieldFromBody::subtractKeyword_
protected

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