Compare commits

..

1 Commits

Author SHA1 Message Date
00e2d3e4ef WIP: mapped PstreamBuffers with NBX
ENH: sparse storage and data exchange for PstreamBuffers

- change the underlying storage from a numProcs list of buffers to a
  Map of buffers. The reduced memory footprint on large systems is
  on aspect but the primary motivation is to more easily support
  sparse data exchange patterns.
  The Map storage for PstreamBuffers corresponds to a non-blocking
  consensus exchange of sizes that automatically propagates through
  different parts of the code and avoids all-to-all.

CONFIG: enable nonBlockingExchange as default (for testing)

- this changes the Pstream::exchangeSizes to use NBX instead of
  all-to-all, even for List containers.
2023-03-02 12:49:20 +01:00
747 changed files with 3733 additions and 5526 deletions

View File

@ -109,7 +109,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh,
dimensionedScalar(Nv.dimensions(), Zero)

View File

@ -12,7 +12,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh,
dimensionedScalar("Ydefault", dimless, 1)
@ -29,7 +29,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh,
dimensionedScalar("p", dimPressure, p0)
@ -46,7 +46,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh,
dimensionedScalar("T", dimTemperature, T0)

View File

@ -103,7 +103,14 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
<< exit(FatalIOError);
}
if (!this->readValueEntry(dict))
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
scalarField("value", dict, p.size())
);
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
}

View File

@ -105,15 +105,18 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
<< exit(FatalIOError);
}
if (this->readValueEntry(dict))
if (dict.found("value"))
{
const auto* hasRefValue = dict.findEntry("refValue", keyType::LITERAL);
const auto* hasFrac = dict.findEntry("valueFraction", keyType::LITERAL);
fvPatchField<vector>::operator=
(
vectorField("value", dict, p.size())
);
if (hasRefValue && hasFrac)
if (dict.found("refValue") && dict.found("valueFraction"))
{
this->refValue().assign(*hasRefValue, p.size());
this->valueFraction().assign(*hasFrac, p.size());
this->refValue() = vectorField("refValue", dict, p.size());
this->valueFraction() =
scalarField("valueFraction", dict, p.size());
}
else
{

View File

@ -243,12 +243,14 @@ turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
<< exit(FatalError);
}
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ);
if (this->readMixedEntries(dict))
if (dict.found("refValue"))
{
// Full restart
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
}
else
{

View File

@ -44,7 +44,7 @@ IOobject turbulencePropertiesHeader
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(false))

View File

@ -9,7 +9,7 @@ IOobject io
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (io.typeHeaderOk<IOdictionary>())
@ -32,4 +32,4 @@ if (io.typeHeaderOk<IOdictionary>())
);
}
// ************************************************************************* //

View File

@ -84,7 +84,7 @@ Foam::surfaceTensionModels::liquidProperties::sigma() const
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh_,
dimSigma

View File

@ -724,7 +724,7 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::laserDTRM::Rp() const
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh_,
dimensionedScalar(dimPower/dimVolume/pow4(dimTemperature), Zero)

View File

@ -97,7 +97,7 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh_,
dimensionedScalar(inv(dimLength), Zero)
@ -130,7 +130,7 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh_,
dimensionedScalar(inv(dimLength), Zero)
@ -163,7 +163,7 @@ Foam::radiation::localDensityAbsorptionEmission::ECont(const label bandI) const
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)

View File

@ -46,7 +46,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // Do not register
)
);

View File

@ -30,7 +30,7 @@
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh,
dimless,

View File

@ -48,7 +48,7 @@ Foam::phaseChangeTwoPhaseMixture::New
U.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // Do not register
)
);

View File

