62 CepsString::size_type pos = params.find(
" ");
64 CepsString rest = pos == std::string::npos ?
"" : params.substr(pos+1);
67 "When adding source term, no parameters found after key " << key
70 add(key,rest,computeSupport);
81 CepsString::size_type pos = params.find(
" ");
83 CepsString rest = pos == std::string::npos ?
"" : params.substr(pos+1);
86 "When adding source term, no parameters found after function name " << key <<
" " << dicokey
89 add(key,dicokey,rest,computeSupport);
112 add(key,params,func,computeSupport);
144 if (options.contains(COMPONENT))
147 "When adding source term, missing unknown identifier after "<< COMPONENT <<
" keyword"
155 for (
auto label : {ATTRIBUTE, ATTRIBUTES})
156 if (options.contains(label))
159 "When adding source term, could not find any attribute after " << label <<
" keyword"
165 if (attributes.empty())
170 if (options.contains(SCALE))
173 "When adding source term, could not find real number after SCALE keyword"
181 if (options.contains(TYPE))
184 "When adding source term, could not find any entry after TYPE keyword"
186 if (options[TYPE].at(0) ==
"KTERM")
188 else if (options[TYPE].at(0) ==
"IAPP")
193 "When adding source term, invalid entry after TYPE keyword. Valid types are\n") +
194 " KTERM (for source terms to be mulitplied XXX FIXME XXX )\n" +
195 " IAPP (volumic source term specific to cardiac PDEs)\n" +
196 " DEFAULT (regular source term)"
211 if (not attributes.empty())
222 return d->getUnknown()->getIdentifier() == component;
242 CEPS_WARNS (
"already contains a source term with the key " << nkey <<
". Ignoring.");
247 m_manager->insert(std::make_pair(nkey,st));
249 CEPS_SAYS (
" Added new source term : " << key);
257 obj.second->actualize(time);
267 "Source term manager has no source term with label " + label
297 if (isEnabledOption(flag, it.second->getFlag()))
CepsSourceTermFlag
Source terms flags.
@ Laplace
A source term that multiplies grad phi (for FE)
@ Default
Simply add the source term.
@ Stimulation
Apply cardiac specific treatment before adding.
#define CEPS_SAYS(message)
Writes a message in the debug log and in the terminal (stdio).
#define CEPS_ABORT_IF(condition, message)
Stops the execution with a message if condition is true. If testing is enabled, only throws a runtime...
#define CEPS_WARNS(message)
Writes a warning in the debug log and in the terminal (stderr).
std::basic_string< CepsChar > CepsString
C++ format string.
CepsIndex CepsUnknownIndex
For unknowns.
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
std::vector< _Type, _Alloc > CepsVector
C++ vector.
CepsInt CepsAttribute
Used to define regions.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
float CepsReal
Need single precision floating point.
constexpr CepsAttribute CepsUniversal
This attribute means "everywhere".
void onlyOnThisProc(CepsBool value=true)
Choose only object that belongs to this proc.
void onlyOnBoundary(CepsBool value=true)
Choose only objects that are on boundary.
Base class for other (big) CEPS classes. All classes can get a pointer to this base class and also co...
A degree of freedom for any kind of problem The dof can be associated to a geometrical element or not...
const CepsVector< _Type > & getOwned() const
Get data owned by the processor, const.
void setScaleFactor(CepsReal scaleFactor)
Scale the result.
void computeSupport(AbstractSelector< _Iterator > *selector, CepsBool canStartEmpty=false)
Computes the support in the domains of definition, using the given selector.
FunctionDictionary that holds functions which can be used to define source terms, boundary conditions...
void addConstant(const CepsString &label, const CepsString ¶ms)
Add a constant function through parameter string.
CepsBool hasScalar(const CepsString &label) const
Tells if function "label" is registered.
const ScalarEntry getScalar(const CepsString &label) const
Get a single scalar entry, const version.
A SAFunc is a ceps::Function that uses CepsStandardArgs as argument of call operator (),...
~SourceTermManager() final
Destroy the Source Term Manager object : default destructor.
void actualizeAll(CepsReal time)
Actualize all data inside.
FunctionDictionary * m_dictionary
the dictionary
SourceTermManager(FunctionDictionary *dico)
Construct a new Source Term Manager object, linked with dictionary of functions.
DistributedInfos< DegreeOfFreedom * > * m_dofs
dofs
Manager * m_manager
the manager
void add(const CepsString ¶ms, CepsBool computeSupport=false)
Add a source term from parameters.
void setDofsInfos(DistributedInfos< DegreeOfFreedom * > *dofs)
Set dofs infos in this class.
CepsMap< CepsString, ScalarSourceTerm * > Manager
Alias for manager inside.
Manager *const getManager() const
Get a map of all source terms.
ScalarSourceTerm * getSourceTerm(CepsString label) const
Get a source term, nullptr if not found.
CepsUInt getNbOfSourceTermsOf(CepsSourceTermFlag flag) const
Number of registered source terms of type flag.
CepsVector< ScalarSourceTerm * > asVector() const
Get a vector of all source terms.
Source term, essentially a ScalarField.
void setFlag(const CepsSourceTermFlag &flag)
Set the source term flag.
void setAttributes(const CepsVector< CepsAttribute > &attributes)
Sets the attributes of the entity.
A namespace for all utility methods.
CepsString toKey(const CepsString &s)
Transform to key type a std::string, upper case and no spaces.
CepsMap< CepsString, CepsVector< CepsString > > splitByKeyword(const CepsString &s, const CepsSet< CepsString > &tags)
Extract parameters in the CepsString given by tags. Builds a map of keywords and parameter words acco...
_Type * getNew(_Args... args)
Allocates memory for one object. Be careful, the expansion of arguments may produce some weird result...
constexpr auto toIntegral(_Enum e) -> typename std::underlying_type< _Enum >::type
Converts an enum type variable to an integer.
CepsVector< _Tp > valuesOf(const CepsMap< _Key, _Tp, _Comp, _Alloc > &m)
Get the values of a map as a vector.
CepsInt toInt(const CepsString &s)
Cast CepsString to CepsInt.
CepsBool isNumber(const CepsString &s)
Check if the string contains only digit numbers.
void destroyObject(_Type &)
Destroy[delete] any type.
CepsReal toReal(const CepsString &s)
Cast CepsString to CepsReal.