diff --git a/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C b/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C index bd1989f433..757ad95e25 100644 --- a/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C +++ b/applications/solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C @@ -90,7 +90,6 @@ int main(int argc, char *argv[]) // --- PISO loop for (int corr=0; corr> 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); diff --git a/applications/test/readCHEMKINIII/readCHEMKINIII.C b/applications/test/readCHEMKINIII/readCHEMKINIII.C index a028e9fd2b..50721d64ea 100644 --- a/applications/test/readCHEMKINIII/readCHEMKINIII.C +++ b/applications/test/readCHEMKINIII/readCHEMKINIII.C @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) //Info<< ck.specieThermo() << endl; //Info<< ck.reactions() << endl; - PtrList reactions = ck.reactions(); + const SLPtrList& 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 testReactions(nReactions); + PtrList testReactions(nReactions); forAll (testReactions, i) { testReactions.set ( i, - chemkinReader::reaction::New + gasReaction::New ( ck.species(), - ck.specieThermo(), + ck.speciesThermo(), reactionStream ) ); diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L index 2fffcaa813..cbb52ab0e0 100644 --- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L +++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L @@ -39,6 +39,8 @@ Description \* ------------------------------------------------------------------------- */ #include +// For EOF only +#include #include "scalar.H" #include "IStringStream.H" diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L index f815e81b53..d349f7709c 100644 --- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L +++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L @@ -41,6 +41,9 @@ Description #include "scalarList.H" #include "IStringStream.H" +// For EOF only +#include + using namespace Foam; #include "argList.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C index c3262e6b9c..4796f4b4f1 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/ensightMesh.C @@ -428,7 +428,43 @@ void Foam::ensightMesh::writePrimsBinary } -void Foam::ensightMesh::writePolys +void Foam::ensightMesh::writePolysNFaces +( + const labelList& polys, + const cellList& cellFaces, + OFstream& ensightGeometryFile +) const +{ + 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]]; + + forAll(cf, faceI) + { + ensightGeometryFile + << setw(10) << faces[cf[faceI]].size() << nl; + } + } +} + + +void Foam::ensightMesh::writePolysPoints ( const labelList& polys, const cellList& cellFaces, @@ -437,50 +473,190 @@ void Foam::ensightMesh::writePolys OFstream& ensightGeometryFile ) const { - if (polys.size()) + label po = pointOffset + 1; + + forAll(polys, i) { - ensightGeometryFile - << "nfaced" << nl << setw(10) << polys.size() << nl; + const labelList& cf = cellFaces[polys[i]]; - label po = pointOffset + 1; - - forAll(polys, i) + forAll(cf, faceI) { - ensightGeometryFile - << setw(10) << cellFaces[polys[i]].size() << nl; - } + const face& f = faces[cf[faceI]]; - forAll(polys, i) - { - const labelList& cf = cellFaces[polys[i]]; - - forAll(cf, faceI) + forAll(f, pointI) { - ensightGeometryFile - << setw(10) << faces[cf[faceI]].size() << nl; - } - } - - forAll(polys, i) - { - const labelList& cf = cellFaces[polys[i]]; - - forAll(cf, faceI) - { - const face& f = faces[cf[faceI]]; - - forAll(f, pointI) - { - ensightGeometryFile << setw(10) << f[pointI] + po; - } - ensightGeometryFile << nl; + ensightGeometryFile << setw(10) << f[pointI] + po; } + ensightGeometryFile << nl; } } } -void Foam::ensightMesh::writePolysBinary +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 @@ -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) { diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index e653b05adb..0d46db1d49 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C @@ -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, parcels, iter) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C index d7c0f2f013..ace25f527f 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C @@ -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]; diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C index f363beae45..431df1f9c5 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C @@ -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) { diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C index e1fd59ccd0..b39dfd453f 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C @@ -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; diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C index 0a21310a63..9b8bcb956d 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C @@ -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) { diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H index 7b7de4d022..bfa2d1ac46 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H @@ -52,10 +52,10 @@ void Foam::vtkPV3Foam::convertPatchField const label nComp = pTraits::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::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) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H index 3a609b2bde..5e3ae1df42 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H @@ -110,9 +110,9 @@ void Foam::vtkPV3Foam::convertPointFields ++partId ) { - const word patchName = getPartName(partId); + const word patchName = getPartName(partId); const label datasetNo = partDataset_[partId]; - const label patchId = patches.findPatchID(patchName); + const label patchId = patches.findPatchID(patchName); if (!partStatus_[partId] || datasetNo < 0 || patchId < 0) { @@ -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())); diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C index 59e445e341..5bb2143c2a 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C @@ -140,7 +140,6 @@ void Foam::vtkPV3Foam::updateInfoInternalMesh() Info<< " 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 diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H index 7e28460a46..4d35525efe 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H @@ -35,7 +35,7 @@ InClass template class patchType, class meshType> void Foam::vtkPV3Foam::updateInfoFields ( - vtkDataArraySelection *select + vtkDataArraySelection* select ) { if (debug) @@ -112,4 +112,5 @@ void Foam::vtkPV3Foam::updateInfoFields // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif + // ************************************************************************* // diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C index a9d12c303a..9683a15914 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C @@ -69,6 +69,7 @@ namespace Foam } // End namespace Foam + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::vtkPV3Foam::AddToBlock diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C index cdb041ce35..8b37f70fe4 100644 --- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C +++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C @@ -62,7 +62,7 @@ void writeProcStats // Determine surface bounding boxes, faces, points List surfBb(Pstream::nProcs()); { - surfBb[Pstream::myProcNo()] = boundBox(s.points(), false); + surfBb[Pstream::myProcNo()] = treeBoundBox(s.points()); Pstream::gatherList(surfBb); Pstream::scatterList(surfBb); } diff --git a/etc/bashrc b/etc/bashrc index df864b40e1..308d33bf84 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -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= diff --git a/etc/cshrc b/etc/cshrc index f5fe32d26e..9ef6fb2d06 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -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 diff --git a/etc/settings.csh b/etc/settings.csh index 1b33c5c42d..d970f03942 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -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 diff --git a/etc/settings.sh b/etc/settings.sh index f1abf12423..02b3172307 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -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 ;; diff --git a/src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H b/src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H index f1875dde70..b2aad34d22 100644 --- a/src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H +++ b/src/OpenFOAM/containers/Lists/CompactListList/CompactListList.H @@ -61,8 +61,16 @@ namespace Foam template class CompactListList; -template Istream& operator>>(Istream&, CompactListList&); -template Ostream& operator<<(Ostream&, const CompactListList&); +template Istream& operator>> +( + Istream&, + CompactListList& +); +template Ostream& operator<< +( + Ostream&, + const CompactListList& +); /*---------------------------------------------------------------------------*\ diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index 705ee5e2b4..25a90ba64c 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -52,20 +52,11 @@ Foam::tmp typename Foam::GeometricField:: GeometricBoundaryField > -Foam::GeometricField::readField(Istream& is) +Foam::GeometricField::readField +( + const dictionary& fieldDict +) { - if (is.version() < 2.0) - { - FatalIOErrorIn - ( - "GeometricField::readField(Istream&)", - is - ) << "IO versions < 2.0 are not supported." - << exit(FatalIOError); - } - - dictionary fieldDict(is); - DimensionedField::readField(fieldDict, "internalField"); tmp tboundaryField @@ -96,6 +87,28 @@ Foam::GeometricField::readField(Istream& is) } +template class PatchField, class GeoMesh> +Foam::tmp +< + typename Foam::GeometricField:: + GeometricBoundaryField +> +Foam::GeometricField::readField(Istream& is) +{ + if (is.version() < 2.0) + { + FatalIOErrorIn + ( + "GeometricField::readField(Istream&)", + is + ) << "IO versions < 2.0 are not supported." + << exit(FatalIOError); + } + + return readField(dictionary(is)); +} + + template class PatchField, class GeoMesh> bool Foam::GeometricField::readIfPresent() { @@ -404,6 +417,44 @@ Foam::GeometricField::GeometricField } +template class PatchField, class GeoMesh> +Foam::GeometricField::GeometricField +( + const IOobject& io, + const Mesh& mesh, + const dictionary& dict +) +: + DimensionedField(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::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" + << endl << this->info() << endl; + } +} + + // construct as copy template class PatchField, class GeoMesh> Foam::GeometricField::GeometricField diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index 71e2bbf34c..1abca4cc87 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -240,6 +240,9 @@ private: // Private member functions + //- Read the field from the dictionary + tmp readField(const dictionary&); + //- Read the field from the given stream tmp readField(Istream& is); @@ -327,6 +330,14 @@ public: Istream& ); + //- Construct from dictionary + GeometricField + ( + const IOobject&, + const Mesh&, + const dictionary& + ); + //- Construct as copy GeometricField ( diff --git a/src/Pstream/mpi/UIPread.C b/src/Pstream/mpi/UIPread.C index 14360e0cc0..fb6a9ec7d7 100644 --- a/src/Pstream/mpi/UIPread.C +++ b/src/Pstream/mpi/UIPread.C @@ -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; diff --git a/src/Pstream/mpi/UOPwrite.C b/src/Pstream/mpi/UOPwrite.C index f8439ba517..9f8726d9a0 100644 --- a/src/Pstream/mpi/UOPwrite.C +++ b/src/Pstream/mpi/UOPwrite.C @@ -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); } diff --git a/src/Pstream/mpi/UPstream.C b/src/Pstream/mpi/UPstream.C index b5a76e36e9..3623f5da58 100644 --- a/src/Pstream/mpi/UPstream.C +++ b/src/Pstream/mpi/UPstream.C @@ -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& 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& 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; } diff --git a/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C b/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C index 3df03c8c70..37562abc35 100644 --- a/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C +++ b/src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C @@ -330,8 +330,6 @@ void Foam::fvMeshAdder::MapVolFields if (fieldsToAdd.found(fld.name())) { - Pout<< "Mapping field " << fld.name() << endl; - const GeometricField& 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(meshMap, fld, fldToAdd); } else { - WarningIn("fvMeshAdder::MapSurfaceFields") + WarningIn("fvMeshAdder::MapSurfaceFields(..)") << "Not mapping field " << fld.name() << " since not present on mesh to add" << endl; diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index fea10f410b..5d4144a32c 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -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::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 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 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::fvMeshDistribute::mergeSharedPoints << " newPointI:" << newPointI << abort(FatalError); } } - //- old: use pointToMaster map. - //forAll(constructMap, i) - //{ - // label oldPointI = constructMap[i]; - // - // // See if merged into other point - // Map