BUGFIX: Illegal use of uninitialised value (backport)
[foam-extend-3.2.git] / applications / utilities / parallelProcessing / reconstructPar / checkFaceAddressingComp.H
blob02e513a2eec6b834dc653643a94253ec5020c524
2     // Foam version 2.1 changes the addressing of faces in faceProcAddressing
3     // The following code checks and modifies the addressing for cases where
4     // the decomposition has been done with the foam2.0 and earlier tools, but
5     // the reconstruction is attempted with version 2.1 or later
7     label minFaceIndex = labelMax;
9     PtrList<labelIOList>& faceProcAddressing = procMeshes.faceProcAddressing();
11     forAll (faceProcAddressing, procI)
12     {
13         const labelList& curFaceAddr = faceProcAddressing[procI];
15         forAll (curFaceAddr, faceI)
16         {
17             if (mag(curFaceAddr[faceI]) < minFaceIndex)
18             {
19                 minFaceIndex = mag(curFaceAddr[faceI]);
20             }
21         }
22     }
24     if (minFaceIndex < 1)
25     {
26         WarningIn(args.executable())
27             << "parallel decomposition addressing." << endl
28             << "It looks like you are trying to reconstruct the case "
29             << "decomposed with an earlier version of FOAM, which could\n"
30             << "potentially cause compatibility problems.  The code will "
31             << "attempt to update the addressing automatically; in case of\n"
32             << "failure, please repeat the decomposition of the case using "
33             << "the current version fo decomposePar"
34             << endl;
36         forAll (faceProcAddressing, procI)
37         {
38             labelList& curFaceAddr = faceProcAddressing[procI];
40             forAll (curFaceAddr, faceI)
41             {
42                 curFaceAddr[faceI] += sign(curFaceAddr[faceI]);
43             }
45             faceProcAddressing[procI].write();
46         }
47     }