From 6c52aacc57f185d65debde3c9e4c96f50b6f0829 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Mar 2011 10:55:13 +0000 Subject: [PATCH 1/5] ENH: POSIX.C : debug printing --- src/OSspecific/POSIX/POSIX.C | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index e6e54c32c0..c31c13203a 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -1074,18 +1074,33 @@ int Foam::system(const std::string& command) void* Foam::dlOpen(const fileName& lib) { + if (POSIX::debug) + { + Info<< "dlOpen(const fileName&)" + << " : dlopen of " << lib << endl; + } return ::dlopen(lib.c_str(), RTLD_LAZY|RTLD_GLOBAL); } bool Foam::dlClose(void* handle) { + if (POSIX::debug) + { + Info<< "dlClose(void*)" + << " : dlclose" << endl; + } return ::dlclose(handle) == 0; } void* Foam::dlSym(void* handle, const std::string& symbol) { + if (POSIX::debug) + { + Info<< "dlSym(void*, const std::string&)" + << " : dlsym of " << symbol << endl; + } // clear any old errors - see manpage dlopen (void) ::dlerror(); @@ -1110,6 +1125,12 @@ bool Foam::dlSymFound(void* handle, const std::string& symbol) { if (handle && !symbol.empty()) { + if (POSIX::debug) + { + Info<< "dlSymFound(void*, const std::string&)" + << " : dlsym of " << symbol << endl; + } + // clear any old errors - see manpage dlopen (void) ::dlerror(); From b50eb3893722197d522f435611fd9738c6edf64c Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Mar 2011 10:56:30 +0000 Subject: [PATCH 2/5] COMP: HashTable: make end() iterator a reference to a static. Weird one. Reported crash with gcc452 with end() iterator returning a copy. The end() iterator returned was not initialised. No idea why & could not repeat. --- .../containers/HashTables/HashTable/HashTable.H | 12 +++++++----- .../containers/HashTables/HashTable/HashTableCore.C | 5 ++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H index 7d4f9d0ddf..92ca5c21bd 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTable.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -97,16 +97,18 @@ struct HashTableCore {} }; + static const iteratorEnd endIter; + //- iteratorEnd set to beyond the end of any HashTable - inline static iteratorEnd cend() + inline static const iteratorEnd& cend() { - return iteratorEnd(); + return endIter; } //- iteratorEnd set to beyond the end of any HashTable - inline static iteratorEnd end() + inline static const iteratorEnd& end() { - return iteratorEnd(); + return endIter; } }; diff --git a/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.C b/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.C index edd46a82b3..6c82ecdc45 100644 --- a/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.C +++ b/src/OpenFOAM/containers/HashTables/HashTable/HashTableCore.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,9 @@ const Foam::label Foam::HashTableCore::maxTableSize ) ); +const Foam::HashTableCore::iteratorEnd Foam::HashTableCore::endIter; + + // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::label Foam::HashTableCore::canonicalSize(const label size) From 1b5de71f7af5f7dcb4c0db268cfe1bd132dcb80a Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Mar 2011 10:58:50 +0000 Subject: [PATCH 3/5] BUG: codedFixedValue: oldTypeName_ not preserved. --- .../codedFixedValue/codedFixedValueFvPatchScalarField.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C index 9123e0cb70..720bd6f9d3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/codedFixedValue/codedFixedValueFvPatchScalarField.C @@ -352,7 +352,7 @@ codedFixedValueFvPatchScalarField fixedValueFvPatchField(ptf, p, iF, mapper), dict_(ptf.dict_), redirectType_(ptf.redirectType_), - oldLibPath_(), + oldLibPath_(ptf.oldLibPath_), redirectPatchFieldPtr_() {} @@ -384,7 +384,7 @@ codedFixedValueFvPatchScalarField fixedValueFvPatchField(ptf), dict_(ptf.dict_), redirectType_(ptf.redirectType_), - oldLibPath_(), + oldLibPath_(ptf.oldLibPath_), redirectPatchFieldPtr_() {} @@ -399,7 +399,7 @@ codedFixedValueFvPatchScalarField fixedValueFvPatchField(ptf, iF), dict_(ptf.dict_), redirectType_(ptf.redirectType_), - oldLibPath_(), + oldLibPath_(ptf.oldLibPath_), redirectPatchFieldPtr_() {} From 0008052e5bf7635d60d2968b1c0069f2d15cf392 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Mar 2011 12:01:32 +0000 Subject: [PATCH 4/5] ENH: triSurface.C: avoid faceFaces() since not valid for non-manifold --- src/triSurface/triSurface/triSurface.C | 70 ++++++++++++++------------ 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index ec82fddc88..f55543a85e 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -211,8 +211,6 @@ void Foam::triSurface::checkTriangles(const bool verbose) boolList valid(size(), true); bool hasInvalid = false; - const labelListList& fFaces = faceFaces(); - forAll(*this, faceI) { const labelledTri& f = (*this)[faceI]; @@ -236,47 +234,53 @@ void Foam::triSurface::checkTriangles(const bool verbose) else { // duplicate triangle check - const labelList& neighbours = fFaces[faceI]; + const labelList& fEdges = faceEdges()[faceI]; // Check if faceNeighbours use same points as this face. // Note: discards normal information - sides of baffle are merged. - forAll(neighbours, neighbourI) + + forAll(fEdges, fp) { - if (neighbours[neighbourI] <= faceI) + const labelList& eFaces = edgeFaces()[fEdges[fp]]; + + forAll(eFaces, i) { - // lower numbered faces already checked - continue; - } + label neighbour = eFaces[i]; - const labelledTri& n = (*this)[neighbours[neighbourI]]; - - if - ( - ((f[0] == n[0]) || (f[0] == n[1]) || (f[0] == n[2])) - && ((f[1] == n[0]) || (f[1] == n[1]) || (f[1] == n[2])) - && ((f[2] == n[0]) || (f[2] == n[1]) || (f[2] == n[2])) - ) - { - valid[faceI] = false; - hasInvalid = true; - - if (verbose) + if (neighbour > faceI) { - WarningIn + // lower numbered faces already checked + const labelledTri& n = (*this)[neighbour]; + + if ( - "triSurface::checkTriangles(bool verbose)" - ) << "triangles share the same vertices:\n" - << " face 1 :" << faceI << endl; - printTriangle(Warning, " ", f, points()); + ((f[0] == n[0]) || (f[0] == n[1]) || (f[0] == n[2])) + && ((f[1] == n[0]) || (f[1] == n[1]) || (f[1] == n[2])) + && ((f[2] == n[0]) || (f[2] == n[1]) || (f[2] == n[2])) + ) + { + valid[faceI] = false; + hasInvalid = true; - Warning - << endl - << " face 2 :" - << neighbours[neighbourI] << endl; - printTriangle(Warning, " ", n, points()); + if (verbose) + { + WarningIn + ( + "triSurface::checkTriangles(bool verbose)" + ) << "triangles share the same vertices:\n" + << " face 1 :" << faceI << endl; + printTriangle(Warning, " ", f, points()); + + Warning + << endl + << " face 2 :" + << neighbour << endl; + printTriangle(Warning, " ", n, points()); + } + + break; + } } - - break; } } } From 92ff766c19b2c41dd6332aa9c906340abd5ceb8a Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Mar 2011 15:30:19 +0000 Subject: [PATCH 5/5] COMP: cloud.c : missing include --- src/OpenFOAM/fields/cloud/cloud.C | 1 + 1 file changed, 1 insertion(+) diff --git a/src/OpenFOAM/fields/cloud/cloud.C b/src/OpenFOAM/fields/cloud/cloud.C index 2bf9a518a4..195f78cc8a 100644 --- a/src/OpenFOAM/fields/cloud/cloud.C +++ b/src/OpenFOAM/fields/cloud/cloud.C @@ -25,6 +25,7 @@ License #include "cloud.H" #include "Time.H" +#include "polyMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //