walberla::geometry::initializer::ScalarFieldFromBody< Field_T > Class Template Reference

Detailed Description

template<typename Field_T>
class walberla::geometry::initializer::ScalarFieldFromBody< Field_T >

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>

+ Inheritance diagram for walberla::geometry::initializer::ScalarFieldFromBody< Field_T >:

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

StructuredBlockStoragestructuredBlockStorage_
 
std::vector< BlockDataIDscalarFieldID_
 
std::string addKeyword_
 
std::string setKeyword_
 

Member Typedef Documentation

◆ Value_T

template<typename Field_T >
using walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::Value_T = typename Field_T::value_type

Constructor & Destructor Documentation

◆ ScalarFieldFromBody() [1/2]

template<typename Field_T >
walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::ScalarFieldFromBody ( StructuredBlockStorage structuredBlockStorage,
BlockDataID  scalarFieldID 
)
inline

Constructor.

Parameters
scalarFieldIDthe scalar field to initialize, or a vector of scalar fields to initialize based on the id specified with the body

◆ ScalarFieldFromBody() [2/2]

template<typename Field_T >
walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::ScalarFieldFromBody ( StructuredBlockStorage structuredBlockStorage,
std::vector< BlockDataID scalarFieldID 
)

Member Function Documentation

◆ init() [1/3]

template<typename Field_T >
void walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::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/3]

template<typename Field_T >
template<typename Body >
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.

Parameters
bodyThe body object - has to implement either overlapFraction(...), or contains(...) see BodyOverlapFunctions for detailed body concept
parserA function parser which will have the variables x,y,z bound before it is evaluated
addOrSetIf true, the value is added to scalar field If false, the value is set on the scalar field.
idIf 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.

◆ init() [3/3]

template<typename Field_T >
template<typename 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.

Parameters
bodyThe body object - has to implement either overlapFraction(...), or contains(...) see BodyOverlapFunctions for detailed body concept
valueThe value to set on the matched cells in the field.
addOrSetIf true, the value is added to scalar field If false, the value is set on the scalar field.
idIf 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.

Member Data Documentation

◆ addKeyword_

template<typename Field_T >
std::string walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::addKeyword_
protected

◆ scalarFieldID_

template<typename Field_T >
std::vector<BlockDataID> walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::scalarFieldID_
protected

◆ setKeyword_

template<typename Field_T >
std::string walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::setKeyword_
protected

◆ structuredBlockStorage_

template<typename Field_T >
StructuredBlockStorage& walberla::geometry::initializer::ScalarFieldFromBody< Field_T >::structuredBlockStorage_
protected

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