Compare commits
96 Commits
develop.sw
...
feature-ne
| Author | SHA1 | Date | |
|---|---|---|---|
| a9c757f1ff | |||
| 8c0679d25f | |||
| 6c6c8c5008 | |||
| 7fa4f1ef76 | |||
| 5b29ff0e42 | |||
| b7592c1ee8 | |||
| 799d247142 | |||
| 70208a7399 | |||
| 473e14418a | |||
| b9c15b8585 | |||
| 18216a4639 | |||
| 99780bd7cd | |||
| 5163e52974 | |||
| 35aa6140cc | |||
| e510321a26 | |||
| 3a4537abc9 | |||
| 493bfdbdc4 | |||
| 32507b3251 | |||
| 81f783286c | |||
| 7db69fc22e | |||
| 9557cde880 | |||
| c039a09e71 | |||
| e0f3993045 | |||
| 12ba22bebf | |||
| 07a9ee86f3 | |||
| 9563607e01 | |||
| 5b1c060e9e | |||
| 53397e6f3f | |||
| 67ba5acf18 | |||
| e5cf96b0f9 | |||
| 62f37b2a43 | |||
| 619ddc2355 | |||
| 4fc34c8a63 | |||
| 2cc96ad7f4 | |||
| 541b6eb28a | |||
| 10b724b10d | |||
| d2f2ab6d25 | |||
| b92fbd8f73 | |||
| 3c214e99df | |||
| 913c45afff | |||
| fc19ca39f3 | |||
| 2202995f5c | |||
| 21f037e3a0 | |||
| c973066646 | |||
| 371795840c | |||
| 7a43cac55a | |||
| 9433898941 | |||
| 454f7960b0 | |||
| 9db3547bd3 | |||
| 278378031e | |||
| bd000d89e9 | |||
| ac25608fbd | |||
| 37e90dbad7 | |||
| 2c7a7b27a3 | |||
| 7a67c1e72b | |||
| b145e59049 | |||
| 24ffc5236d | |||
| fd55151a12 | |||
| 3caeeb1f51 | |||
| 0c3a938810 | |||
| 62244c6caf | |||
| 3a6a76044d | |||
| 5a9dbcdadf | |||
| 65dc440f3c | |||
| 4585a2d229 | |||
| 18eeba116a | |||
| 61deacd24d | |||
| 81b1c5021f | |||
| 96ff2f32e5 | |||
| 9434972261 | |||
| d5cdc60a54 | |||
| 779a2ca084 | |||
| 98a510c317 | |||
| 0c89f38312 | |||
| bcd461926c | |||
| 793433da72 | |||
| 34d69cad23 | |||
| a246a97b12 | |||
| 7b2bcfda0b | |||
| 7eda6de6f4 | |||
| d938e01d7a | |||
| 623c0624fb | |||
| 36d7954004 | |||
| 159a7a5a38 | |||
| 55f5f8774b | |||
| 9d5a3a5c54 | |||
| ee9119f436 | |||
| 3a6e427409 | |||
| ea51c2c0e4 | |||
| 867b5e9060 | |||
| 7c2311aae6 | |||
| f87f0040b8 | |||
| c59b6db3c4 | |||
| 5677e10d90 | |||
| 38d68824b3 | |||
| 8283599c31 |
@ -35,7 +35,7 @@
|
||||
(
|
||||
solidRegions[i],
|
||||
thermos[i],
|
||||
coordinateSystem::typeName_()
|
||||
coordinateSystem::typeName
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ if (!thermo.isotropic())
|
||||
(
|
||||
mesh,
|
||||
thermo,
|
||||
coordinateSystem::typeName_()
|
||||
coordinateSystem::typeName
|
||||
);
|
||||
|
||||
tmp<volVectorField> tkappaByCp = thermo.Kappa()/thermo.Cp();
|
||||
|
||||
@ -157,12 +157,7 @@ void Foam::radiation::laserDTRM::initialiseReflection()
|
||||
);
|
||||
}
|
||||
|
||||
if (reflections_.size())
|
||||
{
|
||||
reflectionSwitch_ = true;
|
||||
}
|
||||
|
||||
reflectionSwitch_ = returnReduce(reflectionSwitch_, orOp<bool>());
|
||||
reflectionSwitch_ = returnReduceOr(reflections_.size());
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,14 +294,12 @@ void Foam::radiation::laserDTRM::initialise()
|
||||
DTRMCloud_.addParticle(pPtr);
|
||||
}
|
||||
|
||||
if (returnReduce(cellI, maxOp<label>()) == -1)
|
||||
if (nMissed < 10 && returnReduceAnd(cellI < 0))
|
||||
{
|
||||
if (++nMissed <= 10)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Cannot find owner cell for focalPoint at "
|
||||
<< p0 << endl;
|
||||
}
|
||||
++nMissed;
|
||||
WarningInFunction
|
||||
<< "Cannot find owner cell for focalPoint at "
|
||||
<< p0 << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,11 +28,6 @@ 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)
|
||||
@ -110,9 +105,9 @@ Foam::word Foam::DirLister::next(DIR* dirPtr) const
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (fType == fileName::FILE && stripgz_ && name.hasExt(extgz))
|
||||
if (fType == fileName::FILE && stripgz_ && name.has_ext("gz"))
|
||||
{
|
||||
name = name.lessExt();
|
||||
name.remove_ext();
|
||||
}
|
||||
|
||||
if (!name.empty() && accept(name))
|
||||
|
||||
@ -113,7 +113,6 @@ 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 : "
|
||||
|
||||
@ -90,7 +90,7 @@ void writeAndRead
|
||||
const IOobject& io,
|
||||
const label sz,
|
||||
const word& writeType,
|
||||
const IOobject::readOption rOpt,
|
||||
IOobjectOption::readOption rOpt,
|
||||
const word& readType
|
||||
)
|
||||
{
|
||||
@ -208,7 +208,8 @@ int main(int argc, char *argv[])
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
{
|
||||
@ -243,9 +244,7 @@ int main(int argc, char *argv[])
|
||||
args.executable(),
|
||||
"constant",
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER // implicit convert to IOobjectOption
|
||||
);
|
||||
|
||||
labelList ints(identity(200));
|
||||
|
||||
@ -182,7 +182,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// MPI barrier
|
||||
bool barrier = true;
|
||||
Pstream::scatter(barrier);
|
||||
Pstream::broadcast(barrier);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -83,9 +83,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
IOstreamOption streamOpt;
|
||||
|
||||
if (outputName.hasExt("gz"))
|
||||
if (outputName.has_ext("gz"))
|
||||
{
|
||||
outputName.removeExt();
|
||||
outputName.remove_ext();
|
||||
streamOpt.compression(IOstreamOption::COMPRESSED);
|
||||
}
|
||||
|
||||
|
||||
@ -138,8 +138,8 @@ int main()
|
||||
maxFirstEqOp<label>()(maxIndexed, item);
|
||||
}
|
||||
|
||||
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
|
||||
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
|
||||
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
|
||||
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
|
||||
|
||||
Info<< "Min indexed: " << minIndexed << nl
|
||||
<< "Max indexed: " << maxIndexed << nl;
|
||||
@ -156,8 +156,8 @@ int main()
|
||||
maxIndexed = maxFirstOp<label>()(maxIndexed, item);
|
||||
}
|
||||
|
||||
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
|
||||
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
|
||||
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
|
||||
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
|
||||
|
||||
Info<< "Min indexed: " << minIndexed << nl
|
||||
<< "Max indexed: " << maxIndexed << nl;
|
||||
|
||||
@ -1,7 +1,2 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -31,7 +31,8 @@ Description
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "boundBox.H"
|
||||
#include "line.H"
|
||||
#include "Random.H"
|
||||
#include "treeBoundBox.H"
|
||||
#include "cellModel.H"
|
||||
#include "bitSet.H"
|
||||
@ -84,7 +85,20 @@ int main(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
bb = cube(0, 1);
|
||||
Info<<"starting box: " << bb << endl;
|
||||
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;
|
||||
|
||||
point pt(Zero);
|
||||
bb.add(pt);
|
||||
@ -147,6 +161,25 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
@ -59,11 +59,11 @@ void basicTests(const coordinateSystem& cs)
|
||||
{
|
||||
cs.writeEntry(cs.name(), Info);
|
||||
|
||||
if (const auto* cartptr = isA<coordSystem::cartesian>(cs))
|
||||
if ((const auto* cartptr = isA<coordSystem::cartesian>(cs)) != nullptr)
|
||||
{
|
||||
if (!cartptr->active())
|
||||
if (!cartptr->valid())
|
||||
{
|
||||
Info<< "inactive cartesian = " << (*cartptr)
|
||||
Info<< "invalid cartesian = " << (*cartptr)
|
||||
<< " with: " << (*cartptr).R() << nl;
|
||||
}
|
||||
}
|
||||
@ -106,7 +106,7 @@ void doTest(const dictionary& dict)
|
||||
|
||||
try
|
||||
{
|
||||
auto cs1ptr = coordinateSystem::New(dict, "");
|
||||
auto cs1ptr = coordinateSystem::New(dict, word::null);
|
||||
coordinateSystem& cs1 = *cs1ptr;
|
||||
cs1.rename(dict.dictName());
|
||||
|
||||
|
||||
@ -51,11 +51,8 @@ cs4
|
||||
{
|
||||
type cylindrical;
|
||||
origin (0 3 5);
|
||||
rotation
|
||||
{
|
||||
type euler;
|
||||
angles (90 0 0);
|
||||
}
|
||||
rotation euler;
|
||||
angles (90 0 0);
|
||||
}
|
||||
|
||||
cyl
|
||||
@ -75,10 +72,7 @@ cyl
|
||||
ident
|
||||
{
|
||||
origin (0 0 0);
|
||||
rotation
|
||||
{
|
||||
type none;
|
||||
}
|
||||
rotation none;
|
||||
}
|
||||
|
||||
)
|
||||
|
||||
@ -26,7 +26,7 @@ rot_x90
|
||||
rot_x90_axesRotation
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axesRotation;
|
||||
e1 (1 0 0);
|
||||
@ -37,7 +37,7 @@ rot_x90_axesRotation
|
||||
rot_x90_axisAngle
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axisAngle;
|
||||
axis (1 0 0); // non-unit also OK
|
||||
@ -48,7 +48,7 @@ rot_x90_axisAngle
|
||||
rot_x90_euler
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type euler;
|
||||
angles (0 90 0); // z-x'-z''
|
||||
@ -61,7 +61,7 @@ rot_x90_euler
|
||||
rot_z45_axesRotation
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axesRotation;
|
||||
e1 (1 1 0);
|
||||
@ -72,7 +72,7 @@ rot_z45_axesRotation
|
||||
rot_z45_axisAngle
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axisAngle;
|
||||
axis (0 0 10); // non-unit also OK
|
||||
@ -83,7 +83,7 @@ rot_z45_axisAngle
|
||||
rot_z45_euler
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type euler;
|
||||
angles (45 0 0); // z-x'-z''
|
||||
@ -93,7 +93,7 @@ rot_z45_euler
|
||||
rot_z45_starcd
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type starcd;
|
||||
angles (45 0 0); // z-x'-y''
|
||||
@ -106,7 +106,7 @@ rot_z45_starcd
|
||||
rot_zm45_axesRotation
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axesRotation;
|
||||
e1 (1 -1 0);
|
||||
@ -117,7 +117,7 @@ rot_zm45_axesRotation
|
||||
rot_zm45_axisAngle
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axisAngle;
|
||||
axis (0 0 10); // non-unit also OK
|
||||
@ -128,7 +128,7 @@ rot_zm45_axisAngle
|
||||
rot_zm45_euler
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type euler;
|
||||
angles (-45 0 0); // z-x'-z''
|
||||
@ -141,7 +141,7 @@ rot_zm45_euler
|
||||
null_axesRotation
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axesRotation;
|
||||
e1 (1 0 0);
|
||||
@ -152,7 +152,7 @@ null_axesRotation
|
||||
null_axisAngle0
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axisAngle;
|
||||
axis (0 0 0); // non-unit also OK
|
||||
@ -163,7 +163,7 @@ null_axisAngle0
|
||||
null_axisAngle1
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type axisAngle;
|
||||
axis (1 1 1); // non-unit also OK
|
||||
@ -174,7 +174,7 @@ null_axisAngle1
|
||||
null_euler
|
||||
{
|
||||
origin (0 0 0);
|
||||
coordinateRotation
|
||||
rotation
|
||||
{
|
||||
type euler;
|
||||
angles (0 0 0); // z-x'-z''
|
||||
|
||||
@ -60,7 +60,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Reading " << file << nl << endl;
|
||||
decomposedBlockData data
|
||||
(
|
||||
Pstream::worldComm,
|
||||
UPstream::worldComm,
|
||||
IOobject
|
||||
(
|
||||
file,
|
||||
@ -79,7 +79,6 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
objPath,
|
||||
IOstreamOption::BINARY,
|
||||
IOstreamOption::currentVersion,
|
||||
runTime.writeCompression()
|
||||
);
|
||||
if (!os.good())
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,8 +65,7 @@ int main(int argc, char *argv[])
|
||||
"tensor",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
{ IOobject::READ_IF_PRESENT, IOobject::NO_REGISTER }
|
||||
),
|
||||
mesh,
|
||||
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9))
|
||||
@ -75,6 +74,47 @@ 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
|
||||
|
||||
@ -120,7 +120,8 @@ int main(int argc, char *argv[])
|
||||
try
|
||||
{
|
||||
// Should not trigger any errors
|
||||
expressions::exprString expr(str, dict, false);
|
||||
auto expr = expressions::exprString::toExpr(str, dict);
|
||||
|
||||
Info<< "expr: " << expr << nl;
|
||||
}
|
||||
catch (const Foam::error& err)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,6 +48,14 @@ 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)
|
||||
@ -260,7 +268,7 @@ int main(int argc, char *argv[])
|
||||
"hello1",
|
||||
"hello2",
|
||||
"hello3",
|
||||
"hello4.hmm"
|
||||
"hello4.ext"
|
||||
};
|
||||
|
||||
Info<< file1 << nl;
|
||||
@ -270,7 +278,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
file1,
|
||||
"some",
|
||||
"more/things.hmm"
|
||||
"more/things.ext"
|
||||
};
|
||||
|
||||
Info<< file2 << nl;
|
||||
@ -281,7 +289,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
std::string("ffO"),
|
||||
"some",
|
||||
"more/things.hmm"
|
||||
"more/things.ext"
|
||||
};
|
||||
Info<< file3 << nl;
|
||||
|
||||
@ -295,7 +303,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
"some",
|
||||
file3,
|
||||
"more/things.hmm",
|
||||
"more/things.ext",
|
||||
file1
|
||||
};
|
||||
Info<< "All ==> " << file4 << nl;
|
||||
@ -328,26 +336,26 @@ int main(int argc, char *argv[])
|
||||
fileName input1("path.to/media/image.png");
|
||||
|
||||
Info<<"File : " << input0 << " ext: "
|
||||
<< Switch(input0.hasExt())
|
||||
<< Switch(input0.has_ext())
|
||||
<< " = " << input0.ext() << nl;
|
||||
Info<<"File : " << input1 << " ext: "
|
||||
<< Switch(input1.hasExt())
|
||||
<< Switch(input1.has_ext())
|
||||
<< " = " << input1.ext() << nl;
|
||||
Info<<"File : " << endWithDot << " ext: "
|
||||
<< Switch(endWithDot.hasExt())
|
||||
<< Switch(endWithDot.has_ext())
|
||||
<< " = " << endWithDot.ext() << " <-- perhaps return false?" << nl;
|
||||
Info<<"File : " << endWithSlash << " ext: "
|
||||
<< Switch(endWithSlash.hasExt())
|
||||
<< Switch(endWithSlash.has_ext())
|
||||
<< " = " << endWithSlash.ext() << nl;
|
||||
|
||||
|
||||
Info<<"Remove extension " << (input0.removeExt());
|
||||
Info<<"Remove extension " << (input0.remove_ext());
|
||||
Info<< " now: " << input0 << nl;
|
||||
|
||||
Info<<"Remove extension " << (input1.removeExt());
|
||||
Info<< " now: " << input1 << nl;
|
||||
|
||||
Info<<"Remove extension " << (endWithSlash.removeExt());
|
||||
Info<<"Remove extension " << (endWithSlash.remove_ext());
|
||||
Info<< " now: " << endWithSlash << nl;
|
||||
|
||||
wordList exts{ "jpg", "png", "txt", word::null };
|
||||
@ -359,14 +367,14 @@ int main(int argc, char *argv[])
|
||||
Info<< nl;
|
||||
|
||||
|
||||
Info<<"Test hasExt(word)" << nl
|
||||
Info<<"Test has_ext(word)" << nl
|
||||
<<"~~~~~~~~~~~~~~~~~" << nl;
|
||||
Info<<"Has extension(s):" << nl
|
||||
<< "input: " << input1 << nl;
|
||||
for (const word& e : exts)
|
||||
{
|
||||
Info<<" '" << e << "' -> "
|
||||
<< Switch(input1.hasExt(e)) << nl;
|
||||
<< Switch(input1.has_ext(e)) << nl;
|
||||
}
|
||||
Info<< nl;
|
||||
|
||||
@ -375,12 +383,12 @@ int main(int argc, char *argv[])
|
||||
for (const word& e : exts)
|
||||
{
|
||||
Info<<" '" << e << "' -> "
|
||||
<< Switch(endWithDot.hasExt(e)) << nl;
|
||||
<< Switch(endWithDot.has_ext(e)) << nl;
|
||||
}
|
||||
Info<< nl;
|
||||
|
||||
|
||||
Info<<"Test hasExt(wordRe)" << nl
|
||||
Info<<"Test has_ext(wordRe)" << nl
|
||||
<<"~~~~~~~~~~~~~~~~~~~" << nl;
|
||||
|
||||
// A regex with a zero length matcher doesn't work at all:
|
||||
@ -393,25 +401,25 @@ int main(int argc, char *argv[])
|
||||
Info<<"Has extension(s):" << nl
|
||||
<< "input: " << endWithDot << nl;
|
||||
Info<<" " << matcher0 << " -> "
|
||||
<< Switch(endWithDot.hasExt(matcher0)) << nl;
|
||||
<< Switch(endWithDot.has_ext(matcher0)) << nl;
|
||||
Info<<" " << matcher1 << " -> "
|
||||
<< Switch(endWithDot.hasExt(matcher1)) << nl;
|
||||
<< Switch(endWithDot.has_ext(matcher1)) << nl;
|
||||
Info<<" " << matcher2 << " -> "
|
||||
<< Switch(endWithDot.hasExt(matcher2)) << nl;
|
||||
<< Switch(endWithDot.has_ext(matcher2)) << nl;
|
||||
|
||||
Info<< "input: " << input1 << nl;
|
||||
Info<<" " << matcher0 << " -> "
|
||||
<< Switch(input1.hasExt(matcher0)) << nl;
|
||||
<< Switch(input1.has_ext(matcher0)) << nl;
|
||||
Info<<" " << matcher1 << " -> "
|
||||
<< Switch(input1.hasExt(matcher1)) << nl;
|
||||
<< Switch(input1.has_ext(matcher1)) << nl;
|
||||
Info<<" " << matcher2 << " -> "
|
||||
<< Switch(input1.hasExt(matcher2)) << nl;
|
||||
<< Switch(input1.has_ext(matcher2)) << nl;
|
||||
Info<< nl;
|
||||
|
||||
Info<<"Remove extension(s):" << nl << "input: " << input1 << nl;
|
||||
while (!input1.empty())
|
||||
{
|
||||
if (input1.removeExt())
|
||||
if (input1.remove_ext())
|
||||
{
|
||||
Info<< " -> " << input1 << nl;
|
||||
}
|
||||
@ -587,14 +595,54 @@ 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");
|
||||
|
||||
Foam::rmDir(dirA);
|
||||
// Purge anything existing
|
||||
Foam::rmDir(dirA, true);
|
||||
Foam::rmDir(dirB, true);
|
||||
Foam::rmDir(dirC, true);
|
||||
Foam::rmDir(dirD, true);
|
||||
Foam::rm(lnA);
|
||||
Foam::rm(lnB);
|
||||
Foam::rmDir(dirB);
|
||||
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
Info<< nl << "=========================" << nl
|
||||
<< "Test some copying and deletion" << endl;
|
||||
@ -618,9 +666,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
Info<<" create: " << file << endl;
|
||||
|
||||
std::ofstream os(file);
|
||||
os << "file=<" << file << ">" << nl;
|
||||
touchFileContent(file);
|
||||
}
|
||||
|
||||
const int oldDebug = POSIX::debug;
|
||||
@ -708,7 +754,7 @@ int main(int argc, char *argv[])
|
||||
"hello1",
|
||||
"hello2",
|
||||
"hello3",
|
||||
"hello4.hmm"
|
||||
"hello4.ext"
|
||||
};
|
||||
|
||||
fileName pathName(wrdList);
|
||||
@ -718,14 +764,28 @@ int main(int argc, char *argv[])
|
||||
<< "pathName.name() = >" << pathName.name() << "<\n"
|
||||
<< "pathName.path() = " << pathName.path() << nl
|
||||
<< "pathName.ext() = >" << pathName.ext() << "<\n"
|
||||
<< "pathName.nameLessExt= >" << pathName.nameLessExt() << "<\n";
|
||||
<< "pathName.stem = >" << pathName.stem() << "<\n";
|
||||
|
||||
Info<< "pathName.components() = " << pathName.components() << nl
|
||||
<< "pathName.component(2) = " << pathName.component(2) << nl
|
||||
<< endl;
|
||||
|
||||
Info<< "hasPath = " << Switch(pathName.hasPath()) << nl;
|
||||
pathName.removePath();
|
||||
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<< "removed path = " << pathName << nl;
|
||||
|
||||
Info<< nl << nl;
|
||||
|
||||
@ -64,13 +64,8 @@ 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.min() -= point::uniform(ROOTVSMALL);
|
||||
bb.max() += point::uniform(ROOTVSMALL);
|
||||
treeBoundBox bb(efem.points());
|
||||
bb.grow(ROOTVSMALL);
|
||||
|
||||
labelList allEdges(identity(efem.edges().size()));
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 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.hasExt("gz"))
|
||||
if (outputName.has_ext("gz"))
|
||||
{
|
||||
comp = IOstreamOption::COMPRESSED;
|
||||
outputName.removeExt();
|
||||
outputName.remove_ext();
|
||||
|
||||
InfoErr<< " [compress]";
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
labelPair inOut;
|
||||
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
|
||||
inOut[0] = allCcs.size();
|
||||
Pstream::scatter(allCcs);
|
||||
Pstream::broadcast(allCcs);
|
||||
inOut[1] = allCcs.size();
|
||||
Pout<< " " << inOut << endl;
|
||||
|
||||
|
||||
@ -41,8 +41,8 @@ void printInfo(const labelRange& range)
|
||||
<< "last " << range.last() << nl
|
||||
<< "min " << range.min() << nl
|
||||
<< "max " << range.max() << nl
|
||||
<< "after " << range.after() << nl
|
||||
<< "begin end " << *range.cbegin() << ' ' << *range.cend() << nl;
|
||||
<< "end " << range.end_value() << 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::addVerbose("enable labelRange::debug");
|
||||
argList::addVerboseOption("enable labelRange::debug");
|
||||
argList::addNote
|
||||
(
|
||||
"The default is to add ranges, use 'add' and 'del' to toggle\n\n"
|
||||
|
||||
@ -44,7 +44,7 @@ using namespace Foam;
|
||||
template<class T>
|
||||
Ostream& printInfo(const MinMax<T>& range)
|
||||
{
|
||||
Info<< range << " valid=" << range.valid() << " span=" << range.span();
|
||||
Info<< range << " good=" << range.good() << " span=" << range.span();
|
||||
|
||||
return Info;
|
||||
}
|
||||
@ -234,11 +234,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Pout<< "hashed: " << hashed << nl;
|
||||
|
||||
Pstream::mapCombineGather
|
||||
(
|
||||
hashed,
|
||||
plusEqOp<scalarMinMax>()
|
||||
);
|
||||
Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>());
|
||||
|
||||
Info<< "reduced: " << hashed << nl;
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ using namespace Foam;
|
||||
template<class T>
|
||||
Ostream& printInfo(const MinMax<T>& range)
|
||||
{
|
||||
Info<< range << " valid=" << range.valid();
|
||||
Info<< range << " good=" << range.good();
|
||||
|
||||
return Info;
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
EXE_INC = $(COMP_OPENMP) /* -UUSE_OMP */
|
||||
EXE_INC = $(COMP_OPENMP)
|
||||
|
||||
/* Mostly do not need to explicitly link openmp libraries */
|
||||
/* EXE_LIBS = $(LINK_OPENMP) */
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,12 +41,6 @@ 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";
|
||||
|
||||
|
||||
@ -167,7 +167,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
localValue,
|
||||
sumOp<scalar>(),
|
||||
Pstream::msgType(),
|
||||
UPstream::msgType(),
|
||||
comm
|
||||
);
|
||||
Pout<< "sum :" << sum << endl;
|
||||
|
||||
@ -125,13 +125,13 @@ int main(int argc, char *argv[])
|
||||
scalar data1 = 1.0;
|
||||
label request1 = -1;
|
||||
{
|
||||
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1);
|
||||
Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
|
||||
}
|
||||
|
||||
scalar data2 = 0.1;
|
||||
label request2 = -1;
|
||||
{
|
||||
Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2);
|
||||
Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -232,6 +232,7 @@ 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);
|
||||
|
||||
|
||||
3
applications/test/rawIOField/Make/files
Normal file
3
applications/test/rawIOField/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-rawIOField.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-rawIOField
|
||||
9
applications/test/rawIOField/Make/options
Normal file
9
applications/test/rawIOField/Make/options
Normal file
@ -0,0 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfileFormats \
|
||||
-lsurfMesh \
|
||||
-lmeshTools
|
||||
168
applications/test/rawIOField/Test-rawIOField.C
Normal file
168
applications/test/rawIOField/Test-rawIOField.C
Normal file
@ -0,0 +1,168 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -135,6 +135,7 @@ 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;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 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;
|
||||
if (!args.readIfPresent("ext", ext))
|
||||
{
|
||||
ext = importName.ext();
|
||||
if (ext == "gz")
|
||||
{
|
||||
ext = importName.lessExt().ext();
|
||||
}
|
||||
}
|
||||
word ext =
|
||||
(
|
||||
importName.has_ext("gz")
|
||||
? importName.stem().ext()
|
||||
: importName.ext()
|
||||
);
|
||||
|
||||
// Allow override of extension
|
||||
args.readIfPresent("ext", ext);
|
||||
|
||||
args.readIfPresent("stl-parser", fileFormats::STLReader::parserType);
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ Description
|
||||
|
||||
#include "vectorField.H"
|
||||
#include "IOstreams.H"
|
||||
#include "Random.H"
|
||||
#include <algorithm>
|
||||
#include <random>
|
||||
|
||||
@ -74,8 +75,12 @@ void doTest(vector& vec1, vector& vec2)
|
||||
printInfo(vec1);
|
||||
printInfo(vec2);
|
||||
|
||||
Info<< "min of " << vec1 << " and " << vec2 << " = "
|
||||
<< min(vec1, vec2) << nl << nl;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -146,6 +151,46 @@ 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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
label patchi = patches.findPatchID(patchName);
|
||||
const label patchi = patches.findPatchID(patchName);
|
||||
|
||||
if (patchi == -1)
|
||||
{
|
||||
@ -597,16 +597,15 @@ label findPatch(const polyBoundaryMesh& patches, const word& patchName)
|
||||
|
||||
// Check same patch for all procs
|
||||
{
|
||||
label newPatch = patchi;
|
||||
reduce(newPatch, minOp<label>());
|
||||
const label newPatchi = returnReduce(patchi, minOp<label>());
|
||||
|
||||
if (newPatch != patchi)
|
||||
if (newPatchi != 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 " << newPatch
|
||||
<< " ; on some other processor it has index " << newPatchi
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -396,12 +397,11 @@ int main(int argc, char *argv[])
|
||||
meshSearch queryMesh(mesh);
|
||||
|
||||
// Check all 'outside' points
|
||||
forAll(outsidePts, outsideI)
|
||||
for (const point& outsidePoint : outsidePts)
|
||||
{
|
||||
const point& outsidePoint = outsidePts[outsideI];
|
||||
const label celli = queryMesh.findCell(outsidePoint, -1, false);
|
||||
|
||||
label celli = queryMesh.findCell(outsidePoint, -1, false);
|
||||
if (returnReduce(celli, maxOp<label>()) == -1)
|
||||
if (returnReduceAnd(celli < 0))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "outsidePoint " << outsidePoint
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 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 = exportName.lessExt();
|
||||
exportName.remove_ext();
|
||||
}
|
||||
}
|
||||
else if (args.found("export"))
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 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 = exportName.lessExt();
|
||||
exportName.remove_ext();
|
||||
}
|
||||
}
|
||||
else if (args.found("case"))
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
ensightMeshReader.C
|
||||
ensightToFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/ensightToFoam
|
||||
@ -0,0 +1,11 @@
|
||||
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
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,194 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,118 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 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");
|
||||
|
||||
fileName exportBase = exportName.lessExt();
|
||||
word exportExt = exportName.ext();
|
||||
const fileName exportBase = exportName.lessExt();
|
||||
const word exportExt = exportName.ext();
|
||||
|
||||
if (!meshedSurface::canWriteType(exportExt, true))
|
||||
{
|
||||
|
||||
@ -538,8 +538,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Add any patches.
|
||||
|
||||
label nAdded = nPatches - mesh.boundaryMesh().size();
|
||||
reduce(nAdded, sumOp<label>());
|
||||
const label nAdded = returnReduce
|
||||
(
|
||||
nPatches - mesh.boundaryMesh().size(),
|
||||
sumOp<label>()
|
||||
);
|
||||
|
||||
Info<< "Adding overall " << nAdded << " processor patches." << endl;
|
||||
|
||||
@ -946,9 +949,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Put all modifications into meshMod
|
||||
bool anyChange = collapser.setRefinement(allPointInfo, meshMod);
|
||||
reduce(anyChange, orOp<bool>());
|
||||
|
||||
if (anyChange)
|
||||
if (returnReduceOr(anyChange))
|
||||
{
|
||||
// Construct new mesh from polyTopoChange.
|
||||
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh, false);
|
||||
@ -1118,8 +1120,7 @@ int main(int argc, char *argv[])
|
||||
processorMeshes::removeFiles(mesh);
|
||||
|
||||
// Need writing cellSet
|
||||
label nAdded = returnReduce(addedCellsSet.size(), sumOp<label>());
|
||||
if (nAdded > 0)
|
||||
if (returnReduceOr(addedCellsSet.size()))
|
||||
{
|
||||
cellSet addedCells(mesh, "addedCells", addedCellsSet);
|
||||
Info<< "Writing added cells to cellSet " << addedCells.name()
|
||||
|
||||
@ -345,7 +345,7 @@ void deleteEmptyPatches(fvMesh& mesh)
|
||||
else
|
||||
{
|
||||
// Common patch.
|
||||
if (returnReduce(patches[patchi].empty(), andOp<bool>()))
|
||||
if (returnReduceAnd(patches[patchi].empty()))
|
||||
{
|
||||
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::listCombineAllGather(zoneSidePatch, plusEqOp<label>());
|
||||
Pstream::listCombineAllGather(zoneZonePatch, plusEqOp<label>());
|
||||
Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>());
|
||||
Pstream::listCombineReduce(zoneZonePatch, plusEqOp<label>());
|
||||
}
|
||||
|
||||
|
||||
@ -1848,7 +1848,7 @@ int main(int argc, char *argv[])
|
||||
const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points());
|
||||
|
||||
|
||||
Pstream::listCombineAllGather(isInternal, orEqOp<bool>());
|
||||
Pstream::listCombineReduce(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::mapCombineAllGather(globalSum, plusEqOp<point>());
|
||||
Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
|
||||
|
||||
forAll(localToGlobalRegion, localRegionI)
|
||||
{
|
||||
|
||||
@ -588,9 +588,8 @@ Foam::label Foam::DistributedDelaunayMesh<Triangulation>::referVertices
|
||||
reduce(preInsertionSize, sumOp<label>());
|
||||
reduce(postInsertionSize, sumOp<label>());
|
||||
|
||||
label nTotalToInsert = referredVertices.size();
|
||||
|
||||
reduce(nTotalToInsert, sumOp<label>());
|
||||
label nTotalToInsert =
|
||||
returnReduce(referredVertices.size(), sumOp<label>());
|
||||
|
||||
if (preInsertionSize + nTotalToInsert != postInsertionSize)
|
||||
{
|
||||
|
||||
@ -167,14 +167,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
{
|
||||
if (volumeStatus[celli] == volumeType::UNKNOWN)
|
||||
{
|
||||
treeBoundBox cellBb
|
||||
(
|
||||
mesh_.cells()[celli].points
|
||||
(
|
||||
mesh_.faces(),
|
||||
mesh_.points()
|
||||
)
|
||||
);
|
||||
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
|
||||
|
||||
if (geometry.overlaps(cellBb))
|
||||
{
|
||||
@ -224,7 +217,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
);
|
||||
}
|
||||
|
||||
if (returnReduce(newCellsToRefine.size(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(newCellsToRefine.empty()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@ -286,14 +279,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
|
||||
{
|
||||
if (volumeStatus[celli] == volumeType::UNKNOWN)
|
||||
{
|
||||
treeBoundBox cellBb
|
||||
(
|
||||
mesh_.cells()[celli].points
|
||||
(
|
||||
mesh_.faces(),
|
||||
mesh_.points()
|
||||
)
|
||||
);
|
||||
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
|
||||
|
||||
if (geometry.overlaps(cellBb))
|
||||
{
|
||||
@ -512,14 +498,7 @@ bool Foam::backgroundMeshDecomposition::refineCell
|
||||
|
||||
// const conformationSurfaces& geometry = geometryToConformTo_;
|
||||
|
||||
treeBoundBox cellBb
|
||||
(
|
||||
mesh_.cells()[celli].points
|
||||
(
|
||||
mesh_.faces(),
|
||||
mesh_.points()
|
||||
)
|
||||
);
|
||||
treeBoundBox cellBb(mesh_.cells()[celli].box(mesh_));
|
||||
|
||||
weightEstimate = 1.0;
|
||||
|
||||
@ -899,7 +878,7 @@ Foam::backgroundMeshDecomposition::distribute
|
||||
}
|
||||
}
|
||||
|
||||
if (returnReduce(cellsToRefine.size(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(cellsToRefine.empty()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ public:
|
||||
return name_;
|
||||
}
|
||||
|
||||
const Switch& forceInitialPointInsertion() const
|
||||
Switch forceInitialPointInsertion() const noexcept
|
||||
{
|
||||
return forceInitialPointInsertion_;
|
||||
}
|
||||
|
||||
@ -92,9 +92,7 @@ bool Foam::controlMeshRefinement::detectEdge
|
||||
magSqr(a - b) < tolSqr
|
||||
)
|
||||
{
|
||||
pointFound.setPoint(midPoint);
|
||||
pointFound.setHit();
|
||||
|
||||
pointFound.hitPoint(midPoint);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -264,7 +262,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
const cellSizeAndAlignmentControl& controlFunction =
|
||||
controlFunctions[fI];
|
||||
|
||||
const Switch& forceInsertion =
|
||||
const Switch forceInsertion =
|
||||
controlFunction.forceInitialPointInsertion();
|
||||
|
||||
Info<< "Inserting points from " << controlFunction.name()
|
||||
@ -450,7 +448,7 @@ void Foam::controlMeshRefinement::initialMeshPopulation
|
||||
const cellSizeAndAlignmentControl& controlFunction =
|
||||
controlFunctions[fI];
|
||||
|
||||
const Switch& forceInsertion =
|
||||
const Switch forceInsertion =
|
||||
controlFunction.forceInitialPointInsertion();
|
||||
|
||||
Info<< "Inserting points from " << controlFunction.name()
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 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_.nameLessExt() + "_cellSize"
|
||||
/ surfaceName_.stem() + "_cellSize"
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ Description
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
|
||||
|
||||
// ------------------------------------------------------------------------- //
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -87,23 +87,17 @@ void Foam::conformalVoronoiMesh::cellSizeMeshOverlapsBackground() const
|
||||
|
||||
boundBox cellSizeMeshBb = cellSizeMesh.bounds();
|
||||
|
||||
bool fullyContained = true;
|
||||
bool fullyContained = cellSizeMeshBb.contains(bb);
|
||||
|
||||
if (!cellSizeMeshBb.contains(bb))
|
||||
if (!fullyContained)
|
||||
{
|
||||
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;
|
||||
Pout<< "Triangulation not fully contained in cell size mesh." << endl
|
||||
<< "Cell Size Mesh Bounds = " << cellSizeMeshBb << endl
|
||||
<< "foamyHexMesh Bounds = " << bb << endl;
|
||||
}
|
||||
|
||||
reduce(fullyContained, andOp<unsigned int>());
|
||||
|
||||
Info<< "Triangulation is "
|
||||
<< (fullyContained ? "fully" : "not fully")
|
||||
<< (returnReduceAnd(fullyContained) ? "fully" : "not fully")
|
||||
<< " contained in the cell size mesh"
|
||||
<< endl;
|
||||
}
|
||||
@ -115,12 +109,7 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
|
||||
bool distribute
|
||||
)
|
||||
{
|
||||
label nPoints = points.size();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
reduce(nPoints, sumOp<label>());
|
||||
}
|
||||
const label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
|
||||
Info<< " " << nPoints << " points to insert..." << endl;
|
||||
|
||||
@ -145,16 +134,15 @@ void Foam::conformalVoronoiMesh::insertInternalPoints
|
||||
map().distribute(points);
|
||||
}
|
||||
|
||||
label nVert = number_of_vertices();
|
||||
label preReinsertionSize(number_of_vertices());
|
||||
|
||||
insert(points.begin(), points.end());
|
||||
|
||||
label nInserted(number_of_vertices() - nVert);
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
reduce(nInserted, sumOp<label>());
|
||||
}
|
||||
const label nInserted = returnReduce
|
||||
(
|
||||
label(number_of_vertices()) - preReinsertionSize,
|
||||
sumOp<label>()
|
||||
);
|
||||
|
||||
Info<< " " << nInserted << " points inserted"
|
||||
<< ", failed to insert " << nPoints - nInserted
|
||||
|
||||
@ -753,7 +753,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
|
||||
forAll(patches, p)
|
||||
{
|
||||
label totalPatchSize = patchDicts[p].get<label>("nFaces");
|
||||
label nPatchFaces = patchDicts[p].get<label>("nFaces");
|
||||
|
||||
if
|
||||
(
|
||||
@ -762,7 +762,7 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
)
|
||||
{
|
||||
// Do not create empty processor patches
|
||||
if (totalPatchSize > 0)
|
||||
if (nPatchFaces)
|
||||
{
|
||||
patchDicts[p].set("transform", "coincidentFullMatch");
|
||||
|
||||
@ -781,9 +781,8 @@ Foam::conformalVoronoiMesh::createPolyMeshFromPoints
|
||||
else
|
||||
{
|
||||
// Check that the patch is not empty on every processor
|
||||
reduce(totalPatchSize, sumOp<label>());
|
||||
|
||||
if (totalPatchSize > 0)
|
||||
if (returnReduceOr(nPatchFaces))
|
||||
{
|
||||
patches[nValidPatches] = polyPatch::New
|
||||
(
|
||||
|
||||
@ -729,7 +729,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
|
||||
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
|
||||
|
||||
forAll(surfaceHits, eI)
|
||||
{
|
||||
@ -816,7 +816,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
|
||||
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
|
||||
|
||||
forAll(featureEdgeHits, eI)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2012-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -707,9 +707,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
|
||||
|
||||
Info<< incrIndent << indent << "Faces matched." << endl;
|
||||
|
||||
reduce(anyChanged, orOp<bool>());
|
||||
|
||||
if (anyChanged)
|
||||
if (returnReduceOr(anyChanged))
|
||||
{
|
||||
label nReorderedFaces = 0;
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@ SourceFiles
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
|
||||
|
||||
// ------------------------------------------------------------------------- //
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ SourceFiles
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
|
||||
|
||||
// ------------------------------------------------------------------------- //
|
||||
|
||||
|
||||
@ -605,7 +605,7 @@ Foam::conformationSurfaces::conformationSurfaces
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::conformationSurfaces::overlaps(const treeBoundBox& bb) const
|
||||
bool Foam::conformationSurfaces::overlaps(const boundBox& bb) const
|
||||
{
|
||||
forAll(surfaces_, s)
|
||||
{
|
||||
|
||||
@ -188,7 +188,7 @@ public:
|
||||
|
||||
//- Check if the supplied bound box overlaps any part of any of
|
||||
// the surfaces
|
||||
bool overlaps(const treeBoundBox& bb) const;
|
||||
bool overlaps(const boundBox& bb) const;
|
||||
|
||||
//- Check if points are inside surfaces to conform to
|
||||
Field<bool> inside(const pointField& samplePts) const;
|
||||
|
||||
@ -84,16 +84,12 @@ Foam::searchableBoxFeatures::features() const
|
||||
autoPtr<extendedFeatureEdgeMesh> features;
|
||||
|
||||
List<vector> faceNormalsList(treeBoundBox::faceNormals);
|
||||
vectorField faceNormals(faceNormalsList);
|
||||
vectorField faceNormals(std::move(faceNormalsList));
|
||||
|
||||
vectorField edgeDirections(12);
|
||||
labelListList normalDirections(12);
|
||||
labelListList normalDirections(12, labelList(2, Zero));
|
||||
labelListList edgeNormals(12, labelList(2, Zero));
|
||||
|
||||
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;
|
||||
@ -116,7 +112,6 @@ 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 =
|
||||
@ -138,12 +133,12 @@ Foam::searchableBoxFeatures::features() const
|
||||
}
|
||||
}
|
||||
|
||||
labelListList featurePointNormals(8);
|
||||
labelListList featurePointEdges(8);
|
||||
labelListList featurePointNormals(8, labelList(3, Zero));
|
||||
labelListList featurePointEdges(8, labelList(3, Zero));
|
||||
|
||||
forAll(featurePointNormals, pI)
|
||||
{
|
||||
labelList& ftPtEdges = featurePointEdges[pI];
|
||||
ftPtEdges.setSize(3, 0);
|
||||
|
||||
label edgeI = 0;
|
||||
forAll(treeBoundBox::edges, eI)
|
||||
@ -161,7 +156,6 @@ Foam::searchableBoxFeatures::features() const
|
||||
}
|
||||
|
||||
labelList& ftPtNormals = featurePointNormals[pI];
|
||||
ftPtNormals.setSize(3, 0);
|
||||
|
||||
ftPtNormals[0] = edgeNormals[ftPtEdges[0]][0];
|
||||
ftPtNormals[1] = edgeNormals[ftPtEdges[0]][1];
|
||||
|
||||
@ -727,14 +727,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
pointField mergedPoints;
|
||||
faceList mergedFaces;
|
||||
labelList pointMergeMap;
|
||||
PatchTools::gatherAndMerge
|
||||
(
|
||||
tolDim,
|
||||
primitivePatch(SubList<face>(isoFaces), isoPoints),
|
||||
mergedPoints,
|
||||
mergedFaces,
|
||||
pointMergeMap
|
||||
mergedFaces
|
||||
);
|
||||
|
||||
if (Pstream::master())
|
||||
|
||||
@ -38,6 +38,7 @@ Description
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
|
||||
|
||||
// ------------------------------------------------------------------------- //
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@ Description
|
||||
#if defined(CGAL_VERSION_NR) && (CGAL_VERSION_NR < 1050211000)
|
||||
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wbitwise-instead-of-logical"
|
||||
|
||||
// ------------------------------------------------------------------------- //
|
||||
|
||||
|
||||
@ -416,10 +416,12 @@ void extractSurface
|
||||
|
||||
// Allocate zone/patch for all patches
|
||||
HashTable<label> compactZoneID(1024);
|
||||
forAllConstIters(patchSize, iter)
|
||||
if (Pstream::master())
|
||||
{
|
||||
label sz = compactZoneID.size();
|
||||
compactZoneID.insert(iter.key(), sz);
|
||||
forAllConstIters(patchSize, iter)
|
||||
{
|
||||
compactZoneID.insert(iter.key(), compactZoneID.size());
|
||||
}
|
||||
}
|
||||
Pstream::broadcast(compactZoneID);
|
||||
|
||||
@ -431,7 +433,7 @@ void extractSurface
|
||||
label patchi = bMesh.findPatchID(iter.key());
|
||||
if (patchi != -1)
|
||||
{
|
||||
patchToCompactZone[patchi] = iter();
|
||||
patchToCompactZone[patchi] = iter.val();
|
||||
}
|
||||
}
|
||||
|
||||
@ -663,7 +665,7 @@ void removeZeroSizedPatches(fvMesh& mesh)
|
||||
if
|
||||
(
|
||||
isA<coupledPolyPatch>(pp)
|
||||
|| returnReduce(pp.size(), sumOp<label>())
|
||||
|| returnReduceOr(pp.size())
|
||||
)
|
||||
{
|
||||
// Coupled (and unknown size) or uncoupled and used
|
||||
@ -1889,11 +1891,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// Use the maxLocalCells from the refinement parameters
|
||||
bool preBalance = returnReduce
|
||||
(
|
||||
(mesh.nCells() >= refineParams.maxLocalCells()),
|
||||
orOp<bool>()
|
||||
);
|
||||
const bool preBalance =
|
||||
returnReduceOr(mesh.nCells() >= refineParams.maxLocalCells());
|
||||
|
||||
|
||||
if (!overwrite && !debugLevel)
|
||||
|
||||
@ -104,9 +104,6 @@ void Foam::checkPatch
|
||||
// << endl;
|
||||
}
|
||||
|
||||
//DebugVar(globalEdgeFaces);
|
||||
|
||||
|
||||
// Synchronise across coupled edges.
|
||||
syncTools::syncEdgeList
|
||||
(
|
||||
@ -116,7 +113,6 @@ void Foam::checkPatch
|
||||
labelList() // null value
|
||||
);
|
||||
|
||||
//DebugVar(globalEdgeFaces);
|
||||
|
||||
label labelTyp = TopoType::MANIFOLD;
|
||||
forAll(meshEdges, edgei)
|
||||
@ -191,7 +187,7 @@ void Foam::checkPatch
|
||||
{
|
||||
const labelList& mp = pp.meshPoints();
|
||||
|
||||
if (returnReduce(mp.size(), sumOp<label>()) > 0)
|
||||
if (returnReduceOr(mp.size()))
|
||||
{
|
||||
boundBox bb(pp.points(), mp, true); // reduce
|
||||
Info<< ' ' << bb;
|
||||
@ -200,6 +196,35 @@ 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,
|
||||
@ -227,10 +252,10 @@ Foam::label Foam::checkTopology
|
||||
}
|
||||
}
|
||||
reduce(nEmpty, sumOp<label>());
|
||||
label nTotCells = returnReduce(mesh.cells().size(), sumOp<label>());
|
||||
const label nCells = returnReduce(mesh.cells().size(), sumOp<label>());
|
||||
|
||||
// These are actually warnings, not errors.
|
||||
if (nTotCells && (nEmpty % nTotCells))
|
||||
if (nCells && (nEmpty % nCells))
|
||||
{
|
||||
Info<< " ***Total number of faces on empty patches"
|
||||
<< " is not divisible by the number of cells in the mesh."
|
||||
@ -310,7 +335,7 @@ Foam::label Foam::checkTopology
|
||||
{
|
||||
noFailedChecks++;
|
||||
|
||||
label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
const label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
|
||||
Info<< " <<Writing " << nPoints
|
||||
<< " unused points to set " << points.name() << endl;
|
||||
@ -447,7 +472,7 @@ Foam::label Foam::checkTopology
|
||||
}
|
||||
}
|
||||
|
||||
label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
|
||||
const label nOneCells = returnReduce(oneCells.size(), sumOp<label>());
|
||||
|
||||
if (nOneCells > 0)
|
||||
{
|
||||
@ -463,7 +488,7 @@ Foam::label Foam::checkTopology
|
||||
}
|
||||
}
|
||||
|
||||
label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
|
||||
const label nTwoCells = returnReduce(twoCells.size(), sumOp<label>());
|
||||
|
||||
if (nTwoCells > 0)
|
||||
{
|
||||
@ -563,11 +588,7 @@ Foam::label Foam::checkTopology
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineAllGather
|
||||
(
|
||||
regionDisconnected,
|
||||
andEqOp<bool>()
|
||||
);
|
||||
Pstream::listCombineReduce(regionDisconnected, andEqOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
@ -614,7 +635,7 @@ Foam::label Foam::checkTopology
|
||||
cellRegions[i].write();
|
||||
}
|
||||
|
||||
label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
const label nPoints = returnReduce(points.size(), sumOp<label>());
|
||||
if (nPoints)
|
||||
{
|
||||
Info<< " <<Writing " << nPoints
|
||||
@ -714,6 +735,25 @@ 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
|
||||
{
|
||||
@ -791,6 +831,26 @@ 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
|
||||
{
|
||||
@ -798,6 +858,65 @@ 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)
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#include "labelList.H"
|
||||
#include "autoPtr.H"
|
||||
#include "ZoneMesh.H"
|
||||
#include "topoSet.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -21,6 +23,14 @@ namespace Foam
|
||||
pointSet& points
|
||||
);
|
||||
|
||||
template<class Zone>
|
||||
label checkZones
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const ZoneMesh<Zone, polyMesh>& zones,
|
||||
topoSet& set
|
||||
);
|
||||
|
||||
label checkTopology
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -138,7 +138,7 @@ void filterPatches(fvMesh& mesh, const wordHashSet& addedPatchNames)
|
||||
if
|
||||
(
|
||||
isA<coupledPolyPatch>(pp)
|
||||
|| returnReduce(pp.size(), sumOp<label>())
|
||||
|| returnReduceOr(pp.size())
|
||||
|| addedPatchNames.found(pp.name())
|
||||
)
|
||||
{
|
||||
|
||||
@ -686,7 +686,7 @@ void syncPoints
|
||||
|
||||
//- Note: hasTransformation is only used for warning messages so
|
||||
// reduction not strictly necessary.
|
||||
//reduce(hasTransformation, orOp<bool>());
|
||||
//Pstream::reduceOr(hasTransformation);
|
||||
|
||||
// Synchronize multiple shared points.
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
@ -714,7 +714,7 @@ void syncPoints
|
||||
}
|
||||
|
||||
// Combine - globally consistent
|
||||
Pstream::listCombineAllGather(sharedPts, cop);
|
||||
Pstream::listCombineReduce(sharedPts, cop);
|
||||
|
||||
// Now we will all have the same information. Merge it back with
|
||||
// my local information.
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -272,7 +273,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
if (returnReduce(changedEdges.size(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(changedEdges.empty()))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1103,9 +1103,7 @@ int main(int argc, char *argv[])
|
||||
// Update proc maps
|
||||
if (cellProcAddressing.headerOk())
|
||||
{
|
||||
bool localOk = (cellProcAddressing.size() == mesh.nCells());
|
||||
|
||||
if (returnReduce(localOk, andOp<bool>()))
|
||||
if (returnReduceAnd(cellProcAddressing.size() == mesh.nCells()))
|
||||
{
|
||||
Info<< "Renumbering processor cell decomposition map "
|
||||
<< cellProcAddressing.name() << endl;
|
||||
@ -1129,9 +1127,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (faceProcAddressing.headerOk())
|
||||
{
|
||||
bool localOk = (faceProcAddressing.size() == mesh.nFaces());
|
||||
|
||||
if (returnReduce(localOk, andOp<bool>()))
|
||||
if (returnReduceAnd(faceProcAddressing.size() == mesh.nFaces()))
|
||||
{
|
||||
Info<< "Renumbering processor face decomposition map "
|
||||
<< faceProcAddressing.name() << endl;
|
||||
@ -1171,9 +1167,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (pointProcAddressing.headerOk())
|
||||
{
|
||||
bool localOk = (pointProcAddressing.size() == mesh.nPoints());
|
||||
|
||||
if (returnReduce(localOk, andOp<bool>()))
|
||||
if (returnReduceAnd(pointProcAddressing.size() == mesh.nPoints()))
|
||||
{
|
||||
Info<< "Renumbering processor point decomposition map "
|
||||
<< pointProcAddressing.name() << endl;
|
||||
@ -1197,12 +1191,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (boundaryProcAddressing.headerOk())
|
||||
{
|
||||
bool localOk =
|
||||
if
|
||||
(
|
||||
boundaryProcAddressing.size()
|
||||
== mesh.boundaryMesh().size()
|
||||
);
|
||||
if (returnReduce(localOk, andOp<bool>()))
|
||||
returnReduceAnd
|
||||
(
|
||||
boundaryProcAddressing.size() == mesh.boundaryMesh().size()
|
||||
)
|
||||
)
|
||||
{
|
||||
// No renumbering needed
|
||||
}
|
||||
|
||||
@ -847,7 +847,7 @@ void createAndWriteRegion
|
||||
|
||||
if (!isA<processorPolyPatch>(pp))
|
||||
{
|
||||
if (returnReduce(pp.size(), sumOp<label>()) > 0)
|
||||
if (returnReduceOr(pp.size()))
|
||||
{
|
||||
oldToNew[patchi] = newI;
|
||||
if (!addedPatches.found(patchi))
|
||||
@ -1114,7 +1114,7 @@ label findCorrespondingRegion
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::listCombineAllGather(cellsInZone, plusEqOp<label>());
|
||||
Pstream::listCombineReduce(cellsInZone, plusEqOp<label>());
|
||||
|
||||
// Pick region with largest overlap of zoneI
|
||||
label regionI = findMax(cellsInZone);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -144,11 +144,7 @@ using namespace Foam;
|
||||
// but leave anything with '/' delimiters untouched
|
||||
bool upgradeScope(word& entryName)
|
||||
{
|
||||
if
|
||||
(
|
||||
entryName.find('/') == string::npos
|
||||
&& entryName.find(':') != string::npos
|
||||
)
|
||||
if (!entryName.contains('/') && entryName.contains(':'))
|
||||
{
|
||||
const wordList names(fileName(entryName).components(':'));
|
||||
|
||||
|
||||
@ -223,7 +223,7 @@ bool writeOptionalMeshObject
|
||||
|
||||
// Make sure all know if there is a valid class name
|
||||
wordList classNames(1, io.headerClassName());
|
||||
Pstream::combineAllGather(classNames, uniqueEqOp<word>());
|
||||
Pstream::combineReduce(classNames, uniqueEqOp<word>());
|
||||
|
||||
// Check for correct type
|
||||
if (classNames[0] == T::typeName)
|
||||
@ -429,7 +429,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
Pstream::combineAllGather(lagrangianDirs, uniqueEqOp<fileName>());
|
||||
Pstream::combineReduce(lagrangianDirs, uniqueEqOp<fileName>());
|
||||
|
||||
if (!lagrangianDirs.empty())
|
||||
{
|
||||
@ -466,7 +466,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
Pstream::combineAllGather(cloudDirs, uniqueEqOp<fileName>());
|
||||
Pstream::combineReduce(cloudDirs, uniqueEqOp<fileName>());
|
||||
|
||||
forAll(cloudDirs, i)
|
||||
{
|
||||
@ -492,7 +492,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// Combine with all other cloud objects
|
||||
Pstream::combineAllGather(cloudFields, uniqueEqOp<word>());
|
||||
Pstream::combineReduce(cloudFields, uniqueEqOp<word>());
|
||||
|
||||
for (const word& name : cloudFields)
|
||||
{
|
||||
|
||||
@ -252,7 +252,7 @@ autoPtr<mapPolyMesh> mergeSharedPoints
|
||||
Info<< "mergeSharedPoints : detected " << pointToMaster.size()
|
||||
<< " points that are to be merged." << endl;
|
||||
|
||||
if (returnReduce(pointToMaster.size(), sumOp<label>()) == 0)
|
||||
if (returnReduceAnd(pointToMaster.empty()))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ Foam::boolList Foam::haveMeshFile
|
||||
|
||||
void Foam::removeProcAddressing(const faMesh& mesh)
|
||||
{
|
||||
IOobject ioAddr
|
||||
IOobject io
|
||||
(
|
||||
"procAddressing",
|
||||
mesh.facesInstance(),
|
||||
@ -79,9 +79,9 @@ void Foam::removeProcAddressing(const faMesh& mesh)
|
||||
|
||||
for (const auto prefix : {"boundary", "edge", "face", "point"})
|
||||
{
|
||||
ioAddr.rename(prefix + word("ProcAddressing"));
|
||||
io.rename(prefix + word("ProcAddressing"));
|
||||
|
||||
const fileName procFile(ioAddr.objectPath());
|
||||
const fileName procFile(io.objectPath());
|
||||
Foam::rm(procFile);
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ void Foam::removeProcAddressing(const faMesh& mesh)
|
||||
|
||||
void Foam::removeProcAddressing(const polyMesh& mesh)
|
||||
{
|
||||
IOobject ioAddr
|
||||
IOobject io
|
||||
(
|
||||
"procAddressing",
|
||||
mesh.facesInstance(),
|
||||
@ -99,89 +99,18 @@ void Foam::removeProcAddressing(const polyMesh& mesh)
|
||||
|
||||
for (const auto prefix : {"boundary", "cell", "face", "point"})
|
||||
{
|
||||
ioAddr.rename(prefix + word("ProcAddressing"));
|
||||
io.rename(prefix + word("ProcAddressing"));
|
||||
|
||||
const fileName procFile(ioAddr.objectPath());
|
||||
const fileName procFile(io.objectPath());
|
||||
Foam::rm(procFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::removeEmptyDir(const fileName& path)
|
||||
void Foam::removeEmptyDir(const fileName& path)
|
||||
{
|
||||
// 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;
|
||||
// Remove directory: silent, emptyOnly
|
||||
Foam::rmDir(path, true, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -64,8 +64,8 @@ void removeProcAddressing(const faMesh& mesh);
|
||||
//- Remove procAddressing
|
||||
void removeProcAddressing(const polyMesh& mesh);
|
||||
|
||||
//- Remove empty directory. Return true if removed.
|
||||
bool removeEmptyDir(const fileName& path);
|
||||
//- Remove empty directory
|
||||
void removeEmptyDir(const fileName& path);
|
||||
|
||||
//- Remove empty directories from bottom up
|
||||
void removeEmptyDirs(const fileName& path);
|
||||
|
||||
@ -224,7 +224,7 @@ Foam::parFvFieldDistributor::distributeField
|
||||
}
|
||||
|
||||
// Map all faces
|
||||
primitiveField = Field<Type>(flatFld, mapper, fld.oriented()());
|
||||
primitiveField = Field<Type>(flatFld, mapper, fld.is_oriented());
|
||||
|
||||
// Trim to internal faces (note: could also have special mapper)
|
||||
primitiveField.resize
|
||||
|
||||
@ -89,10 +89,11 @@ void Foam::parLagrangianDistributor::findClouds
|
||||
}
|
||||
|
||||
// Synchronise cloud names
|
||||
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(cloudNames);
|
||||
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
Foam::sort(cloudNames); // Consistent order
|
||||
|
||||
objectNames.setSize(cloudNames.size());
|
||||
objectNames.clear();
|
||||
objectNames.resize(cloudNames.size());
|
||||
|
||||
for (const fileName& localCloudName : localCloudDirs)
|
||||
{
|
||||
@ -124,11 +125,11 @@ void Foam::parLagrangianDistributor::findClouds
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronise objectNames
|
||||
forAll(objectNames, i)
|
||||
// Synchronise objectNames (per cloud)
|
||||
for (wordList& objNames : objectNames)
|
||||
{
|
||||
Pstream::combineGather(objectNames[i], ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(objectNames[i]);
|
||||
Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
|
||||
Foam::sort(objNames); // Consistent order
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +292,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
|
||||
nsTransPs[sendProcI] = subMap[sendProcI].size();
|
||||
}
|
||||
// Send sizes across. Note: blocks.
|
||||
Pstream::combineAllGather(sizes, Pstream::listEq());
|
||||
Pstream::combineReduce(sizes, Pstream::listEq());
|
||||
|
||||
labelListList constructMap(Pstream::nProcs());
|
||||
label constructSize = 0;
|
||||
|
||||
@ -51,14 +51,9 @@ Foam::wordList Foam::parLagrangianDistributor::filterObjects
|
||||
: objects.names<Container>(selectedFields)
|
||||
);
|
||||
|
||||
// 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);
|
||||
// Parallel synchronise - combine names from all processors
|
||||
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
|
||||
Foam::sort(fieldNames); // Consistent order
|
||||
|
||||
return fieldNames;
|
||||
}
|
||||
@ -93,11 +88,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFields
|
||||
if (!nFields)
|
||||
{
|
||||
// Performing an all-to-one (reconstruct)?
|
||||
reconstruct = returnReduce
|
||||
(
|
||||
(!map.constructSize() || Pstream::master()),
|
||||
andOp<bool>()
|
||||
);
|
||||
reconstruct =
|
||||
returnReduceAnd(!map.constructSize() || Pstream::master());
|
||||
}
|
||||
|
||||
if (verbose_)
|
||||
@ -200,11 +192,8 @@ Foam::label Foam::parLagrangianDistributor::distributeFieldFields
|
||||
if (!nFields)
|
||||
{
|
||||
// Performing an all-to-one (reconstruct)?
|
||||
reconstruct = returnReduce
|
||||
(
|
||||
(!map.constructSize() || Pstream::master()),
|
||||
andOp<bool>()
|
||||
);
|
||||
reconstruct =
|
||||
returnReduceAnd(!map.constructSize() || Pstream::master());
|
||||
}
|
||||
|
||||
if (verbose_)
|
||||
@ -349,11 +338,8 @@ Foam::label Foam::parLagrangianDistributor::distributeStoredFields
|
||||
if (!nFields)
|
||||
{
|
||||
// Performing an all-to-one (reconstruct)?
|
||||
reconstruct = returnReduce
|
||||
(
|
||||
(!map.constructSize() || Pstream::master()),
|
||||
andOp<bool>()
|
||||
);
|
||||
reconstruct =
|
||||
returnReduceAnd(!map.constructSize() || Pstream::master());
|
||||
}
|
||||
|
||||
if (verbose_)
|
||||
|
||||
@ -132,7 +132,7 @@ void createTimeDirs(const fileName& path)
|
||||
//Pstream::parRun(oldParRun); // Restore parallel state
|
||||
masterTimeDirs = localTimeDirs;
|
||||
}
|
||||
Pstream::scatter(masterTimeDirs);
|
||||
Pstream::broadcast(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::combineAllGather(roots, ListOps::uniqueEqOp<fileName>());
|
||||
Pstream::combineReduce(roots, ListOps::uniqueEqOp<fileName>());
|
||||
nfs = (roots.size() == 1);
|
||||
}
|
||||
|
||||
@ -1187,7 +1187,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (decompose)
|
||||
{
|
||||
Info<< "Removing existing processor directory" << procDir << endl;
|
||||
Info<< "Removing existing processor directory:"
|
||||
<< args.relativePath(procDir) << endl;
|
||||
fileHandler().rmDir(procDir);
|
||||
}
|
||||
}
|
||||
@ -1202,7 +1203,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
// If master changed to decompose mode make sure all nodes know about it
|
||||
Pstream::scatter(decompose);
|
||||
Pstream::broadcast(decompose);
|
||||
|
||||
|
||||
// If running distributed we have problem of new processors not finding
|
||||
@ -1287,7 +1288,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::scatter(timeDirs);
|
||||
Pstream::broadcast(timeDirs);
|
||||
|
||||
if (timeDirs.empty())
|
||||
{
|
||||
@ -1546,7 +1547,7 @@ int main(int argc, char *argv[])
|
||||
if
|
||||
(
|
||||
!volMeshHaveUndecomposed
|
||||
|| !returnReduce(haveVolAddressing, andOp<bool>())
|
||||
|| !returnReduceAnd(haveVolAddressing)
|
||||
)
|
||||
{
|
||||
Info<< "No undecomposed mesh. Creating from: "
|
||||
@ -1614,7 +1615,7 @@ int main(int argc, char *argv[])
|
||||
&&
|
||||
(
|
||||
!areaMeshHaveUndecomposed
|
||||
|| !returnReduce(haveAreaAddressing, andOp<bool>())
|
||||
|| !returnReduceAnd(haveAreaAddressing)
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -2066,7 +2067,7 @@ int main(int argc, char *argv[])
|
||||
args
|
||||
)[0].value();
|
||||
}
|
||||
Pstream::scatter(masterTime);
|
||||
Pstream::broadcast(masterTime);
|
||||
Info<< "Setting time to that of master or undecomposed case : "
|
||||
<< masterTime << endl;
|
||||
runTime.setTime(masterTime, 0);
|
||||
@ -2348,6 +2349,8 @@ 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()
|
||||
@ -2364,9 +2367,7 @@ int main(int argc, char *argv[])
|
||||
&& volMeshDir[proci] != volMeshDir[myProci]
|
||||
)
|
||||
{
|
||||
Info<< "Deleting mesh dir:"
|
||||
<< volMeshDir[proci] << endl;
|
||||
Foam::rmDir(volMeshDir[proci]);
|
||||
Foam::rmDir(volMeshDir[proci], true); // silent
|
||||
}
|
||||
|
||||
if
|
||||
@ -2375,9 +2376,18 @@ int main(int argc, char *argv[])
|
||||
&& areaMeshDir[proci] != areaMeshDir[myProci]
|
||||
)
|
||||
{
|
||||
Info<< "Deleting mesh dir:"
|
||||
<< areaMeshDir[proci] << endl;
|
||||
Foam::rmDir(areaMeshDir[proci]);
|
||||
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()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2441,7 +2451,8 @@ int main(int argc, char *argv[])
|
||||
// Remove dummy mesh created by loadOrCreateMesh
|
||||
const bool oldParRun = Pstream::parRun(false);
|
||||
mesh.removeFiles();
|
||||
Foam::rmDir(mesh.objectRegistry::objectPath());
|
||||
// Silent rmdir
|
||||
Foam::rmDir(mesh.objectRegistry::objectPath(), true);
|
||||
Pstream::parRun(oldParRun); // Restore parallel state
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 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
|
||||
reduce(hasMovingMesh, orOp<bool>());
|
||||
Pstream::reduceOr(hasMovingMesh);
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 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 =
|
||||
returnReduce(currentCloudDirs.found(cloudName), orOp<bool>());
|
||||
returnReduceOr(currentCloudDirs.found(cloudName));
|
||||
|
||||
{
|
||||
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
|
||||
reduce(fieldExists, orOp<bool>());
|
||||
Pstream::reduceOr(fieldExists);
|
||||
}
|
||||
|
||||
bool wrote = false;
|
||||
|
||||
@ -101,7 +101,7 @@ if (timeDirs.size() && doLagrangian)
|
||||
{
|
||||
for (auto& cloudFields : regionCloudFields)
|
||||
{
|
||||
Pstream::mapCombineAllGather
|
||||
Pstream::mapCombineReduce
|
||||
(
|
||||
cloudFields,
|
||||
HashTableOps::plusEqOp<word>()
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -64,9 +64,7 @@ Foam::label Foam::checkData
|
||||
}
|
||||
}
|
||||
|
||||
reduce(good, andOp<bool>());
|
||||
|
||||
if (good)
|
||||
if (returnReduceAnd(good))
|
||||
{
|
||||
goodFields.insert(fieldName);
|
||||
}
|
||||
|
||||
@ -46,11 +46,9 @@ if (doLagrangian)
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Synchronise cloud names
|
||||
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(cloudNames);
|
||||
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
|
||||
}
|
||||
// Consistent order
|
||||
Foam::sort(cloudNames);
|
||||
Foam::sort(cloudNames); // Consistent order
|
||||
|
||||
for (const word& cloudName : cloudNames)
|
||||
{
|
||||
@ -66,7 +64,7 @@ if (doLagrangian)
|
||||
isCloud = true;
|
||||
}
|
||||
|
||||
if (!returnReduce(isCloud, orOp<bool>()))
|
||||
if (!returnReduceOr(isCloud))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -78,7 +76,7 @@ if (doLagrangian)
|
||||
);
|
||||
|
||||
// Are there cloud fields (globally)?
|
||||
if (returnReduce(cloudObjs.empty(), andOp<bool>()))
|
||||
if (returnReduceAnd(cloudObjs.empty()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
||||
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
|
||||
maxIds.resize(maxNProcs, -1);
|
||||
|
||||
Pstream::listCombineAllGather(maxIds, maxEqOp<label>());
|
||||
Pstream::listCombineReduce(maxIds, maxEqOp<label>());
|
||||
|
||||
// From ids to count
|
||||
const labelList numIds = maxIds + 1;
|
||||
|
||||
@ -77,8 +77,7 @@ Foam::label Foam::particleTracksSampler::setTrackFields
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
|
||||
Pstream::broadcast(fieldNames);
|
||||
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
|
||||
}
|
||||
|
||||
for (const word& fieldName : fieldNames)
|
||||
|
||||
@ -15,10 +15,5 @@ wordRes acceptFields(propsDict.get<wordRes>("fields"));
|
||||
wordRes excludeFields;
|
||||
propsDict.readIfPresent("exclude", excludeFields);
|
||||
|
||||
const dictionary formatOptions
|
||||
(
|
||||
propsDict.subOrEmptyDict("formatOptions", keyType::LITERAL)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -68,7 +69,7 @@ void Foam::channelIndex::walkOppositeFaces
|
||||
blockedFace[facei] = true;
|
||||
}
|
||||
|
||||
while (returnReduce(frontFaces.size(), sumOp<label>()) > 0)
|
||||
while (returnReduceOr(frontFaces.size()))
|
||||
{
|
||||
// Transfer across.
|
||||
boolList isFrontBndFace(nBnd, false);
|
||||
|
||||
@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
|
||||
}
|
||||
|
||||
// Global sum
|
||||
Pstream::listCombineAllGather(regionField, plusEqOp<T>());
|
||||
Pstream::listCombineReduce(regionField, plusEqOp<T>());
|
||||
|
||||
return regionField;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 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));
|
||||
autoPtr<noiseModel> model(noiseModel::New(dict, runTime));
|
||||
model->calculate();
|
||||
|
||||
Info<< nl << "End\n" << endl;
|
||||
|
||||
@ -193,14 +193,14 @@ int main(int argc, char* argv[])
|
||||
const labelRange origBlocks(0, obstacles.size());
|
||||
|
||||
// Intersection blockage
|
||||
labelRange interBlocks(origBlocks.after(), 0);
|
||||
labelRange interBlocks(origBlocks.end_value(), 0);
|
||||
|
||||
scalar volSubtract = 0;
|
||||
|
||||
// Do binary intersections between blocks and cylinders (or diag-beam)
|
||||
// by creating -ve blocks at the overlap
|
||||
|
||||
labelRange int1Blocks(origBlocks.after(), 0);
|
||||
labelRange int1Blocks(origBlocks.end_value(), 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.after(), 0);
|
||||
labelRange int2Blocks(int1Blocks.end_value(), 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.after(), 0);
|
||||
labelRange int3Blocks(int2Blocks.end_value(), 0);
|
||||
if (pars.overlaps % 8 > 3)
|
||||
{
|
||||
Info<< " triple intersections" << endl;
|
||||
|
||||
@ -223,7 +223,7 @@ void Foam::solverTemplate::setRegionProperties
|
||||
fieldDimensions_[regionI].set
|
||||
(
|
||||
i,
|
||||
new dimensionSet(dict, "dimensions")
|
||||
new dimensionSet("dimensions", dict)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -238,7 +238,7 @@ void rewriteBoundary
|
||||
|
||||
patches.reorder(oldToNew);
|
||||
|
||||
if (returnReduce(nOldCyclics, sumOp<label>()) > 0)
|
||||
if (returnReduceOr(nOldCyclics))
|
||||
{
|
||||
if (dryrun)
|
||||
{
|
||||
@ -299,7 +299,7 @@ void rewriteField
|
||||
|
||||
dictionary& boundaryField = fieldDict.subDict("boundaryField");
|
||||
|
||||
label nChanged = 0;
|
||||
bool hasChange = false;
|
||||
|
||||
forAllConstIters(thisNames, iter)
|
||||
{
|
||||
@ -337,13 +337,13 @@ void rewriteField
|
||||
);
|
||||
Info<< " Adding entry " << nbrNames[patchName] << endl;
|
||||
|
||||
nChanged++;
|
||||
hasChange = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Info<< "New boundaryField:" << boundaryField << endl;
|
||||
|
||||
if (returnReduce(nChanged, sumOp<label>()) > 0)
|
||||
if (returnReduceOr(hasChange))
|
||||
{
|
||||
if (dryrun)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -113,10 +113,9 @@ void mapLagrangian(const meshToMesh& interp)
|
||||
|
||||
if
|
||||
(
|
||||
returnReduce
|
||||
returnReduceOr
|
||||
(
|
||||
(objects.found("coordinates") || objects.found("positions")),
|
||||
orOp<bool>()
|
||||
objects.found("coordinates") || objects.found("positions")
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
@ -60,18 +60,16 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
).subDict("volumetricBSplinesMotionSolverCoeffs")
|
||||
);
|
||||
// Read box names and allocate size
|
||||
wordList controlBoxes(NURBSdict.toc());
|
||||
|
||||
for (const word& boxName : controlBoxes)
|
||||
for (const entry& dEntry : NURBSdict)
|
||||
{
|
||||
if (NURBSdict.isDict(boxName))
|
||||
if (dEntry.isDict())
|
||||
{
|
||||
// Creating an object writes the control points in the
|
||||
// constructor
|
||||
NURBS3DVolume::New
|
||||
(void) NURBS3DVolume::New
|
||||
(
|
||||
NURBSdict.subDict(boxName),
|
||||
dEntry.dict(),
|
||||
mesh,
|
||||
false // do not compute parametric coordinates
|
||||
);
|
||||
|
||||
@ -232,15 +232,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
dictionary& patchDict = boundaryFieldDict.subDict(patchName);
|
||||
|
||||
auto valueExpr_
|
||||
(
|
||||
expressions::exprString::getEntry
|
||||
(
|
||||
"expression",
|
||||
currDict,
|
||||
true // strip comments
|
||||
)
|
||||
);
|
||||
expressions::exprString valueExpr_("expression", currDict);
|
||||
|
||||
Info<< "Set boundaryField/" << patchName << '/'
|
||||
<< targetName << nl
|
||||
|
||||
@ -560,7 +560,6 @@ int main(int argc, char *argv[])
|
||||
" (command-line operation)",
|
||||
true // Advanced option
|
||||
);
|
||||
argList::addOptionCompat("dimensions", {"dimension", 2012});
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
@ -771,11 +770,7 @@ int main(int argc, char *argv[])
|
||||
ctrl.streamOpt.format(IOstreamOption::ASCII);
|
||||
}
|
||||
|
||||
expressions::exprString valueExpr_
|
||||
(
|
||||
args["expression"],
|
||||
dictionary::null
|
||||
);
|
||||
expressions::exprString valueExpr_(args["expression"]);
|
||||
|
||||
expressions::exprString maskExpr_;
|
||||
args.readIfPresent("field-mask", maskExpr_);
|
||||
@ -860,14 +855,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const word fieldName(dict.get<word>("field"));
|
||||
|
||||
auto valueExpr_
|
||||
(
|
||||
expressions::exprString::getEntry
|
||||
(
|
||||
"expression",
|
||||
dict
|
||||
)
|
||||
);
|
||||
expressions::exprString valueExpr_("expression", dict);
|
||||
|
||||
expressions::exprString maskExpr_;
|
||||
{
|
||||
@ -884,18 +872,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// Optional: "dimensions"
|
||||
dimensionSet dims;
|
||||
if (dims.readEntry("dimensions", dict, false))
|
||||
{
|
||||
const entry* dimPtr = dict.findCompat
|
||||
(
|
||||
"dimensions", {{"dimension", 2012}},
|
||||
keyType::LITERAL
|
||||
);
|
||||
if (dimPtr)
|
||||
{
|
||||
dimPtr->stream() >> dims;
|
||||
}
|
||||
ctrl.hasDimensions = bool(dimPtr);
|
||||
ctrl.hasDimensions = true;
|
||||
}
|
||||
|
||||
if (args.verbose() && !timei)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user