| 270 | |
| 271 | |
| 272 | void Foam::cellCuts::writeUncutOBJ |
| 273 | ( |
| 274 | const fileName& dir, |
| 275 | const label celli |
| 276 | ) const |
| 277 | { |
| 278 | // Cell edges |
| 279 | OFstream cutsStream(dir / "cell_" + name(celli) + ".obj"); |
| 280 | |
| 281 | Pout<< "Writing cell for time " << mesh().time().timeName() |
| 282 | << " to " << cutsStream.name() << nl; |
| 283 | |
| 284 | meshTools::writeOBJ |
| 285 | ( |
| 286 | cutsStream, |
| 287 | mesh().cells(), |
| 288 | mesh().faces(), |
| 289 | mesh().points(), |
| 290 | labelList(1, celli) |
| 291 | ); |
| 292 | |
| 293 | // Loop cutting cell in two |
| 294 | OFstream cutStream(dir / "cellCuts_" + name(celli) + ".obj"); |
| 295 | |
| 296 | Pout<< "Writing raw cuts on cell for time " << mesh().time().timeName() |
| 297 | << " to " << cutStream.name() << nl; |
| 298 | |
| 299 | const labelList& cPoints = mesh().cellPoints()[celli]; |
| 300 | |
| 301 | forAll(cPoints, i) |
| 302 | { |
| 303 | label pointi = cPoints[i]; |
| 304 | if (pointIsCut_[pointi]) |
| 305 | { |
| 306 | meshTools::writeOBJ(cutStream, mesh().points()[pointi]); |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | const pointField& pts = mesh().points(); |
| 311 | |
| 312 | const labelList& cEdges = mesh().cellEdges()[celli]; |
| 313 | |
| 314 | forAll(cEdges, i) |
| 315 | { |
| 316 | label edgeI = cEdges[i]; |
| 317 | |
| 318 | if (edgeIsCut_[edgeI]) |
| 319 | { |
| 320 | const edge& e = mesh().edges()[edgeI]; |
| 321 | |
| 322 | const scalar w = edgeWeight_[edgeI]; |
| 323 | |
| 324 | meshTools::writeOBJ(cutStream, w*pts[e[1]] + (1-w)*pts[e[0]]); |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | |