BUG: extrudeMesh: revert previous fix. see #1964

The polyMesh construct-from-components will now ignore
the readOpt for the supplied primitives as before.
This again re-allows READ_IF_PRESENT for fv* in
combination with supplied primitives.
This commit is contained in:
mattijs
2020-12-21 17:25:56 +00:00
parent 983b7579ee
commit a2bc1fd3a6
4 changed files with 85 additions and 19 deletions

View File

@ -704,7 +704,7 @@ int main(int argc, char *argv[])
regionName, regionName,
runTimeExtruded.constant(), runTimeExtruded.constant(),
runTimeExtruded, runTimeExtruded,
IOobject::NO_READ, // Do not read primitives, do read fv* IOobject::READ_IF_PRESENT, // Read fv* if present
IOobject::AUTO_WRITE, IOobject::AUTO_WRITE,
false false
), ),

View File

@ -404,7 +404,7 @@ Foam::polyMesh::polyMesh
instance(), instance(),
meshSubDir, meshSubDir,
*this, *this,
io.readOpt(), IOobject::NO_READ, //io.readOpt(),
io.writeOpt() io.writeOpt()
), ),
std::move(points) std::move(points)
@ -417,7 +417,7 @@ Foam::polyMesh::polyMesh
instance(), instance(),
meshSubDir, meshSubDir,
*this, *this,
io.readOpt(), IOobject::NO_READ, //io.readOpt(),
io.writeOpt() io.writeOpt()
), ),
std::move(faces) std::move(faces)
@ -430,7 +430,7 @@ Foam::polyMesh::polyMesh
instance(), instance(),
meshSubDir, meshSubDir,
*this, *this,
io.readOpt(), IOobject::NO_READ, //io.readOpt(),
io.writeOpt() io.writeOpt()
), ),
std::move(owner) std::move(owner)
@ -443,7 +443,7 @@ Foam::polyMesh::polyMesh
instance(), instance(),
meshSubDir, meshSubDir,
*this, *this,
io.readOpt(), IOobject::NO_READ, //io.readOpt(),
io.writeOpt() io.writeOpt()
), ),
std::move(neighbour) std::move(neighbour)
@ -519,11 +519,6 @@ Foam::polyMesh::polyMesh
oldPointsPtr_(nullptr), oldPointsPtr_(nullptr),
oldCellCentresPtr_(nullptr) oldCellCentresPtr_(nullptr)
{ {
// Note: changed that the constructors where values can be supplied
// (points, faces, owner/neighbour) use the readOpt. All others
// (boundary, *zones) ignore readOpt. To be reviewed as with
// constructor below
// Check if the faces and cells are valid // Check if the faces and cells are valid
forAll(faces_, facei) forAll(faces_, facei)
{ {
@ -677,9 +672,6 @@ Foam::polyMesh::polyMesh
oldPointsPtr_(nullptr), oldPointsPtr_(nullptr),
oldCellCentresPtr_(nullptr) oldCellCentresPtr_(nullptr)
{ {
// Note: probably needs io.readOpt() for points/faces/cells etc so
// we can run with READ_IF_PRESENT. See constructor above.
// Check if faces are valid // Check if faces are valid
forAll(faces_, facei) forAll(faces_, facei)
{ {

View File

@ -331,7 +331,7 @@ public:
// Boundary is added using addPatches() member function // Boundary is added using addPatches() member function
polyMesh(const IOobject& io, const zero, const bool syncPar=true); polyMesh(const IOobject& io, const zero, const bool syncPar=true);
//- Construct from IOobject or from components. //- Construct from IOobject and components.
// Boundary is added using addPatches() member function // Boundary is added using addPatches() member function
polyMesh polyMesh
( (

View File

@ -442,6 +442,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
fileName facesInstance; fileName facesInstance;
fileName pointsInstance;
// Patch types // Patch types
// ~~~~~~~~~~~ // ~~~~~~~~~~~
@ -457,7 +458,12 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
"faces", "faces",
IOobject::MUST_READ IOobject::MUST_READ
); );
pointsInstance = io.time().findInstance
(
meshSubDir,
"points",
IOobject::MUST_READ
);
patchEntries = polyBoundaryMeshEntries patchEntries = polyBoundaryMeshEntries
( (
IOobject IOobject
@ -491,8 +497,9 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
fromMaster >> patchEntries; fromMaster >> patchEntries;
} }
Pstream::scatter(facesInstance); Pstream::scatter(facesInstance);
Pstream::scatter(pointsInstance);
// Dummy meshes // Dummy meshes
// ~~~~~~~~~~~~ // ~~~~~~~~~~~~
@ -522,8 +529,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
// Read mesh // Read mesh
// ~~~~~~~~~ // ~~~~~~~~~
// Now all processors read a mesh or use supplied points,faces etc // Now all processors use supplied points,faces etc
// if there is none.
// Note: fvSolution, fvSchemes are also using the supplied IOobject so // Note: fvSolution, fvSchemes are also using the supplied IOobject so
// on slave will be NO_READ, on master READ_IF_PRESENT. This will // on slave will be NO_READ, on master READ_IF_PRESENT. This will
// conflict with e.g. timeStampMaster reading so switch off. // conflict with e.g. timeStampMaster reading so switch off.
@ -535,7 +541,75 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshTools::newMesh
regIOobject::fileModificationChecking; regIOobject::fileModificationChecking;
regIOobject::fileModificationChecking = regIOobject::timeStamp; regIOobject::fileModificationChecking = regIOobject::timeStamp;
auto meshPtr = autoPtr<fvMesh>::New(meshIO, Zero);
//- Points
pointIOField points
(
IOobject
(
"points",
pointsInstance, //meshIO.instance(),
meshSubDir,
meshIO.db(),
(haveMesh ? IOobject::MUST_READ : IOobject::NO_READ),
IOobject::NO_WRITE,
false
)
);
//- Faces
faceCompactIOList faces
(
IOobject
(
"faces",
meshIO.instance(),
meshSubDir,
meshIO.db(),
(haveMesh ? IOobject::MUST_READ : IOobject::NO_READ),
IOobject::NO_WRITE,
false
)
);
//- Face owner
labelIOList owner
(
IOobject
(
"owner",
meshIO.instance(),
meshSubDir,
meshIO.db(),
(haveMesh ? IOobject::MUST_READ : IOobject::NO_READ),
IOobject::NO_WRITE,
false
)
);
//- Face neighbour
labelIOList neighbour
(
IOobject
(
"neighbour",
meshIO.instance(),
meshSubDir,
meshIO.db(),
(haveMesh ? IOobject::MUST_READ : IOobject::NO_READ),
IOobject::NO_WRITE,
false
)
);
auto meshPtr = autoPtr<fvMesh>::New
(
meshIO,
std::move(points),
std::move(faces),
std::move(owner),
std::move(neighbour)
);
fvMesh& mesh = *meshPtr; fvMesh& mesh = *meshPtr;
regIOobject::fileModificationChecking = oldCheckType; regIOobject::fileModificationChecking = oldCheckType;