Compare commits

..

3 Commits

Author SHA1 Message Date
e65dc2d578 BUG: integratedNonUniformTable: correct offsets (fixes #2614) 2022-11-01 14:55:59 +00:00
37db8ccd20 ENH: support direct calculation of finiteArea edgeNormals (#2592)
- with geometryOrder=1, calculate the edge normals from the adjacent
  faces (area-weighted, inverse distance squared) and also
  use that for the Le() calculation.

  Includes the contributions from processor edge neighbours, so it
  should be consistent on both sides.

  This new method (consider as 'beta') contrasts with the current
  standard method that first calculates area-weighted point normals
  and uses the average of them for the edge normal.

  Enable for testing either with a controlDict OptimisationSwitch entry
  "fa:geometryOrder", or on the command-line:

      solverName -opt-switch=fa:geometryOrder=1
2022-09-28 17:47:18 +02:00
a5d6c8ced0 ENH: use fallback value if calculated Le() is degenerate (#2592)
- the Le vector is calculated from (edgeVec ^ edgeNorm)
  and should be oriented in direction (faceCentre -> edgeCentre).

  If, however, the edgeNorm value is bad for any reason, the
  cross-product falls apart and Le vector is calculated as a zero
  vector!

  For these cases, revert to using (faceCentre -> edgeCentre)
  as a better approximation than a zero vector.

  In the future, will very likely switch calculating the edge normals
  directly from the attached faces, instead of from the attached
  points as is currently done, which should improve robustness.

ENH: expose fa:geometryOrder as a registered OptimisationSwitch

ENN: reuse polyMesh data (eg, faceCentres) if possible in faMesh

STYLE: add code lambdas and static functions to isolate logic
2022-09-28 17:47:17 +02:00
967 changed files with 10446 additions and 23760 deletions

View File

@ -35,7 +35,7 @@
(
solidRegions[i],
thermos[i],
coordinateSystem::typeName
coordinateSystem::typeName_()
)
);

View File

@ -15,7 +15,7 @@ if (!thermo.isotropic())
(
mesh,
thermo,
coordinateSystem::typeName
coordinateSystem::typeName_()
);
tmp<volVectorField> tkappaByCp = thermo.Kappa()/thermo.Cp();

View File

@ -157,7 +157,12 @@ void Foam::radiation::laserDTRM::initialiseReflection()
);
}
reflectionSwitch_ = returnReduceOr(reflections_.size());
if (reflections_.size())
{
reflectionSwitch_ = true;
}
reflectionSwitch_ = returnReduce(reflectionSwitch_, orOp<bool>());
}
}
@ -294,12 +299,14 @@ void Foam::radiation::laserDTRM::initialise()
DTRMCloud_.addParticle(pPtr);
}
if (nMissed < 10 && returnReduceAnd(cellI < 0))
if (returnReduce(cellI, maxOp<label>()) == -1)
{
++nMissed;
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
if (++nMissed <= 10)
{
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
}
}
}
}

View File

@ -28,6 +28,11 @@ License
#include "DirLister.H"
#include <dirent.h>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
static const Foam::word extgz("gz");
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::DirLister::const_iterator::open(const fileName& dir)
@ -105,9 +110,9 @@ Foam::word Foam::DirLister::next(DIR* dirPtr) const
if (ok)
{
if (fType == fileName::FILE && stripgz_ && name.has_ext("gz"))
if (fType == fileName::FILE && stripgz_ && name.hasExt(extgz))
{
name.remove_ext();
name = name.lessExt();
}
if (!name.empty() && accept(name))

View File

@ -113,6 +113,7 @@ int main(int argc, char *argv[])
label coarseSize = max(addr)+1;
Info<< "Level : " << level << endl
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " current size : "
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " agglomerated size : "

View File

@ -90,7 +90,7 @@ void writeAndRead
const IOobject& io,
const label sz,
const word& writeType,
IOobjectOption::readOption rOpt,
const IOobject::readOption rOpt,
const word& readType
)
{
@ -208,8 +208,7 @@ int main(int argc, char *argv[])
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::NO_WRITE
);
{
@ -244,7 +243,9 @@ int main(int argc, char *argv[])
args.executable(),
"constant",
runTime,
IOobject::NO_REGISTER // implicit convert to IOobjectOption
IOobject::NO_READ,
IOobject::NO_WRITE,
false
);
labelList ints(identity(200));

View File

@ -182,7 +182,7 @@ int main(int argc, char *argv[])
// MPI barrier
bool barrier = true;
Pstream::broadcast(barrier);
Pstream::scatter(barrier);
}

View File

@ -83,9 +83,9 @@ int main(int argc, char *argv[])
{
IOstreamOption streamOpt;
if (outputName.has_ext("gz"))
if (outputName.hasExt("gz"))
{
outputName.remove_ext();
outputName.removeExt();
streamOpt.compression(IOstreamOption::COMPRESSED);
}

View File

@ -138,8 +138,8 @@ int main()
maxFirstEqOp<label>()(maxIndexed, item);
}
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl;
@ -156,8 +156,8 @@ int main()
maxIndexed = maxFirstOp<label>()(maxIndexed, item);
}
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl;

View File

@ -1,2 +1,7 @@
/* EXE_INC = */
/* EXE_LIBS = */
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,8 +31,7 @@ Description
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
#include "line.H"
#include "Random.H"
#include "boundBox.H"
#include "treeBoundBox.H"
#include "cellModel.H"
#include "bitSet.H"
@ -85,20 +84,7 @@ int main(int argc, char *argv[])
else
{
bb = cube(0, 1);
Info<< "starting box: " << bb << endl;
Info<< "corner: " << bb.hexCorner<0>() << nl
<< "corner: " << bb.hexCorner<7>() << nl
<< "corner: " << bb.hexCorner<6>() << endl;
linePoints ln1(bb.max(), bb.centre());
Info<< "line: " << ln1 << " box: " << ln1.box() << endl;
Info<< "box: " << boundBox(ln1.box()) << endl;
Info<< "corner: " << bb.hexCorner<0>() << nl
<< "corner: " << bb.hexCorner<7>() << nl
<< "corner: " << bb.hexCorner<6>() << endl;
Info<<"starting box: " << bb << endl;
point pt(Zero);
bb.add(pt);
@ -161,25 +147,6 @@ int main(int argc, char *argv[])
Info<< "box is now => " << box1 << endl;
}
List<boundBox> boxes(12);
{
Random rndGen(12345);
for (auto& bb : boxes)
{
bb = cube
(
rndGen.position<scalar>(-10, 10),
rndGen.position<scalar>(0, 5)
);
}
Info<< "boxes: " << boxes << endl;
Foam::sort(boxes);
Info<< "sorted: " << boxes << endl;
}
return 0;
}

View File

