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();
54 void Foam::LagrangianSchemes::readScheme
57 dictionary& typeSchemes,
58 ITstream& defaultTypeScheme
61 typeSchemes = subDict(
type +
"Schemes");
65 typeSchemes.found(
"default")
66 && word(typeSchemes.lookup(
"default")) !=
"none"
69 defaultTypeScheme = typeSchemes.lookup(
"default");
74 void Foam::LagrangianSchemes::readDict()
76 readScheme(
"ddt", ddtSchemes_, defaultDdtScheme_);
77 readScheme(
"Sp", SpSchemes_, defaultSpScheme_);
82 defaultAveragingScheme_
87 interpolationSchemes_,
88 defaultInterpolationScheme_
94 defaultAccumulationScheme_
102 const dictionary& typeSchemes,
103 const ITstream& defaultTypeScheme
108 Info<<
"Lookup scheme for " <<
name <<
" in dictionary "
109 << typeSchemes.name().caseName() <<
endl;
113 DynamicList<Pair<word::size_type>> nameSubIndices;
120 nameChari <
name.size();
126 nameSubIndices.last().second() ++;
129 if (
name[nameChari] ==
'.' ||
name[nameChari] ==
':')
131 nameSubIndices.append({nameChari, 0});
134 else if (!isalnum(
name[nameChari]))
145 for (
label nRemoves = 0; nRemoves < nameSubIndices.size() + 1; ++ nRemoves)
147 const entry* schemePtr =
nullptr;
151 label removeMask = 0;
152 removeMask < (1 << nameSubIndices.size());
157 label thisNRemoves = 0;
158 for (
label r = removeMask; r > 0; r >>= 1) thisNRemoves += r % 2;
159 if (thisNRemoves != nRemoves)
continue;
165 forAll(nameSubIndices, nameSubi)
172 nameSubIndices[nameSubi].
first() - nameChari
176 if (!((1 << nameSubi) & removeMask))
182 nameSubIndices[nameSubi].
first(),
183 nameSubIndices[nameSubi].
second()
189 nameSubIndices[nameSubi].first()
190 + nameSubIndices[nameSubi].second();
192 filteredName.append(
name(nameChari,
name.size() - nameChari));
195 const entry* thisSchemePtr =
196 typeSchemes.lookupEntryPtr(filteredName,
false,
true);
200 if (schemePtr && thisSchemePtr)
203 <<
"keyword " <<
name <<
" ambiguously matches multiple "
204 <<
"schemes in dictionary " << typeSchemes.name()
208 schemePtr = thisSchemePtr;
213 return schemePtr->stream();
218 if (defaultTypeScheme.empty())
220 return typeSchemes.lookup(
name);
224 const_cast<ITstream&
>(defaultTypeScheme).rewind();
225 return const_cast<ITstream&
>(defaultTypeScheme);
245 defaultDdtScheme_(ddtSchemes_.
name() +
".default",
tokenList()),
247 defaultSpScheme_(SpSchemes_.
name() +
".default",
tokenList()),
252 objectPath() +
".averagingSchemes",
256 defaultAveragingScheme_
258 averagingSchemes_.
name() +
".default",
261 interpolationSchemes_
265 objectPath() +
".interpolationSchemes",
269 defaultInterpolationScheme_
271 interpolationSchemes_.
name() +
".default",
278 objectPath() +
".accumulationSchemes",
282 defaultAccumulationScheme_
284 accumulationSchemes_.
name() +
".default",
319 return lookupScheme(
name, ddtSchemes_, defaultDdtScheme_);
325 return lookupScheme(
name, SpSchemes_, defaultSpScheme_);
331 return lookupScheme(
name, averagingSchemes_, defaultAveragingScheme_);
340 interpolationSchemes_,
341 defaultInterpolationScheme_
348 return lookupScheme(
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.
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.
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.
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)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.