Compare commits
176 Commits
feature-am
...
maintenanc
| Author | SHA1 | Date | |
|---|---|---|---|
| faf46536c1 | |||
| 9bfe826442 | |||
| 0a363f2885 | |||
| a797ac8193 | |||
| 1cb61b90e7 | |||
| 52b530fb82 | |||
| b9335f4989 | |||
| 8a508910ba | |||
| d6df40a5e2 | |||
| 69b2a667c9 | |||
| be01ca7888 | |||
| 630d60de3b | |||
| 2390ebbf7e | |||
| 510d9fc5a5 | |||
| c6399ca920 | |||
| cdc1a34bab | |||
| fa49ae252b | |||
| 0b9391ff3b | |||
| 7bdc000865 | |||
| ac099d82eb | |||
| fb96927275 | |||
| ab5f6dbf41 | |||
| 7c45670c8b | |||
| 58aa8c97c2 | |||
| 9f4bb2d432 | |||
| 24ac8308b3 | |||
| 0e23e6c66c | |||
| 21c554d7d0 | |||
| 391f059335 | |||
| 5873ec1b22 | |||
| bb483951b7 | |||
| 7b5e605b29 | |||
| 732872b9cc | |||
| c6501b799e | |||
| 93ee308ebf | |||
| 9d6b8a9c28 | |||
| 530a5192ca | |||
| d859f7b00f | |||
| 2ef96e9e43 | |||
| baa8dccb0a | |||
| 5059e1ddec | |||
| dced6c581e | |||
| 3e64faf605 | |||
| 3083c32c35 | |||
| 51a34f5abc | |||
| f48e617cd2 | |||
| 1b825b4470 | |||
| 199a9801ca | |||
| f6ba6bc40e | |||
| bf9b9204c3 | |||
| 06ee000cb8 | |||
| d3861a5dcc | |||
| 8950c9b0c6 | |||
| a0fea418e2 | |||
| 1bce1e44c4 | |||
| 440cb83fa7 | |||
| b2532e7769 | |||
| 790de0f98e | |||
| cf5eaef236 | |||
| d148816bfe | |||
| f7291c4550 | |||
| eea442e209 | |||
| 755d354f69 | |||
| d71b3c4633 | |||
| de39878b9b | |||
| 274fee92dd | |||
| 64c15e179a | |||
| 1bcb90bf79 | |||
| 4deb146118 | |||
| a87763f6a6 | |||
| c61466b6e5 | |||
| 323149ad24 | |||
| e9cf0fba05 | |||
| 2d52ee13b1 | |||
| 5015883c01 | |||
| 74e118dd32 | |||
| 01f501e8e7 | |||
| 60ffaba71d | |||
| 056bb4f0a0 | |||
| 30d2e2d3cf | |||
| c07997d816 | |||
| 495fa6c577 | |||
| dfc9a8923a | |||
| ee895577ae | |||
| 9f032057b4 | |||
| 10b0c3cfca | |||
| 773548c283 | |||
| 9335b641f1 | |||
| ffc9894033 | |||
| 1406f9ec26 | |||
| b81fe70830 | |||
| bbde236be5 | |||
| 3b9176665f | |||
| 6a80d4de40 | |||
| 3f1d181b42 | |||
| 8d649d1737 | |||
| 21a84bdf91 | |||
| 1ad1957c41 | |||
| 4510067e63 | |||
| 8cf757daf0 | |||
| 6581c5792a | |||
| 03fb8f043e | |||
| 45ec64e6c8 | |||
| eb17ff1ea3 | |||
| a7538fab57 | |||
| 4fb85d1f76 | |||
| d9c73ae489 | |||
| e15d696a24 | |||
| dbfd1f90b1 | |||
| 883196981d | |||
| 3fed41547f | |||
| e22edc5dee | |||
| 0ef7589979 | |||
| 7dc9ccdcaa | |||
| b2bbc15463 | |||
| 7b38b148fa | |||
| 7f355ba343 | |||
| e1d45ec26e | |||
| 690d02f9e8 | |||
| 31b74cd627 | |||
| f04ccef588 | |||
| 8a8b5db977 | |||
| 5fb1181bb2 | |||
| 411ac5fcfa | |||
| 880215e8e6 | |||
| 3874c1312e | |||
| 09377471a3 | |||
| 2889dc7248 | |||
| d75c60d8ae | |||
| 582b613d5f | |||
| 6cce1cdc8b | |||
| b6203a7de5 | |||
| 701c916764 | |||
| d1c4a225a2 | |||
| 4cfa2ea304 | |||
| b5435cc83e | |||
| 1d5b95b5fe | |||
| 31aadc5c4d | |||
| a803516b16 | |||
| 1b212789e5 | |||
| 688fd5f3f1 | |||
| 75e19c3116 | |||
| 16dd92b38e | |||
| 92c329a8a9 | |||
| 6546dd3f5b | |||
| 752ab418c9 | |||
| d578d48a4f | |||
| 85771c8985 | |||
| 68c5d90ad0 | |||
| 0dcc53ab03 | |||
| 6ac572a179 | |||
| 7fd962926d | |||
| bca093d89c | |||
| 0ef981adbc | |||
| 2d61127606 | |||
| e099e98b8b | |||
| 2ff67f8ce4 | |||
| 13f66313d1 | |||
| 483075b4aa | |||
| 1668519996 | |||
| 5091c79e96 | |||
| 6bd1486a38 | |||
| 93f6cae46a | |||
| 68e36946fd | |||
| c6ecf3113a | |||
| 46e1b00c34 | |||
| a431e0fe9a | |||
| 6d69506294 | |||
| 77ec7ab679 | |||
| 6692ecfbbc | |||
| 3ef892b980 | |||
| e651d63566 | |||
| a7d6f2720f | |||
| 4a0a63999e | |||
| b1eb3e8746 | |||
| bc03a538cf |
@ -49,10 +49,10 @@
|
||||
|
||||
<!--
|
||||
Providing details of your set-up can help us identify any issues, e.g.
|
||||
OpenFOAM version : v2312|v2306|v2212|v2206|v2112 etc
|
||||
Operating system : ubuntu|openSUSE|centos etc
|
||||
OpenFOAM version : v2406|v2312|v2306|v2212|v2206 etc
|
||||
Operating system : ubuntu|openSUSE|RedHat etc
|
||||
Hardware info : any info that may help?
|
||||
Compiler : gcc|intel|clang etc
|
||||
Compiler : gcc|clang etc
|
||||
-->
|
||||
|
||||
- OpenFOAM version :
|
||||
|
||||
9
.gitmodules
vendored
9
.gitmodules
vendored
@ -1,8 +1,8 @@
|
||||
[submodule "cfmesh"]
|
||||
path = modules/cfmesh
|
||||
path = plugins/cfmesh
|
||||
url = https://develop.openfoam.com/Community/integration-cfmesh.git
|
||||
[submodule "avalanche"]
|
||||
path = modules/avalanche
|
||||
path = plugins/avalanche
|
||||
url = https://develop.openfoam.com/Community/avalanche.git
|
||||
[submodule "adios"]
|
||||
path = modules/adios
|
||||
@ -18,5 +18,8 @@
|
||||
path = modules/external-solver
|
||||
url = https://develop.openfoam.com/Modules/external-solver.git
|
||||
[submodule "turbulence-community"]
|
||||
path = modules/turbulence-community
|
||||
path = plugins/turbulence-community
|
||||
url = https://gitlab.com/openfoam/community/tc-turbulence/turbulence-community.git
|
||||
[submodule "plugins/data-community"]
|
||||
path = plugins/data-community
|
||||
url = https://gitlab.com/openfoam/community/sig-data-modelling/data-community.git
|
||||
|
||||
17
Allwmake
17
Allwmake
@ -68,19 +68,34 @@ src/Allwmake $targetType $*
|
||||
# OpenFOAM applications
|
||||
applications/Allwmake $targetType $*
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Additional components
|
||||
|
||||
# Additional components/modules
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
(false | none)
|
||||
echo ========================================
|
||||
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||
echo "Can be built separately:"
|
||||
echo
|
||||
echo " ./Allwmake-modules -prefix=..."
|
||||
echo
|
||||
echo ========================================
|
||||
echo
|
||||
;;
|
||||
(*)
|
||||
# Use wmake -all instead of Allwmake to allow for overrides
|
||||
( cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all )
|
||||
|
||||
echo ========================================
|
||||
echo "The optional plugins can be built separately:"
|
||||
echo
|
||||
echo " ./Allwmake-plugins -prefix=..."
|
||||
echo
|
||||
echo ========================================
|
||||
echo
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Count files in given directory. Ignore "Test-*" binaries.
|
||||
_foamCountDirEntries()
|
||||
{
|
||||
|
||||
39
Allwmake-modules
Executable file
39
Allwmake-modules
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
set -- -no-recursion "$@" # Parse arguments only
|
||||
|
||||
# Run from OPENFOAM top-level directory only
|
||||
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 || \
|
||||
echo "Argument parse error"
|
||||
else
|
||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Additional components
|
||||
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
(false | none)
|
||||
echo ========================================
|
||||
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||
echo "Can be built separately:"
|
||||
echo
|
||||
echo " ./Allwmake-modules -prefix=..."
|
||||
echo
|
||||
echo ========================================
|
||||
echo
|
||||
;;
|
||||
(*)
|
||||
# Use wmake -all instead of Allwmake to allow for overrides
|
||||
( cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all )
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
39
Allwmake-plugins
Executable file
39
Allwmake-plugins
Executable file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
set -- -no-recursion "$@" # Parse arguments only
|
||||
|
||||
# Run from OPENFOAM top-level directory only
|
||||
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 || \
|
||||
echo "Argument parse error"
|
||||
else
|
||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Additional components
|
||||
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
(false | none)
|
||||
echo ========================================
|
||||
echo "OpenFOAM plugins disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||
echo "Can be built separately:"
|
||||
echo
|
||||
echo " ./Allwmake-plugins -prefix=..."
|
||||
echo
|
||||
echo ========================================
|
||||
echo
|
||||
;;
|
||||
(*)
|
||||
# Use wmake -all instead of Allwmake to allow for overrides
|
||||
( cd "$WM_PROJECT_DIR/plugins" 2>/dev/null && wmake -all )
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,2 +1,2 @@
|
||||
api=2401
|
||||
patch=240220
|
||||
api=2406
|
||||
patch=241212
|
||||
|
||||
16
README.md
16
README.md
@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
|
||||
|
||||
If OpenFOAM has already been compiled on your system, simply source
|
||||
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
|
||||
For example, for the OpenFOAM-v2312 version:
|
||||
For example, for the OpenFOAM-v2406 version:
|
||||
```
|
||||
source /installation/path/OpenFOAM-v2312/etc/bashrc
|
||||
source /installation/path/OpenFOAM-v2406/etc/bashrc
|
||||
```
|
||||
|
||||
## Compiling OpenFOAM
|
||||
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
|
||||
to the OpenFOAM directory. For example,
|
||||
```
|
||||
/path/parent
|
||||
|-- OpenFOAM-v2312
|
||||
\-- ThirdParty-v2312
|
||||
|-- OpenFOAM-v2406
|
||||
\-- ThirdParty-v2406
|
||||
```
|
||||
There are, however, many cases where this simple convention is inadequate:
|
||||
|
||||
@ -136,7 +136,7 @@ There are, however, many cases where this simple convention is inadequate:
|
||||
operating system or cluster installation provides it)
|
||||
|
||||
* When we have changed the OpenFOAM directory name to some arbitrary
|
||||
directory name, e.g. openfoam-sandbox2312, etc..
|
||||
directory name, e.g. openfoam-sandbox2406, etc..
|
||||
|
||||
* When we would like any additional 3rd party software to be located
|
||||
inside of the OpenFOAM directory to ensure that the installation is
|
||||
@ -156,9 +156,9 @@ when locating the ThirdParty directory with the following precedence:
|
||||
2. PREFIX/ThirdParty-VERSION
|
||||
* this corresponds to the traditional approach
|
||||
3. PREFIX/ThirdParty-vAPI
|
||||
* allows for an updated value of VERSION, *eg*, `v2312-myCustom`,
|
||||
* allows for an updated value of VERSION, *eg*, `v2406-myCustom`,
|
||||
without requiring a renamed ThirdParty. The API value would still
|
||||
be `2312` and the original `ThirdParty-v2312/` would be found.
|
||||
be `2406` and the original `ThirdParty-v2406/` would be found.
|
||||
4. PREFIX/ThirdParty-API
|
||||
* same as the previous example, but using an unadorned API value.
|
||||
5. PREFIX/ThirdParty-common
|
||||
@ -213,4 +213,4 @@ ThirdParty directory will contain either an `Allwmake` file or a
|
||||
- [Governance](http://www.openfoam.com/governance/), [Governance Projects](https://www.openfoam.com/governance/projects)
|
||||
- [Contacting OpenCFD](http://www.openfoam.com/contact/)
|
||||
|
||||
Copyright 2016-2023 OpenCFD Ltd
|
||||
Copyright 2016-2024 OpenCFD Ltd
|
||||
|
||||
@ -21,6 +21,11 @@
|
||||
+ fvOptions(rho, he)
|
||||
);
|
||||
|
||||
if (MRF.active())
|
||||
{
|
||||
EEqn += fvc::div(MRF.phi(), p);
|
||||
}
|
||||
|
||||
EEqn.relax();
|
||||
|
||||
fvOptions.constrain(EEqn);
|
||||
|
||||
@ -20,6 +20,11 @@
|
||||
fvOptions(rho, he)
|
||||
);
|
||||
|
||||
if (MRF.active())
|
||||
{
|
||||
EEqn += fvc::div(MRF.phi(), p);
|
||||
}
|
||||
|
||||
EEqn.relax();
|
||||
|
||||
fvOptions.constrain(EEqn);
|
||||
|
||||
@ -14,6 +14,11 @@
|
||||
fvOptions(rho, he)
|
||||
);
|
||||
|
||||
if (MRF.active())
|
||||
{
|
||||
EEqn += fvc::div(MRF.phi(), p);
|
||||
}
|
||||
|
||||
EEqn.relax();
|
||||
|
||||
fvOptions.constrain(EEqn);
|
||||
|
||||
@ -9,6 +9,11 @@
|
||||
fvOptions(rho, e)
|
||||
);
|
||||
|
||||
if (MRF.active())
|
||||
{
|
||||
EEqn += fvc::div(MRF.phi(), p);
|
||||
}
|
||||
|
||||
EEqn.relax();
|
||||
|
||||
fvOptions.constrain(EEqn);
|
||||
|
||||
@ -130,10 +130,17 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
#include "UEqn.H"
|
||||
|
||||
#include "YEqns.H"
|
||||
#include "TEqn.H"
|
||||
|
||||
if (pimple.frozenFlow())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -188,8 +188,6 @@ int main(int argc, char *argv[])
|
||||
argList::addBoolOption("label", "Use label for tests (default)");
|
||||
argList::addBoolOption("ref", "Test writing by ref");
|
||||
|
||||
#include "addTimeOptions.H"
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createPolyMesh.H"
|
||||
@ -280,7 +278,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
IOFieldRef<vector>(ioOutput, mesh.points()).write();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-OCountStream.C
|
||||
Test-OCountStream.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-OCountStream
|
||||
|
||||
@ -65,11 +65,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
OCountStream cnt;
|
||||
OCharStream cstr;
|
||||
OStringStream str;
|
||||
OStringStream sstr;
|
||||
ocountstream plain;
|
||||
|
||||
generateOutput(cstr);
|
||||
generateOutput(str);
|
||||
generateOutput(sstr);
|
||||
generateOutput(cnt);
|
||||
generateOutput(plain);
|
||||
|
||||
@ -77,7 +77,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "counter state: " << (cnt.stdStream().rdstate()) << nl
|
||||
<< "via char-stream: " << label(cstr.view().size()) << " chars" << nl
|
||||
<< "via string-stream: " << str.str().size() << " chars" << nl
|
||||
<< "via string-stream: " << label(sstr.count()) << " chars" << nl
|
||||
<< "via ocountstream: " << plain.count() << " chars" << endl;
|
||||
|
||||
fileName outputName;
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,10 +32,14 @@ Description
|
||||
#include "IOstreams.H"
|
||||
#include "OSspecific.H"
|
||||
#include "argList.H"
|
||||
#include "clock.H"
|
||||
#include "Switch.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
std::string time_stamp;
|
||||
|
||||
void listFiles(const fileName& dir)
|
||||
{
|
||||
wordList files = ListOps::create<word>
|
||||
@ -55,25 +59,150 @@ void listFiles(const fileName& dir)
|
||||
}
|
||||
|
||||
|
||||
OSstream& printInfo(OFstream& os)
|
||||
{
|
||||
InfoErr
|
||||
<< "open: " << os.name() << nl
|
||||
<< "appending: " << Switch::name(os.is_appending())
|
||||
<< " tellp: "<< os.stdStream().tellp()
|
||||
<< " gz: " << Switch::name(os.compression()) << nl;
|
||||
|
||||
return InfoErr.stream();
|
||||
}
|
||||
|
||||
|
||||
void withHeader(OFstream& os)
|
||||
{
|
||||
const auto tellp = os.stdStream().tellp();
|
||||
|
||||
if (tellp <= 0)
|
||||
{
|
||||
InfoErr
|
||||
<< "Add header" << nl;
|
||||
os << "HEADER: " << time_stamp.c_str() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class OSstreamType>
|
||||
void generateLines(OSstreamType& os, label count = 1)
|
||||
{
|
||||
for (label line = 1; line <= count; ++line)
|
||||
{
|
||||
os << "[" << line
|
||||
<< "] =============================================" << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class OSstreamType>
|
||||
void generateContent
|
||||
(
|
||||
OSstreamType& os,
|
||||
const bool with_seekend,
|
||||
const bool test_overwrite = false,
|
||||
const int64_t seek_out = -1
|
||||
)
|
||||
{
|
||||
if (with_seekend)
|
||||
{
|
||||
os.stdStream().seekp(0, std::ios_base::end);
|
||||
// OR? os.seek_end();
|
||||
}
|
||||
|
||||
printInfo(os);
|
||||
|
||||
withHeader(os);
|
||||
|
||||
if (test_overwrite && seek_out >= 0)
|
||||
{
|
||||
InfoErr<< "... seekp(" << seek_out << ")" << nl;
|
||||
|
||||
auto& oss = os.stdStream();
|
||||
|
||||
// Actually std::streampos, but cannot increment that
|
||||
|
||||
int64_t pos(seek_out);
|
||||
|
||||
const int64_t tellp_end = oss.tellp();
|
||||
|
||||
if (pos >= 0 && pos < tellp_end)
|
||||
{
|
||||
InfoErr
|
||||
<< "... fill from " << label(pos)
|
||||
<< " to " << label(tellp_end) << nl;
|
||||
|
||||
oss.seekp(pos);
|
||||
|
||||
while (pos < tellp_end)
|
||||
{
|
||||
// Fill with char 'X', rely on streambuf buffering
|
||||
oss << 'X';
|
||||
++pos;
|
||||
}
|
||||
|
||||
oss.seekp(seek_out);
|
||||
os << "More content [at " << seek_out << ']' << endl;
|
||||
}
|
||||
}
|
||||
|
||||
generateLines(os, 4);
|
||||
|
||||
printInfo(os)
|
||||
<< "... sleep" << endl;
|
||||
|
||||
listFiles(os.name().path());
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "[new content] +++++++++++++++++++++++++++++++++++" << endl;
|
||||
}
|
||||
|
||||
|
||||
template<class OSstreamType>
|
||||
void generateOverwriteContent
|
||||
(
|
||||
OSstreamType& os,
|
||||
const bool with_seekend,
|
||||
const int64_t seek_out = -1
|
||||
)
|
||||
{
|
||||
generateContent(os, with_seekend, true, seek_out);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption("gz", "Use compression");
|
||||
argList::addBoolOption("append", "Use append mode");
|
||||
argList::addBoolOption("append-app", "Use append app mode");
|
||||
argList::addBoolOption("append-ate", "Use append ate mode");
|
||||
argList::addBoolOption("seekend", "Seek to end after non-append open");
|
||||
argList::addOption("seek", "value", "Seek from start (default: 100)");
|
||||
argList::addBoolOption("atomic", "Use atomic");
|
||||
argList::addBoolOption("keep", "Do not remove test directory");
|
||||
argList::addOption("write", "file", "test writing to file");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
// Same time-stamp for all generated files
|
||||
time_stamp = clock::dateTime();
|
||||
|
||||
const fileName baseDir("Test-OFstream-directory");
|
||||
|
||||
Foam::mkDir(baseDir);
|
||||
|
||||
InfoErr<< "mkdir: " << baseDir << endl;
|
||||
|
||||
Info<< "start:" << nl;
|
||||
listFiles(baseDir);
|
||||
|
||||
const bool with_seekend = args.found("seekend");
|
||||
|
||||
const int seek_out = args.getOrDefault<int>("seek", 100);
|
||||
|
||||
IOstreamOption streamOpt;
|
||||
|
||||
if (args.found("gz"))
|
||||
@ -83,10 +212,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
IOstreamOption::appendType append =
|
||||
(
|
||||
args.found("append")
|
||||
? IOstreamOption::APPEND
|
||||
: IOstreamOption::NON_APPEND
|
||||
args.found("append-app") ? IOstreamOption::APPEND_APP
|
||||
: args.found("append-ate") ? IOstreamOption::APPEND_ATE
|
||||
: IOstreamOption::NO_APPEND
|
||||
);
|
||||
|
||||
IOstreamOption::atomicType atomic =
|
||||
(
|
||||
args.found("atomic")
|
||||
@ -97,7 +227,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
OFstream(baseDir/"dummy")() << "Some file content" << endl;
|
||||
|
||||
Foam::ln("dummy", baseDir/"Test2.txt");
|
||||
Foam::ln("dummy", baseDir/"Test3.txt");
|
||||
Foam::ln("dummy", baseDir/"Test4.txt");
|
||||
Foam::ln("dummy", baseDir/"Test4.txt.gz");
|
||||
@ -114,16 +243,31 @@ int main(int argc, char *argv[])
|
||||
append
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
generateOverwriteContent(os, with_seekend, seek_out);
|
||||
}
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
atomic,
|
||||
baseDir/"Test1-app.txt",
|
||||
streamOpt,
|
||||
IOstreamOption::APPEND_APP
|
||||
);
|
||||
|
||||
listFiles(baseDir);
|
||||
generateOverwriteContent(os, with_seekend, seek_out);
|
||||
}
|
||||
|
||||
sleep(2);
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
atomic,
|
||||
baseDir/"Test1-ate.txt",
|
||||
streamOpt,
|
||||
IOstreamOption::APPEND_ATE
|
||||
);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
generateOverwriteContent(os, with_seekend, seek_out);
|
||||
}
|
||||
|
||||
{
|
||||
@ -132,39 +276,21 @@ int main(int argc, char *argv[])
|
||||
atomic,
|
||||
baseDir/"Test2.txt",
|
||||
streamOpt
|
||||
// NON_APPEND
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
generateContent(os, with_seekend);
|
||||
}
|
||||
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
atomic,
|
||||
baseDir/"Test3.txt",
|
||||
streamOpt,
|
||||
IOstreamOption::APPEND
|
||||
IOstreamOption::APPEND_APP
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
generateContent(os, with_seekend, with_seekend);
|
||||
}
|
||||
{
|
||||
OFstream os
|
||||
@ -174,35 +300,17 @@ int main(int argc, char *argv[])
|
||||
IOstreamOption::COMPRESSED
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
// No seekend with COMPRESSED
|
||||
generateContent(os, false);
|
||||
}
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
IOstreamOption::ATOMIC,
|
||||
baseDir/"Test5.txt"
|
||||
// ASCII UNCOMPRESSED NON_APPEND
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
generateContent(os, with_seekend);
|
||||
}
|
||||
|
||||
Info<< nl << "done:" << endl;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -201,7 +201,6 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addTimeOptions.H"
|
||||
argList::addArgument("patch");
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -53,46 +53,37 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
fileName coherentInst;
|
||||
word coherentInst;
|
||||
coherentInst =
|
||||
(
|
||||
runTime.findInstance
|
||||
(
|
||||
polyMesh::meshSubDir,
|
||||
"coherent",
|
||||
IOobject::READ_IF_PRESENT
|
||||
IOobject::READ_IF_PRESENT,
|
||||
word::null, // No stop instance
|
||||
false // No "constant" fallback (word::null instead)
|
||||
)
|
||||
);
|
||||
|
||||
// Unfortunately with READ_IF_PRESENT, cannot tell if the file
|
||||
// was actually found or not
|
||||
|
||||
Info<< "check: " << (coherentInst/polyMesh::meshSubDir/"coherent") << nl;
|
||||
|
||||
if (!Foam::isFile(coherentInst/polyMesh::meshSubDir/"coherent"))
|
||||
{
|
||||
coherentInst.clear();
|
||||
}
|
||||
|
||||
Info<< "found coherent: " << coherentInst << nl;
|
||||
Info<< "Found coherent \"" << coherentInst << '"' << nl;
|
||||
|
||||
PtrList<entry> entries;
|
||||
|
||||
if (!coherentInst.empty())
|
||||
{
|
||||
IOdictionary coherent
|
||||
(
|
||||
IOobject
|
||||
dictionary coherent =
|
||||
IOdictionary::readContents
|
||||
(
|
||||
"coherent",
|
||||
coherentInst,
|
||||
polyMesh::meshSubDir,
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
);
|
||||
IOobject
|
||||
(
|
||||
"coherent",
|
||||
coherentInst,
|
||||
polyMesh::meshSubDir,
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
|
||||
ITstream& is = coherent.lookup("boundary");
|
||||
is >> entries;
|
||||
@ -105,7 +96,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "size: " << polyBoundaryMeshEntries::patchSizes(entries) << nl;
|
||||
Info<< nl;
|
||||
|
||||
fileName boundaryInst;
|
||||
word boundaryInst;
|
||||
boundaryInst =
|
||||
(
|
||||
runTime.findInstance
|
||||
@ -116,7 +107,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "found boundary: " << boundaryInst << nl;
|
||||
Info<< "Found boundary: \"" << boundaryInst << '"' << nl;
|
||||
|
||||
polyBoundaryMeshEntries pbm
|
||||
(
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,7 +24,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
checkDecomposePar
|
||||
Test-checkDecomposePar
|
||||
|
||||
Group
|
||||
grpParallelUtilities
|
||||
@ -35,8 +35,9 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "OSspecific.H"
|
||||
#include "fvCFD.H"
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cpuTime.H"
|
||||
#include "IFstream.H"
|
||||
#include "regionProperties.H"
|
||||
@ -44,10 +45,14 @@ Description
|
||||
#include "decompositionInformation.H"
|
||||
#include "decompositionModel.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"Check decomposition from kaffpa (KaHIP) output"
|
||||
@ -65,9 +70,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList::addArgument("kaffpa-output-file");
|
||||
|
||||
// Include explicit constant options, have zero from time range
|
||||
timeSelector::addOptions(true, false);
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const auto decompFile = args.get<fileName>(1);
|
||||
@ -75,8 +77,8 @@ int main(int argc, char *argv[])
|
||||
// Set time from database
|
||||
#include "createTime.H"
|
||||
|
||||
// Allow override of time
|
||||
instantList times = timeSelector::selectIfPresent(runTime, args);
|
||||
// Allow override of time from specified time options, or no-op
|
||||
timeSelector::setTimeIfPresent(runTime, args);
|
||||
|
||||
// Allow override of decomposeParDict location
|
||||
const fileName decompDictFile =
|
||||
@ -95,7 +97,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "\n\nDecomposing mesh " << regionName << nl << endl;
|
||||
Info<< "Create mesh..." << flush;
|
||||
|
||||
fvMesh mesh
|
||||
polyMesh mesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -111,7 +113,7 @@ int main(int argc, char *argv[])
|
||||
Info<< " nCells = " << mesh.nCells() << endl;
|
||||
|
||||
// Expected format is a simple ASCII list
|
||||
cellToProc.setSize(mesh.nCells());
|
||||
cellToProc.resize(mesh.nCells());
|
||||
{
|
||||
IFstream is(decompFile);
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -123,7 +123,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
Info<< testInput << nl;
|
||||
SubStrings<string> args = stringOps::splitSpace(testInput);
|
||||
auto args = stringOps::splitSpace(testInput);
|
||||
Info<< "split into " << args.size() << " args" << nl;
|
||||
|
||||
CStringList inC(args);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-dimField.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-dimField
|
||||
3
applications/test/dimField1/Make/files
Normal file
3
applications/test/dimField1/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-dimField1.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-dimField1
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,7 +24,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-dimField
|
||||
Test-dimField1
|
||||
|
||||
Description
|
||||
Simple tests for DimensionedField
|
||||
@ -52,7 +52,12 @@ namespace Foam
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption("write", "write some test fields");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool doWrite = args.found("write");
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
@ -60,19 +65,23 @@ int main(int argc, char *argv[])
|
||||
Info<< "Tensor field\n" << endl;
|
||||
DimensionedField<tensor, volMesh> tensorfld
|
||||
(
|
||||
IOobject
|
||||
mesh.newIOobject
|
||||
(
|
||||
"tensor",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
{ IOobject::READ_IF_PRESENT, IOobject::NO_REGISTER }
|
||||
{ IOobject::READ_IF_PRESENT, IOobject::NO_WRITE }
|
||||
),
|
||||
mesh,
|
||||
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9))
|
||||
);
|
||||
|
||||
Info().beginBlock("transformed")
|
||||
<< tensorfld.T() << nl;
|
||||
if (doWrite)
|
||||
{
|
||||
tensorfld.write();
|
||||
}
|
||||
|
||||
|
||||
Info<< nl;
|
||||
Info().beginBlock("transformed") << tensorfld.T();
|
||||
Info().endBlock();
|
||||
|
||||
{
|
||||
@ -84,8 +93,8 @@ int main(int argc, char *argv[])
|
||||
dimensioned<scalar>(14)
|
||||
);
|
||||
|
||||
Info().beginBlock(tfld().type())
|
||||
<< tfld << nl;
|
||||
Info<< nl;
|
||||
Info().beginBlock(tfld().type()) << tfld;
|
||||
Info().endBlock();
|
||||
}
|
||||
|
||||
@ -98,8 +107,8 @@ int main(int argc, char *argv[])
|
||||
dimensioned<scalar>(5)
|
||||
);
|
||||
|
||||
Info().beginBlock(tfld().type())
|
||||
<< tfld() << nl;
|
||||
Info<< nl;
|
||||
Info().beginBlock(tfld().type()) << tfld();
|
||||
Info().endBlock();
|
||||
|
||||
// From dissimilar types
|
||||
@ -111,8 +120,8 @@ int main(int argc, char *argv[])
|
||||
dimensioned<vector>(Zero)
|
||||
);
|
||||
|
||||
Info().beginBlock(tfld2().type())
|
||||
<< tfld2() << nl;
|
||||
Info<< nl;
|
||||
Info().beginBlock(tfld2().type()) << tfld2();
|
||||
Info().endBlock();
|
||||
}
|
||||
}
|
||||
@ -122,20 +131,13 @@ int main(int argc, char *argv[])
|
||||
Info<< "uint8 field\n" << endl;
|
||||
DimensionedField<uint8_t, volMesh> statefld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"state",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh.newIOobject("state")
|
||||
mesh,
|
||||
dimensioned<uint8_t>(dimless, uint8_t{100})
|
||||
);
|
||||
|
||||
Info().beginBlock("stateField")
|
||||
<< statefld << nl;
|
||||
Info<< nl;
|
||||
Info().beginBlock("stateField") << statefld;
|
||||
Info().endBlock();
|
||||
}
|
||||
#endif
|
||||
@ -1,3 +0,0 @@
|
||||
Test-ensightFile.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-ensightFile
|
||||
@ -1,8 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/conversion/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools \
|
||||
-lconversion
|
||||
3
applications/test/ensightFile1/Make/files
Normal file
3
applications/test/ensightFile1/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-ensightFile1.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-ensightFile1
|
||||
5
applications/test/ensightFile1/Make/options
Normal file
5
applications/test/ensightFile1/Make/options
Normal file
@ -0,0 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfileFormats
|
||||
137
applications/test/ensightFile1/Test-ensightFile1.cxx
Normal file
137
applications/test/ensightFile1/Test-ensightFile1.cxx
Normal file
@ -0,0 +1,137 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-ensightFile
|
||||
|
||||
Description
|
||||
check cleanup of ensight file and variable names
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "ensightFile.H"
|
||||
#include "ensightGeoFile.H"
|
||||
#include "Switch.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
argList::addBoolOption("ascii", "open as ascii instead of binary");
|
||||
argList::addBoolOption("binary", "(default)");
|
||||
argList::addBoolOption("clear", "force clear of time-steps");
|
||||
argList::addBoolOption("no-end", "skip use of endTimeStep");
|
||||
argList::addBoolOption("append", "open in append mode");
|
||||
argList::addOption("geom", "geometry file");
|
||||
argList::addOption("field", "field file");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool with_ascii = args.found("ascii") && !args.found("binary");
|
||||
// const bool with_binary = args.found("binary");
|
||||
const bool with_append = args.found("append");
|
||||
const bool with_clear = args.found("clear");
|
||||
const bool without_end = args.found("no-end");
|
||||
|
||||
const IOstreamOption::streamFormat fmt =
|
||||
(
|
||||
with_ascii
|
||||
? IOstreamOption::ASCII
|
||||
: IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
const IOstreamOption::appendType append =
|
||||
(
|
||||
with_append
|
||||
? IOstreamOption::APPEND_ATE
|
||||
: IOstreamOption::NO_APPEND
|
||||
);
|
||||
|
||||
|
||||
fileName file;
|
||||
if (args.readIfPresent("geom", file))
|
||||
{
|
||||
Info<< "Open " << file << " as geometry "
|
||||
<< " format:" << (with_ascii ? "ASCII" : "BINARY")
|
||||
<< " append:" << Switch::name(with_append) << nl;
|
||||
|
||||
ensightGeoFile ensFile(append, file, fmt);
|
||||
|
||||
if (append)
|
||||
{
|
||||
ensFile.beginTimeStep();
|
||||
|
||||
// At the moment need to pair begin/end time-step calls
|
||||
if (!without_end)
|
||||
{
|
||||
ensFile.endTimeStep();
|
||||
}
|
||||
}
|
||||
|
||||
if (with_clear)
|
||||
{
|
||||
ensFile.clearTimeSteps();
|
||||
}
|
||||
}
|
||||
|
||||
if (args.readIfPresent("field", file))
|
||||
{
|
||||
Info<< "Open " << file << " as field"
|
||||
<< " format:" << (with_ascii ? "ASCII" : "BINARY")
|
||||
<< " append:" << Switch::name(with_append) << nl;
|
||||
|
||||
ensightFile ensFile(append, file, fmt);
|
||||
|
||||
if (append)
|
||||
{
|
||||
ensFile.beginTimeStep();
|
||||
|
||||
// At the moment need to pair begin/end time-step calls
|
||||
if (!without_end)
|
||||
{
|
||||
ensFile.endTimeStep();
|
||||
}
|
||||
}
|
||||
|
||||
if (with_clear)
|
||||
{
|
||||
ensFile.clearTimeSteps();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/test/ensightFileName/Make/files
Normal file
3
applications/test/ensightFileName/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-ensightFileName.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-ensightFileName
|
||||
5
applications/test/ensightFileName/Make/options
Normal file
5
applications/test/ensightFileName/Make/options
Normal file
@ -0,0 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfileFormats
|
||||
@ -24,10 +24,10 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-ensightFile
|
||||
Test-ensightFileName
|
||||
|
||||
Description
|
||||
check cleanup of ensight file and variable names
|
||||
Check cleanup of ensight file and variable names
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -21,6 +21,8 @@ Description
|
||||
#include "argList.H"
|
||||
#include "IOstreams.H"
|
||||
#include "ITstream.H"
|
||||
#include "OTstream.H"
|
||||
#include "SpanStream.H"
|
||||
#include "exprValue.H"
|
||||
#include "Pstream.H"
|
||||
|
||||
@ -34,6 +36,41 @@ void printInfo(const expressions::exprValue& val)
|
||||
}
|
||||
|
||||
|
||||
void write_read(const expressions::exprValue& val)
|
||||
{
|
||||
OCharStream os;
|
||||
os << val;
|
||||
|
||||
ISpanStream is(os.view());
|
||||
expressions::exprValue val2;
|
||||
is >> val2;
|
||||
|
||||
Pout<< "wrote " << os.count() << " chars: " << os.str() << nl;
|
||||
|
||||
printInfo(val);
|
||||
printInfo(val2);
|
||||
Pout<< "====" << nl;
|
||||
}
|
||||
|
||||
|
||||
tokenList tokens_of(const expressions::exprValue& val)
|
||||
{
|
||||
OTstream toks;
|
||||
toks << val;
|
||||
|
||||
Pout<< "val with tokens: ";
|
||||
toks.writeList(Pout, 0) << nl;
|
||||
|
||||
for (const auto& t : toks)
|
||||
{
|
||||
Pout<< " " << t.info() << nl;
|
||||
}
|
||||
Pout<< nl;
|
||||
|
||||
return toks;
|
||||
}
|
||||
|
||||
|
||||
expressions::exprValue tryParse(const std::string& str)
|
||||
{
|
||||
expressions::exprValue val, val2;
|
||||
@ -90,6 +127,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
expressions::exprValue value;
|
||||
tokenList toks;
|
||||
|
||||
Info<< "exprValue"
|
||||
<< " sizeof:" << value.size_bytes()
|
||||
@ -99,21 +137,31 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Nothing
|
||||
printInfo(value);
|
||||
toks = tokens_of(value);
|
||||
write_read(value);
|
||||
|
||||
value.set(scalar(100));
|
||||
printInfo(value);
|
||||
printInfo(value); write_read(value); toks = tokens_of(value);
|
||||
|
||||
value.set(scalar(100.01));
|
||||
printInfo(value); write_read(value); toks = tokens_of(value);
|
||||
|
||||
value.set(vector(1,2,3));
|
||||
printInfo(value);
|
||||
printInfo(value); write_read(value); toks = tokens_of(value);
|
||||
|
||||
value = vector(4,5,6);
|
||||
printInfo(value);
|
||||
printInfo(value); write_read(value); toks = tokens_of(value);
|
||||
|
||||
value = Zero;
|
||||
printInfo(value);
|
||||
printInfo(value); write_read(value); toks = tokens_of(value);
|
||||
|
||||
value.clear();
|
||||
printInfo(value); write_read(value); toks = tokens_of(value);
|
||||
|
||||
value.set<bool>(true);
|
||||
|
||||
printInfo(value);
|
||||
printInfo(value); write_read(value); toks = tokens_of(value);
|
||||
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
exprValueFieldTag.cxx
|
||||
|
||||
Test-exprValue2.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-exprValue2
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
Copyright (C) 2023-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,7 +36,6 @@ Description
|
||||
#include "vectorField.H"
|
||||
#include "DynamicList.H"
|
||||
#include "Random.H"
|
||||
#include "exprValue.H"
|
||||
#include "exprValueFieldTag.H"
|
||||
|
||||
using namespace Foam;
|
||||
@ -61,27 +60,81 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
DynamicList<fieldTag> allTags;
|
||||
|
||||
{
|
||||
scalarField fld1(20);
|
||||
scalarField fld2a(20, Zero);
|
||||
scalarField fld2b(10, 3.10);
|
||||
scalarField fld3;
|
||||
|
||||
forAll(fld1, i)
|
||||
for (auto& val : fld1)
|
||||
{
|
||||
fld1[i] = rnd.position<scalar>(0, 20);
|
||||
val = rnd.position<scalar>(0, 20);
|
||||
}
|
||||
|
||||
if (!UPstream::master())
|
||||
{
|
||||
fld2b.resize(5);
|
||||
fld2b *= 2;
|
||||
}
|
||||
|
||||
fieldTag tag1(fld1.begin(), fld1.end());
|
||||
fieldTag tag2a(fld2a.begin(), fld2a.end());
|
||||
fieldTag tag2b(fld2b.begin(), fld2b.end());
|
||||
fieldTag tag3(fld3.begin(), fld3.end());
|
||||
fieldTag tag4(fld3.begin(), fld3.end());
|
||||
|
||||
printInfo(tag1) << nl;
|
||||
printInfo(tag2a) << nl;
|
||||
printInfo(tag2b) << nl;
|
||||
printInfo(tag3) << nl;
|
||||
|
||||
{
|
||||
Pout<< "Test reduce" << nl;
|
||||
|
||||
fieldTag work(fld2b.begin(), fld2b.end());
|
||||
|
||||
Pout<< "Before" << nl;
|
||||
printInfo(work) << nl;
|
||||
|
||||
work.reduce();
|
||||
|
||||
Pout<< "After" << nl;
|
||||
printInfo(work) << nl;
|
||||
Pout<< "====" << nl;
|
||||
}
|
||||
|
||||
allTags.clear();
|
||||
allTags.push_back(tag1);
|
||||
allTags.push_back(tag2a);
|
||||
allTags.push_back(tag2b);
|
||||
allTags.push_back(tag3);
|
||||
allTags.push_back(tag4);
|
||||
allTags.push_back(fieldTag::make_empty<tensor>());
|
||||
|
||||
|
||||
// Add some other types
|
||||
{
|
||||
vectorField vfld2a(20, vector::uniform(1.23));
|
||||
|
||||
allTags.emplace_back
|
||||
(
|
||||
vfld2a.begin(),
|
||||
vfld2a.end()
|
||||
);
|
||||
allTags.emplace_back(vector(1.01, 2.02, 3.03));
|
||||
allTags.emplace_back(12.4);
|
||||
|
||||
allTags.emplace_back().set_value(vector::uniform(2.0));
|
||||
allTags.back().set_empty();
|
||||
}
|
||||
Info<< "all tags: " << allTags << nl;
|
||||
|
||||
Foam::sort(allTags);
|
||||
|
||||
Info<< "sorted: " << allTags << nl;
|
||||
|
||||
fieldTag result;
|
||||
|
||||
result = fieldTag::combineOp{}(tag1, tag2a);
|
||||
|
||||
@ -1,160 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "exprValueFieldTag.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::expressions::exprValueFieldTag::empty() const noexcept
|
||||
{
|
||||
return
|
||||
(
|
||||
uniformity_ == Foam::Detail::ListPolicy::uniformity::EMPTY
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::expressions::exprValueFieldTag::is_uniform() const noexcept
|
||||
{
|
||||
return
|
||||
(
|
||||
uniformity_ == Foam::Detail::ListPolicy::uniformity::UNIFORM
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::expressions::exprValueFieldTag::is_nonuniform() const noexcept
|
||||
{
|
||||
return
|
||||
(
|
||||
uniformity_ == Foam::Detail::ListPolicy::uniformity::NONUNIFORM
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::expressions::exprValueFieldTag::equal
|
||||
(
|
||||
const exprValueFieldTag& rhs
|
||||
) const
|
||||
{
|
||||
return (value_ == rhs.value_);
|
||||
}
|
||||
|
||||
|
||||
void Foam::expressions::exprValueFieldTag::set_nouniform() noexcept
|
||||
{
|
||||
uniformity_ = Foam::Detail::ListPolicy::uniformity::NONUNIFORM;
|
||||
value_ = Foam::zero{};
|
||||
}
|
||||
|
||||
|
||||
void Foam::expressions::exprValueFieldTag::combine
|
||||
(
|
||||
const exprValueFieldTag& b
|
||||
)
|
||||
{
|
||||
if (b.empty())
|
||||
{
|
||||
// no-op
|
||||
return;
|
||||
}
|
||||
|
||||
exprValueFieldTag& a = *this;
|
||||
|
||||
if (a.empty())
|
||||
{
|
||||
a = b;
|
||||
}
|
||||
else if (a.is_nonuniform())
|
||||
{
|
||||
// Already non-uniform/mixed
|
||||
// a.uniformity_ |= b.uniformity_;
|
||||
|
||||
a.value_ = Foam::zero{};
|
||||
}
|
||||
else if (a.is_uniform() && b.is_uniform())
|
||||
{
|
||||
// Both are uniform, but are they the same value?
|
||||
if (!a.equal(b))
|
||||
{
|
||||
a.set_nouniform();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
void Foam::expressions::exprValueFieldTag::read(Istream& is)
|
||||
{
|
||||
label uniformTag;
|
||||
|
||||
is >> uniformTag;
|
||||
uniformity_ = int(uniformTag);
|
||||
value_.read(is);
|
||||
}
|
||||
|
||||
|
||||
void Foam::expressions::exprValueFieldTag::write(Ostream& os) const
|
||||
{
|
||||
os << label(uniformity_);
|
||||
value_.write(os, false); // No pruning
|
||||
}
|
||||
|
||||
|
||||
void Foam::expressions::exprValueFieldTag::print(Ostream& os) const
|
||||
{
|
||||
os << "{ uniform:"
|
||||
<< label(uniformity_)
|
||||
<< " type:" << label(value_.typeCode())
|
||||
<< " value: " << value_ << " }";
|
||||
}
|
||||
|
||||
|
||||
Foam::Istream& Foam::operator>>
|
||||
(
|
||||
Istream& is,
|
||||
expressions::exprValueFieldTag& tag
|
||||
)
|
||||
{
|
||||
tag.read(is);
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const expressions::exprValueFieldTag& tag
|
||||
)
|
||||
{
|
||||
tag.write(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -32,6 +32,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "Time.H"
|
||||
@ -126,14 +127,14 @@ void writeStencilStats(const labelListList& stencil)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addTimeOptions.H"
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
#include "checkTimeOptions.H"
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
// Set time from specified time options, or force start from Time=0
|
||||
timeSelector::setTimeIfPresent(runTime, args, true);
|
||||
|
||||
#include "createMesh.H"
|
||||
|
||||
// Force calculation of extended edge addressing
|
||||
|
||||
@ -32,6 +32,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
@ -107,14 +108,16 @@ void writeStencilStats(const labelListList& stencil)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addTimeOptions.H"
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
#include "checkTimeOptions.H"
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
// Set time from specified time options, or force start from Time=0
|
||||
timeSelector::setTimeIfPresent(runTime, args, true);
|
||||
|
||||
#include "createMesh.H"
|
||||
|
||||
|
||||
|
||||
3
applications/test/faMesh-try/Make/files
Normal file
3
applications/test/faMesh-try/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-faMesh-try.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-faMesh-try
|
||||
7
applications/test/faMesh-try/Make/options
Normal file
7
applications/test/faMesh-try/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteArea \
|
||||
-lmeshTools
|
||||
63
applications/test/faMesh-try/Test-faMesh-try.cxx
Normal file
63
applications/test/faMesh-try/Test-faMesh-try.cxx
Normal file
@ -0,0 +1,63 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-faMesh-try
|
||||
|
||||
Description
|
||||
Test for loading of faMesh
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "faMesh.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addRegionOption.H"
|
||||
#include "addFaRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createNamedPolyMesh.H"
|
||||
|
||||
#include "getFaRegionOption.H"
|
||||
|
||||
autoPtr<faMesh> aMeshPtr = faMesh::TryNew(areaRegionName, mesh);
|
||||
|
||||
Info<< "area-mesh: " << Switch::name(aMeshPtr) << nl;
|
||||
|
||||
Info<< "\nEnd\n" << nl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/test/faMeshesRegistry/Make/files
Normal file
3
applications/test/faMeshesRegistry/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-faMeshesRegistry.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-faMeshesRegistry
|
||||
7
applications/test/faMeshesRegistry/Make/options
Normal file
7
applications/test/faMeshesRegistry/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteArea \
|
||||
-lmeshTools
|
||||
68
applications/test/faMeshesRegistry/Test-faMeshesRegistry.cxx
Normal file
68
applications/test/faMeshesRegistry/Test-faMeshesRegistry.cxx
Normal file
@ -0,0 +1,68 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-faMeshesRegistry
|
||||
|
||||
Description
|
||||
Basic tests for faMeshesRegistry
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "faMesh.H"
|
||||
#include "faMeshesRegistry.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createPolyMesh.H"
|
||||
|
||||
Info<< "mesh 0: " << mesh.sortedNames() << nl;
|
||||
|
||||
faMeshesRegistry& reg =
|
||||
const_cast<faMeshesRegistry&>(faMeshesRegistry::New(mesh));
|
||||
|
||||
// faMeshesRegistry faReg = faMeshesRegistry(mesh);
|
||||
|
||||
faMesh mesh1(mesh, Foam::zero{});
|
||||
faMesh mesh2("mesh2", mesh, Foam::zero{});
|
||||
|
||||
reg.write();
|
||||
|
||||
Info<< "\nEnd\n" << nl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -5,4 +5,5 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh
|
||||
|
||||
@ -32,6 +32,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "Time.H"
|
||||
@ -51,22 +52,33 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addTimeOptions.H"
|
||||
argList::addArgument("inflate (true|false)");
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"inflate",
|
||||
"Use inflation/deflation for deleting cells"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
// Allow override of time from specified time options, or no-op
|
||||
timeSelector::setTimeIfPresent(runTime, args);
|
||||
|
||||
#include "createMesh.H"
|
||||
|
||||
const Switch inflate(args[1]);
|
||||
const bool inflate = args.found("inflate");
|
||||
|
||||
if (inflate)
|
||||
{
|
||||
Info<< "Deleting cells using inflation/deflation" << nl << endl;
|
||||
Info<< "Deleting cells using inflation/deflation"
|
||||
<< nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Deleting cells, introducing points at new position" << nl
|
||||
<< endl;
|
||||
Info<< "Deleting cells, introducing points at new position"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -47,7 +47,7 @@ using namespace Foam;
|
||||
template<class PrimitiveType>
|
||||
static List<PrimitiveType> splitStringToList(const std::string& str)
|
||||
{
|
||||
const SubStrings<std::string> items = stringOps::splitAny(str, " ,;");
|
||||
const auto items = stringOps::splitAny(str, " ,;");
|
||||
|
||||
DynamicList<PrimitiveType> values(items.size());
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
Copyright (C) 2023-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,6 +50,9 @@ void printInfo(const meshObjects::gravity& g)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption("checkout", "Test checkout with release");
|
||||
argList::addBoolOption("release", "Test release instead of delete");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -70,14 +73,81 @@ int main(int argc, char *argv[])
|
||||
printInfo(g);
|
||||
}
|
||||
|
||||
Pout<< "registered:" << flatOutput(runTime.sortedToc()) << nl << endl;
|
||||
Pout<< "registered:"
|
||||
<< flatOutput(runTime.sortedToc()) << nl << endl;
|
||||
}
|
||||
|
||||
meshObjects::gravity::Delete("g", runTime);
|
||||
meshObjects::gravity::Delete("something-not-in-registry", runTime);
|
||||
std::unique_ptr<meshObjects::gravity> release1;
|
||||
std::unique_ptr<meshObjects::gravity> release2;
|
||||
|
||||
Info<< "after Delete" << nl;
|
||||
Pout<< "registered:" << flatOutput(runTime.sortedToc()) << endl;
|
||||
if (args.found("release"))
|
||||
{
|
||||
// Ugly!
|
||||
typedef
|
||||
MeshObject<Time, TopologicalMeshObject, meshObjects::gravity>
|
||||
parent_type;
|
||||
|
||||
release1 = meshObjects::gravity::Release("g", runTime);
|
||||
release2 = meshObjects::gravity::Release("#none#", runTime);
|
||||
|
||||
Info<< "release: " << Switch::name(bool(release1))
|
||||
<< ", " << Switch::name(bool(release2)) << nl;
|
||||
|
||||
Info<< "after Release: "
|
||||
<< flatOutput(runTime.sortedToc()) << endl;
|
||||
|
||||
// Do checkout by hand (ugly)
|
||||
if (args.found("checkout"))
|
||||
{
|
||||
if (release1)
|
||||
{
|
||||
release1->parent_type::checkOut();
|
||||
}
|
||||
|
||||
if (release2)
|
||||
{
|
||||
release2->parent_type::checkOut();
|
||||
}
|
||||
|
||||
Info<< "after checkout: "
|
||||
<< flatOutput(runTime.sortedToc()) << endl;
|
||||
}
|
||||
}
|
||||
else if (args.found("checkout"))
|
||||
{
|
||||
// Do checkout as part of release
|
||||
release1 = meshObjects::gravity::Release("g", runTime, true);
|
||||
release2 = meshObjects::gravity::Release("#none#", runTime, true);
|
||||
|
||||
Info<< "release: " << Switch::name(bool(release1))
|
||||
<< ", " << Switch::name(bool(release2)) << nl;
|
||||
|
||||
Info<< "after Release/Checkout(true) : "
|
||||
<< flatOutput(runTime.sortedToc()) << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
meshObjects::gravity::Delete("g", runTime);
|
||||
meshObjects::gravity::Delete("#none#", runTime);
|
||||
|
||||
Info<< "after Delete: "
|
||||
<< flatOutput(runTime.sortedToc()) << endl;
|
||||
}
|
||||
|
||||
|
||||
if (meshObjects::gravity::Store(std::move(release1)))
|
||||
{
|
||||
Info<< "Store pointer" << endl;
|
||||
}
|
||||
|
||||
if (release2)
|
||||
{
|
||||
release2.reset();
|
||||
Info<< "Clear pointer" << endl;
|
||||
}
|
||||
|
||||
Info<< "Before exit: "
|
||||
<< flatOutput(runTime.sortedToc()) << endl;
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -5,4 +5,5 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh
|
||||
|
||||
@ -33,6 +33,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "Time.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
@ -52,21 +53,28 @@ using namespace Foam;
|
||||
// Main program:
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addTimeOptions.H"
|
||||
argList::addArgument("inflate (true|false)");
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"inflate",
|
||||
"Use inflation/deflation for splitting/deleting cells"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
// Allow override of time from specified time options, or no-op
|
||||
timeSelector::setTimeIfPresent(runTime, args);
|
||||
|
||||
#include "createMesh.H"
|
||||
|
||||
|
||||
const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh));
|
||||
|
||||
const Switch inflate(args[1]);
|
||||
const bool inflate = args.found("inflate");
|
||||
|
||||
if (inflate)
|
||||
{
|
||||
Info<< "Splitting/deleting cells using inflation/deflation" << nl
|
||||
<< endl;
|
||||
Info<< "Splitting/deleting cells using inflation/deflation"
|
||||
<< nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -75,6 +83,8 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
const pointConstraints& pc = pointConstraints::New(pointMesh::New(mesh));
|
||||
|
||||
Random rndGen(0);
|
||||
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / O peration | Version: v2406 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user