@ -69,7 +69,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
size
);
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
@ -125,7 +125,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
size
);
@ -157,7 +157,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -46,39 +46,35 @@ using namespace Foam;
template<class Type>
void doWrite(const IOobject& io, const label sz)
{
const bool writeOnProc = (sz > 0);
IOField<Type> fld(io, sz);
forAll(fld, i)
{
fld[i] = i + 1000.25 + (0.25 * i);
}
Pout<< "writing:" << fld << endl;
fld.write(writeOnProc);
fld.write(sz > 0);
}
template<>
void doWrite<bool>(const IOobject& io, const label sz)
{
const bool writeOnProc = (sz > 0);
IOField<bool> fld(io, sz);
forAll(fld, i)
{
fld[i] = i % 2;
}
Pout<< "writing:" << fld << endl;
fld.write(writeOnProc);
fld.write(sz > 0);
}
template<class Type>
void doRead(const IOobject& io, const label sz)
{
const bool readOnProc = (sz > 0);
Pout<< " readOnProc:" << readOnProc << endl;
IOField<Type> fld(io, readOnProc);
bool valid = (sz > 0);
Pout<< " valid:" << valid << endl;
IOField<Type> fld(io, valid);
Pout<< " wanted:" << sz << " actually read:" << fld.size() << endl;
if (fld.size() != sz)

View File

@ -92,8 +92,8 @@ int main(int argc, char *argv[])
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedVector(Zero)

View File

@ -143,7 +143,7 @@ int main(int argc, char *argv[])
{
#include "setRootCase.H"
treeBoundBox bb(zero_one{});
treeBoundBox bb(cube(0, 1));
treeBoundBox sub(cube(0.1, 0.8));
Info<< nl

View File

@ -103,7 +103,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -67,7 +67,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -116,7 +116,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022-2023 OpenCFD Ltd.
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -51,7 +51,7 @@ void printInfo(const label comm)
<< " sub:" << UPstream::subProcs(comm) << nl;
if (UPstream::commSelf() == comm)
if (UPstream::selfComm == comm)
{
Pout<< "self all:" << UPstream::allProcs(comm)
<< " sub:" << UPstream::subProcs(comm) << nl;
@ -86,32 +86,32 @@ int main(int argc, char *argv[])
<< "nProcs = " << UPstream::nProcs()
<< " with " << UPstream::nComms() << " predefined comm(s)" << nl;
Info<< "comm-world : ";
printInfo(UPstream::commWorld());
Info<< "worldComm : ";
printInfo(UPstream::worldComm);
Info<< "comm-self : ";
printInfo(UPstream::commSelf());
Info<< "selfComm : ";
printInfo(UPstream::selfComm);
Info<< nl;
// Reductions (using MPI intrinsics)
{
label val = Pstream::myProcNo(UPstream::commWorld());
label val = Pstream::myProcNo(UPstream::worldComm);
label worldVal = returnReduce
(
val,
sumOp<label>(),
UPstream::msgType(),
UPstream::commWorld()
Pstream::msgType(),
UPstream::worldComm
);
label selfVal = returnReduce
(
val,
sumOp<label>(),
UPstream::msgType(),
UPstream::commSelf()
Pstream::msgType(),
UPstream::selfComm
);
Pout<< "value " << val
@ -123,8 +123,8 @@ int main(int argc, char *argv[])
{
Pair<label> val
(
Pstream::myProcNo(UPstream::commWorld()),
Pstream::myProcNo(UPstream::commWorld())
Pstream::myProcNo(UPstream::worldComm),
Pstream::myProcNo(UPstream::worldComm)
);
Pair<label> worldVal = val;
@ -133,8 +133,8 @@ int main(int argc, char *argv[])
(
worldVal,
minFirstEqOp<label>(),
UPstream::msgType(),
UPstream::commWorld()
Pstream::msgType(),
UPstream::worldComm
);
Pair<label> selfVal = val;
@ -143,8 +143,8 @@ int main(int argc, char *argv[])
(
worldVal,
minFirstEqOp<label>(),
UPstream::msgType(),
UPstream::commSelf()
Pstream::msgType(),
UPstream::selfComm
);
Pout<< "value " << val

View File

@ -150,7 +150,11 @@ int main(int argc, char *argv[])
Pout<< "localValue :" << localValue << endl;
label comm = UPstream::allocateCommunicator(UPstream::worldComm, top);
label comm = Pstream::allocateCommunicator
(
UPstream::worldComm,
top
);
Pout<< "allocated comm :" << comm << endl;
Pout<< "comm myproc :" << Pstream::myProcNo(comm)
@ -169,7 +173,7 @@ int main(int argc, char *argv[])
Pout<< "sum :" << sum << endl;
}
UPstream::freeCommunicator(comm);
Pstream::freeCommunicator(comm);
Pout<< "End\n" << endl;

View File

@ -88,12 +88,12 @@ int main(int argc, char *argv[])
//- Process IDs within a given communicator
Info<< "procIDs: "
<< flatOutput(UPstream::procID(UPstream::commWorld())) << endl;
<< flatOutput(UPstream::procID(UPstream::worldComm)) << endl;
rankInfo(UPstream::commWorld());
rankInfo(UPstream::worldComm);
Pout<< endl;
const int myProci = UPstream::myProcNo(UPstream::commWorld());
const int myProci = UPstream::myProcNo(UPstream::worldComm);
int localRanki = myProci;
labelList subRanks;
@ -101,9 +101,9 @@ int main(int argc, char *argv[])
#if 1
// With first ranks
subRanks = identity(UPstream::nProcs(UPstream::commWorld()) / 2);
subRanks = identity(UPstream::nProcs(UPstream::worldComm) / 2);
newComm.reset(UPstream::commWorld(), subRanks);
newComm.reset(UPstream::worldComm, subRanks);
localRanki = UPstream::myProcNo(newComm);
Pout.prefix() =
@ -120,14 +120,14 @@ int main(int argc, char *argv[])
#if 1
// With every other rank
subRanks = identity(UPstream::nProcs(UPstream::commWorld()));
subRanks = identity(UPstream::nProcs(UPstream::worldComm));
for (label& val : subRanks)
{
if (val % 2) val = -1;
}
newComm.reset(UPstream::commWorld(), subRanks);
newComm.reset(UPstream::worldComm, subRanks);
localRanki = UPstream::myProcNo(newComm);
Pout.prefix() =
@ -165,19 +165,19 @@ int main(int argc, char *argv[])
}
if (Pstream::parRun() && args.found("host-comm"))
{
// Host communicator, based on the current world communicator
// Host communicator, based on the current worldComm
// Use hostname
// Lowest rank per hostname is the IO rank
label numprocs = UPstream::nProcs(UPstream::commGlobal());
label numprocs = UPstream::nProcs(UPstream::globalComm);
stringList hosts(numprocs);
hosts[Pstream::myProcNo(UPstream::commGlobal())] = hostName();
hosts[Pstream::myProcNo(UPstream::globalComm)] = hostName();
labelList hostIDs_;
// Compact
if (Pstream::master(UPstream::commGlobal()))
if (Pstream::master(UPstream::globalComm))
{
DynamicList<word> hostNames(numprocs);
hostIDs_.resize_nocopy(numprocs);
@ -196,10 +196,10 @@ int main(int argc, char *argv[])
}
}
Pstream::broadcasts(UPstream::commGlobal(), hostIDs_);
Pstream::broadcasts(UPstream::globalComm, hostIDs_);
const label myHostId =
hostIDs_[Pstream::myProcNo(UPstream::commGlobal())];
hostIDs_[Pstream::myProcNo(UPstream::globalComm)];
DynamicList<label> subRanks;
forAll(hostIDs_, proci)
@ -210,11 +210,11 @@ int main(int argc, char *argv[])
}
}
// Allocate new communicator with global communicator as its parent
// Allocate new communicator with globalComm as its parent
const label hostComm =
UPstream::allocateCommunicator
(
UPstream::commGlobal(),
UPstream::globalComm, // parent
subRanks,
true
);

View File

@ -1,3 +0,0 @@
Test-polyMeshGeom-speed1.C
EXE = $(FOAM_USER_APPBIN)/Test-polyMeshGeom-speed1

View File

@ -1,5 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/mesh/blockMesh/lnInclude
EXE_LIBS = \
-lblockMesh

View File

@ -1,804 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 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/>.
Description
Simple timing tests for some polyMesh primitives
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "clockTime.H"
#include "Time.H"
#include "PDRblock.H"
#include "polyMesh.H"
#include "ListOps.H"
using namespace Foam;
void printAlloc(const polyMesh& mesh)
{
Info<< "memory"
<< " hasCellPoints:" << mesh.hasCellPoints()
<< " hasPointCells:" << mesh.hasPointCells() << endl;
}
void printInfo(const polyMesh& mesh)
{
Info<< "polyMesh"
<< " nPoints:" << mesh.nPoints()
<< " nInternalFaces:" << mesh.nInternalFaces()
<< " nFaces:" << mesh.nFaces()
<< " nCells:" << mesh.nCells() << endl;
}
// How point cells are calculated in OpenFOAM-v2212 and earlier
autoPtr<labelListList> pointCells_2212(const polyMesh& mesh)
{
const cellList& cf = mesh.cells();
// Count number of cells per point
labelList npc(mesh.nPoints(), Zero);
forAll(cf, celli)
{
const labelList curPoints = cf[celli].labels(mesh.faces());
for (const label pointi : curPoints)
{
++npc[pointi];
}
}
// Size and fill cells per point
auto pcPtr_ = autoPtr<labelListList>::New(npc.size());
labelListList& pointCellAddr = *pcPtr_;
forAll(pointCellAddr, pointi)
{
pointCellAddr[pointi].setSize(npc[pointi]);
npc[pointi] = 0;
}
forAll(cf, celli)
{
const labelList curPoints = cf[celli].labels(mesh.faces());
for (const label pointi : curPoints)
{
pointCellAddr[pointi][npc[pointi]++] = celli;
}
}
return pcPtr_;
}
// Line cell::labels but with persistent storage
void cell_labels
(
const cell& cFaces,
const faceUList& meshFaces,
DynamicList<label>& pointLabels
)
{
// const labelList& cFaces = *this;
label nVerts = 0;
for (const label facei : cFaces)
{
nVerts += meshFaces[facei].size();
}
// pointLabels.clear();
pointLabels.expandStorage();
// The first face has no duplicates, can copy in values
const labelList& firstFace = meshFaces[cFaces[0]];
std::copy(firstFace.cbegin(), firstFace.cend(), pointLabels.begin());
// Now already contains some vertices
nVerts = firstFace.size();
// For the rest of the faces. For each vertex, check if the point is
// already inserted (up to nVerts, which now carries the number of real
// points. If not, add it at the end of the list.
for (label facei = 1; facei < cFaces.size(); ++facei)
{
for (const label curPoint : meshFaces[cFaces[facei]])
{
bool pointFound = false;
for (label checki = 0; checki < nVerts; ++checki)
{
if (curPoint == pointLabels[checki])
{
pointFound = true;
break;
}
}
if (!pointFound)
{
pointLabels[nVerts] = curPoint;
++nVerts;
}
}
}
pointLabels.resize(nVerts);
}
// Like OpenFOAM-v2212, but with cell::labels unrolled to avoid allocations
autoPtr<labelListList> pointCells_2212mod(const polyMesh& mesh)
{
const cellList& cf = mesh.cells();
// Vertex labels for the current cell
DynamicList<label> vertices(256);
// Count number of cells per point
labelList npc(mesh.nPoints(), Zero);
for (const cell& c : cf)
{
cell_labels(c, mesh.faces(), vertices);
for (const label pointi : vertices)
{
++npc[pointi];
}
}
// Size and fill cells per point
auto pcPtr_ = autoPtr<labelListList>::New(npc.size());
labelListList& pointCellAddr = *pcPtr_;
forAll(pointCellAddr, pointi)
{
pointCellAddr[pointi].resize(npc[pointi]);
npc[pointi] = 0;
}
forAll(cf, celli)
{
cell_labels(cf[celli], mesh.faces(), vertices);
for (const label pointi : vertices)
{
pointCellAddr[pointi][npc[pointi]++] = celli;
}
}
return pcPtr_;
}
// How cells points are calculated in OpenFOAM-v2212 and earlier
autoPtr<labelListList> cellPoints_2212(const polyMesh& mesh)
{
autoPtr<labelListList> pointCells = pointCells_2212(mesh);
auto cpPtr_ = autoPtr<labelListList>::New(mesh.nCells());
invertManyToMany(mesh.nCells(), pointCells(), *cpPtr_);
return cpPtr_;
}
// Calculate with bitSet tracking and avoid cells::labels
autoPtr<labelListList> pointCells_bitSet(const polyMesh& mesh)
{
// Calculate point-cell topology
const cellList& cellLst = mesh.cells();
const faceList& faceLst = mesh.faces();
// For tracking (only use each point id once)
bitSet usedPoints(mesh.nPoints());
// Vertex labels for the current cell
DynamicList<label> vertices(256);
const label loopLen = mesh.nCells();
// Step 1: count number of cells per point
labelList pointCount(mesh.nPoints(), Zero);
for (label celli = 0; celli < loopLen; ++celli)
{
// Clear any previous contents
usedPoints.unset(vertices);
vertices.clear();
for (const label facei : cellLst[celli])
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (usedPoints.set(pointi))
{
vertices.push_back(pointi);
++pointCount[pointi];
}
}
}
}
// Step 2: set sizing, reset counters
auto pcPtr_ = autoPtr<labelListList>::New(mesh.nPoints());
auto& pointCellAddr = *pcPtr_;
forAll(pointCellAddr, pointi)
{
pointCellAddr[pointi].resize_nocopy(pointCount[pointi]);
pointCount[pointi] = 0;
}
// Step 3: fill in values. Logic as per step 1
for (label celli = 0; celli < loopLen; ++celli)
{
// Clear any previous contents
usedPoints.unset(vertices);
vertices.clear();
for (const label facei : cellLst[celli])
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (usedPoints.set(pointi))
{
vertices.push_back(pointi);
pointCellAddr[pointi][pointCount[pointi]++] = celli;
}
}
}
}
return pcPtr_;
}
// Calculate with bitSet tracking and avoid cells::labels
autoPtr<labelListList> cellPoints_bitSet(const polyMesh& mesh)
{
// Calculate cell-point topology
auto cpPtr_ = autoPtr<labelListList>::New(mesh.nCells());
auto& cellPointAddr = *cpPtr_;
const cellList& cellLst = mesh.cells();
const faceList& faceLst = mesh.faces();
// For tracking (only use each point id once)
bitSet usedPoints(mesh.nPoints());
// Vertex labels for the current cell
DynamicList<label> vertices(256);
const label loopLen = mesh.nCells();
for (label celli = 0; celli < loopLen; ++celli)
{
// Clear any previous contents
usedPoints.unset(vertices);
vertices.clear();
for (const label facei : cellLst[celli])
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (usedPoints.set(pointi))
{
vertices.push_back(pointi);
}
}
}
cellPointAddr[celli] = vertices; // unsorted
}
return cpPtr_;
}
// Calculate with linear lookup and avoid cells::labels
autoPtr<labelListList> pointCells_linear(const polyMesh& mesh)
{
// Calculate point-cell topology
const cellList& cellLst = mesh.cells();
const faceList& faceLst = mesh.faces();
// Vertex labels for the current cell
DynamicList<label> vertices(256);
const label loopLen = mesh.nCells();
// Step 1: count number of cells per point
labelList pointCount(mesh.nPoints(), Zero);
for (label celli = 0; celli < loopLen; ++celli)
{
// Clear any previous contents
vertices.clear();
for (const label facei : cellLst[celli])
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (!vertices.contains(pointi))
{
vertices.push_back(pointi);
++pointCount[pointi];
}
}
}
}
// Step 2: set sizing, reset counters
auto pcPtr_ = autoPtr<labelListList>::New(mesh.nPoints());
auto& pointCellAddr = *pcPtr_;
forAll(pointCellAddr, pointi)
{
pointCellAddr[pointi].resize_nocopy(pointCount[pointi]);
pointCount[pointi] = 0;
}
// Step 3: fill in values. Logic as per step 1
for (label celli = 0; celli < loopLen; ++celli)
{
// Clear any previous contents
vertices.clear();
for (const label facei : cellLst[celli])
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (!vertices.contains(pointi))
{
vertices.push_back(pointi);
pointCellAddr[pointi][pointCount[pointi]++] = celli;
}
}
}
}
return pcPtr_;
}
// Calculate with linear lookup and avoid cells::labels
autoPtr<labelListList> cellPoints_linear(const polyMesh& mesh)
{
// Calculate cell-point topology
auto cpPtr_ = autoPtr<labelListList>::New(mesh.nCells());
auto& cellPointAddr = *cpPtr_;
const cellList& cellLst = mesh.cells();
const faceList& faceLst = mesh.faces();
// Vertex labels for the current cell
DynamicList<label> vertices(256);
const label loopLen = mesh.nCells();
for (label celli = 0; celli < loopLen; ++celli)
{
// Clear any previous contents
vertices.clear();
for (const label facei : cellLst[celli])
{
for (const label pointi : faceLst[facei])
{
// Only once for each point id
if (!vertices.contains(pointi))
{
vertices.push_back(pointi);
}
}
}
cellPointAddr[celli] = vertices; // unsorted
}
return cpPtr_;
}
// Calculate point-cell from point-face information
autoPtr<labelListList> pointCells_faces(const polyMesh& mesh)
{
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
const labelListList& pFaces = mesh.pointFaces();
const label loopLen = mesh.nPoints();
auto pcPtr_ = autoPtr<labelListList>::New(mesh.nPoints());
auto& pointCellAddr = *pcPtr_;
DynamicList<label> storage(256);
for (label pointi = 0; pointi < loopLen; ++pointi)
{
// Clear any previous contents
storage.clear();
for (const label facei : pFaces[pointi])
{
// Owner cell
storage.push_back(own[facei]);
// Neighbour cell
if (facei < mesh.nInternalFaces())
{
storage.push_back(nei[facei]);
}
}
// Sort + unique to eliminate duplicates
std::sort(storage.begin(), storage.end());
auto last = std::unique(storage.begin(), storage.end());
storage.resize(label(last - storage.begin()));
pointCellAddr[pointi] = storage;
}
return pcPtr_;
}
// Calculate point-cell from point-face information
autoPtr<labelListList> pointCells_bitSet_faces(const polyMesh& mesh)
{
const labelList& own = mesh.faceOwner();
const labelList& nei = mesh.faceNeighbour();
const labelListList& pFaces = mesh.pointFaces();
const label loopLen = mesh.nPoints();
auto pcPtr_ = autoPtr<labelListList>::New(mesh.nPoints());
auto& pointCellAddr = *pcPtr_;
// For tracking (only use each cell id once)
bitSet usedCells(mesh.nCells());
DynamicList<label> storage(256);
for (label pointi = 0; pointi < loopLen; ++pointi)
{
// Clear any previous contents
usedCells.unset(storage);
storage.clear();
for (const label facei : pFaces[pointi])
{
// Owner cell - only once
if (usedCells.set(own[facei]))
{
storage.push_back(own[facei]);
}
// Neighbour cell
if (facei < mesh.nInternalFaces() && usedCells.set(nei[facei]))
{
storage.push_back(nei[facei]);
}
}
pointCellAddr[pointi] = storage;
}
return pcPtr_;
}
// Calculate point-cell from cell-point information
autoPtr<labelListList> pointCells_bitSet_alon(const polyMesh& mesh)
{
autoPtr<labelListList> cellPoints = cellPoints_bitSet(mesh);
auto pcPtr_ = autoPtr<labelListList>::New(mesh.nPoints());
invertManyToMany(mesh.nPoints(), cellPoints(), *pcPtr_);
return pcPtr_;
}
// Eliminate duplicates with sort+unique
autoPtr<labelListList> cellPoints_sorted(const polyMesh& mesh)
{
// Calculate cell-point topology
auto cpPtr_ = autoPtr<labelListList>::New(mesh.nCells());
auto& cellPointAddr = *cpPtr_;
const cellList& cellLst = mesh.cells();
const faceList& faceLst = mesh.faces();
// Vertex labels for the current cell
DynamicList<label> vertices(256);
const label loopLen = mesh.nCells();
for (label celli = 0; celli < loopLen; ++celli)
{
// Clear any previous contents
vertices.clear();
for (const label facei : cellLst[celli])
{
for (const label pointi : faceLst[facei])
{
vertices.push_back(pointi);
}
}
// Sort + unique to eliminate duplicates
std::sort(vertices.begin(), vertices.end());
auto last = std::unique(vertices.begin(), vertices.end());
vertices.resize(label(last - vertices.begin()));
cellPointAddr[celli] = vertices;
}
return cpPtr_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noBanner();
argList::noParallel();
argList::noFunctionObjects();
argList::addOption("nCells", "number", "The number of cells");
#include "setRootCase.H"
const scalar cellCount(args.getOrDefault<scalar>("nCells", 1000));
const label nDivs(::round(::cbrt(cellCount)));
PDRblock blkMesh(boundBox(zero_one{}), labelVector::uniform(nDivs));
autoPtr<Time> dummyTimePtr(Time::New());
Info<< "Requested " << cellCount
<< " cells, blockMesh with " << blkMesh.nCells() << " cells" << nl;
autoPtr<polyMesh> meshPtr = blkMesh.innerMesh
(
IOobject
(
"Testing",
dummyTimePtr->system(),
*dummyTimePtr,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
)
);
auto& mesh = meshPtr();
printInfo(mesh);
printAlloc(mesh);
clockTime timing;
// pointCells
{
mesh.clearOut();
timing.resetTime();
(void) mesh.pointCells();
Info<< "pointCells (builtin): " << timing.elapsedTime() << " s" << nl;
}
// cellPoints
{
mesh.clearOut();
timing.resetTime();
(void) mesh.cellPoints();
Info<< "cellPoints (builtin): " << timing.elapsedTime() << " s" << nl;
}
Info<< nl;
// pointCells
{
mesh.clearOut();
timing.resetTime();
(void) pointCells_2212(mesh);
Info<< "pointCells (2212): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) pointCells_2212mod(mesh);
Info<< "pointCells (2212mod): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) pointCells_bitSet(mesh);
Info<< "pointCells (bitSet): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) pointCells_linear(mesh);
Info<< "pointCells (linear): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) pointCells_faces(mesh);
Info<< "pointCells (faces): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) pointCells_bitSet_faces(mesh);
Info<< "pointCells (bitSet faces): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) pointCells_bitSet_alon(mesh);
Info<< "pointCells (bitSet alon): " << timing.elapsedTime() << " s" << nl;
}
// cellPoints
{
mesh.clearOut();
timing.resetTime();
(void) cellPoints_2212(mesh);
Info<< "cellPoints (2212): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) cellPoints_bitSet(mesh);
Info<< "cellPoints (bitSet): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) cellPoints_linear(mesh);
Info<< "cellPoints (linear): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) cellPoints_sorted(mesh);
Info<< "cellPoints (sorted): " << timing.elapsedTime() << " s" << nl;
}
// With precalculated values
{
mesh.clearOut();
const auto& cp = mesh.cellPoints();
timing.resetTime();
auto pcPtr_ = autoPtr<labelListList>::New(mesh.nPoints());
invertManyToMany(mesh.nPoints(), cp, *pcPtr_);
Info<< "pointCells (from cached cellPoints): " << timing.elapsedTime() << " s" << nl;
}
// With precalculated values
{
mesh.clearOut();
(void)mesh.pointFaces();
timing.resetTime();
(void) pointCells_bitSet_faces(mesh);
Info<< "pointCells (bitSet from cached pointFaces): " << timing.elapsedTime() << " s" << nl;
}
// With precalculated values
{
mesh.clearOut();
const auto& pc = mesh.pointCells();
timing.resetTime();
auto cpPtr_ = autoPtr<labelListList>::New(mesh.nCells());
invertManyToMany(mesh.nCells(), pc, *cpPtr_);
Info<< "cellPoints (from cached pointCells): " << timing.elapsedTime() << " s" << nl;
}
// Re-measure timings
Info<< nl;
{
mesh.clearOut();
timing.resetTime();
(void) mesh.pointCells();
Info<< "pointCells (builtin): " << timing.elapsedTime() << " s" << nl;
}
{
mesh.clearOut();
timing.resetTime();
(void) mesh.cellPoints();
Info<< "cellPoints (builtin): " << timing.elapsedTime() << " s" << nl;
}
Info<< "\nEnd\n" << nl;
return 0;
}
// ************************************************************************* //

