diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C index 8c6a557060..df30a8698e 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkMesh.C @@ -142,31 +142,45 @@ int main(int argc, char *argv[]) const word surfaceFormat = args.getOrDefault("writeSets", ""); const bool writeSets = surfaceFormat.size(); + + // All potential writeable fields + const wordHashSet allFields + ({ + "nonOrthoAngle", + "faceWeight", + "skewness", + "cellDeterminant", + "aspectRatio", + "cellShapes", + "cellVolume", + "cellVolumeRatio", + "minTetVolume", + "minPyrVolume", + "cellRegion", + "wallDistance", + "cellZone", + "faceZone" + }); + wordHashSet selectedFields; - bool writeFields = args.readIfPresent - ( - "writeFields", - selectedFields - ); - if (!writeFields && args.found("writeAllFields")) + if (args.found("writeFields")) { - selectedFields.insert - ({ - "nonOrthoAngle", - "faceWeight", - "skewness", - "cellDeterminant", - "aspectRatio", - "cellShapes", - "cellVolume", - "cellVolumeRatio", - "minTetVolume", - "minPyrVolume", - "cellRegion", - "wallDistance", - "cellZone", - "faceZone" - }); + selectedFields = args.getList("writeFields"); + wordHashSet badFields(selectedFields); + badFields -= allFields; + + if (!badFields.empty()) + { + FatalErrorInFunction + << "Illegal field(s) " << flatOutput(badFields.sortedToc()) + << nl + << "Valid fields are " << flatOutput(allFields.sortedToc()) + << nl << exit(FatalError); + } + } + else if (args.found("writeAllFields")) + { + selectedFields = allFields; }