37 namespace implicitFunctions
43 composedFunctionImplicitFunction,
53 Foam::implicitFunctions::composedFunctionImplicitFunction::modeType
55 Foam::implicitFunctions::composedFunctionImplicitFunction::modeTypeNames
57 { modeType::ADD,
"add" },
58 { modeType::SUBTRACT,
"subtract" },
59 { modeType::MINDIST,
"minDist" },
60 { modeType::INTERSECT,
"intersect" },
65 Foam::implicitFunctions::composedFunctionImplicitFunction::selectFunction
72 case modeType::MINDIST:
81 case modeType::SUBTRACT:
95 case modeType::INTERSECT:
102 <<
"This mode is not supported only " <<
nl 103 <<
"Supported modes are: " <<
nl 115 Foam::implicitFunctions::composedFunctionImplicitFunction::
116 composedFunctionImplicitFunction
118 const dictionary&
dict 122 mode_(modeTypeNames.
get(
"mode",
dict)),
125 const dictionary& funcDict =
dict.subDict(
"composedFunction");
127 functions_.resize(funcDict.size());
128 values_.resize(funcDict.size(),
Zero);
132 for (
const entry& dEntry : funcDict)
134 const word&
key = dEntry.keyword();
136 if (!dEntry.isDict())
139 <<
"Entry " <<
key <<
" is not a dictionary" <<
endl 143 const dictionary& subdict = dEntry.dict();
165 values_[i] = functions_[i].value(
p);
168 const label idx = selectFunction(values_);
181 values_[i] =
mag(functions_[i].value(
p));
184 const label minIdx =
findMin(values_);
186 return functions_[minIdx].grad(
p);
198 values_[i] =
mag(functions_[i].value(
p));
201 const label minIdx =
findMin(values_);
203 return functions_[minIdx].distanceToSurfaces(
p);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
label findMax(const ListType &input, label start=0)
Linear search for the index of the max element, similar to std::max_element but for lists and returns...
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
virtual scalar value(const vector &p) const
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
virtual vector grad(const vector &p) const
virtual scalar distanceToSurfaces(const vector &p) const
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
dimensionedScalar pos(const dimensionedScalar &ds)
label findMin(const ListType &input, label start=0)
Linear search for the index of the min element, similar to std::min_element but for lists and returns...
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
errorManip< error > abort(error &err)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
defineTypeNameAndDebug(combustionModel, 0)
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)