Compare commits
6 Commits
feature-fv
...
feature-su
| Author | SHA1 | Date | |
|---|---|---|---|
| 99a3f10729 | |||
| 0fa124af45 | |||
| b7ce6bf69d | |||
| 0a53013499 | |||
| 47f2ff618d | |||
| 47575aabf2 |
@ -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"
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -53,6 +53,7 @@ Description
|
||||
#include "pointSet.H"
|
||||
#include "ReadFields.H"
|
||||
#include "processorMeshes.H"
|
||||
#include "IOmapDistributePolyMesh.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -369,6 +370,11 @@ int main(int argc, char *argv[])
|
||||
"Subset with cellZone(s) instead of cellSet."
|
||||
" The command argument may be a list of words or regexs"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"no-map",
|
||||
"Suppress writing of map."
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"resultTime",
|
||||
@ -393,6 +399,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const bool useCellZone = args.found("zone");
|
||||
const bool overwrite = args.found("overwrite");
|
||||
const bool noMap = args.found("no-map");
|
||||
const bool specifiedInstance = args.readIfPresent
|
||||
(
|
||||
"resultTime",
|
||||
@ -663,8 +670,6 @@ int main(int argc, char *argv[])
|
||||
Info<< "Writing subsetted mesh and fields to time " << runTime.timeName()
|
||||
<< endl;
|
||||
subsetter.subMesh().write();
|
||||
processorMeshes::removeFiles(subsetter.subMesh());
|
||||
|
||||
auto* subPointMeshPtr =
|
||||
subsetter.subMesh().thisDb().findObject<pointMesh>
|
||||
(
|
||||
@ -676,6 +681,115 @@ int main(int argc, char *argv[])
|
||||
subPointMesh.setInstance(subsetter.subMesh().facesInstance());
|
||||
subPointMesh.write();
|
||||
}
|
||||
processorMeshes::removeFiles(subsetter.subMesh());
|
||||
|
||||
|
||||
if (!noMap)
|
||||
{
|
||||
const auto& subMesh = subsetter.subMesh();
|
||||
const auto& pbm = mesh.boundaryMesh();
|
||||
labelList patchStarts(pbm.size());
|
||||
labelList patchNMeshPoints(pbm.size());
|
||||
for (const auto& pp : pbm)
|
||||
{
|
||||
patchStarts[pp.index()] = pp.start();
|
||||
patchNMeshPoints[pp.index()] = pp.nPoints();
|
||||
}
|
||||
|
||||
const label myProcNo = UPstream::myProcNo(mesh.comm());
|
||||
|
||||
// cellMap
|
||||
labelListList cellSubMap(UPstream::nProcs(mesh.comm()));
|
||||
cellSubMap[myProcNo] = subsetter.cellMap();
|
||||
labelListList cellConstructMap(UPstream::nProcs(mesh.comm()));
|
||||
cellConstructMap[myProcNo] = identity(subMesh.nCells());
|
||||
mapDistribute cellMap
|
||||
(
|
||||
subMesh.nCells(),
|
||||
std::move(cellSubMap),
|
||||
std::move(cellConstructMap),
|
||||
false,
|
||||
false,
|
||||
mesh.comm()
|
||||
);
|
||||
|
||||
// faceMap
|
||||
labelListList faceSubMap(UPstream::nProcs(mesh.comm()));
|
||||
faceSubMap[myProcNo] = subsetter.faceMap();
|
||||
labelListList faceConstructMap(UPstream::nProcs(mesh.comm()));
|
||||
faceConstructMap[myProcNo] = identity(subMesh.nFaces());
|
||||
mapDistribute faceMap
|
||||
(
|
||||
subMesh.nFaces(),
|
||||
std::move(faceSubMap),
|
||||
std::move(faceConstructMap),
|
||||
false,
|
||||
false,
|
||||
mesh.comm()
|
||||
);
|
||||
|
||||
// pointMap
|
||||
labelListList pointSubMap(UPstream::nProcs(mesh.comm()));
|
||||
pointSubMap[myProcNo] = subsetter.pointMap();
|
||||
labelListList pointConstructMap(UPstream::nProcs(mesh.comm()));
|
||||
pointConstructMap[myProcNo] = identity(subMesh.nPoints());
|
||||
mapDistribute pointMap
|
||||
(
|
||||
subMesh.nPoints(),
|
||||
std::move(pointSubMap),
|
||||
std::move(pointConstructMap),
|
||||
false,
|
||||
false,
|
||||
mesh.comm()
|
||||
);
|
||||
|
||||
// patchMap
|
||||
labelListList patchSubMap(UPstream::nProcs(mesh.comm()));
|
||||
patchSubMap[myProcNo] = identity(pbm.size());
|
||||
labelListList patchConstructMap(UPstream::nProcs(mesh.comm()));
|
||||
patchConstructMap[myProcNo] = identity(pbm.size()); // or subMesh?
|
||||
mapDistribute patchMap
|
||||
(
|
||||
subMesh.nPoints(),
|
||||
std::move(patchSubMap),
|
||||
std::move(patchConstructMap),
|
||||
false,
|
||||
false,
|
||||
mesh.comm()
|
||||
);
|
||||
|
||||
mapDistributePolyMesh map
|
||||
(
|
||||
mesh.nPoints(), // old points
|
||||
mesh.nFaces(), // old faces
|
||||
mesh.nCells(), // old cells
|
||||
|
||||
std::move(patchStarts),
|
||||
std::move(patchNMeshPoints),
|
||||
|
||||
std::move(pointMap),
|
||||
std::move(faceMap),
|
||||
std::move(cellMap),
|
||||
std::move(patchMap)
|
||||
);
|
||||
|
||||
|
||||
const IOobject io
|
||||
(
|
||||
"parentMeshAddressing",
|
||||
subMesh.facesInstance(),
|
||||
fvMesh::meshSubDir,
|
||||
subMesh.thisDb(),
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
);
|
||||
|
||||
Info<< "Writing map from subsetted to original mesh to "
|
||||
<< io.objectRelPath() << endl;
|
||||
|
||||
IOmapDistributePolyMeshRef(io, map).write();
|
||||
}
|
||||
|
||||
|
||||
// Volume fields
|
||||
|
||||
@ -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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -51,6 +51,26 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::refPtr<Foam::fvMesh>
|
||||
Foam::fvMesh::parentMesh(const objectRegistry& obr) const
|
||||
{
|
||||
const fvMesh* meshPtr = isA<fvMesh>(obr);
|
||||
|
||||
if (meshPtr)
|
||||
{
|
||||
return refPtr<fvMesh>(*meshPtr);
|
||||
}
|
||||
else if (obr.isTimeDb())
|
||||
{
|
||||
return refPtr<fvMesh>();
|
||||
}
|
||||
else
|
||||
{
|
||||
return parentMesh(obr.parent());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::fvMesh::clearGeomNotOldVol()
|
||||
{
|
||||
meshObject::clearUpto
|
||||
|
||||
@ -164,6 +164,9 @@ protected:
|
||||
void makeCf() const;
|
||||
|
||||
|
||||
//- Helper: search for parent mesh
|
||||
refPtr<fvMesh> parentMesh(const objectRegistry& obr) const;
|
||||
|
||||
//- No copy construct
|
||||
fvMesh(const fvMesh&) = delete;
|
||||
|
||||
|
||||
@ -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>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -705,6 +705,8 @@ bool Foam::faceAreaWeightAMI::calculate
|
||||
srcCentroids_[i].transfer(srcCtr[i]);
|
||||
}
|
||||
|
||||
tgtAddress_.setSize(tgtAddr.size());
|
||||
tgtWeights_.setSize(tgtWght.size());
|
||||
forAll(tgtAddr, i)
|
||||
{
|
||||
tgtAddress_[i].transfer(tgtAddr[i]);
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user