void starMesh::readPoints(const scalar scaleFactor) { label nPoints = 0; label maxLabel = -1; fileName pointsFileName(casePrefix_ + ".vrt"); { IFstream pointsFile(pointsFileName); // Pass 1: get # points and maximum vertex label if (pointsFile.good()) { label pointLabel; scalar x, y, z; maxLabel = -1; while ((pointsFile >> pointLabel).good()) { nPoints++; maxLabel = max(maxLabel, pointLabel); pointsFile >> x >> y >> z; } } else {
void Foam::CV2D::insertPoints(const fileName& pointFileName) { IFstream pointsFile(pointFileName); if (pointsFile.good()) { insertPoints ( point2DField(pointsFile), 0.5*meshControls().minCellSize2() ); } else { FatalErrorInFunction << "Could not open pointsFile " << pointFileName << exit(FatalError); } }
void starMesh::readPoints(const scalar scaleFactor) { label nPoints = 0; label maxLabel = -1; fileName pointsFileName(casePrefix_ + ".vrt"); { IFstream pointsFile(pointsFileName); // Pass 1: get # points and maximum vertex label if (pointsFile.good()) { label pointLabel; maxLabel = -1; while (pointsFile) { pointLabel = readVtxLabel(pointsFile); if (!pointsFile) break; maxLabel = max(maxLabel, pointLabel); readVtxCmpt(pointsFile); readVtxCmpt(pointsFile); readVtxCmpt(pointsFile); readToNl(pointsFile); nPoints++; } } else { FatalErrorIn("starMesh::readPoints()") << "Cannot read file " << pointsFileName << abort(FatalError); } } Info<< "Number of points = " << nPoints << endl << endl; points_.setSize(nPoints); # ifdef starMesh_H starPointID_.setSize(nPoints); // Reset STAR point ID, just in case starPointID_ = -1; # endif starPointLabelLookup_.setSize(maxLabel+1); // reset point labels to invalid value starPointLabelLookup_ = -1; if (nPoints > 0) { // Pass 2: construct pointlist and conversion table // from Star vertex numbers to Foam pointLabels IFstream pointsFile(pointsFileName); label pointLabel; forAll(points_, p) { pointLabel = readVtxLabel(pointsFile); points_[p].x() = readVtxCmpt(pointsFile); points_[p].y() = readVtxCmpt(pointsFile); points_[p].z() = readVtxCmpt(pointsFile); readToNl(pointsFile); # ifdef starMesh_H starPointID_[p] = pointLabel; # endif starPointLabelLookup_[pointLabel] = p; }