View File

@ -204,7 +204,7 @@ int main(int argc, char *argv[])
*dummyTimePtr,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // do not register
);
Info<< "Testing searchable sphere" << endl;

View File

@ -510,7 +510,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
std::move(surf)
);

View File

@ -88,7 +88,8 @@ int main(int argc, char *argv[])
// Info<<"tree-bb faces: " << treeBoundBox::faces << nl
// <<"tree-bb edges: " << treeBoundBox::edges << endl;
treeBoundBox bb(zero_one{});
treeBoundBox bb;
bb = cube(0, 1);
triPoints tri;
tri.a() = point(-0.1, 0.5, 0.5);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2023 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -76,9 +76,9 @@ Description
writer.beginCellData(4);
writer.writeProcIDs();
{
// Use primitive patch order
Field<scalar> fld
(
// Use primitive patch order
faMeshTools::flattenEdgeField(aMesh.magLe(), true)
);
writer.write("magLe", fld);
@ -93,17 +93,11 @@ Description
}
{
const Field<vector> edgeCentres
(
// Use primitive patch order
faMeshTools::flattenEdgeField(aMesh.edgeCentres(), true)
);
// finiteArea - edgeCentres
// (no other convenient way to display vectors on the edges)
vtk::lineWriter writer
(
edgeCentres,
aMesh.edgeCentres(),
edgeList::null(),
// vtk::formatType::INLINE_ASCII,
fileName
@ -115,20 +109,19 @@ Description
writer.writeGeometry();
// PointData
writer.beginPointData(3);
writer.writeProcIDs(); // Unfortunately cannot threshold on points
writer.beginPointData(4);
{
// Use primitive patch order
Field<vector> fld
(
// Use primitive patch order
faMeshTools::flattenEdgeField(aMesh.Le(), true)
);
writer.write("Le", fld);
}
{
// Use primitive patch order
Field<vector> fld
(
// Use primitive patch order
faMeshTools::flattenEdgeField(aMesh.edgeAreaNormals(), true)
);
writer.write("normal", fld);

View File

@ -74,7 +74,7 @@ autoPtr<IOdictionary> meshDictPtr;
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER,
false, // no registerObject
true // is globalObject
);

View File

@ -16,7 +16,7 @@
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (io.typeHeaderOk<IOdictionary>(true))

View File

@ -16,7 +16,7 @@
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (io.typeHeaderOk<IOdictionary>(true))

View File

@ -16,7 +16,7 @@
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (io.typeHeaderOk<IOdictionary>(true))

View File

@ -16,7 +16,7 @@
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (io.typeHeaderOk<IOdictionary>(true))

View File

@ -191,7 +191,7 @@ int main(int argc, char *argv[])
runTime, // registry
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // Do not register
)
);

