mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-list-face-updates' into 'develop'
collected changes for Lists, faces and PrimitivePatch See merge request Development/openfoam!446
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dynamicFvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dynamicFvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
|
|||||||
@ -55,6 +55,9 @@ See also
|
|||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
// see issue #2083
|
||||||
|
#undef Foam_constructList_from_iterators
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -254,8 +257,12 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "list4: " << list4 << nl
|
Info<< "list4: " << list4 << nl
|
||||||
<< "list5: " << list5 << endl;
|
<< "list5: " << list5 << endl;
|
||||||
|
|
||||||
|
#ifdef Foam_constructList_from_iterators
|
||||||
List<vector> list6(list4.begin(), list4.end());
|
List<vector> list6(list4.begin(), list4.end());
|
||||||
Info<< "list6: " << list6 << endl;
|
Info<< "list6: " << list6 << endl;
|
||||||
|
#else
|
||||||
|
Info<< "NOTE: no construction from two iterators" << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Subset
|
// Subset
|
||||||
const labelList map{0, 2};
|
const labelList map{0, 2};
|
||||||
@ -273,9 +280,13 @@ int main(int argc, char *argv[])
|
|||||||
// scalarList slist = identity(15);
|
// scalarList slist = identity(15);
|
||||||
//
|
//
|
||||||
// More writing, but does work:
|
// More writing, but does work:
|
||||||
|
#ifdef Foam_constructList_from_iterators
|
||||||
scalarList slist(labelRange().begin(), labelRange(15).end());
|
scalarList slist(labelRange().begin(), labelRange(15).end());
|
||||||
|
|
||||||
Info<<"scalar identity:" << flatOutput(slist) << endl;
|
Info<<"scalar identity:" << flatOutput(slist) << endl;
|
||||||
|
#else
|
||||||
|
Info<<"No iterator means of creating a scalar identity list" << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
printListOutputType<label>("labels") << nl;
|
printListOutputType<label>("labels") << nl;
|
||||||
|
|
||||||
@ -384,6 +395,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
Info<< "sub-sorted: " << flatOutput(longLabelList) << nl;
|
Info<< "sub-sorted: " << flatOutput(longLabelList) << nl;
|
||||||
|
|
||||||
|
#ifdef Foam_constructList_from_iterators
|
||||||
// Construct from a label-range
|
// Construct from a label-range
|
||||||
labelRange range(25,15);
|
labelRange range(25,15);
|
||||||
|
|
||||||
@ -406,6 +418,10 @@ int main(int argc, char *argv[])
|
|||||||
// Even weird things like this
|
// Even weird things like this
|
||||||
List<scalar> sident4(labelRange().begin(), labelRange(8).end());
|
List<scalar> sident4(labelRange().begin(), labelRange(8).end());
|
||||||
Info<<"range-list (scalar)=" << sident4 << nl;
|
Info<<"range-list (scalar)=" << sident4 << nl;
|
||||||
|
#else
|
||||||
|
Info<< "NOTE: no construction of labelList from range pair" << nl
|
||||||
|
<< "use identity(...) instead" << endl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wordReList reLst;
|
wordReList reLst;
|
||||||
|
|||||||
@ -62,7 +62,9 @@ void testFind(const T& val, const ListType& lst)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
List<label> completeList(20);
|
labelList completeList(20);
|
||||||
|
labelList scratch(20);
|
||||||
|
scratch = -1;
|
||||||
|
|
||||||
forAll(completeList, i)
|
forAll(completeList, i)
|
||||||
{
|
{
|
||||||
@ -71,12 +73,24 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Info<< "raw : " << flatOutput(completeList) << nl << endl;
|
Info<< "raw : " << flatOutput(completeList) << nl << endl;
|
||||||
|
|
||||||
List<label> addresses{1, 0, 3, 7, 4, 8, 5, 1, 0, 3, 7, 4, 8, 5, };
|
List<label> addresses({ 1, 0, 3, 7, 4, 8, 5, 1, 0, 3, 7, 4, 8, 5 });
|
||||||
|
|
||||||
labelUIndList idl1(completeList, addresses);
|
labelUIndList idl1(completeList, addresses);
|
||||||
|
|
||||||
printInfo(idl1);
|
printInfo(idl1);
|
||||||
|
|
||||||
|
labelList::subList slice(scratch, idl1.size());
|
||||||
|
slice = idl1;
|
||||||
|
|
||||||
|
Info<< "sliced: " << flatOutput(slice) << nl;
|
||||||
|
Info<< "scratch: " << flatOutput(scratch) << nl;
|
||||||
|
|
||||||
|
// Again, but offset and using intermediate only
|
||||||
|
scratch = -1;
|
||||||
|
labelList::subList(scratch, idl1.size(), 5) = idl1;
|
||||||
|
Info<< "offset: " << flatOutput(scratch) << nl;
|
||||||
|
|
||||||
|
|
||||||
for (const label val : { 10, 30, 40, 50, 90, 80, 120 } )
|
for (const label val : { 10, 30, 40, 50, 90, 80, 120 } )
|
||||||
{
|
{
|
||||||
testFind(val, idl1);
|
testFind(val, idl1);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,6 +33,8 @@ Description
|
|||||||
|
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "labelledTri.H"
|
#include "labelledTri.H"
|
||||||
|
#include "faceList.H"
|
||||||
|
#include "triFaceList.H"
|
||||||
#include "pointList.H"
|
#include "pointList.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
|
||||||
@ -63,6 +65,35 @@ void testSign
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Face>
|
||||||
|
void testEdges(const Face& f)
|
||||||
|
{
|
||||||
|
const label nEdges = f.nEdges();
|
||||||
|
Info<< "face: " << f << nl
|
||||||
|
<< "flip: " << f.reverseFace() << nl
|
||||||
|
<< " fc edges:" << flatOutput(f.edges()) << nl
|
||||||
|
<< " rc edges:" << flatOutput(f.rcEdges()) << nl;
|
||||||
|
|
||||||
|
Info<< " forward edges" << nl;
|
||||||
|
for (label edgei = 0; edgei < nEdges; ++edgei)
|
||||||
|
{
|
||||||
|
Info<< " " << edgei << " : " << f.edge(edgei) << nl;
|
||||||
|
}
|
||||||
|
Info<< " reverse edges" << nl;
|
||||||
|
for (label edgei = 0; edgei < nEdges; ++edgei)
|
||||||
|
{
|
||||||
|
Info<< " " << edgei << " : " << f.rcEdge(edgei) << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void testCompare(const triFace& a, const triFace& b)
|
||||||
|
{
|
||||||
|
Info<< "compare: " << a << " with " << b
|
||||||
|
<< " == " << triFace::compare(a, b) << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Main program:
|
// Main program:
|
||||||
|
|
||||||
@ -92,7 +123,7 @@ int main(int argc, char *argv[])
|
|||||||
{ 2, 2, 2}
|
{ 2, 2, 2}
|
||||||
});
|
});
|
||||||
|
|
||||||
face f1{ 1, 2, 3, 4 };
|
face f1({1, 2, 3, 4});
|
||||||
Info<< "face:"; faceInfo(f1, points1); Info << nl;
|
Info<< "face:"; faceInfo(f1, points1); Info << nl;
|
||||||
testSign(f1, points1, testPoints);
|
testSign(f1, points1, testPoints);
|
||||||
|
|
||||||
@ -100,7 +131,7 @@ int main(int argc, char *argv[])
|
|||||||
testSign(f1, points2, testPoints);
|
testSign(f1, points2, testPoints);
|
||||||
Info<< nl;
|
Info<< nl;
|
||||||
|
|
||||||
triFace t1{ 1, 2, 3 };
|
triFace t1({1, 2, 3});
|
||||||
Info<< "triFace:"; faceInfo(t1, points1); Info << nl;
|
Info<< "triFace:"; faceInfo(t1, points1); Info << nl;
|
||||||
testSign(t1, points1, testPoints);
|
testSign(t1, points1, testPoints);
|
||||||
|
|
||||||
@ -115,11 +146,12 @@ int main(int argc, char *argv[])
|
|||||||
f1 = t1.triFaceFace();
|
f1 = t1.triFaceFace();
|
||||||
Info<< "face:" << f1 << nl;
|
Info<< "face:" << f1 << nl;
|
||||||
|
|
||||||
// expect these to fail
|
#if 0
|
||||||
|
// Expect failure, but triggers abort which cannot be caught
|
||||||
const bool throwingError = FatalError.throwExceptions();
|
const bool throwingError = FatalError.throwExceptions();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
labelledTri l1{ 1, 2, 3, 10, 24 };
|
labelledTri l1({1, 2, 3, 10, 24});
|
||||||
Info<< "labelled:" << l1 << nl;
|
Info<< "labelled:" << l1 << nl;
|
||||||
}
|
}
|
||||||
catch (const Foam::error& err)
|
catch (const Foam::error& err)
|
||||||
@ -128,11 +160,12 @@ int main(int argc, char *argv[])
|
|||||||
<< "Caught FatalError " << err << nl << endl;
|
<< "Caught FatalError " << err << nl << endl;
|
||||||
}
|
}
|
||||||
FatalError.throwExceptions(throwingError);
|
FatalError.throwExceptions(throwingError);
|
||||||
|
#endif
|
||||||
|
|
||||||
labelledTri l2{ 1, 2, 3 };
|
labelledTri l2({1, 2, 3});
|
||||||
Info<< "labelled:" << l2 << nl;
|
Info<< "labelled:" << l2 << nl;
|
||||||
|
|
||||||
labelledTri l3{ 1, 2, 3, 10 };
|
labelledTri l3({1, 2, 3, 10});
|
||||||
Info<< "labelled:" << l3 << nl;
|
Info<< "labelled:" << l3 << nl;
|
||||||
|
|
||||||
t1.flip();
|
t1.flip();
|
||||||
@ -141,6 +174,62 @@ int main(int argc, char *argv[])
|
|||||||
Info<< "flip:" << t1 << nl;
|
Info<< "flip:" << t1 << nl;
|
||||||
Info<< "flip:" << l3 << nl;
|
Info<< "flip:" << l3 << nl;
|
||||||
|
|
||||||
|
{
|
||||||
|
triFaceList faceList1
|
||||||
|
({
|
||||||
|
triFace{1, 2, 3},
|
||||||
|
triFace{4, 2, 100},
|
||||||
|
triFace{1, 3, 2},
|
||||||
|
});
|
||||||
|
|
||||||
|
Info<< nl << "Test edges" << nl;
|
||||||
|
|
||||||
|
for (const auto& f : faceList1)
|
||||||
|
{
|
||||||
|
testEdges(f);
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
faceList faceList1
|
||||||
|
({
|
||||||
|
face{1, 2, 3, 4},
|
||||||
|
face{1, 4, 3, 2},
|
||||||
|
face{4, 2, 100, 8, 35},
|
||||||
|
});
|
||||||
|
|
||||||
|
Info<< nl << "Test edges" << nl;
|
||||||
|
|
||||||
|
for (const auto& f : faceList1)
|
||||||
|
{
|
||||||
|
testEdges(f);
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
triFaceList faceList1
|
||||||
|
({
|
||||||
|
triFace{1, 2, 3},
|
||||||
|
triFace{1, 3, 2},
|
||||||
|
triFace{3, 1, 2},
|
||||||
|
triFace{4, 5, 1},
|
||||||
|
});
|
||||||
|
|
||||||
|
Info<< nl << "Test triFace compare" << nl;
|
||||||
|
for (const triFace& a : faceList1)
|
||||||
|
{
|
||||||
|
for (const triFace& b : faceList1)
|
||||||
|
{
|
||||||
|
testCompare(a, b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Info<< nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,14 +28,16 @@ Application
|
|||||||
globalIndexTest
|
globalIndexTest
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Simple demonstration and test application for the globalIndex class.
|
Simple tests for the globalIndex class.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "globalIndex.H"
|
#include "globalIndex.H"
|
||||||
|
#include "globalMeshData.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
|
#include "IndirectList.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "Random.H"
|
#include "Random.H"
|
||||||
|
|
||||||
@ -218,6 +220,34 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<< "Gather indirect list of boundary points (patch = 0)\n";
|
||||||
|
{
|
||||||
|
const polyPatch& pp = mesh.boundaryMesh()[0];
|
||||||
|
|
||||||
|
// Map mesh point index to local (compact) point index
|
||||||
|
labelList pointToGlobal;
|
||||||
|
labelList uniqueMeshPointLabels;
|
||||||
|
|
||||||
|
autoPtr<globalIndex> globalPointsPtr =
|
||||||
|
mesh.globalData().mergePoints
|
||||||
|
(
|
||||||
|
pp.meshPoints(),
|
||||||
|
pp.meshPointMap(),
|
||||||
|
pointToGlobal,
|
||||||
|
uniqueMeshPointLabels
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "local-sizes: " << globalPointsPtr().sizes() << nl;
|
||||||
|
|
||||||
|
UIndirectList<point> procPoints(mesh.points(), uniqueMeshPointLabels);
|
||||||
|
pointField patchPoints;
|
||||||
|
|
||||||
|
globalPointsPtr().gather(procPoints, patchPoints);
|
||||||
|
|
||||||
|
Info<< "gathered point field = " << patchPoints.size() << " points\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< "\nEnd\n" << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,6 +34,7 @@ Description
|
|||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "primitiveFacePatch.H"
|
#include "primitiveFacePatch.H"
|
||||||
#include "primitivePatch.H"
|
#include "primitivePatch.H"
|
||||||
|
#include "IndirectList.H"
|
||||||
#include "Fstream.H"
|
#include "Fstream.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
@ -242,6 +243,28 @@ int main(int argc, char *argv[])
|
|||||||
writeEdgeFaces(localPoints, localFaces, edges, edgeFaces);
|
writeEdgeFaces(localPoints, localFaces, edges, edgeFaces);
|
||||||
|
|
||||||
writeFaceFaces(localPoints, localFaces, faceFaces);
|
writeFaceFaces(localPoints, localFaces, faceFaces);
|
||||||
|
|
||||||
|
const labelList bndFaceIds(pp.boundaryFaces());
|
||||||
|
|
||||||
|
Info<< "Have: " << bndFaceIds.size() << " boundary faces" << nl;
|
||||||
|
|
||||||
|
// Can calculate by hand
|
||||||
|
if (!pp.hasFaceCentres())
|
||||||
|
{
|
||||||
|
pointField boundaryCentres(bndFaceIds.size());
|
||||||
|
|
||||||
|
forAll(bndFaceIds, facei)
|
||||||
|
{
|
||||||
|
boundaryCentres[facei] =
|
||||||
|
pp[bndFaceIds[facei]].centre(pp.points());
|
||||||
|
}
|
||||||
|
Info << "calc faceCentres:"
|
||||||
|
<< boundaryCentres << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// But will often use the cached information
|
||||||
|
Info<< "faceCentres:"
|
||||||
|
<< UIndirectList<point>(pp.faceCentres(), bndFaceIds) << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move construct
|
// Move construct
|
||||||
|
|||||||
@ -38,8 +38,6 @@ Description
|
|||||||
#include "centredCPCCellToCellStencilObject.H"
|
#include "centredCPCCellToCellStencilObject.H"
|
||||||
#include "zoneDistribute.H"
|
#include "zoneDistribute.H"
|
||||||
|
|
||||||
#include "SortableList.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|||||||
@ -212,7 +212,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from IOobject
|
//- Construct from IOobject
|
||||||
fluentFvMesh(const IOobject& io);
|
explicit fluentFvMesh(const IOobject& io);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
|
|||||||
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fluentFvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
runTime
|
runTime
|
||||||
)
|
)
|
||||||
|
|||||||
@ -233,7 +233,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
regionName = fvMesh::defaultRegion;
|
regionName = polyMesh::defaultRegion;
|
||||||
Info<< "Create mesh for time = "
|
Info<< "Create mesh for time = "
|
||||||
<< runTimeExtruded.timeName() << nl << endl;
|
<< runTimeExtruded.timeName() << nl << endl;
|
||||||
}
|
}
|
||||||
@ -787,7 +787,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
extrudedMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTimeExtruded.constant(),
|
runTimeExtruded.constant(),
|
||||||
runTimeExtruded
|
runTimeExtruded
|
||||||
),
|
),
|
||||||
|
|||||||
@ -73,7 +73,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
mirrorFvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
runTime
|
runTime
|
||||||
),
|
),
|
||||||
|
|||||||
@ -2303,7 +2303,7 @@ int main(int argc, char *argv[])
|
|||||||
// than it writes to
|
// than it writes to
|
||||||
// - reconstruct - reads parallel, write on master only and to parent
|
// - reconstruct - reads parallel, write on master only and to parent
|
||||||
// directory
|
// directory
|
||||||
const_cast<fileOperation&>(fileHandler()).distributed(true);
|
fileHandler().distributed(true);
|
||||||
|
|
||||||
|
|
||||||
#include "foamDlOpenLibs.H"
|
#include "foamDlOpenLibs.H"
|
||||||
@ -2905,7 +2905,7 @@ int main(int argc, char *argv[])
|
|||||||
const word& regionName = regionNames[regioni];
|
const word& regionName = regionNames[regioni];
|
||||||
const fileName meshSubDir
|
const fileName meshSubDir
|
||||||
(
|
(
|
||||||
regionName == fvMesh::defaultRegion
|
regionName == polyMesh::defaultRegion
|
||||||
? fileName(polyMesh::meshSubDir)
|
? fileName(polyMesh::meshSubDir)
|
||||||
: regionNames[regioni]/polyMesh::meshSubDir
|
: regionNames[regioni]/polyMesh::meshSubDir
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
// As much as possible avoid synchronised operation
|
// As much as possible avoid synchronised operation
|
||||||
const_cast<fileOperation&>(fileHandler()).distributed(true);
|
fileHandler().distributed(true);
|
||||||
|
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
|
|||||||
@ -499,7 +499,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
fileName regionPrefix;
|
fileName regionPrefix;
|
||||||
if (regionName != fvMesh::defaultRegion)
|
if (regionName != polyMesh::defaultRegion)
|
||||||
{
|
{
|
||||||
regionPrefix = regionName;
|
regionPrefix = regionName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,7 +89,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
wordList regionNames(1, fvMesh::defaultRegion);
|
wordList regionNames(1, polyMesh::defaultRegion);
|
||||||
if (!args.readIfPresent("region", regionNames.first()))
|
if (!args.readIfPresent("region", regionNames.first()))
|
||||||
{
|
{
|
||||||
args.readIfPresent("regions", regionNames);
|
args.readIfPresent("regions", regionNames);
|
||||||
|
|||||||
@ -291,7 +291,7 @@ int main(int argc, char *argv[])
|
|||||||
const fileName caseDirSource = casePath.name();
|
const fileName caseDirSource = casePath.name();
|
||||||
|
|
||||||
Info<< "Source: " << rootDirSource << " " << caseDirSource << endl;
|
Info<< "Source: " << rootDirSource << " " << caseDirSource << endl;
|
||||||
word sourceRegion = fvMesh::defaultRegion;
|
word sourceRegion = polyMesh::defaultRegion;
|
||||||
if (args.found("sourceRegion"))
|
if (args.found("sourceRegion"))
|
||||||
{
|
{
|
||||||
sourceRegion = args["sourceRegion"];
|
sourceRegion = args["sourceRegion"];
|
||||||
@ -299,7 +299,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Target: " << rootDirTarget << " " << caseDirTarget << endl;
|
Info<< "Target: " << rootDirTarget << " " << caseDirTarget << endl;
|
||||||
word targetRegion = fvMesh::defaultRegion;
|
word targetRegion = polyMesh::defaultRegion;
|
||||||
if (args.found("targetRegion"))
|
if (args.found("targetRegion"))
|
||||||
{
|
{
|
||||||
targetRegion = args["targetRegion"];
|
targetRegion = args["targetRegion"];
|
||||||
|
|||||||
@ -219,14 +219,14 @@ int main(int argc, char *argv[])
|
|||||||
const fileName caseDirSource = casePath.name();
|
const fileName caseDirSource = casePath.name();
|
||||||
|
|
||||||
Info<< "Source: " << rootDirSource << " " << caseDirSource << endl;
|
Info<< "Source: " << rootDirSource << " " << caseDirSource << endl;
|
||||||
word sourceRegion = fvMesh::defaultRegion;
|
word sourceRegion = polyMesh::defaultRegion;
|
||||||
if (args.readIfPresent("sourceRegion", sourceRegion))
|
if (args.readIfPresent("sourceRegion", sourceRegion))
|
||||||
{
|
{
|
||||||
Info<< "Source region: " << sourceRegion << endl;
|
Info<< "Source region: " << sourceRegion << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Target: " << rootDirTarget << " " << caseDirTarget << endl;
|
Info<< "Target: " << rootDirTarget << " " << caseDirTarget << endl;
|
||||||
word targetRegion = fvMesh::defaultRegion;
|
word targetRegion = polyMesh::defaultRegion;
|
||||||
if (args.readIfPresent("targetRegion", targetRegion))
|
if (args.readIfPresent("targetRegion", targetRegion))
|
||||||
{
|
{
|
||||||
Info<< "Target region: " << targetRegion << endl;
|
Info<< "Target region: " << targetRegion << endl;
|
||||||
|
|||||||
@ -655,7 +655,7 @@ $(mapPolyMesh)/mapDistribute/IOmapDistribute.C
|
|||||||
$(mapPolyMesh)/mapAddedPolyMesh.C
|
$(mapPolyMesh)/mapAddedPolyMesh.C
|
||||||
|
|
||||||
PrimitivePatch = $(primitiveMesh)/PrimitivePatch
|
PrimitivePatch = $(primitiveMesh)/PrimitivePatch
|
||||||
$(PrimitivePatch)/PrimitivePatchName.C
|
$(PrimitivePatch)/PrimitivePatchBase.C
|
||||||
|
|
||||||
pointMesh = meshes/pointMesh
|
pointMesh = meshes/pointMesh
|
||||||
$(pointMesh)/pointMesh.C
|
$(pointMesh)/pointMesh.C
|
||||||
|
|||||||
@ -123,52 +123,25 @@ public:
|
|||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- The number of elements in the list
|
//- The number of elements in the list
|
||||||
inline label size() const
|
inline label size() const noexcept
|
||||||
{
|
{
|
||||||
return addr_.size();
|
return addr_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- True if the list is empty (ie, size() is zero).
|
//- True if the list is empty (ie, size() is zero).
|
||||||
inline bool empty() const
|
inline bool empty() const noexcept
|
||||||
{
|
{
|
||||||
return addr_.empty();
|
return addr_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- True if all entries have identical values, and list is non-empty
|
|
||||||
inline bool uniform() const;
|
|
||||||
|
|
||||||
//- The first element of the list.
|
|
||||||
inline T& first()
|
|
||||||
{
|
|
||||||
return values_[addr_.first()];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- The first element of the list.
|
|
||||||
inline const T& first() const
|
|
||||||
{
|
|
||||||
return values_[addr_.first()];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- The last element of the list.
|
|
||||||
inline T& last()
|
|
||||||
{
|
|
||||||
return values_[addr_.last()];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- The last element of the list.
|
|
||||||
inline const T& last() const
|
|
||||||
{
|
|
||||||
return values_[addr_.last()];
|
|
||||||
}
|
|
||||||
|
|
||||||
//- The list of values (without addressing)
|
//- The list of values (without addressing)
|
||||||
inline const UList<T>& values() const
|
inline const UList<T>& values() const noexcept
|
||||||
{
|
{
|
||||||
return values_;
|
return values_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- The list of values (without addressing)
|
//- The list of values (without addressing)
|
||||||
inline UList<T>& values()
|
inline UList<T>& values() noexcept
|
||||||
{
|
{
|
||||||
return values_;
|
return values_;
|
||||||
}
|
}
|
||||||
@ -179,6 +152,41 @@ public:
|
|||||||
return addr_;
|
return addr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- True if all entries have identical values, and list is non-empty
|
||||||
|
inline bool uniform() const;
|
||||||
|
|
||||||
|
//- The first element of the list.
|
||||||
|
inline const T& first() const;
|
||||||
|
|
||||||
|
//- The first element of the list.
|
||||||
|
inline T& first();
|
||||||
|
|
||||||
|
//- The last element of the list.
|
||||||
|
inline const T& last() const;
|
||||||
|
|
||||||
|
//- The last element of the list.
|
||||||
|
inline T& last();
|
||||||
|
|
||||||
|
//- The forward circular index. The next index in the list
|
||||||
|
//- which returns to the first at the end of the list
|
||||||
|
inline label fcIndex(const label i) const;
|
||||||
|
|
||||||
|
//- The reverse circular index. The previous index in the list
|
||||||
|
//- which returns to the last at the beginning of the list
|
||||||
|
inline label rcIndex(const label i) const;
|
||||||
|
|
||||||
|
//- Return forward circular value (ie, next value in the list)
|
||||||
|
inline const T& fcValue(const label i) const;
|
||||||
|
|
||||||
|
//- Return forward circular value (ie, next value in the list)
|
||||||
|
inline T& fcValue(const label i);
|
||||||
|
|
||||||
|
//- Return reverse circular value (ie, previous value in the list)
|
||||||
|
inline const T& rcValue(const label i) const;
|
||||||
|
|
||||||
|
//- Return reverse circular value (ie, previous value in the list)
|
||||||
|
inline T& rcValue(const label i);
|
||||||
|
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -84,9 +84,9 @@ inline bool Foam::IndirectListBase<T, Addr>::uniform() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const T& val = (*this)[0];
|
const T& val = (*this)[0]; // first
|
||||||
|
|
||||||
for (label i=1; i<len; ++i)
|
for (label i = 1; i < len; ++i)
|
||||||
{
|
{
|
||||||
if (val != (*this)[i])
|
if (val != (*this)[i])
|
||||||
{
|
{
|
||||||
@ -109,6 +109,74 @@ inline bool Foam::IndirectListBase<T, Addr>::found
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline Foam::label Foam::IndirectListBase<T, Addr>::fcIndex(const label i) const
|
||||||
|
{
|
||||||
|
return (i == addr_.size()-1 ? 0 : i+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline Foam::label Foam::IndirectListBase<T, Addr>::rcIndex(const label i) const
|
||||||
|
{
|
||||||
|
return (i ? i-1 : addr_.size()-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline const T& Foam::IndirectListBase<T, Addr>::first() const
|
||||||
|
{
|
||||||
|
return values_[addr_.first()];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline T& Foam::IndirectListBase<T, Addr>::first()
|
||||||
|
{
|
||||||
|
return values_[addr_.first()];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline const T& Foam::IndirectListBase<T, Addr>::last() const
|
||||||
|
{
|
||||||
|
return values_[addr_.last()];
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline T& Foam::IndirectListBase<T, Addr>::last()
|
||||||
|
{
|
||||||
|
return values_[addr_.last()];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline const T& Foam::IndirectListBase<T, Addr>::fcValue(const label i) const
|
||||||
|
{
|
||||||
|
return values_[this->fcIndex(i)];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline T& Foam::IndirectListBase<T, Addr>::fcValue(const label i)
|
||||||
|
{
|
||||||
|
return values_[this->fcIndex(i)];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline const T& Foam::IndirectListBase<T, Addr>::rcValue(const label i) const
|
||||||
|
{
|
||||||
|
return values_[this->rcIndex(i)];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T, class Addr>
|
||||||
|
inline T& Foam::IndirectListBase<T, Addr>::rcValue(const label i)
|
||||||
|
{
|
||||||
|
return values_[this->rcIndex(i)];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T, class Addr>
|
template<class T, class Addr>
|
||||||
|
|||||||
@ -122,11 +122,6 @@ public:
|
|||||||
template<unsigned N>
|
template<unsigned N>
|
||||||
inline DynamicList(const FixedList<T, N>& lst);
|
inline DynamicList(const FixedList<T, N>& lst);
|
||||||
|
|
||||||
//- Construct given begin/end iterators.
|
|
||||||
// Uses std::distance to determine the size.
|
|
||||||
template<class InputIterator>
|
|
||||||
inline DynamicList(InputIterator begIter, InputIterator endIter);
|
|
||||||
|
|
||||||
//- Construct from an initializer list. Size set to list size.
|
//- Construct from an initializer list. Size set to list size.
|
||||||
inline explicit DynamicList(std::initializer_list<T> lst);
|
inline explicit DynamicList(std::initializer_list<T> lst);
|
||||||
|
|
||||||
|
|||||||
@ -147,19 +147,6 @@ inline Foam::DynamicList<T, SizeMin>::DynamicList
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T, int SizeMin>
|
|
||||||
template<class InputIterator>
|
|
||||||
inline Foam::DynamicList<T, SizeMin>::DynamicList
|
|
||||||
(
|
|
||||||
InputIterator begIter,
|
|
||||||
InputIterator endIter
|
|
||||||
)
|
|
||||||
:
|
|
||||||
List<T>(begIter, endIter),
|
|
||||||
capacity_(List<T>::size())
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class T, int SizeMin>
|
template<class T, int SizeMin>
|
||||||
inline Foam::DynamicList<T, SizeMin>::DynamicList
|
inline Foam::DynamicList<T, SizeMin>::DynamicList
|
||||||
(
|
(
|
||||||
|
|||||||
@ -336,14 +336,6 @@ Foam::List<T>::List
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
template<class InputIterator>
|
|
||||||
Foam::List<T>::List(InputIterator begIter, InputIterator endIter)
|
|
||||||
:
|
|
||||||
List<T>(begIter, endIter, std::distance(begIter, endIter))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
template<unsigned N>
|
template<unsigned N>
|
||||||
Foam::List<T>::List(const FixedList<T, N>& list)
|
Foam::List<T>::List(const FixedList<T, N>& list)
|
||||||
|
|||||||
@ -53,16 +53,12 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class Istream;
|
|
||||||
class Ostream;
|
|
||||||
|
|
||||||
template<class T> class List;
|
template<class T> class List;
|
||||||
template<class T, unsigned N> class FixedList;
|
template<class T, unsigned N> class FixedList;
|
||||||
template<class T, int SizeMin> class DynamicList;
|
template<class T, int SizeMin> class DynamicList;
|
||||||
|
|
||||||
template<class T> class PtrList;
|
template<class T> class PtrList;
|
||||||
template<class T> class SortableList;
|
template<class T> class SortableList;
|
||||||
template<class T, class Addr> class IndirectListBase;
|
|
||||||
|
|
||||||
template<class T> Istream& operator>>(Istream& is, List<T>& list);
|
template<class T> Istream& operator>>(Istream& is, List<T>& list);
|
||||||
|
|
||||||
@ -160,11 +156,6 @@ public:
|
|||||||
template<unsigned N>
|
template<unsigned N>
|
||||||
List(const UList<T>& list, const FixedList<label, N>& indices);
|
List(const UList<T>& list, const FixedList<label, N>& indices);
|
||||||
|
|
||||||
//- Construct given begin/end iterators.
|
|
||||||
// Uses std::distance for the size.
|
|
||||||
template<class InputIterator>
|
|
||||||
List(InputIterator begIter, InputIterator endIter);
|
|
||||||
|
|
||||||
//- Construct as copy of FixedList\<T, N\>
|
//- Construct as copy of FixedList\<T, N\>
|
||||||
template<unsigned N>
|
template<unsigned N>
|
||||||
explicit List(const FixedList<T, N>& list);
|
explicit List(const FixedList<T, N>& list);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -125,12 +125,16 @@ public:
|
|||||||
//- Allow cast to a const List\<T\>&
|
//- Allow cast to a const List\<T\>&
|
||||||
inline operator const Foam::List<T>&() const;
|
inline operator const Foam::List<T>&() const;
|
||||||
|
|
||||||
//- Copy assign entries from given sub-list
|
//- Copy assign entries from given sub-list. Sizes must match!
|
||||||
inline void operator=(const SubList<T>& list);
|
inline void operator=(const SubList<T>& list);
|
||||||
|
|
||||||
//- Copy assign entries from given list
|
//- Copy assign entries from given list. Sizes must match!
|
||||||
inline void operator=(const UList<T>& list);
|
inline void operator=(const UList<T>& list);
|
||||||
|
|
||||||
|
//- Copy assign entries from given indirect list. Sizes must match!
|
||||||
|
template<class Addr>
|
||||||
|
inline void operator=(const IndirectListBase<T, Addr>& list);
|
||||||
|
|
||||||
//- Assign all entries to the given value
|
//- Assign all entries to the given value
|
||||||
inline void operator=(const T& val);
|
inline void operator=(const T& val);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -135,6 +135,14 @@ inline void Foam::SubList<T>::operator=(const UList<T>& list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
template<class Addr>
|
||||||
|
inline void Foam::SubList<T>::operator=(const IndirectListBase<T, Addr>& list)
|
||||||
|
{
|
||||||
|
UList<T>::deepCopy(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void Foam::SubList<T>::operator=(const T& val)
|
inline void Foam::SubList<T>::operator=(const T& val)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -110,8 +110,8 @@ void Foam::UList<T>::deepCopy(const UList<T>& list)
|
|||||||
if (len != list.size_)
|
if (len != list.size_)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "ULists have different sizes: "
|
<< "Lists have different sizes: "
|
||||||
<< len << " " << list.size_
|
<< len << " != " << list.size() << nl
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
else if (len)
|
else if (len)
|
||||||
@ -138,6 +138,30 @@ void Foam::UList<T>::deepCopy(const UList<T>& list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
template<class Addr>
|
||||||
|
void Foam::UList<T>::deepCopy(const IndirectListBase<T, Addr>& list)
|
||||||
|
{
|
||||||
|
const label len = this->size_;
|
||||||
|
|
||||||
|
if (len != list.size())
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Lists have different sizes: "
|
||||||
|
<< len << " != " << list.size() << nl
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
else if (len)
|
||||||
|
{
|
||||||
|
List_ACCESS(T, (*this), lhs);
|
||||||
|
for (label i = 0; i < len; ++i)
|
||||||
|
{
|
||||||
|
lhs[i] = list[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
@ -68,10 +68,15 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
|
class Istream;
|
||||||
|
class Ostream;
|
||||||
class labelRange;
|
class labelRange;
|
||||||
|
|
||||||
template<class T> class List;
|
template<class T> class List;
|
||||||
template<class T> class SubList;
|
template<class T> class SubList;
|
||||||
template<class T> class UList;
|
template<class T> class UList;
|
||||||
|
template<class T, class Addr> class IndirectListBase;
|
||||||
|
|
||||||
template<class T> Istream& operator>>(Istream&, UList<T>&);
|
template<class T> Istream& operator>>(Istream&, UList<T>&);
|
||||||
template<class T> Ostream& operator<<(Ostream&, const UList<T>&);
|
template<class T> Ostream& operator<<(Ostream&, const UList<T>&);
|
||||||
|
|
||||||
@ -232,9 +237,13 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the forward circular index, i.e. next index
|
//- The forward circular index. The next index in the list
|
||||||
//- which returns to the first at the end of the list
|
//- which returns to the first at the end of the list
|
||||||
inline label fcIndex(const label i) const;
|
inline label fcIndex(const label i) const noexcept;
|
||||||
|
|
||||||
|
//- The reverse circular index. The previous index in the list
|
||||||
|
//- which returns to the last at the beginning of the list
|
||||||
|
inline label rcIndex(const label i) const noexcept;
|
||||||
|
|
||||||
//- Return forward circular value (ie, next value in the list)
|
//- Return forward circular value (ie, next value in the list)
|
||||||
inline const T& fcValue(const label i) const;
|
inline const T& fcValue(const label i) const;
|
||||||
@ -242,10 +251,6 @@ public:
|
|||||||
//- Return forward circular value (ie, next value in the list)
|
//- Return forward circular value (ie, next value in the list)
|
||||||
inline T& fcValue(const label i);
|
inline T& fcValue(const label i);
|
||||||
|
|
||||||
//- Return the reverse circular index, i.e. previous index
|
|
||||||
//- which returns to the last at the beginning of the list
|
|
||||||
inline label rcIndex(const label i) const;
|
|
||||||
|
|
||||||
//- Return reverse circular value (ie, previous value in the list)
|
//- Return reverse circular value (ie, previous value in the list)
|
||||||
inline const T& rcValue(const label i) const;
|
inline const T& rcValue(const label i) const;
|
||||||
|
|
||||||
@ -342,6 +347,10 @@ public:
|
|||||||
//- Copy elements of the given UList
|
//- Copy elements of the given UList
|
||||||
void deepCopy(const UList<T>& list);
|
void deepCopy(const UList<T>& list);
|
||||||
|
|
||||||
|
//- Copy elements of the given indirect list
|
||||||
|
template<class Addr>
|
||||||
|
void deepCopy(const IndirectListBase<T, Addr>& list);
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
@ -493,7 +502,7 @@ public:
|
|||||||
typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
|
typename std::enable_if<std::is_same<bool, TypeT>::value, bool>::type
|
||||||
inline test(const label i) const
|
inline test(const label i) const
|
||||||
{
|
{
|
||||||
return (i >= 0 && i < size() && v_[i]);
|
return (i >= 0 && i < size_ && v_[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- A bitSet::get() method for a list of bool
|
//- A bitSet::get() method for a list of bool
|
||||||
|
|||||||
@ -57,12 +57,19 @@ inline const Foam::UList<T>& Foam::UList<T>::null()
|
|||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline Foam::label Foam::UList<T>::fcIndex(const label i) const
|
inline Foam::label Foam::UList<T>::fcIndex(const label i) const noexcept
|
||||||
{
|
{
|
||||||
return (i == size()-1 ? 0 : i+1);
|
return (i == size()-1 ? 0 : i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline Foam::label Foam::UList<T>::rcIndex(const label i) const noexcept
|
||||||
|
{
|
||||||
|
return (i ? i-1 : size()-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline const T& Foam::UList<T>::fcValue(const label i) const
|
inline const T& Foam::UList<T>::fcValue(const label i) const
|
||||||
{
|
{
|
||||||
@ -77,13 +84,6 @@ inline T& Foam::UList<T>::fcValue(const label i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline Foam::label Foam::UList<T>::rcIndex(const label i) const
|
|
||||||
{
|
|
||||||
return (i ? i-1 : size()-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline const T& Foam::UList<T>::rcValue(const label i) const
|
inline const T& Foam::UList<T>::rcValue(const label i) const
|
||||||
{
|
{
|
||||||
@ -146,14 +146,14 @@ inline bool Foam::UList<T>::uniform() const
|
|||||||
{
|
{
|
||||||
const label len = size();
|
const label len = size();
|
||||||
|
|
||||||
if (len == 0)
|
if (!len)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const T& val = first();
|
const T& val = (*this)[0]; // first
|
||||||
|
|
||||||
for (label i=1; i<len; ++i)
|
for (label i = 1; i < len; ++i)
|
||||||
{
|
{
|
||||||
if (val != (*this)[i])
|
if (val != (*this)[i])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -101,7 +101,7 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
// For temporary fields that are initialised after construction
|
// For temporary fields that are initialised after construction
|
||||||
inline constexpr Field() noexcept;
|
inline constexpr Field() noexcept;
|
||||||
|
|
||||||
@ -374,8 +374,13 @@ public:
|
|||||||
//- Copy assignment
|
//- Copy assignment
|
||||||
void operator=(const Field<Type>&);
|
void operator=(const Field<Type>&);
|
||||||
void operator=(const tmp<Field<Type>>&);
|
void operator=(const tmp<Field<Type>>&);
|
||||||
inline void operator=(const UList<Type>&);
|
|
||||||
inline void operator=(const SubField<Type>&);
|
inline void operator=(const UList<Type>& rhs);
|
||||||
|
inline void operator=(const SubField<Type>& rhs);
|
||||||
|
|
||||||
|
//- Copy assign from IndirectList
|
||||||
|
template<class Addr>
|
||||||
|
inline void operator=(const IndirectListBase<Type, Addr>& rhs);
|
||||||
|
|
||||||
//- Move assignment
|
//- Move assignment
|
||||||
inline void operator=(Field<Type>&& rhs);
|
inline void operator=(Field<Type>&& rhs);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -172,6 +172,17 @@ inline void Foam::Field<Type>::operator=(const SubField<Type>& rhs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
template<class Addr>
|
||||||
|
inline void Foam::Field<Type>::operator=
|
||||||
|
(
|
||||||
|
const IndirectListBase<Type, Addr>& rhs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
List<Type>::operator=(rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline void Foam::Field<Type>::operator=(Field<Type>&& rhs)
|
inline void Foam::Field<Type>::operator=(Field<Type>&& rhs)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -729,6 +729,14 @@ Foam::fileOperation::New
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::fileOperation::distributed(bool on) const noexcept
|
||||||
|
{
|
||||||
|
bool old(distributed_);
|
||||||
|
distributed_ = on;
|
||||||
|
return old;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::fileOperation::objectPath
|
Foam::fileName Foam::fileOperation::objectPath
|
||||||
(
|
(
|
||||||
const IOobject& io,
|
const IOobject& io,
|
||||||
@ -1461,6 +1469,17 @@ Foam::label Foam::fileOperation::detectProcessorPath(const fileName& fName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::fileOperation> Foam::fileOperation::NewUncollated()
|
||||||
|
{
|
||||||
|
return autoPtr<fileOperation>
|
||||||
|
(
|
||||||
|
new fileOperations::uncollatedFileOperation(false)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::fileOperation& Foam::fileHandler()
|
const Foam::fileOperation& Foam::fileHandler()
|
||||||
@ -1481,7 +1500,8 @@ const Foam::fileOperation& Foam::fileHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fileHandler(autoPtr<fileOperation>&& newHandler)
|
Foam::autoPtr<Foam::fileOperation>
|
||||||
|
Foam::fileHandler(autoPtr<fileOperation>&& newHandler)
|
||||||
{
|
{
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -1490,10 +1510,14 @@ void Foam::fileHandler(autoPtr<fileOperation>&& newHandler)
|
|||||||
&& newHandler->type() == fileOperation::fileHandlerPtr_->type()
|
&& newHandler->type() == fileOperation::fileHandlerPtr_->type()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return;
|
return nullptr; // No change
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autoPtr<fileOperation> old(std::move(fileOperation::fileHandlerPtr_));
|
||||||
|
|
||||||
fileOperation::fileHandlerPtr_ = std::move(newHandler);
|
fileOperation::fileHandlerPtr_ = std::move(newHandler);
|
||||||
|
|
||||||
|
return old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -112,7 +112,7 @@ protected:
|
|||||||
const label comm_;
|
const label comm_;
|
||||||
|
|
||||||
//- Distributed roots (parallel run)
|
//- Distributed roots (parallel run)
|
||||||
bool distributed_;
|
mutable bool distributed_;
|
||||||
|
|
||||||
//- Detected processors directories
|
//- Detected processors directories
|
||||||
mutable HashTable<dirIndexList> procsDirs_;
|
mutable HashTable<dirIndexList> procsDirs_;
|
||||||
@ -181,6 +181,9 @@ public:
|
|||||||
//- Static fileOperation
|
//- Static fileOperation
|
||||||
static autoPtr<fileOperation> fileHandlerPtr_;
|
static autoPtr<fileOperation> fileHandlerPtr_;
|
||||||
|
|
||||||
|
//- Static construct the commonly used uncollatedFileOperation
|
||||||
|
static autoPtr<fileOperation> NewUncollated();
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
@ -239,13 +242,9 @@ public:
|
|||||||
return distributed_;
|
return distributed_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Set distributed roots on/off, return old value
|
//- Set distributed roots on/off (mutable)
|
||||||
bool distributed(bool on) noexcept
|
// \return old value
|
||||||
{
|
bool distributed(bool on) const noexcept;
|
||||||
bool old(distributed_);
|
|
||||||
distributed_ = on;
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// OSSpecific equivalents
|
// OSSpecific equivalents
|
||||||
@ -595,14 +594,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
// Global declarations: defined in fileOperation.C
|
|
||||||
|
// Note: defined in fileOperation.C
|
||||||
|
|
||||||
//- Get current file handler
|
//- Get current file handler
|
||||||
const fileOperation& fileHandler();
|
const fileOperation& fileHandler();
|
||||||
|
|
||||||
//- Replace, reset file handler
|
//- Replace, reset file handler.
|
||||||
void fileHandler(autoPtr<fileOperation>&& newHandler);
|
// \return old handler on change, null otherwise
|
||||||
|
autoPtr<fileOperation> fileHandler(autoPtr<fileOperation>&& newHandler);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Foam::fvMesh mesh
|
|||||||
(
|
(
|
||||||
Foam::IOobject
|
Foam::IOobject
|
||||||
(
|
(
|
||||||
Foam::fvMesh::defaultRegion,
|
Foam::polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
Foam::IOobject::MUST_READ
|
Foam::IOobject::MUST_READ
|
||||||
|
|||||||
@ -31,6 +31,7 @@ License
|
|||||||
#include "triPointRef.H"
|
#include "triPointRef.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "mathematicalConstants.H"
|
||||||
#include "ConstCirculator.H"
|
#include "ConstCirculator.H"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -40,25 +41,18 @@ const char* const Foam::face::typeName = "face";
|
|||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::vectorField>
|
Foam::tmp<Foam::vectorField>
|
||||||
Foam::face::calcEdges(const UList<point>& points) const
|
Foam::face::calcEdgeVectors(const UList<point>& points) const
|
||||||
{
|
{
|
||||||
tmp<vectorField> tedges(new vectorField(size()));
|
auto tedgeVecs = tmp<vectorField>::New(size());
|
||||||
vectorField& edges = tedges.ref();
|
auto& edgeVecs = tedgeVecs.ref();
|
||||||
|
|
||||||
forAll(*this, i)
|
forAll(*this, i)
|
||||||
{
|
{
|
||||||
label ni = fcIndex(i);
|
edgeVecs[i] = vector(points[nextLabel(i)] - points[thisLabel(i)]);
|
||||||
|
edgeVecs[i].normalise();
|
||||||
point thisPt = points[operator[](i)];
|
|
||||||
point nextPt = points[operator[](ni)];
|
|
||||||
|
|
||||||
vector vec(nextPt - thisPt);
|
|
||||||
vec /= Foam::mag(vec) + VSMALL;
|
|
||||||
|
|
||||||
edges[i] = vec;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tedges;
|
return tedgeVecs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,11 +62,11 @@ Foam::scalar Foam::face::edgeCos
|
|||||||
const label index
|
const label index
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label leftEdgeI = left(index);
|
const vector& leftEdge = edges[rcIndex(index)];
|
||||||
label rightEdgeI = right(index);
|
const vector& rightEdge = edges[index];
|
||||||
|
|
||||||
// Note negate on left edge to get correct left-pointing edge.
|
// Note negate on left edge to get correct left-pointing edge.
|
||||||
return -(edges[leftEdgeI] & edges[rightEdgeI]);
|
return -(leftEdge & rightEdge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -90,12 +84,12 @@ Foam::label Foam::face::mostConcaveAngle
|
|||||||
|
|
||||||
forAll(edges, i)
|
forAll(edges, i)
|
||||||
{
|
{
|
||||||
label leftEdgeI = left(i);
|
const vector& leftEdge = edges[rcIndex(i)];
|
||||||
label rightEdgeI = right(i);
|
const vector& rightEdge = edges[i];
|
||||||
|
|
||||||
vector edgeNormal = edges[rightEdgeI] ^ edges[leftEdgeI];
|
vector edgeNormal = (rightEdge ^ leftEdge);
|
||||||
|
|
||||||
scalar edgeCos = edges[leftEdgeI] & edges[rightEdgeI];
|
scalar edgeCos = (leftEdge & rightEdge);
|
||||||
scalar edgeAngle = acos(max(-1.0, min(1.0, edgeCos)));
|
scalar edgeAngle = acos(max(-1.0, min(1.0, edgeCos)));
|
||||||
|
|
||||||
scalar angle;
|
scalar angle;
|
||||||
@ -133,15 +127,15 @@ Foam::label Foam::face::split
|
|||||||
faceList& quadFaces
|
faceList& quadFaces
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
label oldIndices = (triI + quadI);
|
const label oldIndices = (triI + quadI);
|
||||||
|
|
||||||
if (size() <= 2)
|
if (size() < 3)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Serious problem: asked to split a face with < 3 vertices"
|
<< "Serious problem: asked to split a face with < 3 vertices"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
if (size() == 3)
|
else if (size() == 3)
|
||||||
{
|
{
|
||||||
// Triangle. Just copy.
|
// Triangle. Just copy.
|
||||||
if (mode == COUNTTRIANGLE || mode == COUNTQUAD)
|
if (mode == COUNTTRIANGLE || mode == COUNTQUAD)
|
||||||
@ -166,7 +160,7 @@ Foam::label Foam::face::split
|
|||||||
else if (mode == SPLITTRIANGLE)
|
else if (mode == SPLITTRIANGLE)
|
||||||
{
|
{
|
||||||
// Start at point with largest internal angle.
|
// Start at point with largest internal angle.
|
||||||
const vectorField edges(calcEdges(points));
|
const vectorField edges(calcEdgeVectors(points));
|
||||||
|
|
||||||
scalar minAngle;
|
scalar minAngle;
|
||||||
label startIndex = mostConcaveAngle(points, edges, minAngle);
|
label startIndex = mostConcaveAngle(points, edges, minAngle);
|
||||||
@ -197,13 +191,13 @@ Foam::label Foam::face::split
|
|||||||
{
|
{
|
||||||
// General case. Like quad: search for largest internal angle.
|
// General case. Like quad: search for largest internal angle.
|
||||||
|
|
||||||
const vectorField edges(calcEdges(points));
|
const vectorField edges(calcEdgeVectors(points));
|
||||||
|
|
||||||
scalar minAngle = 1;
|
scalar minAngle = 1;
|
||||||
label startIndex = mostConcaveAngle(points, edges, minAngle);
|
label startIndex = mostConcaveAngle(points, edges, minAngle);
|
||||||
|
|
||||||
scalar bisectAngle = minAngle/2;
|
scalar bisectAngle = minAngle/2;
|
||||||
vector rightEdge = edges[right(startIndex)];
|
const vector& rightEdge = edges[startIndex];
|
||||||
|
|
||||||
//
|
//
|
||||||
// Look for opposite point which as close as possible bisects angle
|
// Look for opposite point which as close as possible bisects angle
|
||||||
@ -222,7 +216,7 @@ Foam::label Foam::face::split
|
|||||||
points[operator[](index)]
|
points[operator[](index)]
|
||||||
- points[operator[](startIndex)]
|
- points[operator[](startIndex)]
|
||||||
);
|
);
|
||||||
splitEdge /= Foam::mag(splitEdge) + VSMALL;
|
splitEdge.normalise();
|
||||||
|
|
||||||
const scalar splitCos = splitEdge & rightEdge;
|
const scalar splitCos = splitEdge & rightEdge;
|
||||||
const scalar splitAngle = acos(max(-1.0, min(1.0, splitCos)));
|
const scalar splitAngle = acos(max(-1.0, min(1.0, splitCos)));
|
||||||
@ -786,62 +780,57 @@ Foam::tensor Foam::face::inertia
|
|||||||
|
|
||||||
Foam::edgeList Foam::face::edges() const
|
Foam::edgeList Foam::face::edges() const
|
||||||
{
|
{
|
||||||
const labelList& points = *this;
|
const labelList& verts = *this;
|
||||||
|
const label nVerts = verts.size();
|
||||||
|
|
||||||
edgeList e(points.size());
|
edgeList theEdges(nVerts);
|
||||||
|
|
||||||
for (label pointi = 0; pointi < points.size() - 1; ++pointi)
|
// Last edge closes the polygon
|
||||||
|
theEdges.last().first() = verts.last();
|
||||||
|
theEdges.last().second() = verts[0];
|
||||||
|
|
||||||
|
for (label verti = 0; verti < nVerts - 1; ++verti)
|
||||||
{
|
{
|
||||||
e[pointi] = edge(points[pointi], points[pointi + 1]);
|
theEdges[verti].first() = verts[verti];
|
||||||
|
theEdges[verti].second() = verts[verti + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add last edge
|
return theEdges;
|
||||||
e.last() = edge(points.last(), points[0]);
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Foam::face::edgeDirection(const edge& e) const
|
Foam::edgeList Foam::face::rcEdges() const
|
||||||
{
|
{
|
||||||
forAll(*this, i)
|
const labelList& verts = *this;
|
||||||
|
const label nVerts = verts.size();
|
||||||
|
|
||||||
|
edgeList theEdges(nVerts);
|
||||||
|
|
||||||
|
// First edge closes the polygon
|
||||||
|
theEdges.first().first() = verts[0];
|
||||||
|
theEdges.first().second() = verts.last();
|
||||||
|
|
||||||
|
for (label verti = 1; verti < nVerts; ++verti)
|
||||||
{
|
{
|
||||||
if (operator[](i) == e.first())
|
theEdges[verti].first() = verts[nVerts - verti];
|
||||||
{
|
theEdges[verti].second() = verts[nVerts - verti - 1];
|
||||||
if (operator[](rcIndex(i)) == e.second())
|
|
||||||
{
|
|
||||||
// Reverse direction
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (operator[](fcIndex(i)) == e.second())
|
|
||||||
{
|
|
||||||
// Forward direction
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No match
|
return theEdges;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
else if (operator[](i) == e.second())
|
|
||||||
|
int Foam::face::edgeDirection(const Foam::edge& e) const
|
||||||
|
{
|
||||||
|
const label idx = find(e.first());
|
||||||
|
|
||||||
|
if (idx != -1)
|
||||||
{
|
{
|
||||||
if (operator[](rcIndex(i)) == e.first())
|
if (e.second() == nextLabel(idx)) return 1; // Forward
|
||||||
{
|
if (e.second() == prevLabel(idx)) return -1; // Reverse
|
||||||
// Forward direction
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (operator[](fcIndex(i)) == e.first())
|
|
||||||
{
|
|
||||||
// Reverse direction
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No match
|
return 0; // Not found
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not found
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -894,29 +883,26 @@ Foam::label Foam::face::trianglesQuads
|
|||||||
|
|
||||||
Foam::label Foam::face::longestEdge(const UList<point>& pts) const
|
Foam::label Foam::face::longestEdge(const UList<point>& pts) const
|
||||||
{
|
{
|
||||||
const edgeList& eds = this->edges();
|
const labelList& verts = *this;
|
||||||
|
const label nVerts = verts.size();
|
||||||
|
|
||||||
label longestEdgeI = -1;
|
// Last edge closes the polygon. Use it to initialize loop
|
||||||
scalar longestEdgeLength = -SMALL;
|
label longest = nVerts - 1;
|
||||||
|
scalar longestLen = Foam::edge(verts.first(), verts.last()).mag(pts);
|
||||||
|
|
||||||
forAll(eds, edI)
|
// Examine other edges
|
||||||
|
for (label edgei = 0; edgei < nVerts - 1; ++edgei)
|
||||||
{
|
{
|
||||||
scalar edgeLength = eds[edI].mag(pts);
|
scalar edgeLen = Foam::edge(verts[edgei], verts[edgei + 1]).mag(pts);
|
||||||
|
|
||||||
if (edgeLength > longestEdgeLength)
|
if (longestLen < edgeLen)
|
||||||
{
|
{
|
||||||
longestEdgeI = edI;
|
longest = edgei;
|
||||||
longestEdgeLength = edgeLength;
|
longestLen = edgeLen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return longestEdgeI;
|
return longest;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::longestEdge(const face& f, const UList<point>& pts)
|
|
||||||
{
|
|
||||||
return f.longestEdge(pts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -76,14 +76,8 @@ class face
|
|||||||
{
|
{
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Edge to the right of face vertex i
|
|
||||||
inline label right(const label i) const;
|
|
||||||
|
|
||||||
//- Edge to the left of face vertex i
|
|
||||||
inline label left(const label i) const;
|
|
||||||
|
|
||||||
//- Construct list of edge vectors for face
|
//- Construct list of edge vectors for face
|
||||||
tmp<vectorField> calcEdges
|
tmp<vectorField> calcEdgeVectors
|
||||||
(
|
(
|
||||||
const UList<point>& points
|
const UList<point>& points
|
||||||
) const;
|
) const;
|
||||||
@ -190,7 +184,7 @@ public:
|
|||||||
void flip();
|
void flip();
|
||||||
|
|
||||||
//- Return the points corresponding to this face
|
//- Return the points corresponding to this face
|
||||||
inline pointField points(const UList<point>& points) const;
|
inline pointField points(const UList<point>& pts) const;
|
||||||
|
|
||||||
//- Centre point of face
|
//- Centre point of face
|
||||||
point centre(const UList<point>& points) const;
|
point centre(const UList<point>& points) const;
|
||||||
@ -227,13 +221,14 @@ public:
|
|||||||
|
|
||||||
// Navigation through face vertices
|
// Navigation through face vertices
|
||||||
|
|
||||||
//- Return true if the point label is found in face.
|
//- Find local index on face for the point label, same as find()
|
||||||
inline bool found(const label pointLabel) const;
|
|
||||||
|
|
||||||
//- Find local index on face for the point label,
|
|
||||||
// \return position in face (0,1,2,...) or -1 if not found.
|
// \return position in face (0,1,2,...) or -1 if not found.
|
||||||
inline label which(const label pointLabel) const;
|
inline label which(const label pointLabel) const;
|
||||||
|
|
||||||
|
//- The vertex on face - identical to operator[], but with naming
|
||||||
|
//- similar to nextLabel(), prevLabel()
|
||||||
|
inline label thisLabel(const label i) const;
|
||||||
|
|
||||||
//- Next vertex on face
|
//- Next vertex on face
|
||||||
inline label nextLabel(const label i) const;
|
inline label nextLabel(const label i) const;
|
||||||
|
|
||||||
@ -342,25 +337,45 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return number of edges
|
//- Return number of edges
|
||||||
inline label nEdges() const;
|
inline label nEdges() const noexcept;
|
||||||
|
|
||||||
//- Return edges in face point ordering,
|
//- Return i-th face edge in forward walk order.
|
||||||
|
//- The faceEdge(0) is the edge between [0] and [1]
|
||||||
|
inline Foam::edge faceEdge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return i-th face edge in forward walk order.
|
||||||
|
//- Identical to faceEdge() but with generic name
|
||||||
|
inline Foam::edge edge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return vector of i-th face edge in forward walk order.
|
||||||
|
inline vector edge(const label edgei, const UList<point>& pts) const;
|
||||||
|
|
||||||
|
//- Return i-th face edge in reverse walk order.
|
||||||
|
//- The rcEdge(0) is the edge between [0] and [n-1]
|
||||||
|
inline Foam::edge rcEdge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return vector of i-th face edge in reverse walk order.
|
||||||
|
inline vector rcEdge(const label edgei, const UList<point>& pts) const;
|
||||||
|
|
||||||
|
//- Return list of edges in forward walk order.
|
||||||
// i.e. edges()[0] is edge between [0] and [1]
|
// i.e. edges()[0] is edge between [0] and [1]
|
||||||
edgeList edges() const;
|
edgeList edges() const;
|
||||||
|
|
||||||
//- Return n-th face edge
|
//- Return list of edges in reverse walk order.
|
||||||
inline edge faceEdge(const label n) const;
|
// i.e. rcEdges()[0] is edge between [0] and [n-1]
|
||||||
|
edgeList rcEdges() const;
|
||||||
|
|
||||||
//- The edge direction on the face
|
//- Test the edge direction on the face
|
||||||
// \return
|
// \return
|
||||||
// - 0: edge not found on the face
|
// - 0: edge not found on the face
|
||||||
// - +1: forward (counter-clockwise) on the face
|
// - +1: forward (counter-clockwise) on the face
|
||||||
// - -1: reverse (clockwise) on the face
|
// - -1: reverse (clockwise) on the face
|
||||||
int edgeDirection(const edge& e) const;
|
int edgeDirection(const Foam::edge& e) const;
|
||||||
|
|
||||||
//- Find the longest edge on a face.
|
//- Find the longest edge on a face.
|
||||||
label longestEdge(const UList<point>& pts) const;
|
label longestEdge(const UList<point>& pts) const;
|
||||||
|
|
||||||
|
|
||||||
// Face splitting utilities
|
// Face splitting utilities
|
||||||
|
|
||||||
//- Number of triangles after splitting
|
//- Number of triangles after splitting
|
||||||
@ -493,13 +508,6 @@ struct offsetOp<face>
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Deprecated(2017-04) find the longest edge on a face.
|
|
||||||
//- Face point labels index into pts.
|
|
||||||
// \deprecated(2017-04) use class method instead
|
|
||||||
FOAM_DEPRECATED_FOR(2017-04, "use face::longestEdge() method")
|
|
||||||
label longestEdge(const face& f, const UList<point>& pts);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool operator==(const face& a, const face& b);
|
inline bool operator==(const face& a, const face& b);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,20 +26,6 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
inline Foam::label Foam::face::right(const label i) const
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::face::left(const label i) const
|
|
||||||
{
|
|
||||||
return rcIndex(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::face::face(const label sz)
|
inline Foam::face::face(const label sz)
|
||||||
@ -98,23 +84,19 @@ inline Foam::face::face(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::pointField Foam::face::points
|
inline Foam::pointField Foam::face::points(const UList<point>& pts) const
|
||||||
(
|
|
||||||
const UList<point>& meshPoints
|
|
||||||
) const
|
|
||||||
{
|
{
|
||||||
// There are as many points as there are labels for them
|
// There are as many points as there are labels for them
|
||||||
pointField p(size());
|
pointField p(size());
|
||||||
|
|
||||||
// For each point in list, set it to the point in 'pnts' addressed
|
auto iter = p.begin();
|
||||||
// by 'labs'
|
|
||||||
label i = 0;
|
|
||||||
for (const label pointi : *this)
|
for (const label pointi : *this)
|
||||||
{
|
{
|
||||||
p[i++] = meshPoints[pointi];
|
*iter = pts[pointi];
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return list
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,22 +115,54 @@ inline Foam::scalar Foam::face::mag(const UList<point>& p) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::face::nEdges() const
|
inline Foam::label Foam::face::nEdges() const noexcept
|
||||||
{
|
{
|
||||||
// for a closed polygon a number of edges is the same as number of points
|
// for a closed polygon a number of edges is the same as number of points
|
||||||
return size();
|
return size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::edge Foam::face::faceEdge(const label n) const
|
inline Foam::edge Foam::face::faceEdge(const label edgei) const
|
||||||
{
|
{
|
||||||
return edge(operator[](n), operator[](fcIndex(n)));
|
return Foam::edge(thisLabel(edgei), nextLabel(edgei));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::face::found(const label pointLabel) const
|
inline Foam::edge Foam::face::edge(const label edgei) const
|
||||||
{
|
{
|
||||||
return labelList::found(pointLabel);
|
return faceEdge(edgei);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::face::edge
|
||||||
|
(
|
||||||
|
const label edgei,
|
||||||
|
const UList<point>& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return vector(pts[nextLabel(edgei)] - pts[thisLabel(edgei)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::face::rcEdge(const label edgei) const
|
||||||
|
{
|
||||||
|
// Edge 0 (forward and reverse) always starts at [0]
|
||||||
|
// for consistency with face flipping
|
||||||
|
const label pointi = edgei ? (nEdges() - edgei) : 0;
|
||||||
|
return Foam::edge(thisLabel(pointi), prevLabel(pointi));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::face::rcEdge
|
||||||
|
(
|
||||||
|
const label edgei,
|
||||||
|
const UList<point>& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Edge 0 (forward and reverse) always starts at [0]
|
||||||
|
// for consistency with face flipping
|
||||||
|
const label pointi = edgei ? (3 - edgei) : 0;
|
||||||
|
return vector(pts[prevLabel(pointi)] - pts[thisLabel(pointi)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,6 +172,12 @@ inline Foam::label Foam::face::which(const label pointLabel) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::face::thisLabel(const label i) const
|
||||||
|
{
|
||||||
|
return labelList::operator[](i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::face::nextLabel(const label i) const
|
inline Foam::label Foam::face::nextLabel(const label i) const
|
||||||
{
|
{
|
||||||
return labelList::fcValue(i);
|
return labelList::fcValue(i);
|
||||||
|
|||||||
@ -116,7 +116,7 @@ public:
|
|||||||
inline void flip();
|
inline void flip();
|
||||||
|
|
||||||
//- Return the points corresponding to this face
|
//- Return the points corresponding to this face
|
||||||
inline pointField points(const UList<point>& points) const;
|
inline pointField points(const UList<point>& pts) const;
|
||||||
|
|
||||||
//- Return triangle as a face
|
//- Return triangle as a face
|
||||||
inline face triFaceFace() const;
|
inline face triFaceFace() const;
|
||||||
@ -148,20 +148,27 @@ public:
|
|||||||
//- Magnitude of face area
|
//- Magnitude of face area
|
||||||
inline scalar mag(const UList<point>& points) const;
|
inline scalar mag(const UList<point>& points) const;
|
||||||
|
|
||||||
//- Number of triangles after splitting
|
//- Number of triangles after splitting == 1
|
||||||
inline label nTriangles() const;
|
inline label nTriangles() const noexcept;
|
||||||
|
|
||||||
//- Return face with reverse direction
|
//- Return face with reverse direction
|
||||||
// The starting points of the original and reverse face are identical.
|
// The starting points of the original and reverse face are identical.
|
||||||
inline triFace reverseFace() const;
|
inline triFace reverseFace() const;
|
||||||
|
|
||||||
//- Return true if the point label is found in face.
|
//- Find local index on face for the point label, same as find()
|
||||||
inline bool found(const label pointLabel) const;
|
|
||||||
|
|
||||||
//- Find local index on face for the point label.
|
|
||||||
// \return position in face (0,1,2) or -1 if not found.
|
// \return position in face (0,1,2) or -1 if not found.
|
||||||
inline label which(const label pointLabel) const;
|
inline label which(const label pointLabel) const;
|
||||||
|
|
||||||
|
//- Next vertex on face
|
||||||
|
inline label nextLabel(const label i) const;
|
||||||
|
|
||||||
|
//- Previous vertex on face
|
||||||
|
inline label prevLabel(const label i) const;
|
||||||
|
|
||||||
|
//- The vertex on face - identical to operator[], but with naming
|
||||||
|
//- similar to nextLabel(), prevLabel()
|
||||||
|
inline label thisLabel(const label i) const;
|
||||||
|
|
||||||
//- Return swept-volume from old-points to new-points
|
//- Return swept-volume from old-points to new-points
|
||||||
inline scalar sweptVol
|
inline scalar sweptVol
|
||||||
(
|
(
|
||||||
@ -243,22 +250,41 @@ public:
|
|||||||
const scalar tol = SMALL
|
const scalar tol = SMALL
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Return number of edges
|
//- Return number of edges == 3
|
||||||
inline label nEdges() const;
|
inline label nEdges() const noexcept;
|
||||||
|
|
||||||
//- Return edges in face point ordering,
|
//- Return i-th face edge in forward walk order.
|
||||||
|
//- The faceEdge(0) is the edge between [0] and [1]
|
||||||
|
inline Foam::edge faceEdge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return i-th face edge in forward walk order.
|
||||||
|
//- Identical to faceEdge() but with generic name
|
||||||
|
inline Foam::edge edge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return vector of i-th face edge in forward walk order.
|
||||||
|
inline vector edge(const label edgei, const UList<point>& pts) const;
|
||||||
|
|
||||||
|
//- Return i-th face edge in reverse walk order.
|
||||||
|
//- The rcEdge(0) is the edge between [0] to [n-1]
|
||||||
|
inline Foam::edge rcEdge(const label edgei) const;
|
||||||
|
|
||||||
|
//- Return vector of i-th face edge in reverse walk order.
|
||||||
|
inline vector rcEdge(const label edgei, const UList<point>& pts) const;
|
||||||
|
|
||||||
|
//- Return list of edges in forward walk order.
|
||||||
// i.e. edges()[0] is edge between [0] and [1]
|
// i.e. edges()[0] is edge between [0] and [1]
|
||||||
inline edgeList edges() const;
|
inline edgeList edges() const;
|
||||||
|
|
||||||
//- Return n-th face edge
|
//- Return list of edges in reverse walk order.
|
||||||
inline edge faceEdge(const label n) const;
|
// i.e. rcEdges()[0] is edge between [0] to [n-1]
|
||||||
|
inline edgeList rcEdges() const;
|
||||||
|
|
||||||
//- Return the edge direction on the face
|
//- Test the edge direction on the face
|
||||||
// \return
|
// \return
|
||||||
// - +1: forward (counter-clockwise) on the face
|
// - +1: forward (counter-clockwise) on the face
|
||||||
// - -1: reverse (clockwise) on the face
|
// - -1: reverse (clockwise) on the face
|
||||||
// - 0: edge not found on the face
|
// - 0: edge not found on the face
|
||||||
inline int edgeDirection(const edge& e) const;
|
inline int edgeDirection(const Foam::edge& e) const;
|
||||||
|
|
||||||
//- Compare triFaces
|
//- Compare triFaces
|
||||||
// \return:
|
// \return:
|
||||||
|
|||||||
@ -29,7 +29,7 @@ License
|
|||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
#include "face.H"
|
#include "face.H"
|
||||||
#include "triPointRef.H"
|
#include "triPointRef.H"
|
||||||
#include "Swap.H"
|
#include <algorithm> // For std::swap
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -144,13 +144,13 @@ inline void Foam::triFace::flip()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::pointField Foam::triFace::points(const UList<point>& points) const
|
inline Foam::pointField Foam::triFace::points(const UList<point>& pts) const
|
||||||
{
|
{
|
||||||
pointField p(3);
|
pointField p(3);
|
||||||
|
|
||||||
p[0] = points[operator[](0)];
|
p[0] = pts[operator[](0)];
|
||||||
p[1] = points[operator[](1)];
|
p[1] = pts[operator[](1)];
|
||||||
p[2] = points[operator[](2)];
|
p[2] = pts[operator[](2)];
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ inline Foam::scalar Foam::triFace::mag(const UList<point>& points) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::triFace::nTriangles() const
|
inline Foam::label Foam::triFace::nTriangles() const noexcept
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -222,18 +222,30 @@ inline Foam::triFace Foam::triFace::reverseFace() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::triFace::found(const label pointLabel) const
|
|
||||||
{
|
|
||||||
return FixedList<label, 3>::found(pointLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::triFace::which(const label pointLabel) const
|
inline Foam::label Foam::triFace::which(const label pointLabel) const
|
||||||
{
|
{
|
||||||
return FixedList<label, 3>::find(pointLabel);
|
return FixedList<label, 3>::find(pointLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::triFace::thisLabel(const label i) const
|
||||||
|
{
|
||||||
|
return operator[](i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::triFace::nextLabel(const label i) const
|
||||||
|
{
|
||||||
|
return operator[]((i == 2 ? 0 : i+1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::label Foam::triFace::prevLabel(const label i) const
|
||||||
|
{
|
||||||
|
return operator[]((i ? i-1 : 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::scalar Foam::triFace::sweptVol
|
inline Foam::scalar Foam::triFace::sweptVol
|
||||||
(
|
(
|
||||||
const UList<point>& opts,
|
const UList<point>& opts,
|
||||||
@ -353,61 +365,109 @@ inline int Foam::triFace::sign
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::triFace::nEdges() const
|
inline Foam::label Foam::triFace::nEdges() const noexcept
|
||||||
{
|
{
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::triFace::faceEdge(const label edgei) const
|
||||||
|
{
|
||||||
|
return Foam::edge(thisLabel(edgei), nextLabel(edgei));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::triFace::edge(const label edgei) const
|
||||||
|
{
|
||||||
|
return faceEdge(edgei);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::triFace::edge
|
||||||
|
(
|
||||||
|
const label edgei,
|
||||||
|
const UList<point>& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return vector(pts[nextLabel(edgei)] - pts[thisLabel(edgei)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::triFace::rcEdge(const label edgei) const
|
||||||
|
{
|
||||||
|
// Edge 0 (forward and reverse) always starts at [0]
|
||||||
|
// for consistency with face flipping
|
||||||
|
const label pointi = edgei ? (3 - edgei) : 0;
|
||||||
|
return Foam::edge(thisLabel(pointi), prevLabel(pointi));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::vector Foam::triFace::rcEdge
|
||||||
|
(
|
||||||
|
const label edgei,
|
||||||
|
const UList<point>& pts
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// Edge 0 (forward and reverse) always starts at [0]
|
||||||
|
// for consistency with face flipping
|
||||||
|
const label pointi = edgei ? (3 - edgei) : 0;
|
||||||
|
return vector(pts[prevLabel(pointi)] - pts[thisLabel(pointi)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::edgeList Foam::triFace::edges() const
|
inline Foam::edgeList Foam::triFace::edges() const
|
||||||
{
|
{
|
||||||
edgeList e(3);
|
edgeList theEdges(3);
|
||||||
|
|
||||||
e[0].first() = operator[](0);
|
theEdges[0].first() = operator[](0);
|
||||||
e[0].second() = operator[](1);
|
theEdges[0].second() = operator[](1);
|
||||||
|
|
||||||
e[1].first() = operator[](1);
|
theEdges[1].first() = operator[](1);
|
||||||
e[1].second() = operator[](2);
|
theEdges[1].second() = operator[](2);
|
||||||
|
|
||||||
e[2].first() = operator[](2);
|
theEdges[2].first() = operator[](2);
|
||||||
e[2].second() = operator[](0);
|
theEdges[2].second() = operator[](0);
|
||||||
|
|
||||||
return e;
|
return theEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::edge Foam::triFace::faceEdge(const label n) const
|
inline Foam::edgeList Foam::triFace::rcEdges() const
|
||||||
{
|
{
|
||||||
return edge(operator[](n), operator[](fcIndex(n)));
|
edgeList theEdges(3);
|
||||||
|
|
||||||
|
theEdges[0].first() = operator[](0);
|
||||||
|
theEdges[0].second() = operator[](2);
|
||||||
|
|
||||||
|
theEdges[1].first() = operator[](2);
|
||||||
|
theEdges[1].second() = operator[](1);
|
||||||
|
|
||||||
|
theEdges[2].first() = operator[](1);
|
||||||
|
theEdges[2].second() = operator[](0);
|
||||||
|
|
||||||
|
return theEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// return
|
inline int Foam::triFace::edgeDirection(const Foam::edge& e) const
|
||||||
// - +1: forward (counter-clockwise) on the face
|
|
||||||
// - -1: reverse (clockwise) on the face
|
|
||||||
// - 0: edge not found on the face
|
|
||||||
inline int Foam::triFace::edgeDirection(const edge& e) const
|
|
||||||
{
|
{
|
||||||
if
|
if (e.first() == operator[](0))
|
||||||
(
|
|
||||||
(operator[](0) == e.first() && operator[](1) == e.second())
|
|
||||||
|| (operator[](1) == e.first() && operator[](2) == e.second())
|
|
||||||
|| (operator[](2) == e.first() && operator[](0) == e.second())
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return 1;
|
if (e.second() == operator[](1)) return 1; // Forward
|
||||||
|
if (e.second() == operator[](2)) return -1; // Reverse
|
||||||
}
|
}
|
||||||
else if
|
if (e.first() == operator[](1))
|
||||||
(
|
|
||||||
(operator[](0) == e.second() && operator[](1) == e.first())
|
|
||||||
|| (operator[](1) == e.second() && operator[](2) == e.first())
|
|
||||||
|| (operator[](2) == e.second() && operator[](0) == e.first())
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return -1;
|
if (e.second() == operator[](2)) return 1; // Forward
|
||||||
|
if (e.second() == operator[](0)) return -1; // Reverse
|
||||||
|
}
|
||||||
|
if (e.first() == operator[](2))
|
||||||
|
{
|
||||||
|
if (e.second() == operator[](0)) return 1; // Forward
|
||||||
|
if (e.second() == operator[](1)) return -1; // Reverse
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0; // Not found
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -237,7 +237,7 @@ public:
|
|||||||
// Other
|
// Other
|
||||||
|
|
||||||
//- Collect data in processor order on master (== procIDs[0]).
|
//- Collect data in processor order on master (== procIDs[0]).
|
||||||
// Needs offsets only on master.
|
// Offsets needed on master only.
|
||||||
template<class Container, class Type>
|
template<class Container, class Type>
|
||||||
static void gather
|
static void gather
|
||||||
(
|
(
|
||||||
@ -247,12 +247,25 @@ public:
|
|||||||
const UList<Type>& fld,
|
const UList<Type>& fld,
|
||||||
List<Type>& allFld,
|
List<Type>& allFld,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const Pstream::commsTypes commsType =
|
const Pstream::commsTypes = Pstream::commsTypes::nonBlocking
|
||||||
Pstream::commsTypes::nonBlocking
|
);
|
||||||
|
|
||||||
|
//- Collect indirect data in processor order on master
|
||||||
|
// Offsets needed on master only.
|
||||||
|
template<class Type, class Addr>
|
||||||
|
static void gather
|
||||||
|
(
|
||||||
|
const labelUList& offsets,
|
||||||
|
const label comm,
|
||||||
|
const UList<int>& procIDs,
|
||||||
|
const IndirectListBase<Type, Addr>& fld,
|
||||||
|
List<Type>& allFld,
|
||||||
|
const int tag = UPstream::msgType(),
|
||||||
|
const Pstream::commsTypes = Pstream::commsTypes::scheduled
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Collect data in processor order on master (== procIDs[0]).
|
//- Collect data in processor order on master (== procIDs[0]).
|
||||||
// Needs offsets only on master.
|
// Offsets needed on master only.
|
||||||
template<class Container, class Type>
|
template<class Container, class Type>
|
||||||
void gather
|
void gather
|
||||||
(
|
(
|
||||||
@ -276,8 +289,18 @@ public:
|
|||||||
const UList<Type>& fld,
|
const UList<Type>& fld,
|
||||||
List<Type>& allFld,
|
List<Type>& allFld,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const Pstream::commsTypes commsType =
|
const Pstream::commsTypes = Pstream::commsTypes::nonBlocking
|
||||||
Pstream::commsTypes::nonBlocking
|
) const;
|
||||||
|
|
||||||
|
//- Collect data indirectly in processor order on master.
|
||||||
|
// Does communication with default communicator and message tag.
|
||||||
|
template<class Type, class Addr>
|
||||||
|
void gather
|
||||||
|
(
|
||||||
|
const IndirectListBase<Type, Addr>& fld,
|
||||||
|
List<Type>& allFld,
|
||||||
|
const int tag = UPstream::msgType(),
|
||||||
|
const Pstream::commsTypes = Pstream::commsTypes::scheduled
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Collect data in processor order on master.
|
//- Collect data in processor order on master.
|
||||||
@ -288,8 +311,7 @@ public:
|
|||||||
const UList<Type>& fld,
|
const UList<Type>& fld,
|
||||||
List<Type>& allFld,
|
List<Type>& allFld,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const Pstream::commsTypes commsType =
|
const Pstream::commsTypes = Pstream::commsTypes::nonBlocking
|
||||||
Pstream::commsTypes::nonBlocking
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -303,8 +325,7 @@ public:
|
|||||||
const Container& procIDs,
|
const Container& procIDs,
|
||||||
List<Type>& fld,
|
List<Type>& fld,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const Pstream::commsTypes commsType =
|
const Pstream::commsTypes = Pstream::commsTypes::nonBlocking
|
||||||
Pstream::commsTypes::nonBlocking
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Inplace collect in processor order on master (== procIDs[0]).
|
//- Inplace collect in processor order on master (== procIDs[0]).
|
||||||
@ -331,8 +352,7 @@ public:
|
|||||||
(
|
(
|
||||||
List<Type>& fld,
|
List<Type>& fld,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const Pstream::commsTypes commsType =
|
const Pstream::commsTypes = Pstream::commsTypes::nonBlocking
|
||||||
Pstream::commsTypes::nonBlocking
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Inplace collect data in processor order on master
|
//- Inplace collect data in processor order on master
|
||||||
@ -343,8 +363,7 @@ public:
|
|||||||
(
|
(
|
||||||
List<Type>& fld,
|
List<Type>& fld,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const Pstream::commsTypes commsType =
|
const Pstream::commsTypes = Pstream::commsTypes::nonBlocking
|
||||||
Pstream::commsTypes::nonBlocking
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -358,8 +377,7 @@ public:
|
|||||||
const UList<Type>& allFld,
|
const UList<Type>& allFld,
|
||||||
UList<Type>& fld,
|
UList<Type>& fld,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const Pstream::commsTypes commsType =
|
const Pstream::commsTypes = Pstream::commsTypes::nonBlocking
|
||||||
Pstream::commsTypes::nonBlocking
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Distribute data in processor order. Requires fld to be sized!
|
//- Distribute data in processor order. Requires fld to be sized!
|
||||||
@ -386,8 +404,7 @@ public:
|
|||||||
const UList<Type>& allFld,
|
const UList<Type>& allFld,
|
||||||
UList<Type>& fld,
|
UList<Type>& fld,
|
||||||
const int tag = UPstream::msgType(),
|
const int tag = UPstream::msgType(),
|
||||||
const Pstream::commsTypes commsType =
|
const Pstream::commsTypes = Pstream::commsTypes::nonBlocking
|
||||||
Pstream::commsTypes::nonBlocking
|
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Get (potentially remote) data. Elements required given as
|
//- Get (potentially remote) data. Elements required given as
|
||||||
|
|||||||
@ -42,9 +42,21 @@ void Foam::globalIndex::gather
|
|||||||
const Pstream::commsTypes commsType
|
const Pstream::commsTypes commsType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!is_contiguous<Type>::value
|
||||||
|
&& commsType == Pstream::commsTypes::nonBlocking
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Cannot use nonBlocking with non-contiguous data"
|
||||||
|
<< exit(FatalError);
|
||||||
|
// Could also warn and change to scheduled etc...
|
||||||
|
}
|
||||||
|
|
||||||
if (Pstream::myProcNo(comm) == procIDs[0])
|
if (Pstream::myProcNo(comm) == procIDs[0])
|
||||||
{
|
{
|
||||||
allFld.setSize(off.last());
|
allFld.resize(off.last());
|
||||||
|
|
||||||
// Assign my local data
|
// Assign my local data
|
||||||
SubList<Type>(allFld, fld.size(), 0) = fld;
|
SubList<Type>(allFld, fld.size(), 0) = fld;
|
||||||
@ -73,7 +85,7 @@ void Foam::globalIndex::gather
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IPstream fromSlave
|
IPstream fromProc
|
||||||
(
|
(
|
||||||
commsType,
|
commsType,
|
||||||
procIDs[i],
|
procIDs[i],
|
||||||
@ -81,22 +93,15 @@ void Foam::globalIndex::gather
|
|||||||
tag,
|
tag,
|
||||||
comm
|
comm
|
||||||
);
|
);
|
||||||
fromSlave >> procSlot;
|
fromProc >> procSlot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// nonBlocking
|
// nonBlocking && is_contiguous == true (already checked)
|
||||||
|
|
||||||
if (!is_contiguous<Type>::value)
|
const label startOfRequests = Pstream::nRequests();
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "nonBlocking not supported for non-contiguous data"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
label startOfRequests = Pstream::nRequests();
|
|
||||||
|
|
||||||
// Set up reads
|
// Set up reads
|
||||||
for (label i = 1; i < procIDs.size(); ++i)
|
for (label i = 1; i < procIDs.size(); ++i)
|
||||||
@ -108,7 +113,7 @@ void Foam::globalIndex::gather
|
|||||||
commsType,
|
commsType,
|
||||||
procIDs[i],
|
procIDs[i],
|
||||||
reinterpret_cast<char*>(procSlot.data()),
|
reinterpret_cast<char*>(procSlot.data()),
|
||||||
procSlot.byteSize(),
|
procSlot.size_bytes(),
|
||||||
tag,
|
tag,
|
||||||
comm
|
comm
|
||||||
);
|
);
|
||||||
@ -153,16 +158,9 @@ void Foam::globalIndex::gather
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// nonBlocking
|
// nonBlocking && is_contiguous == true (already checked)
|
||||||
|
|
||||||
if (!is_contiguous<Type>::value)
|
const label startOfRequests = Pstream::nRequests();
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "nonBlocking not supported for non-contiguous data"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
label startOfRequests = Pstream::nRequests();
|
|
||||||
|
|
||||||
// Set up write
|
// Set up write
|
||||||
OPstream::write
|
OPstream::write
|
||||||
@ -182,6 +180,64 @@ void Foam::globalIndex::gather
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, class Addr>
|
||||||
|
void Foam::globalIndex::gather
|
||||||
|
(
|
||||||
|
const labelUList& off,
|
||||||
|
const label comm,
|
||||||
|
const UList<int>& procIDs,
|
||||||
|
const IndirectListBase<Type, Addr>& fld,
|
||||||
|
List<Type>& allFld,
|
||||||
|
const int tag,
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (commsType == Pstream::commsTypes::nonBlocking)
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Cannot use nonBlocking with indirect list of data"
|
||||||
|
<< exit(FatalError);
|
||||||
|
// Could also warn and change to scheduled etc...
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Pstream::myProcNo(comm) == procIDs[0])
|
||||||
|
{
|
||||||
|
allFld.resize(off.last());
|
||||||
|
|
||||||
|
// Assign my local data
|
||||||
|
SubList<Type>(allFld, fld.size(), 0) = fld;
|
||||||
|
|
||||||
|
// Already verified commsType != nonBlocking
|
||||||
|
for (label i = 1; i < procIDs.size(); ++i)
|
||||||
|
{
|
||||||
|
SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
||||||
|
|
||||||
|
IPstream fromProc
|
||||||
|
(
|
||||||
|
commsType,
|
||||||
|
procIDs[i],
|
||||||
|
0,
|
||||||
|
tag,
|
||||||
|
comm
|
||||||
|
);
|
||||||
|
fromProc >> procSlot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OPstream toMaster
|
||||||
|
(
|
||||||
|
commsType,
|
||||||
|
procIDs[0],
|
||||||
|
0,
|
||||||
|
tag,
|
||||||
|
comm
|
||||||
|
);
|
||||||
|
toMaster << fld;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::globalIndex::gather
|
void Foam::globalIndex::gather
|
||||||
(
|
(
|
||||||
@ -203,6 +259,28 @@ void Foam::globalIndex::gather
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type, class Addr>
|
||||||
|
void Foam::globalIndex::gather
|
||||||
|
(
|
||||||
|
const IndirectListBase<Type, Addr>& fld,
|
||||||
|
List<Type>& allFld,
|
||||||
|
const int tag,
|
||||||
|
const Pstream::commsTypes commsType
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
gather
|
||||||
|
(
|
||||||
|
offsets_,
|
||||||
|
UPstream::worldComm,
|
||||||
|
UPstream::procID(UPstream::worldComm),
|
||||||
|
fld,
|
||||||
|
allFld,
|
||||||
|
tag,
|
||||||
|
commsType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::globalIndex::gatherOp
|
void Foam::globalIndex::gatherOp
|
||||||
(
|
(
|
||||||
@ -293,6 +371,18 @@ void Foam::globalIndex::scatter
|
|||||||
const Pstream::commsTypes commsType
|
const Pstream::commsTypes commsType
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
!is_contiguous<Type>::value
|
||||||
|
&& commsType == Pstream::commsTypes::nonBlocking
|
||||||
|
)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Cannot use nonBlocking with non-contiguous data"
|
||||||
|
<< exit(FatalError);
|
||||||
|
// Could also warn and change to scheduled etc...
|
||||||
|
}
|
||||||
|
|
||||||
if (Pstream::myProcNo(comm) == procIDs[0])
|
if (Pstream::myProcNo(comm) == procIDs[0])
|
||||||
{
|
{
|
||||||
fld.deepCopy(SubList<Type>(allFld, off[1]-off[0]));
|
fld.deepCopy(SubList<Type>(allFld, off[1]-off[0]));
|
||||||
@ -305,12 +395,7 @@ void Foam::globalIndex::scatter
|
|||||||
{
|
{
|
||||||
for (label i = 1; i < procIDs.size(); ++i)
|
for (label i = 1; i < procIDs.size(); ++i)
|
||||||
{
|
{
|
||||||
const SubList<Type> procSlot
|
const SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
||||||
(
|
|
||||||
allFld,
|
|
||||||
off[i+1]-off[i],
|
|
||||||
off[i]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (is_contiguous<Type>::value)
|
if (is_contiguous<Type>::value)
|
||||||
{
|
{
|
||||||
@ -326,7 +411,7 @@ void Foam::globalIndex::scatter
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OPstream toSlave
|
OPstream toProc
|
||||||
(
|
(
|
||||||
commsType,
|
commsType,
|
||||||
procIDs[i],
|
procIDs[i],
|
||||||
@ -334,32 +419,20 @@ void Foam::globalIndex::scatter
|
|||||||
tag,
|
tag,
|
||||||
comm
|
comm
|
||||||
);
|
);
|
||||||
toSlave << procSlot;
|
toProc << procSlot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// nonBlocking
|
// nonBlocking && is_contiguous == true (already checked)
|
||||||
|
|
||||||
if (!is_contiguous<Type>::value)
|
const label startOfRequests = Pstream::nRequests();
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "nonBlocking not supported for non-contiguous data"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
label startOfRequests = Pstream::nRequests();
|
|
||||||
|
|
||||||
// Set up writes
|
// Set up writes
|
||||||
for (label i = 1; i < procIDs.size(); ++i)
|
for (label i = 1; i < procIDs.size(); ++i)
|
||||||
{
|
{
|
||||||
const SubList<Type> procSlot
|
const SubList<Type> procSlot(allFld, off[i+1]-off[i], off[i]);
|
||||||
(
|
|
||||||
allFld,
|
|
||||||
off[i+1]-off[i],
|
|
||||||
off[i]
|
|
||||||
);
|
|
||||||
|
|
||||||
OPstream::write
|
OPstream::write
|
||||||
(
|
(
|
||||||
@ -411,16 +484,9 @@ void Foam::globalIndex::scatter
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// nonBlocking
|
// nonBlocking && is_contiguous == true (already checked)
|
||||||
|
|
||||||
if (!is_contiguous<Type>::value)
|
const label startOfRequests = Pstream::nRequests();
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "nonBlocking not supported for non-contiguous data"
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
label startOfRequests = Pstream::nRequests();
|
|
||||||
|
|
||||||
// Set up read
|
// Set up read
|
||||||
IPstream::read
|
IPstream::read
|
||||||
@ -472,7 +538,7 @@ void Foam::globalIndex::get
|
|||||||
const int tag
|
const int tag
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
allFld.setSize(globalIds.size());
|
allFld.resize(globalIds.size());
|
||||||
if (globalIds.size())
|
if (globalIds.size())
|
||||||
{
|
{
|
||||||
// Sort according to processor
|
// Sort according to processor
|
||||||
|
|||||||
@ -2507,7 +2507,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
|||||||
Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||||
(
|
(
|
||||||
const labelList& meshPoints,
|
const labelList& meshPoints,
|
||||||
const Map<label>& meshPointMap,
|
const Map<label>& /* unused: meshPointMap */,
|
||||||
labelList& pointToGlobal,
|
labelList& pointToGlobal,
|
||||||
labelList& uniqueMeshPoints
|
labelList& uniqueMeshPoints
|
||||||
) const
|
) const
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -342,7 +342,7 @@ public:
|
|||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the mesh reference
|
//- Return the mesh reference
|
||||||
const polyMesh& mesh() const
|
const polyMesh& mesh() const noexcept
|
||||||
{
|
{
|
||||||
return mesh_;
|
return mesh_;
|
||||||
}
|
}
|
||||||
@ -351,25 +351,25 @@ public:
|
|||||||
// not running parallel)
|
// not running parallel)
|
||||||
bool parallel() const
|
bool parallel() const
|
||||||
{
|
{
|
||||||
return processorPatches_.size() > 0;
|
return !processorPatches_.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return total number of points in decomposed mesh. Not
|
//- Return total number of points in decomposed mesh. Not
|
||||||
// compensated for duplicate points!
|
// compensated for duplicate points!
|
||||||
label nTotalPoints() const
|
label nTotalPoints() const noexcept
|
||||||
{
|
{
|
||||||
return nTotalPoints_;
|
return nTotalPoints_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return total number of faces in decomposed mesh. Not
|
//- Return total number of faces in decomposed mesh. Not
|
||||||
// compensated for duplicate faces!
|
// compensated for duplicate faces!
|
||||||
label nTotalFaces() const
|
label nTotalFaces() const noexcept
|
||||||
{
|
{
|
||||||
return nTotalFaces_;
|
return nTotalFaces_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return total number of cells in decomposed mesh.
|
//- Return total number of cells in decomposed mesh.
|
||||||
label nTotalCells() const
|
label nTotalCells() const noexcept
|
||||||
{
|
{
|
||||||
return nTotalCells_;
|
return nTotalCells_;
|
||||||
}
|
}
|
||||||
@ -379,7 +379,7 @@ public:
|
|||||||
|
|
||||||
//- Return list of processor patch labels
|
//- Return list of processor patch labels
|
||||||
// (size of list = number of processor patches)
|
// (size of list = number of processor patches)
|
||||||
const labelList& processorPatches() const
|
const labelList& processorPatches() const noexcept
|
||||||
{
|
{
|
||||||
return processorPatches_;
|
return processorPatches_;
|
||||||
}
|
}
|
||||||
@ -387,14 +387,14 @@ public:
|
|||||||
//- Return list of indices into processorPatches_ for each patch.
|
//- Return list of indices into processorPatches_ for each patch.
|
||||||
// Index = -1 for non-processor parches.
|
// Index = -1 for non-processor parches.
|
||||||
// (size of list = number of patches)
|
// (size of list = number of patches)
|
||||||
const labelList& processorPatchIndices() const
|
const labelList& processorPatchIndices() const noexcept
|
||||||
{
|
{
|
||||||
return processorPatchIndices_;
|
return processorPatchIndices_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return processorPatchIndices of the neighbours
|
//- Return processorPatchIndices of the neighbours
|
||||||
// processor patches. -1 if not running parallel.
|
// processor patches. -1 if not running parallel.
|
||||||
const labelList& processorPatchNeighbours() const
|
const labelList& processorPatchNeighbours() const noexcept
|
||||||
{
|
{
|
||||||
return processorPatchNeighbours_;
|
return processorPatchNeighbours_;
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ public:
|
|||||||
autoPtr<globalIndex> mergePoints
|
autoPtr<globalIndex> mergePoints
|
||||||
(
|
(
|
||||||
const labelList& meshPoints,
|
const labelList& meshPoints,
|
||||||
const Map<label>& meshPointMap,
|
const Map<label>& meshPointMap, //!< currently unused
|
||||||
labelList& pointToGlobal,
|
labelList& pointToGlobal,
|
||||||
labelList& uniqueMeshPoints
|
labelList& uniqueMeshPoints
|
||||||
) const;
|
) const;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
|
Copyright (C) 2011-2017, 2020 OpenFOAM Foundation
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -325,7 +325,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Read construct from IOobject
|
//- Read construct from IOobject
|
||||||
polyMesh(const IOobject& io, const bool doInit = true);
|
explicit polyMesh(const IOobject& io, const bool doInit = true);
|
||||||
|
|
||||||
//- Construct from IOobject or as zero-sized mesh
|
//- Construct from IOobject or as zero-sized mesh
|
||||||
// Boundary is added using addPatches() member function
|
// Boundary is added using addPatches() member function
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -130,7 +130,6 @@ Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
|
|||||||
const PrimitivePatch<FaceList, PointField>& pp
|
const PrimitivePatch<FaceList, PointField>& pp
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
PrimitivePatchName(),
|
|
||||||
FaceList(pp),
|
FaceList(pp),
|
||||||
points_(pp.points_),
|
points_(pp.points_),
|
||||||
edgesPtr_(nullptr),
|
edgesPtr_(nullptr),
|
||||||
@ -173,13 +172,7 @@ Foam::PrimitivePatch<FaceList, PointField>::movePoints
|
|||||||
const Field<point_type>&
|
const Field<point_type>&
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Recalculating geometry following mesh motion" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
<< "movePoints() : "
|
|
||||||
<< "recalculating PrimitivePatch geometry following mesh motion"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
clearGeom();
|
clearGeom();
|
||||||
}
|
}
|
||||||
@ -198,6 +191,24 @@ Foam::PrimitivePatch<FaceList, PointField>::edges() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class FaceList, class PointField>
|
||||||
|
const Foam::edgeList::subList
|
||||||
|
Foam::PrimitivePatch<FaceList, PointField>::internalEdges() const
|
||||||
|
{
|
||||||
|
const edgeList& allEdges = this->edges(); // Force demand-driven
|
||||||
|
return edgeList::subList(allEdges, nInternalEdges());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class FaceList, class PointField>
|
||||||
|
const Foam::edgeList::subList
|
||||||
|
Foam::PrimitivePatch<FaceList, PointField>::boundaryEdges() const
|
||||||
|
{
|
||||||
|
const edgeList& allEdges = this->edges(); // Force demand-driven
|
||||||
|
return edgeList::subList(allEdges, nBoundaryEdges(), nInternalEdges());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class FaceList, class PointField>
|
template<class FaceList, class PointField>
|
||||||
Foam::label
|
Foam::label
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::nInternalEdges() const
|
Foam::PrimitivePatch<FaceList, PointField>::nInternalEdges() const
|
||||||
@ -211,6 +222,15 @@ Foam::PrimitivePatch<FaceList, PointField>::nInternalEdges() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class FaceList, class PointField>
|
||||||
|
Foam::label
|
||||||
|
Foam::PrimitivePatch<FaceList, PointField>::nBoundaryEdges() const
|
||||||
|
{
|
||||||
|
const edgeList& allEdges = this->edges(); // Force demand-driven
|
||||||
|
return (allEdges.size() - this->nInternalEdges());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class FaceList, class PointField>
|
template<class FaceList, class PointField>
|
||||||
const Foam::labelList&
|
const Foam::labelList&
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::boundaryPoints() const
|
Foam::PrimitivePatch<FaceList, PointField>::boundaryPoints() const
|
||||||
@ -496,6 +516,7 @@ Foam::PrimitivePatch<FaceList, PointField>::operator=
|
|||||||
#include "PrimitivePatchAddressing.C"
|
#include "PrimitivePatchAddressing.C"
|
||||||
#include "PrimitivePatchEdgeLoops.C"
|
#include "PrimitivePatchEdgeLoops.C"
|
||||||
#include "PrimitivePatchClear.C"
|
#include "PrimitivePatchClear.C"
|
||||||
|
#include "PrimitivePatchBdryFaces.C"
|
||||||
#include "PrimitivePatchBdryPoints.C"
|
#include "PrimitivePatchBdryPoints.C"
|
||||||
#include "PrimitivePatchLocalPointOrder.C"
|
#include "PrimitivePatchLocalPointOrder.C"
|
||||||
#include "PrimitivePatchMeshData.C"
|
#include "PrimitivePatchMeshData.C"
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,16 +36,16 @@ Description
|
|||||||
using List and pointField.
|
using List and pointField.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
PrimitivePatchAddressing.C
|
|
||||||
PrimitivePatchBdryPoints.C
|
|
||||||
PrimitivePatch.C
|
PrimitivePatch.C
|
||||||
|
PrimitivePatchAddressing.C
|
||||||
|
PrimitivePatchBdryFaces.C
|
||||||
|
PrimitivePatchBdryPoints.C
|
||||||
PrimitivePatchCheck.C
|
PrimitivePatchCheck.C
|
||||||
PrimitivePatchClear.C
|
PrimitivePatchClear.C
|
||||||
PrimitivePatchEdgeLoops.C
|
PrimitivePatchEdgeLoops.C
|
||||||
PrimitivePatchLocalPointOrder.C
|
PrimitivePatchLocalPointOrder.C
|
||||||
PrimitivePatchMeshData.C
|
PrimitivePatchMeshData.C
|
||||||
PrimitivePatchMeshEdges.C
|
PrimitivePatchMeshEdges.C
|
||||||
PrimitivePatchName.C
|
|
||||||
PrimitivePatchPointAddressing.C
|
PrimitivePatchPointAddressing.C
|
||||||
PrimitivePatchProjectPoints.C
|
PrimitivePatchProjectPoints.C
|
||||||
|
|
||||||
@ -61,6 +61,7 @@ SourceFiles
|
|||||||
#include "intersection.H"
|
#include "intersection.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
#include "objectHit.H"
|
#include "objectHit.H"
|
||||||
|
#include "PrimitivePatchBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -71,13 +72,6 @@ namespace Foam
|
|||||||
class face;
|
class face;
|
||||||
template<class T> class Map;
|
template<class T> class Map;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class PrimitivePatchName Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
TemplateName(PrimitivePatch);
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class PrimitivePatch Declaration
|
Class PrimitivePatch Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
@ -85,7 +79,7 @@ TemplateName(PrimitivePatch);
|
|||||||
template<class FaceList, class PointField>
|
template<class FaceList, class PointField>
|
||||||
class PrimitivePatch
|
class PrimitivePatch
|
||||||
:
|
:
|
||||||
public PrimitivePatchName,
|
public PrimitivePatchBase,
|
||||||
public FaceList
|
public FaceList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -129,7 +123,7 @@ private:
|
|||||||
PointField points_;
|
PointField points_;
|
||||||
|
|
||||||
|
|
||||||
// Demand driven private data
|
// Demand-driven Private Data
|
||||||
|
|
||||||
//- Edges of the patch; address into local point list;
|
//- Edges of the patch; address into local point list;
|
||||||
// sorted with internal edges first in upper-triangular order
|
// sorted with internal edges first in upper-triangular order
|
||||||
@ -194,10 +188,10 @@ private:
|
|||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Calculate edges of the patch
|
//- Calculate internal points on a patch
|
||||||
void calcIntBdryEdges() const;
|
void calcInternPoints() const;
|
||||||
|
|
||||||
//- Calculated boundary points on a patch
|
//- Calculate boundary points on a patch
|
||||||
void calcBdryPoints() const;
|
void calcBdryPoints() const;
|
||||||
|
|
||||||
//- Calculate addressing
|
//- Calculate addressing
|
||||||
@ -308,18 +302,24 @@ public:
|
|||||||
return points_;
|
return points_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Number of faces in the patch
|
||||||
|
label nFaces() const
|
||||||
|
{
|
||||||
|
return FaceList::size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Access functions for demand-driven data
|
// Access functions for demand-driven data
|
||||||
|
|
||||||
// Topological data; no mesh required.
|
// Topological data; no mesh required.
|
||||||
|
|
||||||
//- Return number of points supporting patch faces
|
//- Number of points supporting patch faces
|
||||||
label nPoints() const
|
label nPoints() const
|
||||||
{
|
{
|
||||||
return meshPoints().size();
|
return meshPoints().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return number of edges in patch
|
//- Number of edges in patch
|
||||||
label nEdges() const
|
label nEdges() const
|
||||||
{
|
{
|
||||||
return edges().size();
|
return edges().size();
|
||||||
@ -328,9 +328,18 @@ public:
|
|||||||
//- Return list of edges, address into LOCAL point list
|
//- Return list of edges, address into LOCAL point list
|
||||||
const edgeList& edges() const;
|
const edgeList& edges() const;
|
||||||
|
|
||||||
|
//- Return sub-list of internal edges, address into LOCAL point list
|
||||||
|
const edgeList::subList internalEdges() const;
|
||||||
|
|
||||||
|
//- Return sub-list of boundary edges, address into LOCAL point list
|
||||||
|
const edgeList::subList boundaryEdges() const;
|
||||||
|
|
||||||
//- Number of internal edges
|
//- Number of internal edges
|
||||||
label nInternalEdges() const;
|
label nInternalEdges() const;
|
||||||
|
|
||||||
|
//- Number of boundary edges == (nEdges() - nInternalEdges())
|
||||||
|
label nBoundaryEdges() const;
|
||||||
|
|
||||||
//- Is internal edge?
|
//- Is internal edge?
|
||||||
bool isInternalEdge(const label edgei) const
|
bool isInternalEdge(const label edgei) const
|
||||||
{
|
{
|
||||||
@ -358,6 +367,10 @@ public:
|
|||||||
//- Return patch faces addressing into local point list
|
//- Return patch faces addressing into local point list
|
||||||
const List<face_type>& localFaces() const;
|
const List<face_type>& localFaces() const;
|
||||||
|
|
||||||
|
//- Calculate and return list of local boundary faces.
|
||||||
|
// These are the faces attached to boundary edges.
|
||||||
|
labelList boundaryFaces() const;
|
||||||
|
|
||||||
|
|
||||||
// Addressing into mesh
|
// Addressing into mesh
|
||||||
|
|
||||||
@ -382,7 +395,7 @@ public:
|
|||||||
|
|
||||||
//- Given an edge in local point labels, return its
|
//- Given an edge in local point labels, return its
|
||||||
//- index in the edge list. If the edge is not found, return -1
|
//- index in the edge list. If the edge is not found, return -1
|
||||||
label whichEdge(const edge&) const;
|
label whichEdge(const edge& e) const;
|
||||||
|
|
||||||
//- Return labels of patch edges in the global edge list using
|
//- Return labels of patch edges in the global edge list using
|
||||||
//- cell addressing
|
//- cell addressing
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -76,40 +76,29 @@ Foam::PrimitivePatch<FaceList, PointField>::calcAddressing() const
|
|||||||
edgeFacesPtr_.reset(new labelListList(maxEdges));
|
edgeFacesPtr_.reset(new labelListList(maxEdges));
|
||||||
auto& edgeFaces = *edgeFacesPtr_;
|
auto& edgeFaces = *edgeFacesPtr_;
|
||||||
|
|
||||||
// faceFaces created using a dynamic list. Cannot guess size because
|
|
||||||
// of multiple connections
|
|
||||||
List<DynamicList<label>> ff(locFcs.size());
|
|
||||||
|
|
||||||
faceEdgesPtr_.reset(new labelListList(locFcs.size()));
|
faceEdgesPtr_.reset(new labelListList(locFcs.size()));
|
||||||
auto& faceEdges = *faceEdgesPtr_;
|
auto& faceEdges = *faceEdgesPtr_;
|
||||||
|
|
||||||
// count the number of face neighbours
|
|
||||||
labelList noFaceFaces(locFcs.size());
|
|
||||||
|
|
||||||
// initialise the lists of subshapes for each face to avoid duplication
|
// initialise the lists of subshapes for each face to avoid duplication
|
||||||
edgeListList faceIntoEdges(locFcs.size());
|
edgeListList faceIntoEdges(locFcs.size());
|
||||||
|
|
||||||
forAll(locFcs, facei)
|
forAll(locFcs, facei)
|
||||||
{
|
{
|
||||||
faceIntoEdges[facei] = locFcs[facei].edges();
|
faceIntoEdges[facei] = locFcs[facei].edges();
|
||||||
|
faceEdges[facei].resize(faceIntoEdges[facei].size(), -1);
|
||||||
labelList& curFaceEdges = faceEdges[facei];
|
|
||||||
curFaceEdges.setSize(faceIntoEdges[facei].size());
|
|
||||||
|
|
||||||
forAll(curFaceEdges, faceEdgeI)
|
|
||||||
{
|
|
||||||
curFaceEdges[faceEdgeI] = -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// faceFaces created using a dynamic list. Cannot guess size because
|
||||||
|
// of multiple connections
|
||||||
|
List<DynamicList<label>> ff(locFcs.size());
|
||||||
|
|
||||||
|
|
||||||
// This algorithm will produce a separated list of edges, internal edges
|
// This algorithm will produce a separated list of edges, internal edges
|
||||||
// starting from 0 and boundary edges starting from the top and
|
// starting from 0 and boundary edges starting from the top and
|
||||||
// growing down.
|
// growing down.
|
||||||
|
|
||||||
label nEdges = 0;
|
label nEdges = 0;
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
// Note that faceIntoEdges is sorted acc. to local vertex numbering
|
// Note that faceIntoEdges is sorted acc. to local vertex numbering
|
||||||
// in face (i.e. curEdges[0] is edge between f[0] and f[1])
|
// in face (i.e. curEdges[0] is edge between f[0] and f[1])
|
||||||
|
|
||||||
@ -132,8 +121,6 @@ Foam::PrimitivePatch<FaceList, PointField>::calcAddressing() const
|
|||||||
// If the edge is already detected, skip
|
// If the edge is already detected, skip
|
||||||
if (faceEdges[facei][edgeI] >= 0) continue;
|
if (faceEdges[facei][edgeI] >= 0) continue;
|
||||||
|
|
||||||
found = false;
|
|
||||||
|
|
||||||
// Set reference to the current edge
|
// Set reference to the current edge
|
||||||
const edge& e = curEdges[edgeI];
|
const edge& e = curEdges[edgeI];
|
||||||
|
|
||||||
@ -141,6 +128,8 @@ Foam::PrimitivePatch<FaceList, PointField>::calcAddressing() const
|
|||||||
|
|
||||||
const labelList& nbrFaces = pf[e.start()];
|
const labelList& nbrFaces = pf[e.start()];
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
forAll(nbrFaces, nbrFacei)
|
forAll(nbrFaces, nbrFacei)
|
||||||
{
|
{
|
||||||
// set reference to the current neighbour
|
// set reference to the current neighbour
|
||||||
@ -212,7 +201,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcAddressing() const
|
|||||||
|
|
||||||
// Set edge-face addressing
|
// Set edge-face addressing
|
||||||
labelList& curEf = edgeFaces[nEdges];
|
labelList& curEf = edgeFaces[nEdges];
|
||||||
curEf.setSize(cnf.size() + 1);
|
curEf.resize(cnf.size() + 1);
|
||||||
curEf[0] = facei;
|
curEf[0] = facei;
|
||||||
|
|
||||||
forAll(cnf, cnfI)
|
forAll(cnf, cnfI)
|
||||||
@ -256,7 +245,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcAddressing() const
|
|||||||
|
|
||||||
// Add edgeFace
|
// Add edgeFace
|
||||||
labelList& curEf = edgeFaces[nEdges];
|
labelList& curEf = edgeFaces[nEdges];
|
||||||
curEf.setSize(1);
|
curEf.resize(1);
|
||||||
curEf[0] = facei;
|
curEf[0] = facei;
|
||||||
|
|
||||||
nEdges++;
|
nEdges++;
|
||||||
@ -265,10 +254,10 @@ Foam::PrimitivePatch<FaceList, PointField>::calcAddressing() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// edges
|
// edges
|
||||||
edges.setSize(nEdges);
|
edges.resize(nEdges);
|
||||||
|
|
||||||
// edgeFaces list
|
// edgeFaces list
|
||||||
edgeFaces.setSize(nEdges);
|
edgeFaces.resize(nEdges);
|
||||||
|
|
||||||
// faceFaces list
|
// faceFaces list
|
||||||
faceFacesPtr_.reset(new labelListList(locFcs.size()));
|
faceFacesPtr_.reset(new labelListList(locFcs.size()));
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,13 +26,13 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "PrimitivePatch.H"
|
#include "PrimitivePatchBase.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(PrimitivePatchName, 0);
|
defineTypeNameAndDebug(PrimitivePatchBase, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 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::PrimitivePatchBase
|
||||||
|
|
||||||
|
Description
|
||||||
|
Non-templated base elements for PrimitivePatch
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
PrimitivePatchBase.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef PrimitivePatchBase_H
|
||||||
|
#define PrimitivePatchBase_H
|
||||||
|
|
||||||
|
#include "className.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class PrimitivePatchBase Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class PrimitivePatchBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
ClassName("PrimitivePatch");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Default construct
|
||||||
|
PrimitivePatchBase() = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 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/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "PrimitivePatch.H"
|
||||||
|
#include "HashSet.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class FaceList, class PointField>
|
||||||
|
Foam::labelList
|
||||||
|
Foam::PrimitivePatch<FaceList, PointField>::boundaryFaces() const
|
||||||
|
{
|
||||||
|
// By definition boundary edges have a _single_ face attached,
|
||||||
|
// but a face can easily have multiple boundary edges.
|
||||||
|
|
||||||
|
const labelListList& edgeToFace = edgeFaces();
|
||||||
|
|
||||||
|
labelHashSet bndFaces(2*nBoundaryEdges());
|
||||||
|
|
||||||
|
for (label edgei = nInternalEdges(); edgei < edgeToFace.size(); ++edgei)
|
||||||
|
{
|
||||||
|
bndFaces.insert(edgeToFace[edgei][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return bndFaces.sortedToc();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -45,16 +45,12 @@ Foam::PrimitivePatch<FaceList, PointField>::calcBdryPoints() const
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const edgeList& e = edges();
|
labelHashSet bp(2*nEdges());
|
||||||
|
|
||||||
labelHashSet bp(2*e.size());
|
for (const edge& e : boundaryEdges())
|
||||||
|
|
||||||
for (label edgeI = nInternalEdges_; edgeI < e.size(); edgeI++)
|
|
||||||
{
|
{
|
||||||
const edge& curEdge = e[edgeI];
|
bp.insert(e.first());
|
||||||
|
bp.insert(e.second());
|
||||||
bp.insert(curEdge.start());
|
|
||||||
bp.insert(curEdge.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boundaryPointsPtr_.reset(new labelList(bp.sortedToc()));
|
boundaryPointsPtr_.reset(new labelList(bp.sortedToc()));
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -49,12 +49,15 @@ Foam::PrimitivePatch<FaceList, PointField>::calcEdgeLoops() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
const edgeList& patchEdges = edges();
|
const edgeList& patchEdges = edges();
|
||||||
label nIntEdges = nInternalEdges();
|
const label nIntEdges = nInternalEdges();
|
||||||
label nBdryEdges = patchEdges.size() - nIntEdges;
|
const label nBdryEdges = patchEdges.size() - nIntEdges;
|
||||||
|
|
||||||
|
// Size return list plenty big
|
||||||
|
edgeLoopsPtr_.reset(new labelListList(nBdryEdges));
|
||||||
|
auto& edgeLoops = *edgeLoopsPtr_;
|
||||||
|
|
||||||
if (nBdryEdges == 0)
|
if (nBdryEdges == 0)
|
||||||
{
|
{
|
||||||
edgeLoopsPtr_.reset(new labelListList(0));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,11 +71,6 @@ Foam::PrimitivePatch<FaceList, PointField>::calcEdgeLoops() const
|
|||||||
// Loop per (boundary) edge.
|
// Loop per (boundary) edge.
|
||||||
labelList loopNumber(nBdryEdges, -1);
|
labelList loopNumber(nBdryEdges, -1);
|
||||||
|
|
||||||
// Size return list plenty big
|
|
||||||
edgeLoopsPtr_.reset(new labelListList(nBdryEdges));
|
|
||||||
auto& edgeLoops = *edgeLoopsPtr_;
|
|
||||||
|
|
||||||
|
|
||||||
// Current loop number.
|
// Current loop number.
|
||||||
label loopI = 0;
|
label loopI = 0;
|
||||||
|
|
||||||
|
|||||||
@ -41,13 +41,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcLocalPointOrder() const
|
|||||||
// Note: Cannot use bandCompressing as point-point addressing does
|
// Note: Cannot use bandCompressing as point-point addressing does
|
||||||
// not exist and is not considered generally useful.
|
// not exist and is not considered generally useful.
|
||||||
|
|
||||||
if (debug)
|
DebugInFunction << "Calculating local point order" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
<< "calcLocalPointOrder() : "
|
|
||||||
<< "calculating local point order"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localPointOrderPtr_)
|
if (localPointOrderPtr_)
|
||||||
{
|
{
|
||||||
@ -116,13 +110,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcLocalPointOrder() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated local point order" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
<< "calcLocalPointOrder() "
|
|
||||||
<< "finished calculating local point order"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -35,13 +35,7 @@ template<class FaceList, class PointField>
|
|||||||
void
|
void
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::calcMeshData() const
|
Foam::PrimitivePatch<FaceList, PointField>::calcMeshData() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Calculating mesh data" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcMeshData() : "
|
|
||||||
"calculating mesh data in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (meshPointsPtr_ || localFacesPtr_)
|
if (meshPointsPtr_ || localFacesPtr_)
|
||||||
{
|
{
|
||||||
@ -117,13 +111,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcMeshData() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated mesh data" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcMeshData() : "
|
|
||||||
"finished calculating mesh data in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,13 +119,7 @@ template<class FaceList, class PointField>
|
|||||||
void
|
void
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::calcMeshPointMap() const
|
Foam::PrimitivePatch<FaceList, PointField>::calcMeshPointMap() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Calculating mesh point map" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcMeshPointMap() : "
|
|
||||||
"calculating mesh point map in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (meshPointMapPtr_)
|
if (meshPointMapPtr_)
|
||||||
{
|
{
|
||||||
@ -157,13 +139,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcMeshPointMap() const
|
|||||||
mpMap.insert(mp[i], i);
|
mpMap.insert(mp[i], i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated mesh point map" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcMeshPointMap() : "
|
|
||||||
"finished calculating mesh point map in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -171,13 +147,7 @@ template<class FaceList, class PointField>
|
|||||||
void
|
void
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::calcLocalPoints() const
|
Foam::PrimitivePatch<FaceList, PointField>::calcLocalPoints() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Calculating localPoints" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcLocalPoints() : "
|
|
||||||
"calculating localPoints in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (localPointsPtr_)
|
if (localPointsPtr_)
|
||||||
{
|
{
|
||||||
@ -197,13 +167,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcLocalPoints() const
|
|||||||
locPts[pointi] = points_[meshPts[pointi]];
|
locPts[pointi] = points_[meshPts[pointi]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated localPoints" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
<< "calcLocalPoints() : "
|
|
||||||
<< "finished calculating localPoints in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -211,13 +175,7 @@ template<class FaceList, class PointField>
|
|||||||
void
|
void
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::calcPointNormals() const
|
Foam::PrimitivePatch<FaceList, PointField>::calcPointNormals() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Calculating pointNormals" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcPointNormals() : "
|
|
||||||
"calculating pointNormals in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pointNormalsPtr_)
|
if (pointNormalsPtr_)
|
||||||
{
|
{
|
||||||
@ -248,13 +206,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcPointNormals() const
|
|||||||
curNormal.normalise();
|
curNormal.normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated pointNormals" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcPointNormals() : "
|
|
||||||
"finished calculating pointNormals in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -262,13 +214,7 @@ template<class FaceList, class PointField>
|
|||||||
void
|
void
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::calcFaceCentres() const
|
Foam::PrimitivePatch<FaceList, PointField>::calcFaceCentres() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Calculating faceCentres" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcFaceCentres() : "
|
|
||||||
"calculating faceCentres in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (faceCentresPtr_)
|
if (faceCentresPtr_)
|
||||||
{
|
{
|
||||||
@ -286,13 +232,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcFaceCentres() const
|
|||||||
c[facei] = this->operator[](facei).centre(points_);
|
c[facei] = this->operator[](facei).centre(points_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated faceCentres" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcFaceCentres() : "
|
|
||||||
"finished calculating faceCentres in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -300,13 +240,7 @@ template<class FaceList, class PointField>
|
|||||||
void
|
void
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::calcMagFaceAreas() const
|
Foam::PrimitivePatch<FaceList, PointField>::calcMagFaceAreas() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Calculating magFaceAreas" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcMagFaceAreas() : "
|
|
||||||
"calculating magFaceAreas in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (magFaceAreasPtr_)
|
if (magFaceAreasPtr_)
|
||||||
{
|
{
|
||||||
@ -324,13 +258,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcMagFaceAreas() const
|
|||||||
a[facei] = this->operator[](facei).mag(points_);
|
a[facei] = this->operator[](facei).mag(points_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated magFaceAreas" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcMagFaceAreas() : "
|
|
||||||
"finished calculating magFaceAreas in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -338,13 +266,7 @@ template<class FaceList, class PointField>
|
|||||||
void
|
void
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::calcFaceAreas() const
|
Foam::PrimitivePatch<FaceList, PointField>::calcFaceAreas() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Calculating faceAreas" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcFaceAreas() : "
|
|
||||||
"calculating faceAreas in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (faceAreasPtr_)
|
if (faceAreasPtr_)
|
||||||
{
|
{
|
||||||
@ -362,13 +284,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcFaceAreas() const
|
|||||||
n[facei] = this->operator[](facei).areaNormal(points_);
|
n[facei] = this->operator[](facei).areaNormal(points_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated faceAreas" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcFaceAreas() : "
|
|
||||||
"finished calculating faceAreas in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -376,13 +292,7 @@ template<class FaceList, class PointField>
|
|||||||
void
|
void
|
||||||
Foam::PrimitivePatch<FaceList, PointField>::calcFaceNormals() const
|
Foam::PrimitivePatch<FaceList, PointField>::calcFaceNormals() const
|
||||||
{
|
{
|
||||||
if (debug)
|
DebugInFunction << "Calculating faceNormals" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcFaceNormals() : "
|
|
||||||
"calculating faceNormals in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (faceNormalsPtr_)
|
if (faceNormalsPtr_)
|
||||||
{
|
{
|
||||||
@ -400,13 +310,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcFaceNormals() const
|
|||||||
n[facei] = this->operator[](facei).unitNormal(points_);
|
n[facei] = this->operator[](facei).unitNormal(points_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "Calculated faceNormals" << endl;
|
||||||
{
|
|
||||||
Pout<< "PrimitivePatch<FaceList, PointField>::"
|
|
||||||
"calcFaceNormals() : "
|
|
||||||
"finished calculating faceNormals in PrimitivePatch"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,47 +43,38 @@ meshEdges
|
|||||||
DebugInFunction
|
DebugInFunction
|
||||||
<< "Calculating labels of patch edges in mesh edge list" << nl;
|
<< "Calculating labels of patch edges in mesh edge list" << nl;
|
||||||
|
|
||||||
// get reference to the list of edges on the patch
|
// The list of edges on the patch
|
||||||
const edgeList& PatchEdges = edges();
|
const edgeList& PatchEdges = edges();
|
||||||
|
|
||||||
|
// The output storage
|
||||||
|
labelList meshEdges(PatchEdges.size());
|
||||||
|
|
||||||
const labelListList& EdgeFaces = edgeFaces();
|
const labelListList& EdgeFaces = edgeFaces();
|
||||||
|
|
||||||
// create the storage
|
// The mesh points associated with the patch
|
||||||
labelList meshEdges(PatchEdges.size());
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
|
|
||||||
// get reference to the points on the patch
|
|
||||||
const labelList& pp = meshPoints();
|
const labelList& pp = meshPoints();
|
||||||
|
|
||||||
// WARNING: Remember that local edges address into local point list;
|
// WARNING: Remember that local edges address into local point list;
|
||||||
// local-to-global point label translation is necessary
|
// local-to-global point label translation is necessary
|
||||||
forAll(PatchEdges, edgeI)
|
forAll(PatchEdges, edgei)
|
||||||
{
|
{
|
||||||
const edge curEdge
|
bool found = false;
|
||||||
(pp[PatchEdges[edgeI].start()], pp[PatchEdges[edgeI].end()]);
|
|
||||||
|
|
||||||
found = false;
|
const edge globalEdge(pp, PatchEdges[edgei]);
|
||||||
|
|
||||||
// get the patch faces sharing the edge
|
// For each patch face sharing the edge
|
||||||
const labelList& curFaces = EdgeFaces[edgeI];
|
for (const label patchFacei : EdgeFaces[edgei])
|
||||||
|
|
||||||
forAll(curFaces, facei)
|
|
||||||
{
|
{
|
||||||
// get the cell next to the face
|
// The cell next to the face
|
||||||
label curCell = faceCells[curFaces[facei]];
|
const label curCelli = faceCells[patchFacei];
|
||||||
|
|
||||||
// get reference to edges on the cell
|
// Check the cell edges
|
||||||
const labelList& ce = cellEdges[curCell];
|
for (const label cellEdgei : cellEdges[curCelli])
|
||||||
|
|
||||||
forAll(ce, cellEdgeI)
|
|
||||||
{
|
{
|
||||||
if (allEdges[ce[cellEdgeI]] == curEdge)
|
if (allEdges[cellEdgei] == globalEdge)
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
meshEdges[edgei] = cellEdgei;
|
||||||
meshEdges[edgeI] = ce[cellEdgeI];
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,29 +98,27 @@ Foam::PrimitivePatch<FaceList, PointField>::meshEdges
|
|||||||
DebugInFunction
|
DebugInFunction
|
||||||
<< "Calculating labels of patch edges in mesh edge list" << nl;
|
<< "Calculating labels of patch edges in mesh edge list" << nl;
|
||||||
|
|
||||||
// get reference to the list of edges on the patch
|
// The list of edges on the patch
|
||||||
const edgeList& PatchEdges = edges();
|
const edgeList& PatchEdges = edges();
|
||||||
|
|
||||||
// create the storage
|
// The output storage
|
||||||
labelList meshEdges(PatchEdges.size());
|
labelList meshEdges(PatchEdges.size());
|
||||||
|
|
||||||
// get reference to the points on the patch
|
// The mesh points associated with the patch
|
||||||
const labelList& pp = meshPoints();
|
const labelList& pp = meshPoints();
|
||||||
|
|
||||||
// WARNING: Remember that local edges address into local point list;
|
// WARNING: Remember that local edges address into local point list;
|
||||||
// local-to-global point label translation is necessary
|
// local-to-global point label translation is necessary
|
||||||
forAll(PatchEdges, edgeI)
|
forAll(PatchEdges, edgei)
|
||||||
{
|
{
|
||||||
const label globalPointi = pp[PatchEdges[edgeI].start()];
|
const edge globalEdge(pp, PatchEdges[edgei]);
|
||||||
const edge curEdge(globalPointi, pp[PatchEdges[edgeI].end()]);
|
|
||||||
|
|
||||||
const labelList& pe = pointEdges[globalPointi];
|
// Check the attached edges
|
||||||
|
for (const label patchEdgei : pointEdges[globalEdge.start()])
|
||||||
forAll(pe, i)
|
|
||||||
{
|
{
|
||||||
if (allEdges[pe[i]] == curEdge)
|
if (allEdges[patchEdgei] == globalEdge)
|
||||||
{
|
{
|
||||||
meshEdges[edgeI] = pe[i];
|
meshEdges[edgei] = patchEdgei;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,18 +137,16 @@ Foam::PrimitivePatch<FaceList, PointField>::whichEdge
|
|||||||
const edge& e
|
const edge& e
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
|
if (e.start() >= 0 && e.start() < nPoints())
|
||||||
|
{
|
||||||
// Get pointEdges from the starting point and search all the candidates
|
// Get pointEdges from the starting point and search all the candidates
|
||||||
const edgeList& Edges = edges();
|
const edgeList& Edges = edges();
|
||||||
|
|
||||||
if (e.start() > -1 && e.start() < nPoints())
|
for (const label patchEdgei : pointEdges()[e.start()])
|
||||||
{
|
{
|
||||||
const labelList& pe = pointEdges()[e.start()];
|
if (e == Edges[patchEdgei])
|
||||||
|
|
||||||
forAll(pe, peI)
|
|
||||||
{
|
{
|
||||||
if (e == Edges[pe[peI]])
|
return patchEdgei;
|
||||||
{
|
|
||||||
return pe[peI];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,8 +54,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcPointEdges() const
|
|||||||
|
|
||||||
invertManyToMany(pe.size(), edges(), pe);
|
invertManyToMany(pe.size(), edges(), pe);
|
||||||
|
|
||||||
DebugInfo
|
DebugInfo << " Finished." << endl;
|
||||||
<< " Finished." << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -81,9 +80,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcPointFaces() const
|
|||||||
|
|
||||||
forAll(locFcs, facei)
|
forAll(locFcs, facei)
|
||||||
{
|
{
|
||||||
const face_type& curPoints = locFcs[facei];
|
for (const label pointi : locFcs[facei])
|
||||||
|
|
||||||
for (const label pointi : curPoints)
|
|
||||||
{
|
{
|
||||||
pointFcs[pointi].append(facei);
|
pointFcs[pointi].append(facei);
|
||||||
}
|
}
|
||||||
@ -98,8 +95,7 @@ Foam::PrimitivePatch<FaceList, PointField>::calcPointFaces() const
|
|||||||
pf[pointi] = pointFcs[pointi];
|
pf[pointi] = pointFcs[pointi];
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugInfo
|
DebugInfo << " Finished." << endl;
|
||||||
<< " Finished." << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -200,7 +200,7 @@ Foam::PrimitivePatch<FaceList, PointField>::projectPoints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) Info<< ".";
|
DebugInfo << '.';
|
||||||
} while (closer);
|
} while (closer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,10 +211,7 @@ Foam::PrimitivePatch<FaceList, PointField>::projectPoints
|
|||||||
{
|
{
|
||||||
nNSquaredSearches++;
|
nNSquaredSearches++;
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "p " << curLocalPointLabel << ": ";
|
||||||
{
|
|
||||||
Info<< "p " << curLocalPointLabel << ": ";
|
|
||||||
}
|
|
||||||
|
|
||||||
result[curLocalPointLabel] = objectHit(false, -1);
|
result[curLocalPointLabel] = objectHit(false, -1);
|
||||||
scalar minDistance = GREAT;
|
scalar minDistance = GREAT;
|
||||||
@ -254,23 +251,18 @@ Foam::PrimitivePatch<FaceList, PointField>::projectPoints
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << result[curLocalPointLabel] << nl;
|
||||||
{
|
|
||||||
Info<< result[curLocalPointLabel] << nl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (debug) Info<< "x";
|
DebugInfo << 'x';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< nl << "Executed " << nNSquaredSearches
|
||||||
Info<< nl << "Executed " << nNSquaredSearches
|
|
||||||
<< " n-squared searches out of total of "
|
<< " n-squared searches out of total of "
|
||||||
<< nPoints() << endl;
|
<< nPoints() << endl;
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -439,7 +431,7 @@ Foam::PrimitivePatch<FaceList, PointField>::projectFaceCentres
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug) Info<< ".";
|
DebugInfo << '.';
|
||||||
} while (closer);
|
} while (closer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,10 +439,7 @@ Foam::PrimitivePatch<FaceList, PointField>::projectFaceCentres
|
|||||||
{
|
{
|
||||||
nNSquaredSearches++;
|
nNSquaredSearches++;
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << "p " << curLocalFaceLabel << ": ";
|
||||||
{
|
|
||||||
Info<< "p " << curLocalFaceLabel << ": ";
|
|
||||||
}
|
|
||||||
|
|
||||||
result[curLocalFaceLabel] = objectHit(false, -1);
|
result[curLocalFaceLabel] = objectHit(false, -1);
|
||||||
scalar minDistance = GREAT;
|
scalar minDistance = GREAT;
|
||||||
@ -490,23 +479,19 @@ Foam::PrimitivePatch<FaceList, PointField>::projectFaceCentres
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo << result[curLocalFaceLabel] << nl;
|
||||||
{
|
|
||||||
Info<< result[curLocalFaceLabel] << nl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (debug) Info<< "x";
|
DebugInfo << 'x';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
DebugInfo
|
||||||
{
|
<< nl
|
||||||
Info<< nl << "Executed " << nNSquaredSearches
|
<< "Executed " << nNSquaredSearches
|
||||||
<< " n-squared searches out of total of "
|
<< " n-squared searches out of total of "
|
||||||
<< this->size() << endl;
|
<< this->size() << endl;
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -81,9 +81,9 @@ Foam::label Foam::checkFireEdges
|
|||||||
{
|
{
|
||||||
const face& faceA = faces[faceI];
|
const face& faceA = faces[faceI];
|
||||||
|
|
||||||
forAll(faceA, edgeI)
|
forAll(faceA, edgei)
|
||||||
{
|
{
|
||||||
const edge currEdge = faceA.faceEdge(edgeI);
|
const edge currEdge = faceA.edge(edgei);
|
||||||
|
|
||||||
// all faces attached to the first point
|
// all faces attached to the first point
|
||||||
const labelList& otherFaceIds = pointFaces[currEdge[0]];
|
const labelList& otherFaceIds = pointFaces[currEdge[0]];
|
||||||
|
|||||||
@ -154,7 +154,7 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dynamicFvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
@ -168,7 +168,7 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
dynamicFvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ
|
IOobject::MUST_READ
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
Foam::word regionName = Foam::fvMesh::defaultRegion;
|
Foam::word regionName = Foam::polyMesh::defaultRegion;
|
||||||
|
|
||||||
if (args.readIfPresent("region", regionName))
|
if (args.readIfPresent("region", regionName))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1756,7 +1756,7 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fvMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,7 +37,7 @@ License
|
|||||||
#include "motionSmoother.H"
|
#include "motionSmoother.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
@ -45,6 +45,8 @@ defineTypeNameAndDebug(edgeCollapser, 0);
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::labelHashSet Foam::edgeCollapser::checkBadFaces
|
Foam::labelHashSet Foam::edgeCollapser::checkBadFaces
|
||||||
(
|
(
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -415,7 +417,7 @@ void Foam::edgeCollapser::faceCollapseAxisAndAspectRatio
|
|||||||
{
|
{
|
||||||
// It is possible that all the points of a face are the same
|
// It is possible that all the points of a face are the same
|
||||||
|
|
||||||
collapseAxis = f.edges()[f.longestEdge(pts)].unitVec(pts);
|
collapseAxis = f.edge(f.longestEdge(pts)).unitVec(pts);
|
||||||
|
|
||||||
// Empirical correlation for high aspect ratio faces
|
// Empirical correlation for high aspect ratio faces
|
||||||
|
|
||||||
@ -432,7 +434,7 @@ void Foam::edgeCollapser::faceCollapseAxisAndAspectRatio
|
|||||||
// Cannot necessarily determine linearly independent
|
// Cannot necessarily determine linearly independent
|
||||||
// eigenvectors, or any at all, use longest edge direction.
|
// eigenvectors, or any at all, use longest edge direction.
|
||||||
|
|
||||||
collapseAxis = f.edges()[f.longestEdge(pts)].unitVec(pts);
|
collapseAxis = f.edge(f.longestEdge(pts)).unitVec(pts);
|
||||||
|
|
||||||
aspectRatio = 1.0;
|
aspectRatio = 1.0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
engineMesh::defaultRegion,
|
polyMesh::defaultRegion,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
runTime,
|
runTime,
|
||||||
Foam::IOobject::MUST_READ
|
Foam::IOobject::MUST_READ
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -122,9 +123,9 @@ Foam::tmp<Foam::scalarField> Foam::levelSetFraction
|
|||||||
vector a(Zero);
|
vector a(Zero);
|
||||||
vector r(Zero);
|
vector r(Zero);
|
||||||
|
|
||||||
for (label eI = 0; eI < f.size(); ++eI)
|
for (label edgei = 0; edgei < f.nEdges(); ++edgei)
|
||||||
{
|
{
|
||||||
const edge e = f.faceEdge(eI);
|
const edge e = f.edge(edgei);
|
||||||
|
|
||||||
const FixedList<point, 3>
|
const FixedList<point, 3>
|
||||||
tri =
|
tri =
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -141,9 +142,9 @@ Foam::tmp<Foam::Field<Type>> Foam::levelSetAverage
|
|||||||
vector a(Zero);
|
vector a(Zero);
|
||||||
sumType r = Zero;
|
sumType r = Zero;
|
||||||
|
|
||||||
for (label eI = 0; eI < f.size(); ++eI)
|
for (label edgei = 0; edgei < f.nEdges(); ++edgei)
|
||||||
{
|
{
|
||||||
const edge e = f.faceEdge(eI);
|
const edge e = f.edge(edgei);
|
||||||
|
|
||||||
const FixedList<point, 3>
|
const FixedList<point, 3>
|
||||||
tri =
|
tri =
|
||||||
|
|||||||
@ -103,7 +103,7 @@ bool Foam::simplifiedMeshes::columnFvMeshInfo::setPatchEntries
|
|||||||
(
|
(
|
||||||
runTime,
|
runTime,
|
||||||
runTime.timeName(),
|
runTime.timeName(),
|
||||||
(regionName_ == fvMesh::defaultRegion ? "" : regionName_)
|
(regionName_ == polyMesh::defaultRegion ? "" : regionName_)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (objects.empty())
|
if (objects.empty())
|
||||||
@ -411,7 +411,7 @@ Foam::simplifiedMeshes::columnFvMeshInfo::columnFvMeshInfo
|
|||||||
regionName_(regionName),
|
regionName_(regionName),
|
||||||
regionPrefix_
|
regionPrefix_
|
||||||
(
|
(
|
||||||
regionName_ == fvMesh::defaultRegion
|
regionName_ == polyMesh::defaultRegion
|
||||||
? ""
|
? ""
|
||||||
: regionName_ + '/'
|
: regionName_ + '/'
|
||||||
),
|
),
|
||||||
|
|||||||
@ -149,7 +149,7 @@ public:
|
|||||||
columnFvMesh
|
columnFvMesh
|
||||||
(
|
(
|
||||||
const Time& runTime,
|
const Time& runTime,
|
||||||
const word& regionName = fvMesh::defaultRegion
|
const word& regionName = polyMesh::defaultRegion
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -663,7 +663,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
|
|||||||
(
|
(
|
||||||
time_.globalPath()/functionObject::outputPrefix/"sets"/name()
|
time_.globalPath()/functionObject::outputPrefix/"sets"/name()
|
||||||
);
|
);
|
||||||
if (mesh_.name() != fvMesh::defaultRegion)
|
if (mesh_.name() != polyMesh::defaultRegion)
|
||||||
{
|
{
|
||||||
vtkPath = vtkPath/mesh_.name();
|
vtkPath = vtkPath/mesh_.name();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -297,7 +297,7 @@ void Foam::particle::changeFace(const label tetTriI)
|
|||||||
(
|
(
|
||||||
;
|
;
|
||||||
edgeI < newFace.size()
|
edgeI < newFace.size()
|
||||||
&& edge::compare(sharedEdge, newFace.faceEdge(edgeI)) != edgeComp;
|
&& edge::compare(sharedEdge, newFace.edge(edgeI)) != edgeComp;
|
||||||
++ edgeI
|
++ edgeI
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -84,7 +84,7 @@ Foam::label Foam::surfaceIntersection::getEdge
|
|||||||
const label fp
|
const label fp
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const edge faceEdge = surf.localFaces()[facei].faceEdge(fp);
|
const edge faceEdge = surf.localFaces()[facei].edge(fp);
|
||||||
|
|
||||||
const labelList& eLabels = surf.faceEdges()[facei];
|
const labelList& eLabels = surf.faceEdges()[facei];
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ Foam::sampledSets::sampledSets
|
|||||||
mesh_.time().globalPath()/functionObject::outputPrefix/name
|
mesh_.time().globalPath()/functionObject::outputPrefix/name
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mesh_.name() != fvMesh::defaultRegion)
|
if (mesh_.name() != polyMesh::defaultRegion)
|
||||||
{
|
{
|
||||||
outputPath_ = outputPath_/mesh_.name();
|
outputPath_ = outputPath_/mesh_.name();
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ Foam::sampledSets::sampledSets
|
|||||||
mesh_.time().globalPath()/functionObject::outputPrefix/name
|
mesh_.time().globalPath()/functionObject::outputPrefix/name
|
||||||
);
|
);
|
||||||
|
|
||||||
if (mesh_.name() != fvMesh::defaultRegion)
|
if (mesh_.name() != polyMesh::defaultRegion)
|
||||||
{
|
{
|
||||||
outputPath_ = outputPath_/mesh_.name();
|
outputPath_ = outputPath_/mesh_.name();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,7 +134,7 @@ void Foam::cuttingSurfaceBase::walkCellCuts
|
|||||||
|
|
||||||
forAll(f, fp)
|
forAll(f, fp)
|
||||||
{
|
{
|
||||||
edge e(f.faceEdge(fp));
|
edge e(f.edge(fp));
|
||||||
|
|
||||||
// Action #1: Orient edge (+ve gradient) and detect intersect
|
// Action #1: Orient edge (+ve gradient) and detect intersect
|
||||||
if (!edgeOrientIntersect(e))
|
if (!edgeOrientIntersect(e))
|
||||||
|
|||||||
Reference in New Issue
Block a user