Merge branch 'master' into cvm

This commit is contained in:
graham
2009-11-16 15:50:36 +00:00
45 changed files with 1639 additions and 621 deletions

View File

@ -90,7 +90,6 @@ int main(int argc, char *argv[])
// --- PISO loop // --- PISO loop
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
surfaceScalarField hf = fvc::interpolate(h);
volScalarField rUA = 1.0/hUEqn.A(); volScalarField rUA = 1.0/hUEqn.A();
surfaceScalarField ghrUAf = magg*fvc::interpolate(h*rUA); surfaceScalarField ghrUAf = magg*fvc::interpolate(h*rUA);

View File

@ -1,20 +1,5 @@
dictionary additional = mesh.solutionDict().subDict("additional"); dictionary additional = mesh.solutionDict().subDict("additional");
bool dpdt = true; bool dpdt = additional.lookupOrDefault("dpdt", true);
if (additional.found("dpdt")) bool eWork = additional.lookupOrDefault("eWork", true);
{ bool hWork = additional.lookupOrDefault("hWork", true);
additional.lookup("dpdt") >> dpdt;
}
bool eWork = true;
if (additional.found("eWork"))
{
additional.lookup("eWork") >> eWork;
}
bool hWork = true;
if (additional.found("hWork"))
{
additional.lookup("hWork") >> hWork;
}

View File

