1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "objectRegistry.H"
27 #include "STARCDsurfaceFormatCore.H"
29 #include "IStringStream.H"
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33 bool Foam::fileFormats::STARCDsurfaceFormatCore::readHeader
43 "fileFormats::STARCDsurfaceFormatCore::readHeader(...)"
45 << "cannot read " << signature << " " << is.name()
55 IStringStream(line)() >> header;
58 IStringStream(line)() >> majorVersion;
60 // add other checks ...
61 if (header != signature)
63 Info<< "header mismatch " << signature << " " << is.name()
71 void Foam::fileFormats::STARCDsurfaceFormatCore::writeHeader
77 os << "PROSTAR_" << filetype << nl
90 bool Foam::fileFormats::STARCDsurfaceFormatCore::readPoints
105 "fileFormats::STARCDsurfaceFormatCore::readPoints(...)"
107 << "Cannot read file " << is.name()
111 readHeader(is, "PROSTAR_VERTEX");
113 DynamicList<point> dynPoints;
114 // STAR-CD index of points
115 dynamicLabelList dynPointId;
118 while ((is >> lineLabel).good())
124 dynPoints.append(point(x, y, z));
125 dynPointId.append(lineLabel);
128 points.transfer(dynPoints);
129 ids.transfer(dynPointId);
136 void Foam::fileFormats::STARCDsurfaceFormatCore::writePoints
139 const pointField& pointLst
142 writeHeader(os, "VERTEX");
144 // Set the precision of the points data to 10
147 // force decimal point for Fortran input
148 os.setf(std::ios::showpoint);
150 forAll(pointLst, ptI)
154 << pointLst[ptI].x() << " "
155 << pointLst[ptI].y() << " "
156 << pointLst[ptI].z() << nl;
162 void Foam::fileFormats::STARCDsurfaceFormatCore::writeCase
165 const pointField& pointLst,
167 const UList<surfZone>& zoneLst
170 word caseName = os.name().lessExt().name();
172 os << "! STAR-CD file written " << clock::dateTime().c_str() << nl
173 << "! " << pointLst.size() << " points, " << nFaces << " faces" << nl
174 << "! case " << caseName << nl
175 << "! ------------------------------" << nl;
177 forAll(zoneLst, zoneI)
179 os << "ctable " << zoneI + 1 << " shell" << nl
180 << "ctname " << zoneI + 1 << " "
181 << zoneLst[zoneI].name() << nl;
184 os << "! ------------------------------" << nl
185 << "*set icvo mxv - 1" << nl
186 << "vread " << caseName << ".vrt icvo,,,coded" << nl
187 << "cread " << caseName << ".cel icvo,,,add,coded" << nl
195 // ************************************************************************* //