Merge branch 'master' into particleInteractions

This commit is contained in:
graham
2010-04-07 09:59:20 +01:00
21 changed files with 563 additions and 936 deletions

View File

@ -70,6 +70,7 @@ namespace Foam
class mapPolyMesh;
class globalIndex;
class PstreamBuffers;
/*---------------------------------------------------------------------------*\
Class mapDistribute Declaration
@ -318,6 +319,13 @@ public:
}
}
//- Do all sends using PstreamBuffers
template<class T>
void send(PstreamBuffers&, const List<T>&) const;
//- Do all receives using PstreamBuffers
template<class T>
void receive(PstreamBuffers&, List<T>&) const;
//- Correct for topo change.
void updateMesh(const mapPolyMesh&)
{

View File

@ -185,7 +185,7 @@ void Foam::mapDistribute::distribute
{
if (!contiguous<T>())
{
PstreamBuffers pBuffs(Pstream::nonBlocking);
PstreamBuffers pBufs(Pstream::nonBlocking);
// Stream data into buffer
for (label domain = 0; domain < Pstream::nProcs(); domain++)
@ -195,13 +195,13 @@ void Foam::mapDistribute::distribute
if (domain != Pstream::myProcNo() && map.size())
{
// Put data into send buffer
UOPstream toDomain(domain, pBuffs);
UOPstream toDomain(domain, pBufs);
toDomain << UIndirectList<T>(field, map);
}
}
// Start receiving
pBuffs.finishedSends();
pBufs.finishedSends();
{
// Set up 'send' to myself
@ -231,7 +231,7 @@ void Foam::mapDistribute::distribute
if (domain != Pstream::myProcNo() && map.size())
{
UIPstream str(domain, pBuffs);
UIPstream str(domain, pBufs);
List<T> recvField(str);
if (recvField.size() != map.size())
@ -551,7 +551,7 @@ void Foam::mapDistribute::distribute
{
if (!contiguous<T>())
{
PstreamBuffers pBuffs(Pstream::nonBlocking);
PstreamBuffers pBufs(Pstream::nonBlocking);
// Stream data into buffer
for (label domain = 0; domain < Pstream::nProcs(); domain++)
@ -561,13 +561,13 @@ void Foam::mapDistribute::distribute
if (domain != Pstream::myProcNo() && map.size())
{
// Put data into send buffer
UOPstream toDomain(domain, pBuffs);
UOPstream toDomain(domain, pBufs);
toDomain << UIndirectList<T>(field, map);
}
}
// Start receiving
pBuffs.finishedSends();
pBufs.finishedSends();
{
// Set up 'send' to myself
@ -597,7 +597,7 @@ void Foam::mapDistribute::distribute
if (domain != Pstream::myProcNo() && map.size())
{
UIPstream str(domain, pBuffs);
UIPstream str(domain, pBufs);
List<T> recvField(str);
if (recvField.size() != map.size())
@ -757,4 +757,66 @@ void Foam::mapDistribute::distribute
}
template<class T>
void Foam::mapDistribute::send(PstreamBuffers& pBufs, const List<T>& field)
const
{
// Stream data into buffer
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = subMap_[domain];
if (map.size())
{
// Put data into send buffer
UOPstream toDomain(domain, pBufs);
toDomain << UIndirectList<T>(field, map);
}
}
// Start sending and receiving but do not block.
pBufs.finishedSends(false);
}
template<class T>
void Foam::mapDistribute::receive(PstreamBuffers& pBufs, List<T>& field) const
{
// Consume
field.setSize(constructSize_);
for (label domain = 0; domain < Pstream::nProcs(); domain++)
{
const labelList& map = constructMap_[domain];
if (map.size())
{
UIPstream str(domain, pBufs);
List<T> recvField(str);
if (recvField.size() != map.size())
{
FatalErrorIn
(
"template<class T>\n"
"void mapDistribute::receive\n"
"(\n"
" PstreamBuffers&,\n"
" List<T>&\n"
")\n"
) << "Expected from processor " << domain
<< " " << map.size() << " but received "
<< recvField.size() << " elements."
<< abort(FatalError);
}
forAll(map, i)
{
field[map[i]] = recvField[i];
}
}
}
}
// ************************************************************************* //

View File

@ -2189,8 +2189,8 @@ bool Foam::primitiveMesh::checkConcaveCells
{
if (debug || report)
{
Info<< " ***Concave cells found, number of cells: "
<< nConcaveCells << endl;
Info<< " ***Concave cells (using face planes) found,"
<< " number of cells: " << nConcaveCells << endl;
}
return true;

View File

@ -1234,7 +1234,7 @@ void Foam::meshRefinement::findCellZoneTopo
{
label surfI = namedSurfaceIndex[faceI];
if (surfI != -1 && surfaceToCellZone[surfI] != -1)
if (surfI != -1)
{
// Calculate region to zone from cellRegions on either side
// of internal face.
@ -1286,7 +1286,7 @@ void Foam::meshRefinement::findCellZoneTopo
label surfI = namedSurfaceIndex[faceI];
if (surfI != -1 && surfaceToCellZone[surfI] != -1)
if (surfI != -1)
{
bool changedCell = calcRegionToZone
(
@ -2327,9 +2327,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
// Set using walking
// ~~~~~~~~~~~~~~~~~
if (!allowFreeStandingZoneFaces)
//if (!allowFreeStandingZoneFaces)
{
Info<< "Walking to assign cellZones." << nl << endl;
Info<< "Walking from location-in-mesh " << keepPoint
<< " to assign cellZones "
<< "- crossing a faceZone face changes cellZone" << nl << endl;
// Topological walk
findCellZoneTopo
@ -2520,6 +2522,32 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
mesh_.setInstance(oldInstance());
}
// Print some stats (note: zones are synchronised)
if (mesh_.cellZones().size() > 0)
{
Info<< "CellZones:" << endl;
forAll(mesh_.cellZones(), zoneI)
{
const cellZone& cz = mesh_.cellZones()[zoneI];
Info<< " " << cz.name()
<< "\tsize:" << returnReduce(cz.size(), sumOp<label>())
<< endl;
}
Info<< endl;
}
if (mesh_.faceZones().size() > 0)
{
Info<< "FaceZones:" << endl;
forAll(mesh_.faceZones(), zoneI)
{
const faceZone& fz = mesh_.faceZones()[zoneI];
Info<< " " << fz.name()
<< "\tsize:" << returnReduce(fz.size(), sumOp<label>())
<< endl;
}
Info<< endl;
}
// None of the faces has changed, only the zones. Still...
updateMesh(map, labelList());

View File

@ -77,11 +77,22 @@ Foam::refinementSurfaces::refinementSurfaces
if (dict.found("faceZone"))
{
dict.lookup("faceZone") >> faceZoneNames_[surfI];
bool hasSide = dict.readIfPresent("zoneInside", zoneInside_[surfI]);
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
{
dict.lookup("zoneInside") >> zoneInside_[surfI];
if (hasSide && !allGeometry_[surfaces_[surfI]].hasVolumeType())
{
IOWarningIn
(
"refinementSurfaces::refinementSurfaces(..)",
dict
) << "Unused entry zoneInside for faceZone "
<< faceZoneNames_[surfI]
<< " since surface " << names_[surfI]
<< " is not closed." << endl;
}
}
else if (dict.found("zoneInside"))
else if (hasSide)
{
IOWarningIn("refinementSurfaces::refinementSurfaces(..)", dict)
<< "Unused entry zoneInside for faceZone "
@ -324,11 +335,30 @@ Foam::refinementSurfaces::refinementSurfaces
if (dict.found("faceZone"))
{
dict.lookup("faceZone") >> faceZoneNames_[surfI];
bool hasSide = dict.readIfPresent
(
"zoneInside",
zoneInside_[surfI]
);
if (dict.readIfPresent("cellZone", cellZoneNames_[surfI]))
{
dict.lookup("zoneInside") >> zoneInside_[surfI];
if
(
hasSide
&& !allGeometry_[surfaces_[surfI]].hasVolumeType()
)
{
IOWarningIn
(
"refinementSurfaces::refinementSurfaces(..)",
dict
) << "Unused entry zoneInside for faceZone "
<< faceZoneNames_[surfI]
<< " since surface " << names_[surfI]
<< " is not closed." << endl;
}
}
else if (dict.found("zoneInside"))
else if (hasSide)
{
IOWarningIn
(