From 82a9f2c949ea57872b2e0cc3e018bf7545ff5588 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 16 Jan 2018 13:20:58 +0100 Subject: [PATCH] BUG: spurious empty surface zones added (fixes #706) - problems were introduced by the change ee252307d39adc3d (issue #686). Affected reading of OBJ files. The fallback zone (used to catch unnamed groups/zones), which was previously filtered away when not needed. Now handle more explicitly. ENH: use stringOps::split and low-level read{Label,Scalar} for parsing OBJ file --- .../edgeMeshFormats/obj/OBJedgeFormat.C | 215 +++++++++--------- .../edgeMeshFormats/obj/OBJedgeFormat.H | 14 +- .../surfaceFormats/nas/NASsurfaceFormat.C | 72 +++--- .../surfaceFormats/obj/OBJsurfaceFormat.C | 179 ++++++++------- .../starcd/STARCDsurfaceFormat.C | 44 ++-- .../surfaceFormats/vtk/VTKsurfaceFormat.C | 2 +- 6 files changed, 258 insertions(+), 268 deletions(-) diff --git a/src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C b/src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C index 5153b212e3..a6ef7f2dae 100644 --- a/src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C +++ b/src/meshTools/edgeMesh/edgeMeshFormats/obj/OBJedgeFormat.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,8 +27,55 @@ License #include "clock.H" #include "Fstream.H" #include "Ostream.H" -#include "StringStream.H" -#include "ListOps.H" +#include "stringOps.H" + +// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Token list with one of the following: +// f v1 v2 v3 ... +// f v1/vt1 v2/vt2 v3/vt3 ... +// l v1 v2 v3 ... +// l v1/vt1 v2/vt2 v3/vt3 ... +static label readObjVertices +( + const SubStrings& tokens, + DynamicList