BUG: redistributePar: write cell/face/pointProcAddressing to correct

directory
This commit is contained in:
mattijs 2023-10-25 15:05:53 +01:00
parent ce16d617ee
commit 6aba163aed
4 changed files with 48 additions and 17 deletions

View File

@ -1040,7 +1040,8 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
mesh,
distMap(),
decompose,
writeHandler
mesh.facesInstance(), //oldFacesInstance,
writeHandler // to write *ProcAddressing
);
}
else if (reconstruct)
@ -1054,6 +1055,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
mesh,
distMap(),
decompose,
volMeshInstance, //oldFacesInstance,
readHandler //writeHandler
);
}

View File

@ -760,12 +760,19 @@ Foam::fvMeshTools::loadOrCreateMeshImpl
const label oldNumProcs = fileHandler().nProcs();
const int oldCache = fileOperation::cacheLevel(0);
const fileName facesInstance = io.time().findInstance
(
meshSubDir,
"faces",
IOobject::MUST_READ
);
patchEntries = polyBoundaryMeshEntries
(
IOobject
(
"boundary",
io.instance(),
facesInstance,
meshSubDir,
io.db(),
IOobject::MUST_READ,

View File

@ -220,6 +220,7 @@ public:
const fvMesh& procMesh,
const mapDistributePolyMesh& map,
const bool decompose,
const fileName& writeHandlerInstance,
refPtr<fileOperation>& writeHandler
);
};

View File

@ -303,6 +303,7 @@ void Foam::fvMeshTools::writeProcAddressing
const fvMesh& mesh,
const mapDistributePolyMesh& map,
const bool decompose,
const fileName& writeHandlerInstance,
refPtr<fileOperation>& writeHandler
)
{
@ -317,7 +318,7 @@ void Foam::fvMeshTools::writeProcAddressing
// been done independently (as a registered object)
IOobject ioAddr
(
"procAddressing",
"proc-addressing",
mesh.facesInstance(),
polyMesh::meshSubDir,
mesh.thisDb(),
@ -421,23 +422,43 @@ void Foam::fvMeshTools::writeProcAddressing
);
}
auto oldHandler = fileOperation::fileHandler(writeHandler);
const bool cellOk = cellMap.write();
const bool faceOk = faceMap.write();
const bool pointOk = pointMap.write();
const bool patchOk = patchMap.write();
// Switch to using the correct
// - fileHandler
// - instance
// to write to the original mesh/time in the original format. Clunky!
// Bypass regIOobject writing to avoid taking over the current time
// as instance so instead of e.g. 'celllMap.write()' directly call
// the chosen file-handler.
writeHandler = fileOperation::fileHandler(oldHandler);
if (!cellOk || !faceOk || !pointOk || !patchOk)
const auto& tm = cellMap.time();
const IOstreamOption opt(tm.writeFormat(), tm.writeCompression());
{
WarningInFunction
<< "Failed to write some of "
<< cellMap.objectRelPath() << ", "
<< faceMap.objectRelPath() << ", "
<< pointMap.objectRelPath() << ", "
<< patchMap.objectRelPath() << endl;
auto oldHandler = fileOperation::fileHandler(writeHandler);
cellMap.instance() = writeHandlerInstance;
const bool cellOk = fileHandler().writeObject(cellMap, opt, true);
faceMap.instance() = writeHandlerInstance;
const bool faceOk = fileHandler().writeObject(faceMap, opt, true);
pointMap.instance() = writeHandlerInstance;
const bool pointOk = fileHandler().writeObject(pointMap, opt, true);
patchMap.instance() = writeHandlerInstance;
const bool patchOk = fileHandler().writeObject(patchMap, opt, true);
writeHandler = fileOperation::fileHandler(oldHandler);
if (!cellOk || !faceOk || !pointOk || !patchOk)
{
WarningInFunction
<< "Failed to write some of "
<< cellMap.objectRelPath() << ", "
<< faceMap.objectRelPath() << ", "
<< pointMap.objectRelPath() << ", "
<< patchMap.objectRelPath() << endl;
}
}
}