@ -59,11 +59,11 @@ void basicTests(const coordinateSystem& cs)
{
cs.writeEntry(cs.name(), Info);
if ((const auto* cartptr = isA<coordSystem::cartesian>(cs)) != nullptr)
if (const auto* cartptr = isA<coordSystem::cartesian>(cs))
{
if (!cartptr->valid())
if (!cartptr->active())
{
Info<< "invalid cartesian = " << (*cartptr)
Info<< "inactive cartesian = " << (*cartptr)
<< " with: " << (*cartptr).R() << nl;
}
}
@ -106,7 +106,7 @@ void doTest(const dictionary& dict)
try
{
auto cs1ptr = coordinateSystem::New(dict, word::null);
auto cs1ptr = coordinateSystem::New(dict, "");
coordinateSystem& cs1 = *cs1ptr;
cs1.rename(dict.dictName());

View File

@ -51,8 +51,11 @@ cs4
{
type cylindrical;
origin (0 3 5);
rotation euler;
angles (90 0 0);
rotation
{
type euler;
angles (90 0 0);
}
}
cyl
@ -72,7 +75,10 @@ cyl
ident
{
origin (0 0 0);
rotation none;
rotation
{
type none;
}
}
)

View File

@ -26,7 +26,7 @@ rot_x90
rot_x90_axesRotation
{
origin (0 0 0);
rotation
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
@ -37,7 +37,7 @@ rot_x90_axesRotation
rot_x90_axisAngle
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (1 0 0); // non-unit also OK
@ -48,7 +48,7 @@ rot_x90_axisAngle
rot_x90_euler
{
origin (0 0 0);
rotation
coordinateRotation
{
type euler;
angles (0 90 0); // z-x'-z''
@ -61,7 +61,7 @@ rot_x90_euler
rot_z45_axesRotation
{
origin (0 0 0);
rotation
coordinateRotation
{
type axesRotation;
e1 (1 1 0);
@ -72,7 +72,7 @@ rot_z45_axesRotation
rot_z45_axisAngle
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (0 0 10); // non-unit also OK
@ -83,7 +83,7 @@ rot_z45_axisAngle
rot_z45_euler
{
origin (0 0 0);
rotation
coordinateRotation
{
type euler;
angles (45 0 0); // z-x'-z''
@ -93,7 +93,7 @@ rot_z45_euler
rot_z45_starcd
{
origin (0 0 0);
rotation
coordinateRotation
{
type starcd;
angles (45 0 0); // z-x'-y''
@ -106,7 +106,7 @@ rot_z45_starcd
rot_zm45_axesRotation
{
origin (0 0 0);
rotation
coordinateRotation
{
type axesRotation;
e1 (1 -1 0);
@ -117,7 +117,7 @@ rot_zm45_axesRotation
rot_zm45_axisAngle
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (0 0 10); // non-unit also OK
@ -128,7 +128,7 @@ rot_zm45_axisAngle
rot_zm45_euler
{
origin (0 0 0);
rotation
coordinateRotation
{
type euler;
angles (-45 0 0); // z-x'-z''
@ -141,7 +141,7 @@ rot_zm45_euler
null_axesRotation
{
origin (0 0 0);
rotation
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
@ -152,7 +152,7 @@ null_axesRotation
null_axisAngle0
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (0 0 0); // non-unit also OK
@ -163,7 +163,7 @@ null_axisAngle0
null_axisAngle1
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (1 1 1); // non-unit also OK
@ -174,7 +174,7 @@ null_axisAngle1
null_euler
{
origin (0 0 0);
rotation
coordinateRotation
{
type euler;
angles (0 0 0); // z-x'-z''

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
Info<< "Reading " << file << nl << endl;
decomposedBlockData data
(
UPstream::worldComm,
Pstream::worldComm,
IOobject
(
file,
@ -79,6 +79,7 @@ int main(int argc, char *argv[])
(
objPath,
IOstreamOption::BINARY,
IOstreamOption::currentVersion,
runTime.writeCompression()
);
if (!os.good())

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -65,7 +65,8 @@ int main(int argc, char *argv[])
"tensor",
runTime.timeName(),
mesh,
{ IOobject::READ_IF_PRESENT, IOobject::NO_REGISTER }
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9))
@ -74,47 +75,6 @@ int main(int argc, char *argv[])
Info().beginBlock("transformed")
<< tensorfld.T() << nl;
Info().endBlock();
{
auto tfld =
DimensionedField<scalar, volMesh>::New
(
tensorfld,
"scalar",
dimensioned<scalar>(14)
);
Info().beginBlock(tfld().type())
<< tfld << nl;
Info().endBlock();
}
{
auto tfld =
volScalarField::New
(
"scalar",
tensorfld.mesh(),
dimensioned<scalar>(5)
);
Info().beginBlock(tfld().type())
<< tfld() << nl;
Info().endBlock();
// From dissimilar types
auto tfld2 =
volVectorField::New
(
tfld(),
"vector",
dimensioned<vector>(Zero)
);
Info().beginBlock(tfld2().type())
<< tfld2() << nl;
Info().endBlock();
}
}
#ifdef TEST_UINT8_FIELD

View File

@ -120,8 +120,7 @@ int main(int argc, char *argv[])
try
{
// Should not trigger any errors
auto expr = expressions::exprString::toExpr(str, dict);
expressions::exprString expr(str, dict, false);
Info<< "expr: " << expr << nl;
}
catch (const Foam::error& err)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,14 +48,6 @@ Description
using namespace Foam;
// Create named file with some dummy content
void touchFileContent(const fileName& file)
{
std::ofstream os(file);
os << "file=<" << file << ">" << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
unsigned testClean(std::initializer_list<Pair<std::string>> tests)
@ -268,7 +260,7 @@ int main(int argc, char *argv[])
"hello1",
"hello2",
"hello3",
"hello4.ext"
"hello4.hmm"
};
Info<< file1 << nl;
@ -278,7 +270,7 @@ int main(int argc, char *argv[])
{
file1,
"some",
"more/things.ext"
"more/things.hmm"
};
Info<< file2 << nl;
@ -289,7 +281,7 @@ int main(int argc, char *argv[])
{
std::string("ffO"),
"some",
"more/things.ext"
"more/things.hmm"
};
Info<< file3 << nl;
@ -303,7 +295,7 @@ int main(int argc, char *argv[])
{
"some",
file3,
"more/things.ext",
"more/things.hmm",
file1
};
Info<< "All ==> " << file4 << nl;
@ -336,26 +328,26 @@ int main(int argc, char *argv[])
fileName input1("path.to/media/image.png");
Info<<"File : " << input0 << " ext: "
<< Switch(input0.has_ext())
<< Switch(input0.hasExt())
<< " = " << input0.ext() << nl;
Info<<"File : " << input1 << " ext: "
<< Switch(input1.has_ext())
<< Switch(input1.hasExt())
<< " = " << input1.ext() << nl;
Info<<"File : " << endWithDot << " ext: "
<< Switch(endWithDot.has_ext())
<< Switch(endWithDot.hasExt())
<< " = " << endWithDot.ext() << " <-- perhaps return false?" << nl;
Info<<"File : " << endWithSlash << " ext: "
<< Switch(endWithSlash.has_ext())
<< Switch(endWithSlash.hasExt())
<< " = " << endWithSlash.ext() << nl;
Info<<"Remove extension " << (input0.remove_ext());
Info<<"Remove extension " << (input0.removeExt());
Info<< " now: " << input0 << nl;
Info<<"Remove extension " << (input1.removeExt());
Info<< " now: " << input1 << nl;
Info<<"Remove extension " << (endWithSlash.remove_ext());
Info<<"Remove extension " << (endWithSlash.removeExt());
Info<< " now: " << endWithSlash << nl;
wordList exts{ "jpg", "png", "txt", word::null };
@ -367,14 +359,14 @@ int main(int argc, char *argv[])
Info<< nl;
Info<<"Test has_ext(word)" << nl
Info<<"Test hasExt(word)" << nl
<<"~~~~~~~~~~~~~~~~~" << nl;
Info<<"Has extension(s):" << nl
<< "input: " << input1 << nl;
for (const word& e : exts)
{
Info<<" '" << e << "' -> "
<< Switch(input1.has_ext(e)) << nl;
<< Switch(input1.hasExt(e)) << nl;
}
Info<< nl;
@ -383,12 +375,12 @@ int main(int argc, char *argv[])
for (const word& e : exts)
{
Info<<" '" << e << "' -> "
<< Switch(endWithDot.has_ext(e)) << nl;
<< Switch(endWithDot.hasExt(e)) << nl;
}
Info<< nl;
Info<<"Test has_ext(wordRe)" << nl
Info<<"Test hasExt(wordRe)" << nl
<<"~~~~~~~~~~~~~~~~~~~" << nl;
// A regex with a zero length matcher doesn't work at all:
@ -401,25 +393,25 @@ int main(int argc, char *argv[])
Info<<"Has extension(s):" << nl
<< "input: " << endWithDot << nl;
Info<<" " << matcher0 << " -> "
<< Switch(endWithDot.has_ext(matcher0)) << nl;
<< Switch(endWithDot.hasExt(matcher0)) << nl;
Info<<" " << matcher1 << " -> "
<< Switch(endWithDot.has_ext(matcher1)) << nl;
<< Switch(endWithDot.hasExt(matcher1)) << nl;
Info<<" " << matcher2 << " -> "
<< Switch(endWithDot.has_ext(matcher2)) << nl;
<< Switch(endWithDot.hasExt(matcher2)) << nl;
Info<< "input: " << input1 << nl;
Info<<" " << matcher0 << " -> "
<< Switch(input1.has_ext(matcher0)) << nl;
<< Switch(input1.hasExt(matcher0)) << nl;
Info<<" " << matcher1 << " -> "
<< Switch(input1.has_ext(matcher1)) << nl;
<< Switch(input1.hasExt(matcher1)) << nl;
Info<<" " << matcher2 << " -> "
<< Switch(input1.has_ext(matcher2)) << nl;
<< Switch(input1.hasExt(matcher2)) << nl;
Info<< nl;
Info<<"Remove extension(s):" << nl << "input: " << input1 << nl;
while (!input1.empty())
{
if (input1.remove_ext())
if (input1.removeExt())
{
Info<< " -> " << input1 << nl;
}
@ -595,54 +587,14 @@ int main(int argc, char *argv[])
if (args.found("system"))
{
const fileName dirA("dirA");
const fileName dirB("dirB");
const fileName dirC("dirC");
const fileName dirD("dirD");
const fileName lnA("lnA");
const fileName lnB("lnB");
const fileName dirB("dirB");
// Purge anything existing
Foam::rmDir(dirA, true);
Foam::rmDir(dirB, true);
Foam::rmDir(dirC, true);
Foam::rmDir(dirD, true);
Foam::rmDir(dirA);
Foam::rm(lnA);
Foam::rm(lnB);
{
fileName name(dirA/dirB/dirC/"abc");
Foam::mkDir(name.path());
touchFileContent(name); // Create real file
Foam::mkDir(dirB/dirB/dirB/dirB);
Foam::ln("test", dirB/"linkB"); // Create dead link
Foam::mkDir(dirC);
Foam::ln("../dirD", dirC/"linkC"); // Create real link
Foam::mkDir(dirD);
for (const fileName& d : { dirA, dirB, dirC, dirD })
{
Info<< "Directory: " << d << " = "
<< readDir(d, fileName::UNDEFINED, false, false) << nl;
if (Foam::rmDir(d, false, true))
{
Info<< " Removed empty dir" << nl;
}
else
{
Info<< " Could not remove empty dir" << nl;
}
}
// Force removal before continuing
Foam::rmDir(dirA, true);
Foam::rmDir(dirB, true);
Foam::rmDir(dirC, true);
Foam::rmDir(dirD, true);
}
Foam::rmDir(dirB);
Info<< nl << "=========================" << nl
<< "Test some copying and deletion" << endl;
@ -666,7 +618,9 @@ int main(int argc, char *argv[])
);
Info<<" create: " << file << endl;
touchFileContent(file);
std::ofstream os(file);
os << "file=<" << file << ">" << nl;
}
const int oldDebug = POSIX::debug;
@ -754,7 +708,7 @@ int main(int argc, char *argv[])
"hello1",
"hello2",
"hello3",
"hello4.ext"
"hello4.hmm"
};
fileName pathName(wrdList);
@ -764,28 +718,14 @@ int main(int argc, char *argv[])
<< "pathName.name() = >" << pathName.name() << "<\n"
<< "pathName.path() = " << pathName.path() << nl
<< "pathName.ext() = >" << pathName.ext() << "<\n"
<< "pathName.stem = >" << pathName.stem() << "<\n";
<< "pathName.nameLessExt= >" << pathName.nameLessExt() << "<\n";
Info<< "pathName.components() = " << pathName.components() << nl
<< "pathName.component(2) = " << pathName.component(2) << nl
<< endl;
pathName.replace_name("newName.ext");
Info<< "new name = " << pathName << nl;
Info<< "has ext = " << Switch::name(pathName.has_ext()) << nl;
Info<< "has ext('') = " << Switch::name(pathName.has_ext("")) << nl;
Info<< "has ext(foo) = " << Switch::name(pathName.has_ext("foo")) << nl;
Info<< "has ext(ext) = " << Switch::name(pathName.has_ext("ext")) << nl;
pathName.replace_ext("png");
Info<< "new ext = " << pathName << nl;
pathName.replace_ext(""); // Same as remove_ext
Info<< "new ext = " << pathName << nl;
Info<< "has path = " << Switch::name(pathName.has_path()) << nl;
pathName.remove_path();
pathName.removePath(); // second type should be a no-op
Info<< "hasPath = " << Switch(pathName.hasPath()) << nl;
pathName.removePath();
Info<< "removed path = " << pathName << nl;
Info<< nl << nl;

View File

@ -64,8 +64,13 @@ int main(int argc, char *argv[])
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
treeBoundBox bb(efem.points());
bb.grow(ROOTVSMALL);
treeBoundBox bb
(
efem.points()
);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
labelList allEdges(identity(efem.edges().size()));

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -61,10 +61,10 @@ int main(int argc, char *argv[])
InfoErr<< "output: " << outputName;
IOstreamOption::compressionType comp(IOstreamOption::UNCOMPRESSED);
if (outputName.has_ext("gz"))
if (outputName.hasExt("gz"))
{
comp = IOstreamOption::COMPRESSED;
outputName.remove_ext();
outputName.removeExt();
InfoErr<< " [compress]";
}

View File

@ -204,7 +204,7 @@ int main(int argc, char *argv[])
labelPair inOut;
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
inOut[0] = allCcs.size();
Pstream::broadcast(allCcs);
Pstream::scatter(allCcs);
inOut[1] = allCcs.size();
Pout<< " " << inOut << endl;

View File

@ -41,8 +41,8 @@ void printInfo(const labelRange& range)
<< "last " << range.last() << nl
<< "min " << range.min() << nl
<< "max " << range.max() << nl
<< "end " << range.end_value() << nl
<< "begin/end " << *range.cbegin() << ' ' << *range.cend() << nl;
<< "after " << range.after() << nl
<< "begin end " << *range.cbegin() << ' ' << *range.cend() << nl;
// Info<< "rbegin rend " << *range.rbegin() << ' ' << *range.rend() << nl;
}
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
argList::noParallel();
argList::noFunctionObjects();
argList::addArgument("start size .. startN sizeN");
argList::addVerboseOption("enable labelRange::debug");
argList::addVerbose("enable labelRange::debug");
argList::addNote
(
"The default is to add ranges, use 'add' and 'del' to toggle\n\n"

View File

@ -44,7 +44,7 @@ using namespace Foam;
template<class T>
Ostream& printInfo(const MinMax<T>& range)
{
Info<< range << " good=" << range.good() << " span=" << range.span();
Info<< range << " valid=" << range.valid() << " span=" << range.span();
return Info;
}
@ -234,7 +234,11 @@ int main(int argc, char *argv[])
Pout<< "hashed: " << hashed << nl;
Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>());
Pstream::mapCombineGather
(
hashed,
plusEqOp<scalarMinMax>()
);
Info<< "reduced: " << hashed << nl;

View File

@ -44,7 +44,7 @@ using namespace Foam;
template<class T>
Ostream& printInfo(const MinMax<T>& range)
{
Info<< range << " good=" << range.good();
Info<< range << " valid=" << range.valid();
return Info;
}

View File

@ -1,4 +1,4 @@
EXE_INC = $(COMP_OPENMP)
EXE_INC = $(COMP_OPENMP) /* -UUSE_OMP */
/* Mostly do not need to explicitly link openmp libraries */
/* EXE_LIBS = $(LINK_OPENMP) */

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,6 +41,12 @@ Description
int main(int argc, char *argv[])
{
#if USE_OMP
std::cout << "USE_OMP defined (" << USE_OMP << ")\n";
#else
std::cout << "USE_OMP undefined\n";
#endif
#if _OPENMP
std::cout << "_OPENMP = " << _OPENMP << "\n\n";

View File

@ -167,7 +167,7 @@ int main(int argc, char *argv[])
(
localValue,
sumOp<scalar>(),
UPstream::msgType(),
Pstream::msgType(),
comm
);
Pout<< "sum :" << sum << endl;

View File

@ -125,13 +125,13 @@ int main(int argc, char *argv[])
scalar data1 = 1.0;
label request1 = -1;
{
Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1);
}
scalar data2 = 0.1;
label request2 = -1;
{
Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2);
Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2);
}

View File

@ -232,7 +232,6 @@ int main(int argc, char *argv[])
const labelListList& edgeFaces = pp.edgeFaces();
const labelListList& faceEdges = pp.faceEdges();
Pout<< "box: " << pp.box() << endl;
checkFaceEdges(localFaces, edges, faceEdges);

View File

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

View File

@ -1,9 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfileFormats \
-lsurfMesh \
-lmeshTools

View File

@ -1,168 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 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-rawIOField
Description
Reading rawIOField from disk
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "Switch.H"
#include "primitiveFields.H"
#include "pointField.H"
#include "rawIOField.H"
#include "exprTraits.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
using namespace Foam;
#undef USE_ROOT_CASE
//#define USE_ROOT_CASE
template<class Type>
tmp<Field<Type>> readRawField
(
const IOobject& io,
IOobjectOption::readOption withAverage
)
{
rawIOField<Type> raw(io, withAverage);
Info<< "File: " << io.objectPath() << nl
<< "Read: " << raw.size()
<< ' ' << pTraits<Type>::typeName << " entries" << nl
<< "Average: " << Switch::name(raw.hasAverage())
<< " = " << raw.average() << endl;
return tmp<Field<Type>>::New(std::move(static_cast<Field<Type>&>(raw)));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Test behaviour of rawIOField reading (writing?)"
);
argList::noCheckProcessorDirectories();
argList::addBoolOption("scalar", "Read scalar field");
argList::addBoolOption("vector", "Read vector field");
argList::addBoolOption("point", "Read point field");
argList::addBoolOption("average", "Require averaged value entry");
argList::addBoolOption("try-average", "Optional averaged value entry");
argList::addArgument("fileName");
#ifdef USE_ROOT_CASE
#include "setRootCase.H"
#include "createTime.H"
#else
// Without root case, or time
argList args(argc, argv);
#endif
fileName inputName = args.get<fileName>(1);
IOobjectOption::readOption withAverage = IOobjectOption::NO_READ;
if (args.found("average"))
{
withAverage = IOobjectOption::MUST_READ;
}
else if (args.found("try-average"))
{
withAverage = IOobjectOption::READ_IF_PRESENT;
}
Info<< "Using case: " << argList::envGlobalPath() << nl
<< "Read file: " << inputName << nl
<< "with average: " << int(withAverage) << nl
<< endl;
refPtr<Time> timePtr;
#ifdef USE_ROOT_CASE
timePtr.cref(runTime);
#endif
// Fallback (eg, no runTime)
if (!timePtr.good())
{
timePtr.reset(Time::New(argList::envGlobalPath()));
}
const auto& tm = timePtr();
fileName resolvedName(inputName);
resolvedName.toAbsolute();
IOobject io
(
resolvedName, // absolute path
tm,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER,
true // is global object (currently not used)
);
if (args.found("scalar"))
{
auto tfield = readRawField<scalar>(io, withAverage);
}
else if (args.found("point"))
{
auto tfield = readRawField<point>(io, withAverage);
}
else if (args.found("vector"))
{
auto tfield = readRawField<vector>(io, withAverage);
}
else
{
Info<< "no data type specified!\n";
}
Info<< nl << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -135,7 +135,6 @@ int main(int argc, char *argv[])
cout<<"string:" << sizeof(Foam::string) << nl;
}
cout<<"IOobjectOption:" << sizeof(Foam::IOobjectOption) << nl;
cout<<"IOobject:" << sizeof(Foam::IOobject) << nl;
cout<<"IOstream:" << sizeof(Foam::IOstream) << nl;
cout<<"PstreamBuffers:" << sizeof(Foam::PstreamBuffers) << nl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -91,15 +91,15 @@ int main(int argc, char *argv[])
const auto importName = args.get<fileName>(1);
word ext =
(
importName.has_ext("gz")
? importName.stem().ext()
: importName.ext()
);
// Allow override of extension
args.readIfPresent("ext", ext);
word ext;
if (!args.readIfPresent("ext", ext))
{
ext = importName.ext();
if (ext == "gz")
{
ext = importName.lessExt().ext();
}
}
args.readIfPresent("stl-parser", fileFormats::STLReader::parserType);

View File

@ -33,7 +33,6 @@ Description
#include "vectorField.H"
#include "IOstreams.H"
#include "Random.H"
#include <algorithm>
#include <random>
@ -75,12 +74,8 @@ void doTest(vector& vec1, vector& vec2)
printInfo(vec1);
printInfo(vec2);
Info<< "vector: " << vec1 << nl
<< "vector: " << vec2 << nl
<< " min: " << min(vec1, vec2) << nl
<< " dist: " << vec1.dist(vec2) << ' ' << mag(vec1 - vec2) << nl
<< "dist^2: " << vec1.distSqr(vec2) << ' ' << magSqr(vec1 - vec2) << nl
<< nl;
Info<< "min of " << vec1 << " and " << vec2 << " = "
<< min(vec1, vec2) << nl << nl;
}
@ -151,46 +146,6 @@ int main(int argc, char *argv[])
std::shuffle(vec2.begin(), vec2.end(), std::default_random_engine());
Info<< "shuffled: " << vec2 << nl;
// Vectors with some identical components
List<vector> vectors
({
{1.1, 2.2, 3.3 },
{2.2, 3.3, 4.4 },
{-1.1, 2.2, 3.3 },
{-2.2, 3.3, 4.4 },
{-1.1, -2.2, 3.3 },
{-2.2, -3.3, 4.4 },
{-1.1, -2.2, -3.3 },
{-2.2, -3.3, -4.4 },
{-3.3, 2.1, 12 },
{3.145, 1.6, 2 },
{0, 0, 0}
});
shuffle(vectors);
Info<< "initial vectors: ";
vectors.writeList(Info, 1) << nl;
Foam::sort(vectors);
Info<< "regular sort:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_xyz);
Info<< "sorted xyz:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_yzx);
Info<< "sorted yzx:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_zxy);
Info<< "sorted zxy:";
vectors.writeList(Info, 1) << nl;
}
// Basic tests for fields

View File

@ -585,7 +585,7 @@ void createBaffles
// Wrapper around find patch. Also makes sure same patch in parallel.
label findPatch(const polyBoundaryMesh& patches, const word& patchName)
{
const label patchi = patches.findPatchID(patchName);
label patchi = patches.findPatchID(patchName);
if (patchi == -1)
{
@ -597,15 +597,16 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
// Check same patch for all procs
{
const label newPatchi = returnReduce(patchi, minOp<label>());
label newPatch = patchi;
reduce(newPatch, minOp<label>());
if (newPatchi != patchi)
if (newPatch != patchi)
{
FatalErrorInFunction
<< "Patch " << patchName
<< " should have the same patch index on all processors." << nl
<< "On my processor it has index " << patchi
<< " ; on some other processor it has index " << newPatchi
<< " ; on some other processor it has index " << newPatch
<< exit(FatalError);
}
}

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -397,11 +396,12 @@ int main(int argc, char *argv[])
meshSearch queryMesh(mesh);
// Check all 'outside' points
for (const point& outsidePoint : outsidePts)
forAll(outsidePts, outsideI)
{
const label celli = queryMesh.findCell(outsidePoint, -1, false);
const point& outsidePoint = outsidePts[outsideI];
if (returnReduceAnd(celli < 0))
label celli = queryMesh.findCell(outsidePoint, -1, false);
if (returnReduce(celli, maxOp<label>()) == -1)
{
FatalErrorInFunction
<< "outsidePoint " << outsidePoint

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -175,7 +175,7 @@ int main(int argc, char *argv[])
// strip erroneous extension (.ccm, .ccmg, .ccmp)
if (ext == "ccm" || ext == "ccmg" || ext == "ccmp")
{
exportName.remove_ext();
exportName = exportName.lessExt();
}
}
else if (args.found("export"))

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
// strip erroneous extension (.ccm, .ccmg, .ccmp)
if (ext == "ccm" || ext == "ccmg" || ext == "ccmp")
{
exportName.remove_ext();
exportName = exportName.lessExt();
}
}
else if (args.found("case"))

View File

@ -1,4 +0,0 @@
ensightMeshReader.C
ensightToFoam.C
EXE = $(FOAM_APPBIN)/ensightToFoam

View File

@ -1,11 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/conversion/lnInclude
EXE_LIBS = \
-lfileFormats \
-lsurfMesh \
-lmeshTools \
-lconversion

View File

@ -1,194 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 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/>.
Class
Foam::fileFormats::ensightMeshReader
Description
Notes
SourceFiles
ensightMeshReader.C
\*---------------------------------------------------------------------------*/
#ifndef Foam_ensightMeshReader_H
#define Foam_ensightMeshReader_H
#include "meshReader.H"
//#include "ensightReadFile.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class ensightReadFile;
namespace fileFormats
{
/*---------------------------------------------------------------------------*\
Class fileFormats::ensightMeshReader Declaration
\*---------------------------------------------------------------------------*/
class ensightMeshReader
:
public meshReader
{
// Private Data
//- Merge distance
const scalar mergeTol_;
//- Check and correct handedness
const bool setHandedness_;
protected:
// Protected Data
//- mesh point to original node_id
labelList nodeIds_;
//- mesh cell to original element_id
labelList elementIds_;
// Protected Member Functions
//- Rotate face so lowest vertex is first
const face& rotateFace
(
const face& f,
face& rotatedFace
) const;
//- Read set of vertices. Optional mapping
void readVerts
(
ensightReadFile& is,
const label nVerts,
const Map<label>& nodeIdToPoints,
DynamicList<label>& verts
) const;
//- Read set of element/node IDs
void readIDs
(
ensightReadFile& is,
const bool doRead,
const label nShapes,
labelList& foamToElem,
Map<label>& elemToFoam
) const;
//- Swap handedness of hex if needed
void setHandedness
(
const cellModel& model,
DynamicList<label>& verts,
const pointField& points
) const;
//- Read a single part until eof (return true) or until start of next
// part (return false)
bool readGoldPart
(
ensightReadFile& is,
const bool read_node_ids,
const bool read_elem_ids,
pointField& points,
labelList& pointToNodeIds,
Map<label>& nodeIdToPoints,
// 3D-elems : cells (cell-to-faces)
faceListList& cellFaces,
labelList& cellToElemIds,
Map<label>& elemIdToCells,
// 2D-elems : faces
faceList& faces,
labelList& faceToElemIDs,
Map<label>& elemIdToFaces
) const;
//- Read the mesh from the file(s)
virtual bool readGeometry(const scalar scaleFactor = 1.0);
public:
//- Runtime type information
TypeName("ensightMeshReader");
// Constructors
//- Construct from case name
ensightMeshReader
(
const fileName& geomFile,
const objectRegistry& registry,
const scalar mergeTol = SMALL,
const scalar scaleFactor = 1.0,
const bool setHandedness = true
);
//- Destructor
virtual ~ensightMeshReader() = default;
// Access
//- Original node id (if supplied) or -1
const labelList& nodeIds() const noexcept
{
return nodeIds_;
}
//- Original element id (if supplied) or -1
const labelList& elementIds() const noexcept
{
return elementIds_;
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fileFormats
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,118 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 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
ensightToFoam
Group
grpMeshConversionUtilities
Description
Convert an Ensight Gold mesh into OpenFOAM format.
Usage
\b ensightToFoam [OPTION] \<ensightGeometryFile\>
Options:
- \par -mergeTol \<factor\>
Specify an alternative merging tolerance as a fraction of
the bounding box of the points.
- \par -scale \<factor\>
Specify an optional geometry scaling factor.
- \par -keepHandedness
Do not automatically flip negative volume cells
See also
Foam::meshReader and Foam::fileFormats::STARCDMeshReader
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "ensightMeshReader.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Convert Ensight mesh to OpenFOAM"
);
argList::noParallel();
argList::addArgument(".geo file", "The file containing the geometry");
argList::addOption
(
"mergeTol",
"factor",
"Merge tolerance as a fraction of bounding box - 0 to disable merging"
);
argList::addOption
(
"scale",
"factor",
"Geometry scaling factor - default is 1"
);
argList::addBoolOption
(
"keepHandedness",
"Do not automatically flip inverted cells"
" (default is to do a geometric test)"
);
argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName());
// Increase the precision of the points data
IOstream::defaultPrecision(max(10u, IOstream::defaultPrecision()));
const fileName geomFile(args.get<fileName>(1));
{
fileFormats::ensightMeshReader reader
(
geomFile,
runTime,
args.getOrDefault<scalar>("mergeTol", 1e-10),
args.getOrDefault<scalar>("scale", 1.0),
args.found("keepHandedness")
);
autoPtr<polyMesh> mesh = reader.mesh(runTime);
mesh().setInstance(runTime.constant());
mesh().write();
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,8 +87,8 @@ int main(int argc, char *argv[])
const scalar scaleFactor = args.getOrDefault<scalar>("scale", 0);
const bool doTriangulate = args.found("tri");
const fileName exportBase = exportName.lessExt();
const word exportExt = exportName.ext();
fileName exportBase = exportName.lessExt();
word exportExt = exportName.ext();
if (!meshedSurface::canWriteType(exportExt, true))
{

View File

@ -538,11 +538,8 @@ int main(int argc, char *argv[])
// Add any patches.
const label nAdded = returnReduce
(
nPatches - mesh.boundaryMesh().size(),
sumOp<label>()
);
label nAdded = nPatches - mesh.boundaryMesh().size();
reduce(nAdded, sumOp<label>());
Info<< "Adding overall " << nAdded << " processor patches." << endl;
@ -949,8 +946,9 @@ int main(int argc, char *argv[])
// Put all modifications into meshMod
bool anyChange = collapser.setRefinement(allPointInfo, meshMod);
reduce(anyChange, orOp<bool>());
if (returnReduceOr(anyChange))
if (anyChange)
{
// Construct new mesh from polyTopoChange.
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
@ -1120,7 +1118,8 @@ int main(int argc, char *argv[])
processorMeshes::removeFiles(mesh);
// Need writing cellSet
if (returnReduceOr(addedCellsSet.size()))
label nAdded = returnReduce(addedCellsSet.size(), sumOp<label>());
if (nAdded > 0)
{
cellSet addedCells(mesh, "addedCells", addedCellsSet);
Info<< "Writing added cells to cellSet " << addedCells.name()

View File

@ -345,7 +345,7 @@ void deleteEmptyPatches(fvMesh& mesh)
else
{
// Common patch.
if (returnReduceAnd(patches[patchi].empty()))
if (returnReduce(patches[patchi].empty(), andOp<bool>()))
{
Pout<< "Deleting patch " << patchi
<< " name:" << patches[patchi].name()
@ -661,8 +661,8 @@ void countExtrudePatches
}
// Synchronise decision. Actual numbers are not important, just make
// sure that they're > 0 on all processors.
Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>());
Pstream::listCombineReduce(zoneZonePatch, plusEqOp<label>());
Pstream::listCombineAllGather(zoneSidePatch, plusEqOp<label>());
Pstream::listCombineAllGather(zoneZonePatch, plusEqOp<label>());
}
@ -1848,7 +1848,7 @@ int main(int argc, char *argv[])
const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points());
Pstream::listCombineReduce(isInternal, orEqOp<bool>());
Pstream::listCombineAllGather(isInternal, orEqOp<bool>());
// Check zone either all internal or all external faces
checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
@ -2309,7 +2309,7 @@ int main(int argc, char *argv[])
}
// Reduce
Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>());
forAll(localToGlobalRegion, localRegionI)
{

View File

@ -588,8 +588,9 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
reduce(preInsertionSize, sumOp<label>());
reduce(postInsertionSize, sumOp<label>());
label nTotalToInsert =
returnReduce(referredVertices.size(), sumOp<label>());
label nTotalToInsert = referredVertices.size();
reduce(nTotalToInsert, sumOp<label>());
if (preInsertionSize + nTotalToInsert != postInsertionSize)
{

View File

@ -167,7 +167,14 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
if (volumeStatus[celli] == volumeType::UNKNOWN)
{
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
treeBoundBox cellBb
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
if (geometry.overlaps(cellBb))
{
@ -217,7 +224,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
);
}
if (returnReduceAnd(newCellsToRefine.empty()))
if (returnReduce(newCellsToRefine.size(), sumOp<label>()) == 0)
{
break;
}
@ -279,7 +286,14 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
{
if (volumeStatus[celli] == volumeType::UNKNOWN)
{
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
treeBoundBox cellBb
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
if (geometry.overlaps(cellBb))
{
@ -498,7 +512,14 @@ bool Foam::backgroundMeshDecomposition::refineCell
// const conformationSurfaces& geometry = geometryToConformTo_;
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
treeBoundBox cellBb
(
mesh_.cells()[celli].points
(
mesh_.faces(),
mesh_.points()
)
);
weightEstimate = 1.0;
@ -878,7 +899,7 @@ Foam::backgroundMeshDecomposition::distribute
}
}
if (returnReduceAnd(cellsToRefine.empty()))
if (returnReduce(cellsToRefine.size(), sumOp<label>()) == 0)
{
break;
}

View File

@ -153,7 +153,7 @@ public:
return name_;
}
Switch forceInitialPointInsertion() const noexcept
const Switch& forceInitialPointInsertion() const
{
return forceInitialPointInsertion_;
}

View File

@ -92,7 +92,9 @@ bool Foam::controlMeshRefinement::detectEdge
magSqr(a - b) < tolSqr
)
{
pointFound.hitPoint(midPoint);
pointFound.setPoint(midPoint);
pointFound.setHit();
return true;
}
@ -262,7 +264,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
const cellSizeAndAlignmentControl& controlFunction =
controlFunctions[fI];
const Switch forceInsertion =
const Switch& forceInsertion =
controlFunction.forceInitialPointInsertion();
Info<< "Inserting points from " << controlFunction.name()
@ -448,7 +450,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
const cellSizeAndAlignmentControl& controlFunction =
controlFunctions[fI];
const Switch forceInsertion =
const Switch& forceInsertion =
controlFunction.forceInitialPointInsertion();
Info<< "Inserting points from " << controlFunction.name()

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -298,7 +298,7 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::automatic::load()
(
surface_.searchableSurface::time().constant()
/ "triSurface"
/ surfaceName_.stem() + "_cellSize"
/ surfaceName_.nameLessExt() + "_cellSize"
)
);

View File

@ -38,7 +38,6 @@ Description
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2016 OpenFOAM Foundation
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,17 +87,23 @@ void Foam::conformalVoronoiMesh::cellSizeMeshOverlapsBackground() const
boundBox cellSizeMeshBb = cellSizeMesh.bounds();
bool fullyContained = cellSizeMeshBb.contains(bb);
bool fullyContained = true;
if (!fullyContained)
if (!cellSizeMeshBb.contains(bb))
{
Pout<< "Triangulation not fully contained in cell size mesh." << endl
<< "Cell Size Mesh Bounds = " << cellSizeMeshBb << endl
<< "foamyHexMesh Bounds = " << bb << endl;
Pout<< "Triangulation not fully contained in cell size mesh."
<< endl;
Pout<< "Cell Size Mesh Bounds = " << cellSizeMesh.bounds() << endl;
Pout<< "foamyHexMesh Bounds = " << bb << endl;
fullyContained = false;
}
reduce(fullyContained, andOp<unsigned int>());
Info<< "Triangulation is "
<< (returnReduceAnd(fullyContained) ? "fully" : "not fully")
<< (fullyContained ? "fully" : "not fully")
<< " contained in the cell size mesh"
<< endl;
}
@ -109,7 +115,12 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
bool distribute
)
{
const label nPoints = returnReduce(points.size(), sumOp<label>());
label nPoints = points.size();
if (Pstream::parRun())
{
reduce(nPoints, sumOp<label>());
}
Info<< " " << nPoints << " points to insert..." << endl;
@ -134,15 +145,16 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
map().distribute(points);
}
label preReinsertionSize(number_of_vertices());
label nVert = number_of_vertices();
insert(points.begin(), points.end());
const label nInserted = returnReduce
(
label(number_of_vertices()) - preReinsertionSize,
sumOp<label>()
);
label nInserted(number_of_vertices() - nVert);
if (Pstream::parRun())
{
reduce(nInserted, sumOp<label>());
}
Info<< " " << nInserted << " points inserted"
<< ", failed to insert " << nPoints - nInserted

View File

@ -753,7 +753,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
forAll(patches, p)
{
label nPatchFaces = patchDicts[p].get<label>("nFaces");
label totalPatchSize = patchDicts[p].get<label>("nFaces");
if
(
@ -762,7 +762,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
)
{
// Do not create empty processor patches
if (nPatchFaces)
if (totalPatchSize > 0)
{
patchDicts[p].set("transform", "coincidentFullMatch");
@ -781,8 +781,9 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
else
{
// Check that the patch is not empty on every processor
reduce(totalPatchSize, sumOp<label>());
if (returnReduceOr(nPatchFaces))
if (totalPatchSize > 0)
{
patches[nValidPatches] = polyPatch::New
(

View File

@ -729,7 +729,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
}
}
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
forAll(surfaceHits, eI)
{
@ -816,7 +816,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
}
}
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
forAll(featureEdgeHits, eI)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -707,7 +707,9 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
Info<< incrIndent << indent << "Faces matched." << endl;
if (returnReduceOr(anyChanged))
reduce(anyChanged, orOp<bool>());
if (anyChanged)
{
label nReorderedFaces = 0;

View File

@ -44,7 +44,6 @@ SourceFiles
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -45,7 +45,6 @@ SourceFiles
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -605,7 +605,7 @@ Foam::conformationSurfaces::conformationSurfaces
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::conformationSurfaces::overlaps(const boundBox& bb) const
bool Foam::conformationSurfaces::overlaps(const treeBoundBox& bb) const
{
forAll(surfaces_, s)
{

View File

@ -188,7 +188,7 @@ public:
//- Check if the supplied bound box overlaps any part of any of
// the surfaces
bool overlaps(const boundBox& bb) const;
bool overlaps(const treeBoundBox& bb) const;
//- Check if points are inside surfaces to conform to
Field<bool> inside(const pointField& samplePts) const;

View File

@ -84,12 +84,16 @@ Foam::searchableBoxFeatures::features() const
autoPtr<extendedFeatureEdgeMesh> features;
List<vector> faceNormalsList(treeBoundBox::faceNormals);
vectorField faceNormals(std::move(faceNormalsList));
vectorField faceNormals(faceNormalsList);
vectorField edgeDirections(12);
labelListList normalDirections(12, labelList(2, Zero));
labelListList edgeNormals(12, labelList(2, Zero));
labelListList normalDirections(12);
labelListList edgeNormals(12);
forAll(edgeNormals, eI)
{
edgeNormals[eI].setSize(2, 0);
}
edgeNormals[0][0] = 2; edgeNormals[0][1] = 4;
edgeNormals[1][0] = 1; edgeNormals[1][1] = 4;
edgeNormals[2][0] = 3; edgeNormals[2][1] = 4;
@ -112,6 +116,7 @@ Foam::searchableBoxFeatures::features() const
surfacePoints[treeBoundBox::edges[eI].end()]
- surfacePoints[treeBoundBox::edges[eI].start()];
normalDirections[eI] = labelList(2, Zero);
for (label j = 0; j < 2; ++j)
{
const vector cross =
@ -133,12 +138,12 @@ Foam::searchableBoxFeatures::features() const
}
}
labelListList featurePointNormals(8, labelList(3, Zero));
labelListList featurePointEdges(8, labelList(3, Zero));
labelListList featurePointNormals(8);
labelListList featurePointEdges(8);
forAll(featurePointNormals, pI)
{
labelList& ftPtEdges = featurePointEdges[pI];
ftPtEdges.setSize(3, 0);
label edgeI = 0;
forAll(treeBoundBox::edges, eI)
@ -156,6 +161,7 @@ Foam::searchableBoxFeatures::features() const
}
labelList& ftPtNormals = featurePointNormals[pI];
ftPtNormals.setSize(3, 0);
ftPtNormals[0] = edgeNormals[ftPtEdges[0]][0];
ftPtNormals[1] = edgeNormals[ftPtEdges[0]][1];

View File

@ -727,12 +727,14 @@ int main(int argc, char *argv[])
pointField mergedPoints;
faceList mergedFaces;
labelList pointMergeMap;
PatchTools::gatherAndMerge
(
tolDim,
primitivePatch(SubList<face>(isoFaces), isoPoints),
mergedPoints,
mergedFaces
mergedFaces,
pointMergeMap
);
if (Pstream::master())

View File

@ -38,7 +38,6 @@ Description
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -40,7 +40,6 @@ Description
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
// ------------------------------------------------------------------------- //

View File

@ -416,12 +416,10 @@ void extractSurface
// Allocate zone/patch for all patches
HashTable<label> compactZoneID(1024);
if (Pstream::master())
forAllConstIters(patchSize, iter)
{
forAllConstIters(patchSize, iter)
{
compactZoneID.insert(iter.key(), compactZoneID.size());
}
label sz = compactZoneID.size();
compactZoneID.insert(iter.key(), sz);
}
Pstream::broadcast(compactZoneID);
@ -433,7 +431,7 @@ void extractSurface
label patchi = bMesh.findPatchID(iter.key());
if (patchi != -1)
{
patchToCompactZone[patchi] = iter.val();
patchToCompactZone[patchi] = iter();
}
}
@ -665,7 +663,7 @@ void removeZeroSizedPatches(fvMesh& mesh)
if
(
isA<coupledPolyPatch>(pp)
|| returnReduceOr(pp.size())
|| returnReduce(pp.size(), sumOp<label>())
)
{
// Coupled (and unknown size) or uncoupled and used
@ -1891,8 +1889,11 @@ int main(int argc, char *argv[])
);
// Use the maxLocalCells from the refinement parameters
const bool preBalance =
returnReduceOr(mesh.nCells() >= refineParams.maxLocalCells());
bool preBalance = returnReduce
(
(mesh.nCells() >= refineParams.maxLocalCells()),
orOp<bool>()
);
if (!overwrite && !debugLevel)

View File

@ -104,6 +104,9 @@ void Foam::checkPatch
// << endl;
}
//DebugVar(globalEdgeFaces);
// Synchronise across coupled edges.
syncTools::syncEdgeList
(
@ -113,6 +116,7 @@ void Foam::checkPatch
labelList() // null value
);
//DebugVar(globalEdgeFaces);
label labelTyp = TopoType::MANIFOLD;
forAll(meshEdges, edgei)
@ -187,7 +191,7 @@ void Foam::checkPatch
{
const labelList& mp = pp.meshPoints();
if (returnReduceOr(mp.size()))
if (returnReduce(mp.size(), sumOp<label>()) > 0)
{
boundBox bb(pp.points(), mp, true); // reduce
Info<< ' ' << bb;
@ -196,35 +200,6 @@ void Foam::checkPatch
}
template<class Zone>
Foam::label Foam::checkZones
(
const polyMesh& mesh,
const ZoneMesh<Zone, polyMesh>& zones,
topoSet& set
)
{
labelList zoneID(set.maxSize(mesh), -1);
for (const auto& zone : zones)
{
for (const label elem : zone)
{
if
(
zoneID[elem] != -1
&& zoneID[elem] != zone.index()
)
{
set.insert(elem);
}
zoneID[elem] = zone.index();
}
}
return returnReduce(set.size(), sumOp<label>());
}
Foam::label Foam::checkTopology
(
const polyMesh& mesh,
@ -252,10 +227,10 @@ Foam::label Foam::checkTopology
}
}
reduce(nEmpty, sumOp<label>());
const label nCells = returnReduce(mesh.cells().size(), sumOp<label>());
label nTotCells = returnReduce(mesh.cells().size(), sumOp<label>());
// These are actually warnings, not errors.
if (nCells && (nEmpty % nCells))
if (nTotCells && (nEmpty % nTotCells))
{
Info<< " ***Total number of faces on empty patches"
<< " is not divisible by the number of cells in the mesh."
@ -335,7 +310,7 @@ Foam::label Foam::checkTopology
{
noFailedChecks++;
const label nPoints = returnReduce(points.size(), sumOp<label>());
label nPoints = returnReduce(points.size(), sumOp<label>());
Info<< " <<Writing " << nPoints
<< " unused points to set " << points.name() << endl;
@ -472,7 +447,7 @@ Foam::label Foam::checkTopology
}
}
const label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
if (nOneCells > 0)
{
@ -488,7 +463,7 @@ Foam::label Foam::checkTopology
}
}
const label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
if (nTwoCells > 0)
{
@ -588,7 +563,11 @@ Foam::label Foam::checkTopology
}
}
Pstream::listCombineReduce(regionDisconnected, andEqOp<bool>());
Pstream::listCombineAllGather
(
regionDisconnected,
andEqOp<bool>()
);
}
@ -635,7 +614,7 @@ Foam::label Foam::checkTopology
cellRegions[i].write();
}
const label nPoints = returnReduce(points.size(), sumOp<label>());
label nPoints = returnReduce(points.size(), sumOp<label>());
if (nPoints)
{
Info<< " <<Writing " << nPoints
@ -735,25 +714,6 @@ Foam::label Foam::checkTopology
);
Info<< endl;
}
// Check for duplicates
if (allTopology)
{
faceSet mzFaces(mesh, "multiZoneFaces", mesh.nFaces()/100);
const label nMulti = checkZones(mesh, faceZones, mzFaces);
if (nMulti)
{
Info<< " <<Writing " << nMulti
<< " faces that are in multiple zones"
<< " to set " << mzFaces.name() << endl;
mzFaces.instance() = mesh.pointsInstance();
mzFaces.write();
if (surfWriter && surfWriter->enabled())
{
mergeAndWrite(*surfWriter, mzFaces);
}
}
}
}
else
{
@ -831,26 +791,6 @@ Foam::label Foam::checkTopology
<< returnReduce(v, sumOp<scalar>())
<< ' ' << bb << endl;
}
// Check for duplicates
if (allTopology)
{
cellSet mzCells(mesh, "multiZoneCells", mesh.nCells()/100);
const label nMulti = checkZones(mesh, cellZones, mzCells);
if (nMulti)
{
Info<< " <<Writing " << nMulti
<< " cells that are in multiple zones"
<< " to set " << mzCells.name() << endl;
mzCells.instance() = mesh.pointsInstance();
mzCells.write();
if (surfWriter && surfWriter->enabled())
{
mergeAndWrite(*surfWriter, mzCells);
}
}
}
}
else
{
@ -858,65 +798,6 @@ Foam::label Foam::checkTopology
}
}
{
Info<< "\nChecking basic pointZone addressing..." << endl;
Pout.setf(ios_base::left);
const pointZoneMesh& pointZones = mesh.pointZones();
if (pointZones.size())
{
Info<< " "
<< setw(20) << "PointZone"
<< setw(8) << "Points"
<< "BoundingBox" << endl;
for (const auto& zone : pointZones)
{
boundBox bb;
for (const label pointi : zone)
{
bb.add(mesh.points()[pointi]);
}
bb.reduce(); // Global min/max
Info<< " "
<< setw(20) << zone.name()
<< setw(8)
<< returnReduce(zone.size(), sumOp<label>())
<< bb << endl;
}
// Check for duplicates
if (allTopology)
{
pointSet mzPoints(mesh, "multiZonePoints", mesh.nPoints()/100);
const label nMulti = checkZones(mesh, pointZones, mzPoints);
if (nMulti)
{
Info<< " <<Writing " << nMulti
<< " points that are in multiple zones"
<< " to set " << mzPoints.name() << endl;
mzPoints.instance() = mesh.pointsInstance();
mzPoints.write();
if (setWriter && setWriter->enabled())
{
mergeAndWrite(*setWriter, mzPoints);
}
}
}
}
else
{
Info<< " No pointZones found."<<endl;
}
}
// Force creation of all addressing if requested.
// Errors will be reported as required
if (allTopology)

View File

@ -1,7 +1,5 @@
#include "labelList.H"
#include "autoPtr.H"
#include "ZoneMesh.H"
#include "topoSet.H"
namespace Foam
{
@ -23,14 +21,6 @@ namespace Foam
pointSet& points
);
template<class Zone>
label checkZones
(
const polyMesh& mesh,
const ZoneMesh<Zone, polyMesh>& zones,
topoSet& set
);
label checkTopology
(
const polyMesh& mesh,

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -138,7 +138,7 @@ void filterPatches(fvMesh& mesh, const wordHashSet& addedPatchNames)
if
(
isA<coupledPolyPatch>(pp)
|| returnReduceOr(pp.size())
|| returnReduce(pp.size(), sumOp<label>())
|| addedPatchNames.found(pp.name())
)
{

View File

@ -686,7 +686,7 @@ void syncPoints
//- Note: hasTransformation is only used for warning messages so
// reduction not strictly necessary.
//Pstream::reduceOr(hasTransformation);
//reduce(hasTransformation, orOp<bool>());
// Synchronize multiple shared points.
const globalMeshData& pd = mesh.globalData();
@ -714,7 +714,7 @@ void syncPoints
}
// Combine - globally consistent
Pstream::listCombineReduce(sharedPts, cop);
Pstream::listCombineAllGather(sharedPts, cop);
// Now we will all have the same information. Merge it back with
// my local information.

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -273,7 +272,7 @@ int main(int argc, char *argv[])
}
if (returnReduceAnd(changedEdges.empty()))
if (returnReduce(changedEdges.size(), sumOp<label>()) == 0)
{
break;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -1103,7 +1103,9 @@ int main(int argc, char *argv[])
// Update proc maps
if (cellProcAddressing.headerOk())
{
if (returnReduceAnd(cellProcAddressing.size() == mesh.nCells()))
bool localOk = (cellProcAddressing.size() == mesh.nCells());
if (returnReduce(localOk, andOp<bool>()))
{
Info<< "Renumbering processor cell decomposition map "
<< cellProcAddressing.name() << endl;
@ -1127,7 +1129,9 @@ int main(int argc, char *argv[])
if (faceProcAddressing.headerOk())
{
if (returnReduceAnd(faceProcAddressing.size() == mesh.nFaces()))
bool localOk = (faceProcAddressing.size() == mesh.nFaces());
if (returnReduce(localOk, andOp<bool>()))
{
Info<< "Renumbering processor face decomposition map "
<< faceProcAddressing.name() << endl;
@ -1167,7 +1171,9 @@ int main(int argc, char *argv[])
if (pointProcAddressing.headerOk())
{
if (returnReduceAnd(pointProcAddressing.size() == mesh.nPoints()))
bool localOk = (pointProcAddressing.size() == mesh.nPoints());
if (returnReduce(localOk, andOp<bool>()))
{
Info<< "Renumbering processor point decomposition map "
<< pointProcAddressing.name() << endl;
@ -1191,13 +1197,12 @@ int main(int argc, char *argv[])
if (boundaryProcAddressing.headerOk())
{
if
bool localOk =
(
returnReduceAnd
(
boundaryProcAddressing.size() == mesh.boundaryMesh().size()
)
)
boundaryProcAddressing.size()
== mesh.boundaryMesh().size()
);
if (returnReduce(localOk, andOp<bool>()))
{
// No renumbering needed
}

View File

@ -847,7 +847,7 @@ void createAndWriteRegion
if (!isA<processorPolyPatch>(pp))
{
if (returnReduceOr(pp.size()))
if (returnReduce(pp.size(), sumOp<label>()) > 0)
{
oldToNew[patchi] = newI;
if (!addedPatches.found(patchi))
@ -1114,7 +1114,7 @@ label findCorrespondingRegion
}
}
Pstream::listCombineReduce(cellsInZone, plusEqOp<label>());
Pstream::listCombineAllGather(cellsInZone, plusEqOp<label>());
// Pick region with largest overlap of zoneI
label regionI = findMax(cellsInZone);

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2017 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -144,7 +144,11 @@ using namespace Foam;
// but leave anything with '/' delimiters untouched
bool upgradeScope(word& entryName)
{
if (!entryName.contains('/') && entryName.contains(':'))
if
(
entryName.find('/') == string::npos
&& entryName.find(':') != string::npos
)
{
const wordList names(fileName(entryName).components(':'));

View File

@ -223,7 +223,7 @@ bool writeOptionalMeshObject
// Make sure all know if there is a valid class name
wordList classNames(1, io.headerClassName());
Pstream::combineReduce(classNames, uniqueEqOp<word>());
Pstream::combineAllGather(classNames, uniqueEqOp<word>());
// Check for correct type
if (classNames[0] == T::typeName)
@ -429,7 +429,7 @@ int main(int argc, char *argv[])
)
);
Pstream::combineReduce(lagrangianDirs, uniqueEqOp<fileName>());
Pstream::combineAllGather(lagrangianDirs, uniqueEqOp<fileName>());
if (!lagrangianDirs.empty())
{
@ -466,7 +466,7 @@ int main(int argc, char *argv[])
)
);
Pstream::combineReduce(cloudDirs, uniqueEqOp<fileName>());
Pstream::combineAllGather(cloudDirs, uniqueEqOp<fileName>());
forAll(cloudDirs, i)
{
@ -492,7 +492,7 @@ int main(int argc, char *argv[])
);
// Combine with all other cloud objects
Pstream::combineReduce(cloudFields, uniqueEqOp<word>());
Pstream::combineAllGather(cloudFields, uniqueEqOp<word>());
for (const word& name : cloudFields)
{

View File

@ -252,7 +252,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
Info<< "mergeSharedPoints : detected " << pointToMaster.size()
<< " points that are to be merged." << endl;
if (returnReduceAnd(pointToMaster.empty()))
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
{
return nullptr;
}

View File

@ -69,7 +69,7 @@ Foam::boolList Foam::haveMeshFile
void Foam::removeProcAddressing(const faMesh& mesh)
{
IOobject io
IOobject ioAddr
(
"procAddressing",
mesh.facesInstance(),
@ -79,9 +79,9 @@ void Foam::removeProcAddressing(const faMesh& mesh)
for (const auto prefix : {"boundary", "edge", "face", "point"})
{
io.rename(prefix + word("ProcAddressing"));
ioAddr.rename(prefix + word("ProcAddressing"));
const fileName procFile(io.objectPath());
const fileName procFile(ioAddr.objectPath());
Foam::rm(procFile);
}
}
@ -89,7 +89,7 @@ void Foam::removeProcAddressing(const faMesh& mesh)
void Foam::removeProcAddressing(const polyMesh& mesh)
{
IOobject io
IOobject ioAddr
(
"procAddressing",
mesh.facesInstance(),
@ -99,18 +99,89 @@ void Foam::removeProcAddressing(const polyMesh& mesh)
for (const auto prefix : {"boundary", "cell", "face", "point"})
{
io.rename(prefix + word("ProcAddressing"));
ioAddr.rename(prefix + word("ProcAddressing"));
const fileName procFile(io.objectPath());
const fileName procFile(ioAddr.objectPath());
Foam::rm(procFile);
}
}
void Foam::removeEmptyDir(const fileName& path)
bool Foam::removeEmptyDir(const fileName& path)
{
// Remove directory: silent, emptyOnly
Foam::rmDir(path, true, true);
// Return true if empty directory. Note bypass of fileHandler to be
// consistent with polyMesh.removeFiles for now.
{
fileNameList files
(
Foam::readDir
(
path,
fileName::FILE,
false, // filterGz
false // followLink
)
);
if (files.size())
{
return false;
}
}
{
fileNameList dirs
(
Foam::readDir
(
path,
fileName::DIRECTORY,
false, // filterGz
false // followLink
)
);
if (dirs.size())
{
return false;
}
}
{
fileNameList links
(
Foam::readDir
(
path,
fileName::SYMLINK,
false, // filterGz
false // followLink
)
);
if (links.size())
{
return false;
}
}
{
fileNameList other
(
Foam::readDir
(
path,
fileName::UNDEFINED,
false, // filterGz
false // followLink
)
);
if (other.size())
{
return false;
}
}
// Avoid checking success of deletion since initial path might not
// exist (e.g. contain 'region0'). Will stop when trying to delete
// parent directory anyway since now not empty.
Foam::rm(path);
return true;
}

View File

@ -64,8 +64,8 @@ void removeProcAddressing(const faMesh& mesh);
//- Remove procAddressing
void removeProcAddressing(const polyMesh& mesh);
//- Remove empty directory
void removeEmptyDir(const fileName& path);
//- Remove empty directory. Return true if removed.
bool removeEmptyDir(const fileName& path);
//- Remove empty directories from bottom up
void removeEmptyDirs(const fileName& path);

View File

@ -224,7 +224,7 @@ Foam::parFvFieldDistributor::distributeField
}
// Map all faces
primitiveField = Field<Type>(flatFld, mapper, fld.is_oriented());
primitiveField = Field<Type>(flatFld, mapper, fld.oriented()());
// Trim to internal faces (note: could also have special mapper)
primitiveField.resize

View File

@ -89,11 +89,10 @@ void Foam::parLagrangianDistributor::findClouds
}
// Synchronise cloud names
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
Foam::sort(cloudNames); // Consistent order
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames);
objectNames.clear();
objectNames.resize(cloudNames.size());
objectNames.setSize(cloudNames.size());
for (const fileName& localCloudName : localCloudDirs)
{
@ -125,11 +124,11 @@ void Foam::parLagrangianDistributor::findClouds
}
}
// Synchronise objectNames (per cloud)
for (wordList& objNames : objectNames)
// Synchronise objectNames
forAll(objectNames, i)
{
Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
Foam::sort(objNames); // Consistent order
Pstream::combineGather(objectNames[i], ListOps::uniqueEqOp<word>());
Pstream::broadcast(objectNames[i]);
}
}
@ -292,7 +291,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
nsTransPs[sendProcI] = subMap[sendProcI].size();
}
// Send sizes across. Note: blocks.
Pstream::combineReduce(sizes, Pstream::listEq());
Pstream::combineAllGather(sizes, Pstream::listEq());
labelListList constructMap(Pstream::nProcs());
label constructSize = 0;

View File

@ -51,9 +51,14 @@ Foam::wordList Foam::parLagrangianDistributor::filterObjects
: objects.names<Container>(selectedFields)
);
// Parallel synchronise - combine names from all processors
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Foam::sort(fieldNames); // Consistent order
// Parallel synchronise
// - Combine names from all processors
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
// Sort for consistent order on all processors
Foam::sort(fieldNames);
return fieldNames;
}
@ -88,8 +93,11 @@ Foam::label Foam::parLagrangianDistributor::distributeFields
if (!nFields)
{
// Performing an all-to-one (reconstruct)?
reconstruct =
returnReduceAnd(!map.constructSize() || Pstream::master());
reconstruct = returnReduce
(
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
}
if (verbose_)
@ -192,8 +200,11 @@ Foam::label Foam::parLagrangianDistributor::distributeFieldFields
if (!nFields)
{
// Performing an all-to-one (reconstruct)?
reconstruct =
returnReduceAnd(!map.constructSize() || Pstream::master());
reconstruct = returnReduce
(
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
}
if (verbose_)
@ -338,8 +349,11 @@ Foam::label Foam::parLagrangianDistributor::distributeStoredFields
if (!nFields)
{
// Performing an all-to-one (reconstruct)?
reconstruct =
returnReduceAnd(!map.constructSize() || Pstream::master());
reconstruct = returnReduce
(
(!map.constructSize() || Pstream::master()),
andOp<bool>()
);
}
if (verbose_)

View File

@ -132,7 +132,7 @@ void createTimeDirs(const fileName& path)
//Pstream::parRun(oldParRun); // Restore parallel state
masterTimeDirs = localTimeDirs;
}
Pstream::broadcast(masterTimeDirs);
Pstream::scatter(masterTimeDirs);
//DebugVar(masterTimeDirs);
//DebugVar(localTimeDirs);
@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
bool nfs = true;
{
List<fileName> roots(1, args.rootPath());
Pstream::combineReduce(roots, ListOps::uniqueEqOp<fileName>());
Pstream::combineAllGather(roots, ListOps::uniqueEqOp<fileName>());
nfs = (roots.size() == 1);
}
@ -1187,8 +1187,7 @@ int main(int argc, char *argv[])
{
if (decompose)
{
Info<< "Removing existing processor directory:"
<< args.relativePath(procDir) << endl;
Info<< "Removing existing processor directory" << procDir << endl;
fileHandler().rmDir(procDir);
}
}
@ -1203,7 +1202,7 @@ int main(int argc, char *argv[])
}
}
// If master changed to decompose mode make sure all nodes know about it
Pstream::broadcast(decompose);
Pstream::scatter(decompose);
// If running distributed we have problem of new processors not finding
@ -1288,7 +1287,7 @@ int main(int argc, char *argv[])
// use the times list from the master processor
// and select a subset based on the command-line options
instantList timeDirs = timeSelector::select(runTime.times(), args);
Pstream::broadcast(timeDirs);
Pstream::scatter(timeDirs);
if (timeDirs.empty())
{
@ -1547,7 +1546,7 @@ int main(int argc, char *argv[])
if
(
!volMeshHaveUndecomposed
|| !returnReduceAnd(haveVolAddressing)
|| !returnReduce(haveVolAddressing, andOp<bool>())
)
{
Info<< "No undecomposed mesh. Creating from: "
@ -1615,7 +1614,7 @@ int main(int argc, char *argv[])
&&
(
!areaMeshHaveUndecomposed
|| !returnReduceAnd(haveAreaAddressing)
|| !returnReduce(haveAreaAddressing, andOp<bool>())
)
)
{
@ -2067,7 +2066,7 @@ int main(int argc, char *argv[])
args
)[0].value();
}
Pstream::broadcast(masterTime);
Pstream::scatter(masterTime);
Info<< "Setting time to that of master or undecomposed case : "
<< masterTime << endl;
runTime.setTime(masterTime, 0);
@ -2349,8 +2348,6 @@ int main(int argc, char *argv[])
// Remove any left-over empty processor directories created
// by loadOrCreateMesh to get around the collated start-up
// problems
Info<< "Removing left-over empty processor directories" << nl;
if (Pstream::master()) //fileHandler().comm()))
{
const auto myProci = UPstream::myProcNo(); //comm()
@ -2367,7 +2364,9 @@ int main(int argc, char *argv[])
&& volMeshDir[proci] != volMeshDir[myProci]
)
{
Foam::rmDir(volMeshDir[proci], true); // silent
Info<< "Deleting mesh dir:"
<< volMeshDir[proci] << endl;
Foam::rmDir(volMeshDir[proci]);
}
if
@ -2376,18 +2375,9 @@ int main(int argc, char *argv[])
&& areaMeshDir[proci] != areaMeshDir[myProci]
)
{
Foam::rmDir(areaMeshDir[proci], true); // silent
}
// Remove empty processor directories
// Eg, <path-name>/processorN/constant/polyMesh
// to <path-name>/processorN
if (proci != myProci)
{
removeEmptyDir
(
volMeshDir[proci].path().path()
);
Info<< "Deleting mesh dir:"
<< areaMeshDir[proci] << endl;
Foam::rmDir(areaMeshDir[proci]);
}
}
@ -2451,8 +2441,7 @@ int main(int argc, char *argv[])
// Remove dummy mesh created by loadOrCreateMesh
const bool oldParRun = Pstream::parRun(false);
mesh.removeFiles();
// Silent rmdir
Foam::rmDir(mesh.objectRegistry::objectPath(), true);
Foam::rmDir(mesh.objectRegistry::objectPath());
Pstream::parRun(oldParRun); // Restore parallel state
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -78,6 +78,6 @@ if (timeDirs.size() > 1)
}
// Ensure consistency
Pstream::reduceOr(hasMovingMesh);
reduce(hasMovingMesh, orOp<bool>());
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -38,7 +38,7 @@ if (doLagrangian)
Info<< "Cloud " << cloudName << " (";
const bool cloudExists =
returnReduceOr(currentCloudDirs.found(cloudName));
returnReduce(currentCloudDirs.found(cloudName), orOp<bool>());
{
autoPtr<ensightFile> os = ensCase.newCloud(cloudName);
@ -82,7 +82,7 @@ if (doLagrangian)
const bool oldParRun = Pstream::parRun(false);
fieldExists = fieldObject.typeHeaderOk<IOField<scalar>>(false);
Pstream::parRun(oldParRun); // Restore parallel state
Pstream::reduceOr(fieldExists);
reduce(fieldExists, orOp<bool>());
}
bool wrote = false;

View File

@ -101,7 +101,7 @@ if (timeDirs.size() && doLagrangian)
{
for (auto& cloudFields : regionCloudFields)
{
Pstream::mapCombineReduce
Pstream::mapCombineAllGather
(
cloudFields,
HashTableOps::plusEqOp<word>()

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -64,7 +64,9 @@ Foam::label Foam::checkData
}
}
if (returnReduceAnd(good))
reduce(good, andOp<bool>());
if (good)
{
goodFields.insert(fieldName);
}

View File

@ -46,9 +46,11 @@ if (doLagrangian)
if (Pstream::parRun())
{
// Synchronise cloud names
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames);
}
Foam::sort(cloudNames); // Consistent order
// Consistent order
Foam::sort(cloudNames);
for (const word& cloudName : cloudNames)
{
@ -64,7 +66,7 @@ if (doLagrangian)
isCloud = true;
}
if (!returnReduceOr(isCloud))
if (!returnReduce(isCloud, orOp<bool>()))
{
continue;
}
@ -76,7 +78,7 @@ if (doLagrangian)
);
// Are there cloud fields (globally)?
if (returnReduceAnd(cloudObjs.empty()))
if (returnReduce(cloudObjs.empty(), andOp<bool>()))
{
continue;
}

View File

@ -186,7 +186,7 @@ int main(int argc, char *argv[])
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
maxIds.resize(maxNProcs, -1);
Pstream::listCombineReduce(maxIds, maxEqOp<label>());
Pstream::listCombineAllGather(maxIds, maxEqOp<label>());
// From ids to count
const labelList numIds = maxIds + 1;

View File

@ -77,7 +77,8 @@ Foam::label Foam::particleTracksSampler::setTrackFields
if (Pstream::parRun())
{
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
}
for (const word& fieldName : fieldNames)

View File

@ -15,5 +15,10 @@ wordRes acceptFields(propsDict.get<wordRes>("fields"));
wordRes excludeFields;
propsDict.readIfPresent("exclude", excludeFields);
const dictionary formatOptions
(
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
);
// ************************************************************************* //

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -69,7 +68,7 @@ void Foam::channelIndex::walkOppositeFaces
blockedFace[facei] = true;
}
while (returnReduceOr(frontFaces.size()))
while (returnReduce(frontFaces.size(), sumOp<label>()) > 0)
{
// Transfer across.
boolList isFrontBndFace(nBnd, false);

View File

@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
}
// Global sum
Pstream::listCombineReduce(regionField, plusEqOp<T>());
Pstream::listCombineAllGather(regionField, plusEqOp<T>());
return regionField;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -127,7 +127,7 @@ int main(int argc, char *argv[])
IOdictionary dict(dictIO);
autoPtr<noiseModel> model(noiseModel::New(dict, runTime));
autoPtr<noiseModel> model(noiseModel::New(dict));
model->calculate();
Info<< nl << "End\n" << endl;

