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/>.
28 Reads in a datToFoam mesh file and outputs a points file. Used in
29 conjunction with blockMesh.
31 \*---------------------------------------------------------------------------*/
37 #include "pointField.H"
38 #include "unitConversion.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 int main(int argc, char *argv[])
47 argList::noParallel();
48 argList::validArgs.append("dat file");
50 argList args(argc, argv);
57 #include "createTime.H"
59 std::ifstream plot3dFile(args.args()[1].c_str());
62 std::getline(plot3dFile, line);
63 std::getline(plot3dFile, line);
65 IStringStream Istring(line);
75 Istring >> punctuation;
81 Info<< "Number of vertices in i direction = " << iPoints << endl
82 << "Number of vertices in j direction = " << jPoints << endl;
84 // We ignore the first layer of points in i and j the biconic meshes
85 label nPointsij = (iPoints - 1)*(jPoints - 1);
87 pointField points(nPointsij, vector::zero);
89 for (direction comp = 0; comp < 2; comp++)
93 for (label j = 0; j < jPoints; j++)
95 for (label i = 0; i < iPoints; i++)
100 // if statement ignores the first layer in i and j
103 points[p++][comp] = coord;
109 // correct error in biconic meshes
112 if (points[i][1] < 1e-07)
118 pointField pointsWedge(nPointsij*2, vector::zero);
120 fileName pointsFile(runTime.constantPath()/"points.tmp");
121 OFstream pFile(pointsFile);
123 scalar a(degToRad(0.1));
129 0.0, -::sin(a), ::cos(a)
134 pointsWedge[i] = (rotateZ & points[i]);
135 pointsWedge[i+nPointsij] = cmptMultiply
137 vector(1.0, 1.0, -1.0),
142 Info<< "Writing points to: " << nl
143 << " " << pointsFile << endl;
144 pFile << pointsWedge;
146 Info<< "End" << endl;
152 // ************************************************************************* //