View File

@ -73,7 +73,7 @@ autoPtr<IOdictionary> meshDictPtr;
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (!meshDictIO.typeHeaderOk<IOdictionary>(true))

View File

@ -679,7 +679,7 @@ int main(int argc, char *argv[])
runTimeExtruded, //mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
)
);
@ -774,7 +774,7 @@ int main(int argc, char *argv[])
runTimeExtruded,
IOobject::READ_IF_PRESENT, // Read fv* if present
IOobject::AUTO_WRITE,
IOobject::NO_REGISTER
false
),
mesh
);

View File

@ -1272,7 +1272,7 @@ void extrudeGeometricProperties
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
regionMesh.nFaces()
);
@ -1356,7 +1356,7 @@ void extrudeGeometricProperties
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
regionMesh.nCells()
);
@ -2389,10 +2389,10 @@ int main(int argc, char *argv[])
runTime,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::NO_REGISTER
false
),
Foam::zero{},
false // syncPar
Zero,
false
);
// Add the new patches
@ -2559,7 +2559,7 @@ int main(int argc, char *argv[])
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
extruder.cellToFaceMap()
);
@ -2575,7 +2575,7 @@ int main(int argc, char *argv[])
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
extruder.faceToFaceMap()
);
@ -2592,7 +2592,7 @@ int main(int argc, char *argv[])
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
extruder.faceToEdgeMap()
);
@ -2609,7 +2609,7 @@ int main(int argc, char *argv[])
regionMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
extruder.pointToPointMap()
);