View File

@ -193,14 +193,14 @@ int main(int argc, char* argv[])
const labelRange origBlocks(0, obstacles.size());
// Intersection blockage
labelRange interBlocks(origBlocks.end_value(), 0);
labelRange interBlocks(origBlocks.after(), 0);
scalar volSubtract = 0;
// Do binary intersections between blocks and cylinders (or diag-beam)
// by creating -ve blocks at the overlap
labelRange int1Blocks(origBlocks.end_value(), 0);
labelRange int1Blocks(origBlocks.after(), 0);
if (pars.overlaps % 2 > 0)
{
@ -219,7 +219,7 @@ int main(int argc, char* argv[])
// Do binary intersections between blocks
// by creating -ve blocks at the overlap
labelRange int2Blocks(int1Blocks.end_value(), 0);
labelRange int2Blocks(int1Blocks.after(), 0);
if (pars.overlaps % 4 > 1)
{
Info<< " block/block intersections" << endl;
@ -237,7 +237,7 @@ int main(int argc, char* argv[])
// Correct for triple intersections
// by looking for overlaps between the -ve blocks just created
labelRange int3Blocks(int2Blocks.end_value(), 0);
labelRange int3Blocks(int2Blocks.after(), 0);
if (pars.overlaps % 8 > 3)
{
Info<< " triple intersections" << endl;

View File

@ -223,7 +223,7 @@ void Foam::solverTemplate::setRegionProperties
fieldDimensions_[regionI].set
(
i,
new dimensionSet("dimensions", dict)
new dimensionSet(dict, "dimensions")
);
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd.
Copyright (C) 2019-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -238,7 +238,7 @@ void rewriteBoundary
patches.reorder(oldToNew);
if (returnReduceOr(nOldCyclics))
if (returnReduce(nOldCyclics, sumOp<label>()) > 0)
{
if (dryrun)
{
@ -299,7 +299,7 @@ void rewriteField
dictionary& boundaryField = fieldDict.subDict("boundaryField");
bool hasChange = false;
label nChanged = 0;
forAllConstIters(thisNames, iter)
{
@ -337,13 +337,13 @@ void rewriteField
);
Info<< " Adding entry " << nbrNames[patchName] << endl;
hasChange = true;
nChanged++;
}
}
//Info<< "New boundaryField:" << boundaryField << endl;
if (returnReduceOr(hasChange))
if (returnReduce(nChanged, sumOp<label>()) > 0)
{
if (dryrun)
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -113,9 +113,10 @@ void mapLagrangian(const meshToMesh& interp)
if
(
returnReduceOr
returnReduce
(
objects.found("coordinates") || objects.found("positions")
(objects.found("coordinates") || objects.found("positions")),
orOp<bool>()
)
)
{

View File

@ -60,16 +60,18 @@ int main(int argc, char *argv[])
)
).subDict("volumetricBSplinesMotionSolverCoeffs")
);
// Read box names and allocate size
wordList controlBoxes(NURBSdict.toc());
for (const entry& dEntry : NURBSdict)
for (const word& boxName : controlBoxes)
{
if (dEntry.isDict())
if (NURBSdict.isDict(boxName))
{
// Creating an object writes the control points in the
// constructor
(void) NURBS3DVolume::New
NURBS3DVolume::New
(
dEntry.dict(),
NURBSdict.subDict(boxName),
mesh,
false // do not compute parametric coordinates
);

View File

@ -232,7 +232,15 @@ int main(int argc, char *argv[])
dictionary& patchDict = boundaryFieldDict.subDict(patchName);
expressions::exprString valueExpr_("expression", currDict);
auto valueExpr_
(
expressions::exprString::getEntry
(
"expression",
currDict,
true // strip comments
)
);
Info<< "Set boundaryField/" << patchName << '/'
<< targetName << nl

View File

@ -560,6 +560,7 @@ int main(int argc, char *argv[])
" (command-line operation)",
true // Advanced option
);
argList::addOptionCompat("dimensions", {"dimension", 2012});
argList::addBoolOption
(
@ -770,7 +771,11 @@ int main(int argc, char *argv[])
ctrl.streamOpt.format(IOstreamOption::ASCII);
}
expressions::exprString valueExpr_(args["expression"]);
expressions::exprString valueExpr_
(
args["expression"],
dictionary::null
);
expressions::exprString maskExpr_;
args.readIfPresent("field-mask", maskExpr_);
@ -855,7 +860,14 @@ int main(int argc, char *argv[])
const word fieldName(dict.get<word>("field"));
expressions::exprString valueExpr_("expression", dict);
auto valueExpr_
(
expressions::exprString::getEntry
(
"expression",
dict
)
);
expressions::exprString maskExpr_;
{
@ -872,11 +884,18 @@ int main(int argc, char *argv[])
}
}
// Optional: "dimensions"
dimensionSet dims;
if (dims.readEntry("dimensions", dict, false))
{
ctrl.hasDimensions = true;
const entry* dimPtr = dict.findCompat
(
"dimensions", {{"dimension", 2012}},
keyType::LITERAL
);
if (dimPtr)
{
dimPtr->stream() >> dims;
}
ctrl.hasDimensions = bool(dimPtr);
}
if (args.verbose() && !timei)

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