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
for (int corr=0; corr<nCorr; corr++)
{
surfaceScalarField hf = fvc::interpolate(h);
volScalarField rUA = 1.0/hUEqn.A();
surfaceScalarField ghrUAf = magg*fvc::interpolate(h*rUA);

View File

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

View File

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

View File

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

View File

@ -41,6 +41,9 @@ Description
#include "scalarList.H"
#include "IStringStream.H"
// For EOF only
#include <cstdio>
using namespace Foam;
#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 cellList& cellFaces,
const faceList& faces,
const label pointOffset,
OFstream& ensightGeometryFile
) const
{
if (polys.size())
{
ensightGeometryFile
<< "nfaced" << nl << setw(10) << polys.size() << nl;
label po = pointOffset + 1;
forAll(polys, i)
{
ensightGeometryFile
<< 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)
{
const labelList& cf = cellFaces[polys[i]];
@ -460,6 +461,19 @@ void Foam::ensightMesh::writePolys
<< 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)
{
@ -476,27 +490,137 @@ void Foam::ensightMesh::writePolys
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 cellList& cellFaces,
const faceList& faces,
const label pointOffset,
std::ofstream& ensightGeometryFile
) 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)
{
writeEnsDataBinary
@ -505,7 +629,17 @@ void Foam::ensightMesh::writePolysBinary
ensightGeometryFile
);
}
}
void Foam::ensightMesh::writePolysNPointsPerFaceBinary
(
const labelList& polys,
const cellList& cellFaces,
const faceList& faces,
std::ofstream& ensightGeometryFile
) const
{
forAll(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)
{
@ -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
(
const char* key,
const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile
@ -627,18 +893,6 @@ void Foam::ensightMesh::writeFacePrims
{
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;
forAll(patchFaces, i)
@ -657,7 +911,6 @@ void Foam::ensightMesh::writeFacePrims
void Foam::ensightMesh::writeFacePrimsBinary
(
const char* key,
const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile
@ -665,22 +918,6 @@ void Foam::ensightMesh::writeFacePrimsBinary
{
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;
forAll(patchFaces, i)
@ -731,17 +968,13 @@ void Foam::ensightMesh::writeAllFacePrims
if (nPrims)
{
if (Pstream::master())
{
if (word(key) != "nsided")
{
ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
}
if (&prims != NULL)
{
writeFacePrims
(
key,
map(patchFaces, prims),
0,
ensightGeometryFile
@ -758,7 +991,251 @@ void Foam::ensightMesh::writeAllFacePrims
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,
pointOffsets[i],
ensightGeometryFile
@ -789,18 +1266,14 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
if (nPrims)
{
if (Pstream::master())
{
if (word(key) != "nsided")
{
writeEnsDataBinary(key,ensightGeometryFile);
writeEnsDataBinary(nPrims,ensightGeometryFile);
}
if (&prims != NULL)
{
writeFacePrimsBinary
(
key,
map(patchFaces, prims),
0,
ensightGeometryFile
@ -817,7 +1290,6 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
writeFacePrimsBinary
(
key,
patchFaces,
pointOffsets[i],
ensightGeometryFile
@ -863,8 +1335,6 @@ void Foam::ensightMesh::writeAscii
{
const Time& runTime = mesh_.time();
const pointField& points = mesh_.points();
const cellList& cellFaces = mesh_.cells();
const faceList& faces = mesh_.faces();
const cellShapeList& cellShapes = mesh_.cellShapes();
word timeFile = prepend;
@ -990,48 +1460,11 @@ void Foam::ensightMesh::writeAscii
ensightGeometryFile
);
if (meshCellSets_.nPolys)
{
if (Pstream::master())
{
/*
ensightGeometryFile
<< "nfaced" << nl
<< setw(10) << meshCellSets_.nPolys << nl;
*/
writePolys
writeAllPolys
(
meshCellSets_.polys,
cellFaces,
faces,
0,
pointOffsets,
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
);
writeAllFacePrims
writeAllNSided
(
"nsided",
polys,
nfp.nPolys,
patchFaces,
@ -1197,8 +1629,6 @@ void Foam::ensightMesh::writeBinary
{
//const Time& runTime = mesh.time();
const pointField& points = mesh_.points();
const cellList& cellFaces = mesh_.cells();
const faceList& faces = mesh_.faces();
const cellShapeList& cellShapes = mesh_.cellShapes();
word timeFile = prepend;
@ -1316,48 +1746,12 @@ void Foam::ensightMesh::writeBinary
ensightGeometryFile
);
if (meshCellSets_.nPolys)
{
if (Pstream::master())
{
/*
ensightGeometryFile
<< "nfaced" << nl
<< setw(10) << meshCellSets_.nPolys << nl;
*/
writePolysBinary
writeAllPolysBinary
(
meshCellSets_.polys,
cellFaces,
faces,
0,
pointOffsets,
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_;
@ -1495,9 +1889,8 @@ void Foam::ensightMesh::writeBinary
ensightGeometryFile
);
writeAllFacePrimsBinary
writeAllNSidedBinary
(
"nsided",
polys,
nfp.nPolys,
patchFaces,
@ -1516,4 +1909,5 @@ void Foam::ensightMesh::writeBinary
}
}
// ************************************************************************* //

View File

@ -134,7 +134,22 @@ class ensightMesh
OFstream& ensightGeometryFile
) 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 cellList& cellFaces,
@ -143,6 +158,12 @@ class ensightMesh
OFstream& ensightGeometryFile
) const;
void writeAllPolys
(
const labelList& pointOffsets,
OFstream& ensightGeometryFile
) const;
void writeAllPrims
(
const char* key,
@ -154,7 +175,6 @@ class ensightMesh
void writeFacePrims
(
const char* key,
const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile
@ -177,6 +197,29 @@ class ensightMesh
OFstream& ensightGeometryFile
) 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
(
const fileName& postProcPath,
@ -209,7 +252,22 @@ class ensightMesh
std::ofstream& ensightGeometryFile
) 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 cellList& cellFaces,
@ -218,6 +276,12 @@ class ensightMesh
std::ofstream& ensightGeometryFile
) const;
void writeAllPolysBinary
(
const labelList& pointOffsets,
std::ofstream& ensightGeometryFile
) const;
void writeAllFacePrimsBinary
(
const char* key,
@ -231,12 +295,33 @@ class ensightMesh
void writeFacePrimsBinary
(
const char* key,
const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile
) 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:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -87,12 +87,12 @@ switch ("$compilerInstall")
case OpenFOAM:
switch ("$WM_COMPILER")
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/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
breaksw
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/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
breaksw

View File

@ -111,12 +111,12 @@ case "${compilerInstall:-OpenFOAM}" in
OpenFOAM)
case "$WM_COMPILER" in
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/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
;;
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/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> Istream& operator>>(Istream&, CompactListList<T, Container>&);
template<class T, class Container> Ostream& operator<<(Ostream&, const CompactListList<T, Container>&);
template<class T, class Container> Istream& operator>>
(
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>::
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");
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>
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
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField

View File

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

View File

@ -66,6 +66,14 @@ Foam::UIPstream::UIPstream
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
// and set it
if (!wantedSize)
@ -75,6 +83,12 @@ Foam::UIPstream::UIPstream
externalBuf_.setCapacity(messageSize_);
wantedSize = messageSize_;
if (debug)
{
Pout<< "UIPstream::UIPstream : probed size:" << wantedSize
<< Foam::endl;
}
}
messageSize_ = UIPstream::read
@ -127,6 +141,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
if (commsType() == UPstream::nonBlocking)
{
// Message is already received into externalBuf
messageSize_ = buffers.recvBuf_[fromProcNo].size();
}
else
{
@ -134,6 +149,14 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
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
// and set it
if (!wantedSize)
@ -143,6 +166,12 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
externalBuf_.setCapacity(messageSize_);
wantedSize = messageSize_;
if (debug)
{
Pout<< "UIPstream::UIPstream PstreamBuffers : probed size:"
<< wantedSize << Foam::endl;
}
}
messageSize_ = UIPstream::read
@ -180,6 +209,14 @@ Foam::label Foam::UIPstream::read
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)
{
MPI_Status status;
@ -214,6 +251,14 @@ Foam::label Foam::UIPstream::read
label 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)
{
FatalErrorIn
@ -256,6 +301,15 @@ Foam::label Foam::UIPstream::read
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);
// Assume the message is completely received.
@ -267,7 +321,8 @@ Foam::label Foam::UIPstream::read
(
"UIPstream::read"
"(const int fromProcNo, char* buf, std::streamsize bufSize)"
) << "Unsupported communications type " << commsType
) << "Unsupported communications type "
<< commsType
<< Foam::abort(FatalError);
return 0;

View File

@ -43,6 +43,14 @@ bool Foam::UOPstream::write
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;
if (commsType == blocking)
@ -56,6 +64,14 @@ bool Foam::UOPstream::write
tag,
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)
{
@ -68,6 +84,14 @@ bool Foam::UOPstream::write
tag,
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)
{
@ -84,6 +108,15 @@ bool Foam::UOPstream::write
&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);
}
else
@ -93,7 +126,8 @@ bool Foam::UOPstream::write
"UOPstream::write"
"(const int fromProcNo, char* buf, std::streamsize bufSize"
", const int)"
) << "Unsupported communications type " << commsType
) << "Unsupported communications type "
<< UPstream::commsTypeNames[commsType]
<< 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_rank(MPI_COMM_WORLD, &myProcNo_);
if (debug)
{
Pout<< "UPstream::init : initialised with numProcs:" << numprocs
<< " myProcNo:" << myProcNo_ << endl;
}
if (numprocs <= 1)
{
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)
{
if (debug)
{
Pout<< "UPstream::exit." << endl;
}
# ifndef SGIMPI
int size;
char* buff;
@ -164,6 +175,11 @@ void Foam::UPstream::abort()
void Foam::reduce(scalar& Value, const sumOp<scalar>& bop)
{
if (Pstream::debug)
{
Pout<< "UPstream::reduce : value:" << Value << endl;
}
if (!UPstream::parRun())
{
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()
{
if (debug)
{
Pout<< "UPstream::waitRequests : starting wait for "
<< PstreamGlobals::outstandingRequests_.size()
<< " outstanding requests." << endl;
}
if (PstreamGlobals::outstandingRequests_.size())
{
if
@ -458,11 +486,22 @@ void Foam::UPstream::waitRequests()
PstreamGlobals::outstandingRequests_.clear();
}
if (debug)
{
Pout<< "UPstream::waitRequests : finished wait." << endl;
}
}
bool Foam::UPstream::finishedRequest(const label i)
{
if (debug)
{
Pout<< "UPstream::waitRequests : starting wait for request:" << i
<< endl;
}
if (i >= PstreamGlobals::outstandingRequests_.size())
{
FatalErrorIn
@ -483,6 +522,12 @@ bool Foam::UPstream::finishedRequest(const label i)
MPI_STATUS_IGNORE
);
if (debug)
{
Pout<< "UPstream::waitRequests : finished wait for request:" << i
<< endl;
}
return flag != 0;
}

View File

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

View File

@ -25,8 +25,6 @@ License
\*----------------------------------------------------------------------------*/
#include "fvMeshDistribute.H"
#include "ProcessorTopology.H"
#include "commSchedule.H"
#include "PstreamCombineReduceOps.H"
#include "fvMeshAdder.H"
#include "faceCoupleInfo.H"
@ -39,6 +37,8 @@ License
#include "mergePoints.H"
#include "mapDistributePolyMesh.H"
#include "surfaceFields.H"
#include "syncTools.H"
#include "CompactListList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -47,71 +47,6 @@ defineTypeNameAndDebug(Foam::fvMeshDistribute, 0);
// * * * * * * * * * * * * * 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
(
const bool selectEqual,
@ -144,14 +79,29 @@ Foam::labelList Foam::fvMeshDistribute::select
// 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
Pstream::listCombineGather(myObjects, checkEqualType());
// Below scatter only needed to balance sends and receives.
Pstream::listCombineScatter(myObjects);
for (label procI = 1; procI < Pstream::nProcs(); procI++)
{
if (allNames[procI] != allNames[0])
{
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);
}
}
//- 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;
}
@ -693,46 +628,49 @@ void Foam::fvMeshDistribute::getNeighbourData
labelList& sourceNewProc
) const
{
sourceFace.setSize(mesh_.nFaces() - mesh_.nInternalFaces());
sourceProc.setSize(sourceFace.size());
sourceNewProc.setSize(sourceFace.size());
label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
sourceFace.setSize(nBnd);
sourceProc.setSize(nBnd);
sourceNewProc.setSize(nBnd);
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)
{
const polyPatch& pp = patches[patchI];
if (isA<processorPolyPatch>(pp))
{
const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp);
label offset = pp.start() - mesh_.nInternalFaces();
// Labels of faces on this side
labelList meshFaceLabels(pp.size());
forAll(meshFaceLabels, i)
// Mesh labels of faces on this side
forAll(pp, i)
{
meshFaceLabels[i] = pp.start()+i;
label bndI = offset + i;
nbrFaces[bndI] = pp.start()+i;
}
// 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)
{
const polyPatch& pp = patches[patchI];
label offset = pp.start() - mesh_.nInternalFaces();
if (isA<processorPolyPatch>(pp))
@ -740,11 +678,6 @@ void Foam::fvMeshDistribute::getNeighbourData
const processorPolyPatch& procPatch =
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.
if (Pstream::myProcNo() < procPatch.neighbProcNo())
@ -752,9 +685,10 @@ void Foam::fvMeshDistribute::getNeighbourData
// Use my local face labels
forAll(pp, i)
{
sourceFace[offset + i] = pp.start()+i;
sourceProc[offset + i] = Pstream::myProcNo();
sourceNewProc[offset + i] = nbrNewProc[i];
label bndI = offset + i;
sourceFace[bndI] = pp.start()+i;
sourceProc[bndI] = Pstream::myProcNo();
sourceNewProc[bndI] = nbrNewProc[bndI];
}
}
else
@ -762,9 +696,10 @@ void Foam::fvMeshDistribute::getNeighbourData
// Use my neighbours face labels
forAll(pp, i)
{
sourceFace[offset + i] = nbrFaces[i];
sourceProc[offset + i] = procPatch.neighbProcNo();
sourceNewProc[offset + i] = nbrNewProc[i];
label bndI = offset + i;
sourceFace[bndI] = nbrFaces[bndI];
sourceProc[bndI] = procPatch.neighbProcNo();
sourceNewProc[bndI] = nbrNewProc[bndI];
}
}
}
@ -773,9 +708,10 @@ void Foam::fvMeshDistribute::getNeighbourData
// Normal (physical) boundary
forAll(pp, i)
{
sourceFace[offset + i] = patchI;
sourceProc[offset + i] = -1;
sourceNewProc[offset + i] = -1;
label bndI = offset + i;
sourceFace[bndI] = patchI;
sourceProc[bndI] = -1;
sourceNewProc[bndI] = -1;
}
}
}
@ -1120,7 +1056,8 @@ void Foam::fvMeshDistribute::sendMesh
const labelList& sourceFace,
const labelList& sourceProc,
const labelList& sourceNewProc
const labelList& sourceNewProc,
UOPstream& toDomain
)
{
if (debug)
@ -1133,52 +1070,95 @@ void Foam::fvMeshDistribute::sendMesh
<< endl;
}
// Assume sparse point zones. Get contents in merged-zone indices.
labelListList zonePoints(pointZoneNames.size());
// Assume sparse, possibly overlapping point zones. Get contents
// in merged-zone indices.
CompactListList<label> zonePoints;
{
const pointZoneMesh& pointZones = mesh.pointZones();
labelList rowSizes(pointZoneNames.size(), 0);
forAll(pointZoneNames, nameI)
{
label myZoneID = pointZones.findZoneID(pointZoneNames[nameI]);
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
labelListList zoneFaces(faceZoneNames.size());
boolListList zoneFaceFlip(faceZoneNames.size());
// Assume sparse, possibly overlapping face zones
CompactListList<label> zoneFaces;
CompactListList<bool> zoneFaceFlip;
{
const faceZoneMesh& faceZones = mesh.faceZones();
labelList rowSizes(faceZoneNames.size(), 0);
forAll(faceZoneNames, nameI)
{
label myZoneID = faceZones.findZoneID(faceZoneNames[nameI]);
if (myZoneID != -1)
{
zoneFaces[nameI] = faceZones[myZoneID];
zoneFaceFlip[nameI] = faceZones[myZoneID].flipMap();
rowSizes[nameI] = faceZones[myZoneID].size();
}
}
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
labelListList zoneCells(cellZoneNames.size());
// Assume sparse, possibly overlapping cell zones
CompactListList<label> zoneCells;
{
const cellZoneMesh& cellZones = mesh.cellZones();
labelList rowSizes(pointZoneNames.size(), 0);
forAll(cellZoneNames, nameI)
{
label myZoneID = cellZones.findZoneID(cellZoneNames[nameI]);
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
OPstream toDomain(Pstream::blocking, domain);
toDomain
<< mesh.points()
<< mesh.faces()
<< CompactListList<label, face>(mesh.faces())
<< mesh.faceOwner()
<< mesh.faceNeighbour()
<< mesh.boundaryMesh()
@ -1214,6 +1193,13 @@ void Foam::fvMeshDistribute::sendMesh
<< sourceFace
<< sourceProc
<< 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,
labelList& domainSourceFace,
labelList& domainSourceProc,
labelList& domainSourceNewProc
labelList& domainSourceNewProc,
UIPstream& fromNbr
)
{
IPstream fromNbr(Pstream::blocking, domain);
pointField domainPoints(fromNbr);
faceList domainFaces(fromNbr);
faceList domainFaces = CompactListList<label, face>(fromNbr)();
labelList domainAllOwner(fromNbr);
labelList domainAllNeighbour(fromNbr);
PtrList<entry> patchEntries(fromNbr);
labelListList zonePoints(fromNbr);
labelListList zoneFaces(fromNbr);
boolListList zoneFaceFlip(fromNbr);
labelListList zoneCells(fromNbr);
CompactListList<label> zonePoints(fromNbr);
CompactListList<label> zoneFaces(fromNbr);
CompactListList<bool> zoneFaceFlip(fromNbr);
CompactListList<label> zoneCells(fromNbr);
fromNbr
>> domainSourceFace
@ -1442,6 +1427,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
const wordList cellZoneNames(mergeWordList(mesh_.cellZones().names()));
// Local environment of all boundary faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1481,36 +1467,39 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
mesh_.clearOut();
mesh_.resetMotion();
// Get data to send. Make sure is synchronised
const wordList volScalars(mesh_.names(volScalarField::typeName));
checkEqualWordList(volScalars);
checkEqualWordList("volScalarFields", volScalars);
const wordList volVectors(mesh_.names(volVectorField::typeName));
checkEqualWordList(volVectors);
checkEqualWordList("volVectorFields", volVectors);
const wordList volSphereTensors
(
mesh_.names(volSphericalTensorField::typeName)
);
checkEqualWordList(volSphereTensors);
checkEqualWordList("volSphericalTensorFields", volSphereTensors);
const wordList volSymmTensors(mesh_.names(volSymmTensorField::typeName));
checkEqualWordList(volSymmTensors);
checkEqualWordList("volSymmTensorFields", volSymmTensors);
const wordList volTensors(mesh_.names(volTensorField::typeName));
checkEqualWordList(volTensors);
checkEqualWordList("volTensorField", volTensors);
const wordList surfScalars(mesh_.names(surfaceScalarField::typeName));
checkEqualWordList(surfScalars);
checkEqualWordList("surfaceScalarFields", surfScalars);
const wordList surfVectors(mesh_.names(surfaceVectorField::typeName));
checkEqualWordList(surfVectors);
checkEqualWordList("surfaceVectorFields", surfVectors);
const wordList surfSphereTensors
(
mesh_.names(surfaceSphericalTensorField::typeName)
);
checkEqualWordList(surfSphereTensors);
checkEqualWordList("surfaceSphericalTensorFields", surfSphereTensors);
const wordList surfSymmTensors
(
mesh_.names(surfaceSymmTensorField::typeName)
);
checkEqualWordList(surfSymmTensors);
checkEqualWordList("surfaceSymmTensorFields", surfSymmTensors);
const wordList surfTensors(mesh_.names(surfaceTensorField::typeName));
checkEqualWordList(surfTensors);
checkEqualWordList("surfaceTensorFields", surfTensors);
// Find patch to temporarily put exposed and processor faces into.
@ -1589,6 +1578,9 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
Pstream::scatterList(nSendCells);
// Allocate buffers
PstreamBuffers pBufs(Pstream::nonBlocking);
// What to send to neighbouring domains
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1612,6 +1604,10 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
<< nl << endl;
}
// Pstream for sending mesh and fields
//OPstream str(Pstream::blocking, recvProc);
UOPstream str(recvProc, pBufs);
// Mesh subsetting engine
fvMeshSubset subsetter(mesh_);
@ -1659,6 +1655,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
procSourceNewProc
);
// Send to neighbour
sendMesh
(
@ -1671,43 +1669,69 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
procSourceFace,
procSourceProc,
procSourceNewProc
procSourceNewProc,
str
);
sendFields<volScalarField>(recvProc, volScalars, subsetter);
sendFields<volVectorField>(recvProc, volVectors, subsetter);
sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
sendFields<volVectorField>(recvProc, volVectors, subsetter, str);
sendFields<volSphericalTensorField>
(
recvProc,
volSphereTensors,
subsetter
subsetter,
str
);
sendFields<volSymmTensorField>
(
recvProc,
volSymmTensors,
subsetter
subsetter,
str
);
sendFields<volTensorField>(recvProc, volTensors, subsetter);
sendFields<volTensorField>(recvProc, volTensors, subsetter, str);
sendFields<surfaceScalarField>(recvProc, surfScalars, subsetter);
sendFields<surfaceVectorField>(recvProc, surfVectors, subsetter);
sendFields<surfaceScalarField>
(
recvProc,
surfScalars,
subsetter,
str
);
sendFields<surfaceVectorField>
(
recvProc,
surfVectors,
subsetter,
str
);
sendFields<surfaceSphericalTensorField>
(
recvProc,
surfSphereTensors,
subsetter
subsetter,
str
);
sendFields<surfaceSymmTensorField>
(
recvProc,
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
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -1817,13 +1841,31 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
<< nl << endl;
}
// Pstream for receiving mesh and fields
UIPstream str(sendProc, pBufs);
// Receive from sendProc
labelList domainSourceFace;
labelList domainSourceProc;
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
autoPtr<fvMesh> domainMeshPtr = receiveMesh
{
domainMeshPtr = receiveMesh
(
sendProc,
pointZoneNames,
@ -1833,93 +1875,98 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
const_cast<Time&>(mesh_.time()),
domainSourceFace,
domainSourceProc,
domainSourceNewProc
domainSourceNewProc,
str
);
fvMesh& domainMesh = domainMeshPtr();
// Receive fields
PtrList<volScalarField> vsf;
// Receive fields. Read as single dictionary because
// of problems reading consecutive fields from single stream.
dictionary fieldDicts(str);
receiveFields<volScalarField>
(
sendProc,
volScalars,
domainMesh,
vsf
vsf,
fieldDicts.subDict(volScalarField::typeName)
);
PtrList<volVectorField> vvf;
receiveFields<volVectorField>
(
sendProc,
volVectors,
domainMesh,
vvf
vvf,
fieldDicts.subDict(volVectorField::typeName)
);
PtrList<volSphericalTensorField> vsptf;
receiveFields<volSphericalTensorField>
(
sendProc,
volSphereTensors,
domainMesh,
vsptf
vsptf,
fieldDicts.subDict(volSphericalTensorField::typeName)
);
PtrList<volSymmTensorField> vsytf;
receiveFields<volSymmTensorField>
(
sendProc,
volSymmTensors,
domainMesh,
vsytf
vsytf,
fieldDicts.subDict(volSymmTensorField::typeName)
);
PtrList<volTensorField> vtf;
receiveFields<volTensorField>
(
sendProc,
volTensors,
domainMesh,
vtf
vtf,
fieldDicts.subDict(volTensorField::typeName)
);
PtrList<surfaceScalarField> ssf;
receiveFields<surfaceScalarField>
(
sendProc,
surfScalars,
domainMesh,
ssf
ssf,
fieldDicts.subDict(surfaceScalarField::typeName)
);
PtrList<surfaceVectorField> svf;
receiveFields<surfaceVectorField>
(
sendProc,
surfVectors,
domainMesh,
svf
svf,
fieldDicts.subDict(surfaceVectorField::typeName)
);
PtrList<surfaceSphericalTensorField> ssptf;
receiveFields<surfaceSphericalTensorField>
(
sendProc,
surfSphereTensors,
domainMesh,
ssptf
ssptf,
fieldDicts.subDict(surfaceSphericalTensorField::typeName)
);
PtrList<surfaceSymmTensorField> ssytf;
receiveFields<surfaceSymmTensorField>
(
sendProc,
surfSymmTensors,
domainMesh,
ssytf
ssytf,
fieldDicts.subDict(surfaceSymmTensorField::typeName)
);
PtrList<surfaceTensorField> stf;
receiveFields<surfaceTensorField>
(
sendProc,
surfTensors,
domainMesh,
stf
stf,
fieldDicts.subDict(surfaceTensorField::typeName)
);
}
const fvMesh& domainMesh = domainMeshPtr();
constructCellMap[sendProc] = identity(domainMesh.nCells());

View File

@ -82,38 +82,8 @@ class fvMeshDistribute
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
//- 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
static labelList select
(
@ -123,7 +93,7 @@ class fvMeshDistribute
);
//- 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
static wordList mergeWordList(const wordList&);
@ -288,7 +258,8 @@ class fvMeshDistribute
const wordList& cellZoneNames,
const labelList& sourceFace,
const labelList& sourceProc,
const labelList& sourceNewProc
const labelList& sourceNewProc,
UOPstream& toDomain
);
//- Send subset of fields
template<class GeoField>
@ -296,7 +267,8 @@ class fvMeshDistribute
(
const label domain,
const wordList& fieldNames,
const fvMeshSubset&
const fvMeshSubset&,
UOPstream& toNbr
);
//- Receive mesh. Opposite of sendMesh
@ -309,7 +281,8 @@ class fvMeshDistribute
const Time& runTime,
labelList& domainSourceFace,
labelList& domainSourceProc,
labelList& domainSourceNewProc
labelList& domainSourceNewProc,
UIPstream& fromNbr
);
//- Receive fields. Opposite of sendFields
@ -319,7 +292,8 @@ class fvMeshDistribute
const label domain,
const wordList& fieldNames,
fvMesh&,
PtrList<GeoField>&
PtrList<GeoField>&,
const dictionary& fieldDicts
);
//- Disallow default bitwise copy construct

View File

@ -184,7 +184,7 @@ void Foam::fvMeshDistribute::mapBoundaryFields
if (flds.size() != oldBflds.size())
{
FatalErrorIn("fvMeshDistribute::mapBoundaryFields") << "problem"
FatalErrorIn("fvMeshDistribute::mapBoundaryFields(..)") << "problem"
<< abort(FatalError);
}
@ -273,19 +273,40 @@ void Foam::fvMeshDistribute::initPatchFields
// 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>
void Foam::fvMeshDistribute::sendFields
(
const label domain,
const wordList& fieldNames,
const fvMeshSubset& subsetter
const fvMeshSubset& subsetter,
UOPstream& toNbr
)
{
toNbr << GeoField::typeName << token::NL << token::BEGIN_BLOCK << token::NL;
forAll(fieldNames, i)
{
//Pout<< "Subsetting field " << fieldNames[i]
// << " for domain:" << domain
// << endl;
if (debug)
{
Pout<< "Subsetting field " << fieldNames[i]
<< " for domain:" << domain << endl;
}
// Send all fieldNames. This has to be exactly the same set as is
// being received!
@ -294,10 +315,12 @@ void Foam::fvMeshDistribute::sendFields
tmp<GeoField> tsubfld = subsetter.interpolate(fld);
// Send
OPstream toNbr(Pstream::blocking, domain);
toNbr << tsubfld();
toNbr
<< fieldNames[i] << token::NL << token::BEGIN_BLOCK
<< 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 wordList& fieldNames,
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());
forAll(fieldNames, i)
{
//Pout<< "Receiving field " << fieldNames[i]
// << " from domain:" << domain
// << endl;
IPstream fromNbr(Pstream::blocking, domain);
if (debug)
{
Pout<< "Constructing field " << fieldNames[i]
<< " from domain:" << domain << endl;
}
fields.set
(
@ -335,7 +365,7 @@ void Foam::fvMeshDistribute::receiveFields
IOobject::AUTO_WRITE
),
mesh,
fromNbr
fieldDicts.subDict(fieldNames[i])
)
);
}

View File

@ -154,7 +154,7 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
label sizeby2 = this->size()/2;
const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
if (long(&psiInternal) == long(&this->internalField()))
if (&psiInternal == &this->internalField())
{
tmp<Field<scalar> > tjf = jump();
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
patchFaceMap_.setSize(oldPatches.size());
// From fine face to coarse face (or -1)
reverseFaceMap_.setSize(mesh.nFaces());
reverseFaceMap_.labelList::operator=(-1);
// Face counter
coarseI = 0;

View File

@ -1858,7 +1858,7 @@ void Foam::meshRefinement::distribute(const mapDistributePolyMesh& map)
// Get local mesh bounding box. Single box for now.
List<treeBoundBox> meshBb(1);
treeBoundBox& bb = meshBb[0];
bb = boundBox(mesh_.points(), false);
bb = treeBoundBox(mesh_.points());
bb = bb.extend(rndGen, 1E-4);
// 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& p2 = points[f[2]];
boundBox triBb(p0, p0);
treeBoundBox triBb(p0, p0);
triBb.min() = min(triBb.min(), p1);
triBb.min() = min(triBb.min(), p2);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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