Compare commits
88 Commits
feature-co
...
feature-co
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f19e9033e | |||
| bbd6219eb2 | |||
| 58aa8c97c2 | |||
| 9f4bb2d432 | |||
| 24ac8308b3 | |||
| 0e23e6c66c | |||
| 21c554d7d0 | |||
| 391f059335 | |||
| 5873ec1b22 | |||
| bb483951b7 | |||
| 7b5e605b29 | |||
| 732872b9cc | |||
| c6501b799e | |||
| 93ee308ebf | |||
| 9d6b8a9c28 | |||
| d859f7b00f | |||
| baa8dccb0a | |||
| 5059e1ddec | |||
| dced6c581e | |||
| 3e64faf605 | |||
| 3083c32c35 | |||
| f48e617cd2 | |||
| 1b825b4470 | |||
| 199a9801ca | |||
| f6ba6bc40e | |||
| bf9b9204c3 | |||
| 06ee000cb8 | |||
| d3861a5dcc | |||
| 8950c9b0c6 | |||
| a0fea418e2 | |||
| 1bce1e44c4 | |||
| 440cb83fa7 | |||
| 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 | |||
| e651d63566 |
@ -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
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
api=2402
|
||||
patch=240220
|
||||
api=2406
|
||||
patch=0
|
||||
|
||||
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())
|
||||
{
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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,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
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -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"
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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,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);
|
||||
|
||||
|
||||
|
||||
@ -51,7 +51,6 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "addTimeOptions.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
@ -66,13 +66,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (const entry& dEntry : dict)
|
||||
{
|
||||
if (!dEntry.isStream())
|
||||
if (dEntry.isStream())
|
||||
{
|
||||
continue;
|
||||
List<namedDictionary> list(dEntry.stream());
|
||||
|
||||
Info<< "input: " << dEntry << nl
|
||||
<< "list: " << list << nl;
|
||||
}
|
||||
Info<< "input: " << dEntry << nl;
|
||||
List<namedDictionary> list(dEntry.stream());
|
||||
Info<< "list: " << list << nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
@ -44,175 +44,62 @@ Description
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
// Looks like Pstream::exchangeBuf
|
||||
template<class T>
|
||||
void do_exchangeBuf
|
||||
//- Number of elements corresponding to max byte transfer.
|
||||
// Normal upper limit is INT_MAX since MPI sizes are limited to <int>.
|
||||
template<class Type>
|
||||
inline std::size_t maxTransferCount
|
||||
(
|
||||
const label sendSize,
|
||||
const char* sendData,
|
||||
const label recvSize,
|
||||
char* recvData,
|
||||
const int tag,
|
||||
const label comm,
|
||||
const bool wait
|
||||
)
|
||||
const std::size_t max_bytes = std::size_t(0)
|
||||
) noexcept
|
||||
{
|
||||
const label startOfRequests = UPstream::nRequests();
|
||||
|
||||
// Set up receives
|
||||
// ~~~~~~~~~~~~~~~
|
||||
|
||||
// forAll(recvSizes, proci)
|
||||
{
|
||||
// if (proci != Pstream::myProcNo(comm) && recvSizes[proci] > 0)
|
||||
if (!Pstream::master(comm) && recvSize > 0)
|
||||
{
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
UPstream::myProcNo(comm), // proci,
|
||||
recvData,
|
||||
recvSize*sizeof(T),
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set up sends
|
||||
// ~~~~~~~~~~~~
|
||||
|
||||
// forAll(sendBufs, proci)
|
||||
for (const int proci : Pstream::subProcs(comm))
|
||||
{
|
||||
if (sendSize > 0)
|
||||
// if (proci != Pstream::myProcNo(comm) && sendSizes[proci] > 0)
|
||||
{
|
||||
if
|
||||
(
|
||||
!UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
proci,
|
||||
sendData,
|
||||
sendSize*sizeof(T),
|
||||
tag,
|
||||
comm
|
||||
)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot send outgoing message. "
|
||||
<< "to:" << proci << " nBytes:"
|
||||
<< label(sendSize*sizeof(T))
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait for all to finish
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (wait)
|
||||
{
|
||||
UPstream::waitRequests(startOfRequests);
|
||||
}
|
||||
return
|
||||
(
|
||||
(max_bytes == 0) // ie, unlimited
|
||||
? (std::size_t(0)) //
|
||||
: (max_bytes > std::size_t(INT_MAX)) // MPI limit is <int>
|
||||
? (std::size_t(INT_MAX) / sizeof(Type)) //
|
||||
: (max_bytes > sizeof(Type)) // require an integral number
|
||||
? (max_bytes / sizeof(Type)) //
|
||||
: (std::size_t(1)) // min of one element
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Looks like Pstream::exchangeContainer
|
||||
template<class Container, class T>
|
||||
void do_exchangeContainer
|
||||
//- Upper limit on number of transfer bytes.
|
||||
// Max bytes is normally INT_MAX since MPI sizes are limited to <int>.
|
||||
// Negative values indicate a subtraction from INT_MAX.
|
||||
inline std::size_t PstreamDetail_maxTransferBytes
|
||||
(
|
||||
const Container& sendData,
|
||||
const label recvSize,
|
||||
Container& recvData,
|
||||
const int tag,
|
||||
const label comm,
|
||||
const bool wait
|
||||
)
|
||||
const int64_t max_bytes
|
||||
) noexcept
|
||||
{
|
||||
const label startOfRequests = UPstream::nRequests();
|
||||
|
||||
// Set up receives
|
||||
// ~~~~~~~~~~~~~~~
|
||||
|
||||
// for (const int proci : Pstream::allProcs(comm))
|
||||
{
|
||||
if (!Pstream::master(comm) && recvSize > 0)
|
||||
// if (proci != Pstream::myProcNo(comm) && recvSize > 0)
|
||||
{
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
UPstream::myProcNo(comm), // proci,
|
||||
recvData.data_bytes(),
|
||||
recvSize*sizeof(T),
|
||||
tag,
|
||||
comm
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set up sends
|
||||
// ~~~~~~~~~~~~
|
||||
|
||||
if (Pstream::master(comm) && sendData.size() > 0)
|
||||
{
|
||||
for (const int proci : Pstream::subProcs(comm))
|
||||
{
|
||||
if
|
||||
(
|
||||
!UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
proci,
|
||||
sendData.cdata_bytes(),
|
||||
sendData.size_bytes(),
|
||||
tag,
|
||||
comm
|
||||
)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot send outgoing message. "
|
||||
<< "to:" << proci << " nBytes:"
|
||||
<< label(sendData.size_bytes())
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for all to finish
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (wait)
|
||||
{
|
||||
UPstream::waitRequests(startOfRequests);
|
||||
}
|
||||
return
|
||||
(
|
||||
(max_bytes < 0) // (numBytes fewer than INT_MAX)
|
||||
? std::size_t(INT_MAX + max_bytes)
|
||||
: std::size_t(max_bytes)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Container, class T>
|
||||
template<class Container, class Type>
|
||||
void broadcast_chunks
|
||||
(
|
||||
Container& sendData,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
const bool wait = true
|
||||
const label comm = UPstream::worldComm
|
||||
const int64_t maxComms_bytes = UPstream::maxCommsSize
|
||||
)
|
||||
{
|
||||
// OR static_assert(is_contiguous<T>::value, "Contiguous data only!")
|
||||
if (!is_contiguous<T>::value)
|
||||
if (!is_contiguous<Type>::value)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Contiguous data only." << sizeof(T) << Foam::abort(FatalError);
|
||||
<< "Contiguous data only." << sizeof(Type)
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
|
||||
if (UPstream::maxCommsSize <= 0)
|
||||
if (maxComms_bytes == 0)
|
||||
{
|
||||
// Do in one go
|
||||
Info<< "send " << sendData.size() << " elements in one go" << endl;
|
||||
@ -227,93 +114,90 @@ void broadcast_chunks
|
||||
|
||||
sendData.resize_nocopy(recvSize); // A no-op on master
|
||||
|
||||
// Determine the number of chunks to send. Note that we
|
||||
// only have to look at the sending data since we are
|
||||
// guaranteed that some processor's sending size is some other
|
||||
// processor's receive size. Also we can ignore any local comms.
|
||||
|
||||
// We need to send chunks so the number of iterations:
|
||||
// maxChunkSize iterations
|
||||
// ------------ ----------
|
||||
// 0 0
|
||||
// 1..maxChunkSize 1
|
||||
// maxChunkSize+1..2*maxChunkSize 2
|
||||
// ...
|
||||
|
||||
const label maxChunkSize
|
||||
// The chunk size (number of elements) corresponding to max byte transfer
|
||||
// Is zero for non-chunked exchanges.
|
||||
const std::size_t chunkSize
|
||||
(
|
||||
max
|
||||
PstreamDetail_maxTransferCount<Type>
|
||||
(
|
||||
static_cast<label>(1),
|
||||
static_cast<label>(UPstream::maxCommsSize/sizeof(T))
|
||||
PstreamDetail_maxTransferBytes(maxComms_bytes)
|
||||
)
|
||||
);
|
||||
|
||||
label nChunks(0);
|
||||
{
|
||||
// Get max send count (elements)
|
||||
// forAll(sendBufs, proci)
|
||||
// {
|
||||
// if (proci != Pstream::myProcNo(comm))
|
||||
// {
|
||||
// nChunks = max(nChunks, sendBufs[proci].size());
|
||||
// }
|
||||
// }
|
||||
nChunks = sendSize;
|
||||
|
||||
if (chunkSize)
|
||||
{
|
||||
// Convert from send count (elements) to number of chunks.
|
||||
// Can normally calculate with (count-1), but add some safety
|
||||
if (nChunks)
|
||||
{
|
||||
nChunks = 1 + (nChunks/maxChunkSize);
|
||||
}
|
||||
reduce(nChunks, maxOp<label>(), tag, comm);
|
||||
label nChunks = 1 + (sendSize/label(chunkSize));
|
||||
|
||||
Info
|
||||
<< "send " << sendSize << " elements ("
|
||||
<< (sendSize*sizeof(T)) << " bytes) in " << nChunks
|
||||
<< " chunks of " << maxChunkSize << " elements ("
|
||||
<< (maxChunkSize*sizeof(T)) << " bytes) for maxCommsSize:"
|
||||
<< Pstream::maxCommsSize
|
||||
<< (sendSize*sizeof(Type)) << " bytes) in " << nChunks
|
||||
<< " chunks of " << label(chunkSize) << " elements ("
|
||||
<< label(chunkSize*sizeof(Type)) << " bytes) for maxCommsSize:"
|
||||
<< label(maxComms_bytes)
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
// stress-test with shortened sendSize
|
||||
// will produce useless loops, but no calls
|
||||
// sendSize /= 2;
|
||||
|
||||
label nSend(0);
|
||||
label startSend(0);
|
||||
char* charPtrSend;
|
||||
typedef stdFoam::span<Type> sendType;
|
||||
|
||||
for (label iter = 0; iter < nChunks; ++iter)
|
||||
do
|
||||
{
|
||||
nSend = min
|
||||
(
|
||||
maxChunkSize,
|
||||
sendSize-startSend
|
||||
);
|
||||
sendType payload(sendData.data(), sendData.size());
|
||||
|
||||
charPtrSend =
|
||||
(
|
||||
nSend > 0
|
||||
? reinterpret_cast<char*>(&(sendData[startSend]))
|
||||
: nullptr
|
||||
);
|
||||
|
||||
Info<< "iter " << iter
|
||||
<< ": beg=" << startSend << " len=" << nSend
|
||||
<< " (" << (nSend*sizeof(T)) << " bytes)" << endl;
|
||||
|
||||
UPstream::broadcast(charPtrSend, nSend*sizeof(T), comm);
|
||||
|
||||
// forAll(nSend, proci)
|
||||
if (!chunkSize)
|
||||
{
|
||||
startSend += nSend;
|
||||
UPstream::broadcast
|
||||
(
|
||||
payload.data_bytes(),
|
||||
payload.size_bytes(),
|
||||
comm
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
// Dispatch chunk-wise until there is nothing left
|
||||
for (int iter = 0; /*true*/; ++iter)
|
||||
{
|
||||
// The begin/end for the data window
|
||||
const std::size_t beg = (std::size_t(iter)*chunkSize);
|
||||
const std::size_t end = (std::size_t(iter+1)*chunkSize);
|
||||
|
||||
if (payload.size() <= beg)
|
||||
{
|
||||
// No more data windows
|
||||
break;
|
||||
}
|
||||
|
||||
sendType window
|
||||
(
|
||||
(end < payload.size())
|
||||
? payload.subspan(beg, end - beg)
|
||||
: payload.subspan(beg)
|
||||
);
|
||||
|
||||
Info<< "iter " << iter
|
||||
<< ": beg=" << label(beg) << " len=" << label(window.size())
|
||||
<< " (" << label(window.size_bytes()) << " bytes)" << endl;
|
||||
|
||||
UPstream::broadcast
|
||||
(
|
||||
window.data_bytes(),
|
||||
window.size_bytes(),
|
||||
comm
|
||||
);
|
||||
}
|
||||
}
|
||||
while (false);
|
||||
|
||||
Info<< "final: " << startSend << endl;
|
||||
Info<< "final" << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -333,7 +217,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
labelList input1;
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
input1 = identity(500);
|
||||
}
|
||||
@ -348,7 +232,7 @@ int main(int argc, char *argv[])
|
||||
// Mostly the same with PstreamBuffers
|
||||
if (false)
|
||||
{
|
||||
PstreamBuffers pBufs(UPstream::commsTypes::nonBlocking);
|
||||
PstreamBuffers pBufs;
|
||||
|
||||
labelList sendData;
|
||||
if (Pstream::master())
|
||||
|
||||
@ -130,7 +130,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (bool barrier_active = false, done = false; !done; /*nil*/)
|
||||
{
|
||||
std::pair<int, int> probed =
|
||||
std::pair<int, int64_t> probed =
|
||||
UPstream::probeMessage
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
@ -143,8 +143,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
// Message found and had size: receive it
|
||||
|
||||
const label proci = probed.first;
|
||||
const label count = probed.second;
|
||||
const label proci(probed.first);
|
||||
const label count(probed.second);
|
||||
|
||||
recvBufs(proci).resize_nocopy(count);
|
||||
recvFromProc(recvRequests.size()) = proci;
|
||||
|
||||
@ -119,7 +119,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (bool barrier_active = false, done = false; !done; /*nil*/)
|
||||
{
|
||||
std::pair<int, int> probed =
|
||||
std::pair<int, int64_t> probed =
|
||||
UPstream::probeMessage
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
@ -132,8 +132,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
// Message found and had size: receive it
|
||||
|
||||
const label proci = probed.first;
|
||||
const label count = probed.second;
|
||||
const label proci(probed.first);
|
||||
const label count(probed.second);
|
||||
|
||||
if (optNonBlocking)
|
||||
{
|
||||
|
||||
@ -7,5 +7,6 @@ EXE_INC = \
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-ldynamicFvMesh \
|
||||
-lsampling \
|
||||
-loverset
|
||||
|
||||
@ -56,6 +56,7 @@ Description
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "simpleControl.H"
|
||||
#include "predicates.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "dynamicOversetFvMesh.H"
|
||||
|
||||
@ -97,6 +98,7 @@ int main(int argc, char *argv[])
|
||||
component(T.ref(), mesh.C(), 1);
|
||||
// Interpolate + halo swap
|
||||
T.correctBoundaryConditions();
|
||||
// T.boundaryFieldRef().evaluate_if(predicates::always{});
|
||||
// Check halo swap
|
||||
dynamicOversetFvMesh::checkCoupledBC(T);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "input: " << input << nl
|
||||
<< "expand: " << output << nl
|
||||
<< "split: " << stringOps::split(output, "/") << nl << nl;
|
||||
<< "split: " << stringOps::split(output, '/') << nl << nl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,6 +34,7 @@ Description
|
||||
#include "argList.H"
|
||||
#include "fileName.H"
|
||||
#include "stringOps.H"
|
||||
#include "Switch.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -65,6 +66,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
argList::noMandatoryArgs();
|
||||
argList::addArgument("string .. stringN");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"any",
|
||||
@ -89,6 +93,12 @@ int main(int argc, char *argv[])
|
||||
"int",
|
||||
"test split on fixed width"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"begin",
|
||||
"int",
|
||||
"begin offset for splits"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"slash",
|
||||
@ -104,18 +114,25 @@ int main(int argc, char *argv[])
|
||||
"empty",
|
||||
"preserve empty strings in split"
|
||||
);
|
||||
argList args(argc, argv, false, true);
|
||||
|
||||
argList args(argc, argv);
|
||||
|
||||
if (args.size() <= 1 && args.options().empty())
|
||||
{
|
||||
args.printUsage();
|
||||
}
|
||||
|
||||
const label beginOffset = args.getOrDefault<label>("begin", 0);
|
||||
|
||||
const bool keepEmpty = args.found("empty");
|
||||
|
||||
Info<< "begin offset: " << beginOffset << nl;
|
||||
Info<< "keep empty : " << Switch::name(keepEmpty) << nl;
|
||||
|
||||
const label nopts =
|
||||
args.count({"any", "slash", "space", "sub", "fixed", "char"});
|
||||
|
||||
|
||||
if (args.found("any"))
|
||||
{
|
||||
const std::string& str = args["any"];
|
||||
@ -125,7 +142,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label argi=1; argi < args.size(); ++argi)
|
||||
{
|
||||
const auto split = stringOps::splitAny(args[argi], str);
|
||||
auto split = stringOps::splitAny(args[argi], str, beginOffset);
|
||||
printSubStrings(args[argi], split);
|
||||
}
|
||||
|
||||
@ -144,7 +161,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label argi=1; argi < args.size(); ++argi)
|
||||
{
|
||||
const auto split = stringOps::split(args[argi], str);
|
||||
auto split = stringOps::split(args[argi], str, beginOffset);
|
||||
printSubStrings(args[argi], split);
|
||||
}
|
||||
|
||||
@ -161,7 +178,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label argi=1; argi < args.size(); ++argi)
|
||||
{
|
||||
const auto split = stringOps::splitSpace(args[argi]);
|
||||
auto split = stringOps::splitSpace(args[argi], beginOffset);
|
||||
printSubStrings(args[argi], split);
|
||||
|
||||
Info<< "pop_front(2)" << nl;
|
||||
split.pop_front(2);
|
||||
printSubStrings(args[argi], split);
|
||||
}
|
||||
|
||||
@ -180,7 +201,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label argi=1; argi < args.size(); ++argi)
|
||||
{
|
||||
const auto split = stringOps::split(args[argi], delim, keepEmpty);
|
||||
auto split =
|
||||
stringOps::split(args[argi], delim, beginOffset, keepEmpty);
|
||||
printSubStrings(args[argi], split);
|
||||
}
|
||||
|
||||
@ -199,7 +221,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label argi=1; argi < args.size(); ++argi)
|
||||
{
|
||||
const auto split = stringOps::splitFixed(args[argi], width);
|
||||
auto split = stringOps::splitFixed(args[argi], width, beginOffset);
|
||||
printSubStrings(args[argi], split);
|
||||
}
|
||||
|
||||
@ -219,7 +241,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label argi=1; argi < args.size(); ++argi)
|
||||
{
|
||||
const auto split = stringOps::split(args[argi], delim, keepEmpty);
|
||||
auto split =
|
||||
stringOps::split(args[argi], delim, beginOffset, keepEmpty);
|
||||
printSubStrings(args[argi], split);
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ int main(int argc, char *argv[])
|
||||
// // skip over time=0, unless some other time option has been specified
|
||||
// if
|
||||
// (
|
||||
// !args.found("zeroTime")
|
||||
// !args.found("noZero")
|
||||
// && !args.found("time")
|
||||
// && !args.found("latestTime")
|
||||
// && Times.size() > 2
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -93,29 +93,34 @@ void Foam::fileFormats::ensightMeshReader::readIDs
|
||||
(
|
||||
ensightReadFile& is,
|
||||
const bool doRead,
|
||||
const label nShapes,
|
||||
const label elemCount,
|
||||
labelList& foamToElem,
|
||||
Map<label>& elemToFoam
|
||||
) const
|
||||
{
|
||||
const label sz = foamToElem.size();
|
||||
foamToElem.resize(sz+nShapes);
|
||||
const label begElem = foamToElem.size();
|
||||
const label endElem = begElem + elemCount;
|
||||
|
||||
foamToElem.resize(foamToElem.size()+elemCount);
|
||||
|
||||
if (doRead)
|
||||
{
|
||||
elemToFoam.reserve(elemToFoam.size()+nShapes);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
elemToFoam.reserve(elemToFoam.size()+elemCount);
|
||||
|
||||
for (label elemi = begElem; elemi < endElem; ++elemi)
|
||||
{
|
||||
label elemi;
|
||||
is.read(elemi);
|
||||
foamToElem[sz+shapei] = elemi;
|
||||
elemToFoam.insert(elemi, sz+shapei);
|
||||
label id;
|
||||
is.read(id);
|
||||
foamToElem[elemi] = id;
|
||||
elemToFoam.insert(id, elemi);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
// identity
|
||||
for (label elemi = begElem; elemi < endElem; ++elemi)
|
||||
{
|
||||
foamToElem[sz+shapei] = sz+shapei;
|
||||
foamToElem[elemi] = elemi;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -209,37 +214,54 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
|
||||
// Work
|
||||
DynamicList<label> verts;
|
||||
|
||||
string line;
|
||||
string buffer;
|
||||
while (is.good())
|
||||
{
|
||||
do
|
||||
{
|
||||
is.readKeyword(line);
|
||||
// Get entire line/string
|
||||
is.read(buffer);
|
||||
}
|
||||
while (line.empty() && is.good());
|
||||
while (buffer.empty() && is.good());
|
||||
|
||||
const auto split = stringOps::splitSpace(line);
|
||||
if (!is.good())
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (buffer.contains("BEGIN TIME STEP"))
|
||||
{
|
||||
// Graciously handle a miscued start
|
||||
continue;
|
||||
}
|
||||
else if (buffer.contains("END TIME STEP"))
|
||||
{
|
||||
// END TIME STEP is a valid means to terminate input
|
||||
break;
|
||||
}
|
||||
const auto split = stringOps::splitSpace(buffer);
|
||||
|
||||
if (split.size() == 0)
|
||||
if (split.empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (split[0] == "part")
|
||||
const auto keyword(split[0].str());
|
||||
|
||||
if (keyword == "part")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (split[0] == "node_ids")
|
||||
else if (keyword == "node_ids")
|
||||
{
|
||||
const label nPoints = points.size();
|
||||
// Ignore for now
|
||||
for (label i = 0; i < nPoints; i++)
|
||||
// Ignore point ids
|
||||
for (label pointi = 0; pointi < nPoints; ++pointi)
|
||||
{
|
||||
label index;
|
||||
is.read(index);
|
||||
label id;
|
||||
is.read(id);
|
||||
}
|
||||
}
|
||||
else if (split[0] == "coordinates")
|
||||
else if (keyword == "coordinates")
|
||||
{
|
||||
label nPoints;
|
||||
is.read(nPoints);
|
||||
@ -257,207 +279,205 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
|
||||
nodeIdToPoints
|
||||
);
|
||||
|
||||
points.setSize(nPoints);
|
||||
|
||||
for (label pointi = 0; pointi < nPoints; pointi++)
|
||||
{
|
||||
is.read(points[pointi].x());
|
||||
}
|
||||
for (label pointi = 0; pointi < nPoints; pointi++)
|
||||
{
|
||||
is.read(points[pointi].y());
|
||||
}
|
||||
for (label pointi = 0; pointi < nPoints; pointi++)
|
||||
{
|
||||
is.read(points[pointi].z());
|
||||
}
|
||||
is.readPoints(nPoints, points);
|
||||
}
|
||||
else if (split[0] == "tetra4")
|
||||
else if (keyword == "tetra4")
|
||||
{
|
||||
label nShapes;
|
||||
is.read(nShapes);
|
||||
label elemCount;
|
||||
is.read(elemCount);
|
||||
|
||||
Pout<< indent<< "tetra4 " << nShapes
|
||||
Pout<< indent<< "tetra4 " << elemCount
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
|
||||
const label celli = cells.size();
|
||||
cells.resize(celli+nShapes);
|
||||
|
||||
readIDs
|
||||
(
|
||||
is,
|
||||
read_elem_ids,
|
||||
nShapes,
|
||||
elemCount,
|
||||
cellToElemIds,
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
// Extend and fill the new trailing portion
|
||||
const label startElemi = cells.size();
|
||||
cells.resize(startElemi+elemCount);
|
||||
faceListList::subList myElements = cells.slice(startElemi);
|
||||
|
||||
const auto& model = cellModel::ref(cellModel::TET);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (auto& cellFaces : myElements)
|
||||
{
|
||||
readVerts(is, 4, nodeIdToPoints, verts);
|
||||
if (setHandedness_)
|
||||
{
|
||||
setHandedness(model, verts, points);
|
||||
}
|
||||
const cellShape cellVerts(model, verts);
|
||||
cells[celli+shapei] = cellVerts.faces();
|
||||
cellFaces = cellShape(model, verts).faces();
|
||||
}
|
||||
}
|
||||
else if (split[0] == "pyramid5")
|
||||
else if (keyword == "pyramid5")
|
||||
{
|
||||
label nShapes;
|
||||
is.read(nShapes);
|
||||
label elemCount;
|
||||
is.read(elemCount);
|
||||
|
||||
Pout<< indent<< "pyramid5 " << nShapes
|
||||
Pout<< indent<< "pyramid5 " << elemCount
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
|
||||
const label celli = cells.size();
|
||||
cells.resize(celli+nShapes);
|
||||
|
||||
readIDs
|
||||
(
|
||||
is,
|
||||
read_elem_ids,
|
||||
nShapes,
|
||||
elemCount,
|
||||
cellToElemIds,
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
// Extend and fill the new trailing portion
|
||||
const label startElemi = cells.size();
|
||||
cells.resize(startElemi+elemCount);
|
||||
faceListList::subList myElements = cells.slice(startElemi);
|
||||
|
||||
const auto& model = cellModel::ref(cellModel::PYR);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (auto& cellFaces : myElements)
|
||||
{
|
||||
readVerts(is, 5, nodeIdToPoints, verts);
|
||||
if (setHandedness_)
|
||||
{
|
||||
setHandedness(model, verts, points);
|
||||
}
|
||||
const cellShape cellVerts(model, verts);
|
||||
cells[celli+shapei] = cellVerts.faces();
|
||||
cellFaces = cellShape(model, verts).faces();
|
||||
}
|
||||
}
|
||||
else if (split[0] == "penta6")
|
||||
else if (keyword == "penta6")
|
||||
{
|
||||
label nShapes;
|
||||
is.read(nShapes);
|
||||
label elemCount;
|
||||
is.read(elemCount);
|
||||
|
||||
Pout<< indent<< "penta6 " << nShapes
|
||||
Pout<< indent<< "penta6 " << elemCount
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
|
||||
const label celli = cells.size();
|
||||
cells.resize(celli+nShapes);
|
||||
|
||||
readIDs
|
||||
(
|
||||
is,
|
||||
read_elem_ids,
|
||||
nShapes,
|
||||
elemCount,
|
||||
cellToElemIds,
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
// Extend and fill the new trailing portion
|
||||
const label startElemi = cells.size();
|
||||
cells.resize(startElemi+elemCount);
|
||||
faceListList::subList myElements = cells.slice(startElemi);
|
||||
|
||||
const auto& model = cellModel::ref(cellModel::PRISM);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (auto& cellFaces : myElements)
|
||||
{
|
||||
readVerts(is, 6, nodeIdToPoints, verts);
|
||||
if (setHandedness_)
|
||||
{
|
||||
setHandedness(model, verts, points);
|
||||
}
|
||||
const cellShape cellVerts(model, verts);
|
||||
cells[celli+shapei] = cellVerts.faces();
|
||||
cellFaces = cellShape(model, verts).faces();
|
||||
}
|
||||
}
|
||||
else if (split[0] == "hexa8")
|
||||
else if (keyword == "hexa8")
|
||||
{
|
||||
label nShapes;
|
||||
is.read(nShapes);
|
||||
label elemCount;
|
||||
is.read(elemCount);
|
||||
|
||||
Pout<< indent<< "hexa8 " << nShapes
|
||||
Pout<< indent<< "hexa8 " << elemCount
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
|
||||
const label celli = cells.size();
|
||||
cells.resize(celli+nShapes);
|
||||
|
||||
readIDs
|
||||
(
|
||||
is,
|
||||
read_elem_ids,
|
||||
nShapes,
|
||||
elemCount,
|
||||
cellToElemIds,
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
// Extend and fill the new trailing portion
|
||||
const label startElemi = cells.size();
|
||||
cells.resize(startElemi+elemCount);
|
||||
faceListList::subList myElements = cells.slice(startElemi);
|
||||
|
||||
const auto& model = cellModel::ref(cellModel::HEX);
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (auto& cellFaces : myElements)
|
||||
{
|
||||
readVerts(is, 8, nodeIdToPoints, verts);
|
||||
if (setHandedness_)
|
||||
{
|
||||
setHandedness(model, verts, points);
|
||||
}
|
||||
const cellShape cellVerts(model, verts);
|
||||
cells[celli+shapei] = cellVerts.faces();
|
||||
cellFaces = cellShape(model, verts).faces();
|
||||
}
|
||||
}
|
||||
else if (split[0] == "nfaced")
|
||||
else if (keyword == "nfaced")
|
||||
{
|
||||
label nShapes;
|
||||
is.read(nShapes);
|
||||
label elemCount;
|
||||
is.read(elemCount);
|
||||
|
||||
Pout<< indent<< "nfaced " << nShapes
|
||||
Pout<< indent<< "nfaced " << elemCount
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
|
||||
const label celli = cells.size();
|
||||
cells.resize(celli+nShapes);
|
||||
|
||||
readIDs
|
||||
(
|
||||
is,
|
||||
read_elem_ids,
|
||||
nShapes,
|
||||
elemCount,
|
||||
cellToElemIds,
|
||||
elemIdToCells
|
||||
);
|
||||
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
// Extend and fill the new trailing portion
|
||||
const label startElemi = cells.size();
|
||||
cells.resize(startElemi+elemCount);
|
||||
faceListList::subList myElements = cells.slice(startElemi);
|
||||
|
||||
for (auto& cellFaces : myElements)
|
||||
{
|
||||
label nFaces;
|
||||
is.read(nFaces);
|
||||
faceList& cellFaces = cells[celli+shapei];
|
||||
cellFaces.setSize(nFaces);
|
||||
cellFaces.resize(nFaces);
|
||||
}
|
||||
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (auto& cellFaces : myElements)
|
||||
{
|
||||
faceList& cellFaces = cells[celli+shapei];
|
||||
forAll(cellFaces, cellFacei)
|
||||
for (face& f : cellFaces)
|
||||
{
|
||||
label nVerts;
|
||||
is.read(nVerts);
|
||||
cellFaces[cellFacei].setSize(nVerts);
|
||||
f.resize(nVerts);
|
||||
}
|
||||
}
|
||||
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (faceList& cellFaces : myElements)
|
||||
{
|
||||
faceList& cellFaces = cells[celli+shapei];
|
||||
forAll(cellFaces, cellFacei)
|
||||
for (face& f : cellFaces)
|
||||
{
|
||||
face& f = cellFaces[cellFacei];
|
||||
readVerts(is, f.size(), nodeIdToPoints, verts);
|
||||
f.labelList::operator=(verts);
|
||||
}
|
||||
}
|
||||
|
||||
forAll(f, fp)
|
||||
// Full check
|
||||
forAll(myElements, elemi)
|
||||
{
|
||||
for (const face& f : myElements[elemi])
|
||||
{
|
||||
for (label pointi : f)
|
||||
{
|
||||
if (f[fp] < 0 || f[fp] >= points.size())
|
||||
if (pointi < 0 || pointi >= points.size())
|
||||
{
|
||||
FatalErrorInFunction<< "Face:" << shapei
|
||||
FatalErrorInFunction
|
||||
<< "Face:" << elemi
|
||||
<< " verts:" << f
|
||||
<< " indexes outside points:" << points.size()
|
||||
<< exit(FatalError);
|
||||
@ -466,107 +486,104 @@ bool Foam::fileFormats::ensightMeshReader::readGoldPart
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (split[0] == "tria3")
|
||||
else if (keyword == "tria3")
|
||||
{
|
||||
label nShapes;
|
||||
is.read(nShapes);
|
||||
label elemCount;
|
||||
is.read(elemCount);
|
||||
|
||||
Pout<< indent << "tria3 " << nShapes
|
||||
Pout<< indent << "tria3 " << elemCount
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
|
||||
const label facei = faces.size();
|
||||
|
||||
readIDs
|
||||
(
|
||||
is,
|
||||
read_elem_ids,
|
||||
nShapes,
|
||||
elemCount,
|
||||
faceToElemIDs,
|
||||
elemIdToFaces
|
||||
);
|
||||
|
||||
faces.setSize(facei+nShapes);
|
||||
// Extend and fill the new trailing portion
|
||||
const label startElemi = cells.size();
|
||||
faces.resize(startElemi+elemCount, face(3)); // <- tria3
|
||||
faceList::subList myElements = faces.slice(startElemi);
|
||||
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (face& f : myElements)
|
||||
{
|
||||
auto& f = faces[facei+shapei];
|
||||
f.setSize(3);
|
||||
readVerts(is, f.size(), nodeIdToPoints, verts);
|
||||
f.labelList::operator=(verts);
|
||||
}
|
||||
}
|
||||
else if (split[0] == "quad4")
|
||||
else if (keyword == "quad4")
|
||||
{
|
||||
label nShapes;
|
||||
is.read(nShapes);
|
||||
label elemCount;
|
||||
is.read(elemCount);
|
||||
|
||||
Pout<< indent << "quad4 " << nShapes
|
||||
Pout<< indent << "quad4 " << elemCount
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
|
||||
const label facei = faces.size();
|
||||
|
||||
readIDs
|
||||
(
|
||||
is,
|
||||
read_elem_ids,
|
||||
nShapes,
|
||||
elemCount,
|
||||
faceToElemIDs,
|
||||
elemIdToFaces
|
||||
);
|
||||
|
||||
faces.setSize(facei+nShapes);
|
||||
// Extend and fill the new trailing portion
|
||||
const label startElemi = cells.size();
|
||||
faces.resize(startElemi+elemCount, face(4)); // <- quad4
|
||||
faceList::subList myElements = faces.slice(startElemi);
|
||||
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (face& f : myElements)
|
||||
{
|
||||
auto& f = faces[facei+shapei];
|
||||
f.setSize(4);
|
||||
readVerts(is, f.size(), nodeIdToPoints, verts);
|
||||
f.labelList::operator=(verts);
|
||||
}
|
||||
}
|
||||
else if (split[0] == "nsided")
|
||||
else if (keyword == "nsided")
|
||||
{
|
||||
label nShapes;
|
||||
is.read(nShapes);
|
||||
label elemCount;
|
||||
is.read(elemCount);
|
||||
|
||||
Pout<< indent << "nsided " << nShapes
|
||||
Pout<< indent << "nsided " << elemCount
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
|
||||
const label facei = faces.size();
|
||||
|
||||
readIDs
|
||||
(
|
||||
is,
|
||||
read_elem_ids,
|
||||
nShapes,
|
||||
elemCount,
|
||||
faceToElemIDs,
|
||||
elemIdToFaces
|
||||
);
|
||||
|
||||
faces.setSize(facei+nShapes);
|
||||
// Extend and fill the new trailing portion
|
||||
const label startElemi = cells.size();
|
||||
faces.resize(startElemi+elemCount);
|
||||
faceList::subList myElements = faces.slice(startElemi);
|
||||
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (face& f : myElements)
|
||||
{
|
||||
auto& f = faces[facei+shapei];
|
||||
label nVerts;
|
||||
is.read(nVerts);
|
||||
f.setSize(nVerts);
|
||||
f.resize(nVerts);
|
||||
}
|
||||
|
||||
for (label shapei = 0; shapei < nShapes; shapei++)
|
||||
for (face& f : myElements)
|
||||
{
|
||||
auto& f = faces[facei+shapei];
|
||||
readVerts(is, f.size(), nodeIdToPoints, verts);
|
||||
f.labelList::operator=(verts);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningInFunction << "Unhandled key " << string(split[0])
|
||||
<< " from line " << line
|
||||
WarningInFunction << "Unhandled key " << keyword
|
||||
<< " from line " << buffer
|
||||
<< " starting at line " << is.lineNumber()
|
||||
<< " position " << is.stdStream().tellg() << endl;
|
||||
}
|
||||
@ -584,16 +601,21 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
|
||||
const scalar scaleFactor
|
||||
)
|
||||
{
|
||||
// Auto-detect ascii/binary format,
|
||||
// skips any initial "BEGIN TIME STEP"
|
||||
|
||||
ensightReadFile is(geometryFile_);
|
||||
|
||||
// Skip 'binary' tag
|
||||
is.readBinaryHeader();
|
||||
|
||||
string header;
|
||||
is.read(header);
|
||||
Info<< "Ensight : " << header << endl;
|
||||
is.read(header);
|
||||
Info<< "Ensight : " << header << endl;
|
||||
string buffer;
|
||||
|
||||
// Ensight Geometry File
|
||||
is.read(buffer);
|
||||
Info<< "Ensight : " << buffer << nl;
|
||||
|
||||
// Description - 1
|
||||
is.read(buffer);
|
||||
Info<< "Ensight : " << buffer << nl;
|
||||
|
||||
|
||||
bool read_node_ids = false;
|
||||
@ -623,61 +645,72 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
|
||||
|
||||
|
||||
// Parse all
|
||||
string line;
|
||||
SubStrings<string> split;
|
||||
|
||||
while (is.good())
|
||||
{
|
||||
do
|
||||
{
|
||||
is.readKeyword(line);
|
||||
// Get entire line/string
|
||||
is.read(buffer);
|
||||
}
|
||||
while (line.empty() && is.good());
|
||||
const auto split = stringOps::splitSpace(line);
|
||||
while (buffer.empty() && is.good());
|
||||
if (buffer.contains("END TIME STEP"))
|
||||
{
|
||||
// END TIME STEP is a valid means to terminate input
|
||||
break;
|
||||
}
|
||||
split = stringOps::splitSpace(buffer);
|
||||
|
||||
if (split[0] == "extents")
|
||||
if (split.empty())
|
||||
{
|
||||
point min;
|
||||
point max;
|
||||
is.read(min.x());
|
||||
is.read(max.x());
|
||||
is.read(min.y());
|
||||
is.read(max.y());
|
||||
is.read(min.z());
|
||||
is.read(max.z());
|
||||
Pout<< indent
|
||||
<< "Read extents " << boundBox(min, max)
|
||||
<< endl;
|
||||
continue;
|
||||
}
|
||||
else if (split[0] == "node")
|
||||
|
||||
const auto keyword(split[0].str());
|
||||
|
||||
if (keyword == "extents")
|
||||
{
|
||||
word id(split[1]);
|
||||
word op(split[2]);
|
||||
// Optional extents (xmin, xmax, ymin, ymax, zmin, zmax)
|
||||
|
||||
boundBox bb;
|
||||
point& min = bb.min();
|
||||
point& max = bb.max();
|
||||
|
||||
is.read(min.x()); is.read(max.x());
|
||||
is.read(min.y()); is.read(max.y());
|
||||
is.read(min.z()); is.read(max.z());
|
||||
|
||||
Pout<< indent << "Read extents " << bb << endl;
|
||||
}
|
||||
else if (keyword == "node")
|
||||
{
|
||||
// "node id (off|assign|given|ignore)"
|
||||
std::string op(split[2]);
|
||||
if (op == "given" || op == "ignore")
|
||||
{
|
||||
Pout<< indent << "Reading node ids" << endl;
|
||||
read_node_ids = true;
|
||||
}
|
||||
}
|
||||
else if (split[0] == "element")
|
||||
else if (keyword == "element")
|
||||
{
|
||||
word id(split[1]);
|
||||
word op(split[2]);
|
||||
// "element id (off|assign|given|ignore)"
|
||||
std::string op(split[2]);
|
||||
if (op == "given" || op == "ignore")
|
||||
{
|
||||
Pout<< indent << "Reading element ids" << endl;
|
||||
read_elem_ids = true;
|
||||
}
|
||||
}
|
||||
else if (split[0] == "part")
|
||||
else if (keyword == "part")
|
||||
{
|
||||
bool finished = false;
|
||||
do
|
||||
{
|
||||
// Make space
|
||||
partIDs.emplace_back();
|
||||
is.read(partIDs.back());
|
||||
|
||||
partNames.emplace_back();
|
||||
is.read(partNames.back());
|
||||
// Read part id and name
|
||||
is.read(partIDs.emplace_back());
|
||||
is.read(partNames.emplace_back());
|
||||
|
||||
Pout<< indent
|
||||
<< "Reading part " << partIDs.back()
|
||||
@ -954,7 +987,7 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
|
||||
const face& f = rotateFace(cFaces[cFacei], rotatedFace);
|
||||
|
||||
const auto fFnd = vertsToCell.find(f);
|
||||
if (fFnd)
|
||||
if (fFnd.good())
|
||||
{
|
||||
// Already inserted. Internal face.
|
||||
vertsToCell.erase(fFnd);
|
||||
@ -1026,7 +1059,12 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
|
||||
)
|
||||
);
|
||||
|
||||
if (!cAndF)
|
||||
if (cAndF.good())
|
||||
{
|
||||
partCellAndFace[patchFacei++] = cAndF.val();
|
||||
vertsToCell.erase(cAndF);
|
||||
}
|
||||
else
|
||||
{
|
||||
//WarningInFunction
|
||||
// << "Did not find face " << facei
|
||||
@ -1036,11 +1074,6 @@ bool Foam::fileFormats::ensightMeshReader::readGeometry
|
||||
// << " in part " << parti
|
||||
// << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
partCellAndFace[patchFacei++] = cAndF();
|
||||
vertsToCell.erase(cAndF);
|
||||
}
|
||||
}
|
||||
partCellAndFace.setSize(patchFacei);
|
||||
}
|
||||
|
||||
@ -1569,7 +1569,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
//Get polyMesh to write to constant
|
||||
|
||||
runTime.setTime(instant(runTime.constant()), 0);
|
||||
runTime.setTime(instant(0, runTime.constant()), 0);
|
||||
|
||||
repatcher.repatch();
|
||||
|
||||
|
||||
@ -803,6 +803,10 @@ CompactListList<label> regionRenumber
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"Renumber mesh cells to reduce the bandwidth. Use the -lib option or"
|
||||
@ -863,11 +867,8 @@ int main(int argc, char *argv[])
|
||||
"eg, 'reverse true;'"
|
||||
);
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
#include "addAllRegionOptions.H"
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addTimeOptions.H"
|
||||
|
||||
// -------------------------
|
||||
|
||||
@ -926,14 +927,15 @@ int main(int argc, char *argv[])
|
||||
// Get region names
|
||||
#include "getAllRegionOptions.H"
|
||||
|
||||
// Get times list
|
||||
instantList Times = runTime.times();
|
||||
|
||||
// Set startTime depending on -time and -latestTime options
|
||||
#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);
|
||||
|
||||
// Capture current time information for non-overwrite
|
||||
const Tuple2<instant, label> startTime
|
||||
(
|
||||
instant(runTime.value(), runTime.timeName()),
|
||||
runTime.timeIndex()
|
||||
);
|
||||
|
||||
// Start/reset all timings
|
||||
timer.resetTime();
|
||||
@ -947,7 +949,10 @@ int main(int argc, char *argv[])
|
||||
for (fvMesh& mesh : meshes)
|
||||
{
|
||||
// Reset time in case of multiple meshes and not overwrite
|
||||
runTime.setTime(Times[startTime], startTime);
|
||||
if (!overwrite)
|
||||
{
|
||||
runTime.setTime(startTime.first(), startTime.second());
|
||||
}
|
||||
|
||||
const word oldInstance = mesh.pointsInstance();
|
||||
|
||||
|
||||
@ -62,12 +62,13 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"Add point/face/cell Zones from similarly named point/face/cell Sets"
|
||||
);
|
||||
|
||||
timeSelector::addOptions(true, false); // constant(true), zero(false)
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noFlipMap",
|
||||
@ -75,14 +76,13 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "addTimeOptions.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
const bool noFlipMap = args.found("noFlipMap");
|
||||
|
||||
// Get times list
|
||||
(void)timeSelector::selectIfPresent(runTime, args);
|
||||
// Allow override of time from specified time options, or no-op
|
||||
timeSelector::setTimeIfPresent(runTime, args);
|
||||
|
||||
#include "createNamedPolyMesh.H"
|
||||
|
||||
|
||||
@ -240,9 +240,9 @@ int main(int argc, char *argv[])
|
||||
// Read set construct info from dictionary
|
||||
List<namedDictionary> actionEntries(topoSetDict.lookup("actions"));
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
|
||||
// Optionally re-read mesh
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
Copyright (C) 2024 Haakan Nilsson
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,6 +72,9 @@ Usage
|
||||
The any or all of the three options may be specified and are processed
|
||||
in the above order.
|
||||
|
||||
-cylToCart (originVector axisVector directionVector)
|
||||
Tranform cylindrical coordinates to cartesian coordinates
|
||||
|
||||
With -rotateFields (in combination with -rotate/yawPitchRoll/rollPitchYaw)
|
||||
it will also read & transform vector & tensor fields.
|
||||
|
||||
@ -93,6 +97,7 @@ Note
|
||||
#include "transformGeometricField.H"
|
||||
#include "axisAngleRotation.H"
|
||||
#include "EulerCoordinateRotation.H"
|
||||
#include "cylindricalCS.H"
|
||||
|
||||
using namespace Foam;
|
||||
using namespace Foam::coordinateRotations;
|
||||
@ -326,6 +331,13 @@ int main(int argc, char *argv[])
|
||||
"Scale by the specified amount - Eg, for uniform [mm] to [m] scaling "
|
||||
"use either '(0.001 0.001 0.001)' or simply '0.001'"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"cylToCart",
|
||||
"(originVec axisVec directionVec)",
|
||||
"Tranform cylindrical coordinates to cartesian coordinates"
|
||||
);
|
||||
|
||||
|
||||
// Compatibility with surfaceTransformPoints
|
||||
argList::addOptionCompat("scale", {"write-scale", 0});
|
||||
@ -348,7 +360,8 @@ int main(int argc, char *argv[])
|
||||
"rotate-z",
|
||||
"rollPitchYaw",
|
||||
"yawPitchRoll",
|
||||
"scale"
|
||||
"scale",
|
||||
"cylToCart"
|
||||
});
|
||||
|
||||
if (!args.count(operationNames))
|
||||
@ -552,6 +565,23 @@ int main(int argc, char *argv[])
|
||||
// Output scaling
|
||||
applyScaling(points, getScalingOpt("scale", args));
|
||||
|
||||
if (args.found("cylToCart"))
|
||||
{
|
||||
vectorField n1n2(args.lookup("cylToCart")());
|
||||
n1n2[1].normalise();
|
||||
n1n2[2].normalise();
|
||||
|
||||
cylindricalCS ccs
|
||||
(
|
||||
"ccs",
|
||||
n1n2[0],
|
||||
n1n2[1],
|
||||
n1n2[2]
|
||||
);
|
||||
|
||||
points = ccs.globalPosition(points);
|
||||
}
|
||||
|
||||
// More precision (for points data)
|
||||
IOstream::minPrecision(10);
|
||||
|
||||
|
||||
@ -549,16 +549,17 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< finder.dict();
|
||||
}
|
||||
else if (finder.ref().isStream())
|
||||
else if (finder.isStream())
|
||||
{
|
||||
bool addSep = false;
|
||||
bool separator = false;
|
||||
|
||||
const tokenList& tokens = finder.ref().stream();
|
||||
|
||||
for (const token& tok : tokens)
|
||||
for (const token& tok : finder.stream())
|
||||
{
|
||||
if (addSep) Info<< token::SPACE;
|
||||
addSep = true;
|
||||
if (separator)
|
||||
{
|
||||
Info<< token::SPACE;
|
||||
}
|
||||
separator = true;
|
||||
Info<< tok;
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
@ -554,7 +554,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
autoPtr<ensightGeoFile> os =
|
||||
ensCase.newGeometry(hasMovingMesh);
|
||||
ensMesh.write(os);
|
||||
|
||||
ensMesh.write(os.ref());
|
||||
}
|
||||
|
||||
// finite-area
|
||||
@ -562,7 +563,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
autoPtr<ensightGeoFile> os =
|
||||
ensFaCasePtr->newGeometry(hasMovingMesh);
|
||||
ensFaMeshPtr->write(os);
|
||||
|
||||
ensFaMeshPtr->write(os.ref());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
Copyright (C) 2023-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,6 +36,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "pointFields.H"
|
||||
@ -145,20 +146,22 @@ void ReadAndMapFields
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"Convert polyMesh results to tetDualMesh"
|
||||
);
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
#include "addTimeOptions.H"
|
||||
|
||||
#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);
|
||||
|
||||
// Read the mesh
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
@ -353,7 +353,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
runTime.setTime(instant(runTime.constant()), 0);
|
||||
runTime.setTime(instant(0, runTime.constant()), 0);
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
runTime.setTime(instant(runTime.constant()), 0);
|
||||
runTime.setTime(instant(0, runTime.constant()), 0);
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef MapConsistentVolFields_H
|
||||
#define MapConsistentVolFields_H
|
||||
#ifndef Foam_MapConsistentVolFields_H
|
||||
#define Foam_MapConsistentVolFields_H
|
||||
|
||||
#include "GeometricField.H"
|
||||
#include "meshToMesh.H"
|
||||
@ -41,10 +41,9 @@ namespace Foam
|
||||
template<class Type>
|
||||
void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
|
||||
{
|
||||
auto& fldBf = fld.boundaryFieldRef();
|
||||
auto& bfld = fld.boundaryFieldRef();
|
||||
|
||||
const UPstream::commsTypes commsType = UPstream::defaultCommsType;
|
||||
const label startOfRequests = UPstream::nRequests();
|
||||
|
||||
if
|
||||
(
|
||||
@ -52,37 +51,32 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
|
||||
|| commsType == UPstream::commsTypes::nonBlocking
|
||||
)
|
||||
{
|
||||
forAll(fldBf, patchi)
|
||||
{
|
||||
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||
const label startOfRequests = UPstream::nRequests();
|
||||
|
||||
for (auto& pfld : bfld)
|
||||
{
|
||||
if
|
||||
(
|
||||
tgtField.type() == tgtField.patch().patch().type()
|
||||
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||
pfld.type() == pfld.patch().patch().type()
|
||||
&& polyPatch::constraintType(pfld.patch().patch().type())
|
||||
)
|
||||
{
|
||||
tgtField.initEvaluate(commsType);
|
||||
pfld.initEvaluate(commsType);
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for outstanding requests
|
||||
if (commsType == UPstream::commsTypes::nonBlocking)
|
||||
{
|
||||
UPstream::waitRequests(startOfRequests);
|
||||
}
|
||||
// Wait for outstanding requests (non-blocking)
|
||||
UPstream::waitRequests(startOfRequests);
|
||||
|
||||
forAll(fldBf, patchi)
|
||||
for (auto& pfld : bfld)
|
||||
{
|
||||
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||
|
||||
if
|
||||
(
|
||||
tgtField.type() == tgtField.patch().patch().type()
|
||||
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||
pfld.type() == pfld.patch().patch().type()
|
||||
&& polyPatch::constraintType(pfld.patch().patch().type())
|
||||
)
|
||||
{
|
||||
tgtField.evaluate(commsType);
|
||||
pfld.evaluate(commsType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,22 +88,21 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
|
||||
for (const auto& schedEval : patchSchedule)
|
||||
{
|
||||
const label patchi = schedEval.patch;
|
||||
|
||||
fvPatchField<Type>& tgtField = fldBf[patchi];
|
||||
auto& pfld = bfld[patchi];
|
||||
|
||||
if
|
||||
(
|
||||
tgtField.type() == tgtField.patch().patch().type()
|
||||
&& polyPatch::constraintType(tgtField.patch().patch().type())
|
||||
pfld.type() == pfld.patch().patch().type()
|
||||
&& polyPatch::constraintType(pfld.patch().patch().type())
|
||||
)
|
||||
{
|
||||
if (schedEval.init)
|
||||
{
|
||||
tgtField.initEvaluate(commsType);
|
||||
pfld.initEvaluate(commsType);
|
||||
}
|
||||
else
|
||||
{
|
||||
tgtField.evaluate(commsType);
|
||||
pfld.evaluate(commsType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 DHI
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 German Aerospace Center (DLR)
|
||||
Copyright (C) 2020 Johan Roenby
|
||||
-------------------------------------------------------------------------------
|
||||
@ -39,6 +39,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "timeSelector.H"
|
||||
|
||||
#include "triSurface.H"
|
||||
#include "triSurfaceTools.H"
|
||||
@ -139,6 +140,10 @@ void setAlpha
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"Uses cutCellIso to create a volume fraction field from an "
|
||||
@ -151,9 +156,14 @@ int main(int argc, char *argv[])
|
||||
"file",
|
||||
"Alternative setAlphaFieldDict dictionary"
|
||||
);
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
// Set time from specified time options, or no-op
|
||||
timeSelector::setTimeIfPresent(runTime, args);
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
const word dictName("setAlphaFieldDict");
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2022-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2022-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,6 +36,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "Time.H"
|
||||
#include "fvMesh.H"
|
||||
#include "faMesh.H"
|
||||
@ -656,6 +657,10 @@ struct setAreaField
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
timeSelector::addOptions_singleTime(); // Single-time options
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"Set values on a selected set of cells/patch-faces via a dictionary"
|
||||
@ -670,8 +675,15 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
#include "addRegionOption.H"
|
||||
|
||||
// -------------------------
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
// Set time from specified time options, or no-op
|
||||
timeSelector::setTimeIfPresent(runTime, args);
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
|
||||
autoPtr<faMesh> faMeshPtr;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -161,25 +161,22 @@ int main(int argc, char *argv[])
|
||||
// rather than tensors to allow indexed permutation.
|
||||
|
||||
// Cartesian basis vectors - right handed orthogonal triplet
|
||||
List<vector> cartesian(3);
|
||||
FixedList<vector, 3> cartesian;
|
||||
|
||||
cartesian[0] = vector(1, 0, 0);
|
||||
cartesian[1] = vector(0, 1, 0);
|
||||
cartesian[2] = vector(0, 0, 1);
|
||||
|
||||
// Principal axis basis vectors - right handed orthogonal
|
||||
// triplet
|
||||
List<vector> principal(3);
|
||||
// Principal axis basis vectors - right handed orthogonal triplet
|
||||
FixedList<vector, 3> principal;
|
||||
|
||||
principal[0] = eVec.x();
|
||||
principal[1] = eVec.y();
|
||||
principal[2] = eVec.z();
|
||||
|
||||
scalar maxMagDotProduct = -GREAT;
|
||||
|
||||
// Matching axis indices, first: cartesian, second:principal
|
||||
|
||||
Pair<label> match(-1, -1);
|
||||
scalar maxMagDotProduct = -GREAT;
|
||||
|
||||
forAll(cartesian, cI)
|
||||
{
|
||||
@ -187,12 +184,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
scalar magDotProduct = mag(cartesian[cI] & principal[pI]);
|
||||
|
||||
if (magDotProduct > maxMagDotProduct)
|
||||
if (maxMagDotProduct < magDotProduct)
|
||||
{
|
||||
maxMagDotProduct = magDotProduct;
|
||||
|
||||
match.first() = cI;
|
||||
|
||||
match.second() = pI;
|
||||
}
|
||||
}
|
||||
@ -208,7 +204,7 @@ int main(int argc, char *argv[])
|
||||
// Invert the best match direction and swap the order of
|
||||
// the other two vectors
|
||||
|
||||
List<vector> tPrincipal = principal;
|
||||
FixedList<vector, 3> tPrincipal = principal;
|
||||
|
||||
tPrincipal[match.second()] *= -1;
|
||||
|
||||
@ -237,7 +233,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
permutationDelta += 3;
|
||||
|
||||
List<vector> tPrincipal = principal;
|
||||
FixedList<vector, 3> tPrincipal = principal;
|
||||
|
||||
vector tEVal = eVal;
|
||||
|
||||
@ -253,10 +249,9 @@ int main(int argc, char *argv[])
|
||||
eVal = tEVal;
|
||||
}
|
||||
|
||||
label matchedAlready = match.first();
|
||||
|
||||
match =Pair<label>(-1, -1);
|
||||
const label matchedAlready = match.first();
|
||||
|
||||
match = Pair<label>(-1, -1);
|
||||
maxMagDotProduct = -GREAT;
|
||||
|
||||
forAll(cartesian, cI)
|
||||
@ -275,12 +270,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
scalar magDotProduct = mag(cartesian[cI] & principal[pI]);
|
||||
|
||||
if (magDotProduct > maxMagDotProduct)
|
||||
if (maxMagDotProduct < magDotProduct)
|
||||
{
|
||||
maxMagDotProduct = magDotProduct;
|
||||
|
||||
match.first() = cI;
|
||||
|
||||
match.second() = pI;
|
||||
}
|
||||
}
|
||||
@ -295,7 +289,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
principal[match.second()] *= -1;
|
||||
|
||||
List<vector> tPrincipal = principal;
|
||||
FixedList<vector, 3> tPrincipal = principal;
|
||||
|
||||
tPrincipal[(matchedAlready + 1) % 3] =
|
||||
principal[(matchedAlready + 2) % 3]*-sense;
|
||||
@ -335,15 +329,16 @@ int main(int argc, char *argv[])
|
||||
showTransform = false;
|
||||
}
|
||||
|
||||
// calculate the total surface area
|
||||
|
||||
// Calculate total surface area and average normal vector
|
||||
scalar surfaceArea = 0;
|
||||
vector averageNormal(Zero);
|
||||
|
||||
forAll(surf, facei)
|
||||
{
|
||||
const labelledTri& f = surf[facei];
|
||||
|
||||
if (f[0] == f[1] || f[0] == f[2] || f[1] == f[2])
|
||||
if (!f.good())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Illegal triangle " << facei << " vertices " << f
|
||||
@ -351,20 +346,23 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceArea += triPointRef
|
||||
(
|
||||
surf.points()[f[0]],
|
||||
surf.points()[f[1]],
|
||||
surf.points()[f[2]]
|
||||
).mag();
|
||||
triPointRef tri = f.tri(surf.points());
|
||||
|
||||
surfaceArea += tri.mag();
|
||||
averageNormal += tri.areaNormal();
|
||||
}
|
||||
}
|
||||
|
||||
// The unit normal (area-averaged)
|
||||
averageNormal.normalise();
|
||||
|
||||
|
||||
Info<< nl << setprecision(12)
|
||||
<< "Density: " << density << nl
|
||||
<< "Mass: " << m << nl
|
||||
<< "Centre of mass: " << cM << nl
|
||||
<< "Surface area: " << surfaceArea << nl
|
||||
<< "Average normal: " << averageNormal << nl
|
||||
<< "Inertia tensor around centre of mass: " << nl << J << nl
|
||||
<< "eigenValues (principal moments): " << eVal << nl
|
||||
<< "eigenVectors (principal axes): " << nl
|
||||
@ -398,21 +396,26 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
}
|
||||
|
||||
OFstream str("axes.obj");
|
||||
|
||||
Info<< nl << "Writing scaled principal axes at centre of mass of "
|
||||
<< surfFileName << " to " << str.name() << endl;
|
||||
|
||||
scalar scale = mag(cM - surf.points()[0])/eVal.component(findMin(eVal));
|
||||
|
||||
meshTools::writeOBJ(str, cM);
|
||||
meshTools::writeOBJ(str, cM + scale*eVal.x()*eVec.x());
|
||||
meshTools::writeOBJ(str, cM + scale*eVal.y()*eVec.y());
|
||||
meshTools::writeOBJ(str, cM + scale*eVal.z()*eVec.z());
|
||||
|
||||
for (label i = 1; i < 4; i++)
|
||||
// Write (scaled) principal axes at centre of mass
|
||||
{
|
||||
str << "l " << 1 << ' ' << i + 1 << endl;
|
||||
OFstream str("axes.obj");
|
||||
|
||||
Info<< nl << "Writing scaled principal axes at centre of mass of "
|
||||
<< surfFileName << " to " << str.name() << endl;
|
||||
|
||||
scalar scale =
|
||||
mag(cM - surf.points()[0])/eVal.component(findMin(eVal));
|
||||
|
||||
meshTools::writeOBJ(str, cM);
|
||||
meshTools::writeOBJ(str, cM + scale*eVal.x()*eVec.x());
|
||||
meshTools::writeOBJ(str, cM + scale*eVal.y()*eVec.y());
|
||||
meshTools::writeOBJ(str, cM + scale*eVal.z()*eVec.z());
|
||||
|
||||
for (label i = 1; i < 4; i++)
|
||||
{
|
||||
str << "l " << 1 << ' ' << i + 1 << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022,2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,6 +58,7 @@ Description
|
||||
#include "axisAngleRotation.H"
|
||||
#include "EulerCoordinateRotation.H"
|
||||
#include "MeshedSurfaces.H"
|
||||
#include "cylindricalCS.H"
|
||||
|
||||
using namespace Foam;
|
||||
using namespace Foam::coordinateRotations;
|
||||
@ -257,6 +258,12 @@ int main(int argc, char *argv[])
|
||||
"type",
|
||||
"Output format (default: use file extension)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"cylToCart",
|
||||
"(originVec axisVec directionVec)",
|
||||
"Tranform cylindrical coordinates to cartesian coordinates"
|
||||
);
|
||||
|
||||
// Backward compatibility and with transformPoints
|
||||
argList::addOptionCompat("write-scale", {"scale", -2006});
|
||||
@ -277,7 +284,8 @@ int main(int argc, char *argv[])
|
||||
"rollPitchYaw",
|
||||
"yawPitchRoll",
|
||||
"read-scale",
|
||||
"write-scale"
|
||||
"write-scale",
|
||||
"cylToCart"
|
||||
});
|
||||
|
||||
if (!args.count(operationNames))
|
||||
@ -461,6 +469,24 @@ int main(int argc, char *argv[])
|
||||
// Output scaling
|
||||
applyScaling(points, getScalingOpt("write-scale", args));
|
||||
|
||||
// Conversion to cylindrical coords
|
||||
if (args.found("cylToCart"))
|
||||
{
|
||||
vectorField n1n2(args.lookup("cylToCart")());
|
||||
n1n2[1].normalise();
|
||||
n1n2[2].normalise();
|
||||
|
||||
cylindricalCS ccs
|
||||
(
|
||||
"ccs",
|
||||
n1n2[0],
|
||||
n1n2[1],
|
||||
n1n2[2]
|
||||
);
|
||||
|
||||
points = ccs.globalPosition(points);
|
||||
}
|
||||
|
||||
surf1.movePoints(points);
|
||||
surf1.write(exportName, writeFileType);
|
||||
|
||||
|
||||
@ -210,7 +210,7 @@ reportExecutable()
|
||||
{
|
||||
APP_NAME="$1"
|
||||
APP_SPEC="$2"
|
||||
APP_PATH="$(findExec $PATH $1)"
|
||||
APP_PATH="$(findExec "$PATH" "$1")"
|
||||
VERSION="unknown"
|
||||
|
||||
if [ -z "$APP_PATH" ]
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
# Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -48,8 +48,16 @@ options:
|
||||
-name=NAME Stem for tar-file (default: auto)
|
||||
-output=DIR Output directory (default: ".")
|
||||
-prefix=NAME Prefix directory within tar-file (default: auto)
|
||||
-pkg-modules Only package submodules - exclude OpenFOAM
|
||||
-no-modules Exclude submodules
|
||||
-pkg-modules Package 'modules' exclusively (no OpenFOAM)
|
||||
-pkg-plugins Package 'plugins' exclusively (no OpenFOAM)
|
||||
-no-extras Exclude 'modules, plugins,...' from source pack
|
||||
-no-modules Exclude 'modules' from source pack (default: off)
|
||||
-no-plugins Exclude 'plugins' from source pack (default: on)
|
||||
-all-extras Include 'modules, plugins,...' into source pack
|
||||
-with-modules Include 'modules' into source pack (default: on)
|
||||
-with-plugins Include 'plugins' into source pack (default: off)
|
||||
-modules=name1,.. Include specifed 'modules' into source pack
|
||||
-plugins=name1,.. Include specifed 'plugins' into source pack
|
||||
-no-patch Ignore '_patch' number for output tar-file
|
||||
-no-prefix Do not prefix subdirectory
|
||||
-no-compress Disable compression
|
||||
@ -67,7 +75,7 @@ Script generator for packing OpenFOAM sources and submodules.
|
||||
Eg,
|
||||
|
||||
$Script -output=some-dir origin/master > create-tar-file
|
||||
sh ./create-tar-file
|
||||
bash ./create-tar-file
|
||||
|
||||
$Script -tgz origin/master | bash
|
||||
|
||||
@ -90,11 +98,16 @@ die()
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
outputDir="."
|
||||
outputDir='.'
|
||||
versionSeparator='_'
|
||||
withPatchNum=true
|
||||
unset compress packageApi withSource withModules prefixDir tarName
|
||||
unset gitbase
|
||||
# Default selections
|
||||
select_source=true
|
||||
select_modules=true
|
||||
select_plugins=false
|
||||
|
||||
unset compress gitbase packageApi prefixDir tarName
|
||||
|
||||
|
||||
# Cleanup tarName to remove trailing '.tar', detect compression etc
|
||||
cleanTarName() {
|
||||
@ -117,7 +130,7 @@ cleanTarName() {
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help*)
|
||||
-h | -help* | --help*)
|
||||
printHelp
|
||||
;;
|
||||
-debian | -debian=[0-9]*)
|
||||
@ -146,13 +159,43 @@ do
|
||||
prefixDir="${1#*=}"
|
||||
prefixDir="${prefixDir%/}"
|
||||
;;
|
||||
-pkg-modules)
|
||||
withModules=true
|
||||
withSource=false
|
||||
-all-extras)
|
||||
select_modules=true
|
||||
select_plugins=true
|
||||
;;
|
||||
-with-modules)
|
||||
select_modules=true
|
||||
;;
|
||||
-modules=*)
|
||||
select_modules="${1#*=}"
|
||||
: "${select_modules:=true}"
|
||||
;;
|
||||
-with-plugins)
|
||||
select_plugins=true
|
||||
;;
|
||||
-plugins=*)
|
||||
select_plugins="${1#*=}"
|
||||
: "${select_plugins:=true}"
|
||||
;;
|
||||
-no-extras)
|
||||
select_modules=false
|
||||
select_plugins=false
|
||||
;;
|
||||
-no-modules)
|
||||
withModules=false
|
||||
withSource=true
|
||||
select_modules=false
|
||||
;;
|
||||
-no-plugins)
|
||||
select_plugins=false
|
||||
;;
|
||||
-pkg-modules) # Package modules exclusively
|
||||
select_modules=true
|
||||
select_plugins=false
|
||||
select_source=false
|
||||
;;
|
||||
-pkg-plugins) # Package plugins exclusively
|
||||
select_modules=false
|
||||
select_plugins=true
|
||||
select_source=false
|
||||
;;
|
||||
-no-patch)
|
||||
withPatchNum=false
|
||||
@ -291,9 +334,15 @@ fi
|
||||
if [ -z "$prefixDir" ]
|
||||
then
|
||||
prefixDir="OpenFOAM-v${packageApi}"
|
||||
if [ "$withSource" = false ]
|
||||
if [ "$select_source" = false ]
|
||||
then
|
||||
prefixDir="OpenFOAM-modules-v${packageApi}"
|
||||
# Either -pkg-modules or -pkg-plugins, not both
|
||||
if [ "$select_modules" != false ]
|
||||
then
|
||||
prefixDir="OpenFOAM-modules-v${packageApi}"
|
||||
else
|
||||
prefixDir="OpenFOAM-plugins-v${packageApi}"
|
||||
fi
|
||||
fi
|
||||
elif [ "$prefixDir" = false ]
|
||||
then
|
||||
@ -320,9 +369,15 @@ case "$tarName" in
|
||||
|
||||
('')
|
||||
tarName="OpenFOAM-v${packageApi}"
|
||||
if [ "$withSource" = false ]
|
||||
if [ "$select_source" = false ]
|
||||
then
|
||||
tarName="OpenFOAM-modules-v${packageApi}"
|
||||
# Either -pkg-modules or -pkg-plugins, not both
|
||||
if [ "$select_modules" != false ]
|
||||
then
|
||||
tarName="OpenFOAM-modules-v${packageApi}"
|
||||
else
|
||||
tarName="OpenFOAM-plugins-v${packageApi}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$withPatchNum" = false ]
|
||||
@ -362,48 +417,56 @@ echo 'tar -cf "$outputDir/$tarName.tar" -T /dev/null'
|
||||
echo
|
||||
echo 'buildInfo="${prefixDir}${prefixDir:+@}META-INFO@build-info"'
|
||||
echo 'manifest0="${prefixDir}${prefixDir:+@}META-INFO@manifest.txt"'
|
||||
echo 'manifest1="${prefixDir}${prefixDir:+@}META-INFO@modules-manifest.txt"'
|
||||
echo '#--------'
|
||||
echo 'manifest1="${prefixDir}${prefixDir:+@}META-INFO@manifest-modules.txt"'
|
||||
echo 'manifest2="${prefixDir}${prefixDir:+@}META-INFO@manifest-plugins.txt"'
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Sort out particulars related to modules
|
||||
if [ "$withModules" = false ]
|
||||
# Sort out particulars related to modules, source
|
||||
|
||||
if [ "$select_source" = false ]
|
||||
then
|
||||
echo '# No modules'
|
||||
echo 'unset manifest1'
|
||||
echo 'unset buildInfo manifest0 # No source'
|
||||
fi
|
||||
|
||||
if [ "$withSource" = false ]
|
||||
if [ "$select_modules" = false ]
|
||||
then
|
||||
echo '# No OpenFOAM source (package modules exclusively)'
|
||||
echo 'unset buildInfo'
|
||||
echo 'unset manifest0'
|
||||
echo 'unset manifest1 # No modules'
|
||||
fi
|
||||
|
||||
if [ "$select_plugins" = false ]
|
||||
then
|
||||
echo 'unset manifest2 # No plugins'
|
||||
fi
|
||||
|
||||
echo '#--------'
|
||||
echo 'set -x'
|
||||
echo
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# OpenFOAM sources
|
||||
if [ "$withSource" != false ]
|
||||
# OpenFOAM sources (unless explicitly excluded)
|
||||
|
||||
if [ "$select_source" != false ]
|
||||
then
|
||||
echo 'git -c tar.umask=0022 archive --format=tar ${prefixDir:+--prefix="$prefixDir/"} -o "$outputDir/$tarName.tar" "$head"'
|
||||
|
||||
# Tag build information with underscore to distinguish from "real" build
|
||||
# information when git is available.
|
||||
echo 'echo build="${build:+_}$build" > "$outputDir/$buildInfo"'
|
||||
|
||||
echo echo 'build="${build:+_}$build" > "$outputDir/$buildInfo"'
|
||||
echo
|
||||
echo '# source'
|
||||
echo 'manifestFile="$manifest0"'
|
||||
echo '{'
|
||||
echo ' echo api="$api"'
|
||||
echo ' echo patch="$patch"'
|
||||
echo ' echo head="$head"'
|
||||
echo ' echo'
|
||||
echo ' git ls-tree -r "$head"'
|
||||
echo '} > "$outputDir/$manifest0"'
|
||||
echo '} > "$outputDir/${manifestFile:?}"'
|
||||
echo 'unset manifestFile'
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Add in modules
|
||||
# OpenFOAM modules/plugins
|
||||
|
||||
# Recursive addition of submodule content.
|
||||
# NB: must be called from within the respective parent directory.
|
||||
@ -411,11 +474,15 @@ fi
|
||||
#
|
||||
# packModule abc (implied cd)
|
||||
# packModule abc/def
|
||||
# packModule abc/def/hij
|
||||
# packModule abc/def/ghi
|
||||
#
|
||||
packModule()
|
||||
{
|
||||
local parent="$1"
|
||||
local filter="$2"
|
||||
|
||||
# Using filter=true means accept everything
|
||||
if [ "$filter" = true ]; then unset filter; fi
|
||||
|
||||
(
|
||||
if [ -n "$parent" ]
|
||||
@ -424,34 +491,51 @@ packModule()
|
||||
fi
|
||||
|
||||
git ls-tree -d HEAD | \
|
||||
while read mode gittype sha1 module
|
||||
while read mode gittype sha1 moduleName
|
||||
do
|
||||
[ "$gittype" == commit ] || continue
|
||||
|
||||
case "$module" in
|
||||
case "$moduleName" in
|
||||
(. | ./)
|
||||
echo
|
||||
echo "# ----"
|
||||
echo "# module $parent : not initialized?"
|
||||
echo "# submodule $parent : not initialized?"
|
||||
echo "# ----"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
# Fully qualified
|
||||
module="$parent${parent:+/}$module"
|
||||
module="$parent${parent:+/}$moduleName"
|
||||
moduleName="${moduleName##*/}"
|
||||
|
||||
echo
|
||||
echo "# module"
|
||||
echo "# submodule"
|
||||
echo "module='$module'"
|
||||
echo "commit='$sha1'"
|
||||
echo "tmpTarFile='$tarName-${module##*/}.tar'"
|
||||
|
||||
# Simplistic filtering
|
||||
if [ -n "$filter" ] && [ "${filter/$moduleName/}" = "$filter" ]
|
||||
then
|
||||
echo "# ----"
|
||||
echo '{'
|
||||
echo ' echo'
|
||||
echo ' echo "$module"'
|
||||
echo ' echo commit="$commit"'
|
||||
echo ' echo "# not exported"'
|
||||
echo ' echo'
|
||||
echo '} >> "$outputDir/${manifestFile:?}"'
|
||||
continue
|
||||
fi
|
||||
|
||||
# Intermediate tar file for module contents
|
||||
echo "tmpTarFile='$tarName-$moduleName.tar'"
|
||||
echo "# ----"
|
||||
echo '('
|
||||
echo ' cd "$module" || exit'
|
||||
echo ' newPrefix="$prefixDir${prefixDir:+/}$module"'
|
||||
echo ' git -c tar.umask=0022 archive --format=tar --prefix="$newPrefix/" -o "$outputDir/$tmpTarFile" "$commit" || exit'
|
||||
# Without {test,tests,validation} directories (potentially large)
|
||||
echo ' # Without {test,tests,validation} directories (potentially large)'
|
||||
echo ' tar --delete -f "$outputDir/$tmpTarFile" "$newPrefix/test" "$newPrefix/tests" "$newPrefix/validation" 2>/dev/null'
|
||||
echo ' tar -Af "$outputDir/$tarName.tar" "$outputDir/$tmpTarFile"'
|
||||
echo ' {'
|
||||
@ -461,32 +545,58 @@ packModule()
|
||||
echo ' echo'
|
||||
echo ' # Without {test,tests,validation} directories'
|
||||
echo ' git ls-tree -r "$commit" | sed -e '"'"'/\t\(test\|\tests\|validation\)\//d'"'"
|
||||
echo ' } >> "$outputDir/$manifest1"'
|
||||
echo ' } >> "$outputDir/${manifestFile:?}"'
|
||||
echo ')'
|
||||
# Remove tmp tar file, even if git archive failed (creates zero-sized tar)
|
||||
echo "# ----"
|
||||
echo 'rm -f "$outputDir/$tmpTarFile"'
|
||||
|
||||
# No filter for lower levels...
|
||||
packModule "$module"
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
if [ "$withModules" != false ]
|
||||
# modules/
|
||||
if [ "$select_modules" != false ]
|
||||
then
|
||||
echo
|
||||
echo '# Modules'
|
||||
echo '# modules/'
|
||||
echo 'manifestFile="$manifest1"'
|
||||
echo '{'
|
||||
echo ' echo "# OpenFOAM modules"'
|
||||
echo ' echo api="$api"'
|
||||
echo ' echo patch="$patch"'
|
||||
echo ' echo head="$head"'
|
||||
echo '} > "$outputDir/$manifest1"'
|
||||
echo '} > "$outputDir/${manifestFile:?}"'
|
||||
|
||||
packModule modules
|
||||
# With all or specified modules
|
||||
packModule modules "$select_modules"
|
||||
|
||||
echo
|
||||
echo '{ echo; echo "# End"; } >> "$outputDir/$manifest1"'
|
||||
echo '{ echo; echo "# End"; } >> "$outputDir/${manifestFile:?}"'
|
||||
echo 'unset manifestFile'
|
||||
fi
|
||||
|
||||
# plugins/
|
||||
if [ "$select_plugins" != false ]
|
||||
then
|
||||
echo
|
||||
echo '# plugins/'
|
||||
echo 'manifestFile="$manifest2"'
|
||||
echo '{'
|
||||
echo ' echo "# OpenFOAM plugins"'
|
||||
echo ' echo api="$api"'
|
||||
echo ' echo patch="$patch"'
|
||||
echo ' echo head="$head"'
|
||||
echo '} > "$outputDir/${manifestFile:?}"'
|
||||
|
||||
# With all or specified plugins
|
||||
packModule plugins "$select_plugins"
|
||||
|
||||
echo
|
||||
echo '{ echo; echo "# End"; } >> "$outputDir/${manifestFile:?}"'
|
||||
echo 'unset manifestFile'
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -494,10 +604,10 @@ fi
|
||||
# Decode '@' in the names as '/' directory separator
|
||||
|
||||
echo
|
||||
echo "echo 'Adding build-info and manifest files'"
|
||||
echo echo 'Adding build-info and manifest files'
|
||||
echo 'if pushd "$outputDir"; then'
|
||||
echo "tar --owner=root --group=root --append --transform='s|@|/|g' -v -f \"\$tarName.tar\" \"\$buildInfo\" \"\$manifest0\" \"\$manifest1\""
|
||||
echo 'rm -f "$buildInfo" "$manifest0" "$manifest1"'
|
||||
echo "tar --owner=root --group=root --append --transform='s|@|/|g' -v -f \"\$tarName.tar\" \"\$buildInfo\" \"\$manifest0\" \"\$manifest1\" \"\$manifest2\""
|
||||
echo 'rm -f "$buildInfo" "$manifest0" "$manifest1" "$manifest2"'
|
||||
echo 'popd; fi'
|
||||
|
||||
echo
|
||||
@ -509,18 +619,18 @@ echo "# -----------------------"
|
||||
# Compression
|
||||
|
||||
case "$compress" in
|
||||
('')
|
||||
('')
|
||||
echo "No compression requested" 1>&2
|
||||
;;
|
||||
|
||||
(gz | gzip)
|
||||
(gz | gzip)
|
||||
echo "Using gzip compression" 1>&2
|
||||
echo 'gzip -f -9 "$outputDir/$tarName.tar"'
|
||||
echo
|
||||
echo '# End of compression'
|
||||
;;
|
||||
|
||||
(tgz)
|
||||
(tgz)
|
||||
echo "Using gzip compression with tgz ending" 1>&2
|
||||
echo 'gzip -c -9 "$outputDir/$tarName.tar" > "$outputDir/$tarName.tgz"'
|
||||
echo 'rm -f "$outputDir/$tarName.tar"'
|
||||
@ -528,28 +638,28 @@ case "$compress" in
|
||||
echo '# End of compression'
|
||||
;;
|
||||
|
||||
(bz | bzip | bzip2)
|
||||
(bz | bzip | bzip2)
|
||||
echo "Using bzip2 compression" 1>&2
|
||||
echo 'bzip2 -f -9 "$outputDir/$tarName.tar"'
|
||||
echo
|
||||
echo '# End of compression'
|
||||
;;
|
||||
|
||||
(xz)
|
||||
(xz)
|
||||
echo "Using xz compression" 1>&2
|
||||
echo 'xz -f -9 "$outputDir/$tarName.tar"'
|
||||
echo
|
||||
echo '# End of compression'
|
||||
;;
|
||||
|
||||
(zst | zstd)
|
||||
(zst | zstd)
|
||||
echo "Using zstd compression" 1>&2
|
||||
echo 'zstd --rm -f -9 "$outputDir/$tarName.tar"'
|
||||
echo
|
||||
echo '# End of compression'
|
||||
;;
|
||||
|
||||
(*)
|
||||
(*)
|
||||
echo "Unknown compression scheme: $compress" 1>&2
|
||||
;;
|
||||
esac
|
||||
|
||||
14
doc/Build.md
14
doc/Build.md
@ -1,23 +1,23 @@
|
||||
## Getting the code
|
||||
|
||||
Links to all code packs are available on https://dl.openfoam.com. For OpenFOAM-v2312:
|
||||
Links to all code packs are available on https://dl.openfoam.com. For OpenFOAM-v2406:
|
||||
|
||||
- https://dl.openfoam.com/source/latest/
|
||||
- Source: https://dl.openfoam.com/source/v2312/OpenFOAM-v2312.tgz
|
||||
- ThirdParty: https://dl.openfoam.com/source/v2312/ThirdParty-v2312.tgz
|
||||
- Source: https://dl.openfoam.com/source/v2406/OpenFOAM-v2406.tgz
|
||||
- ThirdParty: https://dl.openfoam.com/source/v2406/ThirdParty-v2406.tgz
|
||||
|
||||
## OpenFOAM® Quick Build Guide
|
||||
|
||||
Prior to building, ensure that the [system requirements][link openfoam-require]
|
||||
are satisfied (including any special [cross-compiling][wiki-cross-compile]
|
||||
considerations), and source the correct OpenFOAM environment.
|
||||
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
|
||||
```
|
||||
e.g. if installed under the `~/openfoam` directory
|
||||
```
|
||||
source ~/openfoam/OpenFOAM-v2312/etc/bashrc
|
||||
source ~/openfoam/OpenFOAM-v2406/etc/bashrc
|
||||
```
|
||||
|
||||
|
||||
@ -157,4 +157,4 @@ More details in the [ThirdParty build guide][link third-build].
|
||||
[wiki-config]: https://develop.openfoam.com/Development/openfoam/-/wikis/configuring
|
||||
|
||||
---
|
||||
Copyright 2019-2023 OpenCFD Ltd
|
||||
Copyright 2019-2024 OpenCFD Ltd
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
## Known Build Issues (v2312, v2306, v2212, v2206, v2112, v2106, v2012)
|
||||
## Known Build Issues (v2406, v2312, v2306, v2212, v2206, v2112, v2106, v2012)
|
||||
|
||||
### Windows cross-compilation
|
||||
|
||||
@ -188,4 +188,4 @@ and attempt to install a `paraview~qt` version instead.
|
||||
[wiki-config]: https://develop.openfoam.com/Development/openfoam/-/wikis/configuring
|
||||
|
||||
---
|
||||
Copyright 2019-2023 OpenCFD Ltd
|
||||
Copyright 2019-2024 OpenCFD Ltd
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
# [WM_PROJECT_VERSION] - A human-readable version name
|
||||
# A development version is often named 'com' - as in www.openfoam.com
|
||||
export WM_PROJECT_VERSION=v2312
|
||||
export WM_PROJECT_VERSION=v2406
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Configuration environment variables.
|
||||
|
||||
@ -34,6 +34,16 @@ cellSet_doc
|
||||
// or
|
||||
min (0 0 0);
|
||||
max (1 1 1);
|
||||
|
||||
// Optional the cell centres can be transformed before being used. This
|
||||
// can be used to simulate moving selections in transient simulations.
|
||||
// Any solidBodyMotionFunction can be used. Note: the same optional
|
||||
// transformation can be used for any selection requiring face centres
|
||||
// or point locations.
|
||||
solidBodyMotionFunction linearMotion
|
||||
{
|
||||
velocity (-0.1 -0.1 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +68,8 @@ cellSet_doc
|
||||
radius 5.0;
|
||||
// optional
|
||||
innerRadius 1.0;
|
||||
|
||||
// See boxToCell for optional transformation of the cell centres
|
||||
}
|
||||
|
||||
//- Select based on faceSet
|
||||
@ -117,6 +129,8 @@ cellSet_doc
|
||||
{
|
||||
source nearestToCell;
|
||||
points ((0 0 0) (1 1 1)(2 2 2));
|
||||
|
||||
// See boxToCell for optional transformation of the cell centres
|
||||
}
|
||||
|
||||
|
||||
@ -162,6 +176,8 @@ cellSet_doc
|
||||
i (0.2 0.2 0);
|
||||
j (-0.2 0.2 0);
|
||||
k (10 10 10);
|
||||
|
||||
// See boxToCell for optional transformation of the cell centres
|
||||
}
|
||||
|
||||
|
||||
@ -170,6 +186,8 @@ cellSet_doc
|
||||
source searchableSurfaceToCell;
|
||||
surfaceType triSurfaceMesh; // Type of surface
|
||||
surfaceName blob.obj; // Name for surface object
|
||||
|
||||
// See boxToCell for optional transformation of the cell centres
|
||||
}
|
||||
|
||||
|
||||
@ -188,6 +206,8 @@ cellSet_doc
|
||||
|
||||
// optional
|
||||
innerRadius 1.0;
|
||||
|
||||
// See boxToCell for optional transformation of the cell centres
|
||||
}
|
||||
|
||||
|
||||
@ -209,6 +229,7 @@ cellSet_doc
|
||||
useSurfaceOrientation false; // use closed surface inside/outside
|
||||
// test (ignores includeCut,
|
||||
// outsidePoints)
|
||||
// See boxToCell for optional transformation of the cell centres
|
||||
}
|
||||
|
||||
|
||||
@ -257,6 +278,8 @@ faceSet_doc
|
||||
// or
|
||||
min (0 0 0);
|
||||
max (1 1 1);
|
||||
|
||||
// See boxToCell for optional transformation of the face centres
|
||||
}
|
||||
|
||||
|
||||
@ -286,6 +309,8 @@ faceSet_doc
|
||||
radius 5.0;
|
||||
// optional
|
||||
innerRadius 1.0;
|
||||
|
||||
// See boxToCell for optional transformation of the face centres
|
||||
}
|
||||
|
||||
|
||||
@ -352,6 +377,8 @@ faceSet_doc
|
||||
source searchableSurfaceToFace;
|
||||
surfaceType triSurfaceMesh; // Type of surface
|
||||
surfaceName blob.obj; // Name for surface object
|
||||
|
||||
// See boxToCell for optional transformation of the face centres
|
||||
}
|
||||
|
||||
|
||||
@ -362,6 +389,8 @@ faceSet_doc
|
||||
radius 5.0;
|
||||
// optional
|
||||
innerRadius 1.0;
|
||||
|
||||
// See boxToCell for optional transformation of the face centres
|
||||
}
|
||||
|
||||
|
||||
@ -410,6 +439,8 @@ pointSet_doc
|
||||
// or
|
||||
min (0 0 0);
|
||||
max (1 1 1);
|
||||
|
||||
// See boxToCell for optional transformation of the points
|
||||
}
|
||||
|
||||
|
||||
@ -436,6 +467,7 @@ pointSet_doc
|
||||
radius 5.0;
|
||||
// optional
|
||||
innerRadius 1.0;
|
||||
// See boxToCell for optional transformation of the points
|
||||
}
|
||||
|
||||
|
||||
@ -465,6 +497,7 @@ pointSet_doc
|
||||
{
|
||||
source nearestToPoint;
|
||||
points ((0 0 0) (1 1 1));
|
||||
// See boxToCell for optional transformation of the points
|
||||
}
|
||||
|
||||
|
||||
@ -486,6 +519,7 @@ pointSet_doc
|
||||
source searchableSurfaceToCell;
|
||||
surfaceType triSurfaceMesh; // Type of surface
|
||||
surfaceName blob.obj; // Name for surface object
|
||||
// See boxToCell for optional transformation of the points
|
||||
}
|
||||
|
||||
|
||||
@ -496,6 +530,7 @@ pointSet_doc
|
||||
radius 5.0;
|
||||
// optional
|
||||
innerRadius 1.0;
|
||||
// See boxToCell for optional transformation of the points
|
||||
}
|
||||
|
||||
|
||||
@ -508,6 +543,7 @@ pointSet_doc
|
||||
// (requires closed surface with consistent
|
||||
// normals)
|
||||
includeOutside false; // ,, outside ,,
|
||||
// See boxToCell for optional transformation of the points
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ cyclic
|
||||
cyclicAMI
|
||||
{
|
||||
type cyclicAMI;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
cyclicACMI
|
||||
|
||||
@ -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, distributed under GPL-3.0-or-later.
|
||||
@ -20,7 +20,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
set adios2_version=ADIOS2-2.9.2
|
||||
set adios2_version=ADIOS2-2.10.1
|
||||
setenv ADIOS2_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -30,7 +30,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
set hypre_version=hypre-2.23.0
|
||||
set hypre_version=hypre-2.31.0
|
||||
setenv HYPRE_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -52,7 +52,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
set ParaView_VERSION=5.11.2
|
||||
set ParaView_VERSION=5.12.1
|
||||
set ParaView_QT=qt-system
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -30,7 +30,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
set petsc_version=petsc-3.19.2
|
||||
set petsc_version=petsc-3.21.2
|
||||
setenv PETSC_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$petsc_version"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
|
||||
@ -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, distributed under GPL-3.0-or-later.
|
||||
@ -21,7 +21,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
adios2_version=ADIOS2-2.9.2
|
||||
adios2_version=ADIOS2-2.10.1
|
||||
export ADIOS2_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
|
||||
61
etc/config.sh/hdf5
Normal file
61
etc/config.sh/hdf5
Normal file
@ -0,0 +1,61 @@
|
||||
#----------------------------------*-sh-*--------------------------------------
|
||||
# ========= |
|
||||
# \\ / 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, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/hdf5
|
||||
# [optional/experimental: not sourced by OpenFOAM-*/etc/bashrc]
|
||||
#
|
||||
# Description
|
||||
# Setup for HDF5 include/libraries (usually ThirdParty installation).
|
||||
#
|
||||
# To disable its use: hdf5_version=hdf5-none
|
||||
# For system-wide installations: hdf5_version=hdf5-system
|
||||
#
|
||||
# For central installations not located under ThirdParty:
|
||||
# 1. use hdf5-system
|
||||
# 2. and provide full path for HDF5_ARCH_PATH
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
hdf5_version=hdf5-1.14.4.3
|
||||
export HDF5_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$hdf5_version"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
|
||||
then
|
||||
echo "Using hdf5 ($hdf5_version) -> $HDF5_ARCH_PATH" 1>&2
|
||||
fi
|
||||
|
||||
if command -v _foamAddLibAuto >/dev/null
|
||||
then
|
||||
# Normal sourcing (not makeHDF5)
|
||||
|
||||
_foamAddLibAuto $HDF5_ARCH_PATH
|
||||
|
||||
unset hdf5_version
|
||||
|
||||
elif [ "$1" = "-force" ]
|
||||
then
|
||||
# Forced command-line sourcing
|
||||
|
||||
if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $HDF5_ARCH_PATH 2>/dev/null)"
|
||||
then
|
||||
eval "$output"
|
||||
fi
|
||||
|
||||
unset hdf5_version output
|
||||
fi
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -27,7 +27,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
hypre_version=hypre-2.23.0
|
||||
hypre_version=hypre-2.31.0
|
||||
export HYPRE_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -57,7 +57,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
ParaView_VERSION=5.11.2
|
||||
ParaView_VERSION=5.12.1
|
||||
ParaView_QT=qt-system
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -27,7 +27,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
petsc_version=petsc-3.19.2
|
||||
petsc_version=petsc-3.21.2
|
||||
export PETSC_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$petsc_version"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
|
||||
@ -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 | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -146,13 +146,18 @@ OptimisationSwitches
|
||||
// The default and minimum is (20000000).
|
||||
mpiBufferSize 0;
|
||||
|
||||
// Optional max size (bytes) for unstructured data exchanges. In some
|
||||
// phases of OpenFOAM it can send over very large data chunks
|
||||
// Optional max size (bytes) for unstructured data exchanges.
|
||||
// In some phases of OpenFOAM it can send over very large data chunks
|
||||
// (e.g. in parallel load balancing) and some MPI implementations have
|
||||
// problems with this. Setting this variable > 0 indicates that the
|
||||
// data exchange needs to be done in multiple passes, each of maxCommsSize.
|
||||
// This is not switched on by default since it requires an additional
|
||||
// global reduction, even if multi-pass is not needed)
|
||||
// problems with this.
|
||||
//
|
||||
// This tuning parameter specifies the max number of bytes before
|
||||
// switching to a multi-pass send/recv
|
||||
// (currently only affects PstreamBuffers exchanges).
|
||||
//
|
||||
// 0 : disabled
|
||||
// >0 : limit exchanges to specified number of bytes
|
||||
// <0 : limit exchanges to INT_MAX minus specified number of bytes
|
||||
maxCommsSize 0;
|
||||
|
||||
// Optional (experimental) feature in lduMatrixUpdate
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
# [WM_PROJECT_VERSION] - A human-readable version name
|
||||
# A development version is often named 'com' - as in www.openfoam.com
|
||||
setenv WM_PROJECT_VERSION v2312
|
||||
setenv WM_PROJECT_VERSION v2406
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Configuration environment variables.
|
||||
|
||||
Submodule modules/OpenQBMM updated: d3ff7dee4e...dfbb204b70
@ -1,12 +1,17 @@
|
||||
[[_TOC_]]
|
||||
|
||||
## OpenFOAM Modules
|
||||
## OpenFOAM modules
|
||||
|
||||
This directory is a location for additional OpenFOAM components or
|
||||
tools to placed and have them built as part of the normal OpenFOAM
|
||||
build process. It is assumed that each subdirectory contain an
|
||||
appropriate `Allwmake` (or `Allwmake.override`) file.
|
||||
|
||||
The primary distinction between `modules` and `plugins` is that `modules` are
|
||||
mainly maintained and released by OpenFOAM developers, whereas `plugins` are an
|
||||
open and welcoming area for add-ons, predominantly maintained and driven by
|
||||
OpenFOAM community members and groups.
|
||||
|
||||
### How to use
|
||||
|
||||
On the first use, you need to register the submodules, and then update them.
|
||||
@ -91,7 +96,7 @@ To build the doxygen information for the components, it is also
|
||||
necessary to link the directories to the doc/ subdirectory.
|
||||
This is a purely manual operation.
|
||||
|
||||
### Developer Information
|
||||
### Developer information
|
||||
|
||||
#### Build locations
|
||||
|
||||
|
||||
Submodule modules/turbulence-community deleted from 06b391bb47
Submodule modules/visualization updated: d2c5f85350...e773eb9289
42
plugins/Allwmake
Executable file
42
plugins/Allwmake
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
targetType=libso
|
||||
. "${WM_PROJECT_DIR:?}"/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Default build into OpenFOAM project locations unless specified with
|
||||
# -prefix or FOAM_MODULE_PREFIX env varable
|
||||
|
||||
# Long form to avoid dash 0.5.8 error (issue #1757)
|
||||
[ -n "$FOAM_MODULE_PREFIX" ] || FOAM_MODULE_PREFIX="${FOAM_LIBBIN%/*}"
|
||||
export FOAM_MODULE_PREFIX
|
||||
|
||||
echo "========================================"
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
(false | none)
|
||||
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||
echo
|
||||
exit 0
|
||||
esac
|
||||
|
||||
echo "prefix = $FOAM_MODULE_PREFIX"
|
||||
echo
|
||||
echo " ignoring possible compilation errors"
|
||||
echo " make certain to check the output file"
|
||||
echo
|
||||
set +e
|
||||
export WM_CONTINUE_ON_ERROR=true
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
for name in $(./list-plugins)
|
||||
do
|
||||
if [ -d "$name" ]
|
||||
then
|
||||
# Use wmake -all instead of Allwmake to allow for overrides
|
||||
( cd "$name" && wmake -all $targetType )
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
139
plugins/README.md
Normal file
139
plugins/README.md
Normal file
@ -0,0 +1,139 @@
|
||||
[[_TOC_]]
|
||||
|
||||
## OpenFOAM plugins
|
||||
|
||||
This directory is a location for additional OpenFOAM components or
|
||||
tools to placed and have them built as part of the normal OpenFOAM
|
||||
build process. It is assumed that each subdirectory contain an
|
||||
appropriate `Allwmake` (or `Allwmake.override`) file.
|
||||
|
||||
The primary distinction between `modules` and `plugins` is that `modules` are
|
||||
mainly maintained and released by OpenFOAM developers, whereas `plugins` are an
|
||||
open and welcoming area for add-ons, predominantly maintained and driven by
|
||||
OpenFOAM community members and groups.
|
||||
|
||||
### How to use
|
||||
|
||||
On the first use, you need to register the submodules, and then update them.
|
||||
You can execute both steps for all the available submodules (including the
|
||||
nested ones) as follows while you are at `$WM_PROJECT_DIR`:
|
||||
|
||||
```bash
|
||||
cd $WM_PROJECT_DIR
|
||||
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Executing this single-line command clones all the submodules from their
|
||||
respective repositories and prepares them for compilation. Note that you can
|
||||
also make only a certain group of submodules ready by explicitly specifying the
|
||||
requested submodules' names at the end of the command above. For example, if
|
||||
you would like to use only the `turbulence-community` submodule, you specify:
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive plugins/turbulence-community
|
||||
```
|
||||
|
||||
You can display information about the status of submodules as follows:
|
||||
|
||||
```bash
|
||||
git submodule status --recursive
|
||||
```
|
||||
|
||||
An easy way to see which submodules are actually in use:
|
||||
|
||||
```bash
|
||||
cat .gitmodules
|
||||
```
|
||||
|
||||
Which will reveal content resembling the following:
|
||||
```
|
||||
[submodule "xyz"]
|
||||
path = plugins/xyz
|
||||
url = ...
|
||||
...
|
||||
```
|
||||
|
||||
If you need to remove a specific submodule or wish to restart the process,
|
||||
you can simply carry out the task as follows:
|
||||
|
||||
```bash
|
||||
git submodule deinit plugins/turbulence-community
|
||||
```
|
||||
|
||||
This command deregisters the specified submodule and clears the
|
||||
`plugins/turbulence-community` directory.
|
||||
|
||||
A quick overview of `git submodules` can be found in this
|
||||
[*blog*][blog git-submodule] with full details in the
|
||||
[*manpage*][man git-submodule].
|
||||
|
||||
### Build locations
|
||||
|
||||
Any individual _plugin_ will normally also be able to exist outside of
|
||||
the plugins directory structure and will typically build into user
|
||||
locations (`$FOAM_USER_APPBIN`, `$FOAM_USER_LIBBIN`).
|
||||
|
||||
When compiled from the top-level OpenFOAM `Allwmake` or the
|
||||
`plugins/Allwmake`, they should build into OpenFOAM project locations
|
||||
(`$FOAM_APPBIN`, `$FOAM_LIBBIN`). This can be adjusted by
|
||||
supplying an alternative `-prefix=` to the corresponding Allwmake
|
||||
command.
|
||||
|
||||
| Command | Install location |
|
||||
|------------|------------------|
|
||||
| ./Allwmake -prefix=user | `$FOAM_USER_APPBIN`, `$FOAM_USER_LIBBIN` |
|
||||
| ./Allwmake -prefix=group | `$FOAM_SITE_APPBIN`, `$FOAM_SITE_LIBBIN` |
|
||||
| ./Allwmake -prefix=openfoam | `$FOAM_APPBIN`, `$FOAM_LIBBIN` |
|
||||
| ./Allwmake -prefix=/some/pathname | `/some/pathname/bin`, `/some/pathname/lib` |
|
||||
|
||||
### Documentation (doxygen)
|
||||
|
||||
To build the doxygen information for the components, it is also
|
||||
necessary to link the directories to the doc/ subdirectory.
|
||||
This is a purely manual operation.
|
||||
|
||||
### Developer information
|
||||
|
||||
#### Build locations
|
||||
|
||||
To accomodate building into various locations, the plugin code should
|
||||
be adapted with the following changes:
|
||||
|
||||
- ***Make/files***
|
||||
```
|
||||
...
|
||||
EXE = $(FOAM_MODULE_APPBIN)/someExecutable
|
||||
|
||||
LIB = $(FOAM_MODULE_LIBBIN)/libSomeLibrary
|
||||
```
|
||||
|
||||
- `Make/options` should include this
|
||||
```
|
||||
include $(GENERAL_RULES)/module-path-user
|
||||
...
|
||||
```
|
||||
|
||||
The following changes to `Make/options` are universally applicable
|
||||
(ie, work with older or other versions of OpenFOAM), but more verbose.
|
||||
|
||||
- `Make/options` with the following
|
||||
```
|
||||
sinclude $(GENERAL_RULES)/module-path-user
|
||||
|
||||
/* Failsafe - user locations */
|
||||
ifeq (,$(FOAM_MODULE_APPBIN))
|
||||
FOAM_MODULE_APPBIN = $(FOAM_USER_APPBIN)
|
||||
endif
|
||||
ifeq (,$(FOAM_MODULE_LIBBIN))
|
||||
FOAM_MODULE_LIBBIN = $(FOAM_USER_LIBBIN)
|
||||
endif
|
||||
...
|
||||
```
|
||||
|
||||
<!-- General Information -->
|
||||
|
||||
[man git-submodule]: https://git-scm.com/docs/git-submodule
|
||||
[blog git-submodule]: http://blog.joncairns.com/2011/10/how-to-use-git-submodules/
|
||||
|
||||
---
|
||||
1
plugins/data-community
Submodule
1
plugins/data-community
Submodule
Submodule plugins/data-community added at 1b1617294c
85
plugins/list-plugins
Executable file
85
plugins/list-plugins
Executable file
@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
#------------------------------------------------------------------------------
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# SPDX-License-Identifier: (GPL-3.0-or-later)
|
||||
#
|
||||
# Script
|
||||
# list-modules
|
||||
#
|
||||
# Description
|
||||
# List module directories
|
||||
# - each first-level directory with an Allwmake file
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
printHelp() {
|
||||
cat<< HELP 1>&2
|
||||
|
||||
Usage: ${0##*/} [OPTION]
|
||||
options:
|
||||
-help Display help and exit
|
||||
|
||||
List module directories - each first-level directory with an Allwmake file
|
||||
|
||||
HELP
|
||||
|
||||
exit 0 # A clean exit
|
||||
}
|
||||
|
||||
# Report error and exit
|
||||
die()
|
||||
{
|
||||
exec 1>&2
|
||||
echo
|
||||
echo "Error encountered:"
|
||||
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
|
||||
echo
|
||||
echo "See '${0##*/} -help' for usage"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Parse options
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
case "$1" in
|
||||
-h | -help*) # Short help
|
||||
printHelp
|
||||
;;
|
||||
|
||||
*)
|
||||
die "Unknown option/argument: '$1'"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
# Each first-level directory with an Allwmake file
|
||||
for moduleName in *
|
||||
do
|
||||
if [ -f "$moduleName/Allwmake" ]
|
||||
then
|
||||
case "$moduleName" in
|
||||
# Skip some directory names
|
||||
(build | doc | platform*)
|
||||
;;
|
||||
(*)
|
||||
echo "$moduleName"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
1
plugins/turbulence-community
Submodule
1
plugins/turbulence-community
Submodule
Submodule plugins/turbulence-community added at 8111aa1339
@ -185,6 +185,7 @@ $(expr)/scanToken/exprScanToken.C
|
||||
|
||||
$(expr)/traits/exprTraits.C
|
||||
$(expr)/value/exprValue.C
|
||||
$(expr)/value/exprValueFieldTag.C
|
||||
|
||||
$(expr)/exprDriver/exprDriver.C
|
||||
$(expr)/exprDriver/exprDriverFields.C
|
||||
|
||||
@ -121,6 +121,12 @@ class IOobject;
|
||||
template<>
|
||||
Ostream& operator<<(Ostream&, const InfoProxy<IOobject>&);
|
||||
|
||||
// Traits
|
||||
|
||||
//- Trait for specifying global vs. local IOobject file types
|
||||
template<class T>
|
||||
struct is_globalIOobject : std::false_type {};
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class IOobject Declaration
|
||||
@ -712,6 +718,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Specialization for \c void always returns true (no headerClassName check).
|
||||
template<>
|
||||
inline bool IOobject::isHeaderClass<void>() const
|
||||
@ -720,11 +728,6 @@ inline bool IOobject::isHeaderClass<void>() const
|
||||
}
|
||||
|
||||
|
||||
//- Trait for specifying global vs. local file types
|
||||
template<class T>
|
||||
struct is_globalIOobject : std::false_type {};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -122,6 +122,26 @@ Foam::GlobalIOField<Type>::GlobalIOField
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Field<Type> Foam::GlobalIOField<Type>::readContents(const IOobject& io)
|
||||
{
|
||||
IOobject rio(io, IOobjectOption::NO_REGISTER);
|
||||
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
|
||||
{
|
||||
rio.readOpt(IOobjectOption::MUST_READ);
|
||||
}
|
||||
|
||||
// The object is global
|
||||
rio.globalObject(true);
|
||||
|
||||
GlobalIOField<Type> reader(rio);
|
||||
|
||||
return Field<Type>(std::move(static_cast<Field<Type>&>(reader)));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -135,7 +155,8 @@ bool Foam::GlobalIOField<Type>::readData(Istream& is)
|
||||
template<class Type>
|
||||
bool Foam::GlobalIOField<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
return (os << static_cast<const Field<Type>&>(*this)).good();
|
||||
os << static_cast<const Field<Type>&>(*this);
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,13 +85,19 @@ public:
|
||||
GlobalIOField(const IOobject& io, const tmp<Field<Type>>& tfld);
|
||||
|
||||
|
||||
// Factory Methods
|
||||
|
||||
//- Read and return contents. The IOobject is never registered
|
||||
static Field<Type> readContents(const IOobject& io);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~GlobalIOField() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Is object global
|
||||
//- The object is global
|
||||
virtual bool global() const
|
||||
{
|
||||
return true;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -106,6 +106,26 @@ Foam::GlobalIOList<Type>::GlobalIOList
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::List<Type> Foam::GlobalIOList<Type>::readContents(const IOobject& io)
|
||||
{
|
||||
IOobject rio(io, IOobjectOption::NO_REGISTER);
|
||||
if (rio.readOpt() == IOobjectOption::READ_MODIFIED)
|
||||
{
|
||||
rio.readOpt(IOobjectOption::MUST_READ);
|
||||
}
|
||||
|
||||
// The object is global
|
||||
rio.globalObject(true);
|
||||
|
||||
GlobalIOList<Type> reader(rio);
|
||||
|
||||
return List<Type>(std::move(static_cast<List<Type>&>(reader)));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
@ -119,7 +139,8 @@ bool Foam::GlobalIOList<Type>::readData(Istream& is)
|
||||
template<class Type>
|
||||
bool Foam::GlobalIOList<Type>::writeData(Ostream& os) const
|
||||
{
|
||||
return (os << *this).good();
|
||||
os << static_cast<const List<Type>&>(*this);
|
||||
return os.good();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,6 +85,12 @@ public:
|
||||
GlobalIOList(const IOobject& io, List<Type>&& content);
|
||||
|
||||
|
||||
// Factory Methods
|
||||
|
||||
//- Read and return contents. The IOobject is never registered
|
||||
static List<Type> readContents(const IOobject& io);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~GlobalIOList() = default;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user