| 262 | |
| 263 | |
| 264 | void Foam::meshToMesh::calculate(const word& methodName) |
| 265 | { |
| 266 | Info<< "Creating mesh-to-mesh addressing for " << srcRegion_.name() |
| 267 | << " and " << tgtRegion_.name() << " regions using " |
| 268 | << methodName << endl; |
| 269 | |
| 270 | singleMeshProc_ = calcDistribution(srcRegion_, tgtRegion_); |
| 271 | |
| 272 | if (singleMeshProc_ == -1) |
| 273 | { |
| 274 | // create global indexing for src and tgt meshes |
| 275 | globalIndex globalSrcCells(srcRegion_.nCells()); |
| 276 | globalIndex globalTgtCells(tgtRegion_.nCells()); |
| 277 | |
| 278 | // Create processor map of overlapping cells. This map gets |
| 279 | // (possibly remote) cells from the tgt mesh such that they (together) |
| 280 | // cover all of the src mesh |
| 281 | autoPtr<mapDistribute> mapPtr = calcProcMap(srcRegion_, tgtRegion_); |
| 282 | const mapDistribute& map = mapPtr(); |
| 283 | |
| 284 | pointField newTgtPoints; |
| 285 | faceList newTgtFaces; |
| 286 | labelList newTgtFaceOwners; |
| 287 | labelList newTgtFaceNeighbours; |
| 288 | labelList newTgtCellIDs; |
| 289 | |
| 290 | distributeAndMergeCells |
| 291 | ( |
| 292 | map, |
| 293 | tgtRegion_, |
| 294 | globalTgtCells, |
| 295 | newTgtPoints, |
| 296 | newTgtFaces, |
| 297 | newTgtFaceOwners, |
| 298 | newTgtFaceNeighbours, |
| 299 | newTgtCellIDs |
| 300 | ); |
| 301 | |
| 302 | |
| 303 | // create a new target mesh |
| 304 | polyMesh newTgt |
| 305 | ( |
| 306 | IOobject |
| 307 | ( |
| 308 | "newTgt." + Foam::name(Pstream::myProcNo()), |
| 309 | tgtRegion_.time().timeName(), |
| 310 | tgtRegion_.time(), |
| 311 | IOobject::NO_READ |
| 312 | ), |
| 313 | xferMove(newTgtPoints), |
| 314 | xferMove(newTgtFaces), |
| 315 | xferMove(newTgtFaceOwners), |
| 316 | xferMove(newTgtFaceNeighbours), |
| 317 | false // no parallel comms |
| 318 | ); |
| 319 | |
| 320 | // create some dummy patch info |
| 321 | List<polyPatch*> patches(1); |
no test coverage detected