ENH: consistency improvements for surface patch handling (fixes #483)

- remove (unused) Istream constructors, prune some unused methods,
  rationalize write() vs writeDict().
  Deprecate inconsistent construction order.

- handle empty names for ".ftr" surface patches (for plain triSurface
  format) with double-quoted strings for more reliable streaming.
  Written on a single line.

  This is _backward_ compatible, but if users have been parsing these
  files manually, they will need to adjust their code.

Previously:
```
  (
  frt-fairing:001%1
  empty

  windshield:002%2
  empty
  ...
  )
```

Updated (with example handling of empty name):
```
  (
  frt-fairing:001%1 empty

  windshield:002%2 ""
  ...
  )
```
This commit is contained in:
Mark Olesen
2020-01-16 10:07:26 +01:00
parent 9dbf94777c
commit 2a98c4e665
29 changed files with 625 additions and 567 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -550,9 +550,9 @@ int main(int argc, char *argv[])
{
patches[nRegions] = geometricSurfacePatch
(
"patch",
geometry[surfaces[i]].name() + "_" + regions[regionI],
nRegions
nRegions,
"patch"
);
nRegions++;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -262,9 +263,9 @@ int main(int argc, char *argv[])
{
patches[nRegions] = geometricSurfacePatch
(
"patch",
geometry[surfaces[i]].name() + "_" + regions[regionI],
nRegions
nRegions,
"patch"
);
nRegions++;
}

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -121,9 +122,9 @@ bool Foam::searchableSurfaceModifiers::autoPatch::modify
{
geometricSurfacePatch patch
(
surf.patches()[regionI].geometricType(),
surf.patches()[regionI].name() + Foam::name(subI),
surf.patches().size()
surf.patches().size(),
surf.patches()[regionI].geometricType()
);

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -73,13 +74,12 @@ void Foam::searchableSurfaceModifiers::cut::triangulate
}
}
geometricSurfacePatchList patches(fcs.size());
forAll(patches, patchI)
forAll(patches, patchi)
{
patches[patchI] = geometricSurfacePatch
patches[patchi] = geometricSurfacePatch
(
"",
"patch" + Foam::name(patchI),
patchI
"patch" + Foam::name(patchi),
patchi
);
}
cutSurf = triSurface(tris, patches, pts, true);
@ -345,9 +345,9 @@ bool Foam::searchableSurfaceModifiers::cut::modify
newPatches.setSize(sz+1);
newPatches[sz] = geometricSurfacePatch
(
newPatches[sz-1].geometricType(),
newPatches[sz-1].name() + "_inside",
newPatches[sz-1].index()
newPatches[sz-1].index(),
newPatches[sz-1].geometricType()
);
Info<< "Moving " << nInside << " out of " << surf3.size()