bool Foam::fileFormats::surfaceFormatsCore::checkSupport ( const wordHashSet& available, const word& ext, const bool verbose, const word& functionName ) { if (available.found(ext)) { return true; } else if (verbose) { wordList toc = available.toc(); SortableList<word> known(toc.xfer()); Info<<"Unknown file extension for " << functionName << " : " << ext << nl <<"Valid types: ("; // compact output: forAll(known, i) { Info<<" " << known[i]; } Info<<" )" << endl; } return false; }
Foam::coalCloudList::coalCloudList ( const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, const SLGThermo& slgThermo ) : PtrList<coalCloud>(), mesh_(rho.mesh()) { IOdictionary props ( IOobject ( "coalCloudList", mesh_.time().constant(), mesh_, IOobject::MUST_READ ) ); const wordHashSet cloudNames(wordList(props.lookup("clouds"))); setSize(cloudNames.size()); label i = 0; forAllConstIter(wordHashSet, cloudNames, iter) { const word& name = iter.key(); Info<< "creating cloud: " << name << endl; set ( i++, new coalCloud ( name, rho, U, g, slgThermo ) ); Info<< endl; } }
void Foam::vtkPV3Foam::pruneObjectList ( IOobjectList& objects, const wordHashSet& selected ) { // hash all the selected field names if (selected.empty()) { objects.clear(); } // only keep selected fields forAllIter(IOobjectList, objects, iter) { if (!selected.found(iter()->name())) { objects.erase(iter); } } }
void Foam::stringOps::variables ( wordHashSet& vars, const string& s, const char sigil ) { string::size_type begVar = 0; // Expand $VAR or ${VAR} // Repeat until nothing more is found while ( (begVar = s.find(sigil, begVar)) != string::npos && begVar < s.size()-1 ) { if (begVar == 0 || s[begVar-1] != '\\') { // Find end of first occurrence string::size_type endVar = begVar; string::size_type delim = 0; // The type/position of the ":-" or ":+" alternative values string::size_type altPos = string::npos; if (s[begVar+1] == '{') { endVar = s.find('}', begVar); delim = 1; // check for ${parameter:-word} or ${parameter:+word} if (endVar != string::npos) { altPos = begVar; findParameterAlternative(s, altPos, endVar); } } else { string::const_iterator iter = s.cbegin() + begVar + 1; // more generous in accepting keywords than for env variables while ( iter != s.cend() && ( isalnum(*iter) || *iter == '.' || *iter == ':' || *iter == '_' ) ) { ++iter; ++endVar; } } if (endVar == string::npos) { // likely parsed '${...' without closing '}' - abort break; } else if (endVar == begVar) { // parsed '${}' or $badChar - skip over begVar = endVar + 1; } else { const word varName ( s.substr ( begVar + 1 + delim, ( (altPos == string::npos ? endVar : altPos) - begVar - 2*delim ) ), false ); vars.insert(varName); begVar = endVar + 1; } } else { ++begVar; } } }