Commit d7995486 authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: simplify IO routines for ac3d, types in isoSurface

parent 7f32509a
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2019 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -1248,9 +1248,7 @@ Foam::triSurface Foam::isoSurfaceCell::subsetMesh
if (include[oldFacei])
{
// Renumber labels for face
const triSurface::FaceType& f = s[oldFacei];
for (const label oldPointi : f)
for (const label oldPointi : s[oldFacei])
{
if (oldToNewPoints[oldPointi] == -1)
{
......
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2019 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -49,6 +49,7 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class polyMesh;
class tetMatcher;
......@@ -170,7 +171,7 @@ class isoSurfaceTopo
void triangulateOutside
(
const bool filterDiag,
const PrimitivePatch<face, SubList, const pointField&>& pp,
const primitivePatch& pp,
const boolList& pointFromDiag,
const labelList& pointToFace,
const label cellID,
......
......@@ -261,17 +261,11 @@ bool Foam::fileFormats::AC3DsurfaceFormat<Face>::read
namespace Foam
{
// file-scope writing of a patch of faces
template
<
class Face,
template<class> class FaceList,
class PointField,
class PointType
>
template<class Patch>
static void writeZone
(
Ostream& os,
const PrimitivePatch<Face, FaceList, PointField, PointType>& patch,
const Patch& patch,
const word& name,
const label zoneI
)
......@@ -289,7 +283,7 @@ static void writeZone
os << "numsurf " << patch.size() << nl;
for (const Face& f : patch.localFaces())
for (const auto& f : patch.localFaces())
{
os << "SURF 0x20" << nl // polygon
<< "mat " << zoneI << nl
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -28,7 +29,6 @@ License
#include "AC3DsurfaceFormatCore.H"
#include "clock.H"
#include "IFstream.H"
#include "StringStream.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -82,9 +82,9 @@ bool Foam::fileFormats::AC3DsurfaceFormatCore::cueTo
string& args
)
{
string line;
while (is.good())
{
string line;
is.getLine(line);
const auto space = line.find(' ');
......
......@@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -39,6 +40,7 @@ SourceFiles
#include "Fstream.H"
#include "surfZone.H"
#include "StringStream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -57,9 +59,17 @@ protected:
// Protected Static Member Functions
//- Read a type via IStringStream
//- Read a type from string
template<class Type>
static Type parse(const string& str);
static Type parse(const string& str)
{
IStringStream is(str);
Type t;
is >> t;
return t;
}
//- Read cmd, args from IFstream
// The cmd is the content up to the first space, args is the balance
......@@ -93,12 +103,6 @@ protected:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "AC3DsurfaceFormatCoreTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "AC3DsurfaceFormatCore.H"
#include "StringStream.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
Type Foam::fileFormats::AC3DsurfaceFormatCore::parse(const string& str)
{
IStringStream is(str);
Type t;
is >> t;
return t;
}
// ************************************************************************* //
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment