1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "FTRsurfaceFormat.H"
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 Foam::fileFormats::FTRsurfaceFormat<Face>::FTRsurfaceFormat
35 const fileName& filename
42 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
45 bool Foam::fileFormats::FTRsurfaceFormat<Face>::read
47 const fileName& filename
52 IFstream is(filename);
57 "fileFormats::FTRsurfaceFormat::read(const fileName&)"
59 << "Cannot read file " << filename
63 List<ftrPatch> ftrPatches(is);
65 // points read directly
66 is >> this->storedPoints();
68 // triFaces read with attached keys
69 List< Keyed<triFace> > facesRead(is);
71 List<Face> faceLst(facesRead.size());
72 List<label> zoneIds(facesRead.size());
74 // disentangle faces/keys - already triangulated
75 forAll(facesRead, faceI)
77 // unfortunately cannot transfer to save memory
78 faceLst[faceI] = facesRead[faceI];
79 zoneIds[faceI] = facesRead[faceI].key();
82 this->storedFaces().transfer(faceLst);
83 this->storedZoneIds().transfer(zoneIds);
86 // change ftrPatch into surfZoneIdentifier
87 List<surfZoneIdentifier> newZones(ftrPatches.size());
88 forAll(newZones, zoneI)
90 newZones[zoneI] = surfZoneIdentifier
92 ftrPatches[zoneI].name(),
97 this->storedZoneToc().transfer(newZones);
102 // ************************************************************************* //