1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "FTRsurfaceFormat.H"
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 Foam::fileFormats::FTRsurfaceFormat<Face>::FTRsurfaceFormat
36 const fileName& filename
43 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
46 bool Foam::fileFormats::FTRsurfaceFormat<Face>::read
48 const fileName& filename
53 IFstream is(filename);
58 "fileFormats::FTRsurfaceFormat::read(const fileName&)"
60 << "Cannot read file " << filename
64 List<ftrPatch> ftrPatches(is);
66 // points read directly
67 is >> this->storedPoints();
69 // triFaces read with attached keys
70 List< Keyed<triFace> > facesRead(is);
72 List<Face> faceLst(facesRead.size());
73 List<label> zoneIds(facesRead.size());
75 // disentangle faces/keys - already triangulated
76 forAll(facesRead, faceI)
78 // unfortunately cannot transfer to save memory
79 faceLst[faceI] = facesRead[faceI];
80 zoneIds[faceI] = facesRead[faceI].key();
83 this->storedFaces().transfer(faceLst);
84 this->storedZoneIds().transfer(zoneIds);
87 // change ftrPatch into surfZoneIdentifier
88 List<surfZoneIdentifier> newZones(ftrPatches.size());
89 forAll(newZones, zoneI)
91 newZones[zoneI] = surfZoneIdentifier
93 ftrPatches[zoneI].name(),
98 this->storedZoneToc().transfer(newZones);
103 // ************************************************************************* //