@ -57,7 +57,7 @@ int main(int argc, char *argv[])
//Info<< ck.specieThermo() << endl; //Info<< ck.specieThermo() << endl;
//Info<< ck.reactions() << endl; //Info<< ck.reactions() << endl;
PtrList<chemkinReader::reaction> reactions = ck.reactions(); const SLPtrList<gasReaction>& reactions = ck.reactions();
{ {
OFstream reactionStream("reactions"); OFstream reactionStream("reactions");
@ -70,17 +70,17 @@ int main(int argc, char *argv[])
label nReactions(readLabel(reactionStream)); label nReactions(readLabel(reactionStream));
reactionStream.readBeginList(args.executable().c_str()); reactionStream.readBeginList(args.executable().c_str());
PtrList<chemkinReader::reaction> testReactions(nReactions); PtrList<gasReaction> testReactions(nReactions);
forAll (testReactions, i) forAll (testReactions, i)
{ {
testReactions.set testReactions.set
( (
i, i,
chemkinReader::reaction::New gasReaction::New
( (
ck.species(), ck.species(),
ck.specieThermo(), ck.speciesThermo(),
reactionStream reactionStream
) )
); );

View File

@ -39,6 +39,8 @@ Description
\* ------------------------------------------------------------------------- */ \* ------------------------------------------------------------------------- */
#include <sstream> #include <sstream>
// For EOF only
#include <cstdio>
#include "scalar.H" #include "scalar.H"
#include "IStringStream.H" #include "IStringStream.H"

View File

@ -41,6 +41,9 @@ Description
#include "scalarList.H" #include "scalarList.H"
#include "IStringStream.H" #include "IStringStream.H"
// For EOF only
#include <cstdio>
using namespace Foam; using namespace Foam;
#include "argList.H" #include "argList.H"

View File

@ -428,28 +428,29 @@ void Foam::ensightMesh::writePrimsBinary
} }
void Foam::ensightMesh::writePolys void Foam::ensightMesh::writePolysNFaces
( (
const labelList& polys, const labelList& polys,
const cellList& cellFaces, const cellList& cellFaces,
const faceList& faces,
const label pointOffset,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const ) const
{ {
if (polys.size())
{
ensightGeometryFile
<< "nfaced" << nl << setw(10) << polys.size() << nl;
label po = pointOffset + 1;
forAll(polys, i) forAll(polys, i)
{ {
ensightGeometryFile ensightGeometryFile
<< setw(10) << cellFaces[polys[i]].size() << nl; << setw(10) << cellFaces[polys[i]].size() << nl;
} }
}
void Foam::ensightMesh::writePolysNPointsPerFace
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
OFstream& ensightGeometryFile
) const
{
forAll(polys, i) forAll(polys, i)
{ {
const labelList& cf = cellFaces[polys[i]]; const labelList& cf = cellFaces[polys[i]];
@ -460,6 +461,19 @@ void Foam::ensightMesh::writePolys
<< setw(10) << faces[cf[faceI]].size() << nl; << setw(10) << faces[cf[faceI]].size() << nl;
} }
} }
}
void Foam::ensightMesh::writePolysPoints
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
const label pointOffset,
OFstream& ensightGeometryFile
) const
{
label po = pointOffset + 1;
forAll(polys, i) forAll(polys, i)
{ {
@ -476,27 +490,137 @@ void Foam::ensightMesh::writePolys
ensightGeometryFile << nl; ensightGeometryFile << nl;
} }
} }
}
void Foam::ensightMesh::writeAllPolys
(
const labelList& pointOffsets,
OFstream& ensightGeometryFile
) const
{
if (meshCellSets_.nPolys)
{
const cellList& cellFaces = mesh_.cells();
const faceList& faces = mesh_.faces();
if (Pstream::master())
{
ensightGeometryFile
<< "nfaced" << nl << setw(10) << meshCellSets_.nPolys << nl;
}
// Number of faces for each poly cell
if (Pstream::master())
{
// Master
writePolysNFaces
(
meshCellSets_.polys,
cellFaces,
ensightGeometryFile
);
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
writePolysNFaces
(
polys,
cellFaces,
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces;
}
// Number of points for each face of the above list
if (Pstream::master())
{
// Master
writePolysNPointsPerFace
(
meshCellSets_.polys,
cellFaces,
faces,
ensightGeometryFile
);
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
writePolysNPointsPerFace
(
polys,
cellFaces,
faces,
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
// List of points id for each face of the above list
if (Pstream::master())
{
// Master
writePolysPoints
(
meshCellSets_.polys,
cellFaces,
faces,
0,
ensightGeometryFile
);
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
writePolysPoints
(
polys,
cellFaces,
faces,
pointOffsets[slave-1],
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
} }
} }
void Foam::ensightMesh::writePolysBinary void Foam::ensightMesh::writePolysNFacesBinary
( (
const labelList& polys, const labelList& polys,
const cellList& cellFaces, const cellList& cellFaces,
const faceList& faces,
const label pointOffset,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const ) const
{ {
if (polys.size())
{
writeEnsDataBinary("nfaced",ensightGeometryFile);
writeEnsDataBinary(polys.size(),ensightGeometryFile);
label po = pointOffset + 1;
//TODO No buffer at the moment. To be done for speed purposes!
forAll(polys, i) forAll(polys, i)
{ {
writeEnsDataBinary writeEnsDataBinary
@ -505,7 +629,17 @@ void Foam::ensightMesh::writePolysBinary
ensightGeometryFile ensightGeometryFile
); );
} }
}
void Foam::ensightMesh::writePolysNPointsPerFaceBinary
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
std::ofstream& ensightGeometryFile
) const
{
forAll(polys, i) forAll(polys, i)
{ {
const labelList& cf = cellFaces[polys[i]]; const labelList& cf = cellFaces[polys[i]];
@ -519,6 +653,19 @@ void Foam::ensightMesh::writePolysBinary
); );
} }
} }
}
void Foam::ensightMesh::writePolysPointsBinary
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
const label pointOffset,
std::ofstream& ensightGeometryFile
) const
{
label po = pointOffset + 1;
forAll(polys, i) forAll(polys, i)
{ {
@ -534,6 +681,126 @@ void Foam::ensightMesh::writePolysBinary
} }
} }
} }
}
void Foam::ensightMesh::writeAllPolysBinary
(
const labelList& pointOffsets,
std::ofstream& ensightGeometryFile
) const
{
if (meshCellSets_.nPolys)
{
const cellList& cellFaces = mesh_.cells();
const faceList& faces = mesh_.faces();
if (Pstream::master())
{
writeEnsDataBinary("nfaced",ensightGeometryFile);
writeEnsDataBinary(meshCellSets_.nPolys,ensightGeometryFile);
}
// Number of faces for each poly cell
if (Pstream::master())
{
// Master
writePolysNFacesBinary
(
meshCellSets_.polys,
cellFaces,
ensightGeometryFile
);
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
writePolysNFacesBinary
(
polys,
cellFaces,
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces;
}
// Number of points for each face of the above list
if (Pstream::master())
{
// Master
writePolysNPointsPerFaceBinary
(
meshCellSets_.polys,
cellFaces,
faces,
ensightGeometryFile
);
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
writePolysNPointsPerFaceBinary
(
polys,
cellFaces,
faces,
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
// List of points id for each face of the above list
if (Pstream::master())
{
// Master
writePolysPointsBinary
(
meshCellSets_.polys,
cellFaces,
faces,
0,
ensightGeometryFile
);
// Slaves
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
writePolysPointsBinary
(
polys,
cellFaces,
faces,
pointOffsets[slave-1],
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
} }
} }
@ -619,7 +886,6 @@ void Foam::ensightMesh::writeAllPrimsBinary
void Foam::ensightMesh::writeFacePrims void Foam::ensightMesh::writeFacePrims
( (
const char* key,
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset, const label pointOffset,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
@ -627,18 +893,6 @@ void Foam::ensightMesh::writeFacePrims
{ {
if (patchFaces.size()) if (patchFaces.size())
{ {
if (word(key) == "nsided")
{
ensightGeometryFile
<< key << nl << setw(10) << patchFaces.size() << nl;
forAll(patchFaces, i)
{
ensightGeometryFile
<< setw(10) << patchFaces[i].size() << nl;
}
}
label po = pointOffset + 1; label po = pointOffset + 1;
forAll(patchFaces, i) forAll(patchFaces, i)
@ -657,7 +911,6 @@ void Foam::ensightMesh::writeFacePrims
void Foam::ensightMesh::writeFacePrimsBinary void Foam::ensightMesh::writeFacePrimsBinary
( (
const char* key,
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset, const label pointOffset,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
@ -665,22 +918,6 @@ void Foam::ensightMesh::writeFacePrimsBinary
{ {
if (patchFaces.size()) if (patchFaces.size())
{ {
//TODO No buffer at the moment. To be done for speed purposes!
if (word(key) == "nsided")
{
writeEnsDataBinary(key,ensightGeometryFile);
writeEnsDataBinary(patchFaces.size(),ensightGeometryFile);
forAll(patchFaces, i)
{
writeEnsDataBinary
(
patchFaces[i].size(),
ensightGeometryFile
);
}
}
label po = pointOffset + 1; label po = pointOffset + 1;
forAll(patchFaces, i) forAll(patchFaces, i)
@ -731,17 +968,13 @@ void Foam::ensightMesh::writeAllFacePrims
if (nPrims) if (nPrims)
{ {
if (Pstream::master()) if (Pstream::master())
{
if (word(key) != "nsided")
{ {
ensightGeometryFile << key << nl << setw(10) << nPrims << nl; ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
}
if (&prims != NULL) if (&prims != NULL)
{ {
writeFacePrims writeFacePrims
( (
key,
map(patchFaces, prims), map(patchFaces, prims),
0, 0,
ensightGeometryFile ensightGeometryFile
@ -758,7 +991,251 @@ void Foam::ensightMesh::writeAllFacePrims
writeFacePrims writeFacePrims
( (
key, patchFaces,
pointOffsets[i],
ensightGeometryFile
);
}
}
}
else if (&prims != NULL)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(patchFaces, prims);
}
}
}
void Foam::ensightMesh::writeNSidedNPointsPerFace
(
const faceList& patchFaces,
OFstream& ensightGeometryFile
) const
{
forAll(patchFaces, i)
{
ensightGeometryFile
<< setw(10) << patchFaces[i].size() << nl;
}
}
void Foam::ensightMesh::writeNSidedPoints
(
const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile
) const
{
writeFacePrims
(
patchFaces,
pointOffset,
ensightGeometryFile
);
}
void Foam::ensightMesh::writeAllNSided
(
const labelList& prims,
const label nPrims,
const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
OFstream& ensightGeometryFile
) const
{
if (nPrims)
{
if (Pstream::master())
{
ensightGeometryFile
<< "nsided" << nl << setw(10) << nPrims << nl;
}
// Number of points for each face
if (Pstream::master())
{
if (&prims != NULL)
{
writeNSidedNPointsPerFace
(
map(patchFaces, prims),
ensightGeometryFile
);
}
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
writeNSidedNPointsPerFace
(
patchFaces,
ensightGeometryFile
);
}
}
}
else if (&prims != NULL)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(patchFaces, prims);
}
// List of points id for each face
if (Pstream::master())
{
if (&prims != NULL)
{
writeNSidedPoints
(
map(patchFaces, prims),
0,
ensightGeometryFile
);
}
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
writeNSidedPoints
(
patchFaces,
pointOffsets[i],
ensightGeometryFile
);
}
}
}
else if (&prims != NULL)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(patchFaces, prims);
}
}
}
void Foam::ensightMesh::writeNSidedPointsBinary
(
const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile
) const
{
writeFacePrimsBinary
(
patchFaces,
pointOffset,
ensightGeometryFile
);
}
void Foam::ensightMesh::writeNSidedNPointsPerFaceBinary
(
const faceList& patchFaces,
std::ofstream& ensightGeometryFile
) const
{
forAll(patchFaces, i)
{
writeEnsDataBinary
(
patchFaces[i].size(),
ensightGeometryFile
);
}
}
void Foam::ensightMesh::writeAllNSidedBinary
(
const labelList& prims,
const label nPrims,
const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
std::ofstream& ensightGeometryFile
) const
{
if (nPrims)
{
if (Pstream::master())
{
writeEnsDataBinary("nsided",ensightGeometryFile);
writeEnsDataBinary(nPrims,ensightGeometryFile);
}
// Number of points for each face
if (Pstream::master())
{
if (&prims != NULL)
{
writeNSidedNPointsPerFaceBinary
(
map(patchFaces, prims),
ensightGeometryFile
);
}
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
writeNSidedNPointsPerFaceBinary
(
patchFaces,
ensightGeometryFile
);
}
}
}
else if (&prims != NULL)
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< map(patchFaces, prims);
}
// List of points id for each face
if (Pstream::master())
{
if (&prims != NULL)
{
writeNSidedPointsBinary
(
map(patchFaces, prims),
0,
ensightGeometryFile
);
}
forAll (patchProcessors, i)
{
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave);
writeNSidedPointsBinary
(
patchFaces, patchFaces,
pointOffsets[i], pointOffsets[i],
ensightGeometryFile ensightGeometryFile
@ -789,18 +1266,14 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
if (nPrims) if (nPrims)
{ {
if (Pstream::master()) if (Pstream::master())
{
if (word(key) != "nsided")
{ {
writeEnsDataBinary(key,ensightGeometryFile); writeEnsDataBinary(key,ensightGeometryFile);
writeEnsDataBinary(nPrims,ensightGeometryFile); writeEnsDataBinary(nPrims,ensightGeometryFile);
}
if (&prims != NULL) if (&prims != NULL)
{ {
writeFacePrimsBinary writeFacePrimsBinary
( (
key,
map(patchFaces, prims), map(patchFaces, prims),
0, 0,
ensightGeometryFile ensightGeometryFile
@ -817,7 +1290,6 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
writeFacePrimsBinary writeFacePrimsBinary
( (
key,
patchFaces, patchFaces,
pointOffsets[i], pointOffsets[i],
ensightGeometryFile ensightGeometryFile
@ -863,8 +1335,6 @@ void Foam::ensightMesh::writeAscii
{ {
const Time& runTime = mesh_.time(); const Time& runTime = mesh_.time();
const pointField& points = mesh_.points(); const pointField& points = mesh_.points();
const cellList& cellFaces = mesh_.cells();
const faceList& faces = mesh_.faces();
const cellShapeList& cellShapes = mesh_.cellShapes(); const cellShapeList& cellShapes = mesh_.cellShapes();
word timeFile = prepend; word timeFile = prepend;
@ -990,48 +1460,11 @@ void Foam::ensightMesh::writeAscii
ensightGeometryFile ensightGeometryFile
); );
writeAllPolys
if (meshCellSets_.nPolys)
{
if (Pstream::master())
{
/*
ensightGeometryFile
<< "nfaced" << nl
<< setw(10) << meshCellSets_.nPolys << nl;
*/
writePolys
( (
meshCellSets_.polys, pointOffsets,
cellFaces,
faces,
0,
ensightGeometryFile ensightGeometryFile
); );
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
writePolys
(
polys,
cellFaces,
faces,
pointOffsets[slave-1],
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
}
} }
@ -1166,9 +1599,8 @@ void Foam::ensightMesh::writeAscii
ensightGeometryFile ensightGeometryFile
); );
writeAllFacePrims writeAllNSided
( (
"nsided",
polys, polys,
nfp.nPolys, nfp.nPolys,
patchFaces, patchFaces,
@ -1197,8 +1629,6 @@ void Foam::ensightMesh::writeBinary
{ {
//const Time& runTime = mesh.time(); //const Time& runTime = mesh.time();
const pointField& points = mesh_.points(); const pointField& points = mesh_.points();
const cellList& cellFaces = mesh_.cells();
const faceList& faces = mesh_.faces();
const cellShapeList& cellShapes = mesh_.cellShapes(); const cellShapeList& cellShapes = mesh_.cellShapes();
word timeFile = prepend; word timeFile = prepend;
@ -1316,48 +1746,12 @@ void Foam::ensightMesh::writeBinary
ensightGeometryFile ensightGeometryFile
); );
if (meshCellSets_.nPolys) writeAllPolysBinary
{
if (Pstream::master())
{
/*
ensightGeometryFile
<< "nfaced" << nl
<< setw(10) << meshCellSets_.nPolys << nl;
*/
writePolysBinary
( (
meshCellSets_.polys, pointOffsets,
cellFaces,
faces,
0,
ensightGeometryFile ensightGeometryFile
); );
for (int slave=1; slave<Pstream::nProcs(); slave++)
{
IPstream fromSlave(Pstream::scheduled, slave);
labelList polys(fromSlave);
cellList cellFaces(fromSlave);
faceList faces(fromSlave);
writePolysBinary
(
polys,
cellFaces,
faces,
pointOffsets[slave-1],
ensightGeometryFile
);
}
}
else
{
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< meshCellSets_.polys << cellFaces << faces;
}
}
} }
label ensightPatchI = patchPartOffset_; label ensightPatchI = patchPartOffset_;
@ -1495,9 +1889,8 @@ void Foam::ensightMesh::writeBinary
ensightGeometryFile ensightGeometryFile
); );
writeAllFacePrimsBinary writeAllNSidedBinary
( (
"nsided",
polys, polys,
nfp.nPolys, nfp.nPolys,
patchFaces, patchFaces,
@ -1516,4 +1909,5 @@ void Foam::ensightMesh::writeBinary
} }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -134,7 +134,22 @@ class ensightMesh
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const; ) const;
void writePolys void writePolysNFaces
(
const labelList& polys,
const cellList& cellFaces,
OFstream& ensightGeometryFile
) const;
void writePolysNPointsPerFace
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
OFstream& ensightGeometryFile
) const;
void writePolysPoints
( (
const labelList& polys, const labelList& polys,
const cellList& cellFaces, const cellList& cellFaces,
@ -143,6 +158,12 @@ class ensightMesh
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const; ) const;
void writeAllPolys
(
const labelList& pointOffsets,
OFstream& ensightGeometryFile
) const;
void writeAllPrims void writeAllPrims
( (
const char* key, const char* key,
@ -154,7 +175,6 @@ class ensightMesh
void writeFacePrims void writeFacePrims
( (
const char* key,
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset, const label pointOffset,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
@ -177,6 +197,29 @@ class ensightMesh
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const; ) const;
void writeNSidedNPointsPerFace
(
const faceList& patchFaces,
OFstream& ensightGeometryFile
) const;
void writeNSidedPoints
(
const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile
) const;
void writeAllNSided
(
const labelList& prims,
const label nPrims,
const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
OFstream& ensightGeometryFile
) const;
void writeAscii void writeAscii
( (
const fileName& postProcPath, const fileName& postProcPath,
@ -209,7 +252,22 @@ class ensightMesh
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const; ) const;
void writePolysBinary void writePolysNFacesBinary
(
const labelList& polys,
const cellList& cellFaces,
std::ofstream& ensightGeometryFile
) const;
void writePolysNPointsPerFaceBinary
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
std::ofstream& ensightGeometryFile
) const;
void writePolysPointsBinary
( (
const labelList& polys, const labelList& polys,
const cellList& cellFaces, const cellList& cellFaces,
@ -218,6 +276,12 @@ class ensightMesh
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const; ) const;
void writeAllPolysBinary
(
const labelList& pointOffsets,
std::ofstream& ensightGeometryFile
) const;
void writeAllFacePrimsBinary void writeAllFacePrimsBinary
( (
const char* key, const char* key,
@ -231,12 +295,33 @@ class ensightMesh
void writeFacePrimsBinary void writeFacePrimsBinary
( (
const char* key,
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset, const label pointOffset,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const; ) const;
void writeNSidedPointsBinary
(
const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile
) const;
void writeNSidedNPointsPerFaceBinary
(
const faceList& patchFaces,
std::ofstream& ensightGeometryFile
) const;
void writeAllNSidedBinary
(
const labelList& prims,
const label nPrims,
const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
std::ofstream& ensightGeometryFile
) const;
public: public:

View File

@ -35,6 +35,7 @@ InClass
#include "vtkFloatArray.h" #include "vtkFloatArray.h"
#include "vtkMultiBlockDataSet.h" #include "vtkMultiBlockDataSet.h"
#include "vtkPolyData.h" #include "vtkPolyData.h"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
@ -53,11 +54,11 @@ void Foam::vtkPV3Foam::convertFaceField
const labelList& faceOwner = mesh.faceOwner(); const labelList& faceOwner = mesh.faceOwner();
const labelList& faceNeigh = mesh.faceNeighbour(); const labelList& faceNeigh = mesh.faceNeighbour();
vtkFloatArray *cellData = vtkFloatArray::New(); vtkFloatArray* cellData = vtkFloatArray::New();
cellData->SetNumberOfTuples( faceLabels.size() ); cellData->SetNumberOfTuples(faceLabels.size());
cellData->SetNumberOfComponents( nComp ); cellData->SetNumberOfComponents(nComp);
cellData->Allocate( nComp*faceLabels.size() ); cellData->Allocate(nComp*faceLabels.size());
cellData->SetName( tf.name().c_str() ); cellData->SetName(tf.name().c_str());
if (debug) if (debug)
{ {
@ -123,11 +124,11 @@ void Foam::vtkPV3Foam::convertFaceField
const labelList& faceOwner = mesh.faceOwner(); const labelList& faceOwner = mesh.faceOwner();
const labelList& faceNeigh = mesh.faceNeighbour(); const labelList& faceNeigh = mesh.faceNeighbour();
vtkFloatArray *cellData = vtkFloatArray::New(); vtkFloatArray* cellData = vtkFloatArray::New();
cellData->SetNumberOfTuples( fSet.size() ); cellData->SetNumberOfTuples(fSet.size());
cellData->SetNumberOfComponents( nComp ); cellData->SetNumberOfComponents(nComp);
cellData->Allocate( nComp*fSet.size() ); cellData->Allocate(nComp*fSet.size());
cellData->SetName( tf.name().c_str() ); cellData->SetName(tf.name().c_str());
if (debug) if (debug)
{ {

View File

@ -80,8 +80,8 @@ vtkPolyData* Foam::vtkPV3Foam::lagrangianVTKMesh
vtkPoints* vtkpoints = vtkPoints::New(); vtkPoints* vtkpoints = vtkPoints::New();
vtkCellArray* vtkcells = vtkCellArray::New(); vtkCellArray* vtkcells = vtkCellArray::New();
vtkpoints->Allocate( parcels.size() ); vtkpoints->Allocate(parcels.size());
vtkcells->Allocate( parcels.size() ); vtkcells->Allocate(parcels.size());
vtkIdType particleId = 0; vtkIdType particleId = 0;
forAllConstIter(Cloud<passiveParticle>, parcels, iter) forAllConstIter(Cloud<passiveParticle>, parcels, iter)

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H" #include "vtkPV3Foam.H"
@ -40,10 +38,7 @@ Description
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh(const polyPatch& p)
(
const polyPatch& p
)
{ {
vtkPolyData* vtkmesh = vtkPolyData::New(); vtkPolyData* vtkmesh = vtkPolyData::New();
@ -56,8 +51,8 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
// Convert Foam mesh vertices to VTK // Convert Foam mesh vertices to VTK
const Foam::pointField& points = p.localPoints(); const Foam::pointField& points = p.localPoints();
vtkPoints *vtkpoints = vtkPoints::New(); vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( points.size() ); vtkpoints->Allocate(points.size());
forAll(points, i) forAll(points, i)
{ {
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
@ -71,7 +66,7 @@ vtkPolyData* Foam::vtkPV3Foam::patchVTKMesh
const faceList& faces = p.localFaces(); const faceList& faces = p.localFaces();
vtkCellArray* vtkcells = vtkCellArray::New(); vtkCellArray* vtkcells = vtkCellArray::New();
vtkcells->Allocate( faces.size() ); vtkcells->Allocate(faces.size());
forAll(faces, faceI) forAll(faces, faceI)
{ {
const face& f = faces[faceI]; const face& f = faces[faceI];

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H" #include "vtkPV3Foam.H"
@ -71,8 +69,8 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
// Convert Foam mesh vertices to VTK // Convert Foam mesh vertices to VTK
const pointField& points = p.localPoints(); const pointField& points = p.localPoints();
vtkPoints *vtkpoints = vtkPoints::New(); vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( points.size() ); vtkpoints->Allocate(points.size());
forAll(points, i) forAll(points, i)
{ {
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
@ -84,7 +82,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceSetVTKMesh
const faceList& faces = p.localFaces(); const faceList& faces = p.localFaces();
vtkCellArray* vtkcells = vtkCellArray::New(); vtkCellArray* vtkcells = vtkCellArray::New();
vtkcells->Allocate( faces.size() ); vtkcells->Allocate(faces.size());
forAll(faces, faceI) forAll(faces, faceI)
{ {
@ -127,8 +125,8 @@ vtkPolyData* Foam::vtkPV3Foam::pointSetVTKMesh
const pointField& meshPoints = mesh.points(); const pointField& meshPoints = mesh.points();
vtkPoints *vtkpoints = vtkPoints::New(); vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( pSet.size() ); vtkpoints->Allocate(pSet.size());
forAllConstIter(pointSet, pSet, iter) forAllConstIter(pointSet, pSet, iter)
{ {

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H" #include "vtkPV3Foam.H"
@ -136,8 +134,8 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
} }
// Convert Foam mesh vertices to VTK // Convert Foam mesh vertices to VTK
vtkPoints *vtkpoints = vtkPoints::New(); vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( mesh.nPoints() + nAddPoints ); vtkpoints->Allocate(mesh.nPoints() + nAddPoints);
const Foam::pointField& points = mesh.points(); const Foam::pointField& points = mesh.points();
@ -152,7 +150,7 @@ vtkUnstructuredGrid* Foam::vtkPV3Foam::volumeVTKMesh
Info<< "... converting cells" << endl; Info<< "... converting cells" << endl;
} }
vtkmesh->Allocate( mesh.nCells() + nAddCells ); vtkmesh->Allocate(mesh.nCells() + nAddCells);
// Set counters for additional points and additional cells // Set counters for additional points and additional cells
label addPointI = 0, addCellI = 0; label addPointI = 0, addCellI = 0;

View File

@ -22,8 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtkPV3Foam.H" #include "vtkPV3Foam.H"
@ -69,7 +67,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
const pointField& points = p.localPoints(); const pointField& points = p.localPoints();
vtkPoints* vtkpoints = vtkPoints::New(); vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( points.size() ); vtkpoints->Allocate(points.size());
forAll(points, i) forAll(points, i)
{ {
vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]); vtkInsertNextOpenFOAMPoint(vtkpoints, points[i]);
@ -83,7 +81,7 @@ vtkPolyData* Foam::vtkPV3Foam::faceZoneVTKMesh
const faceList& faces = p.localFaces(); const faceList& faces = p.localFaces();
vtkCellArray* vtkcells = vtkCellArray::New(); vtkCellArray* vtkcells = vtkCellArray::New();
vtkcells->Allocate( faces.size() ); vtkcells->Allocate(faces.size());
forAll(faces, faceI) forAll(faces, faceI)
{ {
@ -126,8 +124,8 @@ vtkPolyData* Foam::vtkPV3Foam::pointZoneVTKMesh
const pointField& meshPoints = mesh.points(); const pointField& meshPoints = mesh.points();
vtkPoints *vtkpoints = vtkPoints::New(); vtkPoints* vtkpoints = vtkPoints::New();
vtkpoints->Allocate( pointLabels.size() ); vtkpoints->Allocate(pointLabels.size());
forAll(pointLabels, pointI) forAll(pointLabels, pointI)
{ {

View File

@ -52,10 +52,10 @@ void Foam::vtkPV3Foam::convertPatchField
const label nComp = pTraits<Type>::nComponents; const label nComp = pTraits<Type>::nComponents;
vtkFloatArray* cellData = vtkFloatArray::New(); vtkFloatArray* cellData = vtkFloatArray::New();
cellData->SetNumberOfTuples( ptf.size() ); cellData->SetNumberOfTuples(ptf.size());
cellData->SetNumberOfComponents( nComp ); cellData->SetNumberOfComponents(nComp);
cellData->Allocate( nComp*ptf.size() ); cellData->Allocate(nComp*ptf.size());
cellData->SetName( name.c_str() ); cellData->SetName(name.c_str());
float vec[nComp]; float vec[nComp];
forAll(ptf, i) forAll(ptf, i)
@ -91,11 +91,11 @@ void Foam::vtkPV3Foam::convertPatchPointField
{ {
const label nComp = pTraits<Type>::nComponents; const label nComp = pTraits<Type>::nComponents;
vtkFloatArray *pointData = vtkFloatArray::New(); vtkFloatArray* pointData = vtkFloatArray::New();
pointData->SetNumberOfTuples( pptf.size() ); pointData->SetNumberOfTuples(pptf.size());
pointData->SetNumberOfComponents( nComp ); pointData->SetNumberOfComponents(nComp);
pointData->Allocate( nComp*pptf.size() ); pointData->Allocate(nComp*pptf.size());
pointData->SetName( name.c_str() ); pointData->SetName(name.c_str());
float vec[nComp]; float vec[nComp];
forAll(pptf, i) forAll(pptf, i)

View File

@ -187,7 +187,7 @@ void Foam::vtkPV3Foam::convertPointField
nPoints = ptf.size(); nPoints = ptf.size();
} }
vtkFloatArray *pointData = vtkFloatArray::New(); vtkFloatArray* pointData = vtkFloatArray::New();
pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size()); pointData->SetNumberOfTuples(nPoints + addPointCellLabels.size());
pointData->SetNumberOfComponents(nComp); pointData->SetNumberOfComponents(nComp);
pointData->Allocate(nComp*(nPoints + addPointCellLabels.size())); pointData->Allocate(nComp*(nPoints + addPointCellLabels.size()));

View File

@ -140,7 +140,6 @@ void Foam::vtkPV3Foam::updateInfoInternalMesh()
Info<< "<end> Foam::vtkPV3Foam::updateInfoInternalMesh" << endl; Info<< "<end> Foam::vtkPV3Foam::updateInfoInternalMesh" << endl;
} }
} }
@ -440,14 +439,13 @@ void Foam::vtkPV3Foam::updateInfoLagrangianFields()
<< endl; << endl;
} }
vtkDataArraySelection *fieldSelection = vtkDataArraySelection* fieldSelection =
reader_->GetLagrangianFieldSelection(); reader_->GetLagrangianFieldSelection();
// preserve the enabled selections // preserve the enabled selections
stringList enabledEntries = getSelectedArrayEntries(fieldSelection); stringList enabledEntries = getSelectedArrayEntries(fieldSelection);
fieldSelection->RemoveAllArrays(); fieldSelection->RemoveAllArrays();
//
// TODO - currently only get fields from ONE cloud // TODO - currently only get fields from ONE cloud
// have to decide if the second set of fields get mixed in // have to decide if the second set of fields get mixed in
// or dealt with separately // or dealt with separately

View File

@ -35,7 +35,7 @@ InClass
template<template<class> class patchType, class meshType> template<template<class> class patchType, class meshType>
void Foam::vtkPV3Foam::updateInfoFields void Foam::vtkPV3Foam::updateInfoFields
( (
vtkDataArraySelection *select vtkDataArraySelection* select
) )
{ {
if (debug) if (debug)
@ -112,4 +112,5 @@ void Foam::vtkPV3Foam::updateInfoFields
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -69,6 +69,7 @@ namespace Foam
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::vtkPV3Foam::AddToBlock void Foam::vtkPV3Foam::AddToBlock

View File

@ -62,7 +62,7 @@ void writeProcStats
// Determine surface bounding boxes, faces, points // Determine surface bounding boxes, faces, points
List<treeBoundBox> surfBb(Pstream::nProcs()); List<treeBoundBox> surfBb(Pstream::nProcs());
{ {
surfBb[Pstream::myProcNo()] = boundBox(s.points(), false); surfBb[Pstream::myProcNo()] = treeBoundBox(s.points());
Pstream::gatherList(surfBb); Pstream::gatherList(surfBb);
Pstream::scatterList(surfBb); Pstream::scatterList(surfBb);
} }

View File

@ -82,8 +82,8 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
: ${WM_OSTYPE:=POSIX}; export WM_OSTYPE : ${WM_OSTYPE:=POSIX}; export WM_OSTYPE
# Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc) # Compiler: set to Gcc, Gcc43, Gcc44, or Icc (for Intel's icc)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: ${WM_COMPILER:=Gcc}; export WM_COMPILER : ${WM_COMPILER:=Gcc}; export WM_COMPILER
export WM_COMPILER_ARCH= export WM_COMPILER_ARCH=

View File

@ -76,8 +76,8 @@ setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX if ( ! $?WM_OSTYPE ) setenv WM_OSTYPE POSIX
# Compiler: set to Gcc, Gcc43 or Icc (for Intel's icc) # Compiler: set to Gcc, Gcc43, Gcc44 or Icc (for Intel's icc)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc if ( ! $?WM_COMPILER ) setenv WM_COMPILER Gcc
setenv WM_COMPILER_ARCH setenv WM_COMPILER_ARCH

View File

@ -87,12 +87,12 @@ switch ("$compilerInstall")
case OpenFOAM: case OpenFOAM:
switch ("$WM_COMPILER") switch ("$WM_COMPILER")
case Gcc: case Gcc:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
breaksw breaksw
case Gcc44: case Gcc44:
setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
breaksw breaksw

View File

@ -111,12 +111,12 @@ case "${compilerInstall:-OpenFOAM}" in
OpenFOAM) OpenFOAM)
case "$WM_COMPILER" in case "$WM_COMPILER" in
Gcc) Gcc)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
;; ;;
Gcc44) Gcc44)
export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.4.2/platforms/$WM_ARCH$WM_COMPILER_ARCH
_foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
_foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
;; ;;

View File

@ -61,8 +61,16 @@ namespace Foam
template<class T, class Container> class CompactListList; template<class T, class Container> class CompactListList;
template<class T, class Container> Istream& operator>>(Istream&, CompactListList<T, Container>&); template<class T, class Container> Istream& operator>>
template<class T, class Container> Ostream& operator<<(Ostream&, const CompactListList<T, Container>&); (
Istream&,
CompactListList<T, Container>&
);
template<class T, class Container> Ostream& operator<<
(
Ostream&,
const CompactListList<T, Container>&
);
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\

View File

@ -52,20 +52,11 @@ Foam::tmp
typename Foam::GeometricField<Type, PatchField, GeoMesh>:: typename Foam::GeometricField<Type, PatchField, GeoMesh>::
GeometricBoundaryField GeometricBoundaryField
> >
Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is) Foam::GeometricField<Type, PatchField, GeoMesh>::readField
(
const dictionary& fieldDict
)
{ {
if (is.version() < 2.0)
{
FatalIOErrorIn
(
"GeometricField<Type, PatchField, GeoMesh>::readField(Istream&)",
is
) << "IO versions < 2.0 are not supported."
<< exit(FatalIOError);
}
dictionary fieldDict(is);
DimensionedField<Type, GeoMesh>::readField(fieldDict, "internalField"); DimensionedField<Type, GeoMesh>::readField(fieldDict, "internalField");
tmp<GeometricBoundaryField> tboundaryField tmp<GeometricBoundaryField> tboundaryField
@ -96,6 +87,28 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
} }
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::tmp
<
typename Foam::GeometricField<Type, PatchField, GeoMesh>::
GeometricBoundaryField
>
Foam::GeometricField<Type, PatchField, GeoMesh>::readField(Istream& is)
{
if (is.version() < 2.0)
{
FatalIOErrorIn
(
"GeometricField<Type, PatchField, GeoMesh>::readField(Istream&)",
is
) << "IO versions < 2.0 are not supported."
<< exit(FatalIOError);
}
return readField(dictionary(is));
}
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
bool Foam::GeometricField<Type, PatchField, GeoMesh>::readIfPresent() bool Foam::GeometricField<Type, PatchField, GeoMesh>::readIfPresent()
{ {
@ -404,6 +417,44 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
} }
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
const Mesh& mesh,
const dictionary& dict
)
:
DimensionedField<Type, GeoMesh>(io, mesh, dimless),
timeIndex_(this->time().timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
boundaryField_(*this, readField(dict))
{
// Check compatibility between field and mesh
if (this->size() != GeoMesh::size(this->mesh()))
{
FatalErrorIn
(
"GeometricField<Type, PatchField, GeoMesh>::GeometricField"
"(const IOobject&, const Mesh&, const dictionary&)"
) << " number of field elements = " << this->size()
<< " number of mesh elements = " << GeoMesh::size(this->mesh())
<< exit(FatalIOError);
}
readOldTimeIfPresent();
if (debug)
{
Info<< "Finishing dictionary-construct of "
"GeometricField<Type, PatchField, GeoMesh>"
<< endl << this->info() << endl;
}
}
// construct as copy // construct as copy
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField

View File

@ -240,6 +240,9 @@ private:
// Private member functions // Private member functions
//- Read the field from the dictionary
tmp<GeometricBoundaryField> readField(const dictionary&);
//- Read the field from the given stream //- Read the field from the given stream
tmp<GeometricBoundaryField> readField(Istream& is); tmp<GeometricBoundaryField> readField(Istream& is);
@ -327,6 +330,14 @@ public:
Istream& Istream&
); );
//- Construct from dictionary
GeometricField
(
const IOobject&,
const Mesh&,
const dictionary&
);
//- Construct as copy //- Construct as copy
GeometricField GeometricField
( (

View File

@ -66,6 +66,14 @@ Foam::UIPstream::UIPstream
label wantedSize = externalBuf_.capacity(); label wantedSize = externalBuf_.capacity();
if (debug)
{
Pout<< "UIPstream::UIPstream : read from:" << fromProcNo
<< " tag:" << tag << " wanted size:" << wantedSize
<< Foam::endl;
}
// If the buffer size is not specified, probe the incomming message // If the buffer size is not specified, probe the incomming message
// and set it // and set it
if (!wantedSize) if (!wantedSize)
@ -75,6 +83,12 @@ Foam::UIPstream::UIPstream
externalBuf_.setCapacity(messageSize_); externalBuf_.setCapacity(messageSize_);
wantedSize = messageSize_; wantedSize = messageSize_;
if (debug)
{
Pout<< "UIPstream::UIPstream : probed size:" << wantedSize
<< Foam::endl;
}
} }
messageSize_ = UIPstream::read messageSize_ = UIPstream::read
@ -127,6 +141,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
if (commsType() == UPstream::nonBlocking) if (commsType() == UPstream::nonBlocking)
{ {
// Message is already received into externalBuf // Message is already received into externalBuf
messageSize_ = buffers.recvBuf_[fromProcNo].size();
} }
else else
{ {
@ -134,6 +149,14 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
label wantedSize = externalBuf_.capacity(); label wantedSize = externalBuf_.capacity();
if (debug)
{
Pout<< "UIPstream::UIPstream PstreamBuffers :"
<< " read from:" << fromProcNo
<< " tag:" << tag_ << " wanted size:" << wantedSize
<< Foam::endl;
}
// If the buffer size is not specified, probe the incomming message // If the buffer size is not specified, probe the incomming message
// and set it // and set it
if (!wantedSize) if (!wantedSize)
@ -143,6 +166,12 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
externalBuf_.setCapacity(messageSize_); externalBuf_.setCapacity(messageSize_);
wantedSize = messageSize_; wantedSize = messageSize_;
if (debug)
{
Pout<< "UIPstream::UIPstream PstreamBuffers : probed size:"
<< wantedSize << Foam::endl;
}
} }
messageSize_ = UIPstream::read messageSize_ = UIPstream::read
@ -180,6 +209,14 @@ Foam::label Foam::UIPstream::read
const int tag const int tag
) )
{ {
if (debug)
{
Pout<< "UIPstream::read : starting read from:" << fromProcNo
<< " tag:" << tag << " wanted size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
if (commsType == blocking || commsType == scheduled) if (commsType == blocking || commsType == scheduled)
{ {
MPI_Status status; MPI_Status status;
@ -214,6 +251,14 @@ Foam::label Foam::UIPstream::read
label messageSize; label messageSize;
MPI_Get_count(&status, MPI_BYTE, &messageSize); MPI_Get_count(&status, MPI_BYTE, &messageSize);
if (debug)
{
Pout<< "UIPstream::read : finished read from:" << fromProcNo
<< " tag:" << tag << " read size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
if (messageSize > bufSize) if (messageSize > bufSize)
{ {
FatalErrorIn FatalErrorIn
@ -256,6 +301,15 @@ Foam::label Foam::UIPstream::read
return 0; return 0;
} }
if (debug)
{
Pout<< "UIPstream::read : started read from:" << fromProcNo
<< " tag:" << tag << " read size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size()
<< Foam::endl;
}
PstreamGlobals::outstandingRequests_.append(request); PstreamGlobals::outstandingRequests_.append(request);
// Assume the message is completely received. // Assume the message is completely received.
@ -267,7 +321,8 @@ Foam::label Foam::UIPstream::read
( (
"UIPstream::read" "UIPstream::read"
"(const int fromProcNo, char* buf, std::streamsize bufSize)" "(const int fromProcNo, char* buf, std::streamsize bufSize)"
) << "Unsupported communications type " << commsType ) << "Unsupported communications type "
<< commsType
<< Foam::abort(FatalError); << Foam::abort(FatalError);
return 0; return 0;

View File

@ -43,6 +43,14 @@ bool Foam::UOPstream::write
const int tag const int tag
) )
{ {
if (debug)
{
Pout<< "UIPstream::write : starting write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
bool transferFailed = true; bool transferFailed = true;
if (commsType == blocking) if (commsType == blocking)
@ -56,6 +64,14 @@ bool Foam::UOPstream::write
tag, tag,
MPI_COMM_WORLD MPI_COMM_WORLD
); );
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
} }
else if (commsType == scheduled) else if (commsType == scheduled)
{ {
@ -68,6 +84,14 @@ bool Foam::UOPstream::write
tag, tag,
MPI_COMM_WORLD MPI_COMM_WORLD
); );
if (debug)
{
Pout<< "UIPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl;
}
} }
else if (commsType == nonBlocking) else if (commsType == nonBlocking)
{ {
@ -84,6 +108,15 @@ bool Foam::UOPstream::write
&request &request
); );
if (debug)
{
Pout<< "UIPstream::write : started write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size()
<< Foam::endl;
}
PstreamGlobals::outstandingRequests_.append(request); PstreamGlobals::outstandingRequests_.append(request);
} }
else else
@ -93,7 +126,8 @@ bool Foam::UOPstream::write
"UOPstream::write" "UOPstream::write"
"(const int fromProcNo, char* buf, std::streamsize bufSize" "(const int fromProcNo, char* buf, std::streamsize bufSize"
", const int)" ", const int)"
) << "Unsupported communications type " << commsType ) << "Unsupported communications type "
<< UPstream::commsTypeNames[commsType]
<< Foam::abort(FatalError); << Foam::abort(FatalError);
} }

View File

@ -70,6 +70,12 @@ bool Foam::UPstream::init(int& argc, char**& argv)
MPI_Comm_size(MPI_COMM_WORLD, &numprocs); MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myProcNo_); MPI_Comm_rank(MPI_COMM_WORLD, &myProcNo_);
if (debug)
{
Pout<< "UPstream::init : initialised with numProcs:" << numprocs
<< " myProcNo:" << myProcNo_ << endl;
}
if (numprocs <= 1) if (numprocs <= 1)
{ {
FatalErrorIn("UPstream::init(int& argc, char**& argv)") FatalErrorIn("UPstream::init(int& argc, char**& argv)")
@ -124,6 +130,11 @@ bool Foam::UPstream::init(int& argc, char**& argv)
void Foam::UPstream::exit(int errnum) void Foam::UPstream::exit(int errnum)
{ {
if (debug)
{
Pout<< "UPstream::exit." << endl;
}
# ifndef SGIMPI # ifndef SGIMPI
int size; int size;
char* buff; char* buff;
@ -164,6 +175,11 @@ void Foam::UPstream::abort()
void Foam::reduce(scalar& Value, const sumOp<scalar>& bop) void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
{ {
if (Pstream::debug)
{
Pout<< "UPstream::reduce : value:" << Value << endl;
}
if (!UPstream::parRun()) if (!UPstream::parRun())
{ {
return; return;
@ -433,11 +449,23 @@ void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
} }
*/ */
} }
if (Pstream::debug)
{
Pout<< "UPstream::reduce : reduced value:" << Value << endl;
}
} }
void Foam::UPstream::waitRequests() void Foam::UPstream::waitRequests()
{ {
if (debug)
{
Pout<< "UPstream::waitRequests : starting wait for "
<< PstreamGlobals::outstandingRequests_.size()
<< " outstanding requests." << endl;
}
if (PstreamGlobals::outstandingRequests_.size()) if (PstreamGlobals::outstandingRequests_.size())
{ {
if if
@ -458,11 +486,22 @@ void Foam::UPstream::waitRequests()
PstreamGlobals::outstandingRequests_.clear(); PstreamGlobals::outstandingRequests_.clear();
} }
if (debug)
{
Pout<< "UPstream::waitRequests : finished wait." << endl;
}
} }
bool Foam::UPstream::finishedRequest(const label i) bool Foam::UPstream::finishedRequest(const label i)
{ {
if (debug)
{
Pout<< "UPstream::waitRequests : starting wait for request:" << i
<< endl;
}
if (i >= PstreamGlobals::outstandingRequests_.size()) if (i >= PstreamGlobals::outstandingRequests_.size())
{ {
FatalErrorIn FatalErrorIn
@ -483,6 +522,12 @@ bool Foam::UPstream::finishedRequest(const label i)
MPI_STATUS_IGNORE MPI_STATUS_IGNORE
); );
if (debug)
{
Pout<< "UPstream::waitRequests : finished wait for request:" << i
<< endl;
}
return flag != 0; return flag != 0;
} }

View File

@ -330,8 +330,6 @@ void Foam::fvMeshAdder::MapVolFields
if (fieldsToAdd.found(fld.name())) if (fieldsToAdd.found(fld.name()))
{ {
Pout<< "Mapping field " << fld.name() << endl;
const GeometricField<Type, fvPatchField, volMesh>& fldToAdd = const GeometricField<Type, fvPatchField, volMesh>& fldToAdd =
*fieldsToAdd[fld.name()]; *fieldsToAdd[fld.name()];
@ -339,7 +337,7 @@ void Foam::fvMeshAdder::MapVolFields
} }
else else
{ {
WarningIn("fvMeshAdder::MapVolFields") WarningIn("fvMeshAdder::MapVolFields(..)")
<< "Not mapping field " << fld.name() << "Not mapping field " << fld.name()
<< " since not present on mesh to add" << " since not present on mesh to add"
<< endl; << endl;
@ -642,15 +640,13 @@ void Foam::fvMeshAdder::MapSurfaceFields
if (fieldsToAdd.found(fld.name())) if (fieldsToAdd.found(fld.name()))
{ {
Pout<< "Mapping field " << fld.name() << endl;
const fldType& fldToAdd = *fieldsToAdd[fld.name()]; const fldType& fldToAdd = *fieldsToAdd[fld.name()];
MapSurfaceField<Type>(meshMap, fld, fldToAdd); MapSurfaceField<Type>(meshMap, fld, fldToAdd);
} }
else else
{ {
WarningIn("fvMeshAdder::MapSurfaceFields") WarningIn("fvMeshAdder::MapSurfaceFields(..)")
<< "Not mapping field " << fld.name() << "Not mapping field " << fld.name()
<< " since not present on mesh to add" << " since not present on mesh to add"
<< endl; << endl;

View File

@ -25,8 +25,6 @@ License
\*----------------------------------------------------------------------------*/ \*----------------------------------------------------------------------------*/
#include "fvMeshDistribute.H" #include "fvMeshDistribute.H"
#include "ProcessorTopology.H"
#include "commSchedule.H"
#include "PstreamCombineReduceOps.H" #include "PstreamCombineReduceOps.H"
#include "fvMeshAdder.H" #include "fvMeshAdder.H"
#include "faceCoupleInfo.H" #include "faceCoupleInfo.H"
@ -39,6 +37,8 @@ License
#include "mergePoints.H" #include "mergePoints.H"
#include "mapDistributePolyMesh.H" #include "mapDistributePolyMesh.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "syncTools.H"
#include "CompactListList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -47,71 +47,6 @@ defineTypeNameAndDebug(Foam::fvMeshDistribute, 0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
//Foam::List<Foam::labelPair> Foam::fvMeshDistribute::getSchedule
//(
// const labelList& distribution
//)
//{
// labelList nCellsPerProc(countCells(distribution));
//
// if (debug)
// {
// Pout<< "getSchedule : Wanted distribution:" << nCellsPerProc << endl;
// }
//
// // Processors I need to send data to
// labelListList mySendProcs(Pstream::nProcs());
//
// // Count
// label nSendProcs = 0;
// forAll(nCellsPerProc, sendProcI)
// {
// if (sendProcI != Pstream::myProcNo() && nCellsPerProc[sendProcI] > 0)
// {
// nSendProcs++;
// }
// }
//
// // Fill
// mySendProcs[Pstream::myProcNo()].setSize(nSendProcs);
// nSendProcs = 0;
// forAll(nCellsPerProc, sendProcI)
// {
// if (sendProcI != Pstream::myProcNo() && nCellsPerProc[sendProcI] > 0)
// {
// mySendProcs[Pstream::myProcNo()][nSendProcs++] = sendProcI;
// }
// }
//
// // Synchronise
// Pstream::gatherList(mySendProcs);
// Pstream::scatterList(mySendProcs);
//
// // Combine into list (same on all procs) giving sending and receiving
// // processor
// label nComms = 0;
// forAll(mySendProcs, procI)
// {
// nComms += mySendProcs[procI].size();
// }
//
// List<labelPair> schedule(nComms);
// nComms = 0;
//
// forAll(mySendProcs, procI)
// {
// const labelList& sendProcs = mySendProcs[procI];
//
// forAll(sendProcs, i)
// {
// schedule[nComms++] = labelPair(procI, sendProcs[i]);
// }
// }
//
// return schedule;
//}
Foam::labelList Foam::fvMeshDistribute::select Foam::labelList Foam::fvMeshDistribute::select
( (
const bool selectEqual, const bool selectEqual,
@ -144,14 +79,29 @@ Foam::labelList Foam::fvMeshDistribute::select
// Check all procs have same names and in exactly same order. // Check all procs have same names and in exactly same order.
void Foam::fvMeshDistribute::checkEqualWordList(const wordList& lst) void Foam::fvMeshDistribute::checkEqualWordList
(
const string& msg,
const wordList& lst
)
{ {
wordList myObjects(lst); List<wordList> allNames(Pstream::nProcs());
allNames[Pstream::myProcNo()] = lst;
Pstream::gatherList(allNames);
Pstream::scatterList(allNames);
// Check that all meshes have same objects for (label procI = 1; procI < Pstream::nProcs(); procI++)
Pstream::listCombineGather(myObjects, checkEqualType()); {
// Below scatter only needed to balance sends and receives. if (allNames[procI] != allNames[0])
Pstream::listCombineScatter(myObjects); {
FatalErrorIn("fvMeshDistribute::checkEqualWordList(..)")
<< "When checking for equal " << msg.c_str() << " :" << endl
<< "processor0 has:" << allNames[0] << endl
<< "processor" << procI << " has:" << allNames[procI] << endl
<< msg.c_str() << " need to be synchronised on all processors."
<< exit(FatalError);
}
}
} }
@ -664,21 +614,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::mergeSharedPoints
<< " newPointI:" << newPointI << abort(FatalError); << " newPointI:" << newPointI << abort(FatalError);
} }
} }
//- old: use pointToMaster map.
//forAll(constructMap, i)
//{
// label oldPointI = constructMap[i];
//
// // See if merged into other point
// Map<label>::const_iterator iter = pointToMaster.find(oldPointI);
//
// if (iter != pointToMaster.end())
// {
// oldPointI = iter();
// }
//
// constructMap[i] = map().reversePointMap()[oldPointI];
//}
} }
return map; return map;
} }
@ -693,46 +628,49 @@ void Foam::fvMeshDistribute::getNeighbourData
labelList& sourceNewProc labelList& sourceNewProc
) const ) const
{ {
sourceFace.setSize(mesh_.nFaces() - mesh_.nInternalFaces()); label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
sourceProc.setSize(sourceFace.size()); sourceFace.setSize(nBnd);
sourceNewProc.setSize(sourceFace.size()); sourceProc.setSize(nBnd);
sourceNewProc.setSize(nBnd);
const polyBoundaryMesh& patches = mesh_.boundaryMesh(); const polyBoundaryMesh& patches = mesh_.boundaryMesh();
// Send meshFace labels of processor patches and destination processor. // Get neighbouring meshFace labels and new processor of coupled boundaries.
labelList nbrFaces(nBnd, -1);
labelList nbrNewProc(nBnd, -1);
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
if (isA<processorPolyPatch>(pp)) if (isA<processorPolyPatch>(pp))
{ {
const processorPolyPatch& procPatch = label offset = pp.start() - mesh_.nInternalFaces();
refCast<const processorPolyPatch>(pp);
// Labels of faces on this side // Mesh labels of faces on this side
labelList meshFaceLabels(pp.size()); forAll(pp, i)
forAll(meshFaceLabels, i)
{ {
meshFaceLabels[i] = pp.start()+i; label bndI = offset + i;
nbrFaces[bndI] = pp.start()+i;
} }
// Which processor they will end up on // Which processor they will end up on
const labelList newProc SubList<label>(nbrNewProc, pp.size(), offset).assign
( (
UIndirectList<label>(distribution, pp.faceCells()) UIndirectList<label>(distribution, pp.faceCells())()
); );
OPstream toNeighbour(Pstream::blocking, procPatch.neighbProcNo());
toNeighbour << meshFaceLabels << newProc;
} }
} }
// Receive meshFace labels and destination processors of processor faces.
// Exchange the boundary data
syncTools::swapBoundaryFaceList(mesh_, nbrFaces, false);
syncTools::swapBoundaryFaceList(mesh_, nbrNewProc, false);
forAll(patches, patchI) forAll(patches, patchI)
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
label offset = pp.start() - mesh_.nInternalFaces(); label offset = pp.start() - mesh_.nInternalFaces();
if (isA<processorPolyPatch>(pp)) if (isA<processorPolyPatch>(pp))
@ -740,11 +678,6 @@ void Foam::fvMeshDistribute::getNeighbourData
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp); refCast<const processorPolyPatch>(pp);
// Receive the data
IPstream fromNeighbour(Pstream::blocking, procPatch.neighbProcNo());
labelList nbrFaces(fromNeighbour);
labelList nbrNewProc(fromNeighbour);
// Check which of the two faces we store. // Check which of the two faces we store.
if (Pstream::myProcNo() < procPatch.neighbProcNo()) if (Pstream::myProcNo() < procPatch.neighbProcNo())
@ -752,9 +685,10 @@ void Foam::fvMeshDistribute::getNeighbourData
// Use my local face labels // Use my local face labels
forAll(pp, i) forAll(pp, i)
{ {
sourceFace[offset + i] = pp.start()+i; label bndI = offset + i;
sourceProc[offset + i] = Pstream::myProcNo(); sourceFace[bndI] = pp.start()+i;
sourceNewProc[offset + i] = nbrNewProc[i]; sourceProc[bndI] = Pstream::myProcNo();
sourceNewProc[bndI] = nbrNewProc[bndI];
} }
} }
else else
@ -762,9 +696,10 @@ void Foam::fvMeshDistribute::getNeighbourData
// Use my neighbours face labels // Use my neighbours face labels
forAll(pp, i) forAll(pp, i)
{ {
sourceFace[offset + i] = nbrFaces[i]; label bndI = offset + i;
sourceProc[offset + i] = procPatch.neighbProcNo(); sourceFace[bndI] = nbrFaces[bndI];
sourceNewProc[offset + i] = nbrNewProc[i]; sourceProc[bndI] = procPatch.neighbProcNo();
sourceNewProc[bndI] = nbrNewProc[bndI];
} }
} }
} }
@ -773,9 +708,10 @@ void Foam::fvMeshDistribute::getNeighbourData
// Normal (physical) boundary // Normal (physical) boundary
forAll(pp, i) forAll(pp, i)
{ {
sourceFace[offset + i] = patchI; label bndI = offset + i;
sourceProc[offset + i] = -1; sourceFace[bndI] = patchI;
sourceNewProc[offset + i] = -1; sourceProc[bndI] = -1;
sourceNewProc[bndI] = -1;
} }
} }
} }
@ -1120,7 +1056,8 @@ void Foam::fvMeshDistribute::sendMesh
const labelList& sourceFace, const labelList& sourceFace,
const labelList& sourceProc, const labelList& sourceProc,
const labelList& sourceNewProc const labelList& sourceNewProc,
UOPstream& toDomain
) )
{ {
if (debug) if (debug)
@ -1133,52 +1070,95 @@ void Foam::fvMeshDistribute::sendMesh
<< endl; << endl;
} }
// Assume sparse point zones. Get contents in merged-zone indices. // Assume sparse, possibly overlapping point zones. Get contents
labelListList zonePoints(pointZoneNames.size()); // in merged-zone indices.
CompactListList<label> zonePoints;
{ {
const pointZoneMesh& pointZones = mesh.pointZones(); const pointZoneMesh& pointZones = mesh.pointZones();
labelList rowSizes(pointZoneNames.size(), 0);
forAll(pointZoneNames, nameI) forAll(pointZoneNames, nameI)
{ {
label myZoneID = pointZones.findZoneID(pointZoneNames[nameI]); label myZoneID = pointZones.findZoneID(pointZoneNames[nameI]);
if (myZoneID != -1) if (myZoneID != -1)
{ {
zonePoints[nameI] = pointZones[myZoneID]; rowSizes[nameI] = pointZones[myZoneID].size();
}
}
zonePoints.setSize(rowSizes);
forAll(pointZoneNames, nameI)
{
label myZoneID = pointZones.findZoneID(pointZoneNames[nameI]);
if (myZoneID != -1)
{
zonePoints[nameI].assign(pointZones[myZoneID]);
} }
} }
} }
// Assume sparse face zones // Assume sparse, possibly overlapping face zones
labelListList zoneFaces(faceZoneNames.size()); CompactListList<label> zoneFaces;
boolListList zoneFaceFlip(faceZoneNames.size()); CompactListList<bool> zoneFaceFlip;
{ {
const faceZoneMesh& faceZones = mesh.faceZones(); const faceZoneMesh& faceZones = mesh.faceZones();
labelList rowSizes(faceZoneNames.size(), 0);
forAll(faceZoneNames, nameI) forAll(faceZoneNames, nameI)
{ {
label myZoneID = faceZones.findZoneID(faceZoneNames[nameI]); label myZoneID = faceZones.findZoneID(faceZoneNames[nameI]);
if (myZoneID != -1) if (myZoneID != -1)
{ {
zoneFaces[nameI] = faceZones[myZoneID]; rowSizes[nameI] = faceZones[myZoneID].size();
zoneFaceFlip[nameI] = faceZones[myZoneID].flipMap(); }
}
zoneFaces.setSize(rowSizes);
zoneFaceFlip.setSize(rowSizes);
forAll(faceZoneNames, nameI)
{
label myZoneID = faceZones.findZoneID(faceZoneNames[nameI]);
if (myZoneID != -1)
{
zoneFaces[nameI].assign(faceZones[myZoneID]);
zoneFaceFlip[nameI].assign(faceZones[myZoneID].flipMap());
} }
} }
} }
// Assume sparse cell zones // Assume sparse, possibly overlapping cell zones
labelListList zoneCells(cellZoneNames.size()); CompactListList<label> zoneCells;
{ {
const cellZoneMesh& cellZones = mesh.cellZones(); const cellZoneMesh& cellZones = mesh.cellZones();
labelList rowSizes(pointZoneNames.size(), 0);
forAll(cellZoneNames, nameI) forAll(cellZoneNames, nameI)
{ {
label myZoneID = cellZones.findZoneID(cellZoneNames[nameI]); label myZoneID = cellZones.findZoneID(cellZoneNames[nameI]);
if (myZoneID != -1) if (myZoneID != -1)
{ {
zoneCells[nameI] = cellZones[myZoneID]; rowSizes[nameI] = cellZones[myZoneID].size();
}
}
zoneCells.setSize(rowSizes);
forAll(cellZoneNames, nameI)
{
label myZoneID = cellZones.findZoneID(cellZoneNames[nameI]);
if (myZoneID != -1)
{
zoneCells[nameI].assign(cellZones[myZoneID]);
} }
} }
} }
@ -1198,10 +1178,9 @@ void Foam::fvMeshDistribute::sendMesh
//} //}
// Send // Send
OPstream toDomain(Pstream::blocking, domain);
toDomain toDomain
<< mesh.points() << mesh.points()
<< mesh.faces() << CompactListList<label, face>(mesh.faces())
<< mesh.faceOwner() << mesh.faceOwner()
<< mesh.faceNeighbour() << mesh.faceNeighbour()
<< mesh.boundaryMesh() << mesh.boundaryMesh()
@ -1214,6 +1193,13 @@ void Foam::fvMeshDistribute::sendMesh
<< sourceFace << sourceFace
<< sourceProc << sourceProc
<< sourceNewProc; << sourceNewProc;
if (debug)
{
Pout<< "Started sending mesh to domain " << domain
<< endl;
}
} }
@ -1227,21 +1213,20 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
const Time& runTime, const Time& runTime,
labelList& domainSourceFace, labelList& domainSourceFace,
labelList& domainSourceProc, labelList& domainSourceProc,
labelList& domainSourceNewProc labelList& domainSourceNewProc,
UIPstream& fromNbr
) )
{ {
IPstream fromNbr(Pstream::blocking, domain);
pointField domainPoints(fromNbr); pointField domainPoints(fromNbr);
faceList domainFaces(fromNbr); faceList domainFaces = CompactListList<label, face>(fromNbr)();
labelList domainAllOwner(fromNbr); labelList domainAllOwner(fromNbr);
labelList domainAllNeighbour(fromNbr); labelList domainAllNeighbour(fromNbr);
PtrList<entry> patchEntries(fromNbr); PtrList<entry> patchEntries(fromNbr);
labelListList zonePoints(fromNbr); CompactListList<label> zonePoints(fromNbr);
labelListList zoneFaces(fromNbr); CompactListList<label> zoneFaces(fromNbr);
boolListList zoneFaceFlip(fromNbr); CompactListList<bool> zoneFaceFlip(fromNbr);
labelListList zoneCells(fromNbr); CompactListList<label> zoneCells(fromNbr);
fromNbr fromNbr
>> domainSourceFace >> domainSourceFace
@ -1442,6 +1427,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
const wordList cellZoneNames(mergeWordList(mesh_.cellZones().names())); const wordList cellZoneNames(mergeWordList(mesh_.cellZones().names()));
// Local environment of all boundary faces // Local environment of all boundary faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1481,36 +1467,39 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
mesh_.clearOut(); mesh_.clearOut();
mesh_.resetMotion(); mesh_.resetMotion();
// Get data to send. Make sure is synchronised
const wordList volScalars(mesh_.names(volScalarField::typeName)); const wordList volScalars(mesh_.names(volScalarField::typeName));
checkEqualWordList(volScalars); checkEqualWordList("volScalarFields", volScalars);
const wordList volVectors(mesh_.names(volVectorField::typeName)); const wordList volVectors(mesh_.names(volVectorField::typeName));
checkEqualWordList(volVectors); checkEqualWordList("volVectorFields", volVectors);
const wordList volSphereTensors const wordList volSphereTensors
( (
mesh_.names(volSphericalTensorField::typeName) mesh_.names(volSphericalTensorField::typeName)
); );
checkEqualWordList(volSphereTensors); checkEqualWordList("volSphericalTensorFields", volSphereTensors);
const wordList volSymmTensors(mesh_.names(volSymmTensorField::typeName)); const wordList volSymmTensors(mesh_.names(volSymmTensorField::typeName));
checkEqualWordList(volSymmTensors); checkEqualWordList("volSymmTensorFields", volSymmTensors);
const wordList volTensors(mesh_.names(volTensorField::typeName)); const wordList volTensors(mesh_.names(volTensorField::typeName));
checkEqualWordList(volTensors); checkEqualWordList("volTensorField", volTensors);
const wordList surfScalars(mesh_.names(surfaceScalarField::typeName)); const wordList surfScalars(mesh_.names(surfaceScalarField::typeName));
checkEqualWordList(surfScalars); checkEqualWordList("surfaceScalarFields", surfScalars);
const wordList surfVectors(mesh_.names(surfaceVectorField::typeName)); const wordList surfVectors(mesh_.names(surfaceVectorField::typeName));
checkEqualWordList(surfVectors); checkEqualWordList("surfaceVectorFields", surfVectors);
const wordList surfSphereTensors const wordList surfSphereTensors
( (
mesh_.names(surfaceSphericalTensorField::typeName) mesh_.names(surfaceSphericalTensorField::typeName)
); );
checkEqualWordList(surfSphereTensors); checkEqualWordList("surfaceSphericalTensorFields", surfSphereTensors);
const wordList surfSymmTensors const wordList surfSymmTensors
( (
mesh_.names(surfaceSymmTensorField::typeName) mesh_.names(surfaceSymmTensorField::typeName)
); );
checkEqualWordList(surfSymmTensors); checkEqualWordList("surfaceSymmTensorFields", surfSymmTensors);
const wordList surfTensors(mesh_.names(surfaceTensorField::typeName)); const wordList surfTensors(mesh_.names(surfaceTensorField::typeName));
checkEqualWordList(surfTensors); checkEqualWordList("surfaceTensorFields", surfTensors);
// Find patch to temporarily put exposed and processor faces into. // Find patch to temporarily put exposed and processor faces into.
@ -1589,6 +1578,9 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
Pstream::scatterList(nSendCells); Pstream::scatterList(nSendCells);
// Allocate buffers
PstreamBuffers pBufs(Pstream::nonBlocking);
// What to send to neighbouring domains // What to send to neighbouring domains
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1612,6 +1604,10 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
<< nl << endl; << nl << endl;
} }
// Pstream for sending mesh and fields
//OPstream str(Pstream::blocking, recvProc);
UOPstream str(recvProc, pBufs);
// Mesh subsetting engine // Mesh subsetting engine
fvMeshSubset subsetter(mesh_); fvMeshSubset subsetter(mesh_);
@ -1659,6 +1655,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
procSourceNewProc procSourceNewProc
); );
// Send to neighbour // Send to neighbour
sendMesh sendMesh
( (
@ -1671,43 +1669,69 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
procSourceFace, procSourceFace,
procSourceProc, procSourceProc,
procSourceNewProc procSourceNewProc,
str
); );
sendFields<volScalarField>(recvProc, volScalars, subsetter); sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
sendFields<volVectorField>(recvProc, volVectors, subsetter); sendFields<volVectorField>(recvProc, volVectors, subsetter, str);
sendFields<volSphericalTensorField> sendFields<volSphericalTensorField>
( (
recvProc, recvProc,
volSphereTensors, volSphereTensors,
subsetter subsetter,
str
); );
sendFields<volSymmTensorField> sendFields<volSymmTensorField>
( (
recvProc, recvProc,
volSymmTensors, volSymmTensors,
subsetter subsetter,
str
); );
sendFields<volTensorField>(recvProc, volTensors, subsetter); sendFields<volTensorField>(recvProc, volTensors, subsetter, str);
sendFields<surfaceScalarField>(recvProc, surfScalars, subsetter); sendFields<surfaceScalarField>
sendFields<surfaceVectorField>(recvProc, surfVectors, subsetter); (
recvProc,
surfScalars,
subsetter,
str
);
sendFields<surfaceVectorField>
(
recvProc,
surfVectors,
subsetter,
str
);
sendFields<surfaceSphericalTensorField> sendFields<surfaceSphericalTensorField>
( (
recvProc, recvProc,
surfSphereTensors, surfSphereTensors,
subsetter subsetter,
str
); );
sendFields<surfaceSymmTensorField> sendFields<surfaceSymmTensorField>
( (
recvProc, recvProc,
surfSymmTensors, surfSymmTensors,
subsetter subsetter,
str
);
sendFields<surfaceTensorField>
(
recvProc,
surfTensors,
subsetter,
str
); );
sendFields<surfaceTensorField>(recvProc, surfTensors, subsetter);
} }
} }
// Start sending&receiving from buffers
pBufs.finishedSends();
// Subset the part that stays // Subset the part that stays
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1817,13 +1841,31 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
<< nl << endl; << nl << endl;
} }
// Pstream for receiving mesh and fields
UIPstream str(sendProc, pBufs);
// Receive from sendProc // Receive from sendProc
labelList domainSourceFace; labelList domainSourceFace;
labelList domainSourceProc; labelList domainSourceProc;
labelList domainSourceNewProc; labelList domainSourceNewProc;
autoPtr<fvMesh> domainMeshPtr;
PtrList<volScalarField> vsf;
PtrList<volVectorField> vvf;
PtrList<volSphericalTensorField> vsptf;
PtrList<volSymmTensorField> vsytf;
PtrList<volTensorField> vtf;
PtrList<surfaceScalarField> ssf;
PtrList<surfaceVectorField> svf;
PtrList<surfaceSphericalTensorField> ssptf;
PtrList<surfaceSymmTensorField> ssytf;
PtrList<surfaceTensorField> stf;
// Opposite of sendMesh // Opposite of sendMesh
autoPtr<fvMesh> domainMeshPtr = receiveMesh {
domainMeshPtr = receiveMesh
( (
sendProc, sendProc,
pointZoneNames, pointZoneNames,
@ -1833,93 +1875,98 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
const_cast<Time&>(mesh_.time()), const_cast<Time&>(mesh_.time()),
domainSourceFace, domainSourceFace,
domainSourceProc, domainSourceProc,
domainSourceNewProc domainSourceNewProc,
str
); );
fvMesh& domainMesh = domainMeshPtr(); fvMesh& domainMesh = domainMeshPtr();
// Receive fields // Receive fields. Read as single dictionary because
PtrList<volScalarField> vsf; // of problems reading consecutive fields from single stream.
dictionary fieldDicts(str);
receiveFields<volScalarField> receiveFields<volScalarField>
( (
sendProc, sendProc,
volScalars, volScalars,
domainMesh, domainMesh,
vsf vsf,
fieldDicts.subDict(volScalarField::typeName)
); );
PtrList<volVectorField> vvf;
receiveFields<volVectorField> receiveFields<volVectorField>
( (
sendProc, sendProc,
volVectors, volVectors,
domainMesh, domainMesh,
vvf vvf,
fieldDicts.subDict(volVectorField::typeName)
); );
PtrList<volSphericalTensorField> vsptf;
receiveFields<volSphericalTensorField> receiveFields<volSphericalTensorField>
( (
sendProc, sendProc,
volSphereTensors, volSphereTensors,
domainMesh, domainMesh,
vsptf vsptf,
fieldDicts.subDict(volSphericalTensorField::typeName)
); );
PtrList<volSymmTensorField> vsytf;
receiveFields<volSymmTensorField> receiveFields<volSymmTensorField>
( (
sendProc, sendProc,
volSymmTensors, volSymmTensors,
domainMesh, domainMesh,
vsytf vsytf,
fieldDicts.subDict(volSymmTensorField::typeName)
); );
PtrList<volTensorField> vtf;
receiveFields<volTensorField> receiveFields<volTensorField>
( (
sendProc, sendProc,
volTensors, volTensors,
domainMesh, domainMesh,
vtf vtf,
fieldDicts.subDict(volTensorField::typeName)
); );
PtrList<surfaceScalarField> ssf;
receiveFields<surfaceScalarField> receiveFields<surfaceScalarField>
( (
sendProc, sendProc,
surfScalars, surfScalars,
domainMesh, domainMesh,
ssf ssf,
fieldDicts.subDict(surfaceScalarField::typeName)
); );
PtrList<surfaceVectorField> svf;
receiveFields<surfaceVectorField> receiveFields<surfaceVectorField>
( (
sendProc, sendProc,
surfVectors, surfVectors,
domainMesh, domainMesh,
svf svf,
fieldDicts.subDict(surfaceVectorField::typeName)
); );
PtrList<surfaceSphericalTensorField> ssptf;
receiveFields<surfaceSphericalTensorField> receiveFields<surfaceSphericalTensorField>
( (
sendProc, sendProc,
surfSphereTensors, surfSphereTensors,
domainMesh, domainMesh,
ssptf ssptf,
fieldDicts.subDict(surfaceSphericalTensorField::typeName)
); );
PtrList<surfaceSymmTensorField> ssytf;
receiveFields<surfaceSymmTensorField> receiveFields<surfaceSymmTensorField>
( (
sendProc, sendProc,
surfSymmTensors, surfSymmTensors,
domainMesh, domainMesh,
ssytf ssytf,
fieldDicts.subDict(surfaceSymmTensorField::typeName)
); );
PtrList<surfaceTensorField> stf;
receiveFields<surfaceTensorField> receiveFields<surfaceTensorField>
( (
sendProc, sendProc,
surfTensors, surfTensors,
domainMesh, domainMesh,
stf stf,
fieldDicts.subDict(surfaceTensorField::typeName)
); );
}
const fvMesh& domainMesh = domainMeshPtr();
constructCellMap[sendProc] = identity(domainMesh.nCells()); constructCellMap[sendProc] = identity(domainMesh.nCells());

