7#ifndef LBSRCTERMCONTROLLER_H
8#define LBSRCTERMCONTROLLER_H
28template <MInt nDim, MInt nDist,
class SysEqn>
46template <MInt nDim, MInt nDist,
class SysEqn>
105template <MInt nDim, MInt nDist,
class SysEqn>
120 std::vector<std::unique_ptr<LbSrcTerm<nDim, nDist, SysEqn>>>
m_srcTerms;
127template <MInt nDim, MInt nDist,
class SysEqn>
130 std::stringstream ss;
131 ss <<
"- Init source terms:" << std::endl;
137 ss <<
" no source terms =" << m_noSrcTerms << std::endl;
139 if(m_noSrcTerms > 0) {
140 for(
MInt i = 0; i < m_noSrcTerms; i++) {
141 const MString srcTermName = Context::getBasicProperty<MString>(
"lbSrcTerms", AT_, &srcTermName, i);
143 ss << srcTermName <<
" ";
147 if(m_solver->domainId() == 0) std::cout << ss.str();
155template <MInt nDim, MInt nDist,
class SysEqn>
158 for(
auto& srcTerm : m_srcTerms) {
168template <MInt nDim, MInt nDist,
class SysEqn>
178template <MInt nDim, MInt nDist,
class SysEqn>
181 for(
auto& srcTerm : m_srcTerms) {
182 srcTerm->apply_preCollision();
190template <MInt nDim, MInt nDist,
class SysEqn>
193 for(
auto& srcTerm : m_srcTerms) {
194 srcTerm->apply_postCollision();
202template <MInt nDim, MInt nDist,
class SysEqn>
205 for(
auto& srcTerm : m_srcTerms) {
206 srcTerm->apply_postPropagation();
static MInt propertyLength(const MString &name, MInt solverId=m_noSolvers)
Returns the number of elements of a property.
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
This class represents all LB models.
Class for registering a source term to the factory registry.
LbRegSrcTerm(const MString &p_name)
Constructor, does the registering.
Front-end to control all source terms in a wrapping manner.
void apply_preCollision()
Call the pre collision routines of all source terms.
void initSrcTerms()
Initialize the source term controller.
std::vector< std::unique_ptr< LbSrcTerm< nDim, nDist, SysEqn > > > m_srcTerms
LbSolverDxQy< nDim, nDist, SysEqn > * m_solver
void apply_postCollision()
Call the post collision routines of all source terms.
void apply_postPropagation()
Call the post collision routines of all source terms.
LbSrcTermController(LbSolverDxQy< nDim, nDist, SysEqn > *p_solver)
void init()
Initialize the source term controller.
void addSrcTerm(const MString &p_name)
Add a source term to the controller by its property tag.
Front-end to create source term objects.
LbSrcTerm< nDim, nDist, SysEqn > * create_srcTerm(const MString &p_name, LbSolverDxQy< nDim, nDist, SysEqn > *p_solver)
Create an lb source term object and return a pointer to it.
static LbSrcTermFactory * instance()
Creates a static instance of LbSrcTermFactory.
void reg_function(const MString &p_name, srcTermConstructor fact_function)
Adds a new LbSrcTerm object to the function registry.
std::map< std::string, srcTermConstructor > m_function_reg
std::function< LbSrcTerm< nDim, nDist, SysEqn > *(LbSolverDxQy< nDim, nDist, SysEqn > *)> srcTermConstructor
Abstract class for lb source terms.
std::basic_string< char > MString