mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -130,6 +130,7 @@ void testPackedList(const polyMesh& mesh, Random& rndGen)
|
||||
{
|
||||
FatalErrorIn("testPackedList()")
|
||||
<< "point:" << i
|
||||
<< " at:" << mesh.points()[i]
|
||||
<< " minlabel:" << pointValues[i]
|
||||
<< " minbits:" << bits.get(i)
|
||||
<< " maxLabel:" << maxPointValues[i]
|
||||
@ -186,6 +187,10 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
|
||||
{
|
||||
Info<< nl << "Testing Map synchronisation." << endl;
|
||||
|
||||
WarningIn("testSparseData()")
|
||||
<< "Position test of sparse data only correct for cases without cyclics"
|
||||
<< " with shared points." << endl;
|
||||
|
||||
primitivePatch allBoundary
|
||||
(
|
||||
SubList<face>
|
||||
@ -204,7 +209,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
|
||||
|
||||
{
|
||||
// Create some data. Use slightly perturbed positions.
|
||||
Map<vector> sparseData;
|
||||
Map<point> sparseData;
|
||||
pointField fullData(mesh.nPoints(), point::max);
|
||||
|
||||
forAll(localPoints, i)
|
||||
@ -223,14 +228,14 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
|
||||
(
|
||||
mesh,
|
||||
sparseData,
|
||||
minEqOp<vector>()
|
||||
minMagSqrEqOp<point>()
|
||||
// true // apply separation
|
||||
);
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh,
|
||||
fullData,
|
||||
minEqOp<vector>(),
|
||||
minMagSqrEqOp<point>(),
|
||||
point::max
|
||||
// true // apply separation
|
||||
);
|
||||
@ -257,7 +262,7 @@ void testSparseData(const polyMesh& mesh, Random& rndGen)
|
||||
}
|
||||
|
||||
// 2. Does sparseData contain more?
|
||||
forAllConstIter(Map<vector>, sparseData, iter)
|
||||
forAllConstIter(Map<point>, sparseData, iter)
|
||||
{
|
||||
const point& sparsePt = iter();
|
||||
label meshPointI = iter.key();
|
||||
@ -374,16 +379,12 @@ void testPointSync(const polyMesh& mesh, Random& rndGen)
|
||||
// Test position.
|
||||
|
||||
{
|
||||
WarningIn("testPointSync()")
|
||||
<< "Position test only correct for cases without cyclics"
|
||||
<< " with shared points." << endl;
|
||||
|
||||
pointField syncedPoints(mesh.points());
|
||||
syncTools::syncPointList
|
||||
syncTools::syncPointPositions
|
||||
(
|
||||
mesh,
|
||||
syncedPoints,
|
||||
minEqOp<point>(),
|
||||
minMagSqrEqOp<point>(),
|
||||
point::max
|
||||
);
|
||||
|
||||
@ -450,20 +451,16 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
|
||||
// Test position.
|
||||
|
||||
{
|
||||
WarningIn("testEdgeSync()")
|
||||
<< "Position test only correct for cases without cyclics"
|
||||
<< " with shared edges." << endl;
|
||||
|
||||
pointField syncedMids(edges.size());
|
||||
forAll(syncedMids, edgeI)
|
||||
{
|
||||
syncedMids[edgeI] = edges[edgeI].centre(mesh.points());
|
||||
}
|
||||
syncTools::syncEdgeList
|
||||
syncTools::syncEdgePositions
|
||||
(
|
||||
mesh,
|
||||
syncedMids,
|
||||
minEqOp<point>(),
|
||||
minMagSqrEqOp<point>(),
|
||||
point::max
|
||||
);
|
||||
|
||||
@ -509,10 +506,11 @@ void testEdgeSync(const polyMesh& mesh, Random& rndGen)
|
||||
{
|
||||
if (nMasters[edgeI] != 1)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
//FatalErrorIn("testEdgeSync()")
|
||||
WarningIn("testEdgeSync()")
|
||||
<< "Edge " << edgeI
|
||||
<< " midpoint " << edges[edgeI].centre(mesh.points())
|
||||
<< " at:" << mesh.points()[e[0]] << mesh.points()[e[1]]
|
||||
<< " has " << nMasters[edgeI]
|
||||
<< " masters."
|
||||
//<< exit(FatalError);
|
||||
@ -532,11 +530,11 @@ void testFaceSync(const polyMesh& mesh, Random& rndGen)
|
||||
{
|
||||
pointField syncedFc(mesh.faceCentres());
|
||||
|
||||
syncTools::syncFaceList
|
||||
syncTools::syncFacePositions
|
||||
(
|
||||
mesh,
|
||||
syncedFc,
|
||||
maxEqOp<point>()
|
||||
maxMagSqrEqOp<point>()
|
||||
);
|
||||
|
||||
forAll(syncedFc, faceI)
|
||||
|
||||
@ -300,19 +300,23 @@ void rewriteField
|
||||
|
||||
Info<< "Looking for entry for patch " << patchName << endl;
|
||||
|
||||
if (boundaryField.found(patchName) && !boundaryField.found(newName))
|
||||
// Find old patch name either direct or through wildcards
|
||||
// Find new patch name direct only
|
||||
|
||||
if
|
||||
(
|
||||
boundaryField.found(patchName)
|
||||
&& !boundaryField.found(newName, false, false)
|
||||
)
|
||||
{
|
||||
Info<< " Changing entry " << patchName << " to " << newName
|
||||
<< endl;
|
||||
|
||||
dictionary patchDict(boundaryField.subDict(patchName));
|
||||
dictionary& patchDict = boundaryField.subDict(patchName);
|
||||
|
||||
if (patchDict.found("value"))
|
||||
{
|
||||
IOWarningIn("rewriteField(..)", patchDict)
|
||||
<< "Cyclic patch " << patchName
|
||||
<< " has value entry. This will be removed."
|
||||
<< endl;
|
||||
// Remove any value field since wrong size.
|
||||
patchDict.remove("value");
|
||||
}
|
||||
|
||||
|
||||
35
doc/changes/staticLinkage.txt
Normal file
35
doc/changes/staticLinkage.txt
Normal file
@ -0,0 +1,35 @@
|
||||
http://www.openfoam.com
|
||||
Copyright (c) 2011 OpenCFD Ltd.
|
||||
|
||||
Static linkage:
|
||||
|
||||
- compile libraries as static objects:
|
||||
src; ./Allwmake libo
|
||||
- in the desired application (e.g. interFoam) adapt Make/options
|
||||
to link all indirect and direct dependencies as .o files:
|
||||
|
||||
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
|
||||
sinclude $(RULES)/mplib$(WM_MPLIB)
|
||||
|
||||
EXE_LIBS = \
|
||||
-lz $(PLIBS) \
|
||||
$(FOAM_LIBBIN)/$(FOAM_MPI)/libPstream.o \
|
||||
$(FOAM_LIBBIN)/libOSspecific.o \
|
||||
$(FOAM_LIBBIN)/libtwoPhaseInterfaceProperties.o \
|
||||
$(FOAM_LIBBIN)/libinterfaceProperties.o \
|
||||
$(FOAM_LIBBIN)/libincompressibleTransportModels.o \
|
||||
$(FOAM_LIBBIN)/libincompressibleTurbulenceModel.o \
|
||||
$(FOAM_LIBBIN)/libincompressibleRASModels.o \
|
||||
$(FOAM_LIBBIN)/libincompressibleLESModels.o \
|
||||
$(FOAM_LIBBIN)/libLESdeltas.o \
|
||||
$(FOAM_LIBBIN)/libLESfilters.o \
|
||||
$(FOAM_LIBBIN)/libfiniteVolume.o \
|
||||
$(FOAM_LIBBIN)/libmeshTools.o \
|
||||
$(FOAM_LIBBIN)/libtriSurface.o \
|
||||
$(FOAM_LIBBIN)/libfileFormats.o \
|
||||
$(FOAM_LIBBIN)/libOpenFOAM.o \
|
||||
|
||||
- in Make/files add
|
||||
SEXE = $(FOAM_USER_APPBIN)/interFoam-static
|
||||
- wmake exe
|
||||
- check with ldd
|
||||
@ -149,7 +149,7 @@ pyr
|
||||
(0 1)
|
||||
(1 2)
|
||||
(2 3)
|
||||
(3 4)
|
||||
(0 3)
|
||||
(0 4)
|
||||
(1 4)
|
||||
(2 4)
|
||||
|
||||
@ -90,7 +90,7 @@ unsetenv MPFR_ARCH_PATH
|
||||
# Location of compiler installation
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ( ! $?foamCompiler ) then
|
||||
foamCompiler=system
|
||||
set foamCompiler=system
|
||||
echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
|
||||
echo " foamCompiler not set, using '$foamCompiler'"
|
||||
endif
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -260,7 +260,12 @@ Foam::SHA1Digest Foam::dictionary::digest() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
bool Foam::dictionary::found
|
||||
(
|
||||
const word& keyword,
|
||||
bool recursive,
|
||||
bool patternMatch
|
||||
) const
|
||||
{
|
||||
if (hashedEntries_.found(keyword))
|
||||
{
|
||||
@ -268,7 +273,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
}
|
||||
else
|
||||
{
|
||||
if (patternEntries_.size())
|
||||
if (patternMatch && patternEntries_.size())
|
||||
{
|
||||
DLList<entry*>::const_iterator wcLink =
|
||||
patternEntries_.begin();
|
||||
@ -276,7 +281,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
patternRegexps_.begin();
|
||||
|
||||
// Find in patterns using regular expressions only
|
||||
if (findInPatterns(true, keyword, wcLink, reLink))
|
||||
if (findInPatterns(patternMatch, keyword, wcLink, reLink))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -284,7 +289,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const
|
||||
|
||||
if (recursive && &parent_ != &dictionary::null)
|
||||
{
|
||||
return parent_.found(keyword, recursive);
|
||||
return parent_.found(keyword, recursive, patternMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -264,7 +264,13 @@ public:
|
||||
|
||||
//- Search dictionary for given keyword
|
||||
// If recursive, search parent dictionaries
|
||||
bool found(const word&, bool recursive=false) const;
|
||||
// If patternMatch, use regular expressions
|
||||
bool found
|
||||
(
|
||||
const word&,
|
||||
bool recursive=false,
|
||||
bool patternMatch = true
|
||||
) const;
|
||||
|
||||
//- Find and return an entry data stream pointer if present
|
||||
// otherwise return NULL.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -61,11 +61,26 @@ bool Foam::mergePoints
|
||||
return false;
|
||||
}
|
||||
|
||||
// We're comparing distance squared to origin first.
|
||||
// Say if starting from two close points:
|
||||
// x, y, z
|
||||
// x+mergeTol, y+mergeTol, z+mergeTol
|
||||
// Then the magSqr of both will be
|
||||
// x^2+y^2+z^2
|
||||
// x^2+y^2+z^2 + 2*mergeTol*(x+z+y) + mergeTol^2*...
|
||||
// so the difference will be 2*mergeTol*(x+y+z)
|
||||
|
||||
const scalar mergeTolSqr = sqr(mergeTol);
|
||||
|
||||
// Sort points by magSqr
|
||||
SortableList<scalar> sortedMagSqr(magSqr(points - compareOrigin));
|
||||
const pointField d(points - compareOrigin);
|
||||
SortableList<scalar> sortedMagSqr(magSqr(d));
|
||||
scalarField sortedTol(points.size());
|
||||
forAll(sortedMagSqr.indices(), sortI)
|
||||
{
|
||||
const point& pt = d[sortedMagSqr.indices()[sortI]];
|
||||
sortedTol[sortI] = 2*mergeTol*(mag(pt.x())+mag(pt.y())+mag(pt.z()));
|
||||
}
|
||||
|
||||
bool hasMerged = false;
|
||||
|
||||
@ -94,7 +109,7 @@ bool Foam::mergePoints
|
||||
(
|
||||
sortedMagSqr[prevSortI]
|
||||
- sortedMagSqr[sortI]
|
||||
) <= mergeTolSqr;
|
||||
) <= sortedTol[sortI];
|
||||
prevSortI--
|
||||
)
|
||||
{
|
||||
|
||||
@ -552,25 +552,102 @@ void Foam::globalMeshData::calcGlobalPointSlaves() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
void Foam::globalMeshData::calcPointConnectivity
|
||||
(
|
||||
List<labelPairList>& allPointConnectivity
|
||||
) const
|
||||
{
|
||||
if (debug)
|
||||
const globalIndexAndTransform& transforms = globalTransforms();
|
||||
const labelListList& slaves = globalPointSlaves();
|
||||
const labelListList& transformedSlaves = globalPointTransformedSlaves();
|
||||
|
||||
|
||||
// Create field with my local data
|
||||
labelPairList myData(globalPointSlavesMap().constructSize());
|
||||
forAll(slaves, pointI)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
||||
<< " calculating coupled master to slave edge addressing." << endl;
|
||||
myData[pointI] = globalIndexAndTransform::encode
|
||||
(
|
||||
Pstream::myProcNo(),
|
||||
pointI,
|
||||
transforms.nullTransformIndex()
|
||||
);
|
||||
}
|
||||
|
||||
// - Send across connected edges (in global edge addressing)
|
||||
// - Check on receiving side whether edge has same slave edge
|
||||
// on both endpoints.
|
||||
// Send over.
|
||||
globalPointSlavesMap().distribute(myData);
|
||||
|
||||
|
||||
// Coupled point to global coupled edges.
|
||||
labelListList globalPointEdges(globalPointSlavesMap().constructSize());
|
||||
// String of connected points with their transform
|
||||
allPointConnectivity.setSize(globalPointSlavesMap().constructSize());
|
||||
forAll(slaves, pointI)
|
||||
{
|
||||
// Reconstruct string of connected points
|
||||
const labelList& pSlaves = slaves[pointI];
|
||||
const labelList& pTransformSlaves = transformedSlaves[pointI];
|
||||
labelPairList& pConnectivity = allPointConnectivity[pointI];
|
||||
pConnectivity.setSize(1+pSlaves.size()+pTransformSlaves.size());
|
||||
label connI = 0;
|
||||
|
||||
// Create local version
|
||||
// Add myself
|
||||
pConnectivity[connI++] = myData[pointI];
|
||||
// Add untransformed points
|
||||
forAll(pSlaves, i)
|
||||
{
|
||||
pConnectivity[connI++] = myData[pSlaves[i]];
|
||||
}
|
||||
// Add transformed points.
|
||||
forAll(pTransformSlaves, i)
|
||||
{
|
||||
// Get transform from index
|
||||
label transformI = globalPointSlavesMap().whichTransform
|
||||
(
|
||||
pTransformSlaves[i]
|
||||
);
|
||||
// Add transform to connectivity
|
||||
const labelPair& n = myData[pTransformSlaves[i]];
|
||||
label procI = globalIndexAndTransform::processor(n);
|
||||
label index = globalIndexAndTransform::index(n);
|
||||
pConnectivity[connI++] = globalIndexAndTransform::encode
|
||||
(
|
||||
procI,
|
||||
index,
|
||||
transformI
|
||||
);
|
||||
}
|
||||
|
||||
// Put back in slots
|
||||
forAll(pSlaves, i)
|
||||
{
|
||||
allPointConnectivity[pSlaves[i]] = pConnectivity;
|
||||
}
|
||||
forAll(pTransformSlaves, i)
|
||||
{
|
||||
allPointConnectivity[pTransformSlaves[i]] = pConnectivity;
|
||||
}
|
||||
}
|
||||
globalPointSlavesMap().reverseDistribute
|
||||
(
|
||||
allPointConnectivity.size(),
|
||||
allPointConnectivity
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::calcGlobalPointEdges
|
||||
(
|
||||
labelListList& globalPointEdges,
|
||||
List<labelPairList>& globalPointPoints
|
||||
) const
|
||||
{
|
||||
const edgeList& edges = coupledPatch().edges();
|
||||
const labelListList& pointEdges = coupledPatch().pointEdges();
|
||||
const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
|
||||
const labelListList& slaves = globalPointSlaves();
|
||||
const labelListList& transformedSlaves = globalPointTransformedSlaves();
|
||||
|
||||
// Create local version
|
||||
globalPointEdges.setSize(globalPointSlavesMap().constructSize());
|
||||
globalPointPoints.setSize(globalPointSlavesMap().constructSize());
|
||||
forAll(pointEdges, pointI)
|
||||
{
|
||||
const labelList& pEdges = pointEdges[pointI];
|
||||
@ -580,154 +657,377 @@ void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
{
|
||||
globalPEdges[i] = globalEdgeNumbers.toGlobal(pEdges[i]);
|
||||
}
|
||||
|
||||
labelPairList& globalPPoints = globalPointPoints[pointI];
|
||||
globalPPoints.setSize(pEdges.size());
|
||||
forAll(pEdges, i)
|
||||
{
|
||||
label otherPointI = edges[pEdges[i]].otherVertex(pointI);
|
||||
globalPPoints[i] = globalIndexAndTransform::encode
|
||||
(
|
||||
Pstream::myProcNo(),
|
||||
otherPointI,
|
||||
globalTransforms().nullTransformIndex()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Pull slave data to master. Dummy transform.
|
||||
globalPointSlavesMap().distribute(globalPointEdges);
|
||||
globalPointSlavesMap().distribute(globalPointPoints);
|
||||
// Add all pointEdges
|
||||
forAll(slaves, pointI)
|
||||
{
|
||||
const labelList& pSlaves = slaves[pointI];
|
||||
const labelList& pTransformSlaves = transformedSlaves[pointI];
|
||||
|
||||
label n = 0;
|
||||
forAll(pSlaves, i)
|
||||
{
|
||||
n += globalPointEdges[pSlaves[i]].size();
|
||||
}
|
||||
forAll(pTransformSlaves, i)
|
||||
{
|
||||
n += globalPointEdges[pTransformSlaves[i]].size();
|
||||
}
|
||||
|
||||
// Add all the point edges of the slaves to those of the (master) point
|
||||
{
|
||||
labelList& globalPEdges = globalPointEdges[pointI];
|
||||
label sz = globalPEdges.size();
|
||||
globalPEdges.setSize(sz+n);
|
||||
forAll(pSlaves, i)
|
||||
{
|
||||
const labelList& otherData = globalPointEdges[pSlaves[i]];
|
||||
forAll(otherData, j)
|
||||
{
|
||||
globalPEdges[sz++] = otherData[j];
|
||||
}
|
||||
}
|
||||
forAll(pTransformSlaves, i)
|
||||
{
|
||||
const labelList& otherData =
|
||||
globalPointEdges[pTransformSlaves[i]];
|
||||
forAll(otherData, j)
|
||||
{
|
||||
globalPEdges[sz++] = otherData[j];
|
||||
}
|
||||
}
|
||||
|
||||
// Put back in slots
|
||||
forAll(pSlaves, i)
|
||||
{
|
||||
globalPointEdges[pSlaves[i]] = globalPEdges;
|
||||
}
|
||||
forAll(pTransformSlaves, i)
|
||||
{
|
||||
globalPointEdges[pTransformSlaves[i]] = globalPEdges;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now check on master if any of my edges are also on slave.
|
||||
// This assumes that if slaves have a coupled edge it is also on
|
||||
// the master (otherwise the mesh would be illegal anyway)
|
||||
// Same for corresponding pointPoints
|
||||
{
|
||||
labelPairList& globalPPoints = globalPointPoints[pointI];
|
||||
label sz = globalPPoints.size();
|
||||
globalPPoints.setSize(sz + n);
|
||||
|
||||
// From global edge to slot in distributed data.
|
||||
Map<label> pointEdgeSet;
|
||||
// Add untransformed points
|
||||
forAll(pSlaves, i)
|
||||
{
|
||||
const labelPairList& otherData = globalPointPoints[pSlaves[i]];
|
||||
forAll(otherData, j)
|
||||
{
|
||||
globalPPoints[sz++] = otherData[j];
|
||||
}
|
||||
}
|
||||
// Add transformed points.
|
||||
forAll(pTransformSlaves, i)
|
||||
{
|
||||
// Get transform from index
|
||||
label transformI = globalPointSlavesMap().whichTransform
|
||||
(
|
||||
pTransformSlaves[i]
|
||||
);
|
||||
|
||||
const labelPairList& otherData =
|
||||
globalPointPoints[pTransformSlaves[i]];
|
||||
forAll(otherData, j)
|
||||
{
|
||||
// Add transform to connectivity
|
||||
const labelPair& n = otherData[j];
|
||||
label procI = globalIndexAndTransform::processor(n);
|
||||
label index = globalIndexAndTransform::index(n);
|
||||
globalPPoints[sz++] = globalIndexAndTransform::encode
|
||||
(
|
||||
procI,
|
||||
index,
|
||||
transformI
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Put back in slots
|
||||
forAll(pSlaves, i)
|
||||
{
|
||||
globalPointPoints[pSlaves[i]] = globalPPoints;
|
||||
}
|
||||
forAll(pTransformSlaves, i)
|
||||
{
|
||||
globalPointPoints[pTransformSlaves[i]] = globalPPoints;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Push back
|
||||
globalPointSlavesMap().reverseDistribute
|
||||
(
|
||||
globalPointEdges.size(),
|
||||
globalPointEdges
|
||||
);
|
||||
// Push back
|
||||
globalPointSlavesMap().reverseDistribute
|
||||
(
|
||||
globalPointPoints.size(),
|
||||
globalPointPoints
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Find transformation to take remotePoint to localPoint. Use info to find
|
||||
// the transforms.
|
||||
Foam::label Foam::globalMeshData::findTransform
|
||||
(
|
||||
const labelPairList& info,
|
||||
const labelPair& remotePoint,
|
||||
const label localPoint
|
||||
) const
|
||||
{
|
||||
const label remoteProcI = globalIndexAndTransform::processor(remotePoint);
|
||||
const label remoteIndex = globalIndexAndTransform::index(remotePoint);
|
||||
|
||||
label remoteTransformI = -1;
|
||||
label localTransformI = -1;
|
||||
forAll(info, i)
|
||||
{
|
||||
label procI = globalIndexAndTransform::processor(info[i]);
|
||||
label pointI = globalIndexAndTransform::index(info[i]);
|
||||
label transformI = globalIndexAndTransform::transformIndex(info[i]);
|
||||
|
||||
if (procI == Pstream::myProcNo() && pointI == localPoint)
|
||||
{
|
||||
localTransformI = transformI;
|
||||
//Pout<< "For local :" << localPoint
|
||||
// << " found transform:" << localTransformI
|
||||
// << endl;
|
||||
}
|
||||
if (procI == remoteProcI && pointI == remoteIndex)
|
||||
{
|
||||
remoteTransformI = transformI;
|
||||
//Pout<< "For remote:" << remotePoint
|
||||
// << " found transform:" << remoteTransformI
|
||||
// << " at index:" << i
|
||||
// << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (remoteTransformI == -1 || localTransformI == -1)
|
||||
{
|
||||
FatalErrorIn("globalMeshData::findTransform(..)")
|
||||
<< "Problem. Cannot find " << remotePoint
|
||||
<< " or " << localPoint << " in " << info
|
||||
<< endl
|
||||
<< "remoteTransformI:" << remoteTransformI << endl
|
||||
<< "localTransformI:" << localTransformI
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return globalTransforms().subtractTransformIndex
|
||||
(
|
||||
remoteTransformI,
|
||||
localTransformI
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::calcGlobalEdgeSlaves() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalEdgeSlaves() :"
|
||||
<< " calculating coupled master to slave edge addressing." << endl;
|
||||
}
|
||||
|
||||
const edgeList& edges = coupledPatch().edges();
|
||||
const labelListList& slaves = globalPointSlaves();
|
||||
const labelListList& transformedSlaves = globalPointTransformedSlaves();
|
||||
const globalIndex& globalEdgeNumbers = globalEdgeNumbering();
|
||||
|
||||
// Create master to slave addressing. Empty for slave edges.
|
||||
// - labelListList to store untransformed elements
|
||||
// - List<labelPair> to store transformed elements
|
||||
globalEdgeSlavesPtr_.reset(new labelListList(edges.size()));
|
||||
labelListList& globalEdgeSlaves = globalEdgeSlavesPtr_();
|
||||
List<labelPairList> transformedEdges(edges.size());
|
||||
|
||||
// The whole problem with deducting edge-connectivity from
|
||||
// point-connectivity is that one of the the endpoints might be
|
||||
// a local master but the other endpoint might not. So we first
|
||||
// need to make sure that all points know about connectivity and
|
||||
// the transformations.
|
||||
|
||||
|
||||
// 1. collect point connectivity - basically recreating globalPoints ouput.
|
||||
// All points will now have a string of points. The transforms are
|
||||
// in respect to the master.
|
||||
List<labelPairList> allPointConnectivity;
|
||||
calcPointConnectivity(allPointConnectivity);
|
||||
|
||||
|
||||
// 2. Get all pointEdges and pointPoints
|
||||
// Coupled point to global coupled edges and corresponding endpoint.
|
||||
labelListList globalPointEdges;
|
||||
List<labelPairList> globalPointPoints;
|
||||
calcGlobalPointEdges(globalPointEdges, globalPointPoints);
|
||||
|
||||
|
||||
// 3. Now all points have
|
||||
// - all the connected points with original transform
|
||||
// - all the connected global edges
|
||||
|
||||
// Now all we need to do is go through all the edges and check
|
||||
// both endpoints. If there is a edge between the two which is
|
||||
// produced by transforming both points in the same way it is a shared
|
||||
// edge.
|
||||
|
||||
// Collect strings of connected edges.
|
||||
List<labelPairList> allEdgeConnectivity(edges.size());
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
const labelList& pEdges0 = globalPointEdges[e[0]];
|
||||
const labelPairList& pPoints0 = globalPointPoints[e[0]];
|
||||
const labelList& pEdges1 = globalPointEdges[e[1]];
|
||||
const labelPairList& pPoints1 = globalPointPoints[e[1]];
|
||||
|
||||
// For this edge check get the pointEdges of the connected points
|
||||
// Any edge in both pointEdges must be connected to this edge.
|
||||
// Most edges will be size 2
|
||||
DynamicList<labelPair> eEdges(2);
|
||||
// Append myself.
|
||||
eEdges.append
|
||||
(
|
||||
globalIndexAndTransform::encode
|
||||
(
|
||||
Pstream::myProcNo(),
|
||||
edgeI,
|
||||
globalTransforms().nullTransformIndex()
|
||||
)
|
||||
);
|
||||
|
||||
// Untransformed
|
||||
// ~~~~~~~~~~~~~
|
||||
forAll(pEdges0, i)
|
||||
{
|
||||
const labelList& slaves0 = slaves[e[0]];
|
||||
const labelList& slaves1 = slaves[e[1]];
|
||||
|
||||
// Check for edges that are in both slaves0 and slaves1.
|
||||
pointEdgeSet.clear();
|
||||
forAll(slaves0, i)
|
||||
forAll(pEdges1, j)
|
||||
{
|
||||
const labelList& connectedEdges = globalPointEdges[slaves0[i]];
|
||||
// Store edges (data on Map not used)
|
||||
forAll(connectedEdges, j)
|
||||
if
|
||||
(
|
||||
pEdges0[i] == pEdges1[j]
|
||||
&& pEdges0[i] != globalEdgeNumbers.toGlobal(edgeI)
|
||||
)
|
||||
{
|
||||
pointEdgeSet.insert(connectedEdges[j], slaves0[i]);
|
||||
}
|
||||
}
|
||||
forAll(slaves1, i)
|
||||
{
|
||||
const labelList& connectedEdges = globalPointEdges[slaves1[i]];
|
||||
forAll(connectedEdges, j)
|
||||
{
|
||||
label globalEdgeI = connectedEdges[j];
|
||||
// Found a shared edge. Now check if the endpoints
|
||||
// go through the same transformation.
|
||||
// Local: e[0] remote:pPoints1[j]
|
||||
// Local: e[1] remote:pPoints0[i]
|
||||
|
||||
if (pointEdgeSet.found(globalEdgeI))
|
||||
|
||||
// Find difference in transforms to go from point on remote
|
||||
// edge (pPoints1[j]) to this point.
|
||||
|
||||
label transform0 = findTransform
|
||||
(
|
||||
allPointConnectivity[e[0]],
|
||||
pPoints1[j],
|
||||
e[0]
|
||||
);
|
||||
label transform1 = findTransform
|
||||
(
|
||||
allPointConnectivity[e[1]],
|
||||
pPoints0[i],
|
||||
e[1]
|
||||
);
|
||||
|
||||
if (transform0 == transform1)
|
||||
{
|
||||
// Found slave edge.
|
||||
label sz = globalEdgeSlaves[edgeI].size();
|
||||
globalEdgeSlaves[edgeI].setSize(sz+1);
|
||||
globalEdgeSlaves[edgeI][sz] = globalEdgeI;
|
||||
label procI = globalEdgeNumbers.whichProcID(pEdges0[i]);
|
||||
eEdges.append
|
||||
(
|
||||
globalIndexAndTransform::encode
|
||||
(
|
||||
procI,
|
||||
globalEdgeNumbers.toLocal(procI, pEdges0[i]),
|
||||
transform0
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allEdgeConnectivity[edgeI].transfer(eEdges);
|
||||
sort(allEdgeConnectivity[edgeI], globalIndexAndTransform::less());
|
||||
}
|
||||
|
||||
// Transformed
|
||||
// ~~~~~~~~~~~
|
||||
// We now have - in allEdgeConnectivity - a list of edges which are shared
|
||||
// between multiple processors. Filter into non-transformed and transformed
|
||||
// connections.
|
||||
|
||||
globalEdgeSlavesPtr_.reset(new labelListList(edges.size()));
|
||||
labelListList& globalEdgeSlaves = globalEdgeSlavesPtr_();
|
||||
List<labelPairList> transformedEdges(edges.size());
|
||||
forAll(allEdgeConnectivity, edgeI)
|
||||
{
|
||||
const labelPairList& edgeInfo = allEdgeConnectivity[edgeI];
|
||||
if (edgeInfo.size() >= 2)
|
||||
{
|
||||
// We look at the slots which hold transformed points
|
||||
// So now when we find the edge we can look at which slot
|
||||
// it came from and work out the transform
|
||||
const labelPair& masterInfo = edgeInfo[0];
|
||||
|
||||
const labelList& slaves0 = transformedSlaves[e[0]];
|
||||
const labelList& slaves1 = transformedSlaves[e[1]];
|
||||
|
||||
// Check for edges that are in both slaves0 and slaves1 (and get
|
||||
// to master through the same transform?)
|
||||
|
||||
pointEdgeSet.clear();
|
||||
forAll(slaves0, i)
|
||||
// Check if master edge (= first element (since sorted)) is me.
|
||||
if
|
||||
(
|
||||
(
|
||||
globalIndexAndTransform::processor(masterInfo)
|
||||
== Pstream::myProcNo()
|
||||
)
|
||||
&& (globalIndexAndTransform::index(masterInfo) == edgeI)
|
||||
)
|
||||
{
|
||||
const labelList& connected = globalPointEdges[slaves0[i]];
|
||||
forAll(connected, j)
|
||||
{
|
||||
pointEdgeSet.insert(connected[j], slaves0[i]);
|
||||
}
|
||||
}
|
||||
forAll(slaves1, i)
|
||||
{
|
||||
const labelList& connected = globalPointEdges[slaves1[i]];
|
||||
forAll(connected, j)
|
||||
{
|
||||
label globalEdgeI = connected[j];
|
||||
// Sort into transformed and untransformed
|
||||
labelList& eEdges = globalEdgeSlaves[edgeI];
|
||||
eEdges.setSize(edgeInfo.size()-1);
|
||||
|
||||
Map<label>::const_iterator iter = pointEdgeSet.find
|
||||
labelPairList& trafoEEdges = transformedEdges[edgeI];
|
||||
trafoEEdges.setSize(edgeInfo.size()-1);
|
||||
|
||||
label nonTransformI = 0;
|
||||
label transformI = 0;
|
||||
|
||||
for (label i = 1; i < edgeInfo.size(); i++)
|
||||
{
|
||||
const labelPair& info = edgeInfo[i];
|
||||
label procI = globalIndexAndTransform::processor(info);
|
||||
label index = globalIndexAndTransform::index(info);
|
||||
label transform = globalIndexAndTransform::transformIndex
|
||||
(
|
||||
globalEdgeI
|
||||
info
|
||||
);
|
||||
if (iter != pointEdgeSet.end())
|
||||
|
||||
if (transform == globalTransforms().nullTransformIndex())
|
||||
{
|
||||
// Found slave edge. Compare both transforms.
|
||||
// Get the transform by looking at where the point
|
||||
// slots came from.
|
||||
label transform0 = findLower
|
||||
eEdges[nonTransformI++] = globalEdgeNumbers.toGlobal
|
||||
(
|
||||
globalPointSlavesMap().transformStart(),
|
||||
iter()+1
|
||||
procI,
|
||||
index
|
||||
);
|
||||
label transform1 = findLower
|
||||
(
|
||||
globalPointSlavesMap().transformStart(),
|
||||
slaves1[i]+1
|
||||
);
|
||||
label mergedTransform =
|
||||
globalIndexAndTransform::minimumTransformIndex
|
||||
(
|
||||
transform0,
|
||||
transform1
|
||||
);
|
||||
|
||||
// Reencode originating edge index and processor
|
||||
// with new transform.
|
||||
label procI = globalEdgeNumbers.whichProcID
|
||||
(
|
||||
globalEdgeI
|
||||
);
|
||||
|
||||
labelPair edgeInfo
|
||||
(
|
||||
globalIndexAndTransform::encode
|
||||
(
|
||||
procI,
|
||||
globalEdgeNumbers.toLocal
|
||||
(
|
||||
procI,
|
||||
globalEdgeI
|
||||
),
|
||||
mergedTransform
|
||||
)
|
||||
);
|
||||
|
||||
label sz = transformedEdges[edgeI].size();
|
||||
transformedEdges[edgeI].setSize(sz+1);
|
||||
transformedEdges[edgeI][sz] = edgeInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
trafoEEdges[transformI++] = info;
|
||||
}
|
||||
}
|
||||
|
||||
eEdges.setSize(nonTransformI);
|
||||
trafoEEdges.setSize(transformI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,8 +263,29 @@ class globalMeshData
|
||||
//- Calculate global point addressing.
|
||||
void calcGlobalPointSlaves() const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves() const;
|
||||
// Global edge addressing
|
||||
|
||||
//- Calculate connected points
|
||||
void calcPointConnectivity(List<labelPairList>&) const;
|
||||
|
||||
//- Calculate pointEdges and pointPoints addressing
|
||||
void calcGlobalPointEdges
|
||||
(
|
||||
labelListList& globalPointEdges,
|
||||
List<labelPairList>& globalPointPoints
|
||||
) const;
|
||||
|
||||
//- Look up remote and local point and find using info the
|
||||
// transforms to go from remotePoint to localPoint
|
||||
label findTransform
|
||||
(
|
||||
const labelPairList& info,
|
||||
const labelPair& remotePoint,
|
||||
const label localPoint
|
||||
) const;
|
||||
|
||||
//- Calculate global edge addressing.
|
||||
void calcGlobalEdgeSlaves() const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -282,7 +303,7 @@ public:
|
||||
|
||||
// Static data members
|
||||
|
||||
//- Geomteric tolerance (fraction of bounding box)
|
||||
//- Geometric tolerance (fraction of bounding box)
|
||||
static const Foam::scalar matchTol_;
|
||||
|
||||
|
||||
@ -449,6 +470,17 @@ public:
|
||||
const bool isPosition
|
||||
);
|
||||
|
||||
//- Helper: synchronise data without transforms
|
||||
template<class Type, class CombineOp>
|
||||
static void syncData
|
||||
(
|
||||
List<Type>& pointData,
|
||||
const labelListList& slaves,
|
||||
const labelListList& transformedSlaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const CombineOp& cop
|
||||
);
|
||||
|
||||
|
||||
// Coupled point to coupled points. Coupled points are
|
||||
// points on any coupled patch.
|
||||
|
||||
@ -90,6 +90,59 @@ void Foam::globalMeshData::syncData
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncData
|
||||
(
|
||||
List<Type>& elems,
|
||||
const labelListList& slaves,
|
||||
const labelListList& transformedSlaves,
|
||||
const mapDistribute& slavesMap,
|
||||
const CombineOp& cop
|
||||
)
|
||||
{
|
||||
// Pull slave data onto master
|
||||
slavesMap.distribute(elems);
|
||||
|
||||
// Combine master data with slave data
|
||||
forAll(slaves, i)
|
||||
{
|
||||
Type& elem = elems[i];
|
||||
|
||||
const labelList& slavePoints = slaves[i];
|
||||
const labelList& transformSlavePoints = transformedSlaves[i];
|
||||
|
||||
if (slavePoints.size()+transformSlavePoints.size() > 0)
|
||||
{
|
||||
// Combine master with untransformed slave data
|
||||
forAll(slavePoints, j)
|
||||
{
|
||||
cop(elem, elems[slavePoints[j]]);
|
||||
}
|
||||
|
||||
// Combine master with transformed slave data
|
||||
forAll(transformSlavePoints, j)
|
||||
{
|
||||
cop(elem, elems[transformSlavePoints[j]]);
|
||||
}
|
||||
|
||||
|
||||
// Copy result back to slave slots
|
||||
forAll(slavePoints, j)
|
||||
{
|
||||
elems[slavePoints[j]] = elem;
|
||||
}
|
||||
forAll(transformSlavePoints, j)
|
||||
{
|
||||
elems[transformSlavePoints[j]] = elem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Push slave-slot data back to slaves
|
||||
slavesMap.reverseDistribute(elems.size(), elems);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class CombineOp>
|
||||
void Foam::globalMeshData::syncPointData
|
||||
(
|
||||
|
||||
@ -125,7 +125,7 @@ bool Foam::globalPoints::mergeInfo
|
||||
const labelPairList& nbrInfo,
|
||||
const label localPointI,
|
||||
labelPairList& myInfo
|
||||
)
|
||||
) const
|
||||
{
|
||||
bool anyChanged = false;
|
||||
|
||||
@ -167,7 +167,7 @@ bool Foam::globalPoints::mergeInfo
|
||||
);
|
||||
|
||||
// Combine mine and nbr transform
|
||||
label t = globalIndexAndTransform::mergeTransformIndex
|
||||
label t = globalTransforms_.mergeTransformIndex
|
||||
(
|
||||
nbrTransform,
|
||||
myTransform
|
||||
@ -315,27 +315,6 @@ bool Foam::globalPoints::storeInitialInfo
|
||||
}
|
||||
|
||||
|
||||
Foam::FixedList<Foam::label, 3> Foam::globalPoints::transformBits
|
||||
(
|
||||
const label transformIndex
|
||||
) const
|
||||
{
|
||||
label t = transformIndex;
|
||||
|
||||
// Decode permutation as 3 integers
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Note: FixedList for speed reasons.
|
||||
FixedList<label, 3> permutation;
|
||||
permutation[0] = (t%3)-1;
|
||||
t /= 3;
|
||||
permutation[1] = (t%3)-1;
|
||||
t /= 3;
|
||||
permutation[2] = (t%3)-1;
|
||||
|
||||
return permutation;
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalPoints::printProcPoints
|
||||
(
|
||||
const labelList& patchToMeshPoint,
|
||||
@ -352,7 +331,8 @@ void Foam::globalPoints::printProcPoints
|
||||
Pout<< " localpoint:";
|
||||
Pout<< index;
|
||||
Pout<< " through transform:"
|
||||
<< trafoI << " bits:" << transformBits(trafoI);
|
||||
<< trafoI << " bits:"
|
||||
<< globalTransforms_.decodeTransformIndex(trafoI);
|
||||
|
||||
if (procI == Pstream::myProcNo())
|
||||
{
|
||||
@ -850,49 +830,6 @@ Foam::labelList Foam::globalPoints::reverseMeshPoints
|
||||
}
|
||||
|
||||
|
||||
bool Foam::globalPoints::globalIndexAndTransformLessThan::operator()
|
||||
(
|
||||
const labelPair& a,
|
||||
const labelPair& b
|
||||
)
|
||||
{
|
||||
label procA = globalIndexAndTransform::processor(a);
|
||||
label procB = globalIndexAndTransform::processor(b);
|
||||
|
||||
if (procA < procB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (procA > procB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Equal proc.
|
||||
label indexA = globalIndexAndTransform::index(a);
|
||||
label indexB = globalIndexAndTransform::index(b);
|
||||
|
||||
if (indexA < indexB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (indexA > indexB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Equal index
|
||||
label transformA = globalIndexAndTransform::transformIndex(a);
|
||||
label transformB = globalIndexAndTransform::transformIndex(b);
|
||||
|
||||
return transformA < transformB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalPoints::calculateSharedPoints
|
||||
(
|
||||
const Map<label>& meshToPatchPoint, // from mesh point to local numbering
|
||||
@ -1027,7 +964,7 @@ void Foam::globalPoints::calculateSharedPoints
|
||||
forAllConstIter(Map<label>, meshToProcPoint_, iter)
|
||||
{
|
||||
labelPairList& pointInfo = procPoints_[iter()];
|
||||
sort(pointInfo, globalIndexAndTransformLessThan());
|
||||
sort(pointInfo, globalIndexAndTransform::less());
|
||||
}
|
||||
|
||||
|
||||
@ -1066,7 +1003,7 @@ void Foam::globalPoints::calculateSharedPoints
|
||||
|
||||
for (label i = 1; i < pointInfo.size(); i++)
|
||||
{
|
||||
labelPair info = pointInfo[i];
|
||||
const labelPair& info = pointInfo[i];
|
||||
label procI = globalIndexAndTransform::processor(info);
|
||||
label index = globalIndexAndTransform::index(info);
|
||||
label transform = globalIndexAndTransform::transformIndex
|
||||
|
||||
@ -139,18 +139,6 @@ class globalPoints
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Helper function to sort according minimum proc, minimum index,
|
||||
// minimum transform
|
||||
class globalIndexAndTransformLessThan
|
||||
{
|
||||
public:
|
||||
bool operator()
|
||||
(
|
||||
const labelPair& a,
|
||||
const labelPair& b
|
||||
);
|
||||
};
|
||||
|
||||
//- Count all points on processorPatches. Is all points for which
|
||||
// information is collected.
|
||||
static label countPatchPoints(const polyBoundaryMesh&);
|
||||
@ -174,12 +162,12 @@ class globalPoints
|
||||
) const;
|
||||
|
||||
//- Merge info from neighbour into my data
|
||||
static bool mergeInfo
|
||||
bool mergeInfo
|
||||
(
|
||||
const labelPairList& nbrInfo,
|
||||
const label localPointI,
|
||||
labelPairList& myInfo
|
||||
);
|
||||
) const;
|
||||
|
||||
//- From mesh point to 'local point'. Is the mesh point itself
|
||||
// if meshToPatchPoint is empty.
|
||||
@ -210,9 +198,7 @@ class globalPoints
|
||||
const label localPointI
|
||||
);
|
||||
|
||||
//- Get the signs for the individual transforms
|
||||
FixedList<label, 3> transformBits(const label transformIndex) const;
|
||||
|
||||
//- Debug printing
|
||||
void printProcPoints
|
||||
(
|
||||
const labelList& patchToMeshPoint,
|
||||
|
||||
@ -91,6 +91,43 @@ void Foam::syncTools::syncPointMap
|
||||
{
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
// Synchronize multiple shared points.
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
|
||||
// Values on shared points. Keyed on global shared index.
|
||||
Map<T> sharedPointValues(0);
|
||||
|
||||
if (pd.nGlobalPoints() > 0)
|
||||
{
|
||||
// meshPoint per local index
|
||||
const labelList& sharedPtLabels = pd.sharedPointLabels();
|
||||
// global shared index per local index
|
||||
const labelList& sharedPtAddr = pd.sharedPointAddr();
|
||||
|
||||
sharedPointValues.resize(sharedPtAddr.size());
|
||||
|
||||
// Fill my entries in the shared points
|
||||
forAll(sharedPtLabels, i)
|
||||
{
|
||||
label meshPointI = sharedPtLabels[i];
|
||||
|
||||
typename Map<T>::const_iterator fnd =
|
||||
pointValues.find(meshPointI);
|
||||
|
||||
if (fnd != pointValues.end())
|
||||
{
|
||||
combine
|
||||
(
|
||||
sharedPointValues,
|
||||
cop,
|
||||
sharedPtAddr[i], // index
|
||||
fnd() // value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
@ -254,8 +291,6 @@ void Foam::syncTools::syncPointMap
|
||||
}
|
||||
|
||||
// Synchronize multiple shared points.
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
|
||||
if (pd.nGlobalPoints() > 0)
|
||||
{
|
||||
// meshPoint per local index
|
||||
@ -263,30 +298,6 @@ void Foam::syncTools::syncPointMap
|
||||
// global shared index per local index
|
||||
const labelList& sharedPtAddr = pd.sharedPointAddr();
|
||||
|
||||
// Values on shared points. Keyed on global shared index.
|
||||
Map<T> sharedPointValues(sharedPtAddr.size());
|
||||
|
||||
|
||||
// Fill my entries in the shared points
|
||||
forAll(sharedPtLabels, i)
|
||||
{
|
||||
label meshPointI = sharedPtLabels[i];
|
||||
|
||||
typename Map<T>::const_iterator fnd =
|
||||
pointValues.find(meshPointI);
|
||||
|
||||
if (fnd != pointValues.end())
|
||||
{
|
||||
combine
|
||||
(
|
||||
sharedPointValues,
|
||||
cop,
|
||||
sharedPtAddr[i], // index
|
||||
fnd() // value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Reduce on master.
|
||||
|
||||
if (Pstream::parRun())
|
||||
@ -367,13 +378,7 @@ void Foam::syncTools::syncPointMap
|
||||
|
||||
if (sharedFnd != sharedPointValues.end())
|
||||
{
|
||||
combine
|
||||
(
|
||||
pointValues,
|
||||
cop,
|
||||
iter(), // index
|
||||
sharedFnd() // value
|
||||
);
|
||||
pointValues.set(iter(), sharedFnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -779,6 +784,23 @@ void Foam::syncTools::syncEdgeMap
|
||||
//
|
||||
// const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
//
|
||||
// // Synchronize multiple shared points.
|
||||
// const globalMeshData& pd = mesh.globalData();
|
||||
//
|
||||
// // Values on shared points.
|
||||
// Field<T> sharedPts(0);
|
||||
// if (pd.nGlobalPoints() > 0)
|
||||
// {
|
||||
// // Values on shared points.
|
||||
// sharedPts.setSize(pd.nGlobalPoints(), nullValue);
|
||||
//
|
||||
// forAll(pd.sharedPointLabels(), i)
|
||||
// {
|
||||
// label meshPointI = pd.sharedPointLabels()[i];
|
||||
// // Fill my entries in the shared points
|
||||
// sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (Pstream::parRun())
|
||||
// {
|
||||
@ -899,16 +921,6 @@ void Foam::syncTools::syncEdgeMap
|
||||
//
|
||||
// if (pd.nGlobalPoints() > 0)
|
||||
// {
|
||||
// // Values on shared points.
|
||||
// Field<T> sharedPts(pd.nGlobalPoints(), nullValue);
|
||||
//
|
||||
// forAll(pd.sharedPointLabels(), i)
|
||||
// {
|
||||
// label meshPointI = pd.sharedPointLabels()[i];
|
||||
// // Fill my entries in the shared points
|
||||
// sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI];
|
||||
// }
|
||||
//
|
||||
// // Combine on master.
|
||||
// Pstream::listCombineGather(sharedPts, cop);
|
||||
// Pstream::listCombineScatter(sharedPts);
|
||||
@ -1208,6 +1220,8 @@ void Foam::syncTools::syncEdgePositions
|
||||
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const labelList& meshEdges = gd.coupledPatchMeshEdges();
|
||||
const globalIndexAndTransform& git = gd.globalTransforms();
|
||||
const mapDistribute& map = gd.globalEdgeSlavesMap();
|
||||
|
||||
List<point> cppFld(UIndirectList<point>(edgeValues, meshEdges));
|
||||
|
||||
@ -1216,8 +1230,8 @@ void Foam::syncTools::syncEdgePositions
|
||||
cppFld,
|
||||
gd.globalEdgeSlaves(),
|
||||
gd.globalEdgeTransformedSlaves(),
|
||||
gd.globalEdgeSlavesMap(),
|
||||
gd.globalTransforms(),
|
||||
map,
|
||||
git,
|
||||
cop,
|
||||
true //position?
|
||||
);
|
||||
@ -1505,140 +1519,28 @@ void Foam::syncTools::syncPointList
|
||||
<< mesh.nPoints() << abort(FatalError);
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const labelList& meshPoints = gd.coupledPatch().meshPoints();
|
||||
|
||||
if (Pstream::parRun())
|
||||
List<unsigned int> cppFld(gd.globalPointSlavesMap().constructSize());
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nPoints() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<unsigned int> patchInfo(procPatch.nPoints());
|
||||
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
const labelList& nbrPts = procPatch.neighbPoints();
|
||||
|
||||
forAll(nbrPts, pointI)
|
||||
{
|
||||
label nbrPointI = nbrPts[pointI];
|
||||
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
}
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nPoints() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<unsigned int> nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
// We do not know the number of points on the other side
|
||||
// so cannot use Pstream::read.
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
const labelList& meshPts = procPatch.meshPoints();
|
||||
|
||||
forAll(meshPts, pointI)
|
||||
{
|
||||
label meshPointI = meshPts[pointI];
|
||||
unsigned int pointVal = pointValues[meshPointI];
|
||||
cop(pointVal, nbrPatchInfo[pointI]);
|
||||
pointValues[meshPointI] = pointVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
cppFld[i] = pointValues[meshPoints[i]];
|
||||
}
|
||||
|
||||
// Do the cyclics.
|
||||
forAll(patches, patchI)
|
||||
globalMeshData::syncData
|
||||
(
|
||||
cppFld,
|
||||
gd.globalPointSlaves(),
|
||||
gd.globalPointTransformedSlaves(),
|
||||
gd.globalPointSlavesMap(),
|
||||
cop
|
||||
);
|
||||
|
||||
// Extract back to mesh
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
if (cycPatch.owner())
|
||||
{
|
||||
// Owner does all.
|
||||
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPts = cycPatch.meshPoints();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshPts = nbrPatch.meshPoints();
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
label meshPoint0 = meshPts[e[0]];
|
||||
label meshPoint1 = nbrMeshPts[e[1]];
|
||||
|
||||
unsigned int val0 = pointValues[meshPoint0];
|
||||
unsigned int val1 = pointValues[meshPoint1];
|
||||
unsigned int t = val0;
|
||||
|
||||
cop(val0, val1);
|
||||
pointValues[meshPoint0] = val0;
|
||||
cop(val1, t);
|
||||
pointValues[meshPoint1] = val1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronize multiple shared points.
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
|
||||
if (pd.nGlobalPoints() > 0)
|
||||
{
|
||||
// Values on shared points. Use unpacked storage for ease!
|
||||
List<unsigned int> sharedPts(pd.nGlobalPoints(), nullValue);
|
||||
|
||||
forAll(pd.sharedPointLabels(), i)
|
||||
{
|
||||
label meshPointI = pd.sharedPointLabels()[i];
|
||||
// Fill my entries in the shared points
|
||||
sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointI];
|
||||
}
|
||||
|
||||
// Combine on master.
|
||||
Pstream::listCombineGather(sharedPts, cop);
|
||||
Pstream::listCombineScatter(sharedPts);
|
||||
|
||||
// Now we will all have the same information. Merge it back with
|
||||
// my local information.
|
||||
forAll(pd.sharedPointLabels(), i)
|
||||
{
|
||||
label meshPointI = pd.sharedPointLabels()[i];
|
||||
pointValues[meshPointI] = sharedPts[pd.sharedPointAddr()[i]];
|
||||
}
|
||||
pointValues[meshPoints[i]] = cppFld[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1664,140 +1566,28 @@ void Foam::syncTools::syncEdgeList
|
||||
<< mesh.nEdges() << abort(FatalError);
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
const globalMeshData& gd = mesh.globalData();
|
||||
const labelList& meshEdges = gd.coupledPatchMeshEdges();
|
||||
|
||||
if (Pstream::parRun())
|
||||
List<unsigned int> cppFld(gd.globalEdgeSlavesMap().constructSize());
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nEdges() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
List<unsigned int> patchInfo(procPatch.nEdges());
|
||||
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
const labelList& neighbEdges = procPatch.neighbEdges();
|
||||
|
||||
forAll(neighbEdges, edgeI)
|
||||
{
|
||||
label nbrEdgeI = neighbEdges[edgeI];
|
||||
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
|
||||
}
|
||||
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<processorPolyPatch>(patches[patchI])
|
||||
&& patches[patchI].nEdges() > 0
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
// Receive from neighbour.
|
||||
List<unsigned int> nbrPatchInfo(procPatch.nEdges());
|
||||
|
||||
{
|
||||
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
const labelList& meshEdges = procPatch.meshEdges();
|
||||
|
||||
forAll(meshEdges, edgeI)
|
||||
{
|
||||
unsigned int patchVal = nbrPatchInfo[edgeI];
|
||||
label meshEdgeI = meshEdges[edgeI];
|
||||
unsigned int edgeVal = edgeValues[meshEdgeI];
|
||||
cop(edgeVal, patchVal);
|
||||
edgeValues[meshEdgeI] = edgeVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
cppFld[i] = edgeValues[meshEdges[i]];
|
||||
}
|
||||
|
||||
// Do the cyclics.
|
||||
forAll(patches, patchI)
|
||||
globalMeshData::syncData
|
||||
(
|
||||
cppFld,
|
||||
gd.globalEdgeSlaves(),
|
||||
gd.globalEdgeTransformedSlaves(),
|
||||
gd.globalEdgeSlavesMap(),
|
||||
cop
|
||||
);
|
||||
|
||||
// Extract back to mesh
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
if (cycPatch.owner())
|
||||
{
|
||||
// Owner does all.
|
||||
const edgeList& coupledEdges = cycPatch.coupledEdges();
|
||||
const labelList& meshEdges = cycPatch.meshEdges();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshEdges = nbrPatch.meshEdges();
|
||||
|
||||
forAll(coupledEdges, i)
|
||||
{
|
||||
const edge& e = coupledEdges[i];
|
||||
|
||||
label edge0 = meshEdges[e[0]];
|
||||
label edge1 = nbrMeshEdges[e[1]];
|
||||
|
||||
unsigned int val0 = edgeValues[edge0];
|
||||
unsigned int t = val0;
|
||||
unsigned int val1 = edgeValues[edge1];
|
||||
|
||||
cop(t, val1);
|
||||
edgeValues[edge0] = t;
|
||||
cop(val1, val0);
|
||||
edgeValues[edge1] = val1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Synchronize multiple shared edges.
|
||||
const globalMeshData& pd = mesh.globalData();
|
||||
|
||||
if (pd.nGlobalEdges() > 0)
|
||||
{
|
||||
// Values on shared edges. Use unpacked storage for ease!
|
||||
List<unsigned int> sharedPts(pd.nGlobalEdges(), nullValue);
|
||||
|
||||
forAll(pd.sharedEdgeLabels(), i)
|
||||
{
|
||||
label meshEdgeI = pd.sharedEdgeLabels()[i];
|
||||
// Fill my entries in the shared edges
|
||||
sharedPts[pd.sharedEdgeAddr()[i]] = edgeValues[meshEdgeI];
|
||||
}
|
||||
|
||||
// Combine on master.
|
||||
Pstream::listCombineGather(sharedPts, cop);
|
||||
Pstream::listCombineScatter(sharedPts);
|
||||
|
||||
// Now we will all have the same information. Merge it back with
|
||||
// my local information.
|
||||
forAll(pd.sharedEdgeLabels(), i)
|
||||
{
|
||||
label meshEdgeI = pd.sharedEdgeLabels()[i];
|
||||
edgeValues[meshEdgeI] = sharedPts[pd.sharedEdgeAddr()[i]];
|
||||
}
|
||||
edgeValues[meshEdges[i]] = cppFld[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +60,24 @@ class polyMesh;
|
||||
|
||||
class globalIndexAndTransform
|
||||
{
|
||||
public:
|
||||
|
||||
// Public classes
|
||||
|
||||
//- Less function class used in sorting encoded transforms and indices
|
||||
// - minimum processor
|
||||
// - minimum local index
|
||||
// - minimum transform
|
||||
class less
|
||||
{
|
||||
public:
|
||||
|
||||
inline bool operator()(const labelPair&, const labelPair&) const;
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to mesh
|
||||
@ -120,11 +138,17 @@ class globalIndexAndTransform
|
||||
bool checkBothSigns
|
||||
) const;
|
||||
|
||||
//- Encode transform index. Hardcoded to 3 independent transforms max.
|
||||
inline label encodeTransformIndex
|
||||
(
|
||||
const FixedList<Foam::label, 3>& permutationIndices
|
||||
) const;
|
||||
|
||||
//- Decode transform index. Hardcoded to 3 independent transforms max.
|
||||
inline static FixedList<label, 3> decodeTransformIndex
|
||||
inline FixedList<label, 3> decodeTransformIndex
|
||||
(
|
||||
const label transformIndex
|
||||
);
|
||||
) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
globalIndexAndTransform(const globalIndexAndTransform&);
|
||||
@ -135,6 +159,10 @@ class globalIndexAndTransform
|
||||
|
||||
public:
|
||||
|
||||
//- Declare friendship with the entry class for IO
|
||||
friend class globalPoints;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
@ -166,18 +194,25 @@ public:
|
||||
) const;
|
||||
|
||||
//- Combine two transformIndices
|
||||
static inline label mergeTransformIndex
|
||||
inline label mergeTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
);
|
||||
) const;
|
||||
|
||||
//- Combine two transformIndices
|
||||
static inline label minimumTransformIndex
|
||||
inline label minimumTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
);
|
||||
) const;
|
||||
|
||||
//- Subtract two transformIndices
|
||||
inline label subtractTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
) const;
|
||||
|
||||
//- Encode index and bare index as components on own processor
|
||||
inline static labelPair encode
|
||||
|
||||
@ -27,6 +27,49 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::globalIndexAndTransform::less::operator()
|
||||
(
|
||||
const labelPair& a,
|
||||
const labelPair& b
|
||||
) const
|
||||
{
|
||||
label procA = globalIndexAndTransform::processor(a);
|
||||
label procB = globalIndexAndTransform::processor(b);
|
||||
|
||||
if (procA < procB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (procA > procB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Equal proc.
|
||||
label indexA = globalIndexAndTransform::index(a);
|
||||
label indexB = globalIndexAndTransform::index(b);
|
||||
|
||||
if (indexA < indexB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (indexA > indexB)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Equal index
|
||||
label transformA = globalIndexAndTransform::transformIndex(a);
|
||||
label transformB = globalIndexAndTransform::transformIndex(b);
|
||||
|
||||
return transformA < transformB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::encodeTransformIndex
|
||||
(
|
||||
const List<label>& permutationIndices
|
||||
@ -75,20 +118,56 @@ Foam::label Foam::globalIndexAndTransform::encodeTransformIndex
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::encodeTransformIndex
|
||||
(
|
||||
const FixedList<Foam::label, 3>& permutation
|
||||
) const
|
||||
{
|
||||
if (nIndependentTransforms() == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (nIndependentTransforms() == 1)
|
||||
{
|
||||
return permutation[0]+1;
|
||||
}
|
||||
else if (nIndependentTransforms() == 2)
|
||||
{
|
||||
return (permutation[1]+1)*3 + (permutation[0]+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
(permutation[2]+1)*9
|
||||
+ (permutation[1]+1)*3
|
||||
+ (permutation[0]+1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::FixedList<Foam::label, 3>
|
||||
Foam::globalIndexAndTransform::decodeTransformIndex
|
||||
(
|
||||
const label transformIndex
|
||||
)
|
||||
) const
|
||||
{
|
||||
FixedList<label, 3> permutation;
|
||||
FixedList<label, 3> permutation(0);
|
||||
|
||||
label t = transformIndex;
|
||||
permutation[0] = (t%3)-1;
|
||||
t /= 3;
|
||||
permutation[1] = (t%3)-1;
|
||||
t /= 3;
|
||||
permutation[2] = (t%3)-1;
|
||||
if (nIndependentTransforms() > 0)
|
||||
{
|
||||
permutation[0] = (t%3)-1;
|
||||
if (nIndependentTransforms() > 1)
|
||||
{
|
||||
t /= 3;
|
||||
permutation[1] = (t%3)-1;
|
||||
if (nIndependentTransforms() > 2)
|
||||
{
|
||||
t /= 3;
|
||||
permutation[2] = (t%3)-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef FULLDEBUG
|
||||
t /= 3;
|
||||
@ -179,10 +258,7 @@ Foam::label Foam::globalIndexAndTransform::addToTransformIndex
|
||||
// Re-encode permutation
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
return
|
||||
(permutation[2]+1)*9
|
||||
+ (permutation[1]+1)*3
|
||||
+ (permutation[0]+1);
|
||||
return encodeTransformIndex(permutation);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -195,7 +271,7 @@ Foam::label Foam::globalIndexAndTransform::mergeTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
)
|
||||
) const
|
||||
{
|
||||
FixedList<label, 3> permutation0 = decodeTransformIndex(transformIndex0);
|
||||
FixedList<label, 3> permutation1 = decodeTransformIndex(transformIndex1);
|
||||
@ -226,10 +302,7 @@ Foam::label Foam::globalIndexAndTransform::mergeTransformIndex
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return
|
||||
(permutation0[2]+1)*9
|
||||
+ (permutation0[1]+1)*3
|
||||
+ (permutation0[0]+1);
|
||||
return encodeTransformIndex(permutation0);
|
||||
}
|
||||
|
||||
|
||||
@ -237,7 +310,7 @@ Foam::label Foam::globalIndexAndTransform::minimumTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
)
|
||||
) const
|
||||
{
|
||||
FixedList<label, 3> permutation0 = decodeTransformIndex(transformIndex0);
|
||||
FixedList<label, 3> permutation1 = decodeTransformIndex(transformIndex1);
|
||||
@ -272,10 +345,25 @@ Foam::label Foam::globalIndexAndTransform::minimumTransformIndex
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
return
|
||||
(permutation0[2]+1)*9
|
||||
+ (permutation0[1]+1)*3
|
||||
+ (permutation0[0]+1);
|
||||
return encodeTransformIndex(permutation0);
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::globalIndexAndTransform::subtractTransformIndex
|
||||
(
|
||||
const label transformIndex0,
|
||||
const label transformIndex1
|
||||
) const
|
||||
{
|
||||
FixedList<label, 3> permutation0 = decodeTransformIndex(transformIndex0);
|
||||
FixedList<label, 3> permutation1 = decodeTransformIndex(transformIndex1);
|
||||
|
||||
forAll(permutation0, i)
|
||||
{
|
||||
permutation0[i] -= permutation1[i];
|
||||
}
|
||||
|
||||
return encodeTransformIndex(permutation0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,11 @@ cd ${0%/*} || exit 1 # run from this directory
|
||||
[ $# -ge 1 ] && makeOption=$1 || makeOption=libso
|
||||
set -x
|
||||
|
||||
wmake $makeOption MGridGenGamgAgglomeration
|
||||
export ParMGridGen=$WM_THIRD_PARTY_DIR/ParMGridGen-1.0
|
||||
|
||||
if [ -d "$ParMGridGen/MGridGen/Lib" ]
|
||||
then
|
||||
wmake $makeOption MGridGenGamgAgglomeration
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
ParMGridGen = $(WM_THIRD_PARTY_DIR)/ParMGridGen-1.0
|
||||
/* Needs ParMGridGen environment variable set. (see Allwmake script) */
|
||||
|
||||
TYPE_REAL=
|
||||
#if defined(WM_SP)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -331,7 +331,7 @@ bool triSurface::readAC(const fileName& ACfileName)
|
||||
|
||||
*this = triSurface(faces, patches, allPoints, true);
|
||||
|
||||
stitchTriangles(allPoints);
|
||||
stitchTriangles();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -422,6 +422,7 @@ bool triSurface::readSTLASCII(const fileName& STLfileName)
|
||||
setSize(lexer.nTriangles());
|
||||
DynamicList<label>& STLlabels = lexer.STLlabels();
|
||||
|
||||
// Assign triangles
|
||||
label pointi = 0;
|
||||
forAll(*this, i)
|
||||
{
|
||||
@ -433,8 +434,11 @@ bool triSurface::readSTLASCII(const fileName& STLfileName)
|
||||
|
||||
STLlabels.clear();
|
||||
|
||||
// Assign coordinates
|
||||
storedPoints().transfer(rawPoints);
|
||||
|
||||
// Stitch all points within SMALL meters.
|
||||
stitchTriangles(rawPoints);
|
||||
stitchTriangles();
|
||||
|
||||
// Convert solidNames into regionNames
|
||||
patches_.setSize(lexer.STLsolidNames().size());
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -123,7 +123,11 @@ bool Foam::triSurface::readSTLBINARY(const fileName& STLfileName)
|
||||
|
||||
//STLfile.close();
|
||||
|
||||
stitchTriangles(rawPoints);
|
||||
// Assign coordinates
|
||||
storedPoints().transfer(rawPoints);
|
||||
|
||||
// Stitch all points within SMALL meters.
|
||||
stitchTriangles();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -138,6 +138,7 @@ bool Foam::triSurface::readTRI(const fileName& TRIfileName)
|
||||
|
||||
setSize(STLlabels.size());
|
||||
|
||||
// Assign triangles
|
||||
pointI = 0;
|
||||
SLList<label>::const_iterator iter = STLlabels.begin();
|
||||
forAll(*this, i)
|
||||
@ -149,7 +150,10 @@ bool Foam::triSurface::readTRI(const fileName& TRIfileName)
|
||||
++iter;
|
||||
}
|
||||
|
||||
stitchTriangles(rawPoints);
|
||||
// Assign coordinates
|
||||
storedPoints().transfer(rawPoints);
|
||||
// Merge duplicate points
|
||||
stitchTriangles();
|
||||
|
||||
// Convert solidNames into regionNames
|
||||
stringList names(STLsolidNames.toc());
|
||||
|
||||
@ -31,30 +31,28 @@ License
|
||||
|
||||
bool Foam::triSurface::stitchTriangles
|
||||
(
|
||||
const pointField& rawPoints,
|
||||
const scalar tol,
|
||||
bool verbose
|
||||
)
|
||||
{
|
||||
pointField& ps = storedPoints();
|
||||
|
||||
// Merge points
|
||||
labelList pointMap;
|
||||
pointField newPoints;
|
||||
bool hasMerged = mergePoints(rawPoints, tol, verbose, pointMap, newPoints);
|
||||
bool hasMerged = mergePoints(ps, tol, verbose, pointMap, newPoints);
|
||||
|
||||
if (hasMerged)
|
||||
{
|
||||
pointField& ps = storedPoints();
|
||||
if (verbose)
|
||||
{
|
||||
Pout<< "stitchTriangles : Merged from " << ps.size()
|
||||
<< " points down to " << newPoints.size() << endl;
|
||||
}
|
||||
|
||||
// Set the coordinates to the merged ones
|
||||
ps.transfer(newPoints);
|
||||
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
Pout<< "stitchTriangles : Merged from " << rawPoints.size()
|
||||
<< " points down to " << ps.size() << endl;
|
||||
}
|
||||
|
||||
// Reset the triangle point labels to the unique points array
|
||||
label newTriangleI = 0;
|
||||
forAll(*this, i)
|
||||
@ -151,11 +149,6 @@ bool Foam::triSurface::stitchTriangles
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can happen for e.g. single triangle or cloud of unconnected triangles
|
||||
storedPoints() = rawPoints;
|
||||
}
|
||||
|
||||
return hasMerged;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -809,7 +809,7 @@ void Foam::triSurface::scalePoints(const scalar scaleFactor)
|
||||
void Foam::triSurface::cleanup(const bool verbose)
|
||||
{
|
||||
// Merge points (already done for STL, TRI)
|
||||
stitchTriangles(points(), SMALL, verbose);
|
||||
stitchTriangles(SMALL, verbose);
|
||||
|
||||
// Merging points might have changed geometric factors
|
||||
clearOut();
|
||||
|
||||
@ -112,7 +112,6 @@ class triSurface
|
||||
// Returns true if any points merged
|
||||
bool stitchTriangles
|
||||
(
|
||||
const pointField& rawPoints,
|
||||
const scalar tol = SMALL,
|
||||
const bool verbose = false
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user