/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | foam-extend: Open Source CFD \\ / O peration | Version: 4.0 \\ / A nd | Web: http://www.foam-extend.org \\/ M anipulation | For copyright notice see file Copyright ------------------------------------------------------------------------------- License This file is part of foam-extend. foam-extend 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. foam-extend 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 foam-extend. If not, see . Description I-Deas unv format mesh conversion. Uses either - DOF sets (757) or - face groups (2452(Cubit), 2467) to do patching. Works without but then puts all faces in defaultFaces patch. \*---------------------------------------------------------------------------*/ #include "argList.H" #include "polyMesh.H" #include "foamTime.H" #include "IFstream.H" #include "cellModeller.H" #include "cellSet.H" #include "faceSet.H" #include "DynamicList.H" #include "triSurface.H" using namespace Foam; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // const string SEPARATOR(" -1"); bool isSeparator(const string& line) { return line.substr(0, 6) == SEPARATOR; } // Reads past -1 and reads element type label readTag(IFstream& is) { string tag; do { if (!is.good()) { return -1; } string line; is.getLine(line); if (line.size() < 6) { return -1; } tag = line.substr(0, 6); } while (tag == SEPARATOR); return readLabel(IStringStream(tag)()); } // Reads and prints header void readHeader(IFstream& is) { string line; while (is.good()) { is.getLine(line); if (isSeparator(line)) { break; } else { Sout<< line << endl; } } } // Skip void skipSection(IFstream& is) { Sout<< "Skipping section at line " << is.lineNumber() << '.' << endl; string line; while (is.good()) { is.getLine(line); if (isSeparator(line)) { break; } else { // Sout<< line << endl; } } } scalar readUnvScalar(const string& unvString) { string s(unvString); s.replaceAll("d", "E"); s.replaceAll("D", "E"); return readScalar(IStringStream(s)()); } // Reads unit section void readUnits ( IFstream& is, scalar& lengthScale, scalar& forceScale, scalar& tempScale, scalar& tempOffset ) { Sout<< "Starting reading units at line " << is.lineNumber() << '.' << endl; string line; is.getLine(line); label l = readLabel(IStringStream(line.substr(0, 10))()); Sout<< "l:" << l << endl; string units(line.substr(10, 20)); Sout<< "units:" << units << endl; label unitType = readLabel(IStringStream(line.substr(30, 10))()); Sout<< "unitType:" << unitType << endl; // Read lengthscales is.getLine(line); lengthScale = readUnvScalar(line.substr(0, 25)); forceScale = readUnvScalar(line.substr(25, 25)); tempScale = readUnvScalar(line.substr(50, 25)); is.getLine(line); tempOffset = readUnvScalar(line.substr(0, 25)); Sout<< "Unit factors:" << nl << " Length scale : " << lengthScale << nl << " Force scale : " << forceScale << nl << " Temperature scale : " << tempScale << nl << " Temperature offset : " << tempOffset << nl << endl; } // Reads points section. Read region as well? void readPoints ( IFstream& is, DynamicList& points, // coordinates DynamicList