View File

@ -153,7 +153,7 @@ int main(int argc, char *argv[])
runTimeExtruded,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
runTimeExtruded,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
std::move(poly2DMesh.points()),
std::move(poly2DMesh.faces()),

View File

@ -726,7 +726,7 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition
runTime_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE,
IOobject::NO_REGISTER
false
)
),
meshCutter_

View File

@ -387,7 +387,7 @@ Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime)
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (io.typeHeaderOk<pointScalarField>(true))
@ -404,7 +404,7 @@ Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime)
mesh.time(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -176,43 +176,55 @@ void Foam::fileControl::initialVertices
{
Info<< " Reading points from file : " << pointsFile_ << endl;
pts = pointIOField::readContents
pointIOField pointsTmp
(
IOobject
(
pointsFile_,
runTime_.constant(),
runTime_,
IOobject::MUST_READ
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
pts.transfer(pointsTmp);
Info<< " Reading sizes from file : " << sizesFile_ << endl;
sizes = scalarIOField::readContents
scalarIOField sizesTmp
(
IOobject
(
sizesFile_,
runTime_.constant(),
runTime_,
IOobject::MUST_READ
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
sizes.transfer(sizesTmp);
Info<< " Reading alignments from file : " << alignmentsFile_ << endl;
alignments = triadIOField::readContents
triadIOField alignmentsTmp
(
IOobject
(
alignmentsFile_,
runTime_.constant(),
runTime_,
IOobject::MUST_READ
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
alignments.transfer(alignmentsTmp);
if ((pts.size() != sizes.size()) || (pts.size() != alignments.size()))
{
FatalErrorInFunction

View File

@ -299,8 +299,8 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
// "tetDualMesh"/polyMesh::meshSubDir,
// runTime_,
// IOobject::NO_READ,
// IOobject::NO_WRITE,
// IOobject::NO_REGISTER
// IOobject::AUTO_WRITE,
// false
// ),
// labelUIndList
// (
@ -346,8 +346,8 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance)
// "tetDualMesh"/polyMesh::meshSubDir,
// runTime_,
// IOobject::NO_READ,
// IOobject::NO_WRITE,
// IOobject::NO_REGISTER
// IOobject::AUTO_WRITE,
// false
// ),
// points
// );
@ -605,7 +605,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
runTime_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
patchNames,
patchDicts

View File

@ -603,7 +603,7 @@ int main(int argc, char *argv[])
fvm.time(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
fvm,
dimensionedScalar(dimLength, Zero)
@ -668,7 +668,7 @@ int main(int argc, char *argv[])
fvm.time(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
pointMesh::New(fvm),
dimensionedScalar(dimLength, Zero)

View File

@ -619,8 +619,8 @@ int main(int argc, char *argv[])
"triSurface",
runTime, // registry
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
s
);

View File

@ -327,8 +327,8 @@ int main(int argc, char *argv[])
"triSurface",
runTime, // registry
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
s
);

View File

@ -158,7 +158,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
std::move(poly2DMesh.points()),
std::move(poly2DMesh.faces()),

View File

@ -134,8 +134,8 @@ void writeSurfaceField
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -193,8 +193,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -227,8 +227,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -279,8 +279,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -316,8 +316,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -351,8 +351,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -386,8 +386,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -416,8 +416,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -445,8 +445,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimVolume, Zero),
@ -476,8 +476,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -511,8 +511,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("minTetVolume", dimless, GREAT),
@ -577,8 +577,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar("minPyrVolume", dimless, GREAT),
@ -650,8 +650,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -701,8 +701,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(scalar(-1)),
@ -740,8 +740,8 @@ void Foam::writeFields
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
mesh,
dimensionedScalar(scalar(-1)),

View File

@ -65,7 +65,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -90,7 +90,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -73,7 +73,7 @@ tmp<volScalarField> createScalarField
(
const fvMesh& mesh,
const word& name,
const labelUList& elems
const labelList& elems
)
{
tmp<volScalarField> tfld
@ -87,7 +87,7 @@ tmp<volScalarField> createScalarField
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::NO_REGISTER
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -1343,7 +1343,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
refData.updateMesh(map());
@ -1387,7 +1387,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
map().cellMap()
).write();
@ -1402,7 +1402,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
map().faceMap()
).write();
@ -1417,7 +1417,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
map().pointMap()
).write();

View File

@ -150,7 +150,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -913,7 +913,7 @@ void createAndWriteRegion
newMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
map().pointMap()
);
@ -932,7 +932,7 @@ void createAndWriteRegion
newMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
newMesh().nFaces()
);
@ -970,7 +970,7 @@ void createAndWriteRegion
newMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
map().cellMap()
);
@ -989,7 +989,7 @@ void createAndWriteRegion
newMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
labelList(nNewPatches, -1)
);
@ -1409,7 +1409,7 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion)
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
cellRegion
);
@ -1429,7 +1429,7 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion)
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh,
dimensionedScalar(dimless, Zero),
@ -1716,7 +1716,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh
);

