Compare commits
38 Commits
postreleas
...
feature-po
| Author | SHA1 | Date | |
|---|---|---|---|
| 66be8e1599 | |||
| 11f3ea8c32 | |||
| dcd1ac4a74 | |||
| 4659b66358 | |||
| 4e50ecdd92 | |||
| 6f89203d80 | |||
| 7827177575 | |||
| ff567dbe71 | |||
| e3b7c2e6ee | |||
| 84a1fc9b4f | |||
| 47c44a5783 | |||
| 91a1eaa01b | |||
| fcf090410a | |||
| 19a6241e08 | |||
| 52f5a6d039 | |||
| fe1d7e01d6 | |||
| cb416fb3ec | |||
| 4ae4f0928d | |||
| 6dadd3d33e | |||
| 3a43aae7c0 | |||
| 9ad3754ed7 | |||
| d6781b91fe | |||
| d9c5a5d1a9 | |||
| fc9820b08a | |||
| f9bbd06e57 | |||
| 182afc27ba | |||
| 0bf39691ff | |||
| 312c7a1c32 | |||
| 0ae3da8560 | |||
| 44c594dbff | |||
| a889e5eba6 | |||
| 3d0cb79be3 | |||
| ebe49d4cbd | |||
| 62524b140c | |||
| a46b310fa4 | |||
| 1dc216eb1f | |||
| c4328296b0 | |||
| 52ab1fc06f |
@ -1,10 +1,15 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-ldynamicFvMesh \
|
||||
-ltopoChangerFvMesh \
|
||||
-lsampling
|
||||
|
||||
@ -56,6 +56,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "fvOptions.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
@ -71,7 +72,7 @@ int main(int argc, char *argv[])
|
||||
#include "addCheckCaseOptions.H"
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
@ -87,6 +88,16 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.controlledUpdate();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi = mesh.Sf() & fvc::interpolate(U);
|
||||
}
|
||||
|
||||
while (simple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix TEqn
|
||||
|
||||
@ -135,14 +135,14 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return thermo1_->he();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy [J/kg]
|
||||
virtual const volScalarField& he() const
|
||||
{
|
||||
NotImplemented;
|
||||
return thermo1_->he();
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy
|
||||
@ -213,7 +213,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Heat capacity at constant volume [J/kg/K]
|
||||
@ -236,7 +236,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
|
||||
@ -243,14 +243,14 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return phases_[0].thermo().he();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy [J/kg]
|
||||
virtual const volScalarField& he() const
|
||||
{
|
||||
NotImplemented;
|
||||
return phases_[0].thermo().he();
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy
|
||||
@ -327,7 +327,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Heat capacity at constant volume [J/kg/K]
|
||||
@ -350,7 +350,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
|
||||
@ -86,14 +86,14 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return p();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Return access to the internal energy field [J/Kg]
|
||||
virtual const volScalarField& he() const
|
||||
{
|
||||
NotImplemented;
|
||||
return p();
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy
|
||||
@ -182,7 +182,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Return Cv of the mixture
|
||||
@ -205,7 +205,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
|
||||
3
applications/test/checkIOspeed/Make/files
Normal file
3
applications/test/checkIOspeed/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-checkIOspeed.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-checkIOspeed
|
||||
7
applications/test/checkIOspeed/Make/options
Normal file
7
applications/test/checkIOspeed/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/blockMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lblockMesh
|
||||
400
applications/test/checkIOspeed/Test-checkIOspeed.cxx
Normal file
400
applications/test/checkIOspeed/Test-checkIOspeed.cxx
Normal file
@ -0,0 +1,400 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2024 OpenCFD 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/>.
|
||||
|
||||
Application
|
||||
Test-checkIOspeed
|
||||
|
||||
Description
|
||||
Simple test of file writing, including timings
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "profiling.H"
|
||||
#include "clockTime.H"
|
||||
|
||||
#include "fileName.H"
|
||||
#include "fileOperation.H"
|
||||
#include "IOstreams.H"
|
||||
#include "OSspecific.H"
|
||||
#include "globalIndex.H"
|
||||
#include "volFields.H"
|
||||
#include "IOField.H"
|
||||
#include "PDRblock.H"
|
||||
|
||||
// Not really great since CoherentMesh only works with reading!
|
||||
#ifdef USE_COHERENT
|
||||
#include "OFCstream.H"
|
||||
#include "SliceStreamRepo.H"
|
||||
#endif
|
||||
|
||||
#include <numeric>
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote("Rewrites fields multiple times");
|
||||
|
||||
argList::noFunctionObjects(); // Disallow function objects
|
||||
argList::noCheckProcessorDirectories();
|
||||
|
||||
argList::addVerboseOption("additional verbosity");
|
||||
argList::addOption
|
||||
(
|
||||
"output",
|
||||
"N",
|
||||
"Begin output iteration (default: 10000)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"count",
|
||||
"N",
|
||||
"Number of writes (default: 1)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"fields",
|
||||
"N",
|
||||
"Number of fields to write (default: 1)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"global",
|
||||
"N",
|
||||
"Global field size"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"local",
|
||||
"N",
|
||||
"Local fields size (default: 1000)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"mesh",
|
||||
"(nx ny nz)",
|
||||
"Create with a mesh"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"exclude",
|
||||
"(int ... )",
|
||||
"zero-sized on ranks with specified modulo"
|
||||
);
|
||||
|
||||
argList::addBoolOption("coherent", "Force coherent output");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
const label firstOutput = args.getOrDefault("output", 10000);
|
||||
const label nOutput = args.getOrDefault("count", 1);
|
||||
const label nFields = args.getOrDefault("fields", 1);
|
||||
labelVector meshCells(0, 0, 0);
|
||||
|
||||
const int verbose = args.verbose();
|
||||
|
||||
const bool useCoherent = args.found("coherent");
|
||||
|
||||
labelList excludes;
|
||||
args.readListIfPresent("exclude", excludes);
|
||||
|
||||
bool writeOnProc = true;
|
||||
|
||||
const label myProci = UPstream::myProcNo();
|
||||
|
||||
for (const label excl : excludes)
|
||||
{
|
||||
if (excl > 1 && myProci > 0 && (myProci % excl) == 0)
|
||||
{
|
||||
writeOnProc = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const label nProcsEff =
|
||||
returnReduce((writeOnProc ? 1 : 0), sumOp<label>());
|
||||
|
||||
Info<< "Output " << nProcsEff
|
||||
<< "/" << UPstream::nProcs()
|
||||
<< " ranks" << nl;
|
||||
|
||||
|
||||
if (args.readIfPresent("mesh", meshCells))
|
||||
{
|
||||
if (!writeOnProc)
|
||||
{
|
||||
meshCells = Zero;
|
||||
}
|
||||
|
||||
PDRblock block(boundBox(point::zero, point::one), meshCells);
|
||||
|
||||
// Advance time
|
||||
// - coherent currently still needs to read the mesh itself!
|
||||
runTime.setTime(firstOutput, firstOutput);
|
||||
|
||||
IOobject meshIO
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
autoPtr<polyMesh> pmeshPtr(block.innerMesh(meshIO));
|
||||
|
||||
fvMesh mesh
|
||||
(
|
||||
meshIO,
|
||||
pointField(pmeshPtr->points()),
|
||||
faceList(pmeshPtr->faces()),
|
||||
labelList(pmeshPtr->faceOwner()),
|
||||
labelList(pmeshPtr->faceNeighbour())
|
||||
);
|
||||
|
||||
pmeshPtr.reset(nullptr);
|
||||
|
||||
const label fieldSize = mesh.nCells();
|
||||
|
||||
const globalIndex giCells(fieldSize);
|
||||
|
||||
// Create fields
|
||||
Info<< nl << "Create " << nFields << " fields" << nl
|
||||
<< "field-size:" << fieldSize
|
||||
<< " total-size:" << giCells.totalSize() << nl;
|
||||
|
||||
// Dimensioned field (no proc boundaries)
|
||||
|
||||
PtrList<volScalarField::Internal> fields(nFields);
|
||||
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"field",
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
forAll(fields, fieldi)
|
||||
{
|
||||
io.resetHeader("field" + Foam::name(fieldi));
|
||||
|
||||
fields.set
|
||||
(
|
||||
fieldi,
|
||||
new volScalarField::Internal(io, mesh, dimless)
|
||||
);
|
||||
|
||||
auto& fld = fields[fieldi];
|
||||
std::iota(fld.begin(), fld.end(), scalar(0));
|
||||
}
|
||||
}
|
||||
|
||||
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
||||
|
||||
if (useCoherent)
|
||||
{
|
||||
#ifdef USE_COHERENT
|
||||
streamOpt.format(IOstreamOption::COHERENT);
|
||||
runTime.writeFormat(IOstreamOption::COHERENT);
|
||||
|
||||
mesh.writeObject(streamOpt, true);
|
||||
|
||||
Info<< nl
|
||||
<< "Specified -coherent (instance: "
|
||||
<< mesh.pointsInstance() << ")" << endl;
|
||||
|
||||
const auto& coherent = CoherentMesh::New(mesh);
|
||||
|
||||
Info<< " points = "
|
||||
<< coherent.globalPointOffsets().totalSize() << nl
|
||||
<< " cells = "
|
||||
<< coherent.globalCellOffsets().totalSize() << nl
|
||||
<< " patches = "
|
||||
<< coherent.nNonProcessorPatches() << nl;
|
||||
|
||||
#else
|
||||
Info<< "Warning: -coherent ignored" << nl;
|
||||
#endif
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Writing " << nOutput << " times starting at "
|
||||
<< firstOutput << nl;
|
||||
|
||||
clockTime timing;
|
||||
|
||||
if (verbose) Info<< "Time:";
|
||||
|
||||
for
|
||||
(
|
||||
label timeIndex = firstOutput, count = 0;
|
||||
count < nOutput;
|
||||
++timeIndex, ++count
|
||||
)
|
||||
{
|
||||
runTime.setTime(timeIndex, timeIndex);
|
||||
if (verbose) Info<< ' ' << runTime.timeName() << flush;
|
||||
runTime.writeNow();
|
||||
|
||||
for (const auto& fld : fields)
|
||||
{
|
||||
fld.regIOobject::writeObject(streamOpt, writeOnProc);
|
||||
}
|
||||
}
|
||||
|
||||
if (useCoherent)
|
||||
{
|
||||
#ifdef USE_COHERENT
|
||||
SliceStreamRepo::closeInstance();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (verbose) Info<< nl;
|
||||
Info<< nl << "Writing took "
|
||||
<< timing.timeIncrement() << "s" << endl;
|
||||
|
||||
Info<< nl
|
||||
<< "Cleanup newly generated files with" << nl << nl
|
||||
<< " foamListTimes -rm -time "
|
||||
<< firstOutput << ":" << nl
|
||||
<< " foamListTimes -processor -rm -time "
|
||||
<< firstOutput << ":" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
label fieldSize = 1000;
|
||||
|
||||
if (args.readIfPresent("global", fieldSize))
|
||||
{
|
||||
fieldSize /= nProcsEff;
|
||||
}
|
||||
else
|
||||
{
|
||||
args.readIfPresent("local", fieldSize);
|
||||
}
|
||||
|
||||
if (!writeOnProc)
|
||||
{
|
||||
fieldSize = 0;
|
||||
}
|
||||
|
||||
const globalIndex giCells(fieldSize);
|
||||
|
||||
// Create fields
|
||||
Info<< nl << "Create " << nFields << " fields" << nl
|
||||
<< "field-size:" << fieldSize
|
||||
<< " total-size:" << giCells.totalSize() << nl;
|
||||
|
||||
|
||||
PtrList<IOField<scalar>> fields(nFields);
|
||||
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"field",
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
forAll(fields, fieldi)
|
||||
{
|
||||
io.resetHeader("field" + Foam::name(fieldi));
|
||||
|
||||
fields.set
|
||||
(
|
||||
fieldi,
|
||||
new IOField<scalar>(io, fieldSize)
|
||||
);
|
||||
|
||||
auto& fld = fields[fieldi];
|
||||
std::iota(fld.begin(), fld.end(), scalar(0));
|
||||
}
|
||||
}
|
||||
|
||||
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
||||
|
||||
if (useCoherent)
|
||||
{
|
||||
Info<< "Warning: -coherent ignored" << nl;
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Writing " << nOutput << " times starting at "
|
||||
<< firstOutput << nl;
|
||||
|
||||
clockTime timing;
|
||||
|
||||
if (verbose) Info<< "Time:";
|
||||
|
||||
for
|
||||
(
|
||||
label timeIndex = firstOutput, count = 0;
|
||||
count < nOutput;
|
||||
++timeIndex, ++count
|
||||
)
|
||||
{
|
||||
runTime.setTime(timeIndex, timeIndex);
|
||||
if (verbose) Info<< ' ' << runTime.timeName() << flush;
|
||||
runTime.writeNow();
|
||||
|
||||
for (const auto& fld : fields)
|
||||
{
|
||||
fld.regIOobject::writeObject(streamOpt, writeOnProc);
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose) Info<< nl;
|
||||
Info<< nl << "Writing took "
|
||||
<< timing.timeIncrement() << "s" << endl;
|
||||
|
||||
Info<< nl
|
||||
<< "Cleanup newly generated files with" << nl << nl
|
||||
<< " foamListTimes -rm -time "
|
||||
<< firstOutput << ":" << nl
|
||||
<< " foamListTimes -processor -rm -time "
|
||||
<< firstOutput << ":" << nl;
|
||||
}
|
||||
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -64,6 +64,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Add some more entries
|
||||
{
|
||||
label idx = 0;
|
||||
dictionary subdict;
|
||||
|
||||
subdict.add("key", 100);
|
||||
@ -72,23 +73,30 @@ int main(int argc, char *argv[])
|
||||
|
||||
subdict.add
|
||||
(
|
||||
new formattingEntry(10, "// comment - without newline.")
|
||||
new formattingEntry(++idx, "// comment - without newline.")
|
||||
);
|
||||
|
||||
subdict.add
|
||||
(
|
||||
// NB newline must be part of the content!
|
||||
new formattingEntry(11, "// some comment - with newline?\n")
|
||||
new formattingEntry(++idx, "// some comment - with newline?\n")
|
||||
);
|
||||
|
||||
subdict.add
|
||||
(
|
||||
// NB newline must be part of the content!
|
||||
new formattingEntry(12, "/* other comment */\n")
|
||||
new formattingEntry(++idx, "/* other comment */\n")
|
||||
);
|
||||
|
||||
// Other - invisible
|
||||
subdict.add(new formattingEntry(++idx, token(123), false));
|
||||
|
||||
// Other - visible (probably not what anyone wants!)
|
||||
subdict.add(new formattingEntry(++idx, token(456)));
|
||||
|
||||
subdict.add("val", 42);
|
||||
|
||||
Info<< "subdict keys:" << flatOutput(subdict.toc()) << nl;
|
||||
dict.add("subdict", std::move(subdict));
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-fileHandler-writing.C
|
||||
Test-fileHandler-writing.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-fileHandler-writing
|
||||
|
||||
@ -56,8 +56,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList::noFunctionObjects(); // Disallow function objects
|
||||
argList::addVerboseOption("additional verbosity");
|
||||
argList::addOption("output", "Begin output iteration (default: 10000)");
|
||||
argList::addOption("count", "Number of writes (default: 1)");
|
||||
argList::addOption
|
||||
(
|
||||
"output",
|
||||
"N",
|
||||
"Begin output iteration (default: 10000)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"count",
|
||||
"N",
|
||||
"Number of writes (default: 1)"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
@ -1,3 +1,3 @@
|
||||
Test-gatherValues1.C
|
||||
Test-gatherValues1.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-gatherValues1
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const labelList localValues
|
||||
(
|
||||
identity(2 *(Pstream::myProcNo()+1), -5*Pstream::myProcNo())
|
||||
identity(2 *(UPstream::myProcNo()+1), -5*UPstream::myProcNo())
|
||||
);
|
||||
|
||||
// Test resize
|
||||
@ -76,8 +76,8 @@ int main(int argc, char *argv[])
|
||||
// One-sided sizing! master only
|
||||
const globalIndex allProcAddr
|
||||
(
|
||||
sendData.size(),
|
||||
globalIndex::gatherOnly{}
|
||||
globalIndex::gatherOnly{},
|
||||
sendData.size()
|
||||
);
|
||||
|
||||
Pout<< "listGather sizes: " << flatOutput(allProcAddr.sizes()) << nl;
|
||||
@ -98,8 +98,8 @@ int main(int argc, char *argv[])
|
||||
// One-sided sizing! master only
|
||||
const globalIndex allProcAddr
|
||||
(
|
||||
sendData.size(),
|
||||
globalIndex::gatherOnly{}
|
||||
globalIndex::gatherOnly{},
|
||||
sendData.size()
|
||||
);
|
||||
|
||||
Pout<< "listGather sizes: " << flatOutput(allProcAddr.sizes()) << nl;
|
||||
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const labelList::subList& sendData =
|
||||
(
|
||||
Pstream::master()
|
||||
UPstream::master()
|
||||
? SubList<label>(localValues, 0) // exclude
|
||||
: SubList<label>(localValues)
|
||||
);
|
||||
@ -147,11 +147,11 @@ int main(int argc, char *argv[])
|
||||
<< UPstream::listScatterValues(subProcAddr.offsets()) << nl;
|
||||
|
||||
|
||||
Pout<< endl << "local list [" << Pstream::myProcNo() << "] "
|
||||
Pout<< endl << "local list [" << UPstream::myProcNo() << "] "
|
||||
<< flatOutput(localValues) << nl;
|
||||
|
||||
|
||||
Pout<< endl << "local send [" << Pstream::myProcNo() << "] "
|
||||
Pout<< endl << "local send [" << UPstream::myProcNo() << "] "
|
||||
<< sendSize << nl;
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Pout<< "off-proc: " << allValues << endl;
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
Info<< "master: " << flatOutput(localValues) << nl;
|
||||
|
||||
@ -196,7 +196,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
globalIndex glob
|
||||
(
|
||||
globalIndex:gatherNone{},
|
||||
globalIndex::gatherNone{},
|
||||
labelList(Foam::one{}, 0)
|
||||
);
|
||||
Info<< "single:" << nl;
|
||||
@ -208,35 +208,37 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// This will likely fail - not declared as is_contiguous
|
||||
// Cannot even catch since it triggers an abort()
|
||||
|
||||
#if 0
|
||||
// Non-contiguous gather - use Pstream, not UPstream!
|
||||
{
|
||||
std::pair<label,vector> sendData(Pstream::myProcNo(), vector::one);
|
||||
typedef std::pair<label,vector> valueType;
|
||||
|
||||
const bool oldThrowingError = FatalError.throwing(true);
|
||||
valueType sendData(UPstream::myProcNo(), vector::one);
|
||||
|
||||
try
|
||||
{
|
||||
List<std::pair<label,vector>> countValues
|
||||
(
|
||||
UPstream::listGatherValues<std::pair<label, vector>>
|
||||
(
|
||||
sendData
|
||||
)
|
||||
);
|
||||
List<valueType> countValues
|
||||
(
|
||||
Pstream::listGatherValues(sendData)
|
||||
);
|
||||
|
||||
Pout<< "listGather: " << flatOutput(countValues) << nl;
|
||||
}
|
||||
catch (const Foam::error& err)
|
||||
{
|
||||
Info<< err.message().c_str() << nl;
|
||||
}
|
||||
|
||||
FatalError.throwing(oldThrowingError);
|
||||
Pout<< "listGather: " << flatOutput(countValues) << nl;
|
||||
}
|
||||
|
||||
// Non-contiguous scatter - use Pstream, not UPstream!
|
||||
{
|
||||
List<fileName> allValues;
|
||||
|
||||
if (UPstream::master())
|
||||
{
|
||||
allValues.resize(UPstream::nProcs());
|
||||
forAll(allValues, proci)
|
||||
{
|
||||
allValues[proci] = "processor" + Foam::name(proci);
|
||||
}
|
||||
}
|
||||
|
||||
fileName procName = Pstream::listScatterValues(allValues);
|
||||
|
||||
Pout<< "listScatter: " << procName << nl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,7 +48,7 @@ class SimpleClass
|
||||
public:
|
||||
|
||||
//- Default construct
|
||||
SimpleClass() {}
|
||||
SimpleClass() = default;
|
||||
};
|
||||
|
||||
|
||||
@ -73,9 +73,8 @@ void printInfo(const UList<T>& list)
|
||||
int main()
|
||||
{
|
||||
// Test pointer and reference to a class
|
||||
|
||||
SimpleClass* ptrToClass = new SimpleClass;
|
||||
SimpleClass& refToClass(*ptrToClass);
|
||||
auto ptrToClass = autoPtr<SimpleClass>::New();
|
||||
auto& refToClass = ptrToClass.ref();
|
||||
|
||||
std::cout
|
||||
<< "nullObject addr=" << name(&(nullObjectPtr)) << nl
|
||||
@ -89,13 +88,13 @@ int main()
|
||||
<< " pointer:" << name(nullObjectPtr->pointer()) << nl
|
||||
<< " value:" << nullObjectPtr->value() << nl << nl;
|
||||
|
||||
if (notNull(ptrToClass))
|
||||
if (notNull(ptrToClass.get()))
|
||||
{
|
||||
Info<< "Pass: ptrToClass is not null" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "FAIL: refToClass is null" << nl;
|
||||
Info<< "FAIL: ptrToClass is null" << nl;
|
||||
}
|
||||
|
||||
if (notNull(refToClass))
|
||||
@ -110,8 +109,8 @@ int main()
|
||||
|
||||
// Test pointer and reference to the nullObject
|
||||
|
||||
const SimpleClass* ptrToNull(NullObjectPtr<SimpleClass>());
|
||||
const SimpleClass& refToNull(*ptrToNull);
|
||||
const SimpleClass* ptrToNull = NullObjectPtr<SimpleClass>();
|
||||
const SimpleClass& refToNull = (*ptrToNull);
|
||||
|
||||
if (isNull(ptrToNull))
|
||||
{
|
||||
@ -131,9 +130,6 @@ int main()
|
||||
Info<< "FAIL: refToNull is not null" << nl;
|
||||
}
|
||||
|
||||
// Clean-up
|
||||
delete ptrToClass;
|
||||
|
||||
|
||||
// Test List casting
|
||||
{
|
||||
@ -152,7 +148,7 @@ int main()
|
||||
// Looks pretty ugly though!
|
||||
|
||||
NullObject::nullObject = "hello world";
|
||||
NullObject::nullObject = labelList({1, 2, 3});
|
||||
NullObject::nullObject = Foam::identity(5);
|
||||
|
||||
Info<< nl;
|
||||
|
||||
|
||||
@ -50,37 +50,37 @@ scalar sumReduce
|
||||
)
|
||||
{
|
||||
scalar sum = 0;
|
||||
if (Pstream::parRun())
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
// Add master value and all slaves
|
||||
// Add master value and all sub-procs
|
||||
sum = localValue;
|
||||
|
||||
for (const int slave : UPstream::subProcs(comm))
|
||||
for (const int proci : UPstream::subProcs(comm))
|
||||
{
|
||||
scalar slaveValue;
|
||||
scalar procValue;
|
||||
UIPstream::read
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
slave,
|
||||
reinterpret_cast<char*>(&slaveValue),
|
||||
UPstream::commsTypes::blocking,
|
||||
proci,
|
||||
reinterpret_cast<char*>(&procValue),
|
||||
sizeof(scalar),
|
||||
UPstream::msgType(), // tag
|
||||
comm // communicator
|
||||
);
|
||||
|
||||
sum += slaveValue;
|
||||
sum += procValue;
|
||||
}
|
||||
|
||||
// Send back to slaves
|
||||
// Send back
|
||||
|
||||
for (const int slave : UPstream::subProcs(comm))
|
||||
for (const int proci : UPstream::subProcs(comm))
|
||||
{
|
||||
UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::blocking,
|
||||
slave,
|
||||
proci,
|
||||
reinterpret_cast<const char*>(&sum),
|
||||
sizeof(scalar),
|
||||
UPstream::msgType(), // tag
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,27 +52,27 @@ void testMapDistribute()
|
||||
|
||||
// Generate random data.
|
||||
List<Tuple2<label, List<scalar>>> complexData(100);
|
||||
forAll(complexData, i)
|
||||
for (auto& data : complexData)
|
||||
{
|
||||
complexData[i].first() = rndGen.position(0, Pstream::nProcs()-1);
|
||||
complexData[i].second().setSize(3);
|
||||
complexData[i].second()[0] = 1;
|
||||
complexData[i].second()[1] = 2;
|
||||
complexData[i].second()[2] = 3;
|
||||
data.first() = rndGen.position(0, UPstream::nProcs()-1);
|
||||
data.second().resize(3);
|
||||
data.second()[0] = 1;
|
||||
data.second()[1] = 2;
|
||||
data.second()[2] = 3;
|
||||
}
|
||||
|
||||
// Send all ones to processor indicated by .first()
|
||||
|
||||
// Count how many to send
|
||||
labelList nSend(Pstream::nProcs(), Zero);
|
||||
forAll(complexData, i)
|
||||
labelList nSend(UPstream::nProcs(), Foam::zero{});
|
||||
for (const auto& data : complexData)
|
||||
{
|
||||
const label proci = complexData[i].first();
|
||||
const label proci = data.first();
|
||||
nSend[proci]++;
|
||||
}
|
||||
|
||||
// Collect items to be sent
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList sendMap(UPstream::nProcs());
|
||||
forAll(sendMap, proci)
|
||||
{
|
||||
sendMap[proci].resize_nocopy(nSend[proci]);
|
||||
@ -116,40 +116,31 @@ void testTransfer(const T& input)
|
||||
{
|
||||
T data = input;
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
Perr<<"test transfer (" << (typeid(T).name()) << "): ";
|
||||
perrInfo(data) << nl << endl;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
for (const int slave : Pstream::subProcs())
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
Perr<< "master receiving from slave " << slave << endl;
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
fromSlave >> data;
|
||||
Perr<< "master receiving from proc:" << proci << endl;
|
||||
IPstream::recv(data, proci);
|
||||
perrInfo(data) << endl;
|
||||
}
|
||||
|
||||
for (const int slave : Pstream::subProcs())
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
Perr<< "master sending to slave " << slave << endl;
|
||||
OPstream toSlave(Pstream::commsTypes::blocking, slave);
|
||||
toSlave << data;
|
||||
Perr<< "master sending to proc:" << proci << endl;
|
||||
OPstream::bsend(data, proci);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
Perr<< "slave sending to master " << Pstream::masterNo() << endl;
|
||||
OPstream toMaster(Pstream::commsTypes::blocking, Pstream::masterNo());
|
||||
toMaster << data;
|
||||
}
|
||||
Perr<< "proc sending to master" << endl;
|
||||
OPstream::bsend(data, UPstream::masterNo());
|
||||
|
||||
Perr<< "slave receiving from master " << Pstream::masterNo() << endl;
|
||||
IPstream fromMaster(Pstream::commsTypes::blocking, Pstream::masterNo());
|
||||
fromMaster >> data;
|
||||
Perr<< "proc receiving from master" << endl;
|
||||
IPstream::recv(data, UPstream::masterNo());
|
||||
perrInfo(data) << endl;
|
||||
}
|
||||
}
|
||||
@ -160,49 +151,31 @@ void testTokenized(const T& data)
|
||||
{
|
||||
token tok;
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
Perr<<"test tokenized \"" << data << "\"" << nl << endl;
|
||||
}
|
||||
Perr<< "test tokenized \"" << data << "\"" << nl << endl;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
for (const int slave : Pstream::subProcs())
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
Perr<< "master receiving from slave " << slave << endl;
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
fromSlave >> tok;
|
||||
Perr<< "master receiving from proc:" << proci << endl;
|
||||
IPstream::recv(tok, proci);
|
||||
Perr<< tok.info() << endl;
|
||||
}
|
||||
|
||||
for (const int slave : Pstream::subProcs())
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
Perr<< "master sending to slave " << slave << endl;
|
||||
OPstream toSlave(Pstream::commsTypes::blocking, slave);
|
||||
toSlave << data;
|
||||
Perr<< "master sending to proc:" << proci << endl;
|
||||
OPstream::bsend(tok, proci);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
Perr<< "slave sending to master " << Pstream::masterNo() << endl;
|
||||
OPstream toMaster
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
Perr<< "proc sending to master" << endl;
|
||||
OPstream::bsend(tok, UPstream::masterNo());
|
||||
|
||||
toMaster << data;
|
||||
}
|
||||
Perr<< "proc receiving from master" << endl;
|
||||
IPstream::recv(tok, UPstream::masterNo());
|
||||
|
||||
Perr<< "slave receiving from master " << Pstream::masterNo() << endl;
|
||||
IPstream fromMaster
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
|
||||
fromMaster >> tok;
|
||||
Perr<< tok.info() << endl;
|
||||
}
|
||||
}
|
||||
@ -212,12 +185,14 @@ void testTokenized(const T& data)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noCheckProcessorDirectories();
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
testMapDistribute();
|
||||
|
||||
if (!Pstream::parRun())
|
||||
if (!UPstream::parRun())
|
||||
{
|
||||
Info<< "\nWarning: not parallel - skipping further tests\n" << endl;
|
||||
return 0;
|
||||
|
||||
@ -51,7 +51,7 @@ void printConnection(Ostream& os, const label proci, const labelUList& below)
|
||||
// The number of receives - as per gatherList (v2112)
|
||||
void printRecvCount_gatherList
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
const UList<UPstream::commsStruct>& comms,
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
@ -91,7 +91,7 @@ void printRecvCount_gatherList
|
||||
// The number of sends - as per scatterList (v2112)
|
||||
void printSendCount_scatterList
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
const UList<UPstream::commsStruct>& comms,
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
@ -131,7 +131,7 @@ void printSendCount_scatterList
|
||||
// Transmission widths (contiguous data)
|
||||
void printWidths
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
const UList<UPstream::commsStruct>& comms,
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
|
||||
@ -43,6 +43,7 @@ Description
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "batchPolyTopoChange.H"
|
||||
#include "polyTopoChanger.H"
|
||||
#include "edgeCollapser.H"
|
||||
#include "perfectInterface.H"
|
||||
@ -1059,7 +1060,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// Topo change container
|
||||
polyTopoChange meshMod(mesh);
|
||||
//polyTopoChange meshMod(mesh);
|
||||
batchPolyTopoChange meshMod(mesh);
|
||||
|
||||
perfectStitcher.setRefinement
|
||||
(
|
||||
@ -1085,7 +1087,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// Construct new mesh from polyTopoChange.
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
//autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
polyTopoChanger XXX (mesh, IOobject::NO_READ);
|
||||
autoPtr<mapPolyMesh> map = XXX.changeMesh(mesh, meshMod);
|
||||
|
||||
// Update fields
|
||||
mesh.updateMesh(map());
|
||||
|
||||
@ -579,8 +579,8 @@ inline bool CGAL::indexedCell<Gt, Cb>::potentialCoplanarCell() const
|
||||
|
||||
if (nMasters == 2 && nSlaves == 2)
|
||||
{
|
||||
Foam::vector vp0(Foam::Zero);
|
||||
Foam::vector vp1(Foam::Zero);
|
||||
Foam::vector vp0(Foam::zero{});
|
||||
Foam::vector vp1(Foam::zero{});
|
||||
|
||||
if
|
||||
(
|
||||
|
||||
@ -622,7 +622,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Execute all polyMeshModifiers
|
||||
autoPtr<mapPolyMesh> morphMap = stitcher.changeMesh(true);
|
||||
autoPtr<mapPolyMesh> morphMap = stitcher.changeMesh();
|
||||
|
||||
mesh.movePoints(morphMap->preMotionPoints());
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ OptimisationSwitches
|
||||
// (sized with magnitude of value) is large enough to hold all
|
||||
// outstanding writes so will not try to initialise the Pstream with
|
||||
// threading support.
|
||||
// Default: 1e9
|
||||
// Default: 0
|
||||
maxThreadFileBufferSize 0;
|
||||
|
||||
//- masterUncollated: non-blocking buffer size.
|
||||
|
||||
@ -75,7 +75,7 @@ wmake $targetType lagrangian/distributionModels
|
||||
parallel/Allwmake $targetType $*
|
||||
|
||||
wmake $targetType dynamicFvMesh
|
||||
wmake $targetType topoChangerFvMesh
|
||||
#HJ wmake $targetType topoChangerFvMesh
|
||||
|
||||
wmake $targetType sampling
|
||||
transportModels/Allwmake $targetType $*
|
||||
@ -130,6 +130,9 @@ wmake $targetType rigidBodyMeshMotion
|
||||
wmake $targetType atmosphericModels
|
||||
wmake $targetType optimisation/adjointOptimisation/adjoint
|
||||
|
||||
# Moved by HJ
|
||||
wmake $targetType topoChangerFvMesh
|
||||
|
||||
|
||||
# interfaceTracking libs
|
||||
dynamicFaMesh/Allwmake $targetType $*
|
||||
|
||||
@ -120,8 +120,11 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null bitSet reference
|
||||
inline static const bitSet& null();
|
||||
//- Return a null bitSet (reference to a nullObject).
|
||||
static const bitSet& null() noexcept
|
||||
{
|
||||
return NullObjectRef<bitSet>();
|
||||
}
|
||||
|
||||
|
||||
//- Declare type-name (with debug switch)
|
||||
|
||||
@ -405,12 +405,6 @@ inline Foam::label Foam::bitSet::find_next(label pos) const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::bitSet& Foam::bitSet::null()
|
||||
{
|
||||
return NullObjectRef<bitSet>();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::bitSet::all() const
|
||||
{
|
||||
if (empty()) return true; // SIC. boost convention
|
||||
|
||||
@ -81,7 +81,7 @@ Foam::CompactListList<T> Foam::CompactListList<T>::pack_impl
|
||||
|
||||
if (len)
|
||||
{
|
||||
newOffsets.resize(len+1, Zero);
|
||||
newOffsets.resize(len+1, Foam::zero{});
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
|
||||
@ -138,8 +138,11 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a CompactListList reference to a nullObject
|
||||
inline static const CompactListList<T>& null();
|
||||
//- Return a null CompactListList (reference to a nullObject).
|
||||
static const CompactListList<T>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<CompactListList<T>>();
|
||||
}
|
||||
|
||||
//- Construct by packing together the list of lists
|
||||
template<class SubListType = List<T>>
|
||||
|
||||
@ -29,15 +29,6 @@ License
|
||||
#include "ListOps.H"
|
||||
#include "SubList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::CompactListList<T>& Foam::CompactListList<T>::null()
|
||||
{
|
||||
return NullObjectRef<CompactListList<T>>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
@ -98,7 +89,7 @@ inline Foam::CompactListList<T>::CompactListList
|
||||
const label nVals
|
||||
)
|
||||
:
|
||||
offsets_(mRows+1, Zero),
|
||||
offsets_(mRows+1, Foam::zero{}),
|
||||
values_(nVals)
|
||||
{
|
||||
// Optionally: enforceSizeSanity();
|
||||
@ -113,8 +104,8 @@ inline Foam::CompactListList<T>::CompactListList
|
||||
const Foam::zero
|
||||
)
|
||||
:
|
||||
offsets_(mRows+1, Zero),
|
||||
values_(nVals, Zero)
|
||||
offsets_(mRows+1, Foam::zero{}),
|
||||
values_(nVals, Foam::zero{})
|
||||
{
|
||||
// Optionally: enforceSizeSanity();
|
||||
}
|
||||
@ -128,7 +119,7 @@ inline Foam::CompactListList<T>::CompactListList
|
||||
const T& val
|
||||
)
|
||||
:
|
||||
offsets_(mRows+1, Zero),
|
||||
offsets_(mRows+1, Foam::zero{}),
|
||||
values_(nVals, val)
|
||||
{
|
||||
// Optionally: enforceSizeSanity();
|
||||
@ -387,7 +378,7 @@ inline void Foam::CompactListList<T>::resize
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets_.resize(mRows+1, Zero);
|
||||
offsets_.resize(mRows+1, Foam::zero{});
|
||||
values_.resize(nVals);
|
||||
}
|
||||
}
|
||||
@ -408,7 +399,7 @@ inline void Foam::CompactListList<T>::resize_nocopy
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets_.resize(mRows+1, Zero);
|
||||
offsets_.resize(mRows+1, Foam::zero{});
|
||||
values_.resize_nocopy(nVals);
|
||||
}
|
||||
}
|
||||
@ -430,7 +421,7 @@ inline void Foam::CompactListList<T>::resize
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets_.resize(mRows+1, Zero);
|
||||
offsets_.resize(mRows+1, Foam::zero{});
|
||||
values_.resize(nVals, val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,9 +46,10 @@ SourceFiles
|
||||
#include "zero.H"
|
||||
#include "contiguous.H"
|
||||
#include "stdFoam.H"
|
||||
#include "autoPtr.H"
|
||||
#include "nullObject.H"
|
||||
#include "Hash.H"
|
||||
#include "ListPolicy.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// <algorithm> already included by stdFoam.H
|
||||
#include <iterator>
|
||||
@ -139,8 +140,12 @@ public:
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Return a null FixedList
|
||||
inline static const FixedList<T, N>& null();
|
||||
//- Return a null FixedList (reference to a nullObject).
|
||||
//- Read/write access is questionable
|
||||
static const FixedList<T, N>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<FixedList<T, N>>();
|
||||
}
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -28,15 +28,6 @@ License
|
||||
|
||||
#include "UList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T, unsigned N>
|
||||
inline const Foam::FixedList<T, N>& Foam::FixedList<T, N>::null()
|
||||
{
|
||||
return NullObjectRef<FixedList<T, N>>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, unsigned N>
|
||||
|
||||
@ -129,8 +129,12 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null List
|
||||
inline static const List<T>& null();
|
||||
//- Return a null List (reference to a nullObject).
|
||||
//- Behaves like an empty List.
|
||||
static const List<T>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<List<T>>();
|
||||
}
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -133,13 +133,6 @@ inline Foam::autoPtr<Foam::List<T>> Foam::List<T>::clone() const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::List<T>& Foam::List<T>::null()
|
||||
{
|
||||
return NullObjectRef<List<T>>();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::List<T>::clear()
|
||||
{
|
||||
|
||||
@ -73,8 +73,12 @@ public:
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Return a null SubList
|
||||
inline static const SubList<T>& null();
|
||||
//- Return a null SubList (reference to a nullObject).
|
||||
//- Behaves like an empty SubList.
|
||||
static const SubList<T>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<SubList<T>>();
|
||||
}
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
@ -28,15 +28,6 @@ License
|
||||
|
||||
#include "FixedList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::SubList<T>& Foam::SubList<T>::null()
|
||||
{
|
||||
return NullObjectRef<SubList<T>>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
@ -124,7 +115,7 @@ inline Foam::SubList<T>::SubList
|
||||
template<class T>
|
||||
inline Foam::UList<T>& Foam::SubList<T>::reset(std::nullptr_t) noexcept
|
||||
{
|
||||
UList<T>::shallowCopy(nullptr, 0);
|
||||
UList<T>::shallowCopy(nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -183,8 +183,12 @@ public:
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Return a UList reference to a nullObject
|
||||
inline static const UList<T>& null();
|
||||
//- Return a null UList (reference to a nullObject).
|
||||
//- Behaves like an empty UList.
|
||||
static const UList<T>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<UList<T>>();
|
||||
}
|
||||
|
||||
|
||||
// Public Classes
|
||||
@ -367,6 +371,9 @@ public:
|
||||
//- Copy the pointer and size
|
||||
inline void shallowCopy(T* __restrict__ ptr, const label len) noexcept;
|
||||
|
||||
//- Copy nullptr and zero size
|
||||
inline void shallowCopy(std::nullptr_t) noexcept;
|
||||
|
||||
//- Copy the pointer and size held by the given UList
|
||||
inline void shallowCopy(const UList<T>& list) noexcept;
|
||||
|
||||
|
||||
@ -93,13 +93,6 @@ inline void Foam::UList<T>::fill_uniform(const Foam::zero)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::UList<T>& Foam::UList<T>::null()
|
||||
{
|
||||
return NullObjectRef<UList<T>>();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::label Foam::UList<T>::fcIndex(const label i) const noexcept
|
||||
{
|
||||
@ -330,6 +323,14 @@ inline void Foam::UList<T>::shallowCopy
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::UList<T>::shallowCopy(std::nullptr_t) noexcept
|
||||
{
|
||||
size_ = 0;
|
||||
v_ = nullptr;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::UList<T>::shallowCopy(const UList<T>& list) noexcept
|
||||
{
|
||||
|
||||
@ -116,7 +116,7 @@ Foam::labelListList Foam::invertOneToMany
|
||||
const labelUList& map
|
||||
)
|
||||
{
|
||||
labelList sizes(len, Zero);
|
||||
labelList sizes(len, Foam::zero{});
|
||||
|
||||
for (const label newIdx : map)
|
||||
{
|
||||
|
||||
@ -707,7 +707,7 @@ void Foam::invertManyToMany
|
||||
)
|
||||
{
|
||||
// The output list sizes
|
||||
labelList sizes(len, Zero);
|
||||
labelList sizes(len, Foam::zero{});
|
||||
|
||||
for (const InputIntListType& sublist : input)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,6 +71,33 @@ public:
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Receive and deserialize a value.
|
||||
//- Uses \c operator>> for de-serialization
|
||||
template<class Type>
|
||||
static void recv
|
||||
(
|
||||
Type& value,
|
||||
const int fromProcNo,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
)
|
||||
{
|
||||
IPstream is
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
fromProcNo,
|
||||
0, // bufSize
|
||||
tag,
|
||||
comm,
|
||||
fmt
|
||||
);
|
||||
is >> value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,6 +71,73 @@ public:
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Serialize a value and send (buffered/blocking or standard mode).
|
||||
//- Uses \c operator<< for serialization
|
||||
template<class Type>
|
||||
static void send
|
||||
(
|
||||
const Type& value,
|
||||
//! blocking or scheduled only!
|
||||
const UPstream::commsTypes commsType,
|
||||
const int toProcNo,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
)
|
||||
{
|
||||
OPstream os(commsType, toProcNo, 0, tag, comm, fmt);
|
||||
os << value;
|
||||
}
|
||||
|
||||
//- Serialize a value and send (buffered/blocking mode).
|
||||
//- Uses \c operator<< for serialization
|
||||
template<class Type>
|
||||
static void bsend
|
||||
(
|
||||
const Type& value,
|
||||
const int toProcNo,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
)
|
||||
{
|
||||
OPstream::send
|
||||
(
|
||||
value,
|
||||
UPstream::commsTypes::blocking,
|
||||
toProcNo,
|
||||
tag,
|
||||
comm,
|
||||
fmt
|
||||
);
|
||||
}
|
||||
|
||||
//- Serialize a value and send (standard mode).
|
||||
//- Uses \c operator<< for serialization
|
||||
template<class Type>
|
||||
static void send
|
||||
(
|
||||
const Type& value,
|
||||
const int toProcNo,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
)
|
||||
{
|
||||
OPstream::send
|
||||
(
|
||||
value,
|
||||
UPstream::commsTypes::scheduled,
|
||||
toProcNo,
|
||||
tag,
|
||||
comm,
|
||||
fmt
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,9 +47,6 @@ SourceFiles
|
||||
#include "UPstream.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
// Legacy
|
||||
// #define Foam_Pstream_scatter_nobroadcast
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -130,22 +127,9 @@ public:
|
||||
|
||||
// Gather
|
||||
|
||||
//- Gather (reduce) data, appyling \c bop to combine \c value
|
||||
//- from different processors. The basis for Foam::reduce().
|
||||
// Uses the specified communication schedule.
|
||||
template<class T, class BinaryOp>
|
||||
static void gather
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
T& value,
|
||||
const BinaryOp& bop,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Gather (reduce) data, applying \c bop to combine \c value
|
||||
//- from different processors. The basis for Foam::reduce().
|
||||
// Uses linear/tree communication.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class T, class BinaryOp>
|
||||
static void gather
|
||||
(
|
||||
@ -155,46 +139,46 @@ public:
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Gather individual values into list locations.
|
||||
// On master list length == nProcs, otherwise zero length.
|
||||
// \n
|
||||
// For \b non-parallel :
|
||||
// the returned list length is 1 with localValue.
|
||||
template<class T>
|
||||
static List<T> listGatherValues
|
||||
(
|
||||
const T& localValue,
|
||||
const label comm = UPstream::worldComm,
|
||||
//! Only used for non-contiguous types
|
||||
const int tag = UPstream::msgType()
|
||||
);
|
||||
|
||||
//- Scatter individual values from list locations.
|
||||
// On master input list length == nProcs, ignored on other procs.
|
||||
// \n
|
||||
// For \b non-parallel :
|
||||
// returns the first list element (or default initialized).
|
||||
template<class T>
|
||||
static T listScatterValues
|
||||
(
|
||||
const UList<T>& allValues,
|
||||
const label comm = UPstream::worldComm,
|
||||
//! Only used for non-contiguous types
|
||||
const int tag = UPstream::msgType()
|
||||
);
|
||||
|
||||
|
||||
// Gather/combine data
|
||||
// Inplace combine values from processors.
|
||||
// (Uses construct from Istream instead of <<)
|
||||
// (Uses construct from Istream instead of \c << operator)
|
||||
|
||||
//- Gather data, applying \c cop to inplace combine \c value
|
||||
//- from different processors.
|
||||
// Uses the specified communication schedule.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class T, class CombineOp>
|
||||
static void combineGather
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Gather data, applying \c cop to inplace combine \c value
|
||||
//- from different processors.
|
||||
// Uses linear/tree communication.
|
||||
template<class T, class CombineOp>
|
||||
static void combineGather
|
||||
(
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Reduce inplace (cf. MPI Allreduce)
|
||||
//- applying \c cop to inplace combine \c value
|
||||
//- from different processors.
|
||||
//- After completion all processors have the same data.
|
||||
// Uses the specified communication schedule.
|
||||
// Wraps combineGather/broadcast (may change in the future).
|
||||
template<class T, class CombineOp>
|
||||
static void combineReduce
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
//! [in,out]
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
@ -210,6 +194,7 @@ public:
|
||||
template<class T, class CombineOp>
|
||||
static void combineReduce
|
||||
(
|
||||
//! [in,out]
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
@ -232,30 +217,25 @@ public:
|
||||
|
||||
// Combine variants working on whole List at a time.
|
||||
|
||||
//- Combines List elements.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class T, class CombineOp>
|
||||
static void listCombineGather
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Like above but switches between linear/tree communication
|
||||
template<class T, class CombineOp>
|
||||
static void listCombineGather
|
||||
(
|
||||
List<T>& values,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Combines List elements.
|
||||
//- After completion all processors have the same data.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class T, class CombineOp>
|
||||
static void listCombineReduce
|
||||
(
|
||||
//! [in,out] - List (not UList) due to broadcast()
|
||||
List<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
@ -266,6 +246,7 @@ public:
|
||||
template<class T, class CombineOp>
|
||||
static void listCombineAllGather
|
||||
(
|
||||
//! [in,out] - List (not UList) due to broadcast()
|
||||
List<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
@ -279,17 +260,8 @@ public:
|
||||
// Combine variants working on whole map at a time.
|
||||
// Container needs iterators, find() and insert methods defined.
|
||||
|
||||
template<class Container, class CombineOp>
|
||||
static void mapCombineGather
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
Container& values,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Like above but switches between linear/tree communication
|
||||
//- Combine Map elements.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class Container, class CombineOp>
|
||||
static void mapCombineGather
|
||||
(
|
||||
@ -338,8 +310,9 @@ public:
|
||||
template<class T>
|
||||
static void gatherList
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const UList<commsStruct>& comms,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
@ -349,133 +322,48 @@ public:
|
||||
template<class T>
|
||||
static void gatherList
|
||||
(
|
||||
List<T>& values,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Gather data, but keep individual values separate.
|
||||
//- Uses linear/tree communication.
|
||||
//- Uses MPI_Allgather or manual linear/tree communication.
|
||||
// After completion all processors have the same data.
|
||||
// Wraps gatherList/scatterList (may change in the future).
|
||||
template<class T>
|
||||
static void allGatherList
|
||||
(
|
||||
List<T>& values,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
|
||||
// Scatter
|
||||
// Scatter
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note comms and tag parameters only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void scatter
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
T& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
//- Inverse of gatherList.
|
||||
//- Uses the specified communication schedule.
|
||||
template<class T>
|
||||
static void scatterList
|
||||
(
|
||||
const UList<commsStruct>& comms,
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note tag parameter only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void scatter
|
||||
(
|
||||
T& value,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note tag parameter only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void combineScatter
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
T& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note tag parameter only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void combineScatter
|
||||
(
|
||||
T& value,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note comms and tag parameters only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void listCombineScatter
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
List<T>& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note comms and tag parameters only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void listCombineScatter
|
||||
(
|
||||
List<T>& value,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
template<class Container>
|
||||
static void mapCombineScatter
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
Container& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Like above but switches between linear/tree communication
|
||||
template<class Container>
|
||||
static void mapCombineScatter
|
||||
(
|
||||
Container& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
|
||||
//- Scatter data. Reverse of gatherList
|
||||
template<class T>
|
||||
static void scatterList
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Like above but switches between linear/tree communication
|
||||
template<class T>
|
||||
static void scatterList
|
||||
(
|
||||
List<T>& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
//- Inverse of gatherList.
|
||||
//- Uses linear/tree communication.
|
||||
template<class T>
|
||||
static void scatterList
|
||||
(
|
||||
UList<T>& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
|
||||
// Exchange
|
||||
@ -654,6 +542,61 @@ public:
|
||||
const label comm,
|
||||
const bool wait = true //!< (ignored)
|
||||
);
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- \deprecated(2024-01) Broadcast data
|
||||
template<class T>
|
||||
FOAM_DEPRECATED_FOR(2024-01, "Pstream::broadcast()")
|
||||
static void scatter
|
||||
(
|
||||
T& value,
|
||||
const int tag = UPstream::msgType(), //!< ignored
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
|
||||
//- \deprecated(2024-01) Broadcast data
|
||||
template<class T>
|
||||
FOAM_DEPRECATED_FOR(2024-01, "Pstream::broadcast()")
|
||||
static void combineScatter
|
||||
(
|
||||
T& value,
|
||||
const int tag = UPstream::msgType(), //!< ignored
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
|
||||
//- \deprecated(2024-01) Broadcast data
|
||||
template<class T>
|
||||
FOAM_DEPRECATED_FOR(2024-01, "Pstream::broadcast()")
|
||||
static void listCombineScatter
|
||||
(
|
||||
List<T>& value,
|
||||
const int tag = UPstream::msgType(), //!< ignored
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
|
||||
//- \deprecated(2024-01) Broadcast data
|
||||
template<class Container>
|
||||
FOAM_DEPRECATED_FOR(2024-01, "Pstream::broadcast()")
|
||||
static void mapCombineScatter
|
||||
(
|
||||
Container& values,
|
||||
const int tag = UPstream::msgType(), //!< ignored
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Pstream::broadcast(values, comm);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -137,4 +137,32 @@ void Foam::Pstream::broadcastList(ListType& list, const label comm)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Convenience wrappers - defined after all specialisations are known
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Return a broadcasted value (uses a copy internally)
|
||||
template<class Type>
|
||||
Type returnBroadcast
|
||||
(
|
||||
const Type& value,
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Type work(value);
|
||||
Pstream::broadcast(work, comm);
|
||||
return work;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,7 +25,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Variant of gather, scatter.
|
||||
Variant of gather.
|
||||
Normal gather uses:
|
||||
- default construct and read (>>) from Istream
|
||||
- binary operator and assignment operator to combine values
|
||||
@ -46,7 +46,6 @@ Description
|
||||
template<class T, class CombineOp>
|
||||
void Foam::Pstream::combineGather
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
@ -55,8 +54,10 @@ void Foam::Pstream::combineGather
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
// My communication order
|
||||
const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
// Communication order
|
||||
const auto& comms = UPstream::whichCommunication(comm);
|
||||
// if (comms.empty()) return; // extra safety?
|
||||
const auto& myComm = comms[UPstream::myProcNo(comm)];
|
||||
|
||||
// Receive from my downstairs neighbours
|
||||
for (const label belowID : myComm.below())
|
||||
@ -89,7 +90,7 @@ void Foam::Pstream::combineGather
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
0,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
@ -106,7 +107,7 @@ void Foam::Pstream::combineGather
|
||||
}
|
||||
|
||||
// Send up value
|
||||
if (myComm.above() != -1)
|
||||
if (myComm.above() >= 0)
|
||||
{
|
||||
if (debug & 2)
|
||||
{
|
||||
@ -132,7 +133,7 @@ void Foam::Pstream::combineGather
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
0,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
@ -143,144 +144,6 @@ void Foam::Pstream::combineGather
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::Pstream::combineScatter
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
T& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
#ifndef Foam_Pstream_scatter_nobroadcast
|
||||
Pstream::broadcast(value, comm);
|
||||
#else
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
// My communication order
|
||||
const UPstream::commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
|
||||
// Receive from up
|
||||
if (myComm.above() != -1)
|
||||
{
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
reinterpret_cast<char*>(&value),
|
||||
sizeof(T),
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPstream fromAbove
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
value = T(fromAbove);
|
||||
}
|
||||
}
|
||||
|
||||
// Send to my downstairs neighbours
|
||||
forAllReverse(myComm.below(), belowI)
|
||||
{
|
||||
const label belowID = myComm.below()[belowI];
|
||||
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
reinterpret_cast<const char*>(&value),
|
||||
sizeof(T),
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toBelow
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
toBelow << value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<class T, class CombineOp>
|
||||
void Foam::Pstream::combineGather
|
||||
(
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
Pstream::combineGather
|
||||
(
|
||||
UPstream::whichCommunication(comm),
|
||||
value,
|
||||
cop,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::Pstream::combineScatter
|
||||
(
|
||||
T& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
#ifndef Foam_Pstream_scatter_nobroadcast
|
||||
Pstream::broadcast(value, comm);
|
||||
#else
|
||||
Pstream::combineScatter
|
||||
(
|
||||
UPstream::whichCommunication(comm),
|
||||
value,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<class T, class CombineOp>
|
||||
void Foam::Pstream::combineReduce
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
Pstream::combineGather(comms, value, cop, tag, comm);
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
|
||||
|
||||
template<class T, class CombineOp>
|
||||
void Foam::Pstream::combineReduce
|
||||
(
|
||||
@ -292,9 +155,7 @@ void Foam::Pstream::combineReduce
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
const auto& comms = UPstream::whichCommunication(comm);
|
||||
|
||||
Pstream::combineGather(comms, value, cop, tag, comm);
|
||||
Pstream::combineGather(value, cop, tag, comm);
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
}
|
||||
@ -305,8 +166,7 @@ void Foam::Pstream::combineReduce
|
||||
template<class T, class CombineOp>
|
||||
void Foam::Pstream::listCombineGather
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
List<T>& values,
|
||||
UList<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
@ -314,8 +174,10 @@ void Foam::Pstream::listCombineGather
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
// My communication order
|
||||
const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
// Communication order
|
||||
const auto& comms = UPstream::whichCommunication(comm);
|
||||
// if (comms.empty()) return; // extra safety?
|
||||
const auto& myComm = comms[UPstream::myProcNo(comm)];
|
||||
|
||||
// Receive from my downstairs neighbours
|
||||
for (const label belowID : myComm.below())
|
||||
@ -351,7 +213,7 @@ void Foam::Pstream::listCombineGather
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
0,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
@ -371,7 +233,7 @@ void Foam::Pstream::listCombineGather
|
||||
}
|
||||
|
||||
// Send up values
|
||||
if (myComm.above() != -1)
|
||||
if (myComm.above() >= 0)
|
||||
{
|
||||
if (debug & 2)
|
||||
{
|
||||
@ -397,7 +259,7 @@ void Foam::Pstream::listCombineGather
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
0,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
@ -408,129 +270,6 @@ void Foam::Pstream::listCombineGather
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::Pstream::listCombineScatter
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
#ifndef Foam_Pstream_scatter_nobroadcast
|
||||
Pstream::broadcast(values, comm);
|
||||
#else
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
// My communication order
|
||||
const UPstream::commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
|
||||
// Receive from up
|
||||
if (myComm.above() != -1)
|
||||
{
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
values.data_bytes(),
|
||||
values.size_bytes(),
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPstream fromAbove
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
fromAbove >> values;
|
||||
}
|
||||
}
|
||||
|
||||
// Send to my downstairs neighbours
|
||||
forAllReverse(myComm.below(), belowI)
|
||||
{
|
||||
const label belowID = myComm.below()[belowI];
|
||||
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
values.cdata_bytes(),
|
||||
values.size_bytes(),
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toBelow
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
toBelow << values;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<class T, class CombineOp>
|
||||
void Foam::Pstream::listCombineGather
|
||||
(
|
||||
List<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
Pstream::listCombineGather
|
||||
(
|
||||
UPstream::whichCommunication(comm),
|
||||
values,
|
||||
cop,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::Pstream::listCombineScatter
|
||||
(
|
||||
List<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
#ifndef Foam_Pstream_scatter_nobroadcast
|
||||
Pstream::broadcast(values, comm);
|
||||
#else
|
||||
Pstream::listCombineScatter
|
||||
(
|
||||
UPstream::whichCommunication(comm),
|
||||
values,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<class T, class CombineOp>
|
||||
void Foam::Pstream::listCombineReduce
|
||||
(
|
||||
@ -542,9 +281,7 @@ void Foam::Pstream::listCombineReduce
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
const auto& comms = UPstream::whichCommunication(comm);
|
||||
|
||||
Pstream::listCombineGather(comms, values, cop, tag, comm);
|
||||
Pstream::listCombineGather(values, cop, tag, comm);
|
||||
Pstream::broadcast(values, comm);
|
||||
}
|
||||
}
|
||||
@ -555,7 +292,6 @@ void Foam::Pstream::listCombineReduce
|
||||
template<class Container, class CombineOp>
|
||||
void Foam::Pstream::mapCombineGather
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
Container& values,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
@ -564,8 +300,10 @@ void Foam::Pstream::mapCombineGather
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
// My communication order
|
||||
const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
// Communication order
|
||||
const auto& comms = UPstream::whichCommunication(comm);
|
||||
// if (comms.empty()) return; // extra safety?
|
||||
const auto& myComm = comms[UPstream::myProcNo(comm)];
|
||||
|
||||
// Receive from my downstairs neighbours
|
||||
for (const label belowID : myComm.below())
|
||||
@ -576,7 +314,7 @@ void Foam::Pstream::mapCombineGather
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
0,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
@ -611,7 +349,7 @@ void Foam::Pstream::mapCombineGather
|
||||
}
|
||||
|
||||
// Send up values
|
||||
if (myComm.above() != -1)
|
||||
if (myComm.above() >= 0)
|
||||
{
|
||||
if (debug & 2)
|
||||
{
|
||||
@ -623,7 +361,7 @@ void Foam::Pstream::mapCombineGather
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
0,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
@ -633,110 +371,6 @@ void Foam::Pstream::mapCombineGather
|
||||
}
|
||||
|
||||
|
||||
template<class Container>
|
||||
void Foam::Pstream::mapCombineScatter
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
Container& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
#ifndef Foam_Pstream_scatter_nobroadcast
|
||||
Pstream::broadcast(values, comm);
|
||||
#else
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
// My communication order
|
||||
const UPstream::commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
|
||||
// Receive from up
|
||||
if (myComm.above() != -1)
|
||||
{
|
||||
IPstream fromAbove
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
fromAbove >> values;
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
Pout<< " received from "
|
||||
<< myComm.above() << " data:" << values << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Send to my downstairs neighbours
|
||||
forAllReverse(myComm.below(), belowI)
|
||||
{
|
||||
const label belowID = myComm.below()[belowI];
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
Pout<< " sending to " << belowID << " data:" << values << endl;
|
||||
}
|
||||
|
||||
OPstream toBelow
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
toBelow << values;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<class Container, class CombineOp>
|
||||
void Foam::Pstream::mapCombineGather
|
||||
(
|
||||
Container& values,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
Pstream::mapCombineGather
|
||||
(
|
||||
UPstream::whichCommunication(comm),
|
||||
values,
|
||||
cop,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Container>
|
||||
void Foam::Pstream::mapCombineScatter
|
||||
(
|
||||
Container& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
#ifndef Foam_Pstream_scatter_nobroadcast
|
||||
Pstream::broadcast(values, comm);
|
||||
#else
|
||||
Pstream::mapCombineScatter
|
||||
(
|
||||
UPstream::whichCommunication(comm),
|
||||
values,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template<class Container, class CombineOp>
|
||||
void Foam::Pstream::mapCombineReduce
|
||||
(
|
||||
@ -748,9 +382,7 @@ void Foam::Pstream::mapCombineReduce
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
const auto& comms = UPstream::whichCommunication(comm);
|
||||
|
||||
Pstream::mapCombineGather(comms, values, cop, tag, comm);
|
||||
Pstream::mapCombineGather(values, cop, tag, comm);
|
||||
Pstream::broadcast(values, comm);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,7 +26,7 @@ License
|
||||
|
||||
Description
|
||||
Gather data from all processors onto single processor according to some
|
||||
communication schedule (usually linear-to-master or tree-to-master).
|
||||
communication schedule (usually tree-to-master).
|
||||
The gathered data will be a single value constructed from the values
|
||||
on individual processors using a user-specified operator.
|
||||
|
||||
@ -41,7 +41,6 @@ Description
|
||||
template<class T, class BinaryOp>
|
||||
void Foam::Pstream::gather
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
T& value,
|
||||
const BinaryOp& bop,
|
||||
const int tag,
|
||||
@ -50,8 +49,10 @@ void Foam::Pstream::gather
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
// My communication order
|
||||
const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
// Communication order
|
||||
const auto& comms = UPstream::whichCommunication(comm);
|
||||
// if (comms.empty()) return; // extra safety?
|
||||
const auto& myComm = comms[UPstream::myProcNo(comm)];
|
||||
|
||||
// Receive from my downstairs neighbours
|
||||
for (const label belowID : myComm.below())
|
||||
@ -76,7 +77,7 @@ void Foam::Pstream::gather
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
0,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
@ -87,7 +88,7 @@ void Foam::Pstream::gather
|
||||
}
|
||||
|
||||
// Send up value
|
||||
if (myComm.above() != -1)
|
||||
if (myComm.above() >= 0)
|
||||
{
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
@ -107,7 +108,7 @@ void Foam::Pstream::gather
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
0,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
@ -119,110 +120,181 @@ void Foam::Pstream::gather
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::Pstream::scatter
|
||||
Foam::List<T> Foam::Pstream::listGatherValues
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
T& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
const T& localValue,
|
||||
const label comm,
|
||||
const int tag
|
||||
)
|
||||
{
|
||||
#ifndef Foam_Pstream_scatter_nobroadcast
|
||||
Pstream::broadcast(value, comm);
|
||||
#else
|
||||
// OR
|
||||
// if (is_contiguous<T>::value)
|
||||
// {
|
||||
// return UPstream::listGatherValues(localValue, comm);
|
||||
// }
|
||||
|
||||
List<T> allValues;
|
||||
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
// My communication order
|
||||
const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
const label numProc = UPstream::nProcs(comm);
|
||||
|
||||
// Receive from up
|
||||
if (myComm.above() != -1)
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
reinterpret_cast<char*>(&value),
|
||||
sizeof(T),
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPstream fromAbove
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
myComm.above(),
|
||||
0,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
fromAbove >> value;
|
||||
}
|
||||
allValues.resize(numProc);
|
||||
}
|
||||
|
||||
// Send to my downstairs neighbours. Note reverse order (compared to
|
||||
// receiving). This is to make sure to send to the critical path
|
||||
// (only when using a tree schedule!) first.
|
||||
forAllReverse(myComm.below(), belowI)
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
const label belowID = myComm.below()[belowI];
|
||||
UPstream::mpiGather
|
||||
(
|
||||
reinterpret_cast<const char*>(&localValue),
|
||||
allValues.data_bytes(),
|
||||
sizeof(T), // The send/recv size per rank
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
// Non-trivial to manage non-blocking gather without a
|
||||
// PEX/NBX approach (eg, PstreamBuffers) but leave with
|
||||
// with simple exchange for now
|
||||
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
reinterpret_cast<const char*>(&value),
|
||||
sizeof(T),
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
allValues[0] = localValue;
|
||||
|
||||
for (int proci = 1; proci < numProc; ++proci)
|
||||
{
|
||||
IPstream fromProc
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
proci,
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
fromProc >> allValues[proci];
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (UPstream::is_rank(comm))
|
||||
{
|
||||
OPstream toBelow
|
||||
OPstream toProc
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
belowID,
|
||||
0,
|
||||
UPstream::masterNo(),
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
toBelow << value;
|
||||
toProc << localValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// non-parallel: return own value
|
||||
// TBD: only when UPstream::is_rank(comm) as well?
|
||||
allValues.resize(1);
|
||||
allValues[0] = localValue;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class BinaryOp>
|
||||
void Foam::Pstream::gather
|
||||
(
|
||||
T& value,
|
||||
const BinaryOp& bop,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
Pstream::gather(UPstream::whichCommunication(comm), value, bop, tag, comm);
|
||||
return allValues;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::Pstream::scatter(T& value, const int tag, const label comm)
|
||||
T Foam::Pstream::listScatterValues
|
||||
(
|
||||
const UList<T>& allValues,
|
||||
const label comm,
|
||||
const int tag
|
||||
)
|
||||
{
|
||||
#ifndef Foam_Pstream_scatter_nobroadcast
|
||||
Pstream::broadcast(value, comm);
|
||||
#else
|
||||
Pstream::scatter(UPstream::whichCommunication(comm), value, tag, comm);
|
||||
#endif
|
||||
// OR
|
||||
// if (is_contiguous<T>::value)
|
||||
// {
|
||||
// return UPstream::listScatterValues(allValues, comm);
|
||||
// }
|
||||
|
||||
T localValue{};
|
||||
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
const label numProc = UPstream::nProcs(comm);
|
||||
|
||||
if (UPstream::master(comm) && allValues.size() < numProc)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Attempting to send " << allValues.size()
|
||||
<< " values to " << numProc << " processors" << endl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UPstream::mpiScatter
|
||||
(
|
||||
allValues.cdata_bytes(),
|
||||
reinterpret_cast<char*>(&localValue),
|
||||
sizeof(T), // The send/recv size per rank
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
const label startOfRequests = UPstream::nRequests();
|
||||
|
||||
List<DynamicList<char>> sendBuffers(numProc);
|
||||
|
||||
for (int proci = 1; proci < numProc; ++proci)
|
||||
{
|
||||
UOPstream toProc
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
proci,
|
||||
sendBuffers[proci],
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
toProc << allValues[proci];
|
||||
}
|
||||
|
||||
// Wait for outstanding requests
|
||||
UPstream::waitRequests(startOfRequests);
|
||||
|
||||
return allValues[0];
|
||||
}
|
||||
else if (UPstream::is_rank(comm))
|
||||
{
|
||||
IPstream fromProc
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
UPstream::masterNo(),
|
||||
0, // bufsize
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
fromProc >> localValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// non-parallel: return first value
|
||||
// TBD: only when UPstream::is_rank(comm) as well?
|
||||
|
||||
if (!allValues.empty())
|
||||
{
|
||||
return allValues[0];
|
||||
}
|
||||
}
|
||||
|
||||
return localValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -26,7 +26,7 @@ License
|
||||
|
||||
Description
|
||||
Gather data from all processors onto single processor according to some
|
||||
communication schedule (usually linear-to-master or tree-to-master).
|
||||
communication schedule (usually tree-to-master).
|
||||
The gathered data will be a list with element procID the data from processor
|
||||
procID. Before calling every processor should insert its value into
|
||||
values[UPstream::myProcNo(comm)].
|
||||
@ -45,24 +45,27 @@ Description
|
||||
template<class T>
|
||||
void Foam::Pstream::gatherList
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const UList<UPstream::commsStruct>& comms,
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
if (!comms.empty() && UPstream::is_parallel(comm))
|
||||
{
|
||||
if (values.size() < UPstream::nProcs(comm))
|
||||
const label myProci = UPstream::myProcNo(comm);
|
||||
const label numProc = UPstream::nProcs(comm);
|
||||
|
||||
if (values.size() < numProc)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "List of values is too small:" << values.size()
|
||||
<< " vs numProcs:" << UPstream::nProcs(comm) << nl
|
||||
<< "List of values:" << values.size()
|
||||
<< " < numProcs:" << numProc << nl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
// My communication order
|
||||
const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
const auto& myComm = comms[myProci];
|
||||
|
||||
// Receive from my downstairs neighbours
|
||||
for (const label belowID : myComm.below())
|
||||
@ -127,21 +130,21 @@ void Foam::Pstream::gatherList
|
||||
// Send up from values:
|
||||
// - my own value first
|
||||
// - all belowLeaves next
|
||||
if (myComm.above() != -1)
|
||||
if (myComm.above() >= 0)
|
||||
{
|
||||
const labelList& belowLeaves = myComm.allBelow();
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
Pout<< " sending to " << myComm.above()
|
||||
<< " data from me:" << UPstream::myProcNo(comm)
|
||||
<< " data:" << values[UPstream::myProcNo(comm)] << endl;
|
||||
<< " data from me:" << myProci
|
||||
<< " data:" << values[myProci] << endl;
|
||||
}
|
||||
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
List<T> sending(belowLeaves.size() + 1);
|
||||
sending[0] = values[UPstream::myProcNo(comm)];
|
||||
sending[0] = values[myProci];
|
||||
|
||||
forAll(belowLeaves, leafI)
|
||||
{
|
||||
@ -168,7 +171,7 @@ void Foam::Pstream::gatherList
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
toAbove << values[UPstream::myProcNo(comm)];
|
||||
toAbove << values[myProci];
|
||||
|
||||
for (const label leafID : belowLeaves)
|
||||
{
|
||||
@ -189,8 +192,8 @@ void Foam::Pstream::gatherList
|
||||
template<class T>
|
||||
void Foam::Pstream::scatterList
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const UList<UPstream::commsStruct>& comms,
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
@ -199,21 +202,24 @@ void Foam::Pstream::scatterList
|
||||
// between scatterList() and using broadcast(List<T>&) or a regular
|
||||
// scatter(List<T>&) is that processor-local data is skipped.
|
||||
|
||||
if (UPstream::is_parallel(comm))
|
||||
if (!comms.empty() && UPstream::is_parallel(comm))
|
||||
{
|
||||
if (values.size() < UPstream::nProcs(comm))
|
||||
const label myProci = UPstream::myProcNo(comm);
|
||||
const label numProc = UPstream::nProcs(comm);
|
||||
|
||||
if (values.size() < numProc)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "List of values is too small:" << values.size()
|
||||
<< " vs numProcs:" << UPstream::nProcs(comm) << nl
|
||||
<< "List of values:" << values.size()
|
||||
<< " < numProcs:" << numProc << nl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
// My communication order
|
||||
const commsStruct& myComm = comms[UPstream::myProcNo(comm)];
|
||||
const auto& myComm = comms[myProci];
|
||||
|
||||
// Receive from up
|
||||
if (myComm.above() != -1)
|
||||
if (myComm.above() >= 0)
|
||||
{
|
||||
const labelList& notBelowLeaves = myComm.allNotBelow();
|
||||
|
||||
@ -318,12 +324,18 @@ void Foam::Pstream::scatterList
|
||||
template<class T>
|
||||
void Foam::Pstream::gatherList
|
||||
(
|
||||
List<T>& values,
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
Pstream::gatherList(UPstream::whichCommunication(comm), values, tag, comm);
|
||||
Pstream::gatherList
|
||||
(
|
||||
UPstream::whichCommunication(comm),
|
||||
values,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -331,19 +343,25 @@ void Foam::Pstream::gatherList
|
||||
template<class T>
|
||||
void Foam::Pstream::scatterList
|
||||
(
|
||||
List<T>& values,
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
Pstream::scatterList(UPstream::whichCommunication(comm), values, tag, comm);
|
||||
Pstream::scatterList
|
||||
(
|
||||
UPstream::whichCommunication(comm),
|
||||
values,
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void Foam::Pstream::allGatherList
|
||||
(
|
||||
List<T>& values,
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,28 +46,6 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Reduce inplace (cf. MPI Allreduce)
|
||||
//- using specified communication schedule.
|
||||
template<class T, class BinaryOp>
|
||||
void reduce
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
T& value,
|
||||
const BinaryOp& bop,
|
||||
const int tag,
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
|
||||
{
|
||||
Pout<< "** reducing:" << value << " with comm:" << comm << endl;
|
||||
error::printStack(Pout);
|
||||
}
|
||||
Pstream::gather(comms, value, bop, tag, comm);
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
|
||||
|
||||
//- Reduce inplace (cf. MPI Allreduce)
|
||||
//- using linear/tree communication schedule
|
||||
template<class T, class BinaryOp>
|
||||
@ -81,7 +59,13 @@ void reduce
|
||||
{
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
Foam::reduce(UPstream::whichCommunication(comm), value, bop, tag, comm);
|
||||
if (UPstream::warnComm >= 0 && comm != UPstream::warnComm)
|
||||
{
|
||||
Pout<< "** reducing:" << value << " with comm:" << comm << endl;
|
||||
error::printStack(Pout);
|
||||
}
|
||||
Pstream::gather(value, bop, tag, comm);
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
}
|
||||
|
||||
@ -436,8 +420,7 @@ Pstream_SumReduce(double);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Convenience wrappers for some reduction operations
|
||||
// - defined after all specialisations are known
|
||||
// Convenience wrappers - defined after all specialisations are known
|
||||
|
||||
//- Perform reduction on a copy, using specified binary operation
|
||||
// \return the resulting value
|
||||
|
||||
@ -52,6 +52,7 @@ Foam::UPstream::commsTypeNames
|
||||
({
|
||||
{ commsTypes::blocking, "blocking" },
|
||||
{ commsTypes::scheduled, "scheduled" },
|
||||
// { commsTypes::nonBlocking, "non-blocking" },
|
||||
{ commsTypes::nonBlocking, "nonBlocking" },
|
||||
});
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -895,21 +895,32 @@ public:
|
||||
);
|
||||
|
||||
//- Communication schedule for tree all-to-master (proc 0)
|
||||
static const List<commsStruct>& treeCommunication
|
||||
static const List<commsStruct>&
|
||||
treeCommunication
|
||||
(
|
||||
const label communicator = worldComm
|
||||
);
|
||||
|
||||
//- Communication schedule for linear/tree all-to-master (proc 0).
|
||||
//- Chooses based on the value of UPstream::nProcsSimpleSum
|
||||
//- Communication schedule for all-to-master (proc 0) as
|
||||
//- linear/tree/none with switching based on UPstream::nProcsSimpleSum
|
||||
//- and the is_parallel() state
|
||||
static const List<commsStruct>& whichCommunication
|
||||
(
|
||||
const label communicator = worldComm
|
||||
)
|
||||
{
|
||||
const label np
|
||||
(
|
||||
parRun_ && is_rank(communicator) // cf. is_parallel()
|
||||
? nProcs(communicator)
|
||||
: 0
|
||||
);
|
||||
|
||||
return
|
||||
(
|
||||
nProcs(communicator) < nProcsSimpleSum
|
||||
np <= 1
|
||||
? List<commsStruct>::null()
|
||||
: np < nProcsSimpleSum
|
||||
? linearCommunication(communicator)
|
||||
: treeCommunication(communicator)
|
||||
);
|
||||
@ -1138,7 +1149,7 @@ public:
|
||||
// On master input list length == nProcs, ignored on other procs.
|
||||
// \n
|
||||
// For \b non-parallel :
|
||||
// returns the first list element (or zero).
|
||||
// returns the first list element (or default initialized).
|
||||
template<class T>
|
||||
static T listScatterValues
|
||||
(
|
||||
@ -1191,6 +1202,7 @@ public:
|
||||
|
||||
//- Process index of first sub-process
|
||||
// \deprecated(2020-09) use subProcs() method instead
|
||||
FOAM_DEPRECATED_FOR(2020-09, "subProcs() method")
|
||||
static constexpr int firstSlave() noexcept
|
||||
{
|
||||
return 1;
|
||||
@ -1198,6 +1210,7 @@ public:
|
||||
|
||||
//- Process index of last sub-process
|
||||
// \deprecated(2020-09) use subProcs() method instead
|
||||
FOAM_DEPRECATED_FOR(2020-09, "subProcs() or allProcs() method")
|
||||
static int lastSlave(const label communicator = worldComm)
|
||||
{
|
||||
return nProcs(communicator) - 1;
|
||||
|
||||
@ -34,14 +34,6 @@ Foam::List<T> Foam::UPstream::allGatherValues
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
if (!is_contiguous<T>::value)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot all-gather values for non-contiguous types" << endl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
List<T> allValues;
|
||||
|
||||
if (UPstream::is_parallel(comm))
|
||||
@ -49,7 +41,17 @@ Foam::List<T> Foam::UPstream::allGatherValues
|
||||
allValues.resize(UPstream::nProcs(comm));
|
||||
allValues[UPstream::myProcNo(comm)] = localValue;
|
||||
|
||||
UPstream::mpiAllGather(allValues.data_bytes(), sizeof(T), comm);
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UPstream::mpiAllGather(allValues.data_bytes(), sizeof(T), comm);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot all-gather values for non-contiguous types"
|
||||
" - consider Pstream variant instead" << endl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -70,14 +72,6 @@ Foam::List<T> Foam::UPstream::listGatherValues
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
if (!is_contiguous<T>::value)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot gather values for non-contiguous types" << endl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
List<T> allValues;
|
||||
|
||||
if (UPstream::is_parallel(comm))
|
||||
@ -87,13 +81,23 @@ Foam::List<T> Foam::UPstream::listGatherValues
|
||||
allValues.resize(UPstream::nProcs(comm));
|
||||
}
|
||||
|
||||
UPstream::mpiGather
|
||||
(
|
||||
reinterpret_cast<const char*>(&localValue),
|
||||
allValues.data_bytes(),
|
||||
sizeof(T), // The send/recv size per rank
|
||||
comm
|
||||
);
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
UPstream::mpiGather
|
||||
(
|
||||
reinterpret_cast<const char*>(&localValue),
|
||||
allValues.data_bytes(),
|
||||
sizeof(T), // The send/recv size per rank
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot gather values for non-contiguous types"
|
||||
" - consider Pstream variant instead" << endl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -114,47 +118,46 @@ T Foam::UPstream::listScatterValues
|
||||
const label comm
|
||||
)
|
||||
{
|
||||
if (!is_contiguous<T>::value)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot scatter values for non-contiguous types" << endl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
T localValue;
|
||||
T localValue{};
|
||||
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
const label nproc = UPstream::nProcs(comm);
|
||||
const label numProc = UPstream::nProcs(comm);
|
||||
|
||||
if (UPstream::master(comm) && allValues.size() < nproc)
|
||||
if (UPstream::master(comm) && allValues.size() < numProc)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Attempting to send " << allValues.size()
|
||||
<< " values to " << nproc << " processors" << endl
|
||||
<< " values to " << numProc << " processors" << endl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
UPstream::mpiScatter
|
||||
(
|
||||
allValues.cdata_bytes(),
|
||||
reinterpret_cast<char*>(&localValue),
|
||||
sizeof(T), // The send/recv size per rank
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// non-parallel: return local value
|
||||
|
||||
if (UPstream::is_rank(comm) && !allValues.empty())
|
||||
if (is_contiguous<T>::value)
|
||||
{
|
||||
localValue = allValues[0];
|
||||
UPstream::mpiScatter
|
||||
(
|
||||
allValues.cdata_bytes(),
|
||||
reinterpret_cast<char*>(&localValue),
|
||||
sizeof(T), // The send/recv size per rank
|
||||
comm
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
localValue = Zero;
|
||||
FatalErrorInFunction
|
||||
<< "Cannot scatter values for non-contiguous types"
|
||||
" - consider Pstream variant instead" << endl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// non-parallel: return first value
|
||||
// TBD: only when UPstream::is_rank(comm) as well?
|
||||
|
||||
if (!allValues.empty())
|
||||
{
|
||||
return allValues[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -541,7 +541,7 @@ public:
|
||||
// No character stripping
|
||||
inline explicit token(tokenType typ, const std::string&, label line=0);
|
||||
|
||||
//- Copy construct word/string token with the specified variant.
|
||||
//- Move construct word/string token with the specified variant.
|
||||
// A invalid word/string variant type is silently treated as STRING.
|
||||
// No character stripping
|
||||
inline explicit token(tokenType typ, std::string&&, label line=0);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 Sergey Lesnik
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
Copyright (C) 2023-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -35,7 +35,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Write tokens without keyword, suppress/ignore bad tokens.
|
||||
// Mostly like primitiveEntry::write(os, false);
|
||||
// Mostly like primitiveEntry::write(os, true);
|
||||
|
||||
static void writeTokens(Ostream& os, const tokenList& toks)
|
||||
{
|
||||
@ -56,11 +56,11 @@ static void writeTokens(Ostream& os, const tokenList& toks)
|
||||
started = true;
|
||||
}
|
||||
|
||||
// Output token with direct handling in Ostream(s),
|
||||
// or use normal '<<' output operator
|
||||
// Token output via direct handling in Ostream(s),
|
||||
// or normal '<<' output operator
|
||||
if (!os.write(tok))
|
||||
{
|
||||
os << tok;
|
||||
os << tok;
|
||||
}
|
||||
|
||||
if (tok.isCharData())
|
||||
@ -73,18 +73,10 @@ static void writeTokens(Ostream& os, const tokenList& toks)
|
||||
if (s.starts_with("//") && !s.ends_with('\n'))
|
||||
{
|
||||
os << '\n';
|
||||
started = false; // already have newline as separator
|
||||
started = false; // Does not need further space separator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Always finish up with a newline?
|
||||
// eg,
|
||||
//
|
||||
// if (started)
|
||||
// {
|
||||
// os << nl;
|
||||
// }
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
@ -141,7 +133,10 @@ Foam::formattingEntry::formattingEntry
|
||||
|
||||
void Foam::formattingEntry::write(Ostream& os) const
|
||||
{
|
||||
writeTokens(os, *this);
|
||||
if (active_)
|
||||
{
|
||||
writeTokens(os, *this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 Sergey Lesnik
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
Copyright (C) 2023-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,12 +51,17 @@ class formattingEntry
|
||||
:
|
||||
public primitiveEntry
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The output visibility
|
||||
bool active_ = true;
|
||||
|
||||
public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Generate a default entry keyword: "__format-entry__NNN"
|
||||
// The generated names are unlikely to collide with user dictionaries
|
||||
//- Generate an entry keyword: "__format-entry__NNN".
|
||||
//- The generated names are unlikely to collide with user dictionaries
|
||||
static keyType defaultName(label n)
|
||||
{
|
||||
return keyType
|
||||
@ -99,6 +104,12 @@ public:
|
||||
formattingEntry(defaultName(n), std::move(content))
|
||||
{}
|
||||
|
||||
//- Construct with token data, using a generated keyword
|
||||
formattingEntry(const label n, token&& tok, bool visible=true)
|
||||
:
|
||||
primitiveEntry(defaultName(n), std::move(tok)),
|
||||
active_(visible)
|
||||
{}
|
||||
|
||||
//- Clone the entry
|
||||
virtual autoPtr<entry> clone(const dictionary&) const
|
||||
@ -112,6 +123,21 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Set output visibility on/off.
|
||||
// \return the previous value
|
||||
bool active(bool on) noexcept
|
||||
{
|
||||
bool old(active_);
|
||||
active_ = on;
|
||||
return old;
|
||||
}
|
||||
|
||||
//- Get the output visibility
|
||||
bool active() const noexcept
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
//- Write content without the keyword.
|
||||
// Special properties:
|
||||
// - ignores any bad tokens on output.
|
||||
|
||||
@ -115,7 +115,7 @@ Type Foam::Function1Types::Function1Expression<Type>::integrate
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return Zero;
|
||||
return Type();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -163,7 +163,7 @@ operator_precedence()
|
||||
|
||||
svalue (lhs) ::= NUMBER (tok) . { lhs = (tok).scalarValue; } // scanToken
|
||||
|
||||
svalue (lhs) ::= ZERO . { lhs = Foam::Zero; }
|
||||
svalue (lhs) ::= ZERO . { lhs = Foam::zero{}; }
|
||||
svalue (lhs) ::= PI LPAREN RPAREN . { lhs = Foam::constant::mathematical::pi; }
|
||||
svalue (lhs) ::= DEG_TO_RAD LPAREN RPAREN . { lhs = Foam::degToRad(); }
|
||||
svalue (lhs) ::= RAD_TO_DEG LPAREN RPAREN . { lhs = Foam::radToDeg(); }
|
||||
|
||||
@ -137,8 +137,11 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a NullObjectRef DimensionedField
|
||||
inline static const DimensionedField<Type, GeoMesh>& null();
|
||||
//- Return a null DimensionedField (reference to a nullObject).
|
||||
static const DimensionedField<Type, GeoMesh>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<DimensionedField<Type, GeoMesh>>();
|
||||
}
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -28,14 +28,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, class GeoMesh>
|
||||
inline const Foam::DimensionedField<Type, GeoMesh>&
|
||||
Foam::DimensionedField<Type, GeoMesh>::null()
|
||||
{
|
||||
return NullObjectRef<DimensionedField<Type, GeoMesh>>();
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class GeoMesh>
|
||||
inline const typename GeoMesh::Mesh&
|
||||
Foam::DimensionedField<Type, GeoMesh>::mesh() const noexcept
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
~SlicedDimensionedField()
|
||||
{
|
||||
// Set internalField to nullptr to avoid deletion of underlying field
|
||||
UList<Type>::shallowCopy(UList<Type>());
|
||||
UList<Type>::shallowCopy(nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -97,8 +97,8 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null field
|
||||
inline static const DynamicField<T, SizeMin>& null()
|
||||
//- Return a null DynamicField (reference to a nullObject).
|
||||
static const DynamicField<T, SizeMin>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<DynamicField<T, SizeMin>>();
|
||||
}
|
||||
|
||||
@ -122,8 +122,12 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return nullObject reference Field
|
||||
inline static const Field<Type>& null();
|
||||
//- Return a null Field (reference to a nullObject).
|
||||
//- Behaves like an empty Field.
|
||||
static const Field<Type>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<Field<Type>>();
|
||||
}
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -25,15 +25,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline const Foam::Field<Type>& Foam::Field<Type>::null()
|
||||
{
|
||||
return NullObjectRef<Field<Type>>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -69,8 +69,12 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return nullObject reference SubField
|
||||
inline static const SubField<Type>& null();
|
||||
//- Return a null SubField (reference to a nullObject).
|
||||
//- Behaves like an empty SubField.
|
||||
static const SubField<Type>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<SubField<Type>>();
|
||||
}
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -26,15 +26,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline const Foam::SubField<Type>& Foam::SubField<Type>::null()
|
||||
{
|
||||
return NullObjectRef<SubField<Type>>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -154,8 +154,11 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null geometric field
|
||||
inline static const GeometricField<Type, PatchField, GeoMesh>& null();
|
||||
//- Return a null GeometricField (reference to a nullObject).
|
||||
static const GeometricField<Type, PatchField, GeoMesh>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<GeometricField<Type, PatchField, GeoMesh>>();
|
||||
}
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -28,14 +28,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
inline const Foam::GeometricField<Type, PatchField, GeoMesh>&
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::null()
|
||||
{
|
||||
return NullObjectRef<GeometricField<Type, PatchField, GeoMesh>>();
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
inline const typename
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::Internal&
|
||||
|
||||
@ -176,10 +176,11 @@ makeBoundary
|
||||
new SlicedPatchField<Type>
|
||||
(
|
||||
p,
|
||||
DimensionedField<Type, GeoMesh>::null(),
|
||||
bField[patchi]
|
||||
DimensionedField<Type, GeoMesh>::null()
|
||||
)
|
||||
);
|
||||
|
||||
bf[patchi].UList<Type>::shallowCopy(bField[patchi]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,7 +369,7 @@ Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
|
||||
~SlicedGeometricField()
|
||||
{
|
||||
// Set internalField to nullptr to avoid deletion of underlying field
|
||||
UList<Type>::shallowCopy(UList<Type>());
|
||||
UList<Type>::shallowCopy(nullptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ namespace fileOperations
|
||||
|
||||
float collatedFileOperation::maxThreadFileBufferSize
|
||||
(
|
||||
debug::floatOptimisationSwitch("maxThreadFileBufferSize", 1e9)
|
||||
debug::floatOptimisationSwitch("maxThreadFileBufferSize", 0)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
@ -90,26 +90,41 @@ void Foam::fileOperations::collatedFileOperation::printBanner
|
||||
DetailInfo
|
||||
<< "I/O : " << this->type();
|
||||
|
||||
if (maxThreadFileBufferSize == 0)
|
||||
{
|
||||
DetailInfo
|
||||
<< " [unthreaded] (maxThreadFileBufferSize = 0)." << nl
|
||||
<< " Writing may be slow for large file sizes."
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
if (mag(maxThreadFileBufferSize) > 1)
|
||||
{
|
||||
// FUTURE: deprecate or remove threading?
|
||||
DetailInfo
|
||||
<< " [threaded] (maxThreadFileBufferSize = "
|
||||
<< maxThreadFileBufferSize << ")." << nl
|
||||
<< " Requires buffer large enough to collect all data"
|
||||
" or thread support" << nl
|
||||
<< " enabled in MPI. If MPI thread support cannot be"
|
||||
" enabled, deactivate" << nl
|
||||
<< " threading by setting maxThreadFileBufferSize"
|
||||
" to 0 in" << nl
|
||||
" or MPI thread support." << nl
|
||||
<< " To avoid MPI threading [slow], set"
|
||||
" (maxThreadFileBufferSize = 0) in" << nl
|
||||
<< " OpenFOAM etc/controlDict" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
DetailInfo
|
||||
<< " [unthreaded] (maxThreadFileBufferSize = 0)." << nl;
|
||||
|
||||
if (mag(maxMasterFileBufferSize) < 1)
|
||||
{
|
||||
DetailInfo
|
||||
<< " With scheduled transfer" << nl;
|
||||
}
|
||||
else if (maxMasterFileBufferSize >= 1)
|
||||
{
|
||||
DetailInfo
|
||||
<< " With non-blocking transfer,"
|
||||
" buffer-size = " << maxMasterFileBufferSize << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
DetailInfo
|
||||
<< " With non-blocking transfer,"
|
||||
" minimal buffer size" << nl;
|
||||
}
|
||||
}
|
||||
|
||||
if (withRanks)
|
||||
{
|
||||
@ -455,7 +470,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
||||
{
|
||||
// Re-check static maxThreadFileBufferSize variable to see
|
||||
// if needs to use threading
|
||||
const bool useThread = (maxThreadFileBufferSize != 0);
|
||||
const bool useThread = (mag(maxThreadFileBufferSize) > 1);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -875,11 +875,11 @@ bool Foam::fileOperations::masterUncollatedFileOperation::mkDir
|
||||
mode_t mode
|
||||
) const
|
||||
{
|
||||
return masterOp<mode_t>
|
||||
return masterOp<bool>
|
||||
(
|
||||
dir,
|
||||
mkDirOp(mode),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -891,11 +891,11 @@ bool Foam::fileOperations::masterUncollatedFileOperation::chMod
|
||||
mode_t mode
|
||||
) const
|
||||
{
|
||||
return masterOp<mode_t>
|
||||
return masterOp<bool>
|
||||
(
|
||||
fName,
|
||||
chModOp(mode),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -911,7 +911,7 @@ mode_t Foam::fileOperations::masterUncollatedFileOperation::mode
|
||||
(
|
||||
fName,
|
||||
modeOp(followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -925,11 +925,11 @@ Foam::fileName::Type Foam::fileOperations::masterUncollatedFileOperation::type
|
||||
{
|
||||
return fileName::Type
|
||||
(
|
||||
masterOp<label>
|
||||
masterOp<int>
|
||||
(
|
||||
fName,
|
||||
typeOp(followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
)
|
||||
);
|
||||
@ -947,7 +947,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::exists
|
||||
(
|
||||
fName,
|
||||
existsOp(checkGzip, followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -963,7 +963,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::isDir
|
||||
(
|
||||
fName,
|
||||
isDirOp(followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -980,7 +980,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::isFile
|
||||
(
|
||||
fName,
|
||||
isFileOp(checkGzip, followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -996,7 +996,7 @@ off_t Foam::fileOperations::masterUncollatedFileOperation::fileSize
|
||||
(
|
||||
fName,
|
||||
fileSizeOp(followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1012,7 +1012,7 @@ time_t Foam::fileOperations::masterUncollatedFileOperation::lastModified
|
||||
(
|
||||
fName,
|
||||
lastModifiedOp(followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
UPstream::worldComm
|
||||
);
|
||||
}
|
||||
@ -1028,7 +1028,7 @@ double Foam::fileOperations::masterUncollatedFileOperation::highResLastModified
|
||||
(
|
||||
fName,
|
||||
highResLastModifiedOp(followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
UPstream::worldComm
|
||||
);
|
||||
}
|
||||
@ -1044,7 +1044,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::mvBak
|
||||
(
|
||||
fName,
|
||||
mvBakOp(ext),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1059,7 +1059,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::rm
|
||||
(
|
||||
fName,
|
||||
rmOp(),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::rmDir
|
||||
(
|
||||
dir,
|
||||
rmDirOp(silent, emptyOnly),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1094,7 +1094,7 @@ Foam::fileNameList Foam::fileOperations::masterUncollatedFileOperation::readDir
|
||||
(
|
||||
dir,
|
||||
readDirOp(type, filtergz, followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1112,7 +1112,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::cp
|
||||
src,
|
||||
dst,
|
||||
cpOp(followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1129,7 +1129,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::ln
|
||||
src,
|
||||
dst,
|
||||
lnOp(),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1147,7 +1147,7 @@ bool Foam::fileOperations::masterUncollatedFileOperation::mv
|
||||
src,
|
||||
dst,
|
||||
mvOp(followLink),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1293,7 +1293,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::filePath
|
||||
(
|
||||
io.objectPath(),
|
||||
fileOrNullOp(true), // isFile=true
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
@ -1451,7 +1451,7 @@ Foam::fileName Foam::fileOperations::masterUncollatedFileOperation::dirPath
|
||||
(
|
||||
io.objectPath(),
|
||||
fileOrNullOp(false), // isFile=false
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm_
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -162,8 +162,8 @@ protected:
|
||||
followLink_(followLink)
|
||||
{}
|
||||
|
||||
// Returns label not fileName::Type for reductions
|
||||
label operator()(const fileName& f) const
|
||||
// Returns int (for reductions) instead of fileName::Type
|
||||
int operator()(const fileName& f) const
|
||||
{
|
||||
return Foam::type(f, followLink_);
|
||||
}
|
||||
@ -390,9 +390,6 @@ protected:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
template<class Type>
|
||||
Type scatterList(const UList<Type>&, const int, const label comm) const;
|
||||
|
||||
template<class Type, class FileOp>
|
||||
Type masterOp
|
||||
(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,41 +31,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Type Foam::fileOperations::masterUncollatedFileOperation::scatterList
|
||||
(
|
||||
const UList<Type>& allValues,
|
||||
const int tag,
|
||||
const label comm
|
||||
) const
|
||||
{
|
||||
// TBD: more efficient scatter
|
||||
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking, tag, comm);
|
||||
if (Pstream::master(comm))
|
||||
{
|
||||
for (const int proci : Pstream::subProcs(comm))
|
||||
{
|
||||
UOPstream os(proci, pBufs);
|
||||
os << allValues[proci];
|
||||
}
|
||||
}
|
||||
pBufs.finishedScatters();
|
||||
|
||||
Type value;
|
||||
|
||||
if (Pstream::master(comm))
|
||||
{
|
||||
value = allValues[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
UIPstream is(Pstream::masterNo(), pBufs);
|
||||
is >> value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class FileOp>
|
||||
Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
||||
(
|
||||
@ -81,17 +46,24 @@ Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
||||
<< typeid(FileOp).name()
|
||||
<< " on " << fName << endl;
|
||||
}
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
List<fileName> filePaths(Pstream::nProcs(comm));
|
||||
filePaths[Pstream::myProcNo(comm)] = fName;
|
||||
Pstream::gatherList(filePaths, tag, comm);
|
||||
|
||||
List<Type> result(filePaths.size());
|
||||
if (Pstream::master(comm))
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
const label myProci = UPstream::myProcNo(comm);
|
||||
const label numProc = UPstream::nProcs(comm);
|
||||
|
||||
List<fileName> filePaths(numProc);
|
||||
filePaths[myProci] = fName;
|
||||
Pstream::gatherList(filePaths, tag, comm);
|
||||
// OR filePaths = Pstream::listGatherValues(fName, comm, tag)
|
||||
|
||||
List<Type> result;
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
result.resize(numProc);
|
||||
result = fop(filePaths[0]);
|
||||
for (label i = 1; i < filePaths.size(); i++)
|
||||
|
||||
for (label i = 1; i < numProc; ++i)
|
||||
{
|
||||
if (filePaths[i] != filePaths[0])
|
||||
{
|
||||
@ -100,12 +72,10 @@ Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
||||
}
|
||||
}
|
||||
|
||||
return scatterList(result, tag, comm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return fop(fName);
|
||||
return Pstream::listScatterValues(result, comm, tag);
|
||||
}
|
||||
|
||||
return fop(fName);
|
||||
}
|
||||
|
||||
|
||||
@ -124,35 +94,41 @@ Type Foam::fileOperations::masterUncollatedFileOperation::masterOp
|
||||
Pout<< "masterUncollatedFileOperation : Operation on src:" << src
|
||||
<< " dest:" << dest << endl;
|
||||
}
|
||||
if (Pstream::parRun())
|
||||
|
||||
if (UPstream::is_parallel(comm))
|
||||
{
|
||||
List<fileName> srcs(Pstream::nProcs(comm));
|
||||
srcs[Pstream::myProcNo(comm)] = src;
|
||||
Pstream::gatherList(srcs, tag, comm);
|
||||
const label myProci = UPstream::myProcNo(comm);
|
||||
const label numProc = UPstream::nProcs(comm);
|
||||
|
||||
List<fileName> dests(srcs.size());
|
||||
dests[Pstream::myProcNo(comm)] = dest;
|
||||
Pstream::gatherList(dests, tag, comm);
|
||||
List<Pair<fileName>> filePaths(numProc);
|
||||
filePaths[myProci].first() = src;
|
||||
filePaths[myProci].second() = dest;
|
||||
Pstream::gatherList(filePaths, tag, comm);
|
||||
// OR
|
||||
// Pair<fileName> tup(src, dest);
|
||||
// filePaths = Pstream::listGatherValues(tup, comm, tag)
|
||||
|
||||
List<Type> result(Pstream::nProcs(comm));
|
||||
if (Pstream::master(comm))
|
||||
List<Type> result;
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
result = fop(srcs[0], dests[0]);
|
||||
for (label i = 1; i < srcs.size(); i++)
|
||||
result.resize(numProc);
|
||||
result = fop(filePaths[0].first(), filePaths[0].second());
|
||||
|
||||
for (label i = 1; i < numProc; ++i)
|
||||
{
|
||||
if (srcs[i] != srcs[0])
|
||||
// TBD: also check second() ?
|
||||
if (filePaths[i].first() != filePaths[0].first())
|
||||
{
|
||||
result[i] = fop(srcs[i], dests[i]);
|
||||
result[i] =
|
||||
fop(filePaths[i].first(), filePaths[i].second());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return scatterList(result, tag, comm);
|
||||
}
|
||||
else
|
||||
{
|
||||
return fop(src, dest);
|
||||
return Pstream::listScatterValues(result, comm, tag);
|
||||
}
|
||||
|
||||
return fop(src, dest);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -114,8 +114,12 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null Matrix
|
||||
inline static const Matrix<Form, Type>& null();
|
||||
//- Return a null Matrix (reference to a nullObject).
|
||||
//- Behaves like a empty Matrix.
|
||||
static const Matrix<Form, Type>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<Matrix<Form, Type>>();
|
||||
}
|
||||
|
||||
|
||||
// Iterators
|
||||
|
||||
@ -85,13 +85,6 @@ Foam::Matrix<Form, Type>::clone() const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Form, class Type>
|
||||
inline const Foam::Matrix<Form, Type>& Foam::Matrix<Form, Type>::null()
|
||||
{
|
||||
return NullObjectRef<Matrix<Form, Type>>();
|
||||
}
|
||||
|
||||
|
||||
template<class Form, class Type>
|
||||
inline Foam::label Foam::Matrix<Form, Type>::size() const
|
||||
{
|
||||
|
||||
@ -102,7 +102,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return autoPtr<GAMGInterfaceField>(nullptr);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -42,8 +42,7 @@ namespace Foam
|
||||
const Foam::objectRegistry& Foam::lduMesh::thisDb() const
|
||||
{
|
||||
NotImplemented;
|
||||
const objectRegistry* orPtr_ = nullptr;
|
||||
return *orPtr_;
|
||||
return NullObjectRef<objectRegistry>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -395,7 +395,7 @@ public:
|
||||
// Face splitting utilities
|
||||
|
||||
//- Number of triangles after splitting
|
||||
inline label nTriangles() const;
|
||||
inline label nTriangles() const noexcept;
|
||||
|
||||
//- Number of triangles after splitting
|
||||
label nTriangles(const UList<point>& unused) const;
|
||||
|
||||
@ -199,9 +199,9 @@ inline Foam::label Foam::face::prevLabel(const label i) const
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::face::nTriangles() const
|
||||
inline Foam::label Foam::face::nTriangles() const noexcept
|
||||
{
|
||||
return size() - 2;
|
||||
return labelList::size() - 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -93,7 +93,7 @@ public:
|
||||
//- Construct from an initializer list of three vertex labels
|
||||
inline explicit triFace(std::initializer_list<label> list);
|
||||
|
||||
//- Copy construct from a list of three vertex labels.
|
||||
//- Copy construct from a list of three vertex labels.
|
||||
inline explicit triFace(const labelUList& list);
|
||||
|
||||
//- Copy construct from a subset of vertex labels
|
||||
|
||||
@ -123,13 +123,13 @@ bool Foam::polyMesh::checkFaceOrthogonality
|
||||
reduce(severeNonOrth, sumOp<label>());
|
||||
reduce(errorNonOrth, sumOp<label>());
|
||||
|
||||
const scalar maxNonOrth = radToDeg(::acos(clamp(minDDotS, -1, 1)));
|
||||
const scalar aveNonOrth = radToDeg(::acos(clamp(sumDDotS/nSummed, -1, 1)));
|
||||
|
||||
dictionary& meshDict = const_cast<dictionary&>(data().meshDict());
|
||||
|
||||
if (nSummed > 0)
|
||||
{
|
||||
scalar maxNonOrth = radToDeg(::acos(clamp(minDDotS, -1, 1)));
|
||||
scalar aveNonOrth = radToDeg(::acos(clamp(sumDDotS/nSummed, -1, 1)));
|
||||
|
||||
meshDict.set("maxNonOrth", maxNonOrth);
|
||||
meshDict.set("aveNonOrth", aveNonOrth);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -110,6 +110,15 @@ public:
|
||||
const FixedList<label, 3>& indices
|
||||
);
|
||||
|
||||
//- Copy construct from subset of points
|
||||
inline triPoints
|
||||
(
|
||||
const UList<point>& points,
|
||||
const label p0,
|
||||
const label p1,
|
||||
const label p2
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -275,7 +284,7 @@ public:
|
||||
//- Construct from three points
|
||||
inline triangle(const FixedList<Point, 3>& pts);
|
||||
|
||||
//- Construct from three points in the list of points
|
||||
//- Construct from three points out of the list of points
|
||||
// The indices could be from triFace etc.
|
||||
inline triangle
|
||||
(
|
||||
@ -283,6 +292,15 @@ public:
|
||||
const FixedList<label, 3>& indices
|
||||
);
|
||||
|
||||
//- Construct from three points out of the list of points
|
||||
inline triangle
|
||||
(
|
||||
const UList<Point>& points,
|
||||
const label p0,
|
||||
const label p1,
|
||||
const label p2
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
inline explicit triangle(Istream& is);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -69,6 +69,20 @@ inline Foam::triPoints::triPoints
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::triPoints::triPoints
|
||||
(
|
||||
const UList<point>& points,
|
||||
const label p0,
|
||||
const label p1,
|
||||
const label p2
|
||||
)
|
||||
{
|
||||
a() = points[p0];
|
||||
b() = points[p1];
|
||||
c() = points[p2];
|
||||
}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::triangle<Point, PointRef>::triangle
|
||||
(
|
||||
@ -108,6 +122,21 @@ inline Foam::triangle<Point, PointRef>::triangle
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::triangle<Point, PointRef>::triangle
|
||||
(
|
||||
const UList<Point>& points,
|
||||
const label p0,
|
||||
const label p1,
|
||||
const label p2
|
||||
)
|
||||
:
|
||||
a_(points[p0]),
|
||||
b_(points[p1]),
|
||||
c_(points[p2])
|
||||
{}
|
||||
|
||||
|
||||
template<class Point, class PointRef>
|
||||
inline Foam::triangle<Point, PointRef>::triangle(Istream& is)
|
||||
{
|
||||
|
||||
@ -290,7 +290,7 @@ Foam::globalIndex::bin
|
||||
if (!globalIds.empty())
|
||||
{
|
||||
labelList& binOffsets = bins.offsets();
|
||||
binOffsets.resize(offsets.size(), Zero);
|
||||
binOffsets.resize(offsets.size(), Foam::zero{});
|
||||
|
||||
labelList& binValues = bins.values();
|
||||
binValues = UIndirectList<label>(globalIds, order);
|
||||
@ -372,7 +372,7 @@ void Foam::globalIndex::reset
|
||||
// TBD: check for (proci >= 0) ?
|
||||
const auto proci = UPstream::myProcNo(comm);
|
||||
|
||||
counts.resize(len, Zero);
|
||||
counts.resize(len, Foam::zero{});
|
||||
counts[proci] = localSize;
|
||||
}
|
||||
|
||||
|
||||
@ -83,6 +83,14 @@ class globalIndex
|
||||
DynamicList<label>& validBins
|
||||
);
|
||||
|
||||
// Cannot use non-blocking for non-contiguous data.
|
||||
// template<class Type>
|
||||
// inline static UPstream::commsTypes getCommsType
|
||||
// (
|
||||
// const UPstream::commsTypes preferred
|
||||
// = UPstream::commsTypes::nonBlocking
|
||||
// );
|
||||
|
||||
//- Report overflow at specified (non-negative) index
|
||||
static void reportOverflowAndExit
|
||||
(
|
||||
@ -187,7 +195,7 @@ public:
|
||||
inline label length() const noexcept;
|
||||
|
||||
//- Global sum of localSizes. Same as totalSize()
|
||||
FOAM_DEPRECATED_STRICT(2022-10, "totalSize() - less ambiguous")
|
||||
FOAM_DEPRECATED_STRICT(2022-10, "totalSize() - unambiguous")
|
||||
inline label size() const;
|
||||
|
||||
//- The span size covered by the offsets, zero if empty
|
||||
@ -722,10 +730,11 @@ public:
|
||||
//- Inplace collect data in processor order on master
|
||||
//- (in serial: a no-op).
|
||||
// Communication with default/specified communicator, message tag.
|
||||
// After the gather, the field is zero-sized on the slaves.
|
||||
// After the gather, the field is zero-sized on non-master.
|
||||
template<class Type>
|
||||
void gatherInplace
|
||||
(
|
||||
//! [in,out]
|
||||
List<Type>& fld,
|
||||
const int tag = UPstream::msgType(),
|
||||
const UPstream::commsTypes = UPstream::commsTypes::nonBlocking,
|
||||
@ -737,12 +746,11 @@ public:
|
||||
// Communication with default/specified communicator.
|
||||
// \attention The nProcs for globalIndex and communicator
|
||||
// must match!!
|
||||
//
|
||||
// The allData is output (master), zero-sized on non-master
|
||||
template<class Type, class OutputContainer = List<Type>>
|
||||
void mpiGather
|
||||
(
|
||||
const UList<Type>& sendData,
|
||||
//! [out] output on master, zero-sized on non-master
|
||||
OutputContainer& allData,
|
||||
const label comm = UPstream::worldComm, //!< communicator
|
||||
|
||||
@ -780,6 +788,7 @@ public:
|
||||
template<class Type>
|
||||
void mpiGatherInplace
|
||||
(
|
||||
//! [in,out]
|
||||
List<Type>& fld,
|
||||
const label comm = UPstream::worldComm, //!< communicator
|
||||
|
||||
@ -833,6 +842,7 @@ public:
|
||||
template<class Type>
|
||||
static void mpiGatherInplaceOp
|
||||
(
|
||||
//! [in,out]
|
||||
List<Type>& fld,
|
||||
const label comm = UPstream::worldComm, //!< communicator
|
||||
|
||||
@ -844,12 +854,11 @@ public:
|
||||
//- Collect data in processor order on master
|
||||
//- (in serial: performs a simple copy).
|
||||
// Communication with default/specified communicator, message tag.
|
||||
//
|
||||
// The allFld is output (master), zero-sized on non-master
|
||||
template<class Type>
|
||||
static void gatherOp
|
||||
(
|
||||
const UList<Type>& sendData,
|
||||
//! [out] output on master, zero-sized on non-master
|
||||
List<Type>& allData,
|
||||
const int tag = UPstream::msgType(),
|
||||
const UPstream::commsTypes = UPstream::commsTypes::nonBlocking,
|
||||
@ -859,12 +868,11 @@ public:
|
||||
//- Collect data in processor order on master
|
||||
//- (in serial: performs a simple copy).
|
||||
// Communication with default/specified communicator, message tag.
|
||||
//
|
||||
// The allFld is output (master), zero-sized on non-master
|
||||
template<class Type, class Addr>
|
||||
static void gatherOp
|
||||
(
|
||||
const IndirectListBase<Type, Addr>& sendData,
|
||||
//! [out] output on master, zero-sized on non-master
|
||||
List<Type>& allData,
|
||||
const int tag = UPstream::msgType(),
|
||||
const UPstream::commsTypes = UPstream::commsTypes::nonBlocking,
|
||||
@ -903,10 +911,11 @@ public:
|
||||
//- (in serial: a no-op).
|
||||
// Communication with default/specified communicator, message tag.
|
||||
//
|
||||
// After the gather, the field is zero-sized on the slaves.
|
||||
// After the gather, the field is zero-sized on non-master.
|
||||
template<class Type>
|
||||
static void gatherInplaceOp
|
||||
(
|
||||
//! [in,out]
|
||||
List<Type>& fld,
|
||||
const int tag = UPstream::msgType(),
|
||||
const UPstream::commsTypes = UPstream::commsTypes::nonBlocking,
|
||||
|
||||
@ -30,6 +30,25 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
// Cannot use non-blocking for non-contiguous data.
|
||||
// template<class Type>
|
||||
// inline Foam::UPstream::commsTypes getCommsType
|
||||
// (
|
||||
// const UPstream::commsTypes preferred
|
||||
// )
|
||||
// {
|
||||
// return
|
||||
// (
|
||||
// (
|
||||
// !is_contiguous<Type>::value
|
||||
// && UPstream::commsTypes::nonBlocking == preferred
|
||||
// )
|
||||
// ? UPstream::commsTypes::scheduled
|
||||
// : preferred
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
template<class Addr>
|
||||
Foam::labelList
|
||||
Foam::globalIndex::calcOffsets
|
||||
@ -115,8 +134,7 @@ void Foam::globalIndex::gatherValues
|
||||
{
|
||||
// low-level: no parRun guard
|
||||
|
||||
// Automatically change from nonBlocking to scheduled for
|
||||
// non-contiguous data.
|
||||
// Cannot use non-blocking for non-contiguous data.
|
||||
const UPstream::commsTypes commsType =
|
||||
(
|
||||
(
|
||||
@ -202,8 +220,7 @@ void Foam::globalIndex::gather
|
||||
{
|
||||
// low-level: no parRun guard
|
||||
|
||||
// Automatically change from nonBlocking to scheduled for
|
||||
// non-contiguous data.
|
||||
// Cannot use non-blocking for non-contiguous data.
|
||||
const UPstream::commsTypes commsType =
|
||||
(
|
||||
(
|
||||
@ -322,8 +339,7 @@ void Foam::globalIndex::gather
|
||||
return;
|
||||
}
|
||||
|
||||
// Automatically change from nonBlocking to scheduled for
|
||||
// non-contiguous data.
|
||||
// Cannot use non-blocking for non-contiguous data.
|
||||
const UPstream::commsTypes commsType =
|
||||
(
|
||||
(
|
||||
@ -907,8 +923,7 @@ void Foam::globalIndex::scatter
|
||||
{
|
||||
// low-level: no parRun guard
|
||||
|
||||
// Automatically change from nonBlocking to scheduled for
|
||||
// non-contiguous data.
|
||||
// Cannot use non-blocking for non-contiguous data.
|
||||
const UPstream::commsTypes commsType =
|
||||
(
|
||||
(
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -158,7 +158,7 @@ extern const NullObject* nullObjectPtr;
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
//- Read from Istream consumes no content
|
||||
//- Read from Istream consumes no content, does not change NullObject
|
||||
inline Istream& operator>>(Istream& is, const NullObject&) noexcept
|
||||
{
|
||||
return is;
|
||||
@ -173,31 +173,48 @@ inline Ostream& operator<<(Ostream& os, const NullObject&) noexcept
|
||||
|
||||
// Global Functions
|
||||
|
||||
//- Pointer (of type T) to the nullObject
|
||||
//- Const pointer (of type T) to the nullObject
|
||||
template<class T>
|
||||
inline const T* NullObjectPtr()
|
||||
inline const T* NullObjectPtr() noexcept
|
||||
{
|
||||
return reinterpret_cast<const T*>(nullObjectPtr);
|
||||
}
|
||||
|
||||
//- Reference (of type T) to the nullObject
|
||||
//- Non-const pointer (of type T) to the nullObject.
|
||||
//- Only use when nothing will be written into it!
|
||||
template<class T>
|
||||
inline const T& NullObjectRef()
|
||||
inline T* NullObjectPtr_constCast() noexcept
|
||||
{
|
||||
return reinterpret_cast<T*>(const_cast<NullObject*>(nullObjectPtr));
|
||||
}
|
||||
|
||||
|
||||
//- Const reference (of type T) to the nullObject
|
||||
template<class T>
|
||||
inline const T& NullObjectRef() noexcept
|
||||
{
|
||||
return *reinterpret_cast<const T*>(nullObjectPtr);
|
||||
}
|
||||
|
||||
//- Non-const reference (of type T) to the nullObject
|
||||
//- Only use when nothing will be written into it!
|
||||
template<class T>
|
||||
inline T& NullObjectRef_constCast() noexcept
|
||||
{
|
||||
return *reinterpret_cast<T*>(const_cast<NullObject*>(nullObjectPtr));
|
||||
}
|
||||
|
||||
|
||||
//- True if ptr is a pointer (of type T) to the nullObject
|
||||
template<class T>
|
||||
inline bool isNull(const T* ptr)
|
||||
inline bool isNull(const T* ptr) noexcept
|
||||
{
|
||||
return ptr == NullObjectPtr<T>();
|
||||
}
|
||||
|
||||
//- True if obj is a reference (of type T) to the nullObject
|
||||
template<class T>
|
||||
inline bool isNull(const T& obj)
|
||||
inline bool isNull(const T& obj) noexcept
|
||||
{
|
||||
return &obj == NullObjectPtr<T>();
|
||||
}
|
||||
@ -205,14 +222,14 @@ inline bool isNull(const T& obj)
|
||||
|
||||
//- True if ptr is not a pointer (of type T) to the nullObject
|
||||
template<class T>
|
||||
inline bool notNull(const T* ptr)
|
||||
inline bool notNull(const T* ptr) noexcept
|
||||
{
|
||||
return ptr != NullObjectPtr<T>();
|
||||
}
|
||||
|
||||
//- True if obj is not a reference (of type T) to the nullObject
|
||||
template<class T>
|
||||
inline bool notNull(const T& obj)
|
||||
inline bool notNull(const T& obj) noexcept
|
||||
{
|
||||
return &obj != NullObjectPtr<T>();
|
||||
}
|
||||
|
||||
@ -86,8 +86,12 @@ public:
|
||||
|
||||
// Static Data / Methods
|
||||
|
||||
//- Return a null wordRes - a reference to the NullObject
|
||||
inline static const wordRes& null();
|
||||
//- Return a null wordRes (reference to a nullObject).
|
||||
//- Behaves like a empty wordRes.
|
||||
static const wordRes& null() noexcept
|
||||
{
|
||||
return NullObjectRef<wordRes>();
|
||||
}
|
||||
|
||||
//- Return a wordRes with duplicate entries filtered out.
|
||||
// No distinction made between literals and regular expressions.
|
||||
|
||||
@ -27,12 +27,6 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::wordRes& Foam::wordRes::null()
|
||||
{
|
||||
return NullObjectRef<wordRes>();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::wordRes::first_match
|
||||
(
|
||||
const UList<wordRe>& selectors,
|
||||
|
||||
@ -22,6 +22,7 @@ $(polyMeshModifier)/polyMeshModifier.C
|
||||
$(polyMeshModifier)/polyMeshModifierNew.C
|
||||
|
||||
polyTopoChange/polyTopoChanger/polyTopoChanger.C
|
||||
polyTopoChange/polyTopoChanger/polyTopoChangerChangeMesh.C
|
||||
polyTopoChange/polyTopoChange/addPatchCellLayer.C
|
||||
polyTopoChange/polyTopoChange/pointEdgeCollapse/pointEdgeCollapse.C
|
||||
polyTopoChange/polyTopoChange/edgeCollapser.C
|
||||
@ -76,6 +77,10 @@ meshCut/refineCell/refineCell.C
|
||||
meshCut/wallLayerCells/wallLayerCells.C
|
||||
meshCut/wallLayerCells/wallNormalInfo/wallNormalInfo.C
|
||||
|
||||
refinement/refinement/refinement.C
|
||||
refinement/polyhedralRefinement/polyhedralRefinement.C
|
||||
refinement/prismatic2DRefinement/prismatic2DRefinement.C
|
||||
|
||||
polyTopoChange/attachPolyTopoChanger/attachPolyTopoChanger.C
|
||||
polyTopoChange/repatchPolyTopoChanger/repatchPolyTopoChanger.C
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ License
|
||||
#include "polyMesh.H"
|
||||
#include "Time.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "batchPolyTopoChange.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -365,7 +365,7 @@ bool Foam::attachDetach::changeTopology() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::attachDetach::setRefinement(polyTopoChange& ref) const
|
||||
void Foam::attachDetach::setRefinement(batchPolyTopoChange& ref) const
|
||||
{
|
||||
// Insert the attach/detach instructions into the topological change
|
||||
|
||||
|
||||
@ -122,10 +122,10 @@ class attachDetach
|
||||
// Topological changes
|
||||
|
||||
//- Attach interface
|
||||
void attachInterface(polyTopoChange&) const;
|
||||
void attachInterface(batchPolyTopoChange&) const;
|
||||
|
||||
//- Detach interface
|
||||
void detachInterface(polyTopoChange&) const;
|
||||
void detachInterface(batchPolyTopoChange&) const;
|
||||
|
||||
//- Calculate point match addressing
|
||||
void calcPointMatchMap() const;
|
||||
@ -215,7 +215,7 @@ public:
|
||||
|
||||
//- Insert the layer addition/removal instructions
|
||||
// into the topological change
|
||||
virtual void setRefinement(polyTopoChange&) const;
|
||||
virtual void setRefinement(batchPolyTopoChange&) const;
|
||||
|
||||
//- Modify motion points to comply with the topological change
|
||||
virtual void modifyMotionPoints(pointField& motionPoints) const;
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "attachDetach.H"
|
||||
#include "polyMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "batchPolyTopoChange.H"
|
||||
#include "polyTopoChanger.H"
|
||||
#include "polyRemovePoint.H"
|
||||
#include "polyRemoveFace.H"
|
||||
@ -43,7 +43,7 @@ const Foam::scalar Foam::attachDetach::positionDifference_ = 1e-8;
|
||||
|
||||
void Foam::attachDetach::attachInterface
|
||||
(
|
||||
polyTopoChange& ref
|
||||
batchPolyTopoChange& ref
|
||||
) const
|
||||
{
|
||||
// Algorithm:
|
||||
@ -62,7 +62,7 @@ void Foam::attachDetach::attachInterface
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void attachDetach::attachInterface("
|
||||
<< "polyTopoChange& ref) const "
|
||||
<< "batchPolyTopoChange& ref) const "
|
||||
<< " for object " << name() << " : "
|
||||
<< "Attaching interface" << endl;
|
||||
}
|
||||
@ -266,7 +266,7 @@ void Foam::attachDetach::attachInterface
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void attachDetach::attachInterface("
|
||||
<< "polyTopoChange& ref) const "
|
||||
<< "batchPolyTopoChange& ref) const "
|
||||
<< " for object " << name() << " : "
|
||||
<< "Finished attaching interface" << endl;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ License
|
||||
#include "attachDetach.H"
|
||||
#include "polyMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "batchPolyTopoChange.H"
|
||||
#include "polyTopoChanger.H"
|
||||
#include "polyAddPoint.H"
|
||||
#include "polyModifyFace.H"
|
||||
@ -38,7 +38,7 @@ License
|
||||
|
||||
void Foam::attachDetach::detachInterface
|
||||
(
|
||||
polyTopoChange& ref
|
||||
batchPolyTopoChange& ref
|
||||
) const
|
||||
{
|
||||
// Algorithm:
|
||||
@ -66,7 +66,7 @@ void Foam::attachDetach::detachInterface
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void attachDetach::detachInterface("
|
||||
<< "polyTopoChange& ref) const "
|
||||
<< "batchPolyTopoChange& ref) const "
|
||||
<< " for object " << name() << " : "
|
||||
<< "Detaching interface" << endl;
|
||||
}
|
||||
@ -75,7 +75,7 @@ void Foam::attachDetach::detachInterface
|
||||
const faceZoneMesh& zoneMesh = mesh.faceZones();
|
||||
|
||||
// Check that zone is in increasing order (needed since adding faces
|
||||
// in same order - otherwise polyTopoChange face ordering will mess up
|
||||
// in same order - otherwise batchPolyTopoChange face ordering will mess up
|
||||
// correspondence)
|
||||
if (debug)
|
||||
{
|
||||
@ -467,7 +467,7 @@ void Foam::attachDetach::detachInterface
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void attachDetach::detachInterface("
|
||||
<< "polyTopoChange& ref) const "
|
||||
<< "batchPolyTopoChange& ref) const "
|
||||
<< " for object " << name() << " : "
|
||||
<< "Finished detaching interface" << endl;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "layerAdditionRemoval.H"
|
||||
#include "polyMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "batchPolyTopoChange.H"
|
||||
#include "polyTopoChanger.H"
|
||||
#include "polyAddPoint.H"
|
||||
#include "polyAddCell.H"
|
||||
@ -88,7 +88,7 @@ Foam::tmp<Foam::vectorField> Foam::layerAdditionRemoval::extrusionDir() const
|
||||
|
||||
void Foam::layerAdditionRemoval::addCellLayer
|
||||
(
|
||||
polyTopoChange& ref
|
||||
batchPolyTopoChange& ref
|
||||
) const
|
||||
{
|
||||
// Insert the layer addition instructions into the topological change
|
||||
@ -108,7 +108,7 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void layerAdditionRemoval::addCellLayer("
|
||||
<< "polyTopoChange& ref) const for object " << name() << " : "
|
||||
<< "batchPolyTopoChange& ref) const for object " << name() << " : "
|
||||
<< "Adding cell layer" << endl;
|
||||
}
|
||||
|
||||
@ -682,7 +682,7 @@ void Foam::layerAdditionRemoval::addCellLayer
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "void layerAdditionRemoval::addCellLayer(polyTopoChange&) const "
|
||||
Pout<< "void layerAdditionRemoval::addCellLayer(batchPolyTopoChange&) const "
|
||||
<< " for object " << name() << ": "
|
||||
<< "Finished adding cell layer" << endl;
|
||||
}
|
||||
|
||||
@ -355,7 +355,7 @@ bool Foam::layerAdditionRemoval::changeTopology() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::layerAdditionRemoval::setRefinement(polyTopoChange& ref) const
|
||||
void Foam::layerAdditionRemoval::setRefinement(batchPolyTopoChange& ref) const
|
||||
{
|
||||
// Insert the layer addition/removal instructions
|
||||
// into the topological change
|
||||
@ -367,7 +367,7 @@ void Foam::layerAdditionRemoval::setRefinement(polyTopoChange& ref) const
|
||||
// Clear addressing. This also resets the addition/removal data
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "layerAdditionRemoval::setRefinement(polyTopoChange&) "
|
||||
Pout<< "layerAdditionRemoval::setRefinement(batchPolyTopoChange&) "
|
||||
<< "for object " << name() << " : "
|
||||
<< "Clearing addressing after layer removal" << endl;
|
||||
}
|
||||
@ -383,7 +383,7 @@ void Foam::layerAdditionRemoval::setRefinement(polyTopoChange& ref) const
|
||||
// Clear addressing. This also resets the addition/removal data
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "layerAdditionRemoval::setRefinement(polyTopoChange&) "
|
||||
Pout<< "layerAdditionRemoval::setRefinement(batchPolyTopoChange&) "
|
||||
<< "for object " << name() << " : "
|
||||
<< "Clearing addressing after layer addition" << endl;
|
||||
}
|
||||
|
||||
@ -119,10 +119,10 @@ class layerAdditionRemoval
|
||||
tmp<vectorField> extrusionDir() const;
|
||||
|
||||
//- Add a layer of cells
|
||||
void addCellLayer(polyTopoChange&) const;
|
||||
void addCellLayer(batchPolyTopoChange&) const;
|
||||
|
||||
//- Remove a layer of cells
|
||||
void removeCellLayer(polyTopoChange&) const;
|
||||
void removeCellLayer(batchPolyTopoChange&) const;
|
||||
|
||||
//- Clear addressing
|
||||
void clearAddressing() const;
|
||||
@ -179,7 +179,7 @@ public:
|
||||
|
||||
//- Insert the layer addition/removal instructions
|
||||
// into the topological change
|
||||
virtual void setRefinement(polyTopoChange&) const;
|
||||
virtual void setRefinement(batchPolyTopoChange&) const;
|
||||
|
||||
//- Modify motion points to comply with the topological change
|
||||
virtual void modifyMotionPoints(pointField& motionPoints) const;
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "layerAdditionRemoval.H"
|
||||
#include "polyMesh.H"
|
||||
#include "primitiveMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "batchPolyTopoChange.H"
|
||||
#include "oppositeFace.H"
|
||||
#include "polyTopoChanger.H"
|
||||
#include "polyRemoveCell.H"
|
||||
@ -83,7 +83,7 @@ bool Foam::layerAdditionRemoval::validCollapse() const
|
||||
|
||||
void Foam::layerAdditionRemoval::removeCellLayer
|
||||
(
|
||||
polyTopoChange& ref
|
||||
batchPolyTopoChange& ref
|
||||
) const
|
||||
{
|
||||
// Algorithm for layer removal. Second phase: topological change
|
||||
|
||||
@ -33,7 +33,7 @@ Description
|
||||
#include "perfectInterface.H"
|
||||
#include "polyTopoChanger.H"
|
||||
#include "polyMesh.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "batchPolyTopoChange.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "matchPoints.H"
|
||||
@ -154,7 +154,7 @@ void Foam::perfectInterface::setRefinement
|
||||
(
|
||||
const indirectPrimitivePatch& pp0,
|
||||
const indirectPrimitivePatch& pp1,
|
||||
polyTopoChange& ref
|
||||
batchPolyTopoChange& ref
|
||||
) const
|
||||
{
|
||||
const polyMesh& mesh = topoChanger().mesh();
|
||||
@ -423,11 +423,11 @@ void Foam::perfectInterface::setRefinement
|
||||
}
|
||||
|
||||
|
||||
void Foam::perfectInterface::setRefinement(polyTopoChange& ref) const
|
||||
void Foam::perfectInterface::setRefinement(batchPolyTopoChange& ref) const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "bool perfectInterface::setRefinement(polyTopoChange&) const : "
|
||||
Pout<< "bool perfectInterface::setRefinement(batchPolyTopoChange&) const : "
|
||||
<< "for object " << name() << " : "
|
||||
<< "masterPatchID_:" << masterPatchID_
|
||||
<< " slavePatchID_:" << slavePatchID_
|
||||
|
||||
@ -129,7 +129,7 @@ public:
|
||||
|
||||
//- Insert the layer addition/removal instructions
|
||||
// into the topological change
|
||||
virtual void setRefinement(polyTopoChange&) const;
|
||||
virtual void setRefinement(batchPolyTopoChange&) const;
|
||||
|
||||
//- Insert the layer addition/removal instructions
|
||||
// into the topological change. Uses only mesh, not any of the
|
||||
@ -139,7 +139,7 @@ public:
|
||||
(
|
||||
const indirectPrimitivePatch& pp0,
|
||||
const indirectPrimitivePatch& pp1,
|
||||
polyTopoChange&
|
||||
batchPolyTopoChange&
|
||||
) const;
|
||||
|
||||
//- Modify motion points to comply with the topological change
|
||||
|
||||
@ -65,7 +65,10 @@ void Foam::attachPolyTopoChanger::attach(const bool removeEmptyPatches)
|
||||
const fileName oldInst = mesh_.facesInstance();
|
||||
|
||||
// Execute all polyMeshModifiers
|
||||
changeMesh(false); // no inflation
|
||||
// DISABLED - this functionality is lost
|
||||
// Bad rewrite by Mattijs Janssens - completely misunderstood the interface
|
||||
// Needs to use polyTopoChange, and not changer.
|
||||
// changeMesh(false); // no inflation
|
||||
|
||||
const pointField p = mesh_.oldPoints();
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ namespace Foam
|
||||
|
||||
// Forward Declarations
|
||||
class polyTopoChanger;
|
||||
class polyTopoChange;
|
||||
class batchPolyTopoChange;
|
||||
class mapPolyMesh;
|
||||
class polyMeshModifier;
|
||||
|
||||
@ -166,7 +166,7 @@ public:
|
||||
virtual bool changeTopology() const = 0;
|
||||
|
||||
//- Insert the topological change instructions
|
||||
virtual void setRefinement(polyTopoChange&) const = 0;
|
||||
virtual void setRefinement(batchPolyTopoChange&) const = 0;
|
||||
|
||||
//- Modify motion points to comply with the topological change
|
||||
virtual void modifyMotionPoints(pointField& motionPoints) const = 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -86,6 +86,19 @@ class removeFaces
|
||||
labelList& cellRegion
|
||||
) const;
|
||||
|
||||
//- Changes region of connected set of faces. Returns number of changed
|
||||
// faces. For use with batch topo change
|
||||
label changeFaceRegion
|
||||
(
|
||||
const labelList& cellRegion,
|
||||
const boolList& removedFace,
|
||||
const labelList& nFacesPerEdge,
|
||||
const label faceI,
|
||||
const label newRegion,
|
||||
|
||||
labelList& faceRegion
|
||||
) const;
|
||||
|
||||
//- Changes region of connected set of faces
|
||||
label changeFaceRegion
|
||||
(
|
||||
@ -119,13 +132,15 @@ class removeFaces
|
||||
);
|
||||
|
||||
//- Merge faceLabels into single face.
|
||||
template<class TopoChangeEngine>
|
||||
void mergeFaces
|
||||
(
|
||||
const labelList& cellRegion,
|
||||
const labelList& cellRegionMaster,
|
||||
const labelHashSet& pointsToRemove,
|
||||
const labelList& faceLabels,
|
||||
polyTopoChange& meshMod
|
||||
|
||||
TopoChangeEngine& meshMod
|
||||
) const;
|
||||
|
||||
//- Get patch, zone info for facei
|
||||
@ -141,6 +156,7 @@ class removeFaces
|
||||
face filterFace(const labelHashSet&, const label) const;
|
||||
|
||||
//- Wrapper for meshMod.modifyFace. Reverses face if own>nei.
|
||||
template<class TopoChangeEngine>
|
||||
void modFace
|
||||
(
|
||||
const face& f,
|
||||
@ -153,11 +169,10 @@ class removeFaces
|
||||
const label zoneID,
|
||||
const bool zoneFlip,
|
||||
|
||||
polyTopoChange& meshMod
|
||||
TopoChangeEngine& meshMod
|
||||
) const;
|
||||
|
||||
|
||||
|
||||
//- No copy construct
|
||||
removeFaces(const removeFaces&) = delete;
|
||||
|
||||
@ -199,12 +214,15 @@ public:
|
||||
|
||||
|
||||
//- Play commands into polyTopoChange to remove faces.
|
||||
template<class TopoChangeEngine>
|
||||
void setRefinement
|
||||
(
|
||||
const labelList& piercedFaces,
|
||||
const labelList& cellRegion,
|
||||
const labelList& cellRegionMaster,
|
||||
polyTopoChange&
|
||||
// const labelList& pointRegionMaster,
|
||||
labelList& cellRegionMaster,
|
||||
|
||||
TopoChangeEngine&
|
||||
) const;
|
||||
|
||||
//- Force recalculation of locally stored data on topological change
|
||||
@ -221,6 +239,10 @@ public:
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "removeFacesTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
1112
src/dynamicMesh/polyTopoChange/polyTopoChange/removeFacesTemplates.C
Normal file
1112
src/dynamicMesh/polyTopoChange/polyTopoChange/removeFacesTemplates.C
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user