View File

@ -82,38 +82,8 @@ class fvMeshDistribute
const scalar mergeTol_; const scalar mergeTol_;
// Private classes
//- Check words are the same. Used in patch type checking of similarly
// named patches.
class checkEqualType
{
public:
void operator()(word& x, const word& y) const
{
if (x != y)
{
FatalErrorIn("checkEqualType()(word&, const word&) const")
<< "Patch type " << x << " possibly on processor "
<< Pstream::myProcNo()
<< " does not equal patch type " << y
<< " on some other processor." << nl
<< "Please check similarly named patches for"
<< " having exactly the same type."
<< abort(FatalError);
}
}
};
// Private Member Functions // Private Member Functions
//- Given distribution work out a communication schedule. Is list
// of pairs. First element of pair is send processor, second is
// receive processor.
//static List<labelPair> getSchedule(const labelList&);
//- Find indices with value //- Find indices with value
static labelList select static labelList select
( (
@ -123,7 +93,7 @@ class fvMeshDistribute
); );
//- Check all procs have same names and in exactly same order. //- Check all procs have same names and in exactly same order.
static void checkEqualWordList(const wordList&); static void checkEqualWordList(const string&, const wordList&);
//- Merge wordlists over all processors //- Merge wordlists over all processors
static wordList mergeWordList(const wordList&); static wordList mergeWordList(const wordList&);
@ -288,7 +258,8 @@ class fvMeshDistribute
const wordList& cellZoneNames, const wordList& cellZoneNames,
const labelList& sourceFace, const labelList& sourceFace,
const labelList& sourceProc, const labelList& sourceProc,
const labelList& sourceNewProc const labelList& sourceNewProc,
UOPstream& toDomain
); );
//- Send subset of fields //- Send subset of fields
template<class GeoField> template<class GeoField>
@ -296,7 +267,8 @@ class fvMeshDistribute
( (
const label domain, const label domain,
const wordList& fieldNames, const wordList& fieldNames,
const fvMeshSubset& const fvMeshSubset&,
UOPstream& toNbr
); );
//- Receive mesh. Opposite of sendMesh //- Receive mesh. Opposite of sendMesh
@ -309,7 +281,8 @@ class fvMeshDistribute
const Time& runTime, const Time& runTime,
labelList& domainSourceFace, labelList& domainSourceFace,
labelList& domainSourceProc, labelList& domainSourceProc,
labelList& domainSourceNewProc labelList& domainSourceNewProc,
UIPstream& fromNbr
); );
//- Receive fields. Opposite of sendFields //- Receive fields. Opposite of sendFields
@ -319,7 +292,8 @@ class fvMeshDistribute
const label domain, const label domain,
const wordList& fieldNames, const wordList& fieldNames,
fvMesh&, fvMesh&,
PtrList<GeoField>& PtrList<GeoField>&,
const dictionary& fieldDicts
); );
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct

