From c19a3d3384ab815e3d2d3025d042483b72557930 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 4 Jul 2019 17:07:48 +0200 Subject: [PATCH 1/6] BUG: metis PrecisionAdaptor used ref() instead of constCast() - closes #1354 - the scotch interface still uses non-const pointers when passing in values. For the ConstPrecisionAdaptor this means that we need to cheat with a constCast(). Using ref() will rightly trigger complaints about trying to modify a const object. --- src/parallel/decompose/metisDecomp/metisDecomp.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C index 165298516b..356b40994b 100644 --- a/src/parallel/decompose/metisDecomp/metisDecomp.C +++ b/src/parallel/decompose/metisDecomp/metisDecomp.C @@ -206,8 +206,8 @@ Foam::label Foam::metisDecomp::decomposeSerial ( &numCells, // num vertices in graph &ncon, // num balancing constraints - xadj_metis.ref().data(), // indexing into adjncy - adjncy_metis.ref().data(), // neighbour info + xadj_metis.constCast().data(), // indexing into adjncy + adjncy_metis.constCast().data(), // neighbour info cellWeights.data(), // vertex wts nullptr, // vsize: total communication vol faceWeights.data(), // edge wts @@ -225,8 +225,8 @@ Foam::label Foam::metisDecomp::decomposeSerial ( &numCells, // num vertices in graph &ncon, // num balancing constraints - xadj_metis.ref().data(), // indexing into adjncy - adjncy_metis.ref().data(), // neighbour info + xadj_metis.constCast().data(), // indexing into adjncy + adjncy_metis.constCast().data(), // neighbour info cellWeights.data(), // vertex wts nullptr, // vsize: total communication vol faceWeights.data(), // edge wts From 8f6f19b25c1719859d308c582feec689a232a008 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 5 Jul 2019 10:29:18 +0200 Subject: [PATCH 2/6] CONFIG: do not touch LD_PRELOAD contents at all (#1357) --- etc/config.csh/setup | 6 +----- etc/config.sh/setup | 6 ------ etc/config.sh/unset | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/etc/config.csh/setup b/etc/config.csh/setup index 8d2833c8c9..a63c3a9353 100644 --- a/etc/config.csh/setup +++ b/etc/config.csh/setup @@ -122,7 +122,7 @@ end # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Prevent local variables from shadowing setenv variables -unset PATH MANPATH LD_LIBRARY_PATH LD_PRELOAD +unset PATH MANPATH LD_LIBRARY_PATH if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH if (! $?MANPATH ) setenv MANPATH @@ -167,10 +167,6 @@ if ( $?MANPATH ) then setenv MANPATH "${MANPATH}:" endif -if ( $?LD_PRELOAD ) then - _foamClean LD_PRELOAD -endif - # Cleanup temporary information # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/etc/config.sh/setup b/etc/config.sh/setup index ed692ec259..03005db42a 100644 --- a/etc/config.sh/setup +++ b/etc/config.sh/setup @@ -153,12 +153,6 @@ then MANPATH="${MANPATH}:" fi -if [ -n "$LD_PRELOAD" ] -then - export LD_PRELOAD - _foamClean LD_PRELOAD -fi - # Cleanup temporary information # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/etc/config.sh/unset b/etc/config.sh/unset index a44eaa9671..d2b7e20cd5 100644 --- a/etc/config.sh/unset +++ b/etc/config.sh/unset @@ -147,7 +147,6 @@ then fi [ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH -[ -n "$LD_PRELOAD" ] || unset LD_PRELOAD [ -n "$MANPATH" ] || unset MANPATH #------------------------------------------------------------------------------ From f2d56deedde340f847ce619de01aa5ef3ac1499a Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 5 Jul 2019 11:04:06 +0200 Subject: [PATCH 3/6] BUG: questionable findInstance handling of constant (related to #1112) - when searching for a file that may not actually exist, the short-cut optimization could lead to the 'constant' directory being ignored. STYLE: simplify logic in points0MotionSolver::points0IO --- .../fileOperation/fileOperation.C | 15 ++-- .../points0/points0MotionSolver.C | 69 ++++++------------- 2 files changed, 28 insertions(+), 56 deletions(-) diff --git a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C index 1c4e484d50..6611940880 100644 --- a/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C +++ b/src/OpenFOAM/global/fileOperations/fileOperation/fileOperation.C @@ -757,8 +757,8 @@ Foam::IOobject Foam::fileOperation::findInstance return io; } - // Search back through the time directories to find the time - // closest to and lower than current time + // Search back through the time directories to find the first time + // that is less than or equal to the current time instantList ts = time.times(); label instanceI = ts.size()-1; @@ -771,20 +771,21 @@ Foam::IOobject Foam::fileOperation::findInstance } } - // Continue searching from here + // Found the time, continue from here for (; instanceI >= 0; --instanceI) { + io.instance() = ts[instanceI].name(); + // Shortcut: if actual directory is the timeName we've already tested it if ( - ts[instanceI].name() == startIO.instance() - && ts[instanceI].name() != stopInstance + io.instance() == startIO.instance() + && io.instance() != stopInstance ) { continue; } - io.instance() = ts[instanceI].name(); if (exists(io)) { DebugInFunction @@ -796,7 +797,7 @@ Foam::IOobject Foam::fileOperation::findInstance } // Check if hit minimum instance - if (ts[instanceI].name() == stopInstance) + if (io.instance() == stopInstance) { DebugInFunction << "Hit stopInstance " << stopInstance << endl; diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C index aafc2afa12..2fedc2355c 100644 --- a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C @@ -48,58 +48,29 @@ Foam::IOobject Foam::points0MotionSolver::points0IO(const polyMesh& mesh) IOobject::READ_IF_PRESENT ); - if (instance != mesh.time().constant()) + IOobject io + ( + "points0", + instance, + polyMesh::meshSubDir, + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ); + + // If points0 are located in constant directory, verify their existence + // or fallback to a copy of the original mesh points + if + ( + instance == mesh.time().constant() + && !io.typeHeaderOk() + ) { - // points0 written to a time folder - - return - IOobject - ( - "points0", - instance, - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); + io.rename("points"); } - else - { - // Check that points0 are actually in constant directory - IOobject io - ( - "points0", - instance, - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - - if (io.typeHeaderOk()) - { - return io; - } - else - { - // Copy of original mesh points - - return - IOobject - ( - "points", - instance, - polyMesh::meshSubDir, - mesh, - IOobject::MUST_READ, - IOobject::NO_WRITE, - false - ); - } - } + return io; } From 400cb033c0a0f336b9f8c3a86004bb3aaaaa76ad Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 8 Jul 2019 13:34:16 +0200 Subject: [PATCH 4/6] COMP: erroneous double definition for long IO on windows (#1360, #1238) - mingw uses 32-bit long regardless of -m32 or -m64 setting --- src/OpenFOAM/primitives/ints/int64/int64.H | 4 ++-- src/OpenFOAM/primitives/ints/int64/int64IO.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/primitives/ints/int64/int64.H b/src/OpenFOAM/primitives/ints/int64/int64.H index 095aa0aa21..9b666528b2 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64.H +++ b/src/OpenFOAM/primitives/ints/int64/int64.H @@ -119,10 +119,10 @@ inline bool read(const std::string& str, int64_t& val) Istream& operator>>(Istream& is, int64_t& val); Ostream& operator<<(Ostream& os, const int64_t val); -// On Darwin and Windows (mingw): +// On Darwin: // long is not unambiguously (int32_t | int64_t) // - explicitly resolve for input and output -#if defined(__APPLE__) || defined(_WIN32) +#if defined(__APPLE__) Istream& operator>>(Istream& is, long& val); Ostream& operator<<(Ostream& os, const long val); #endif diff --git a/src/OpenFOAM/primitives/ints/int64/int64IO.C b/src/OpenFOAM/primitives/ints/int64/int64IO.C index add4abb455..4e084aff8a 100644 --- a/src/OpenFOAM/primitives/ints/int64/int64IO.C +++ b/src/OpenFOAM/primitives/ints/int64/int64IO.C @@ -125,7 +125,7 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t val) } -#if defined(__APPLE__) || defined(_WIN32) +#if defined(__APPLE__) Foam::Istream& Foam::operator>>(Istream& is, long& val) { return operator>>(is, reinterpret_cast(val)); From 7360ef7d46bfaaeefbb7acd4eca31fe81b662129 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 8 Jul 2019 13:53:06 +0200 Subject: [PATCH 5/6] COMP: silence spurious GCC -Wstringop-truncation warning in ensightFile --- src/fileFormats/ensight/file/ensightFile.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fileFormats/ensight/file/ensightFile.C b/src/fileFormats/ensight/file/ensightFile.C index 8f9b28d555..ac552d911d 100644 --- a/src/fileFormats/ensight/file/ensightFile.C +++ b/src/fileFormats/ensight/file/ensightFile.C @@ -165,8 +165,15 @@ Foam::Ostream& Foam::ensightFile::write Foam::Ostream& Foam::ensightFile::write(const char* value) { + // Parentheses around strncpy to silence the GCC -Wstringop-truncation + // warning, which is spurious here. + // The max-size and buffer-size *are* identical, which means the buffer + // may not have a nul terminator. However, this is properly handled in + // the subsequent binary write and the ASCII write explicitly adds + // a nul terminator. + char buf[80]; - strncpy(buf, value, 80); // max 80 chars or padded with nul if smaller + (strncpy(buf, value, 80)); // max 80 chars or padded with nul if smaller if (format() == IOstream::BINARY) { From 8f19a127267e344af41243d4ecaed38e6cd1bfaf Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 8 Jul 2019 14:04:49 +0200 Subject: [PATCH 6/6] CONFIG: bump patch level --- META-INFO/api-info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/META-INFO/api-info b/META-INFO/api-info index 4448e7818b..cf3497f429 100644 --- a/META-INFO/api-info +++ b/META-INFO/api-info @@ -1,2 +1,2 @@ api=1906 -patch=0 +patch=190708