Compare commits

...

11 Commits

Author SHA1 Message Date
e5c6ccc3d3 CONFIG: bump patch level 2025-08-14 11:04:56 +02:00
af3c9ebb5e BUG: missed removal of pointMesh/boundaryProcAddressing (fixes #3412) 2025-08-14 11:04:25 +02:00
de413eaf9c ENH: pointConstraint: work in binary mode 2025-08-14 11:04:25 +02:00
07945a519f COMP: resolve label 64 compilation ambiguity for Mingw (fixes #3390)
COMP: restrict HashTable maxTableSize to int32 range

- avoids compiler warning about possible overflow (left-shift
  operation) for label 64 compilations and we don't need anything
  larger than int32 HashTable capacity anyhow.

ENH: make nearest power-of-two non-branching (previously brute-force)
2025-08-14 11:04:25 +02:00
0bb0c1db74 BUG: plicRDF: reconstructing distance func for point neighbours (fixes #3279) 2025-05-28 12:13:52 +01:00
535a4fccb4 Merge branch 'fix-3360-wrong-addressing' into 'master'
BUG: wrong cellZone addressing in uniformityCellZone (fixes #3360)

Closes #3360

See merge request Development/openfoam!738
2025-05-13 10:36:26 +00:00
e1b04cb6a7 BUG: wrong cellZone addressing in uniformityCellZone (fixes #3360)
The mean value, variance and volume fields for each zone were accessed
using the wrong indices
2025-05-13 11:29:18 +03:00
b7ce6bf69d CONFIG: inject -no-recursion into the argument list (#3198)
- sourcing a file with '-no-recursion "$@"' does not work with dash.
  Need to modify the argument list directly.
2025-03-19 15:28:57 +01:00
0a53013499 BUG: foamReport mesh quantities are not parallel (fixes #3338) 2025-03-17 11:53:23 +01:00
47f2ff618d COMP: remove obsolete -fsimdmath flag for ARM64 (#3326) 2025-03-17 09:59:42 +01:00
47575aabf2 COMP: compilation with clang (c++17) and older flex files (fixes #3337)
- The register keyword has been removed from c++17 but old flex
  versions (version < 2.6.0) produce code including it, leading to
  compilation errors when using clang (despite disabling the diagnostic).
  gcc compiles but issues warnings.

- use '#define register' as empty as a workaround
2025-03-17 09:58:20 +01:00
27 changed files with 292 additions and 163 deletions

View File

@ -1,13 +1,15 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
set -- -no-recursion "$@" # Parse arguments only
# Run from OPENFOAM top-level directory only
cd "${0%/*}" || exit
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
echo " Check your OpenFOAM environment and installation"
exit 1
}
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments -no-recursion "$@" || \
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
echo "Argument parse error"
else
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"

View File

@ -1,13 +1,15 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
set -- -no-recursion "$@" # Parse arguments only
# Run from OPENFOAM top-level directory only
cd "${0%/*}" || exit
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
echo " Check your OpenFOAM environment and installation"
exit 1
}
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments -no-recursion "$@" || \
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
echo "Argument parse error"
else
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"

View File

@ -1,2 +1,2 @@
api=2412
patch=0
patch=250814

View File

@ -1,6 +1,7 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
cd "${0%/*}" || exit # Run from this directory
set -- -no-recursion "$@" # Parse arguments only
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2023 OpenCFD Ltd.
Copyright (C) 2017-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -37,11 +37,30 @@ License
using namespace Foam;
void checkCanonicalSize(label size)
{
const auto n = HashTableCore::canonicalSize(size);
std::ostringstream buf;
buf.setf(std::ios_base::hex, std::ios_base::basefield);
buf << n;
Info<< "hash-table size of " << size
<< " = " << n << " (0x" << buf.str().c_str() << ')' << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main()
{
for (label size : { -1, 0, 1, 7, 500, 1024, 1025, 10000, (labelMax-1)} )
{
checkCanonicalSize(size);
}
Info<< nl;
HashTable<scalar> table1
{
{"aaa", 1.0},

View File

@ -62,6 +62,9 @@ Description
// Flex may use register, which is deprecated and incompatible with C++17
#pragma clang diagnostic ignored "-Wdeprecated-register"
// A 'nothing' define to effectively remove from code as well (issue #3337)
#undef register
#define register
using namespace Foam;

View File

@ -56,6 +56,9 @@ Description
// Flex may use register, which is deprecated and incompatible with C++17
#pragma clang diagnostic ignored "-Wdeprecated-register"
// A 'nothing' define to effectively remove from code as well (issue #3337)
#undef register
#define register
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -63,6 +63,9 @@ Description
// Flex may use register, which is deprecated and incompatible with C++17
#pragma clang diagnostic ignored "-Wdeprecated-register"
// A 'nothing' define to effectively remove from code as well (issue #3337)
#undef register
#define register
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -51,6 +51,9 @@ Description
// Flex may use register, which is deprecated and incompatible with C++17
#pragma clang diagnostic ignored "-Wdeprecated-register"
// A 'nothing' define to effectively remove from code as well (issue #3337)
#undef register
#define register
using namespace Foam;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
Copyright (C) 2017-2019 OpenCFD Ltd.
Copyright (C) 2017-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/
#include "HashTableCore.H"
#include "uLabel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -36,51 +35,66 @@ namespace Foam
defineTypeNameAndDebug(HashTableCore, 0);
}
// Approximately labelMax/4
const Foam::label Foam::HashTableCore::maxTableSize(1L << (sizeof(label)*8-3));
// file-scope:
// Minimum internal table size (must be a power of two!)
constexpr int32_t minTableSize = 8;
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::label Foam::HashTableCore::canonicalSize(const label requested_size)
Foam::label Foam::HashTableCore::canonicalSize(const label size) noexcept
{
if (requested_size < 1)
{
return 0;
}
else if (requested_size >= maxTableSize)
{
return maxTableSize;
}
// Enforce power of two for fast modulus in hash index calculations.
// Use unsigned for these calculations.
//
// - The lower limit (8) is somewhat arbitrary, but if the hash table
// is too small, there will be many direct table collisions.
// - The upper limit (approx. labelMax/4) must be a power of two,
// - The upper limit (approx. INT32_MAX/4) must be a power of two,
// need not be extremely large for hashing.
uLabel powerOfTwo = 8u; // lower-limit
const uLabel size = requested_size;
if (size <= powerOfTwo)
if (size <= minTableSize)
{
return powerOfTwo;
return (size < 1 ? 0 : minTableSize);
}
else if (size > maxTableSize/2)
{
return maxTableSize;
}
if (size & (size-1)) // <- Modulus of i^2
{
// Determine power-of-two. Brute-force is fast enough.
while (powerOfTwo < size)
{
powerOfTwo <<= 1;
}
// Determine power-of-two with glibc (may or may not be faster):
//
// return (1 << (32-__builtin_clz(int32_t(size-1))));
return powerOfTwo;
if (!(size & (size-1)))
{
// Already a power-of-two...
return size;
}
return size;
// Non-branching for 32-bit
// [https://graphics.stanford.edu/~seander/bithacks.html]
{
uint32_t n(size);
--n;
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
++n;
return n;
}
// OLD:
// Brute-force method
//
// uint32_t n(minTableSize);
// while (n < uint32_t(size))
// {
// n <<= 1;
// }
// return n;
}

View File

@ -40,7 +40,6 @@ SourceFiles
#define Foam_HashTableCore_H
#include "label.H"
#include "uLabel.H"
#include "className.H"
#include "nullObject.H"
@ -56,11 +55,13 @@ namespace Foam
//- Bits that are independent of HashTable template parameters.
struct HashTableCore
{
//- Maximum allowable internal table size. Approximately labelMax/4
static const label maxTableSize;
//- Maximum allowable internal table size (must be a power of two!).
// - approximately (INT32_MAX/4) => 0x20000000
// - don't need an int64 version
static constexpr int32_t maxTableSize = (1 << (32-3));
//- Return a canonical (power-of-two) of the requested size.
static label canonicalSize(const label requested_size);
static label canonicalSize(const label size) noexcept;
//- Declare type-name (with debug switch)
ClassName("HashTable");

View File

@ -26,12 +26,19 @@ License
\*---------------------------------------------------------------------------*/
#include "pointConstraint.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
const char* const pTraits<pointConstraint>::typeName = "pointConstraint";
defineCompoundTypeName(List<pointConstraint>, pointConstraintList);
addCompoundToRunTimeSelectionTable
(
List<pointConstraint>,
pointConstraintList
);
}
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -64,7 +64,7 @@ MAXMINPOW(float, float, int)
MAXMINPOW(float, int, float)
MAXMINPOW(float, float, long)
MAXMINPOW(float, long, float)
#if defined(__APPLE__) && WM_LABEL_SIZE == 64
#if (WM_LABEL_SIZE == 64) && (defined(__APPLE__) || defined(_WIN32))
MAXMINPOW(double, double, int64_t)
MAXMINPOW(double, int64_t, double)
MAXMINPOW(float, float, int64_t)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2014 OpenFOAM Foundation
Copyright (C) 2019-2023 OpenCFD Ltd.
Copyright (C) 2019-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -433,7 +433,7 @@ inline complex pow(const complex& x, const complex& y)
powFuncs(int)
powFuncs(long)
#if defined(__APPLE__) && WM_LABEL_SIZE == 64
#if (WM_LABEL_SIZE == 64) && (defined(__APPLE__) || defined(_WIN32))
powFuncs(int64_t)
#endif
powFuncs(float)

View File

@ -1,6 +1,7 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
cd "${0%/*}" || exit # Run from this directory
set -- -no-recursion "$@" # Parse arguments only
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------

View File

@ -44,6 +44,9 @@ Description
// Flex may use register, which is deprecated and incompatible with C++17
#pragma clang diagnostic ignored "-Wdeprecated-register"
// A 'nothing' define to effectively remove from code as well (issue #3337)
#undef register
#define register
using namespace Foam;

View File

@ -183,7 +183,8 @@ void Foam::zoneDistribute::setUpCommforZone
Foam::List<Foam::label> Foam::zoneDistribute::getCyclicPatches
(
const label celli,
const label globalIdx
const label globalIdx,
const vector globalIdxCellCentre
) const
{
// Initialise cyclic patch label list
@ -197,26 +198,26 @@ Foam::List<Foam::label> Foam::zoneDistribute::getCyclicPatches
const polyBoundaryMesh& bMesh = mesh_.boundaryMesh();
// Making list of cyclic patches to which celli belongs
List<label> celliCyclicPatches;
forAll(bMesh, patchi)
{
if (isA<cyclicPolyPatch>(bMesh[patchi]))
{
// Note: Probably not efficient due to use of found(celli) but
// typically only used for very few cells (interface cells and their
// point neighbours on cyclic boundaries).
if (bMesh[patchi].faceCells().found(celli))
{
celliCyclicPatches.append(patchi);
}
}
}
// So celli belongs to at least one cyclic patch.
// Let us figure out which.
if (globalNumbering_.isLocal(globalIdx)) // celli and globalIdx on same proc
{
// Making list of cyclic patches to which celli belongs
List<label> celliCyclicPatches;
forAll(bMesh, patchi)
{
if (isA<cyclicPolyPatch>(bMesh[patchi]))
{
// Note: Probably not efficient due to use of found(celli) but
// typically only used for very cells (interface cells and their
// point neighbours on cyclic boundaries).
if (bMesh[patchi].faceCells().found(celli))
{
celliCyclicPatches.append(patchi);
}
}
}
// Get all local point neighbor cells of celli, i.e. all point
// neighbours that are not on the other side of a cyclic patch.
List<label> localPointNeiCells(0);
@ -243,14 +244,14 @@ Foam::List<Foam::label> Foam::zoneDistribute::getCyclicPatches
{
for (const label patchi : celliCyclicPatches)
{
// find the corresponding cyclic neighbor patch ID
// Find the corresponding cyclic neighbor patch ID
const cyclicPolyPatch& cpp =
static_cast<const cyclicPolyPatch&>(bMesh[patchi]);
const label neiPatch = cpp.neighbPatchID();
// Check if the cell globalIdx is on neiPatch.
// If it is, append neiPatch to list of
// If it is, append neiPatch to list of patches to return
if (bMesh[neiPatch].faceCells().found(localIdx))
{
patches.append(neiPatch);
@ -267,75 +268,71 @@ Foam::List<Foam::label> Foam::zoneDistribute::getCyclicPatches
}
else // celli and globalIdx on differet processors
{
// Note: The following is needed if a celli is located at the interface
// (plicRDF), on a cyclic patch and a processor patch. In this case
// globalIdx may be on a different processor, but requires the
// transformation from a cyclic patch on the processor of celli.
List<label> cyclicID(3, -1);
List<vector> separationVectors(3, vector(0,0,0));
scalar distance = GREAT;
const List<label>& faces = mesh_.cells()[celli];
// Loop over all faces of celli and find cyclic patches
for (const label facei : faces)
forAll(celliCyclicPatches, cID)
{
if (mesh_.isInternalFace(facei)) continue;
cyclicID[cID] = celliCyclicPatches[cID];
const label patchi = bMesh.whichPatch(facei);
const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(bMesh[patchi]);
const label& patchI = celliCyclicPatches[cID];
const cyclicPolyPatch& cpp =
static_cast<const cyclicPolyPatch&>(bMesh[patchI]);
if (cpp)
if(cpp.transform() == coupledPolyPatch::transformType::ROTATIONAL)
{
// Get the neighbor cell across the cyclic face
const label cycNeiPatch = cpp->neighbPatchID();
const label cycNeiCell =
bMesh[cycNeiPatch].faceCells()[facei - cpp->start()];
const List<label>& cycNeiCellFaces = mesh_.cells()[cycNeiCell];
FatalErrorInFunction
<< "Rotational cyclic patches are not supported in parallel.\n"
<< "Try to decompose the domain so that the rotational cyclic patch "
<< "is not split in between processors."
<< exit(FatalError);
}
cpp.neighbPatch().transformPosition(separationVectors[cID], 0);
}
// Loop over all the faces of the neighbor cell
for (const label cycNeiCellFace : cycNeiCellFaces)
for(int i = 0; i < 2; i++)
{
for(int j = 0; j < 2; j++)
{
for(int k = 0; k < 2; k++)
{
if (mesh_.isInternalFace(cycNeiCellFace))
vector separation = i*separationVectors[0]
+ j*separationVectors[1]
+ k*separationVectors[2];
scalar testDistance = mag
(
(globalIdxCellCentre - separation)
-
mesh_.C()[celli]
);
if(debug) Info << "testDistance " << testDistance << endl;
if( testDistance < distance )
{
continue;
}
distance = testDistance;
patches = List<label>(0);
List<label> applyCyclic({i,j,k});
// Check if the neighbor cell has processor patches
const label neiPatch = bMesh.whichPatch(cycNeiCellFace);
const processorPolyPatch* ppp =
isA<processorPolyPatch>(bMesh[neiPatch]);
if(debug) Info << "distance " << distance << endl;
if(debug) Info << "separation " << separation << endl;
if(debug) Info << "applyCyclic " << applyCyclic << endl;
if (ppp)
{
// Avoid duplicate entries
if (patches.found(cycNeiPatch))
for(int n = 0; n < 3; n++)
{
continue;
}
// Since we can not access any information on globalIdx
// we use the cell centre map from the stencil to
// identify the cell.
const label localFaceID = cycNeiCellFace - ppp->start();
const vector neiCentre =
ppp->neighbFaceCellCentres()[localFaceID];
forAll(cyclicCentres_()[celli], k)
{
if
(
(
mag(cyclicCentres_()[celli][k] - neiCentre)
< 100*SMALL
)
&& (stencil_[celli][k] == globalIdx)
)
if(cyclicID[n] != -1 && applyCyclic[n] == 1)
{
patches.append(cycNeiPatch);
// Here an alternative might be to append patchi
// and do:
// cpp.transformPosition()
// instead of
// cpp.neighbPatch().transformPosition()
// in getValue()
const cyclicPolyPatch& cpp =
static_cast<const cyclicPolyPatch&>
(
bMesh[cyclicID[n]]
);
if(debug)
{
Info << "cpp.name() " << cpp.name() << endl;
}
patches.append(cpp.neighbPatchID());
}
}
}

View File

@ -186,7 +186,7 @@ public:
//- Finds and returns list of all cyclic patch labels to which celli's
// point neighbour cell, globalIdx, belongs. celli and globalIdx touch
// in at least one point on these patces. globalIdx typically belongs
// in at least one point on these patches. globalIdx typically belongs
// to stencil_[celli]. The returned label list is used to transform
// positions across cyclic boundaries e.g. to be able to calculate
// distances between cell centres and interface centres in plicRDF
@ -194,7 +194,8 @@ public:
List<label> getCyclicPatches
(
const label celli,
const label globalIdx
const label globalIdx,
const vector globalIdxCellCentre
) const;
//- Gives patchNumber and patchFaceNumber for a given

View File

@ -174,7 +174,12 @@ Foam::Map<Foam::Field<Type>> Foam::zoneDistribute::getPositionFields
List<label> cyclicPatches(0);
if(checkTransformation)
{
cyclicPatches = getCyclicPatches(celli, gblIdx);
cyclicPatches = getCyclicPatches
(
celli,
gblIdx,
getValue(phi, neiValues, gblIdx)
);
}
tmpField.append

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2024 OpenCFD Ltd.
Copyright (C) 2024-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,6 +32,7 @@ License
#include "cloud.H"
#include "foamVersion.H"
#include "fvMesh.H"
#include "globalMeshData.H"
#include "IFstream.H"
#include "stringOps.H"
#include "substitutionModel.H"
@ -56,7 +57,7 @@ void Foam::functionObjects::foamReport::setStaticBuiltins()
substitutionModel::addBuiltinStr
(
"OF_PROC_ZERO_DIR",
Pstream::parRun() ? "processor0" : ""
UPstream::parRun() ? "processor0" : ""
);
substitutionModel::addBuiltin("OF_API", foamVersion::api);
@ -72,26 +73,45 @@ void Foam::functionObjects::foamReport::setStaticBuiltins()
substitutionModel::addBuiltinStr("OF_CASE_PATH", argList::envGlobalPath());
substitutionModel::addBuiltinStr("OF_CASE_NAME", time().globalCaseName());
substitutionModel::addBuiltin("OF_NPROCS", Pstream::nProcs());
substitutionModel::addBuiltin("OF_NPROCS", UPstream::nProcs());
// Set mesh builtins when there is only 1 mesh
const auto meshes = time_.lookupClass<fvMesh>();
const auto meshes = time_.csorted<fvMesh>();
if (meshes.size() == 1)
{
const auto& mesh = *(meshes.begin().val());
substitutionModel::addBuiltin("OF_MESH_NCELLS", mesh.nCells());
substitutionModel::addBuiltin("OF_MESH_NFACES", mesh.nFaces());
substitutionModel::addBuiltin("OF_MESH_NEDGES", mesh.nEdges());
substitutionModel::addBuiltin("OF_MESH_NPOINTS", mesh.nPoints());
const auto& mesh = meshes[0];
substitutionModel::addBuiltin
(
"OF_MESH_NCELLS",
mesh.globalData().nTotalCells()
);
substitutionModel::addBuiltin
(
"OF_MESH_NFACES",
mesh.globalData().nTotalFaces()
);
substitutionModel::addBuiltin
(
"OF_MESH_NEDGES",
returnReduce(mesh.nEdges(), sumOp<label>())
);
substitutionModel::addBuiltin
(
"OF_MESH_NPOINTS",
mesh.globalData().nTotalPoints()
);
substitutionModel::addBuiltin
(
"OF_MESH_NINTERNALFACES",
mesh.nInternalFaces()
returnReduce(mesh.nInternalFaces(), sumOp<label>())
);
substitutionModel::addBuiltin
(
"OF_MESH_NBOUNDARYFACES",
mesh.nBoundaryFaces()
// TBD: use mesh.boundaryMesh().nNonProcessorFaces() ?
returnReduce(mesh.nBoundaryFaces(), sumOp<label>())
);
substitutionModel::addBuiltin
(
@ -123,8 +143,8 @@ void Foam::functionObjects::foamReport::setDynamicBuiltins()
substitutionModel::setBuiltinStr("OF_DATE_NOW", clock::date());
substitutionModel::setBuiltinStr("OF_CLOCK_NOW", clock::clockTime());
substitutionModel::setBuiltin("OF_NREGIONS", time().names<fvMesh>().size());
substitutionModel::setBuiltin("OF_NCLOUDS", time().names<cloud>().size());
substitutionModel::setBuiltin("OF_NREGIONS", time().count<fvMesh>());
substitutionModel::setBuiltin("OF_NCLOUDS", time().count<cloud>());
}

View File

@ -5,8 +5,8 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2007-2023 PCOpt/NTUA
Copyright (C) 2013-2023 FOSS GP
Copyright (C) 2007-2025 PCOpt/NTUA
Copyright (C) 2013-2025 FOSS GP
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -118,11 +118,11 @@ scalar objectiveUniformityCellZone::J()
const volVectorField& U = vars_.UInst();
const scalarField& V = mesh_.V().field();
for (const label zI : zones_)
forAll(zones_, zI)
{
const cellZone& zoneI = mesh_.cellZones()[zI];
scalarField VZone(V, zoneI);
vectorField UZone(U.primitiveField(), zoneI);
const cellZone& cz = mesh_.cellZones()[zones_[zI]];
scalarField VZone(V, cz);
vectorField UZone(U.primitiveField(), cz);
volZone_[zI] = gSum(VZone);
UMean_[zI] = gSum(UZone*VZone)/volZone_[zI];
UVar_[zI] = gSum(magSqr(UZone - UMean_[zI])*VZone)/volZone_[zI];
@ -138,10 +138,10 @@ void objectiveUniformityCellZone::update_dJdv()
{
const volVectorField& U = vars_.U();
for (const label zI : zones_)
forAll(zones_, zI)
{
const cellZone& zoneI = mesh_.cellZones()[zI];
for (const label cellI : zoneI)
const cellZone& cz = mesh_.cellZones()[zones_[zI]];
for (const label cellI : cz)
{
dJdvPtr_()[cellI] = (U[cellI] - UMean_[zI])/volZone_[zI];
}
@ -154,10 +154,10 @@ void objectiveUniformityCellZone::update_divDxDbMultiplier()
volScalarField& divDxDbMult = divDxDbMultPtr_();
const volVectorField& U = vars_.U();
for (const label zI : zones_)
forAll(zones_, zI)
{
const cellZone& zoneI = mesh_.cellZones()[zI];
for (const label cellI : zoneI)
const cellZone& cz = mesh_.cellZones()[zones_[zI]];
for (const label cellI : cz)
{
divDxDbMult[cellI] =
0.5*(magSqr(U[cellI] - UMean_[zI]) - UVar_[zI])/volZone_[zI];

View File

@ -1,6 +1,7 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
cd "${0%/*}" || exit # Run from this directory
set -- -no-recursion "$@" # Parse arguments only
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_scotch

View File

@ -306,8 +306,8 @@ void Foam::processorMeshes::removeFiles(const polyMesh& mesh)
// pointMesh/boundary
fileHandler().rm(fileHandler().filePath(pointIO.objectPath()));
// boundaryProcAddressing
io.rename("boundaryProcAddressing");
// pointMesh/boundaryProcAddressing
pointIO.rename("boundaryProcAddressing");
fileHandler().rm(fileHandler().filePath(pointIO.objectPath()));
}

View File

@ -39,6 +39,9 @@ License
// Flex may use register, which is deprecated and incompatible with C++17
#pragma clang diagnostic ignored "-Wdeprecated-register"
// A 'nothing' define to effectively remove from code as well (issue #3337)
#undef register
#define register
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -260,7 +260,7 @@ const Foam::volScalarField& Foam::reconstructedDistanceFunction::constructRDF
const labelListList& stencil = distribute.getStencil();
forAll(nextToInterface,celli)
forAll(nextToInterface, celli)
{
if (nextToInterface[celli])
{
@ -289,7 +289,17 @@ const Foam::volScalarField& Foam::reconstructedDistanceFunction::constructRDF
centre,
mapCentres,
gblIdx,
distribute.getCyclicPatches(celli, gblIdx)
distribute.getCyclicPatches
(
celli,
gblIdx,
distribute.getValue
(
centre,
mapCentres,
gblIdx
)
)
)
);
vector distanceToIntSeg(c - p);
@ -341,7 +351,12 @@ const Foam::volScalarField& Foam::reconstructedDistanceFunction::constructRDF
forAll(stencil[pCellI], j)
{
const label gblIdx = stencil[pCellI][j];
vector n = -distribute.getValue(normal, mapNormal, gblIdx);
vector n = -distribute.getValue
(
normal,
mapNormal,
gblIdx
);
if (mag(n) != 0)
{
n /= mag(n);
@ -352,7 +367,17 @@ const Foam::volScalarField& Foam::reconstructedDistanceFunction::constructRDF
centre,
mapCentres,
gblIdx,
distribute.getCyclicPatches(pCellI, gblIdx)
distribute.getCyclicPatches
(
pCellI,
gblIdx,
distribute.getValue
(
centre,
mapCentres,
gblIdx
)
)
)
);
vector distanceToIntSeg(c - p);

View File

@ -103,7 +103,12 @@ void Foam::reconstruction::plicRDF::interpolateNormal()
centre_,
mapCentre,
gblIdx,
exchangeFields.getCyclicPatches(celli, gblIdx)
exchangeFields.getCyclicPatches
(
celli,
gblIdx,
exchangeFields.getValue(mesh_.C(), mapCC, gblIdx)
)
)
);
vector distanceToIntSeg = (tensor::I- n*n) & (p - centre);
@ -157,7 +162,12 @@ void Foam::reconstruction::plicRDF::interpolateNormal()
exchangeFields.getPosition
(
mesh_.C(), mapCC, gblIdx,
exchangeFields.getCyclicPatches(celli, gblIdx)
exchangeFields.getCyclicPatches
(
celli,
gblIdx,
exchangeFields.getValue(mesh_.C(), mapCC, gblIdx)
)
)
);
alphaValues.append
@ -208,7 +218,12 @@ void Foam::reconstruction::plicRDF::gradSurf(const volScalarField& phi)
exchangeFields.getPosition
(
mesh_.C(), mapCC, gblIdx,
exchangeFields.getCyclicPatches(celli, gblIdx)
exchangeFields.getCyclicPatches
(
celli,
gblIdx,
exchangeFields.getValue(mesh_.C(), mapCC, gblIdx)
)
)
);
phiValues.append

View File

@ -1,2 +1,2 @@
c++DBUG =
c++OPT = -ffp-contract=fast -ffast-math -O3 -funsafe-math-optimizations -fsimdmath -armpl
c++OPT = -ffp-contract=fast -ffast-math -O3 -funsafe-math-optimizations -armpl