Go to the documentation of this file.
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);
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
virtual scalar distanceToSurfaces(const vector &p) const
static constexpr const zero Zero
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Ostream & endl(Ostream &os)
virtual vector grad(const vector &p) const
virtual scalar value(const vector &p) const
Macros for easy insertion into run-time selection tables.
errorManip< error > abort(error &err)
Vector< scalar > vector
A scalar version of the templated Vector.
errorManipArg< error, int > exit(error &err, const int errNo=1)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
#define FatalErrorInFunction
label findMax(const ListType &input, label start=0)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
#define FatalIOErrorInFunction(ios)
label findMin(const ListType &input, label start=0)
defineTypeNameAndDebug(combustionModel, 0)
dimensionedScalar pos(const dimensionedScalar &ds)