| 28 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 29 | |
| 30 | void Foam::blockMeshTools::read |
| 31 | ( |
| 32 | Istream& is, |
| 33 | label& val, |
| 34 | const dictionary& dict |
| 35 | ) |
| 36 | { |
| 37 | token t(is); |
| 38 | if (t.isLabel()) |
| 39 | { |
| 40 | val = t.labelToken(); |
| 41 | } |
| 42 | else if (t.isWord()) |
| 43 | { |
| 44 | const word& varName = t.wordToken(); |
| 45 | const entry* ePtr = dict.lookupScopedEntryPtr |
| 46 | ( |
| 47 | varName, |
| 48 | true, |
| 49 | true |
| 50 | ); |
| 51 | if (ePtr) |
| 52 | { |
| 53 | // Read as label |
| 54 | val = Foam::readLabel(ePtr->stream()); |
| 55 | } |
| 56 | else |
| 57 | { |
| 58 | FatalIOErrorInFunction(is) |
| 59 | << "Undefined variable " |
| 60 | << varName << ". Valid variables are " << dict |
| 61 | << exit(FatalIOError); |
| 62 | } |
| 63 | } |
| 64 | else |
| 65 | { |
| 66 | FatalIOErrorInFunction(is) |
| 67 | << "Illegal token " << t.info() |
| 68 | << " when trying to read label" |
| 69 | << exit(FatalIOError); |
| 70 | } |
| 71 | |
| 72 | is.fatalCheck |
| 73 | ( |
| 74 | "operator>>(Istream&, List<T>&) : reading entry" |
| 75 | ); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | Foam::label Foam::blockMeshTools::read |