readSeparatedPoints.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "starMesh.H"
00031 #include "IFstream.H"
00032
00033
00034
00035 void starMesh::readPoints(const scalar scaleFactor)
00036 {
00037 label nPoints = 0;
00038 label maxLabel = -1;
00039
00040 fileName pointsFileName(casePrefix_ + ".vrt");
00041
00042 {
00043 IFstream pointsFile(pointsFileName);
00044
00045
00046
00047 if (pointsFile.good())
00048 {
00049 label pointLabel;
00050 scalar x, y, z;
00051
00052 maxLabel = -1;
00053 while ((pointsFile >> pointLabel).good())
00054 {
00055 nPoints++;
00056 maxLabel = max(maxLabel, pointLabel);
00057 pointsFile >> x >> y >> z;
00058 }
00059 }
00060 else
00061 {
00062 FatalErrorIn("starMesh::readPoints()")
00063 << "Cannot read file " << pointsFileName
00064 << abort(FatalError);
00065 }
00066 }
00067
00068 Info<< "Number of points = " << nPoints << endl << endl;
00069
00070 points_.setSize(nPoints);
00071 starPointID_.setSize(nPoints);
00072
00073
00074 starPointID_ = -1;
00075
00076 starPointLabelLookup_.setSize(maxLabel+1);
00077
00078
00079 starPointLabelLookup_ = -1;
00080
00081 if (nPoints > 0)
00082 {
00083
00084
00085
00086 IFstream pointsFile(pointsFileName);
00087 label pointLabel;
00088
00089 forAll(points_, p)
00090 {
00091 pointsFile
00092 >> pointLabel
00093 >> points_[p].x()
00094 >> points_[p].y()
00095 >> points_[p].z();
00096
00097 starPointID_[p] = pointLabel;
00098 starPointLabelLookup_[pointLabel] = p;
00099 }
00100
00101 if (scaleFactor > 1.0 + SMALL || scaleFactor < 1.0 - SMALL)
00102 {
00103 points_ *= scaleFactor;
00104 }
00105 }
00106 else
00107 {
00108 FatalError
00109 << "void starMesh::readPoints() : "
00110 << "no points in file "
00111 << pointsFileName
00112 << abort(FatalError);
00113 }
00114 }
00115
00116
00117
Copyright © 2000-2009 OpenCFD Ltd