View File

@ -414,7 +414,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -106,7 +106,7 @@ bool writeZones
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
bool writeOk = false;
@ -203,7 +203,7 @@ bool writeOptionalMeshObject
const word& name,
const fileName& meshDir,
Time& runTime,
const bool writeOnProc
const bool valid
)
{
IOobject io
@ -214,11 +214,12 @@ bool writeOptionalMeshObject
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
bool writeOk = false;
const bool haveFile = io.typeHeaderOk<IOField<label>>(false);
bool haveFile = io.typeHeaderOk<IOField<label>>(false);
// Make sure all know if there is a valid class name
wordList classNames(1, io.headerClassName());
@ -229,10 +230,10 @@ bool writeOptionalMeshObject
{
Info<< " Reading " << classNames[0]
<< " : " << name << endl;
T meshObject(io, writeOnProc && haveFile);
T meshObject(io, valid && haveFile);
Info<< " Writing " << name << endl;
writeOk = meshObject.regIOobject::write(writeOnProc && haveFile);
writeOk = meshObject.regIOobject::write(valid && haveFile);
}
return writeOk;

View File

@ -31,8 +31,8 @@ Description
\*---------------------------------------------------------------------------*/
#ifndef Foam_writeMeshObject_H
#define Foam_writeMeshObject_H
#ifndef writeMeshObject_H
#define writeMeshObject_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,7 +59,7 @@ inline bool writeMeshObject
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
bool writeOk = false;

View File

@ -94,7 +94,7 @@ void Foam::helpTypes::helpBoundary::fixedValueFieldConditions
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
mesh,
dimensioned<Type>(dimless, Zero)

View File

@ -189,7 +189,7 @@ autoPtr<labelIOList> procAddressing
procMesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // do not register
)
);
}
@ -505,7 +505,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
decompDictFile,
args.getOrDefault<label>("domains", 0),
@ -543,7 +543,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // do not register
),
decompDictFile
)
@ -653,7 +653,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
decompDictFile
);
@ -683,7 +683,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
procIds
);
@ -816,7 +816,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // not registered
);
if (io.typeHeaderOk<faBoundaryMesh>(true))

View File

@ -91,7 +91,7 @@ Foam::domainDecomposition::domainDecomposition
*this,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
)
: nullptr
@ -221,7 +221,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
*this,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
@ -767,7 +767,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
std::move(procPoints)
);
@ -831,7 +831,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
baseMeshData,
procCellAddressing_[proci],
@ -907,7 +907,7 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
procMesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // not registered
);
// pointProcAddressing

View File

@ -153,7 +153,7 @@ void Foam::domainDecompositionDryRun::execute
// mesh_,
// IOobject::NO_READ,
// IOobject::NO_WRITE,
// IOobject::NO_REGISTER
// false
// ),
// std::move(cellToProc)
// );

View File