View File

@ -184,7 +184,7 @@ void Foam::fvMeshDistribute::mapBoundaryFields
if (flds.size() != oldBflds.size()) if (flds.size() != oldBflds.size())
{ {
FatalErrorIn("fvMeshDistribute::mapBoundaryFields") << "problem" FatalErrorIn("fvMeshDistribute::mapBoundaryFields(..)") << "problem"
<< abort(FatalError); << abort(FatalError);
} }
@ -273,19 +273,40 @@ void Foam::fvMeshDistribute::initPatchFields
// Send fields. Note order supplied so we can receive in exactly the same order. // Send fields. Note order supplied so we can receive in exactly the same order.
// Note that field gets written as entry in dictionary so we
// can construct from subdictionary.
// (since otherwise the reading as-a-dictionary mixes up entries from
// consecutive fields)
// The dictionary constructed is:
// volScalarField
// {
// p {internalField ..; boundaryField ..;}
// k {internalField ..; boundaryField ..;}
// }
// volVectorField
// {
// U {internalField ... }
// }
// volVectorField {U {internalField ..; boundaryField ..;}}
//
template<class GeoField> template<class GeoField>
void Foam::fvMeshDistribute::sendFields void Foam::fvMeshDistribute::sendFields
( (
const label domain, const label domain,
const wordList& fieldNames, const wordList& fieldNames,
const fvMeshSubset& subsetter const fvMeshSubset& subsetter,
UOPstream& toNbr
) )
{ {
toNbr << GeoField::typeName << token::NL << token::BEGIN_BLOCK << token::NL;
forAll(fieldNames, i) forAll(fieldNames, i)
{ {
//Pout<< "Subsetting field " << fieldNames[i] if (debug)
// << " for domain:" << domain {
// << endl; Pout<< "Subsetting field " << fieldNames[i]
<< " for domain:" << domain << endl;
}
// Send all fieldNames. This has to be exactly the same set as is // Send all fieldNames. This has to be exactly the same set as is
// being received! // being received!
@ -294,10 +315,12 @@ void Foam::fvMeshDistribute::sendFields
tmp<GeoField> tsubfld = subsetter.interpolate(fld); tmp<GeoField> tsubfld = subsetter.interpolate(fld);
// Send toNbr
OPstream toNbr(Pstream::blocking, domain); << fieldNames[i] << token::NL << token::BEGIN_BLOCK
toNbr << tsubfld(); << tsubfld
<< token::NL << token::END_BLOCK << token::NL;
} }
toNbr << token::END_BLOCK << token::NL;
} }
@ -308,18 +331,25 @@ void Foam::fvMeshDistribute::receiveFields
const label domain, const label domain,
const wordList& fieldNames, const wordList& fieldNames,
fvMesh& mesh, fvMesh& mesh,
PtrList<GeoField>& fields PtrList<GeoField>& fields,
const dictionary& fieldDicts
) )
{ {
if (debug)
{
Pout<< "Receiving fields " << fieldNames
<< " from domain:" << domain << endl;
}
fields.setSize(fieldNames.size()); fields.setSize(fieldNames.size());
forAll(fieldNames, i) forAll(fieldNames, i)
{ {
//Pout<< "Receiving field " << fieldNames[i] if (debug)
// << " from domain:" << domain {
// << endl; Pout<< "Constructing field " << fieldNames[i]
<< " from domain:" << domain << endl;
IPstream fromNbr(Pstream::blocking, domain); }
fields.set fields.set
( (
@ -335,7 +365,7 @@ void Foam::fvMeshDistribute::receiveFields
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
fromNbr fieldDicts.subDict(fieldNames[i])
) )
); );
} }

