Commit 0615b67d authored by Mark Olesen's avatar Mark Olesen
Browse files

Merge commit 'OpenCFD/master' into olesenm

parents 78e41f78 e49e95a5
......@@ -676,7 +676,7 @@ int main(int argc, char *argv[])
)
);
pointMesh procPMesh(procMesh, true);
pointMesh procPMesh(procMesh);
pointFieldDecomposer fieldDecomposer
(
......
......@@ -109,7 +109,6 @@ Foam::domainDecomposition::domainDecomposition(const IOobject& io)
procNeighbourProcessors_(nProcs_),
procProcessorPatchSize_(nProcs_),
procProcessorPatchStartIndex_(nProcs_),
globallySharedPoints_(0),
cyclicParallel_(false)
{
if (decompositionDict_.found("distributed"))
......@@ -132,15 +131,6 @@ bool Foam::domainDecomposition::writeDecomposition()
{
Info<< "\nConstructing processor meshes" << endl;
// Make a lookup map for globally shared points
Map<label> sharedPointLookup(2*globallySharedPoints_.size());
forAll(globallySharedPoints_, pointi)
{
sharedPointLookup.insert(globallySharedPoints_[pointi], pointi);
}
// Mark point/faces/cells that are in zones.
// -1 : not in zone
// -2 : in multiple zones
......
......@@ -103,9 +103,6 @@ class domainDecomposition
//- Start indices for inter-processor patches
labelListList procProcessorPatchStartIndex_;
//- List of globally shared point labels
labelList globallySharedPoints_;
//- Are there cyclic-parallel faces
bool cyclicParallel_;
......
......@@ -643,79 +643,6 @@ void Foam::domainDecomposition::decomposeMesh()
// Reset the size of used points
procPointLabels.setSize(nUsedPoints);
}
// Gather data about globally shared points
// Memory management
{
labelList pointsUsage(nPoints(), 0);
// Globally shared points are the ones used by more than 2 processors
// Size the list approximately and gather the points
labelHashSet gSharedPoints
(
min(100, nPoints()/1000)
);
// Loop through all the processors and mark up points used by
// processor boundaries. When a point is used twice, it is a
// globally shared point
for (label procI = 0; procI < nProcs_; procI++)
{
// Get list of face labels
const labelList& curFaceLabels = procFaceAddressing_[procI];
// Get start of processor faces
const labelList& curProcessorPatchStarts =
procProcessorPatchStartIndex_[procI];
const labelList& curProcessorPatchSizes =
procProcessorPatchSize_[procI];
// Reset the lookup list
pointsUsage = 0;
forAll(curProcessorPatchStarts, patchi)
{
const label curStart = curProcessorPatchStarts[patchi];
const label curEnd = curStart + curProcessorPatchSizes[patchi];
for
(
label facei = curStart;
facei < curEnd;
facei++
)
{
// Mark the original face as used
// Remember to decrement the index by one (turning index)
//
const label curF = mag(curFaceLabels[facei]) - 1;
const face& f = fcs[curF];
forAll(f, pointi)
{
if (pointsUsage[f[pointi]] == 0)
{
// Point not previously used
pointsUsage[f[pointi]] = patchi + 1;
}
else if (pointsUsage[f[pointi]] != patchi + 1)
{
// Point used by some other patch = global point!
gSharedPoints.insert(f[pointi]);
}
}
}
}
}
// Grab the result from the hash list
globallySharedPoints_ = gSharedPoints.toc();
sort(globallySharedPoints_);
}
}
// ************************************************************************* //
......@@ -26,7 +26,6 @@ License
#include "pointFieldDecomposer.H"
#include "processorPointPatchFields.H"
#include "globalPointPatchFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
......@@ -40,12 +39,8 @@ Foam::pointFieldDecomposer::decomposeField
// Create and map the internal field values
Field<Type> internalField(field.internalField(), pointAddressing_);
// Create a list of pointers for the patchFields including one extra
// for the global patch
PtrList<pointPatchField<Type> > patchFields
(
boundaryAddressing_.size() + 1
);
// Create a list of pointers for the patchFields
PtrList<pointPatchField<Type> > patchFields(boundaryAddressing_.size());
// Create and map the patch field values
forAll(boundaryAddressing_, patchi)
......@@ -78,17 +73,6 @@ Foam::pointFieldDecomposer::decomposeField
}
}
// Add the global patch
patchFields.set
(
boundaryAddressing_.size(),
new globalPointPatchField<Type>
(
procMesh_.boundary().globalPatch(),
DimensionedField<Type, pointMesh>::null()
)
);
// Create the field for the processor
return tmp<GeometricField<Type, pointPatchField, pointMesh> >
(
......
......@@ -110,30 +110,40 @@ void writeAllData
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << key << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData(map(vf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
scalarField data(fromSlaves[slave]);
writeData(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, prims, cmpt);
}
}
}
}
......@@ -150,30 +160,40 @@ void writeAllDataBinary
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary(key,ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary(map(vf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
scalarField data(fromSlaves[slave]);
writeEnsDataBinary(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, prims, cmpt);
}
}
}
}
......@@ -190,31 +210,40 @@ void writeAllFaceData
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(pf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << key << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData(map(pf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pf(fromSlave);
scalarField pf(fromSlaves[slave]);
writeData(pf, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(pf, prims, cmpt);
}
}
}
}
......@@ -231,31 +260,40 @@ void writeAllFaceDataBinary
{
if (nPrims)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(pf, prims, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary(key,ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary(map(pf, prims, cmpt), ensightFile);
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField pf(fromSlave);
scalarField pf(fromSlaves[slave]);
writeEnsDataBinary(pf, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(pf, prims, cmpt);
}
}
}
}
......@@ -554,10 +592,29 @@ void ensightFieldAscii
if (meshCellSets.nHexesWedges)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
ensightFile << "hexa8" << nl;
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeData
......@@ -568,20 +625,11 @@ void ensightFieldAscii
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
scalarField data(fromSlaves[slave]);
writeData(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
}
writeAllData("penta6", vf, prisms, meshCellSets.nPrisms, ensightFile);
......@@ -695,10 +743,29 @@ void ensightFieldBinary
if (meshCellSets.nHexesWedges)
{
PstreamBuffers pBufs(Pstream::nonBlocking);
if (!Pstream::master())
{
UOPstream toMaster(Pstream::masterNo(), pBufs);
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
pBufs.finishedSends();
if (Pstream::master())
{
writeEnsDataBinary("hexa8",ensightFile);
PtrList<UIPstream> fromSlaves(Pstream::nProcs());
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
fromSlaves.set(slave, new UIPstream(slave, pBufs));
}
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
writeEnsDataBinary
......@@ -709,20 +776,11 @@ void ensightFieldBinary
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
scalarField data(fromSlave);
scalarField data(fromSlaves[slave]);
writeEnsDataBinary(data, ensightFile);
}
}
}
else
{
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(vf, hexes, wedges, cmpt);
}
}
}
writeAllDataBinary
......
......@@ -37,7 +37,6 @@ SourceFiles
#ifndef lagrangianWriter_H
#define lagrangianWriter_H
#include "globalPointPatch.H"
#include "OFstream.H"
#include "Cloud.H"
#include "volFields.H"
......
......@@ -643,7 +643,6 @@ DebugSwitches
perfectInterface 0;
pointIndexHitList 0;
pointPatchField 0;
pointPatchInterpolation 0;
pointScalarField 0;
pointScalarField::DimensionedInternalField 0;
pointSet 0;
......
......@@ -453,7 +453,9 @@ $(constraintPointPatches)/processor/processorPointPatch.C
derivedPointPatches = $(pointPatches)/derived
$(derivedPointPatches)/coupled/coupledFacePointPatch.C
/*
$(derivedPointPatches)/global/globalPointPatch.C
*/
$(derivedPointPatches)/wall/wallPointPatch.C
pointBoundaryMesh = $(pointMesh)/pointBoundaryMesh
......@@ -508,7 +510,9 @@ $(constraintPointPatchFields)/processor/processorPointPatchFields.C
derivedPointPatchFields = $(pointPatchFields)/derived
$(derivedPointPatchFields)/slip/slipPointPatchFields.C
/*
$(derivedPointPatchFields)/global/globalPointPatchFields.C
*/
$(derivedPointPatchFields)/uniformFixedValue/uniformFixedValuePointPatchFields.C
$(derivedPointPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValuePointPatchFields.C
......
......@@ -121,11 +121,19 @@ public:
) = 0;
//- Initialise swap of patch point values
virtual void initSwapAdd(Field<Type>&) const
virtual void initSwapAddSeparated
(
const Pstream::commsTypes,
Field<Type>&
) const
{}
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const = 0;
virtual void swapAddSeparated
(
const Pstream::commsTypes,
Field<Type>&
) const = 0;
};
......
......@@ -122,7 +122,11 @@ cyclicPointPatchField<Type>::cyclicPointPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
void cyclicPointPatchField<Type>::swapAddSeparated
(
const Pstream::commsTypes,
Field<Type>& pField
) const
{
Field<Type> pf(this->patchInternalField(pField));
......@@ -145,7 +149,7 @@ void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
}
}
addToInternalField(pField, pf);
addToInternalField(pField, pf, cyclicPatch_.separatedPoints());
}
......
......@@ -159,7 +159,11 @@ public:
{}
//- Complete swap of patch point values and add to local values
virtual void swapAdd(Field<Type>&) const;
virtual void swapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>&
) const;
};
......
......@@ -96,16 +96,28 @@ processorPointPatchField<Type>::~processorPointPatchField()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
void processorPointPatchField<Type>::initSwapAddSeparated
(
const Pstream::commsTypes commsType,
Field<Type>& pField
)