| 5986 | } |
| 5987 | |
| 5988 | int vtkExodusIIReader::GetObjectIndex(int objectType, const char* objectName) |
| 5989 | { |
| 5990 | if (!objectName) |
| 5991 | { |
| 5992 | vtkErrorMacro("You must specify a non-nullptr name"); |
| 5993 | return -1; |
| 5994 | } |
| 5995 | int nObj = this->GetNumberOfObjects(objectType); |
| 5996 | if (nObj == 0) |
| 5997 | { |
| 5998 | vtkDebugMacro("No objects of that type (" << objectType << ") to find index for given name " |
| 5999 | << objectName << "."); |
| 6000 | return -1; |
| 6001 | } |
| 6002 | |
| 6003 | std::string objectRealName(objectName); |
| 6004 | |
| 6005 | // handle legacy block names. |
| 6006 | vtksys::RegularExpression regex( |
| 6007 | "^(Unnamed block ID: [0-9]+)( Type: [0-9a-zA-Z]+)?( Size: [0-9]+)?$"); |
| 6008 | if (regex.find(objectRealName)) |
| 6009 | { |
| 6010 | objectRealName = regex.match(1); |
| 6011 | } |
| 6012 | |
| 6013 | for (int obj = 0; obj < nObj; ++obj) |
| 6014 | { |
| 6015 | const char* storedObjName = this->GetObjectName(objectType, obj); |
| 6016 | if (objectRealName == storedObjName) |
| 6017 | { |
| 6018 | return obj; |
| 6019 | } |
| 6020 | } |
| 6021 | vtkDebugMacro( |
| 6022 | "No objects named \"" << objectName << "\" of the specified type (" << objectType << ")."); |
| 6023 | return -1; |
| 6024 | } |
| 6025 | |
| 6026 | int vtkExodusIIReader::GetObjectIndex(int objectType, int id) |
| 6027 | { |
no test coverage detected