@ -48,7 +48,7 @@ void Foam::domainDecompositionDryRun::writeVolField
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
this->mesh(),
dimensionedScalar("cellDist", dimless, -1),

View File

@ -49,7 +49,7 @@ void Foam::domainDecomposition::writeVolField
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
this->mesh(),
dimensionedScalar("cellDist", dimless, -1),

View File

@ -780,7 +780,7 @@ int main(int argc, char *argv[])
procMesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
)
);
@ -822,7 +822,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
cellMaps,
pointMaps,
@ -853,7 +853,7 @@ int main(int argc, char *argv[])
procMesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
)
);
@ -895,7 +895,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
cellMaps,
pointMaps,

View File

@ -353,7 +353,7 @@ boundBox procBounds
procDb,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
@ -382,7 +382,7 @@ void writeDistribution
masterMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
masterMesh.nCells()
);
@ -418,7 +418,7 @@ void writeDistribution
masterMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
masterMesh,
dimensionedScalar("cellDist", dimless, -1),
@ -498,7 +498,7 @@ void writeMaps
procMesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // Do not register
);

View File

@ -114,7 +114,7 @@ Foam::label Foam::parLagrangianDistributor::distributeFields
srcMesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
label(0)
);
@ -130,7 +130,7 @@ Foam::label Foam::parLagrangianDistributor::distributeFields
tgtMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (field.size())
@ -218,7 +218,7 @@ Foam::label Foam::parLagrangianDistributor::distributeFieldFields
srcMesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
label(0)
);
@ -235,7 +235,7 @@ Foam::label Foam::parLagrangianDistributor::distributeFieldFields
tgtMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (field.size())
@ -363,7 +363,7 @@ Foam::label Foam::parLagrangianDistributor::distributeStoredFields
tgtMesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (field.size())

View File

@ -397,7 +397,7 @@ void writeDecomposition
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
decomp
);
@ -415,7 +415,7 @@ void writeDecomposition
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // do not register
),
mesh,
dimensionedScalar(name, dimless, -1),
@ -891,7 +891,7 @@ autoPtr<mapDistributePolyMesh> redistributeAndWrite
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
hexRef8Data refData(io);
@ -2592,7 +2592,7 @@ int main(int argc, char *argv[])
areaProcMeshPtr->thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
faDistMap
).write();

View File

@ -94,7 +94,7 @@ public:
{}
//- Disable writing objects
virtual bool writeObject(IOstreamOption, const bool writeOnProc) const
virtual bool writeObject(IOstreamOption, const bool valid) const
{
return true;
}

View File

@ -49,7 +49,7 @@ if (timeDirs.size() > 1)
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // no register
).typeHeaderOk<pointIOField>(true, false)
)
{

View File

@ -42,7 +42,7 @@ label timeIndex = 0;
runTime,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // no register
);
if (io.typeHeaderOk<IOdictionary>(true, false))

View File

@ -55,7 +55,7 @@ Foam::label Foam::checkData
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // no register
).typeHeaderOk<volScalarField>(false, false);
if (!good)

View File

@ -7,7 +7,7 @@
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // no register
);
if (io.typeHeaderOk<pointIOField>(true, false))

View File

@ -211,7 +211,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER,
false, // no register
true // global-like
)
);

View File

@ -169,7 +169,7 @@ void fieldInterpolator::interpolate()
objects_[fieldName]->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
fieldName,
selectedTimeNames,

View File

@ -10,7 +10,7 @@
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
)
);

View File

@ -84,7 +84,7 @@ void blendField
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (fieldHeader.typeHeaderOk<volScalarField>(true))
@ -122,7 +122,7 @@ void calcOmegaField
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (omegaHeader.typeHeaderOk<volScalarField>(true))
@ -159,7 +159,7 @@ void setField
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (fldHeader.typeHeaderOk<volScalarField>(true))

View File

@ -548,7 +548,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
@ -672,7 +672,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (fieldHeader.typeHeaderOk<localIOdictionary>(false))

View File

@ -59,7 +59,7 @@ Foam::IOPtrList<Foam::entry> Foam::boundaryInfo::readBoundaryDict
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
@ -75,7 +75,8 @@ Foam::IOPtrList<Foam::entry> Foam::boundaryInfo::readBoundaryDict
if (!procPatch)
{
label nFaces = dict.get<label>("nFaces");
if (returnReduceAnd(nFaces == 0))
reduce(nFaces, sumOp<label>());
if (nFaces == 0)
{
addPatch = false;
}

View File

@ -108,7 +108,7 @@ Foam::dictionary Foam::solverTemplate::readFluidFieldTemplates
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -89,7 +89,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
boundary.size()
);

View File

@ -287,7 +287,7 @@ void rewriteField
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
@ -455,7 +455,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (io.typeHeaderOk<IOPtrList<entry>>(false))
@ -489,7 +489,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
if (io.typeHeaderOk<IOPtrList<entry>>(false))

View File

@ -82,7 +82,7 @@ void MapLagrangianFields
meshTarget,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
addParticles.size()
);
@ -121,7 +121,7 @@ void MapLagrangianFields
meshTarget,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
addParticles.size()
);
@ -159,7 +159,7 @@ void MapLagrangianFields
meshTarget,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
addParticles.size()
);

View File

@ -67,7 +67,7 @@ int readNumProcs
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // do not register
),
args.getOrDefault<fileName>(optionName, "")
)
@ -360,7 +360,7 @@ int main(int argc, char *argv[])
runTimeTarget,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -81,7 +81,7 @@ void MapLagrangianFields
meshTarget,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
addParticles.size()
);
@ -123,7 +123,7 @@ void MapLagrangianFields
meshTarget,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
min(fieldSource.size(), addParticles.size()) // handle 0 size
);
@ -172,7 +172,7 @@ void MapLagrangianFields
meshTarget,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
min(fieldSource.size(), addParticles.size()) // handle 0 size
);

View File

@ -313,7 +313,7 @@ int main(int argc, char *argv[])
runTimeTarget,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);

View File

@ -47,14 +47,16 @@ int main(int argc, char *argv[])
const dictionary NURBSdict
(
IOdictionary::readContents
IOdictionary
(
IOobject
(
"dynamicMeshDict",
mesh.time().constant(),
mesh,
IOobject::MUST_READ
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
).subDict("volumetricBSplinesMotionSolverCoeffs")
);

View File

@ -197,7 +197,7 @@ int main(int argc, char *argv[])
mesh.thisDb(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
);
const bool headOk = fieldHeader.typeHeaderOk<IOdictionary>(false);

View File

@ -163,7 +163,7 @@ bool setField
mesh.thisDb(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // No register
),
mesh
);

View File

@ -148,7 +148,7 @@ IOobject createIOobject
mesh,
rOpt,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // do not register
);
}
@ -377,7 +377,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false // do not register
),
mesh,
dimensionedScalar(dimless, scalar(1)),

