mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add area-name handling for faMesh decompose/reconstruct (#3419)
- using labelUList addressing - support direct handling of pointers (as well as autoPtr)
This commit is contained in:
@ -32,7 +32,6 @@ License
|
|||||||
#include "edgeFields.H"
|
#include "edgeFields.H"
|
||||||
#include "fileOperation.H"
|
#include "fileOperation.H"
|
||||||
#include "BitOps.H"
|
#include "BitOps.H"
|
||||||
#include "ListOps.H"
|
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "processorFaPatch.H"
|
#include "processorFaPatch.H"
|
||||||
|
|
||||||
@ -432,12 +431,12 @@ Foam::faMeshTools::loadOrCreateMesh_impl
|
|||||||
}
|
}
|
||||||
else if (readHandlerPtr && haveLocalMesh)
|
else if (readHandlerPtr && haveLocalMesh)
|
||||||
{
|
{
|
||||||
const label numProcs = UPstream::nProcs(UPstream::worldComm);
|
const label numWorldProcs = UPstream::nProcs(UPstream::worldComm);
|
||||||
|
const label realWorldComm = UPstream::worldComm;
|
||||||
|
|
||||||
const labelList meshProcIds(BitOps::sortedToc(haveMesh));
|
const labelList meshProcIds(BitOps::sortedToc(haveMesh));
|
||||||
|
|
||||||
UPstream::communicator newCommunicator;
|
UPstream::communicator newCommunicator;
|
||||||
const label oldWorldComm = UPstream::commWorld();
|
|
||||||
|
|
||||||
auto& readHandler = *readHandlerPtr;
|
auto& readHandler = *readHandlerPtr;
|
||||||
auto oldHandler = fileOperation::fileHandler(readHandler);
|
auto oldHandler = fileOperation::fileHandler(readHandler);
|
||||||
@ -447,13 +446,13 @@ Foam::faMeshTools::loadOrCreateMesh_impl
|
|||||||
// Instead allocate a new communicator for everyone with a mesh
|
// Instead allocate a new communicator for everyone with a mesh
|
||||||
|
|
||||||
// Comparing global ranks in the communicator.
|
// Comparing global ranks in the communicator.
|
||||||
|
if (UPstream::sameProcs(fileHandler().comm(), meshProcIds))
|
||||||
if (ListOps::equal(meshProcIds, UPstream::procID(fileHandler().comm())))
|
|
||||||
{
|
{
|
||||||
|
const_cast<fileOperation&>(fileHandler()).nProcs(numWorldProcs);
|
||||||
// Can use the handler communicator as is.
|
// Can use the handler communicator as is.
|
||||||
UPstream::commWorld(fileHandler().comm());
|
UPstream::commWorld(fileHandler().comm());
|
||||||
}
|
}
|
||||||
else if (UPstream::nProcs(fileHandler().comm()) != numProcs)
|
else if (UPstream::nProcs(fileHandler().comm()) != numWorldProcs)
|
||||||
{
|
{
|
||||||
// Need a new communicator for the fileHandler.
|
// Need a new communicator for the fileHandler.
|
||||||
|
|
||||||
@ -468,10 +467,10 @@ Foam::faMeshTools::loadOrCreateMesh_impl
|
|||||||
meshPtr = autoPtr<faMesh>::New(areaName, pMesh, false);
|
meshPtr = autoPtr<faMesh>::New(areaName, pMesh, false);
|
||||||
|
|
||||||
readHandler = fileOperation::fileHandler(oldHandler);
|
readHandler = fileOperation::fileHandler(oldHandler);
|
||||||
UPstream::commWorld(oldWorldComm);
|
UPstream::commWorld(realWorldComm);
|
||||||
|
|
||||||
// Reset mesh communicator to the real world comm
|
// Reset mesh communicator to the real world comm
|
||||||
meshPtr().comm() = UPstream::commWorld();
|
meshPtr().comm() = realWorldComm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,100 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | www.openfoam.com
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::faPatchFieldMapperPatchRef
|
|
||||||
|
|
||||||
Description
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef faPatchFieldMapperPatchRef_H
|
|
||||||
#define faPatchFieldMapperPatchRef_H
|
|
||||||
|
|
||||||
#include "faPatchFieldMapper.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class faPatchFieldMapperPatchRef Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
class faPatchFieldMapperPatchRef
|
|
||||||
:
|
|
||||||
public faPatchFieldMapper
|
|
||||||
{
|
|
||||||
// Private Data
|
|
||||||
|
|
||||||
const faPatch& sourcePatch_;
|
|
||||||
const faPatch& targetPatch_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- No copy construct
|
|
||||||
faPatchFieldMapperPatchRef(const faPatchFieldMapperPatchRef&) = delete;
|
|
||||||
|
|
||||||
//- No copy assignment
|
|
||||||
void operator=(const faPatchFieldMapperPatchRef&) = delete;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
faPatchFieldMapperPatchRef(const faPatch& source, const faPatch& target)
|
|
||||||
:
|
|
||||||
sourcePatch_(source),
|
|
||||||
targetPatch_(target)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
|
|
||||||
const faPatch& sourcePatch() const
|
|
||||||
{
|
|
||||||
return sourcePatch_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const faPatch& targetPatch() const
|
|
||||||
{
|
|
||||||
return targetPatch_;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
Copyright (C) 2015-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -390,7 +390,7 @@ Foam::labelList Foam::fvMeshTools::removeEmptyPatches
|
|||||||
if (keepPatches.found(pp.name()))
|
if (keepPatches.found(pp.name()))
|
||||||
{
|
{
|
||||||
newToOld[newI] = patchI;
|
newToOld[newI] = patchI;
|
||||||
oldToNew[patchI] = newI++;
|
oldToNew[patchI] = newI++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -777,7 +777,7 @@ Foam::fvMeshTools::loadOrCreateMeshImpl
|
|||||||
|
|
||||||
// Patch types
|
// Patch types
|
||||||
// ~~~~~~~~~~~
|
// ~~~~~~~~~~~
|
||||||
// Read and scatter master patches (without reading master mesh!)
|
// Read and broadcast master patches (without reading master mesh!)
|
||||||
|
|
||||||
PtrList<entry> patchEntries;
|
PtrList<entry> patchEntries;
|
||||||
if (UPstream::master())
|
if (UPstream::master())
|
||||||
@ -951,10 +951,12 @@ Foam::fvMeshTools::loadOrCreateMeshImpl
|
|||||||
}
|
}
|
||||||
else if (readHandlerPtr && haveLocalMesh)
|
else if (readHandlerPtr && haveLocalMesh)
|
||||||
{
|
{
|
||||||
|
const label numWorldProcs = UPstream::nProcs(UPstream::worldComm);
|
||||||
|
const label realWorldComm = UPstream::worldComm;
|
||||||
|
|
||||||
const labelList meshProcIds(BitOps::sortedToc(haveMesh));
|
const labelList meshProcIds(BitOps::sortedToc(haveMesh));
|
||||||
|
|
||||||
UPstream::communicator newCommunicator;
|
UPstream::communicator newCommunicator;
|
||||||
const label oldWorldComm = UPstream::commWorld();
|
|
||||||
|
|
||||||
auto& readHandler = *readHandlerPtr;
|
auto& readHandler = *readHandlerPtr;
|
||||||
auto oldHandler = fileOperation::fileHandler(readHandler);
|
auto oldHandler = fileOperation::fileHandler(readHandler);
|
||||||
@ -963,31 +965,14 @@ Foam::fvMeshTools::loadOrCreateMeshImpl
|
|||||||
// only include the ranks for the current IO rank.
|
// only include the ranks for the current IO rank.
|
||||||
// Instead allocate a new communicator for everyone with a mesh
|
// Instead allocate a new communicator for everyone with a mesh
|
||||||
|
|
||||||
const auto& handlerProcIds = UPstream::procID(fileHandler().comm());
|
|
||||||
|
|
||||||
// Comparing global ranks in the communicator.
|
// Comparing global ranks in the communicator.
|
||||||
// Use std::equal for the List<label> vs List<int> comparison
|
if (UPstream::sameProcs(fileHandler().comm(), meshProcIds))
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
meshProcIds.size() == handlerProcIds.size()
|
|
||||||
&& std::equal
|
|
||||||
(
|
|
||||||
meshProcIds.cbegin(),
|
|
||||||
meshProcIds.cend(),
|
|
||||||
handlerProcIds.cbegin()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
const_cast<fileOperation&>(fileHandler()).nProcs(UPstream::nProcs(oldWorldComm));
|
const_cast<fileOperation&>(fileHandler()).nProcs(numWorldProcs);
|
||||||
// Can use the handler communicator as is.
|
// Can use the handler communicator as is.
|
||||||
UPstream::commWorld(fileHandler().comm());
|
UPstream::commWorld(fileHandler().comm());
|
||||||
}
|
}
|
||||||
else if
|
else if (UPstream::nProcs(fileHandler().comm()) != numWorldProcs)
|
||||||
(
|
|
||||||
UPstream::nProcs(fileHandler().comm())
|
|
||||||
!= UPstream::nProcs(UPstream::worldComm)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Need a new communicator for the fileHandler.
|
// Need a new communicator for the fileHandler.
|
||||||
|
|
||||||
@ -1002,10 +987,10 @@ Foam::fvMeshTools::loadOrCreateMeshImpl
|
|||||||
meshPtr = autoPtr<fvMesh>::New(io, false);
|
meshPtr = autoPtr<fvMesh>::New(io, false);
|
||||||
|
|
||||||
readHandler = fileOperation::fileHandler(oldHandler);
|
readHandler = fileOperation::fileHandler(oldHandler);
|
||||||
UPstream::commWorld(oldWorldComm);
|
UPstream::commWorld(realWorldComm);
|
||||||
|
|
||||||
// Reset mesh communicator to the real world comm
|
// Reset mesh communicator to the real world comm
|
||||||
meshPtr().polyMesh::comm() = UPstream::commWorld();
|
meshPtr().polyMesh::comm() = realWorldComm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
Copyright (C) 2015-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -218,7 +218,7 @@ public:
|
|||||||
static autoPtr<mapDistributePolyMesh> readProcAddressing
|
static autoPtr<mapDistributePolyMesh> readProcAddressing
|
||||||
(
|
(
|
||||||
const fvMesh& procMesh,
|
const fvMesh& procMesh,
|
||||||
const autoPtr<fvMesh>& baseMeshPtr
|
const fvMesh* baseMeshPtr
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write addressing if decomposing (1 to many) or reconstructing
|
//- Write addressing if decomposing (1 to many) or reconstructing
|
||||||
@ -227,10 +227,23 @@ public:
|
|||||||
(
|
(
|
||||||
const fvMesh& procMesh,
|
const fvMesh& procMesh,
|
||||||
const mapDistributePolyMesh& map,
|
const mapDistributePolyMesh& map,
|
||||||
|
//! running in decompose vs reconstruct mode
|
||||||
const bool decompose,
|
const bool decompose,
|
||||||
const fileName& writeHandlerInstance,
|
//! the instance for maps
|
||||||
|
const fileName& writeInstance,
|
||||||
|
//! The output file handler
|
||||||
refPtr<fileOperation>& writeHandler
|
refPtr<fileOperation>& writeHandler
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Housekeeping
|
||||||
|
|
||||||
|
//- Read procAddressing components (reconstructing)
|
||||||
|
static autoPtr<mapDistributePolyMesh> readProcAddressing
|
||||||
|
(
|
||||||
|
const fvMesh& procMesh,
|
||||||
|
const autoPtr<fvMesh>& baseMeshPtr
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
Copyright (C) 2015-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,7 +45,7 @@ namespace Foam
|
|||||||
static autoPtr<mapDistributePolyMesh> createReconstructMap
|
static autoPtr<mapDistributePolyMesh> createReconstructMap
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const autoPtr<fvMesh>& baseMeshPtr,
|
const fvMesh* baseMeshPtr,
|
||||||
const labelList& cellProcAddressing,
|
const labelList& cellProcAddressing,
|
||||||
const labelList& faceProcAddressing,
|
const labelList& faceProcAddressing,
|
||||||
const labelList& pointProcAddressing,
|
const labelList& pointProcAddressing,
|
||||||
@ -109,7 +109,7 @@ static autoPtr<mapDistributePolyMesh> createReconstructMap
|
|||||||
|
|
||||||
|
|
||||||
// NB: can only have a reconstruct on master!
|
// NB: can only have a reconstruct on master!
|
||||||
if (Pstream::master() && baseMeshPtr && baseMeshPtr->nCells())
|
if (UPstream::master() && baseMeshPtr && baseMeshPtr->nCells())
|
||||||
{
|
{
|
||||||
const fvMesh& baseMesh = *baseMeshPtr;
|
const fvMesh& baseMesh = *baseMeshPtr;
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh>
|
|||||||
Foam::fvMeshTools::readProcAddressing
|
Foam::fvMeshTools::readProcAddressing
|
||||||
(
|
(
|
||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const autoPtr<fvMesh>& baseMeshPtr
|
const fvMesh* baseMeshPtr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Processor-local reading
|
// Processor-local reading
|
||||||
@ -303,7 +303,7 @@ void Foam::fvMeshTools::writeProcAddressing
|
|||||||
const fvMesh& mesh,
|
const fvMesh& mesh,
|
||||||
const mapDistributePolyMesh& map,
|
const mapDistributePolyMesh& map,
|
||||||
const bool decompose,
|
const bool decompose,
|
||||||
const fileName& writeHandlerInstance,
|
const fileName& writeInstance,
|
||||||
refPtr<fileOperation>& writeHandler
|
refPtr<fileOperation>& writeHandler
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -431,21 +431,22 @@ void Foam::fvMeshTools::writeProcAddressing
|
|||||||
// as instance so instead of e.g. 'celllMap.write()' directly call
|
// as instance so instead of e.g. 'celllMap.write()' directly call
|
||||||
// the chosen file-handler.
|
// the chosen file-handler.
|
||||||
|
|
||||||
|
if (!writeInstance.empty())
|
||||||
|
{
|
||||||
|
cellMap.instance() = writeInstance;
|
||||||
|
faceMap.instance() = writeInstance;
|
||||||
|
pointMap.instance() = writeInstance;
|
||||||
|
patchMap.instance() = writeInstance;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& tm = cellMap.time();
|
const auto& tm = cellMap.time();
|
||||||
const IOstreamOption opt(tm.writeFormat(), tm.writeCompression());
|
const IOstreamOption opt(tm.writeStreamOption());
|
||||||
{
|
{
|
||||||
auto oldHandler = fileOperation::fileHandler(writeHandler);
|
auto oldHandler = fileOperation::fileHandler(writeHandler);
|
||||||
|
|
||||||
cellMap.instance() = writeHandlerInstance;
|
|
||||||
const bool cellOk = fileHandler().writeObject(cellMap, opt, true);
|
const bool cellOk = fileHandler().writeObject(cellMap, opt, true);
|
||||||
|
|
||||||
faceMap.instance() = writeHandlerInstance;
|
|
||||||
const bool faceOk = fileHandler().writeObject(faceMap, opt, true);
|
const bool faceOk = fileHandler().writeObject(faceMap, opt, true);
|
||||||
|
|
||||||
pointMap.instance() = writeHandlerInstance;
|
|
||||||
const bool pointOk = fileHandler().writeObject(pointMap, opt, true);
|
const bool pointOk = fileHandler().writeObject(pointMap, opt, true);
|
||||||
|
|
||||||
patchMap.instance() = writeHandlerInstance;
|
|
||||||
const bool patchOk = fileHandler().writeObject(patchMap, opt, true);
|
const bool patchOk = fileHandler().writeObject(patchMap, opt, true);
|
||||||
|
|
||||||
writeHandler = fileOperation::fileHandler(oldHandler);
|
writeHandler = fileOperation::fileHandler(oldHandler);
|
||||||
@ -463,4 +464,17 @@ void Foam::fvMeshTools::writeProcAddressing
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Housekeeping * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::mapDistributePolyMesh>
|
||||||
|
Foam::fvMeshTools::readProcAddressing
|
||||||
|
(
|
||||||
|
const fvMesh& procMesh,
|
||||||
|
const autoPtr<fvMesh>& baseMeshPtr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return readProcAddressing(procMesh, baseMeshPtr.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
faFieldDecomposer.C
|
faFieldDecomposer.cxx
|
||||||
faFieldDecomposerCache.C
|
faFieldDecomposerCache.cxx
|
||||||
|
|
||||||
faMeshDecomposition.C
|
faMeshDecomposition.cxx
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfaDecompose
|
LIB = $(FOAM_LIBBIN)/libfaDecompose
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
Copyright (C) 2021-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,9 +35,9 @@ Author
|
|||||||
Hrvoje Jasak, Wikki Ltd.
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faFieldDecomposer.C
|
faFieldDecomposer.cxx
|
||||||
fvFieldDecomposerCache.C
|
faFieldDecomposer.txx
|
||||||
faFieldDecomposerTemplates.C
|
fvFieldDecomposerCache.cxx
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -90,9 +90,9 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member Functions
|
||||||
|
|
||||||
label size() const
|
label size() const noexcept
|
||||||
{
|
{
|
||||||
return directAddressing_.size();
|
return directAddressing_.size();
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
return sizeBeforeMapping_;
|
return sizeBeforeMapping_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool direct() const
|
bool direct() const noexcept
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelUList& directAddressing() const
|
const labelUList& directAddressing() const noexcept
|
||||||
{
|
{
|
||||||
return directAddressing_;
|
return directAddressing_;
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
label size() const
|
label size() const noexcept
|
||||||
{
|
{
|
||||||
return directAddressing_.size();
|
return directAddressing_.size();
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ public:
|
|||||||
return sizeBeforeMapping_;
|
return sizeBeforeMapping_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool direct() const
|
bool direct() const noexcept
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelUList& directAddressing() const
|
const labelUList& directAddressing() const noexcept
|
||||||
{
|
{
|
||||||
return directAddressing_;
|
return directAddressing_;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
label size() const
|
label size() const noexcept
|
||||||
{
|
{
|
||||||
return addressing_.size();
|
return addressing_.size();
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ public:
|
|||||||
return sizeBeforeMapping_;
|
return sizeBeforeMapping_;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool direct() const
|
bool direct() const noexcept
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -212,12 +212,12 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelListList& addressing() const
|
const labelListList& addressing() const noexcept
|
||||||
{
|
{
|
||||||
return addressing_;
|
return addressing_;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalarListList& weights() const
|
const scalarListList& weights() const noexcept
|
||||||
{
|
{
|
||||||
return weights_;
|
return weights_;
|
||||||
}
|
}
|
||||||
@ -232,13 +232,13 @@ private:
|
|||||||
const faMesh& procMesh_;
|
const faMesh& procMesh_;
|
||||||
|
|
||||||
//- Reference to edge addressing
|
//- Reference to edge addressing
|
||||||
const labelList& edgeAddressing_;
|
const labelUList& edgeAddressing_;
|
||||||
|
|
||||||
//- Reference to face addressing
|
//- Reference to face addressing
|
||||||
const labelList& faceAddressing_;
|
const labelUList& faceAddressing_;
|
||||||
|
|
||||||
//- Reference to boundary addressing
|
//- Reference to boundary addressing
|
||||||
const labelList& boundaryAddressing_;
|
const labelUList& boundaryAddressing_;
|
||||||
|
|
||||||
//- List of patch field decomposers
|
//- List of patch field decomposers
|
||||||
PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
|
PtrList<patchFieldDecomposer> patchFieldDecomposerPtrs_;
|
||||||
@ -270,11 +270,11 @@ public:
|
|||||||
//- Construct without mappers, added later with reset()
|
//- Construct without mappers, added later with reset()
|
||||||
faFieldDecomposer
|
faFieldDecomposer
|
||||||
(
|
(
|
||||||
const Foam::zero,
|
Foam::zero,
|
||||||
const faMesh& procMesh, // Target mesh
|
const faMesh& procMesh, // Target mesh
|
||||||
const labelList& edgeAddressing,
|
const labelUList& edgeAddressing,
|
||||||
const labelList& faceAddressing,
|
const labelUList& faceAddressing,
|
||||||
const labelList& boundaryAddressing
|
const labelUList& boundaryAddressing
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from components using information from the complete mesh
|
//- Construct from components using information from the complete mesh
|
||||||
@ -282,9 +282,9 @@ public:
|
|||||||
(
|
(
|
||||||
const faMesh& completeMesh, // Source mesh
|
const faMesh& completeMesh, // Source mesh
|
||||||
const faMesh& procMesh, // Target mesh
|
const faMesh& procMesh, // Target mesh
|
||||||
const labelList& edgeAddressing,
|
const labelUList& edgeAddressing,
|
||||||
const labelList& faceAddressing,
|
const labelUList& faceAddressing,
|
||||||
const labelList& boundaryAddressing
|
const labelUList& boundaryAddressing
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from components without the complete mesh
|
//- Construct from components without the complete mesh
|
||||||
@ -292,15 +292,15 @@ public:
|
|||||||
(
|
(
|
||||||
// Information about the complete mesh
|
// Information about the complete mesh
|
||||||
const label nTotalFaces,
|
const label nTotalFaces,
|
||||||
const List<labelRange>& boundaryRanges,
|
const UList<labelRange>& boundaryRanges,
|
||||||
const labelUList& edgeOwner,
|
const labelUList& edgeOwner,
|
||||||
const labelUList& edgeNeigbour,
|
const labelUList& edgeNeigbour,
|
||||||
|
|
||||||
// Addressing for processor mesh
|
// Addressing for processor mesh
|
||||||
const faMesh& procMesh, // Target mesh
|
const faMesh& procMesh, // Target mesh
|
||||||
const labelList& edgeAddressing,
|
const labelUList& edgeAddressing,
|
||||||
const labelList& faceAddressing,
|
const labelUList& faceAddressing,
|
||||||
const labelList& boundaryAddressing
|
const labelUList& boundaryAddressing
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- True if no mappers have been allocated
|
//- True if no mappers have been allocated
|
||||||
bool empty() const;
|
bool empty() const noexcept;
|
||||||
|
|
||||||
//- Remove all mappers
|
//- Remove all mappers
|
||||||
void clear();
|
void clear();
|
||||||
@ -323,7 +323,7 @@ public:
|
|||||||
void reset
|
void reset
|
||||||
(
|
(
|
||||||
const label nTotalFaces,
|
const label nTotalFaces,
|
||||||
const List<labelRange>& boundaryRanges,
|
const UList<labelRange>& boundaryRanges,
|
||||||
const labelUList& edgeOwner,
|
const labelUList& edgeOwner,
|
||||||
const labelUList& edgeNeigbour
|
const labelUList& edgeNeigbour
|
||||||
);
|
);
|
||||||
@ -448,7 +448,7 @@ public:
|
|||||||
//- Supports reading/sending fields
|
//- Supports reading/sending fields
|
||||||
void readAllFields
|
void readAllFields
|
||||||
(
|
(
|
||||||
const boolList& haveMeshOnProc,
|
const boolUList& haveMeshOnProc,
|
||||||
const faMeshSubset* subsetter,
|
const faMeshSubset* subsetter,
|
||||||
const faMesh& mesh,
|
const faMesh& mesh,
|
||||||
IOobjectList& objects
|
IOobjectList& objects
|
||||||
@ -470,7 +470,7 @@ public:
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "faFieldDecomposerTemplates.C"
|
#include "faFieldDecomposer.txx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
Copyright (C) 2021-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -126,21 +126,17 @@ processorEdgePatchFieldDecomposer
|
|||||||
|
|
||||||
Foam::faFieldDecomposer::faFieldDecomposer
|
Foam::faFieldDecomposer::faFieldDecomposer
|
||||||
(
|
(
|
||||||
const Foam::zero,
|
Foam::zero,
|
||||||
const faMesh& procMesh,
|
const faMesh& procMesh,
|
||||||
const labelList& edgeAddressing,
|
const labelUList& edgeAddressing,
|
||||||
const labelList& faceAddressing,
|
const labelUList& faceAddressing,
|
||||||
const labelList& boundaryAddressing
|
const labelUList& boundaryAddressing
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
procMesh_(procMesh),
|
procMesh_(procMesh),
|
||||||
edgeAddressing_(edgeAddressing),
|
edgeAddressing_(edgeAddressing),
|
||||||
faceAddressing_(faceAddressing),
|
faceAddressing_(faceAddressing),
|
||||||
boundaryAddressing_(boundaryAddressing),
|
boundaryAddressing_(boundaryAddressing)
|
||||||
// Mappers
|
|
||||||
patchFieldDecomposerPtrs_(),
|
|
||||||
processorAreaPatchFieldDecomposerPtrs_(),
|
|
||||||
processorEdgePatchFieldDecomposerPtrs_()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -148,14 +144,14 @@ Foam::faFieldDecomposer::faFieldDecomposer
|
|||||||
(
|
(
|
||||||
const faMesh& completeMesh,
|
const faMesh& completeMesh,
|
||||||
const faMesh& procMesh,
|
const faMesh& procMesh,
|
||||||
const labelList& edgeAddressing,
|
const labelUList& edgeAddressing,
|
||||||
const labelList& faceAddressing,
|
const labelUList& faceAddressing,
|
||||||
const labelList& boundaryAddressing
|
const labelUList& boundaryAddressing
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
faFieldDecomposer
|
faFieldDecomposer
|
||||||
(
|
(
|
||||||
zero{},
|
Foam::zero{},
|
||||||
procMesh,
|
procMesh,
|
||||||
edgeAddressing,
|
edgeAddressing,
|
||||||
faceAddressing,
|
faceAddressing,
|
||||||
@ -169,19 +165,19 @@ Foam::faFieldDecomposer::faFieldDecomposer
|
|||||||
Foam::faFieldDecomposer::faFieldDecomposer
|
Foam::faFieldDecomposer::faFieldDecomposer
|
||||||
(
|
(
|
||||||
const label nTotalFaces,
|
const label nTotalFaces,
|
||||||
const List<labelRange>& boundaryRanges,
|
const UList<labelRange>& boundaryRanges,
|
||||||
const labelUList& edgeOwner,
|
const labelUList& edgeOwner,
|
||||||
const labelUList& edgeNeigbour,
|
const labelUList& edgeNeigbour,
|
||||||
|
|
||||||
const faMesh& procMesh,
|
const faMesh& procMesh,
|
||||||
const labelList& edgeAddressing,
|
const labelUList& edgeAddressing,
|
||||||
const labelList& faceAddressing,
|
const labelUList& faceAddressing,
|
||||||
const labelList& boundaryAddressing
|
const labelUList& boundaryAddressing
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
faFieldDecomposer
|
faFieldDecomposer
|
||||||
(
|
(
|
||||||
zero{},
|
Foam::zero{},
|
||||||
procMesh,
|
procMesh,
|
||||||
edgeAddressing,
|
edgeAddressing,
|
||||||
faceAddressing,
|
faceAddressing,
|
||||||
@ -194,7 +190,7 @@ Foam::faFieldDecomposer::faFieldDecomposer
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::faFieldDecomposer::empty() const
|
bool Foam::faFieldDecomposer::empty() const noexcept
|
||||||
{
|
{
|
||||||
return patchFieldDecomposerPtrs_.empty();
|
return patchFieldDecomposerPtrs_.empty();
|
||||||
}
|
}
|
||||||
@ -211,16 +207,16 @@ void Foam::faFieldDecomposer::clear()
|
|||||||
void Foam::faFieldDecomposer::reset
|
void Foam::faFieldDecomposer::reset
|
||||||
(
|
(
|
||||||
const label nTotalFaces,
|
const label nTotalFaces,
|
||||||
const List<labelRange>& boundaryRanges,
|
const UList<labelRange>& boundaryRanges,
|
||||||
const labelUList& edgeOwner,
|
const labelUList& edgeOwner,
|
||||||
const labelUList& edgeNeigbour
|
const labelUList& edgeNeigbour
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
clear();
|
|
||||||
const label nMappers = procMesh_.boundary().size();
|
const label nMappers = procMesh_.boundary().size();
|
||||||
patchFieldDecomposerPtrs_.resize(nMappers);
|
|
||||||
processorAreaPatchFieldDecomposerPtrs_.resize(nMappers);
|
patchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||||
processorEdgePatchFieldDecomposerPtrs_.resize(nMappers);
|
processorAreaPatchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||||
|
processorEdgePatchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||||
|
|
||||||
forAll(boundaryAddressing_, patchi)
|
forAll(boundaryAddressing_, patchi)
|
||||||
{
|
{
|
||||||
@ -282,11 +278,11 @@ void Foam::faFieldDecomposer::reset
|
|||||||
|
|
||||||
void Foam::faFieldDecomposer::reset(const faMesh& completeMesh)
|
void Foam::faFieldDecomposer::reset(const faMesh& completeMesh)
|
||||||
{
|
{
|
||||||
clear();
|
|
||||||
const label nMappers = procMesh_.boundary().size();
|
const label nMappers = procMesh_.boundary().size();
|
||||||
patchFieldDecomposerPtrs_.resize(nMappers);
|
|
||||||
processorAreaPatchFieldDecomposerPtrs_.resize(nMappers);
|
patchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||||
processorEdgePatchFieldDecomposerPtrs_.resize(nMappers);
|
processorAreaPatchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||||
|
processorEdgePatchFieldDecomposerPtrs_.resize_null(nMappers);
|
||||||
|
|
||||||
// Create weightings now - needed for proper parallel synchronization
|
// Create weightings now - needed for proper parallel synchronization
|
||||||
//// (void)completeMesh.weights();
|
//// (void)completeMesh.weights();
|
||||||
@ -265,7 +265,7 @@ void Foam::faFieldDecomposer::fieldsCache::readAllFields
|
|||||||
|
|
||||||
void Foam::faFieldDecomposer::fieldsCache::readAllFields
|
void Foam::faFieldDecomposer::fieldsCache::readAllFields
|
||||||
(
|
(
|
||||||
const boolList& haveMeshOnProc,
|
const boolUList& haveMeshOnProc,
|
||||||
const faMeshSubset* subsetter,
|
const faMeshSubset* subsetter,
|
||||||
const faMesh& mesh,
|
const faMesh& mesh,
|
||||||
IOobjectList& objects
|
IOobjectList& objects
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2021 OpenCFD Ltd.
|
Copyright (C) 2021,2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,24 +35,20 @@ Author
|
|||||||
Hrvoje Jasak, Wikki Ltd.
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faMeshDecomposition.C
|
faMeshDecomposition.cxx
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_faMeshDecomposition_H
|
#ifndef Foam_faMeshDecomposition_H
|
||||||
#define Foam_faMeshDecomposition_H
|
#define Foam_faMeshDecomposition_H
|
||||||
|
|
||||||
#include "polyMesh.H"
|
|
||||||
#include "faMesh.H"
|
#include "faMesh.H"
|
||||||
#include "labelList.H"
|
|
||||||
#include "PtrList.H"
|
|
||||||
#include "point.H"
|
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class faMeshDecomposition Declaration
|
Class faMeshDecomposition Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class faMeshDecomposition
|
class faMeshDecomposition
|
||||||
@ -61,8 +57,11 @@ class faMeshDecomposition
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
|
//- The area-region name
|
||||||
|
const word areaName_;
|
||||||
|
|
||||||
//- Number of processors in decomposition
|
//- Number of processors in decomposition
|
||||||
label nProcs_;
|
const label nProcs_;
|
||||||
|
|
||||||
//- Is the decomposition data to be distributed for each processor
|
//- Is the decomposition data to be distributed for each processor
|
||||||
bool distributed_;
|
bool distributed_;
|
||||||
@ -128,6 +127,11 @@ class faMeshDecomposition
|
|||||||
|
|
||||||
void distributeFaces();
|
void distributeFaces();
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
faMeshDecomposition(const faMeshDecomposition&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const faMeshDecomposition&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -135,13 +139,27 @@ public:
|
|||||||
|
|
||||||
//- Construct from components.
|
//- Construct from components.
|
||||||
//- Values will come from the volume decomposition
|
//- Values will come from the volume decomposition
|
||||||
// \param mesh the fvMesh
|
|
||||||
// \param nProcessors the number of processors
|
|
||||||
// \param params additional parameters, sent to updateParameters
|
|
||||||
faMeshDecomposition
|
faMeshDecomposition
|
||||||
(
|
(
|
||||||
|
//! The area-region name
|
||||||
|
const word& areaName,
|
||||||
|
//! The underlying polyMesh
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
|
//! The number of processors
|
||||||
const label nProcessors,
|
const label nProcessors,
|
||||||
|
//! Additional parameters, sent to updateParameters
|
||||||
|
const dictionary& params = dictionary::null
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from components (default area region).
|
||||||
|
//- Values will come from the volume decomposition
|
||||||
|
faMeshDecomposition
|
||||||
|
(
|
||||||
|
//! The underlying polyMesh
|
||||||
|
const polyMesh& mesh,
|
||||||
|
//! The number of processors
|
||||||
|
const label nProcessors,
|
||||||
|
//! Additional parameters, sent to updateParameters
|
||||||
const dictionary& params = dictionary::null
|
const dictionary& params = dictionary::null
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -154,20 +172,17 @@ public:
|
|||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
|
|
||||||
|
//- The area-region name
|
||||||
|
const word& name() const noexcept { return areaName_; }
|
||||||
|
|
||||||
//- Number of processor in decomposition
|
//- Number of processor in decomposition
|
||||||
label nProcs() const noexcept
|
label nProcs() const noexcept { return nProcs_; }
|
||||||
{
|
|
||||||
return nProcs_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Is decomposition data to be distributed for each processor
|
//- Is decomposition data to be distributed for each processor
|
||||||
bool distributed() const noexcept
|
bool distributed() const noexcept { return distributed_; }
|
||||||
{
|
|
||||||
return distributed_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Change distributed flag
|
//- Change distributed flag
|
||||||
bool distributed(const bool on) noexcept
|
bool distributed(bool on) noexcept
|
||||||
{
|
{
|
||||||
bool old(distributed_);
|
bool old(distributed_);
|
||||||
distributed_ = on;
|
distributed_ = on;
|
||||||
@ -177,11 +192,11 @@ public:
|
|||||||
//- Are global face zones used
|
//- Are global face zones used
|
||||||
bool useGlobalFaceZones() const noexcept
|
bool useGlobalFaceZones() const noexcept
|
||||||
{
|
{
|
||||||
return distributed_;
|
return hasGlobalFaceZones_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Change global face zones flag
|
//- Change global face zones flag
|
||||||
bool useGlobalFaceZones(const bool on) noexcept
|
bool useGlobalFaceZones(bool on) noexcept
|
||||||
{
|
{
|
||||||
bool old(hasGlobalFaceZones_);
|
bool old(hasGlobalFaceZones_);
|
||||||
hasGlobalFaceZones_ = on;
|
hasGlobalFaceZones_ = on;
|
||||||
@ -208,7 +223,7 @@ public:
|
|||||||
void decomposeMesh();
|
void decomposeMesh();
|
||||||
|
|
||||||
//- Write decomposition
|
//- Write decomposition
|
||||||
bool writeDecomposition();
|
bool writeDecomposition() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,6 @@ License
|
|||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
#include "labelIOList.H"
|
#include "labelIOList.H"
|
||||||
#include "processorFaPatch.H"
|
#include "processorFaPatch.H"
|
||||||
#include "faMesh.H"
|
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "SLList.H"
|
#include "SLList.H"
|
||||||
@ -42,9 +41,10 @@ License
|
|||||||
|
|
||||||
void Foam::faMeshDecomposition::distributeFaces()
|
void Foam::faMeshDecomposition::distributeFaces()
|
||||||
{
|
{
|
||||||
const word& polyMeshRegionName = mesh().name();
|
const word& polyMeshRegionName = faMesh::mesh().name();
|
||||||
|
|
||||||
Info<< "\nCalculating distribution of finiteArea faces" << endl;
|
Info<< "\nCalculating distribution of finite-area faces ["
|
||||||
|
<< polyMesh::regionName(areaName_) << "]" << endl;
|
||||||
|
|
||||||
cpuTime decompositionTime;
|
cpuTime decompositionTime;
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ void Foam::faMeshDecomposition::distributeFaces()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
IOobject ioAddr
|
IOobject ioFvAddr
|
||||||
(
|
(
|
||||||
"procAddressing",
|
"procAddressing",
|
||||||
"constant",
|
"constant",
|
||||||
@ -82,8 +82,11 @@ void Foam::faMeshDecomposition::distributeFaces()
|
|||||||
|
|
||||||
|
|
||||||
// faceProcAddressing (polyMesh)
|
// faceProcAddressing (polyMesh)
|
||||||
ioAddr.rename("faceProcAddressing");
|
ioFvAddr.resetHeader("faceProcAddressing");
|
||||||
labelIOList fvFaceProcAddressing(ioAddr);
|
const labelList fvFaceProcAddressing
|
||||||
|
(
|
||||||
|
labelIOList::readContents(ioFvAddr)
|
||||||
|
);
|
||||||
|
|
||||||
labelHashSet faceProcAddressingHash;
|
labelHashSet faceProcAddressingHash;
|
||||||
faceProcAddressingHash.reserve(fvFaceProcAddressing.size());
|
faceProcAddressingHash.reserve(fvFaceProcAddressing.size());
|
||||||
@ -99,20 +102,17 @@ void Foam::faMeshDecomposition::distributeFaces()
|
|||||||
if (hasGlobalFaceZones_)
|
if (hasGlobalFaceZones_)
|
||||||
{
|
{
|
||||||
// owner (polyMesh)
|
// owner (polyMesh)
|
||||||
ioAddr.rename("owner");
|
ioFvAddr.resetHeader("owner");
|
||||||
const label ownerSize = labelIOList(ioAddr).size();
|
const label ownerSize = labelIOList::readContentsSize(ioFvAddr);
|
||||||
|
|
||||||
for (int i = 0; i < ownerSize; ++i)
|
for (label i = 0; i < ownerSize; ++i)
|
||||||
{
|
{
|
||||||
faceProcAddressingHash.insert(fvFaceProcAddressing[i]);
|
faceProcAddressingHash.insert(fvFaceProcAddressing[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
faceProcAddressingHash.insert
|
faceProcAddressingHash.insert(fvFaceProcAddressing);
|
||||||
(
|
|
||||||
static_cast<labelList&>(fvFaceProcAddressing)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(faceLabels(), facei)
|
forAll(faceLabels(), facei)
|
||||||
@ -137,16 +137,18 @@ void Foam::faMeshDecomposition::distributeFaces()
|
|||||||
|
|
||||||
Foam::faMeshDecomposition::faMeshDecomposition
|
Foam::faMeshDecomposition::faMeshDecomposition
|
||||||
(
|
(
|
||||||
|
const word& areaName,
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
const label nProcessors,
|
const label nProcessors,
|
||||||
const dictionary& params
|
const dictionary& params
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
faMesh(mesh),
|
faMesh(areaName, mesh),
|
||||||
|
areaName_(areaName.empty() ? polyMesh::defaultRegion : areaName),
|
||||||
nProcs_(nProcessors),
|
nProcs_(nProcessors),
|
||||||
distributed_(false),
|
distributed_(false),
|
||||||
hasGlobalFaceZones_(false),
|
hasGlobalFaceZones_(false),
|
||||||
faceToProc_(nFaces()),
|
faceToProc_(faMesh::nFaces()),
|
||||||
procFaceLabels_(nProcs_),
|
procFaceLabels_(nProcs_),
|
||||||
procMeshEdgesMap_(nProcs_),
|
procMeshEdgesMap_(nProcs_),
|
||||||
procNInternalEdges_(nProcs_, Zero),
|
procNInternalEdges_(nProcs_, Zero),
|
||||||
@ -168,6 +170,23 @@ Foam::faMeshDecomposition::faMeshDecomposition
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::faMeshDecomposition::faMeshDecomposition
|
||||||
|
(
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const label nProcessors,
|
||||||
|
const dictionary& params
|
||||||
|
)
|
||||||
|
:
|
||||||
|
faMeshDecomposition
|
||||||
|
(
|
||||||
|
polyMesh::defaultRegion,
|
||||||
|
mesh,
|
||||||
|
nProcessors,
|
||||||
|
params
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::faMeshDecomposition::updateParameters
|
void Foam::faMeshDecomposition::updateParameters
|
||||||
@ -188,9 +207,10 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
// Decide which cell goes to which processor
|
// Decide which cell goes to which processor
|
||||||
distributeFaces();
|
distributeFaces();
|
||||||
|
|
||||||
const word& polyMeshRegionName = mesh().name();
|
const word& polyMeshRegionName = faMesh::mesh().name();
|
||||||
|
|
||||||
Info<< "\nDistributing faces to processors" << endl;
|
Info<< "\nDistributing faces to processors ["
|
||||||
|
<< polyMesh::regionName(areaName_) << "]" << endl;
|
||||||
|
|
||||||
labelList nLocalFaces(nProcs_, Zero);
|
labelList nLocalFaces(nProcs_, Zero);
|
||||||
|
|
||||||
@ -267,16 +287,21 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
|
|
||||||
|
|
||||||
// pointProcAddressing (polyMesh)
|
// pointProcAddressing (polyMesh)
|
||||||
ioAddr.rename("pointProcAddressing");
|
ioAddr.resetHeader("pointProcAddressing");
|
||||||
labelIOList fvPointProcAddressing(ioAddr);
|
const labelList fvPointProcAddressing
|
||||||
|
(
|
||||||
|
labelIOList::readContents(ioAddr)
|
||||||
|
);
|
||||||
|
|
||||||
Map<label> fvFaceProcAddressingHash;
|
Map<label> fvFaceProcAddressingHash;
|
||||||
|
|
||||||
{
|
{
|
||||||
// faceProcAddressing (polyMesh)
|
// faceProcAddressing (polyMesh)
|
||||||
ioAddr.rename("faceProcAddressing");
|
ioAddr.resetHeader("faceProcAddressing");
|
||||||
labelIOList fvFaceProcAddressing(ioAddr);
|
const labelList fvFaceProcAddressing
|
||||||
|
(
|
||||||
|
labelIOList::readContents(ioAddr)
|
||||||
|
);
|
||||||
fvFaceProcAddressingHash = invertToMap(fvFaceProcAddressing);
|
fvFaceProcAddressingHash = invertToMap(fvFaceProcAddressing);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,9 +321,10 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
).val();
|
).val();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create processor finite area mesh
|
// Create processor finite-area mesh
|
||||||
faMesh procMesh
|
faMesh procMesh
|
||||||
(
|
(
|
||||||
|
areaName_,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
labelList(procFaceLabels_[procI])
|
labelList(procFaceLabels_[procI])
|
||||||
);
|
);
|
||||||
@ -315,18 +341,12 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
edgesHash.insert(patch.edges()[edgei], edgesHash.size());
|
edgesHash.insert(patch.edges()[edgei], edgesHash.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(boundary(), patchi)
|
for (const auto& fap : faMesh::boundary())
|
||||||
{
|
{
|
||||||
// Include emptyFaPatch
|
// Also include emptyFaPatch etc
|
||||||
const label size = boundary()[patchi].labelList::size();
|
for (const label edgei : fap.edgeLabels())
|
||||||
|
|
||||||
for (label edgei=0; edgei < size; ++edgei)
|
|
||||||
{
|
{
|
||||||
edgesHash.insert
|
edgesHash.insert(patch.edges()[edgei], edgesHash.size());
|
||||||
(
|
|
||||||
patch.edges()[boundary()[patchi][edgei]],
|
|
||||||
edgesHash.size()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,6 +538,8 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
|
|
||||||
forAll(patches, patchI)
|
forAll(patches, patchI)
|
||||||
{
|
{
|
||||||
|
const faPatch& fap = patches[patchI];
|
||||||
|
|
||||||
// Reset size and start index for all processors
|
// Reset size and start index for all processors
|
||||||
forAll(procPatchSize_, procI)
|
forAll(procPatchSize_, procI)
|
||||||
{
|
{
|
||||||
@ -526,7 +548,7 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
procEdgeList[procI].size();
|
procEdgeList[procI].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
const label patchStart = patches[patchI].start();
|
const label patchStart = fap.start();
|
||||||
|
|
||||||
// if (!isA<cyclicFaPatch>(patches[patchI]))
|
// if (!isA<cyclicFaPatch>(patches[patchI]))
|
||||||
if (true)
|
if (true)
|
||||||
@ -1030,9 +1052,10 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// create finite area mesh
|
// Create processor finite-area mesh
|
||||||
faMesh procMesh
|
faMesh procMesh
|
||||||
(
|
(
|
||||||
|
areaName_,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
labelList(procFaceLabels_[procI])
|
labelList(procFaceLabels_[procI])
|
||||||
);
|
);
|
||||||
@ -1101,9 +1124,9 @@ void Foam::faMeshDecomposition::decomposeMesh()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::faMeshDecomposition::writeDecomposition()
|
bool Foam::faMeshDecomposition::writeDecomposition() const
|
||||||
{
|
{
|
||||||
const word& polyMeshRegionName = mesh().name();
|
const word& polyMeshRegionName = faMesh::mesh().name();
|
||||||
|
|
||||||
Info<< "\nConstructing processor FA meshes" << endl;
|
Info<< "\nConstructing processor FA meshes" << endl;
|
||||||
|
|
||||||
@ -1144,23 +1167,29 @@ bool Foam::faMeshDecomposition::writeDecomposition()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
labelIOList fvBoundaryProcAddressing
|
IOobject ioFvAddr
|
||||||
(
|
(
|
||||||
IOobject
|
"procAddressing",
|
||||||
(
|
"constant",
|
||||||
"boundaryProcAddressing",
|
polyMesh::meshSubDir,
|
||||||
"constant",
|
procFvMesh,
|
||||||
polyMesh::meshSubDir,
|
IOobject::MUST_READ,
|
||||||
procFvMesh,
|
IOobject::NO_WRITE,
|
||||||
IOobject::MUST_READ,
|
IOobject::NO_REGISTER
|
||||||
IOobject::NO_WRITE
|
);
|
||||||
)
|
|
||||||
|
// boundaryProcAddressing (polyMesh)
|
||||||
|
ioFvAddr.resetHeader("boundaryProcAddressing");
|
||||||
|
const labelList fvBoundaryProcAddressing
|
||||||
|
(
|
||||||
|
labelIOList::readContents(ioFvAddr)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Create finite area mesh
|
// Create processor finite-area mesh
|
||||||
faMesh procMesh
|
faMesh procMesh
|
||||||
(
|
(
|
||||||
|
areaName_,
|
||||||
procFvMesh,
|
procFvMesh,
|
||||||
labelList(procFaceLabels_[procI])
|
labelList(procFaceLabels_[procI])
|
||||||
);
|
);
|
||||||
@ -1303,7 +1332,6 @@ bool Foam::faMeshDecomposition::writeDecomposition()
|
|||||||
maxProcPatches = max(maxProcPatches, nProcPatches);
|
maxProcPatches = max(maxProcPatches, nProcPatches);
|
||||||
|
|
||||||
// Write the addressing information
|
// Write the addressing information
|
||||||
|
|
||||||
IOobject ioAddr
|
IOobject ioAddr
|
||||||
(
|
(
|
||||||
"procAddressing",
|
"procAddressing",
|
||||||
@ -1317,19 +1345,19 @@ bool Foam::faMeshDecomposition::writeDecomposition()
|
|||||||
|
|
||||||
// pointProcAddressing
|
// pointProcAddressing
|
||||||
ioAddr.rename("pointProcAddressing");
|
ioAddr.rename("pointProcAddressing");
|
||||||
IOList<label>::writeContents(ioAddr, procPatchPointAddressing_[procI]);
|
labelIOList::writeContents(ioAddr, procPatchPointAddressing_[procI]);
|
||||||
|
|
||||||
// edgeProcAddressing
|
// edgeProcAddressing
|
||||||
ioAddr.rename("edgeProcAddressing");
|
ioAddr.rename("edgeProcAddressing");
|
||||||
IOList<label>::writeContents(ioAddr, procEdgeAddressing_[procI]);
|
labelIOList::writeContents(ioAddr, procEdgeAddressing_[procI]);
|
||||||
|
|
||||||
// faceProcAddressing
|
// faceProcAddressing
|
||||||
ioAddr.rename("faceProcAddressing");
|
ioAddr.rename("faceProcAddressing");
|
||||||
IOList<label>::writeContents(ioAddr, procFaceAddressing_[procI]);
|
labelIOList::writeContents(ioAddr, procFaceAddressing_[procI]);
|
||||||
|
|
||||||
// boundaryProcAddressing
|
// boundaryProcAddressing
|
||||||
ioAddr.rename("boundaryProcAddressing");
|
ioAddr.rename("boundaryProcAddressing");
|
||||||
IOList<label>::writeContents(ioAddr, procBoundaryAddressing_[procI]);
|
labelIOList::writeContents(ioAddr, procBoundaryAddressing_[procI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
processorFaMeshes.C
|
processorFaMeshes.cxx
|
||||||
faFieldReconstructor.C
|
faFieldReconstructor.cxx
|
||||||
faMeshReconstructor.C
|
faMeshReconstructor.cxx
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfaReconstruct
|
LIB = $(FOAM_LIBBIN)/libfaReconstruct
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2022-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -35,16 +35,16 @@ Author
|
|||||||
Hrvoje Jasak, Wikki Ltd.
|
Hrvoje Jasak, Wikki Ltd.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faFieldReconstructor.C
|
faFieldReconstructor.cxx
|
||||||
faFieldReconstructorTemplates.C
|
faFieldReconstructor.txx
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Foam_faFieldReconstructor_H
|
#ifndef Foam_faFieldReconstructor_H
|
||||||
#define Foam_faFieldReconstructor_H
|
#define Foam_faFieldReconstructor_H
|
||||||
|
|
||||||
#include "PtrList.H"
|
|
||||||
#include "faMesh.H"
|
#include "faMesh.H"
|
||||||
|
#include "PtrList.H"
|
||||||
#include "IOobjectList.H"
|
#include "IOobjectList.H"
|
||||||
#include "faPatchFieldMapper.H"
|
#include "faPatchFieldMapper.H"
|
||||||
#include "labelIOList.H"
|
#include "labelIOList.H"
|
||||||
@ -63,19 +63,19 @@ class faFieldReconstructor
|
|||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Reconstructed mesh reference
|
//- Reconstructed mesh reference
|
||||||
faMesh& mesh_;
|
const faMesh& mesh_;
|
||||||
|
|
||||||
//- List of processor meshes
|
//- List of processor meshes
|
||||||
const PtrList<faMesh>& procMeshes_;
|
const UPtrList<faMesh>& procMeshes_;
|
||||||
|
|
||||||
//- List of processor edge addressing lists
|
//- List of processor edge addressing lists
|
||||||
const PtrList<labelIOList>& edgeProcAddressing_;
|
const UPtrList<labelIOList>& edgeProcAddressing_;
|
||||||
|
|
||||||
//- List of processor face addressing lists
|
//- List of processor face addressing lists
|
||||||
const PtrList<labelIOList>& faceProcAddressing_;
|
const UPtrList<labelIOList>& faceProcAddressing_;
|
||||||
|
|
||||||
//- List of processor boundary addressing lists
|
//- List of processor boundary addressing lists
|
||||||
const PtrList<labelIOList>& boundaryProcAddressing_;
|
const UPtrList<labelIOList>& boundaryProcAddressing_;
|
||||||
|
|
||||||
//- Number of fields reconstructed
|
//- Number of fields reconstructed
|
||||||
label nReconstructed_;
|
label nReconstructed_;
|
||||||
@ -157,11 +157,11 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
faFieldReconstructor
|
faFieldReconstructor
|
||||||
(
|
(
|
||||||
faMesh& mesh, // Target mesh
|
const faMesh& mesh, // Target mesh
|
||||||
const PtrList<faMesh>& procMeshes, // Source meshes
|
const UPtrList<faMesh>& procMeshes, // Source meshes
|
||||||
const PtrList<labelIOList>& edgeProcAddressing,
|
const UPtrList<labelIOList>& edgeProcAddressing,
|
||||||
const PtrList<labelIOList>& faceProcAddressing,
|
const UPtrList<labelIOList>& faceProcAddressing,
|
||||||
const PtrList<labelIOList>& boundaryProcAddressing
|
const UPtrList<labelIOList>& boundaryProcAddressing
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -179,7 +179,7 @@ public:
|
|||||||
reconstructField
|
reconstructField
|
||||||
(
|
(
|
||||||
const IOobject& fieldObject,
|
const IOobject& fieldObject,
|
||||||
const PtrList<GeometricField<Type, faPatchField, areaMesh>>&
|
const UPtrList<GeometricField<Type, faPatchField, areaMesh>>&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Read and reconstruct area field
|
//- Read and reconstruct area field
|
||||||
@ -194,7 +194,7 @@ public:
|
|||||||
reconstructField
|
reconstructField
|
||||||
(
|
(
|
||||||
const IOobject& fieldObject,
|
const IOobject& fieldObject,
|
||||||
const PtrList<GeometricField<Type, faePatchField, edgeMesh>>&
|
const UPtrList<GeometricField<Type, faePatchField, edgeMesh>>&
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Read and reconstruct edge field
|
//- Read and reconstruct edge field
|
||||||
@ -252,7 +252,7 @@ public:
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
# include "faFieldReconstructorTemplates.C"
|
# include "faFieldReconstructor.txx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2022 OpenCFD Ltd.
|
Copyright (C) 2022-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,11 +39,11 @@ int Foam::faFieldReconstructor::verbose_ = 1;
|
|||||||
|
|
||||||
Foam::faFieldReconstructor::faFieldReconstructor
|
Foam::faFieldReconstructor::faFieldReconstructor
|
||||||
(
|
(
|
||||||
faMesh& mesh,
|
const faMesh& mesh,
|
||||||
const PtrList<faMesh>& procMeshes,
|
const UPtrList<faMesh>& procMeshes,
|
||||||
const PtrList<labelIOList>& edgeProcAddressing,
|
const UPtrList<labelIOList>& edgeProcAddressing,
|
||||||
const PtrList<labelIOList>& faceProcAddressing,
|
const UPtrList<labelIOList>& faceProcAddressing,
|
||||||
const PtrList<labelIOList>& boundaryProcAddressing
|
const UPtrList<labelIOList>& boundaryProcAddressing
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
@ -28,7 +28,6 @@ License
|
|||||||
|
|
||||||
#include "faFieldReconstructor.H"
|
#include "faFieldReconstructor.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "PtrList.H"
|
|
||||||
#include "emptyFaPatch.H"
|
#include "emptyFaPatch.H"
|
||||||
#include "faPatchFields.H"
|
#include "faPatchFields.H"
|
||||||
#include "faePatchFields.H"
|
#include "faePatchFields.H"
|
||||||
@ -40,7 +39,7 @@ Foam::tmp<Foam::GeometricField<Type, Foam::faPatchField, Foam::areaMesh>>
|
|||||||
Foam::faFieldReconstructor::reconstructField
|
Foam::faFieldReconstructor::reconstructField
|
||||||
(
|
(
|
||||||
const IOobject& fieldObject,
|
const IOobject& fieldObject,
|
||||||
const PtrList<GeometricField<Type, faPatchField, areaMesh>>& procFields
|
const UPtrList<GeometricField<Type, faPatchField, areaMesh>>& procFields
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Create the internalField
|
// Create the internalField
|
||||||
@ -271,7 +270,7 @@ Foam::tmp<Foam::GeometricField<Type, Foam::faePatchField, Foam::edgeMesh>>
|
|||||||
Foam::faFieldReconstructor::reconstructField
|
Foam::faFieldReconstructor::reconstructField
|
||||||
(
|
(
|
||||||
const IOobject& fieldObject,
|
const IOobject& fieldObject,
|
||||||
const PtrList<GeometricField<Type, faePatchField, edgeMesh>>& procFields
|
const UPtrList<GeometricField<Type, faePatchField, edgeMesh>>& procFields
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Create the internalField
|
// Create the internalField
|
||||||
@ -40,7 +40,7 @@ Description
|
|||||||
but caution should be exercised before attempting large operations.
|
but caution should be exercised before attempting large operations.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faMeshReconstructor.C
|
faMeshReconstructor.cxx
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -214,10 +214,10 @@ public:
|
|||||||
static void writeAddressing
|
static void writeAddressing
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const labelList& faBoundaryProcAddr,
|
const labelUList& faBoundaryProcAddr,
|
||||||
const labelList& faFaceProcAddr,
|
const labelUList& faFaceProcAddr,
|
||||||
const labelList& faPointProcAddr,
|
const labelUList& faPointProcAddr,
|
||||||
const labelList& faEdgeProcAddr
|
const labelUList& faEdgeProcAddr
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Write proc addressing at the polyMesh faceInstances time
|
//- Write proc addressing at the polyMesh faceInstances time
|
||||||
|
|||||||
@ -56,15 +56,7 @@ void Foam::faMeshReconstructor::calcAddressing
|
|||||||
faBoundaryProcAddr_ = identity(nPatches);
|
faBoundaryProcAddr_ = identity(nPatches);
|
||||||
|
|
||||||
// Mark processor patches
|
// Mark processor patches
|
||||||
for
|
faBoundaryProcAddr_.slice(procMesh_.boundary().nNonProcessor()) = -1;
|
||||||
(
|
|
||||||
label patchi = procMesh_.boundary().nNonProcessor();
|
|
||||||
patchi < nPatches;
|
|
||||||
++patchi
|
|
||||||
)
|
|
||||||
{
|
|
||||||
faBoundaryProcAddr_[patchi] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------
|
// ------------------
|
||||||
@ -112,13 +104,13 @@ void Foam::faMeshReconstructor::calcAddressing
|
|||||||
|
|
||||||
PstreamBuffers pBufs;
|
PstreamBuffers pBufs;
|
||||||
|
|
||||||
if (Pstream::master())
|
if (UPstream::master())
|
||||||
{
|
{
|
||||||
// Determine the respective local portions of the global ordering
|
// Determine the respective local portions of the global ordering
|
||||||
|
|
||||||
labelList procTargets(globalFaceNum.totalSize());
|
labelList procTargets(globalFaceNum.totalSize());
|
||||||
|
|
||||||
for (const label proci : Pstream::allProcs())
|
for (const label proci : UPstream::allProcs())
|
||||||
{
|
{
|
||||||
labelList::subList
|
labelList::subList
|
||||||
(
|
(
|
||||||
@ -139,7 +131,7 @@ void Foam::faMeshReconstructor::calcAddressing
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send the local portions
|
// Send the local portions
|
||||||
for (const int proci : Pstream::subProcs())
|
for (const int proci : UPstream::subProcs())
|
||||||
{
|
{
|
||||||
SubList<label> localOrder
|
SubList<label> localOrder
|
||||||
(
|
(
|
||||||
@ -158,11 +150,11 @@ void Foam::faMeshReconstructor::calcAddressing
|
|||||||
|
|
||||||
pBufs.finishedScatters();
|
pBufs.finishedScatters();
|
||||||
|
|
||||||
if (!Pstream::master())
|
if (!UPstream::master())
|
||||||
{
|
{
|
||||||
labelList localOrder;
|
labelList localOrder;
|
||||||
|
|
||||||
UIPstream fromProc(Pstream::masterNo(), pBufs);
|
UIPstream fromProc(UPstream::masterNo(), pBufs);
|
||||||
fromProc >> localOrder;
|
fromProc >> localOrder;
|
||||||
|
|
||||||
faFaceProcAddr_ = labelList(faFaceProcAddr_, localOrder);
|
faFaceProcAddr_ = labelList(faFaceProcAddr_, localOrder);
|
||||||
@ -235,7 +227,7 @@ void Foam::faMeshReconstructor::calcAddressing
|
|||||||
tmpFaces,
|
tmpFaces,
|
||||||
singlePatchProcFaces,
|
singlePatchProcFaces,
|
||||||
UPstream::msgType(),
|
UPstream::msgType(),
|
||||||
Pstream::commsTypes::scheduled
|
UPstream::commsTypes::scheduled
|
||||||
);
|
);
|
||||||
|
|
||||||
globalPointsPtr().gather
|
globalPointsPtr().gather
|
||||||
@ -531,11 +523,11 @@ void Foam::faMeshReconstructor::createMesh()
|
|||||||
|
|
||||||
// Serial mesh - no parallel communication
|
// Serial mesh - no parallel communication
|
||||||
|
|
||||||
const bool oldParRun = Pstream::parRun(false);
|
const bool oldParRun = UPstream::parRun(false);
|
||||||
|
|
||||||
completeMesh.addFaPatches(completePatches);
|
completeMesh.addFaPatches(completePatches);
|
||||||
|
|
||||||
Pstream::parRun(oldParRun); // Restore parallel state
|
UPstream::parRun(oldParRun); // Restore parallel state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -550,7 +542,7 @@ Foam::faMeshReconstructor::faMeshReconstructor
|
|||||||
procMesh_(procMesh),
|
procMesh_(procMesh),
|
||||||
errors_(0)
|
errors_(0)
|
||||||
{
|
{
|
||||||
if (!Pstream::parRun())
|
if (!UPstream::parRun())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Can only be called in parallel!!" << nl
|
<< "Can only be called in parallel!!" << nl
|
||||||
@ -612,7 +604,7 @@ Foam::faMeshReconstructor::faMeshReconstructor
|
|||||||
procMesh_(procMesh),
|
procMesh_(procMesh),
|
||||||
errors_(0)
|
errors_(0)
|
||||||
{
|
{
|
||||||
if (!Pstream::parRun())
|
if (!UPstream::parRun())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Can only be called in parallel!!" << nl
|
<< "Can only be called in parallel!!" << nl
|
||||||
@ -681,10 +673,10 @@ void Foam::faMeshReconstructor::writeAddressing() const
|
|||||||
void Foam::faMeshReconstructor::writeAddressing
|
void Foam::faMeshReconstructor::writeAddressing
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
const labelList& faBoundaryProcAddr,
|
const labelUList& faBoundaryProcAddr,
|
||||||
const labelList& faFaceProcAddr,
|
const labelUList& faFaceProcAddr,
|
||||||
const labelList& faPointProcAddr,
|
const labelUList& faPointProcAddr,
|
||||||
const labelList& faEdgeProcAddr
|
const labelUList& faEdgeProcAddr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Write copies
|
// Write copies
|
||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
|
Copyright (C) 2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,7 +34,7 @@ Author
|
|||||||
Zeljko Tukovic, FSB Zagreb
|
Zeljko Tukovic, FSB Zagreb
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
processorFaMeshes.C
|
processorFaMeshes.cxx
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -59,8 +60,11 @@ class processorFaMeshes
|
|||||||
{
|
{
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- List of processor finite volume meshes
|
//- The area-region name
|
||||||
const UPtrList<fvMesh>& fvMeshes_;
|
const word areaName_;
|
||||||
|
|
||||||
|
//- List of processor volume meshes (could/should be polyMesh)
|
||||||
|
const UPtrList<fvMesh>& volMeshes_;
|
||||||
|
|
||||||
//- List of processor finite area meshes
|
//- List of processor finite area meshes
|
||||||
PtrList<faMesh> meshes_;
|
PtrList<faMesh> meshes_;
|
||||||
@ -95,16 +99,30 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
explicit processorFaMeshes(const UPtrList<fvMesh>& procFvMeshes);
|
explicit processorFaMeshes
|
||||||
|
(
|
||||||
|
//! The processor volume meshes (could/should be polyMesh)
|
||||||
|
const UPtrList<fvMesh>& procVolMeshes,
|
||||||
|
//! The area-region name
|
||||||
|
const word& areaName = word()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- The area-region name
|
||||||
|
const word& name() const noexcept { return areaName_; }
|
||||||
|
|
||||||
|
//- The number of processors used
|
||||||
|
label nProcs() const noexcept { return volMeshes_.size(); }
|
||||||
|
|
||||||
|
//- The processor finite-area meshes
|
||||||
const PtrList<faMesh>& meshes() const noexcept
|
const PtrList<faMesh>& meshes() const noexcept
|
||||||
{
|
{
|
||||||
return meshes_;
|
return meshes_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- The processor finite-area meshes
|
||||||
PtrList<faMesh>& meshes() noexcept
|
PtrList<faMesh>& meshes() noexcept
|
||||||
{
|
{
|
||||||
return meshes_;
|
return meshes_;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 Wikki Ltd
|
Copyright (C) 2016-2017 Wikki Ltd
|
||||||
Copyright (C) 2022-2023 OpenCFD Ltd.
|
Copyright (C) 2022-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,17 +37,23 @@ void Foam::processorFaMeshes::read()
|
|||||||
// Make sure to clear (and hence unregister) any previously loaded meshes
|
// Make sure to clear (and hence unregister) any previously loaded meshes
|
||||||
// and fields
|
// and fields
|
||||||
|
|
||||||
boundaryProcAddressing_.free();
|
const label numProc = volMeshes_.size();
|
||||||
faceProcAddressing_.free();
|
|
||||||
edgeProcAddressing_.free();
|
|
||||||
pointProcAddressing_.free();
|
|
||||||
meshes_.free();
|
|
||||||
|
|
||||||
|
boundaryProcAddressing_.resize_null(numProc);
|
||||||
|
faceProcAddressing_.resize_null(numProc);
|
||||||
|
edgeProcAddressing_.resize_null(numProc);
|
||||||
|
pointProcAddressing_.resize_null(numProc);
|
||||||
|
meshes_.resize_null(numProc);
|
||||||
|
|
||||||
forAll(fvMeshes_, proci)
|
for (label proci = 0; proci < numProc; ++proci)
|
||||||
{
|
{
|
||||||
// Construct from polyMesh IO information
|
// Construct from polyMesh IO information
|
||||||
meshes_.emplace_set(proci, fvMeshes_[proci]);
|
|
||||||
|
meshes_.set
|
||||||
|
(
|
||||||
|
proci,
|
||||||
|
new faMesh(areaName_, volMeshes_[proci])
|
||||||
|
);
|
||||||
|
|
||||||
// Read the addressing information
|
// Read the addressing information
|
||||||
|
|
||||||
@ -91,15 +97,12 @@ void Foam::processorFaMeshes::read()
|
|||||||
|
|
||||||
Foam::processorFaMeshes::processorFaMeshes
|
Foam::processorFaMeshes::processorFaMeshes
|
||||||
(
|
(
|
||||||
const UPtrList<fvMesh>& procFvMeshes
|
const UPtrList<fvMesh>& procVolMeshes,
|
||||||
|
const word& areaName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fvMeshes_(procFvMeshes),
|
areaName_(areaName.empty() ? polyMesh::defaultRegion : areaName),
|
||||||
meshes_(procFvMeshes.size()),
|
volMeshes_(procVolMeshes)
|
||||||
pointProcAddressing_(meshes_.size()),
|
|
||||||
edgeProcAddressing_(meshes_.size()),
|
|
||||||
faceProcAddressing_(meshes_.size()),
|
|
||||||
boundaryProcAddressing_(meshes_.size())
|
|
||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user