From 23cf5d94cd937aae0a912f01da023f43a9a09d2c Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 3 Nov 2009 14:33:01 +0000 Subject: [PATCH 01/19] code tidying --- .../vtkPV3Foam/vtkPV3FoamFaceField.H | 21 ++++++++++--------- .../vtkPV3Foam/vtkPV3FoamMeshLagrangian.C | 4 ++-- .../vtkPV3Foam/vtkPV3FoamMeshPatch.C | 13 ++++-------- .../vtkPV3Foam/vtkPV3FoamMeshSet.C | 12 +++++------ .../vtkPV3Foam/vtkPV3FoamMeshVolume.C | 8 +++---- .../vtkPV3Foam/vtkPV3FoamMeshZone.C | 10 ++++----- .../vtkPV3Foam/vtkPV3FoamPatchField.H | 18 ++++++++-------- .../vtkPV3Foam/vtkPV3FoamPointFields.H | 6 +++--- .../vtkPV3Foam/vtkPV3FoamUpdateInfo.C | 4 +--- .../vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H | 3 ++- .../vtkPV3Foam/vtkPV3FoamUtils.C | 1 + 11 files changed, 45 insertions(+), 55 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H index dba8d97d37..14c0d5f9b9 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamFaceField.H @@ -35,6 +35,7 @@ InClass #include "vtkFloatArray.h" #include "vtkMultiBlockDataSet.h" #include "vtkPolyData.h" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // template @@ -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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C index e653b05adb..0d46db1d49 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshLagrangian.C +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C index d7c0f2f013..ace25f527f 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshPatch.C +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C index f363beae45..431df1f9c5 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshSet.C +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C index e1fd59ccd0..b39dfd453f 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshVolume.C +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C index 0a21310a63..9b8bcb956d 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamMeshZone.C +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H index 7b7de4d022..bfa2d1ac46 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPatchField.H +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H index 3a609b2bde..5e3ae1df42 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamPointFields.H +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C index 59e445e341..5bb2143c2a 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfo.C +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H index 7e28460a46..4d35525efe 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUpdateInfoFields.H +++ b/applications/utilities/postProcessing/graphics/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/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C index a9d12c303a..9683a15914 100644 --- a/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C +++ b/applications/utilities/postProcessing/graphics/PV3FoamReader/vtkPV3Foam/vtkPV3FoamUtils.C @@ -69,6 +69,7 @@ namespace Foam } // End namespace Foam + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::vtkPV3Foam::AddToBlock From e7347dbd624989eea8d9b8f4614128f0c8f711bb Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 9 Nov 2009 10:15:07 +0000 Subject: [PATCH 02/19] removed unnecessary interpolation of h - not used --- .../solvers/incompressible/shallowWaterFoam/shallowWaterFoam.C | 1 - 1 file changed, 1 deletion(-) 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 Date: Thu, 12 Nov 2009 13:28:18 +0000 Subject: [PATCH 03/19] typo --- .../alphatJayatillekeWallFunctionFvPatchScalarField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index b5022e2756..5c73b8b146 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -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 From 963a8cb8d52db5da8a5484c9c5b3a581297b20ec Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 12 Nov 2009 13:28:55 +0000 Subject: [PATCH 04/19] cleaner code --- .../readAdditionalSolutionControls.H | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readAdditionalSolutionControls.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readAdditionalSolutionControls.H index 8159205cae..340623fbfd 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readAdditionalSolutionControls.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/readAdditionalSolutionControls.H @@ -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); From 9e57cef139841dab800bc68b2ace7619840bf3b1 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 12 Nov 2009 18:23:22 +0000 Subject: [PATCH 05/19] fixed reverseFaceMap --- src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C index 65965f15d9..7e38d09831 100644 --- a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C @@ -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; From 6e793380d9697cb4cc1644f64ab474028e3854af Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 12 Nov 2009 18:25:08 +0000 Subject: [PATCH 06/19] rmeoved printing --- src/dynamicMesh/fvMeshAdder/fvMeshAdderTemplates.C | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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; From 1d4533a41eb2f95e4a11a6d704f1be3e1352a0a6 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 12 Nov 2009 18:25:37 +0000 Subject: [PATCH 07/19] >80 line length --- .../Lists/CompactListList/CompactListList.H | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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& +); /*---------------------------------------------------------------------------*\ From b7845edeba957575b3ed69462f93db1ce123a4cb Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 13 Nov 2009 16:09:27 +0000 Subject: [PATCH 08/19] updated to new thermo --- applications/test/readCHEMKINIII/readCHEMKINIII.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 ) ); From 8349d891109d2e4c1c5e8165678d82e18fa96c6d Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 13 Nov 2009 16:09:39 +0000 Subject: [PATCH 09/19] construct from dictionary --- .../GeometricField/GeometricField.C | 77 +++++++++++++++---- .../GeometricField/GeometricField.H | 11 +++ 2 files changed, 75 insertions(+), 13 deletions(-) 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 ( From 03d777f594b1092c6d773e8531d38c1cbc946c26 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 13 Nov 2009 16:10:11 +0000 Subject: [PATCH 10/19] message size not set; debug printing --- src/Pstream/mpi/UIPread.C | 57 +++++++++++++++++++++++++++++++++++++- src/Pstream/mpi/UOPwrite.C | 36 +++++++++++++++++++++++- src/Pstream/mpi/UPstream.C | 45 ++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+), 2 deletions(-) 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; } From 4a5f0fbebec395d92c190911b30d0bbf462de1bc Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 13 Nov 2009 16:10:25 +0000 Subject: [PATCH 11/19] extraneous pointer cast --- .../constraint/jumpCyclic/jumpCyclicFvPatchField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C index 4f4ec60dd0..dcd3440e36 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/jumpCyclic/jumpCyclicFvPatchField.C @@ -154,7 +154,7 @@ void jumpCyclicFvPatchField::updateInterfaceMatrix label sizeby2 = this->size()/2; const unallocLabelList& faceCells = this->cyclicPatch().faceCells(); - if (long(&psiInternal) == long(&this->internalField())) + if (&psiInternal == &this->internalField()) { tmp > tjf = jump(); const Field& jf = tjf(); From 4f1305316da6b1bc39671311935861252ac8e950 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 13 Nov 2009 16:10:54 +0000 Subject: [PATCH 12/19] fix multiple field transfer --- .../fvMeshDistribute/fvMeshDistribute.C | 549 ++++++++++-------- .../fvMeshDistribute/fvMeshDistribute.H | 44 +- .../fvMeshDistributeTemplates.C | 60 +- 3 files changed, 352 insertions(+), 301 deletions(-) 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