mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: processorField: provision for mesh changes. Fixes #2319
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -68,11 +68,11 @@ Foam::functionObjects::processorField::processorField
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Zero)
|
||||
dimensionedScalar(dimless, Pstream::myProcNo())
|
||||
)
|
||||
);
|
||||
|
||||
mesh_.objectRegistry::store(procFieldPtr);
|
||||
mesh_.thisDb().store(procFieldPtr);
|
||||
}
|
||||
|
||||
|
||||
@ -109,4 +109,29 @@ bool Foam::functionObjects::processorField::write()
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::processorField::updateMesh(const mapPolyMesh& mpm)
|
||||
{
|
||||
const_cast<objectRegistry&>(mesh_.thisDb()).erase("processorID");
|
||||
|
||||
volScalarField* procFieldPtr
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"processorID",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Pstream::myProcNo())
|
||||
)
|
||||
);
|
||||
|
||||
mesh_.thisDb().store(procFieldPtr);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -138,6 +138,10 @@ public:
|
||||
|
||||
//- Write the processorID field
|
||||
virtual bool write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
// The base implementation is a no-op.
|
||||
virtual void updateMesh(const mapPolyMesh& mpm);
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user