39 void Foam::LagrangianSchemes::clear()
42 defaultDdtScheme_.
clear();
44 defaultSpScheme_.
clear();
45 averagingSchemes_.
clear();
46 defaultAveragingScheme_.
clear();
47 interpolationSchemes_.
clear();
48 defaultInterpolationScheme_.
clear();
49 accumulationSchemes_.
clear();
50 defaultAccumulationScheme_.
clear();
56 const dictionary&
dict,
58 dictionary& typeSchemes,
59 ITstream& defaultTypeScheme
66 typeSchemes.found(
"default")
67 && word(typeSchemes.lookup(
"default")) !=
"none"
70 defaultTypeScheme = typeSchemes.
lookup(
"default");
77 read(
dict,
"ddt", ddtSchemes_, defaultDdtScheme_);
78 read(
dict,
"Sp", SpSchemes_, defaultSpScheme_);
84 defaultAveragingScheme_
90 interpolationSchemes_,
91 defaultInterpolationScheme_
98 defaultAccumulationScheme_
106 const dictionary& typeSchemes,
107 const ITstream& defaultTypeScheme
112 Info<<
"Lookup scheme for " <<
name <<
" in dictionary "
113 << typeSchemes.name().caseName() <<
endl;
117 DynamicList<Pair<word::size_type>> nameSubIndices;
124 nameChari <
name.size();
130 nameSubIndices.last().second() ++;
133 if (
name[nameChari] ==
'.' ||
name[nameChari] ==
':')
135 nameSubIndices.append({nameChari, 0});
138 else if (!isalnum(
name[nameChari]))
149 for (
label nRemoves = 0; nRemoves < nameSubIndices.size() + 1; ++ nRemoves)
151 const entry* schemePtr =
nullptr;
155 label removeMask = 0;
156 removeMask < (1 << nameSubIndices.size());
161 label thisNRemoves = 0;
162 for (
label r = removeMask; r > 0; r >>= 1) thisNRemoves += r % 2;
163 if (thisNRemoves != nRemoves)
continue;
169 forAll(nameSubIndices, nameSubi)
176 nameSubIndices[nameSubi].
first() - nameChari
180 if (!((1 << nameSubi) & removeMask))
186 nameSubIndices[nameSubi].
first(),
187 nameSubIndices[nameSubi].
second()
193 nameSubIndices[nameSubi].first()
194 + nameSubIndices[nameSubi].second();
196 filteredName.append(
name(nameChari,
name.size() - nameChari));
199 const entry* thisSchemePtr =
200 typeSchemes.lookupEntryPtr(filteredName,
false,
true);
204 if (schemePtr && thisSchemePtr)
207 <<
"keyword " <<
name <<
" ambiguously matches multiple "
208 <<
"schemes in dictionary " << typeSchemes.name()
212 schemePtr = thisSchemePtr;
217 return schemePtr->stream();
222 if (defaultTypeScheme.empty())
224 return typeSchemes.lookup(
name);
228 const_cast<ITstream&
>(defaultTypeScheme).rewind();
229 return const_cast<ITstream&
>(defaultTypeScheme);
249 defaultDdtScheme_(ddtSchemes_.
name() +
".default",
tokenList()),
251 defaultSpScheme_(SpSchemes_.
name() +
".default",
tokenList()),
256 objectPath() +
".averagingSchemes",
260 defaultAveragingScheme_
262 averagingSchemes_.
name() +
".default",
265 interpolationSchemes_
269 objectPath() +
".interpolationSchemes",
273 defaultInterpolationScheme_
275 interpolationSchemes_.
name() +
".default",
282 objectPath() +
".accumulationSchemes",
286 defaultAccumulationScheme_
288 accumulationSchemes_.
name() +
".default",
336 return lookup(
name, ddtSchemes_, defaultDdtScheme_);
342 return lookup(
name, SpSchemes_, defaultSpScheme_);
348 return lookup(
name, averagingSchemes_, defaultAveragingScheme_);
354 return lookup(
name, interpolationSchemes_, defaultInterpolationScheme_);
360 return lookup(
name, accumulationSchemes_, defaultAccumulationScheme_);
graph_traits< Graph >::vertices_size_type size_type
#define forAll(list, i)
Loop across all elements in list.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Selector class for Lagrangian schemes.
const dictionary & schemesDict() const
Access the dictionary.
ITstream & interpolation(const word &name) const
Get the interpolation scheme for the given field name.
ITstream & ddt(const word &name) const
Get the time scheme for the given field name.
~LagrangianSchemes()
Destructor.
ITstream & accumulation(const word &name) const
Get the accumulation scheme for the given field name.
ITstream & Sp(const word &name) const
Get the source scheme for the given field name.
ITstream & averaging(const word &name) const
Get the averaging scheme for the given field name.
LagrangianSchemes(const objectRegistry &db)
Construct for objectRegistry.
bool read()
Read the LagrangianSchemes.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void clear()
Clear the list, i.e. set size to zero.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
void clear()
Clear the dictionary.
Registry of regIOobjects.
virtual bool read()
Read object.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
int system(const std::string &command)
Execute the specified command.
bool read(const char *, int32_t &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList second(const UList< labelPair > &p)
labelList first(const UList< labelPair > &p)
defineTypeNameAndDebug(combustionModel, 0)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.