View File

@ -480,7 +480,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
@ -824,7 +824,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
nCoarseFaces
);
@ -1273,7 +1273,7 @@ int main(int argc, char *argv[])
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
std::move(globalFaceFaces)
);

View File

@ -1811,7 +1811,7 @@ int main(int argc, char *argv[])
runTime, // registry
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
feMesh.points(),
feMesh.edges()

View File

@ -639,8 +639,8 @@ int main(int argc, char *argv[])
"triSurface",
runTime, // registry
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::AUTO_WRITE,
false
),
feMesh.points(),
feMesh.edges()

View File

@ -228,7 +228,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
args.getOrDefault<fileName>("dict", "")
);

View File

@ -188,7 +188,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
args.getOrDefault<fileName>("dict", "")
);

View File

@ -200,7 +200,7 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
args.getOrDefault<fileName>("dict", "")
);

View File

@ -81,11 +81,12 @@ int main(int argc, char *argv[])
runTime,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
)
);
const scalar P = 1e5;
const scalar T = 3000.0;

View File

@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2015 OpenFOAM Foundation
# Copyright (C) 2017-2023 OpenCFD Ltd.
# Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -45,7 +45,6 @@ options:
-local Same as -spawn=1
-remote Same as -spawn=2
-clean Remove old processor*.{log,sh} files, mpirun.schema etc
-decompose-dict=<file> Specific decomposeParDict name
-help Print the usage
Invoke mpirun with separate per-processor log files or running in
@ -112,7 +111,7 @@ Linux)
esac
unset appName appArgs nProcs
unset method spawn optClean optValue
unset method spawn optClean
optConfirm=true
decompDict="system/decomposeParDict"
@ -127,7 +126,7 @@ do
then
knownOption=true # Assume success
case "$1" in
('') ;; # Ignore junk
'') ;; # ignore junk
-clean) optClean=true ;;
-yes) unset optConfirm ;;
@ -174,25 +173,14 @@ do
shift
;;
(-decompose-dict=*)
optValue="${1#*=}"
case "$optValue" in
('' | none | false) ;; ## Ignore
(*)
decompDict="$optValue"
appArgs="${appArgs}${appArgs:+ }-decomposeParDict '$decompDict'"
;;
esac
;;
-decomposeParDict)
# Grab values and add to args immediately
decompDict="$2"
appArgs="${appArgs}${appArgs:+ }$1 '$2'"
shift
appArgs="${appArgs}${appArgs:+ }-decomposeParDict '$decompDict'"
;;
(*)
*)
knownOption=false # Fallthrough to regular processing
;;
esac
@ -204,24 +192,23 @@ do
fi
fi
# Processing application arguments
case "$1" in
(-help* | --help*) usage ;;
('') ;; ## Ignore junk
-help* | --help*) usage ;;
'') ;; # ignore junk
(-np)
-np)
nProcs="$2"
shift
;;
(-decomposeParDict)
-decomposeParDict)
# Grab values and add to args immediately
decompDict="$2"
appArgs="${appArgs}${appArgs:+ }-decomposeParDict '$decompDict'"
appArgs="${appArgs}${appArgs:+ }$1 '$2'"
shift
;;
(*)
*)
if [ -z "$appName" ]
then
appName="$1"

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2015-2023 OpenCFD Ltd.
# Copyright (C) 2015-2022 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -180,16 +180,6 @@ getNumberOfProcessors()
{
local dict="${1:-system/decomposeParDict}"
case "$dict" in
(system/*) # Already qualified
;;
(*)
# If it does not exist, assume it refers to location in system/
[ -f "$dict" ] || dict="system/$dict"
;;
esac
# Re-use positional parameters for automatic whitespace elimination
set -- $(foamDictionary -entry numberOfSubdomains -value "$dict" 2>/dev/null)
@ -233,7 +223,7 @@ getApplication()
#
runApplication()
{
local appName appRun optValue logFile logMode
local appName appRun logFile logMode
# Any additional parsed arguments (eg, decomposeParDict)
local appArgs
@ -242,39 +232,25 @@ runApplication()
while [ "$#" -gt 0 ] && [ -z "$appRun" ]
do
case "$1" in
('') ;; # Ignore junk
(-a | -append)
logMode=append
;;
(-o | -overwrite)
logMode=overwrite
;;
(-s | -suffix)
logFile=".$2"
shift
;;
(-decompose-dict=*)
optValue="${1#*=}"
case "$optValue" in
('' | none | false) ;; ## Ignore
(*) appArgs="$appArgs -decomposeParDict $optValue" ;;
esac
;;
(-decomposeParDict)
optValue="$2"
shift
case "$optValue" in
('' | none | false) ;; ## Ignore
(*) appArgs="$appArgs -decomposeParDict $optValue" ;;
esac
;;
(*)
appRun="$1"
;;
-a | -append)
logMode=append
;;
-o | -overwrite)
logMode=overwrite
;;
-s | -suffix)
logFile=".$2"
shift
;;
-decomposeParDict)
appArgs="$appArgs $1 $2"
shift
;;
'')
;;
*)
appRun="$1"
;;
esac
shift
done
@ -304,7 +280,7 @@ runApplication()
#
runParallel()
{
local appName appRun optValue logFile logMode nProcs
local appName appRun logFile logMode nProcs
# Any additional parsed arguments (eg, decomposeParDict)
local appArgs="-parallel"
@ -319,46 +295,30 @@ runParallel()
while [ "$#" -gt 0 ] && [ -z "$appRun" ]
do
case "$1" in
('') ;; # Ignore junk
(-a | -append)
logMode=append
;;
(-o | -overwrite)
logMode=overwrite
;;
(-s | -suffix)
logFile=".$2"
shift
;;
(-n | -np)
nProcs="$2"
shift
;;
(-decompose-dict=*)
optValue="${1#*=}"
case "$optValue" in
('' | none | false) ;; ## Ignore
(*)
appArgs="$appArgs -decomposeParDict $optValue"
nProcs="$(getNumberOfProcessors "$optValue")"
-a | -append)
logMode=append
;;
esac
;;
(-decomposeParDict)
optValue="$2"
shift
case "$optValue" in
('' | none | false) ;; ## Ignore
(*)
appArgs="$appArgs -decomposeParDict $optValue"
nProcs="$(getNumberOfProcessors "$optValue")"
-o | -overwrite)
logMode=overwrite
;;
-s | -suffix)
logFile=".$2"
shift
;;
-n | -np)
nProcs="$2"
shift
;;
-decomposeParDict)
appArgs="$appArgs $1 $2"
nProcs=$(getNumberOfProcessors "$2")
shift
;;
'')
;;
*)
appRun="$1"
;;
esac
;;
(*)
appRun="$1"
;;
esac
shift
done

Some files were not shown because too many files have changed in this diff Show More