read in the points from the .vrt file ---------------------------------------------------------------------------*\ Line 1: PROSTAR_VERTEX [newline] Line 2: 0 0 0 0 0 0 0 [newline] Body: [newline] \*---------------------------------------------------------------------------*/
| 114 | |
| 115 | \*---------------------------------------------------------------------------*/ |
| 116 | void Foam::meshReaders::STARCD::readPoints |
| 117 | ( |
| 118 | const fileName& inputName, |
| 119 | const scalar scaleFactor |
| 120 | ) |
| 121 | { |
| 122 | const word fileSignature = "PROSTAR_VERTEX"; |
| 123 | label nPoints = 0, maxId = 0; |
| 124 | |
| 125 | // Pass 1: |
| 126 | // get # points and maximum vertex label |
| 127 | { |
| 128 | IFstream is(inputName); |
| 129 | readHeader(is, fileSignature); |
| 130 | |
| 131 | label lineLabel; |
| 132 | scalar x, y, z; |
| 133 | |
| 134 | while ((is >> lineLabel).good()) |
| 135 | { |
| 136 | nPoints++; |
| 137 | maxId = max(maxId, lineLabel); |
| 138 | is >> x >> y >> z; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | Info<< "Number of points = " << nPoints << endl; |
| 143 | |
| 144 | // set sizes and reset to invalid values |
| 145 | |
| 146 | points_.setSize(nPoints); |
| 147 | mapToFoamPointId_.setSize(maxId+1); |
| 148 | |
| 149 | //- Original Point number for a given vertex |
| 150 | // might need again in the future |
| 151 | //// labelList origPointId(nPoints); |
| 152 | //// origPointId = -1; |
| 153 | |
| 154 | mapToFoamPointId_ = -1; |
| 155 | |
| 156 | // Pass 2: |
| 157 | // construct pointList and conversion table |
| 158 | // from Star vertex numbers to Foam point labels |
| 159 | if (nPoints > 0) |
| 160 | { |
| 161 | IFstream is(inputName); |
| 162 | readHeader(is, fileSignature); |
| 163 | |
| 164 | label lineLabel; |
| 165 | |
| 166 | label pointi = 0; |
| 167 | while ((is >> lineLabel).good()) |
| 168 | { |
| 169 | is >> points_[pointi].x() |
| 170 | >> points_[pointi].y() |
| 171 | >> points_[pointi].z(); |
| 172 | |
| 173 | // might need again in the future |
no test coverage detected