View File

@ -154,7 +154,7 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
label sizeby2 = this->size()/2; label sizeby2 = this->size()/2;
const unallocLabelList& faceCells = this->cyclicPatch().faceCells(); const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
if (long(&psiInternal) == long(&this->internalField())) if (&psiInternal == &this->internalField())
{ {
tmp<Field<scalar> > tjf = jump(); tmp<Field<scalar> > tjf = jump();
const Field<scalar>& jf = tjf(); const Field<scalar>& jf = tjf();

View File

@ -0,0 +1,142 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "translatingWallVelocityFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
translatingWallVelocityFvPatchVectorField::
translatingWallVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
U_(vector::zero)
{}
translatingWallVelocityFvPatchVectorField::
translatingWallVelocityFvPatchVectorField
(
const translatingWallVelocityFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
U_(ptf.U_)
{}
translatingWallVelocityFvPatchVectorField::
translatingWallVelocityFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF),
U_(dict.lookup("U"))
{
// Evaluate the wall velocity
updateCoeffs();
}
translatingWallVelocityFvPatchVectorField::
translatingWallVelocityFvPatchVectorField
(
const translatingWallVelocityFvPatchVectorField& twvpvf
)
:
fixedValueFvPatchField<vector>(twvpvf),
U_(twvpvf.U_)
{}
translatingWallVelocityFvPatchVectorField::
translatingWallVelocityFvPatchVectorField
(
const translatingWallVelocityFvPatchVectorField& twvpvf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(twvpvf, iF),
U_(twvpvf.U_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void translatingWallVelocityFvPatchVectorField::updateCoeffs()
{
if (updated())
{
return;
}
// Remove the component of U normal to the wall in case the wall is not flat
vectorField n = patch().nf();
vectorField::operator=(U_ - n*(n & U_));
fixedValueFvPatchVectorField::updateCoeffs();
}
void translatingWallVelocityFvPatchVectorField::write(Ostream& os) const
{
fvPatchVectorField::write(os);
os.writeKeyword("U") << U_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchVectorField,
translatingWallVelocityFvPatchVectorField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::translatingWallVelocityFvPatchVectorField
Description
Foam::translatingWallVelocityFvPatchVectorField
SourceFiles
translatingWallVelocityFvPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef translatingWallVelocityFvPatchVectorField_H
#define translatingWallVelocityFvPatchVectorField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class translatingWallVelocityFvPatchField Declaration
\*---------------------------------------------------------------------------*/
class translatingWallVelocityFvPatchVectorField
:
public fixedValueFvPatchVectorField
{
// Private data
//- Origin of the rotation
vector U_;
public:
//- Runtime type information
TypeName("translatingWallVelocity");
// Constructors
//- Construct from patch and internal field
translatingWallVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
translatingWallVelocityFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given a
// translatingWallVelocityFvPatchVectorField onto a new patch
translatingWallVelocityFvPatchVectorField
(
const translatingWallVelocityFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
translatingWallVelocityFvPatchVectorField
(
const translatingWallVelocityFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new translatingWallVelocityFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
translatingWallVelocityFvPatchVectorField
(
const translatingWallVelocityFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
new translatingWallVelocityFvPatchVectorField(*this, iF)
);
}
// Member functions
// Access functions
//- Return the velocity
const vector& U() const
{
return U_;
}
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -146,6 +146,10 @@ void Foam::singleCellFvMesh::agglomerateMesh
// From new patch face back to agglomeration // From new patch face back to agglomeration
patchFaceMap_.setSize(oldPatches.size()); patchFaceMap_.setSize(oldPatches.size());
// From fine face to coarse face (or -1)
reverseFaceMap_.setSize(mesh.nFaces());
reverseFaceMap_.labelList::operator=(-1);
// Face counter // Face counter
coarseI = 0; coarseI = 0;

View File

@ -1858,7 +1858,7 @@ void Foam::meshRefinement::distribute(const mapDistributePolyMesh& map)
// Get local mesh bounding box. Single box for now. // Get local mesh bounding box. Single box for now.
List<treeBoundBox> meshBb(1); List<treeBoundBox> meshBb(1);
treeBoundBox& bb = meshBb[0]; treeBoundBox& bb = meshBb[0];
bb = boundBox(mesh_.points(), false); bb = treeBoundBox(mesh_.points());
bb = bb.extend(rndGen, 1E-4); bb = bb.extend(rndGen, 1E-4);
// Distribute all geometry (so refinementSurfaces and shellSurfaces) // Distribute all geometry (so refinementSurfaces and shellSurfaces)

View File

@ -276,7 +276,7 @@ bool Foam::treeDataTriSurface::overlaps
const point& p1 = points[f[1]]; const point& p1 = points[f[1]];
const point& p2 = points[f[2]]; const point& p2 = points[f[2]];
boundBox triBb(p0, p0); treeBoundBox triBb(p0, p0);
triBb.min() = min(triBb.min(), p1); triBb.min() = min(triBb.min(), p1);
triBb.min() = min(triBb.min(), p2); triBb.min() = min(triBb.min(), p2);

View File

@ -69,7 +69,7 @@ public:
// Constructors // Constructors
//- Construct from components. Holds reference to points! //- Construct from components. Holds reference to points!
octreeDataPoint(const pointField&); explicit octreeDataPoint(const pointField&);
// Member Functions // Member Functions

View File

@ -170,11 +170,11 @@ public:
inline treeBoundBox(const point& min, const point& max); inline treeBoundBox(const point& min, const point& max);
//- Construct from components //- Construct from components
inline treeBoundBox(const boundBox& bb); explicit inline treeBoundBox(const boundBox& bb);
//- Construct as the bounding box of the given pointField. //- Construct as the bounding box of the given pointField.
// Local processor domain only (no reduce as in boundBox) // Local processor domain only (no reduce as in boundBox)
treeBoundBox(const UList<point>&); explicit treeBoundBox(const UList<point>&);
//- Construct as subset of points //- Construct as subset of points
// Local processor domain only (no reduce as in boundBox) // Local processor domain only (no reduce as in boundBox)

View File

@ -957,7 +957,7 @@ bool Foam::distributedTriSurfaceMesh::overlaps
{ {
const treeBoundBox& bb = bbs[bbI]; const treeBoundBox& bb = bbs[bbI];
boundBox triBb(p0, p0); treeBoundBox triBb(p0, p0);
triBb.min() = min(triBb.min(), p1); triBb.min() = min(triBb.min(), p1);
triBb.min() = min(triBb.min(), p2); triBb.min() = min(triBb.min(), p2);

View File

@ -757,9 +757,13 @@ Foam::Map<Foam::label> Foam::surfaceFeatures::nearestSamples
) const ) const
{ {
// Build tree out of all samples. // Build tree out of all samples.
//Note: cannot be done one the fly - gcc4.4 compiler bug.
treeBoundBox bb(samples);
octree<octreeDataPoint> ppTree octree<octreeDataPoint> ppTree
( (
treeBoundBox(samples), // overall search domain bb, // overall search domain
octreeDataPoint(samples), // all information needed to do checks octreeDataPoint(samples), // all information needed to do checks
1, // min levels 1, // min levels
20.0, // maximum ratio of cubes v.s. cells 20.0, // maximum ratio of cubes v.s. cells
@ -857,10 +861,12 @@ Foam::Map<Foam::label> Foam::surfaceFeatures::nearestSamples
scalar maxSearch = max(maxDist); scalar maxSearch = max(maxDist);
vector span(maxSearch, maxSearch, maxSearch); vector span(maxSearch, maxSearch, maxSearch);
// octree.shapes holds reference! //Note: cannot be done one the fly - gcc4.4 compiler bug.
treeBoundBox bb(samples);
octree<octreeDataPoint> ppTree octree<octreeDataPoint> ppTree
( (
treeBoundBox(samples), // overall search domain bb, // overall search domain
octreeDataPoint(samples), // all information needed to do checks octreeDataPoint(samples), // all information needed to do checks
1, // min levels 1, // min levels
20.0, // maximum ratio of cubes v.s. cells 20.0, // maximum ratio of cubes v.s. cells

View File

@ -32,6 +32,8 @@ License
#include "error.H" #include "error.H"
#include "IStringStream.H" #include "IStringStream.H"
// For EOF only
#include <cstdio>
// flex input buffer size // flex input buffer size
int Foam::chemkinReader::yyBufSize = YY_BUF_SIZE; int Foam::chemkinReader::yyBufSize = YY_BUF_SIZE;

View File

@ -239,7 +239,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
// Molecular Prandtl number // Molecular Prandtl number
scalar Pr = muw[faceI]/alphaw[faceI]; scalar Pr = muw[faceI]/alphaw[faceI];
// Molecular-to-turbulenbt Prandtl number ratio // Molecular-to-turbulent Prandtl number ratio
scalar Prat = Pr/Prt_; scalar Prat = Pr/Prt_;
// Thermal sublayer thickness // Thermal sublayer thickness