Initializes a scalar field from a geometric body.
Currently supported are Sphere, Ellipsoid and Box (= AABB)
Examples:
<InitializerUID> { initialFill : drop; someArbitraryId { shape sphere; add; // add to the current value in the field value 1.0; midpoint < 3,4,5>; radius 4; id 0; // If given a vector of scalar fields, which one of them to operate on. // Should be zero (the default value) if given a scalar field directly. } object2 { shape box; add; value -3.14; min <1,2,3>; max <3,4,5>; } object3_ellipse { set; // overwrite the current value in the field value 0; shape ellipsoid; midpoint < 3,4,2>; axis1 <1,0,0>; axis2 <0,1,0>; radii <1,1,4>; } }
#include <ScalarFieldFromBody.h>
Public Types | |
using | Value_T = typename Field_T::value_type |
Public Member Functions | |
ScalarFieldFromBody (StructuredBlockStorage &structuredBlockStorage, BlockDataID scalarFieldID) | |
Constructor. More... | |
ScalarFieldFromBody (StructuredBlockStorage &structuredBlockStorage, std::vector< BlockDataID > scalarFieldID) | |
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, Value_T value, bool addOrSet, std::vector< BlockDataID >::size_type id=0) |
Sets a body on the scalar field. More... | |
template<typename Body > | |
void | init (const Body &body, math::FunctionParser &parser, bool addOrSet, std::vector< BlockDataID >::size_type id=0) |
Sets a body on the scalar field. More... | |
Public Member Functions inherited from walberla::geometry::initializer::Initializer | |
virtual | ~Initializer ()=default |
Protected Attributes | |
StructuredBlockStorage & | structuredBlockStorage_ |
std::vector< BlockDataID > | scalarFieldID_ |
std::string | addKeyword_ |
std::string | setKeyword_ |
using walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::Value_T = typename Field_T::value_type |
|
inline |
Constructor.
scalarFieldID | the scalar field to initialize, or a vector of scalar fields to initialize based on the id specified with the body |
walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::ScalarFieldFromBody | ( | StructuredBlockStorage & | structuredBlockStorage, |
std::vector< BlockDataID > | scalarFieldID | ||
) |
|
overridevirtual |
Interface implementation for Initializer - sets a body on a scalar field with options from configuration file.
Implements walberla::geometry::initializer::Initializer.
void walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::init | ( | const Body & | body, |
math::FunctionParser & | parser, | ||
bool | addOrSet, | ||
std::vector< BlockDataID >::size_type | id = 0 |
||
) |
Sets a body on the scalar field.
body | The body object - has to implement either overlapFraction(...), or contains(...) see BodyOverlapFunctions for detailed body concept |
parser | A function parser which will have the variables x,y,z bound before it is evaluated |
addOrSet | If true, the value is added to scalar field If false, the value is set on the scalar field. |
id | If operating on a vector of fields, which field to treat. Zero otherwise. |
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.
void walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::init | ( | const Body & | body, |
Value_T | value, | ||
bool | addOrSet, | ||
std::vector< BlockDataID >::size_type | id = 0 |
||
) |
Sets a body on the scalar field.
body | The body object - has to implement either overlapFraction(...), or contains(...) see BodyOverlapFunctions for detailed body concept |
value | The value to set on the matched cells in the field. |
addOrSet | If true, the value is added to scalar field If false, the value is set on the scalar field. |
id | If operating on a vector of fields, which field to treat. Zero otherwise. |
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.
|
protected |
|
protected |
|
protected |
|
protected |