| 31 | // * * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * // |
| 32 | |
| 33 | void Foam::meshReader::warnDuplicates |
| 34 | ( |
| 35 | const word& context, |
| 36 | const wordList& list |
| 37 | ) |
| 38 | { |
| 39 | HashTable<label> hashed(list.size()); |
| 40 | bool duplicates = false; |
| 41 | |
| 42 | forAll(list, listI) |
| 43 | { |
| 44 | // check duplicate name |
| 45 | HashTable<label>::iterator iter = hashed.find(list[listI]); |
| 46 | if (iter != hashed.end()) |
| 47 | { |
| 48 | (*iter)++; |
| 49 | duplicates = true; |
| 50 | } |
| 51 | else |
| 52 | { |
| 53 | hashed.insert(list[listI], 1); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | // warn about duplicate names |
| 58 | if (duplicates) |
| 59 | { |
| 60 | Info<< nl << "WARNING: " << context << " with identical names:"; |
| 61 | forAllConstIter(HashTable<label>, hashed, iter) |
| 62 | { |
| 63 | if (*iter > 1) |
| 64 | { |
| 65 | Info<< " " << iter.key(); |
| 66 | } |
| 67 | } |
| 68 | Info<< nl << endl; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | |
| 73 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // |