Compare commits

..

20 Commits

Author SHA1 Message Date
0a04de8661 CONFIG: bump patch level (240625) 2024-06-26 13:12:55 +02:00
5802d22470 BUG: Nastran reading of free format truncates last field (fixes #3189)
- the old logic relied on the presence/absence of a comma to decide
  whether to parse as fixed or free format. This logic is faulty when
  handling the final (trailing) entry and will generally lead to the
  last field being truncated when read in.
  Now the caller decides on fixed vs free.

FIX: inconsistent Nastran surface output format

- use FREE format by default. Previously had an odd mix of SHORT
  format when created without options and LONG format (as default)
  when created with format options.
2024-06-26 13:12:26 +02:00
1679c5f157 BUG: SlicedGeometricField, slices into field instead of shallow copy (#3080)
- regression introduced by e98acdc4fc

  Affected versions: (v2206, v2212, v2306, v2312)
2024-01-19 20:19:12 +01:00
d5607b2f28 COMP: g++11: suppress optimisation. See #3024 2024-01-19 20:18:28 +01:00
b0ed2a254b BUG: ThermoSurfaceFilm: reintroduce energy to film sources (fixes #2996) 2023-10-11 11:29:50 +01:00
0085b60946 BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 16:36:46 +02:00
45e9db3489 BUG: expressions rand() ignores objectRegistry timeIndex (fixes #2923) 2023-06-26 17:55:07 +02:00
68bed4f1dc BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)
- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
2023-06-20 09:23:44 +02:00
fe97c8fee9 Revert "BUG: Fixing ray dAve and omega for 1D and 2D cases"
This reverts commit 5848b0afd5.
2023-05-22 09:41:24 +01:00
324ce9adec BUG: VTK write pointSet fails in parallel (fixes #2773)
- de-referenced autoPtr with () instead of ref() will fail on
  non-master ranks.
2023-05-05 16:08:36 +02:00
a8cba8ba8f COMP: code adjustments for gcc-13 (#2714) 2023-02-28 16:03:12 +01:00
58a5587ca8 BUG: globalIndex gather/scatter fails with multi-world (fixes #2706)
- was using UPstream::procIDs(), which returns the sub-ranks with
  respect to the parent communicator. This is normally just an
  identity list (single-world) but with multi-world the indexing
  is incorrect.  Use UPstream::allProcs() instead.
2023-02-21 12:24:15 +01:00
6d045eabc1 BUG: inconsistent faceArea on processor boundaries (fixes #2683)
- was missing evaluateCoupled on the initial faceAreaNormals field
  (related to #2507)

ENH: simplify/consistent geometry updating
2023-02-21 12:24:01 +01:00
d45b9b4e41 COMP: backslash instead of slash in Make/options 2023-02-20 18:04:13 +01:00
dae13bfae8 BUG: expression field functionObject 'store' keyword ignored 2023-02-20 18:04:13 +01:00
5894f2ed95 BUG: vtk::coordSetWriter produces incorrect VTK legacy format (fixes #2678)
- has a special purpose beginPiece() method, but was missing an update
  on the numberOfPoints, numberOfCells values required by the base class.
2023-01-13 09:39:23 +01:00
d0151570a1 BUG: inconsistent finiteArea proc-boundary contributions (fixes #2672) 2023-01-13 09:38:45 +01:00
8993af73ac CONFIG: bump patch level 2022-11-20 18:16:53 +01:00
a4d235af6b BUG: porousBafflePressure: read fixedJump entries - apply under-relaxation (fixes #2626) 2022-11-09 14:18:06 +00:00
dffac4d887 BUG: distributedTriSurfaceMesh: locally empty surface. Fixes #2612 2022-10-13 11:57:27 +01:00
1930 changed files with 21978 additions and 47524 deletions

View File

@ -5,8 +5,6 @@ It is likely incomplete...
## Contributors (alphabetical by surname)
- Tetsuo Aoyagi
- Akira Azami
- William Bainbridge
- Gabriel Barajas
- Kutalmis Bercin
@ -21,7 +19,6 @@ It is likely incomplete...
- Bernhard Gschaider
- Andrew Heather
- David Hill
- Yoshiaki Inoue
- Mattijs Janssens
- Andrew Jackson
- Hrvoje Jasak

View File

@ -1,2 +1,2 @@
api=2206
patch=220907
patch=240625

View File

@ -11,5 +11,4 @@ EXE_LIBS = \
-lfvOptions \
-lmeshTools \
-lsampling \
-lregionFaModels \
-lfiniteArea
-lregionFaModels

View File

@ -116,7 +116,7 @@ int main(int argc, char *argv[])
"normalisedGradP",
tmagGradP()/max(tmagGradP())
);
normalisedGradP.writeOpt(IOobject::AUTO_WRITE);
normalisedGradP.writeOpt() = IOobject::AUTO_WRITE;
tmagGradP.clear();
++runTime;

View File

@ -1,8 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \

View File

@ -9,7 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \
@ -26,5 +26,4 @@ EXE_LIBS = \
-ltopoChangerFvMesh \
-lsampling \
-latmosphericModels \
-lregionFaModels \
-lfiniteArea
-lregionFaModels

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \
@ -21,5 +21,4 @@ EXE_LIBS = \
-lcompressibleTurbulenceModels \
-lthermoTools \
-latmosphericModels \
-lregionFaModels \
-lfiniteArea
-lregionFaModels

View File

@ -10,7 +10,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \
@ -28,5 +28,4 @@ EXE_LIBS = \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lregionFaModels \
-lfiniteArea
-lregionFaModels

View File

@ -7,7 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \
@ -22,5 +22,4 @@ EXE_LIBS = \
-lcompressibleTurbulenceModels \
-lthermoTools \
-latmosphericModels \
-lregionFaModels \
-lfiniteArea
-lregionFaModels

View File

@ -19,7 +19,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
@ -40,5 +40,4 @@ EXE_LIBS = \
-lthermoTools \
-lradiationModels \
-lregionModels \
-lregionFaModels \
-lfiniteArea
-lregionFaModels

View File

@ -36,5 +36,5 @@ EXE_LIBS = \
-lfaOptions \
-lregionModels \
-lsampling \
-lregionFaModels \
-lfiniteArea
-lregionFaModels

View File

@ -35,7 +35,7 @@
(
solidRegions[i],
thermos[i],
coordinateSystem::typeName
coordinateSystem::typeName_()
)
);

View File

@ -15,7 +15,7 @@ if (!thermo.isotropic())
(
mesh,
thermo,
coordinateSystem::typeName
coordinateSystem::typeName_()
);
tmp<volVectorField> tkappaByCp = thermo.Kappa()/thermo.Cp();

View File

@ -8,7 +8,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/regionFaModels\lnInclude
-I$(LIB_SRC)/regionFaModels/lnInclude
EXE_LIBS = \
-lfiniteVolume \
@ -22,5 +22,4 @@ EXE_LIBS = \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-latmosphericModels \
-lregionFaModels \
-lfiniteArea
-lregionFaModels

View File

@ -1,7 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -2,10 +2,10 @@ EXE_INC = \
-I../reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \

View File

@ -2,8 +2,8 @@ EXE_INC = \
-I.. \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \

View File

@ -1,7 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \

View File

@ -2,7 +2,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -2,8 +2,8 @@ EXE_INC = \
-I../reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -4,8 +4,8 @@ EXE_INC = \
-I../../reactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -2,7 +2,7 @@ EXE_INC = \
-I$(FOAM_SOLVERS)/lagrangian/reactingParcelFoam/simpleReactingParcelFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \

View File

@ -4,8 +4,8 @@ EXE_INC = \
-I../../../compressible/rhoPimpleFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I${LIB_SRC}/sampling/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \

View File

@ -42,5 +42,4 @@ EXE_LIBS = \
-lregionModels \
-lregionFaModels \
-lsurfaceFilmModels \
-lfiniteArea \
-lcompressibleTwoPhaseMixtureTurbulenceModels

View File

@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef Foam_DTRMParticle_H
#define Foam_DTRMParticle_H
#ifndef DTRMParticle_H
#define DTRMParticle_H
#include "particle.H"
#include "IOstream.H"
@ -50,13 +50,12 @@ SourceFiles
namespace Foam
{
// Forward Declarations
class DTRMParticle;
Ostream& operator<<(Ostream&, const DTRMParticle&);
using namespace Foam::radiation;
// Forward declaration of friend functions
Ostream& operator<<(Ostream&, const DTRMParticle&);
/*---------------------------------------------------------------------------*\
Class DTRMParticle Declaration
\*---------------------------------------------------------------------------*/
@ -131,7 +130,7 @@ public:
);
// Member Functions
// Member functions
inline const interpolationCell<scalar>& aInterp() const;
inline const interpolationCell<scalar>& eInterp() const;
@ -233,34 +232,37 @@ public:
// Access
//- Return const access to the initial position
const point& p0() const noexcept { return p0_; }
inline const point& p0() const;
//- Return const access to the target position
const point& p1() const noexcept { return p1_; }
inline const point& p1() const;
//- Return const access to the initial intensity
scalar I0() const noexcept { return I0_; }
inline scalar I0() const;
//- Return const access to the current intensity
scalar I() const noexcept { return I_; }
inline scalar I() const;
//- Return const access dA
scalar dA() const noexcept { return dA_; }
inline scalar dA() const;
// Edit
//- Return access to the target position
point& p1() noexcept { return p1_; }
inline point& p1();
//- Return access to the initial intensity
scalar& I0() noexcept { return I0_; }
inline scalar& I0();
//- Return access to the current intensity
scalar& I() noexcept { return I_; }
inline scalar& I();
//- Return access to dA
scalar& dA() noexcept { return dA_; }
inline scalar& dA();
//- Return access to reflectedId
inline label& reflectedId();
// Tracking

View File

@ -107,4 +107,58 @@ inline Foam::scalar& Foam::DTRMParticle::trackingData::Q(label celli)
}
inline const Foam::point& Foam::DTRMParticle::p0() const
{
return p0_;
}
inline const Foam::point& Foam::DTRMParticle::p1() const
{
return p1_;
}
inline Foam::scalar Foam::DTRMParticle::I0() const
{
return I0_;
}
inline Foam::scalar Foam::DTRMParticle::I() const
{
return I_;
}
inline Foam::scalar Foam::DTRMParticle::dA() const
{
return dA_;
}
inline Foam::scalar& Foam::DTRMParticle::dA()
{
return dA_;
}
inline Foam::point& Foam::DTRMParticle::p1()
{
return p1_;
}
inline Foam::scalar& Foam::DTRMParticle::I0()
{
return I0_;
}
inline Foam::scalar& Foam::DTRMParticle::I()
{
return I_;
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -59,7 +59,7 @@ Foam::DTRMParticle::DTRMParticle
{
if (readFields)
{
if (is.format() == IOstreamOption::ASCII)
if (is.format() == IOstream::ASCII)
{
is >> p0_ >> p1_ >> I0_ >> I_ >> dA_ >> transmissiveId_;
}
@ -115,7 +115,7 @@ void Foam::DTRMParticle::writeProperties
Foam::Ostream& Foam::operator<<(Ostream& os, const DTRMParticle& p)
{
if (os.format() == IOstreamOption::ASCII)
if (os.format() == IOstream::ASCII)
{
os << static_cast<const particle&>(p)
<< token::SPACE << p.p0_

View File

@ -157,7 +157,12 @@ void Foam::radiation::laserDTRM::initialiseReflection()
);
}
reflectionSwitch_ = returnReduceOr(reflections_.size());
if (reflections_.size())
{
reflectionSwitch_ = true;
}
reflectionSwitch_ = returnReduce(reflectionSwitch_, orOp<bool>());
}
}
@ -294,12 +299,14 @@ void Foam::radiation::laserDTRM::initialise()
DTRMCloud_.addParticle(pPtr);
}
if (nMissed < 10 && returnReduceAnd(cellI < 0))
if (returnReduce(cellI, maxOp<label>()) == -1)
{
++nMissed;
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
if (++nMissed <= 10)
{
WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
}
}
}
}
@ -692,7 +699,7 @@ void Foam::radiation::laserDTRM::calculate()
for (label pointi = 0; pointi < lines.size(); pointi += 2)
{
os.writeLine(lines[pointi], lines[pointi+1]);
os.write(linePointRef(lines[pointi], lines[pointi+1]));
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -49,8 +49,8 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
IOstreamOption streamOpt(IOstreamOption::BINARY);
// IOstreamOption streamOpt(IOstreamOption::ASCII);
IOstream::streamFormat format = IOstream::BINARY;
// IOstream::streamFormat format = IOstream::ASCII;
const label size = 20000000;
@ -85,7 +85,11 @@ int main(int argc, char *argv[])
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
faces2.writeObject(streamOpt, true);
faces2.writeObject
(
IOstreamOption(format),
true
);
Info<< "Written old format faceList in = "
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
@ -141,7 +145,11 @@ int main(int argc, char *argv[])
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
faces2.writeObject(streamOpt, true);
faces2.writeObject
(
IOstreamOption(format),
true
);
Info<< "Written new format faceList in = "
<< runTime.cpuTimeIncrement() << " s" << nl << endl;

View File

@ -28,6 +28,11 @@ License
#include "DirLister.H"
#include <dirent.h>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
static const Foam::word extgz("gz");
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::DirLister::const_iterator::open(const fileName& dir)
@ -105,9 +110,9 @@ Foam::word Foam::DirLister::next(DIR* dirPtr) const
if (ok)
{
if (fType == fileName::FILE && stripgz_ && name.has_ext("gz"))
if (fType == fileName::FILE && stripgz_ && name.hasExt(extgz))
{
name.remove_ext();
name = name.lessExt();
}
if (!name.empty() && accept(name))

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021-2022 OpenCFD Ltd.
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -104,7 +104,7 @@ void readList
{
OTstream os;
os << input;
ITstream is(os.tokens());
ITstream is("input", os.tokens());
is >> output;
}
@ -118,7 +118,7 @@ void readList
{
OTstream os;
os << input;
ITstream is(os.tokens());
ITstream is("input", os.tokens());
is >> output;
}

View File

@ -1,3 +0,0 @@
Test-FieldFields1.C
EXE = $(FOAM_USER_APPBIN)/Test-FieldFields1

View File

@ -1,117 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 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-FieldFields1
\*---------------------------------------------------------------------------*/
#include "symmTensorField.H"
#include "tensorField.H"
#include "FieldFields.H"
#include "Random.H"
using namespace Foam;
template<class Cmpt>
void printFieldField(const FieldField<Field, Cmpt>& ff)
{
forAll(ff, i)
{
Info<< i << ": " << flatOutput(ff[i]) << nl;
}
Info<< nl;
}
template<class Type>
tmp<Field<Type>> randomField(Random& rnd, label dim)
{
auto tfld = tmp<Field<Type>>::New(dim);
auto& fld = tfld.ref();
for (Type& val : fld)
{
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
{
setComponent(val, cmpt) = rnd.position<label>(0, 100);
}
}
return tfld;
}
template<class Type>
tmp<Field<Type>> randomField(label dim)
{
Random rnd;
return randomField<Type>(rnd, dim);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
// scalarField
{
Info<< nl << "scalarFieldField" << nl;
Random rnd;
FieldField<Field, scalar> sff1(6);
forAll(sff1, i)
{
sff1.set(i, randomField<scalar>(rnd, 8));
}
printFieldField(sff1);
Info<< nl << "indexing:" << nl;
{
labelPair index;
const label range1 = sff1.size()-1;
const label range2 = sff1[0].size()-1;
for (label iter = 0; iter < 10; ++iter)
{
index.first() = rnd.position<label>(0, range1);
index.second() = rnd.position<label>(0, range2);
Info<< index << " => " << sff1[index] << nl;
}
}
}
Info<< nl << "End\n" << nl;
return 0;
}
// ************************************************************************* //

View File

@ -1,3 +0,0 @@
Test-FieldFields2.C
EXE = $(FOAM_USER_APPBIN)/Test-FieldFields2

View File

@ -1,2 +0,0 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -113,6 +113,7 @@ int main(int argc, char *argv[])
label coarseSize = max(addr)+1;
Info<< "Level : " << level << endl
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " current size : "
<< returnReduce(addr.size(), sumOp<label>()) << endl
<< " agglomerated size : "

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,10 +31,7 @@ Description
#include <memory>
#include <iostream>
#include "autoPtr.H"
#include "refPtr.H"
#include "tmp.H"
#include "PtrMap.H"
#include "primitiveFields.H"
#include "HashPtrTable.H"
using namespace Foam;
@ -253,42 +250,6 @@ int main()
Info<< "Table: " << tbl << nl;
}
{
PtrMap<scalarField> fields;
{
const label patchi = 2;
scalarField fld1(patchi, 5.0);
scalarField fld2(patchi, 8.0);
// assign from tmp<>
fields.set( patchi, (fld1 * fld2));
}
{
const label patchi = 3;
scalarField fld1(patchi, 6.0);
// From tmp (clone)
fields.set(patchi, tmp<scalarField>(fld1));
}
{
const label patchi = 4;
// From refPtr
fields.set(patchi, refPtr<scalarField>::New(patchi, 10.0));
}
Info<< nl
<< "PtrMap:" << nl
<< fields << endl;
}
Info<< "\nEnd" << nl;
return 0;
}

View File

@ -1,3 +1,3 @@
EXE_INC = $(c++LESSWARN)
EXE_INC = ${c++LESSWARN}
/* EXE_LIBS = */

View File

@ -1,3 +1,3 @@
EXE_INC = $(c++LESSWARN)
EXE_INC = ${c++LESSWARN}
/* EXE_LIBS = */

View File

@ -1,3 +1,3 @@
EXE_INC = $(c++LESSWARN)
EXE_INC = ${c++LESSWARN}
/* EXE_LIBS = */

View File

@ -90,7 +90,7 @@ void writeAndRead
const IOobject& io,
const label sz,
const word& writeType,
IOobjectOption::readOption rOpt,
const IOobject::readOption rOpt,
const word& readType
)
{
@ -208,8 +208,7 @@ int main(int argc, char *argv[])
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
IOobject::NO_WRITE
);
{
@ -244,7 +243,9 @@ int main(int argc, char *argv[])
args.executable(),
"constant",
runTime,
IOobject::NO_REGISTER // implicit convert to IOobjectOption
IOobject::NO_READ,
IOobject::NO_WRITE,
false
);
labelList ints(identity(200));

View File

@ -146,7 +146,7 @@ int main(int argc, char *argv[])
{
Info<<"Writing output to " << binaryOutput << endl;
OFstream os(binaryOutput, IOstreamOption::BINARY);
OFstream os(binaryOutput, IOstream::BINARY);
os.writeEntry("idl1", idl1);
os.writeEntry("idl2", idl2);
@ -182,7 +182,7 @@ int main(int argc, char *argv[])
// MPI barrier
bool barrier = true;
Pstream::broadcast(barrier);
Pstream::scatter(barrier);
}

View File

@ -83,9 +83,9 @@ int main(int argc, char *argv[])
{
IOstreamOption streamOpt;
if (outputName.has_ext("gz"))
if (outputName.hasExt("gz"))
{
outputName.remove_ext();
outputName.removeExt();
streamOpt.compression(IOstreamOption::COMPRESSED);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
OTstream os;
os << poly;
ITstream is(std::move(os.tokens()));
ITstream is("input", std::move(os.tokens()));
is >> polyfunc;
}

View File

@ -28,14 +28,15 @@ Description
\*---------------------------------------------------------------------------*/
#include "scalar.H"
using namespace Foam;
#include "floatScalar.H"
#include "doubleScalar.H"
#include "complex.H"
#include "Matrix.H"
#include "Random.H"
#include <chrono>
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Total number of unit tests

View File

@ -138,8 +138,8 @@ int main()
maxFirstEqOp<label>()(maxIndexed, item);
}
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl;
@ -156,8 +156,8 @@ int main()
maxIndexed = maxFirstOp<label>()(maxIndexed, item);
}
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,6 +27,7 @@ License
// #define Foam_autoPtr_deprecate_setMethod
#include <memory>
#include "autoPtr.H"
#include "labelList.H"
#include "ListOps.H"
@ -76,14 +77,6 @@ autoPtr<T> testNullReturn2()
}
template<class T>
struct DerivedList : public List<T>
{
// Inherit constructors
using List<T>::List;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
@ -261,16 +254,6 @@ int main(int argc, char *argv[])
// autoPtr<labelList> ptr2 = testNullReturn2<labelList>();
}
{
auto input1 = autoPtr<DerivedList<label>>::New(label(10), 1);
auto input2 = autoPtr<DerivedList<scalar>>::New(label(10), 1.0);
autoPtr<labelList> ptr1(std::move(input1));
// Does not compile: ptr1 = std::move(input2);
// Does not compile: ptr1 = autoPtr<List<scalar>>::New(label(10), 2);
}
return 0;
}

View File

@ -1,3 +0,0 @@
Test-barycentric.C
EXE = $(FOAM_USER_APPBIN)/Test-barycentric

View File

@ -1,2 +0,0 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -1,93 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 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-barycentric
Description
Some simple tests for barycentric coordinates and transforms
\*---------------------------------------------------------------------------*/
#include "barycentricTensor.H"
#include "tetrahedron.H"
#include "vectorField.H"
#include "IOstreams.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
// Tets to test
tetPoints tetA
(
point(0, 0, 0),
point(1, 0, 0),
point(1, 1, 0),
point(1, 1, 1)
);
const barycentricTensor baryT(tetA[0], tetA[1], tetA[2], tetA[3]);
Info<< nl << "Tet: " << tetA << nl;
Info<< "tens:" << baryT << nl;
for
(
const barycentric& bary :
List<barycentric>
({
{0.25, 0.25, 0.25, 0.25},
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0},
{0, 0, 0, 1},
{0, 0, 0, 0} // Not really valid
})
)
{
vector v(tetA.tet().barycentricToPoint(bary));
barycentric b(tetA.tet().pointToBarycentric(v));
Info<< nl
<< "bary: " << bary << nl
<< "vec: " << v << nl
// << "Vec: " << baryT.inner(bary) << nl
<< "Vec: " << (baryT & bary) << nl
<< "bary: " << b << nl
// This won't work (needs a differently defined tensor)
// << "Bary: " << (v & baryT) << nl
;
}
Info<< "\nEnd\n" << nl;
return 0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,2 +1,7 @@
/* EXE_INC = */
/* EXE_LIBS = */
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,8 +31,7 @@ Description
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
#include "line.H"
#include "Random.H"
#include "boundBox.H"
#include "treeBoundBox.H"
#include "cellModel.H"
#include "bitSet.H"
@ -85,20 +84,7 @@ int main(int argc, char *argv[])
else
{
bb = cube(0, 1);
Info<< "starting box: " << bb << endl;
Info<< "corner: " << bb.hexCorner<0>() << nl
<< "corner: " << bb.hexCorner<7>() << nl
<< "corner: " << bb.hexCorner<6>() << endl;
linePoints ln1(bb.max(), bb.centre());
Info<< "line: " << ln1 << " box: " << ln1.box() << endl;
Info<< "box: " << boundBox(ln1.box()) << endl;
Info<< "corner: " << bb.hexCorner<0>() << nl
<< "corner: " << bb.hexCorner<7>() << nl
<< "corner: " << bb.hexCorner<6>() << endl;
Info<<"starting box: " << bb << endl;
point pt(Zero);
bb.add(pt);
@ -161,25 +147,6 @@ int main(int argc, char *argv[])
Info<< "box is now => " << box1 << endl;
}
List<boundBox> boxes(12);
{
Random rndGen(12345);
for (auto& bb : boxes)
{
bb = cube
(
rndGen.position<scalar>(-10, 10),
rndGen.position<scalar>(0, 5)
);
}
Info<< "boxes: " << boxes << endl;
Foam::sort(boxes);
Info<< "sorted: " << boxes << endl;
}
return 0;
}

View File

@ -59,11 +59,11 @@ void basicTests(const coordinateSystem& cs)
{
cs.writeEntry(cs.name(), Info);
if ((const auto* cartptr = isA<coordSystem::cartesian>(cs)) != nullptr)
if (const auto* cartptr = isA<coordSystem::cartesian>(cs))
{
if (!cartptr->valid())
if (!cartptr->active())
{
Info<< "invalid cartesian = " << (*cartptr)
Info<< "inactive cartesian = " << (*cartptr)
<< " with: " << (*cartptr).R() << nl;
}
}
@ -106,7 +106,7 @@ void doTest(const dictionary& dict)
try
{
auto cs1ptr = coordinateSystem::New(dict, word::null);
auto cs1ptr = coordinateSystem::New(dict, "");
coordinateSystem& cs1 = *cs1ptr;
cs1.rename(dict.dictName());

View File

@ -51,8 +51,11 @@ cs4
{
type cylindrical;
origin (0 3 5);
rotation euler;
angles (90 0 0);
rotation
{
type euler;
angles (90 0 0);
}
}
cyl
@ -72,7 +75,10 @@ cyl
ident
{
origin (0 0 0);
rotation none;
rotation
{
type none;
}
}
)

View File

@ -26,7 +26,7 @@ rot_x90
rot_x90_axesRotation
{
origin (0 0 0);
rotation
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
@ -37,7 +37,7 @@ rot_x90_axesRotation
rot_x90_axisAngle
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (1 0 0); // non-unit also OK
@ -48,7 +48,7 @@ rot_x90_axisAngle
rot_x90_euler
{
origin (0 0 0);
rotation
coordinateRotation
{
type euler;
angles (0 90 0); // z-x'-z''
@ -61,7 +61,7 @@ rot_x90_euler
rot_z45_axesRotation
{
origin (0 0 0);
rotation
coordinateRotation
{
type axesRotation;
e1 (1 1 0);
@ -72,7 +72,7 @@ rot_z45_axesRotation
rot_z45_axisAngle
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (0 0 10); // non-unit also OK
@ -83,7 +83,7 @@ rot_z45_axisAngle
rot_z45_euler
{
origin (0 0 0);
rotation
coordinateRotation
{
type euler;
angles (45 0 0); // z-x'-z''
@ -93,7 +93,7 @@ rot_z45_euler
rot_z45_starcd
{
origin (0 0 0);
rotation
coordinateRotation
{
type starcd;
angles (45 0 0); // z-x'-y''
@ -106,7 +106,7 @@ rot_z45_starcd
rot_zm45_axesRotation
{
origin (0 0 0);
rotation
coordinateRotation
{
type axesRotation;
e1 (1 -1 0);
@ -117,7 +117,7 @@ rot_zm45_axesRotation
rot_zm45_axisAngle
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (0 0 10); // non-unit also OK
@ -128,7 +128,7 @@ rot_zm45_axisAngle
rot_zm45_euler
{
origin (0 0 0);
rotation
coordinateRotation
{
type euler;
angles (-45 0 0); // z-x'-z''
@ -141,7 +141,7 @@ rot_zm45_euler
null_axesRotation
{
origin (0 0 0);
rotation
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
@ -152,7 +152,7 @@ null_axesRotation
null_axisAngle0
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (0 0 0); // non-unit also OK
@ -163,7 +163,7 @@ null_axisAngle0
null_axisAngle1
{
origin (0 0 0);
rotation
coordinateRotation
{
type axisAngle;
axis (1 1 1); // non-unit also OK
@ -174,7 +174,7 @@ null_axisAngle1
null_euler
{
origin (0 0 0);
rotation
coordinateRotation
{
type euler;
angles (0 0 0); // z-x'-z''

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
Info<< "Reading " << file << nl << endl;
decomposedBlockData data
(
UPstream::worldComm,
Pstream::worldComm,
IOobject
(
file,
@ -78,7 +78,8 @@ int main(int argc, char *argv[])
OFstream os
(
objPath,
IOstreamOption::BINARY,
IOstream::BINARY,
IOstream::currentVersion,
runTime.writeCompression()
);
if (!os.good())

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,7 +42,7 @@ namespace Foam
// Something like an internal state field. Probably only dimensionless
typedef DimensionedField<uint8_t, volMesh> dimUint8Field;
defineTemplateTypeNameAndDebug(dimUint8Field, 0);
defineTemplate2TypeNameAndDebug(dimUint8Field, 0);
} // End namespace Foam
#endif
@ -65,7 +65,8 @@ int main(int argc, char *argv[])
"tensor",
runTime.timeName(),
mesh,
{ IOobject::READ_IF_PRESENT, IOobject::NO_REGISTER }
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9))
@ -74,47 +75,6 @@ int main(int argc, char *argv[])
Info().beginBlock("transformed")
<< tensorfld.T() << nl;
Info().endBlock();
{
auto tfld =
DimensionedField<scalar, volMesh>::New
(
tensorfld,
"scalar",
dimensioned<scalar>(14)
);
Info().beginBlock(tfld().type())
<< tfld << nl;
Info().endBlock();
}
{
auto tfld =
volScalarField::New
(
"scalar",
tensorfld.mesh(),
dimensioned<scalar>(5)
);
Info().beginBlock(tfld().type())
<< tfld() << nl;
Info().endBlock();
// From dissimilar types
auto tfld2 =
volVectorField::New
(
tfld(),
"vector",
dimensioned<vector>(Zero)
);
Info().beginBlock(tfld2().type())
<< tfld2() << nl;
Info().endBlock();
}
}
#ifdef TEST_UINT8_FIELD

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -46,8 +46,8 @@ int main(int argc, char *argv[])
profiling::disable(); // No profiling output
argList::noBanner();
argList::noParallel();
argList::noFunctionObjects();
argList::removeOption("case");
argList::removeOption("noFunctionObjects");
argList::addBoolOption("no-close", "Skip dlclose");
argList::addBoolOption("quiet", "Disable verbosity");

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -82,7 +82,8 @@ int main(int argc, char *argv[])
Info<< nl << "hash-like functionality" << nl;
e4.clear();
// doesn't work e4 = -1;
e4.start() = e4.end() = -1;
printInfo(e4);
for (label i : {2, -1, 2, 1, 4, 1, 2, 3})
@ -92,24 +93,24 @@ int main(int argc, char *argv[])
printInfo(e4);
}
e4.clear();
e4.start() = e4.end() = -1;
Info<< "insert from list\n";
labelHashSet newIndices({2, -1, 2, 1, 4, 1, 2, 3});
e4.insert(newIndices.toc());
printInfo(e4);
e4.clear();
e4.start() = e4.end() = -1;
Info<< "insert from list\n";
e4.insert({0, 5, 2, -1, 2, 1, 4, 1, 2, 3});
printInfo(e4);
FixedList<label, 8> otherIndices{12, 2, -1, 1, 4, 1, 2, 3};
e4.clear();
e4.start() = e4.end() = -1;
Info<< "insert from list: " << otherIndices << nl;
e4.insert(otherIndices);
printInfo(e4);
e4.a() = e4.b();
e4.start() = e4.end();
Info<< "erase from list: " << otherIndices << nl;
Info<< "removed " << e4.erase(otherIndices) << " values" << nl;
printInfo(e4);

View File

@ -120,8 +120,7 @@ int main(int argc, char *argv[])
try
{
// Should not trigger any errors
auto expr = expressions::exprString::toExpr(str, dict);
expressions::exprString expr(str, dict, false);
Info<< "expr: " << expr << nl;
}
catch (const Foam::error& err)

View File

@ -1,3 +1,3 @@
EXE_INC = $(c++LESSWARN)
EXE_INC = ${c++LESSWARN}
/* EXE_LIBS = */

View File

@ -1,7 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteArea/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I${LIB_SRC}/finiteVolume/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
EXE_LIBS = \
-lfiniteArea \

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -48,14 +48,6 @@ Description
using namespace Foam;
// Create named file with some dummy content
void touchFileContent(const fileName& file)
{
std::ofstream os(file);
os << "file=<" << file << ">" << nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
unsigned testClean(std::initializer_list<Pair<std::string>> tests)
@ -268,7 +260,7 @@ int main(int argc, char *argv[])
"hello1",
"hello2",
"hello3",
"hello4.ext"
"hello4.hmm"
};
Info<< file1 << nl;
@ -278,7 +270,7 @@ int main(int argc, char *argv[])
{
file1,
"some",
"more/things.ext"
"more/things.hmm"
};
Info<< file2 << nl;
@ -289,7 +281,7 @@ int main(int argc, char *argv[])
{
std::string("ffO"),
"some",
"more/things.ext"
"more/things.hmm"
};
Info<< file3 << nl;
@ -303,7 +295,7 @@ int main(int argc, char *argv[])
{
"some",
file3,
"more/things.ext",
"more/things.hmm",
file1
};
Info<< "All ==> " << file4 << nl;
@ -336,26 +328,26 @@ int main(int argc, char *argv[])
fileName input1("path.to/media/image.png");
Info<<"File : " << input0 << " ext: "
<< Switch(input0.has_ext())
<< Switch(input0.hasExt())
<< " = " << input0.ext() << nl;
Info<<"File : " << input1 << " ext: "
<< Switch(input1.has_ext())
<< Switch(input1.hasExt())
<< " = " << input1.ext() << nl;
Info<<"File : " << endWithDot << " ext: "
<< Switch(endWithDot.has_ext())
<< Switch(endWithDot.hasExt())
<< " = " << endWithDot.ext() << " <-- perhaps return false?" << nl;
Info<<"File : " << endWithSlash << " ext: "
<< Switch(endWithSlash.has_ext())
<< Switch(endWithSlash.hasExt())
<< " = " << endWithSlash.ext() << nl;
Info<<"Remove extension " << (input0.remove_ext());
Info<<"Remove extension " << (input0.removeExt());
Info<< " now: " << input0 << nl;
Info<<"Remove extension " << (input1.removeExt());
Info<< " now: " << input1 << nl;
Info<<"Remove extension " << (endWithSlash.remove_ext());
Info<<"Remove extension " << (endWithSlash.removeExt());
Info<< " now: " << endWithSlash << nl;
wordList exts{ "jpg", "png", "txt", word::null };
@ -367,14 +359,14 @@ int main(int argc, char *argv[])
Info<< nl;
Info<<"Test has_ext(word)" << nl
Info<<"Test hasExt(word)" << nl
<<"~~~~~~~~~~~~~~~~~" << nl;
Info<<"Has extension(s):" << nl
<< "input: " << input1 << nl;
for (const word& e : exts)
{
Info<<" '" << e << "' -> "
<< Switch(input1.has_ext(e)) << nl;
<< Switch(input1.hasExt(e)) << nl;
}
Info<< nl;
@ -383,12 +375,12 @@ int main(int argc, char *argv[])
for (const word& e : exts)
{
Info<<" '" << e << "' -> "
<< Switch(endWithDot.has_ext(e)) << nl;
<< Switch(endWithDot.hasExt(e)) << nl;
}
Info<< nl;
Info<<"Test has_ext(wordRe)" << nl
Info<<"Test hasExt(wordRe)" << nl
<<"~~~~~~~~~~~~~~~~~~~" << nl;
// A regex with a zero length matcher doesn't work at all:
@ -401,25 +393,25 @@ int main(int argc, char *argv[])
Info<<"Has extension(s):" << nl
<< "input: " << endWithDot << nl;
Info<<" " << matcher0 << " -> "
<< Switch(endWithDot.has_ext(matcher0)) << nl;
<< Switch(endWithDot.hasExt(matcher0)) << nl;
Info<<" " << matcher1 << " -> "
<< Switch(endWithDot.has_ext(matcher1)) << nl;
<< Switch(endWithDot.hasExt(matcher1)) << nl;
Info<<" " << matcher2 << " -> "
<< Switch(endWithDot.has_ext(matcher2)) << nl;
<< Switch(endWithDot.hasExt(matcher2)) << nl;
Info<< "input: " << input1 << nl;
Info<<" " << matcher0 << " -> "
<< Switch(input1.has_ext(matcher0)) << nl;
<< Switch(input1.hasExt(matcher0)) << nl;
Info<<" " << matcher1 << " -> "
<< Switch(input1.has_ext(matcher1)) << nl;
<< Switch(input1.hasExt(matcher1)) << nl;
Info<<" " << matcher2 << " -> "
<< Switch(input1.has_ext(matcher2)) << nl;
<< Switch(input1.hasExt(matcher2)) << nl;
Info<< nl;
Info<<"Remove extension(s):" << nl << "input: " << input1 << nl;
while (!input1.empty())
{
if (input1.remove_ext())
if (input1.removeExt())
{
Info<< " -> " << input1 << nl;
}
@ -595,54 +587,14 @@ int main(int argc, char *argv[])
if (args.found("system"))
{
const fileName dirA("dirA");
const fileName dirB("dirB");
const fileName dirC("dirC");
const fileName dirD("dirD");
const fileName lnA("lnA");
const fileName lnB("lnB");
const fileName dirB("dirB");
// Purge anything existing
Foam::rmDir(dirA, true);
Foam::rmDir(dirB, true);
Foam::rmDir(dirC, true);
Foam::rmDir(dirD, true);
Foam::rmDir(dirA);
Foam::rm(lnA);
Foam::rm(lnB);
{
fileName name(dirA/dirB/dirC/"abc");
Foam::mkDir(name.path());
touchFileContent(name); // Create real file
Foam::mkDir(dirB/dirB/dirB/dirB);
Foam::ln("test", dirB/"linkB"); // Create dead link
Foam::mkDir(dirC);
Foam::ln("../dirD", dirC/"linkC"); // Create real link
Foam::mkDir(dirD);
for (const fileName& d : { dirA, dirB, dirC, dirD })
{
Info<< "Directory: " << d << " = "
<< readDir(d, fileName::UNDEFINED, false, false) << nl;
if (Foam::rmDir(d, false, true))
{
Info<< " Removed empty dir" << nl;
}
else
{
Info<< " Could not remove empty dir" << nl;
}
}
// Force removal before continuing
Foam::rmDir(dirA, true);
Foam::rmDir(dirB, true);
Foam::rmDir(dirC, true);
Foam::rmDir(dirD, true);
}
Foam::rmDir(dirB);
Info<< nl << "=========================" << nl
<< "Test some copying and deletion" << endl;
@ -666,7 +618,9 @@ int main(int argc, char *argv[])
);
Info<<" create: " << file << endl;
touchFileContent(file);
std::ofstream os(file);
os << "file=<" << file << ">" << nl;
}
const int oldDebug = POSIX::debug;
@ -754,7 +708,7 @@ int main(int argc, char *argv[])
"hello1",
"hello2",
"hello3",
"hello4.ext"
"hello4.hmm"
};
fileName pathName(wrdList);
@ -764,28 +718,14 @@ int main(int argc, char *argv[])
<< "pathName.name() = >" << pathName.name() << "<\n"
<< "pathName.path() = " << pathName.path() << nl
<< "pathName.ext() = >" << pathName.ext() << "<\n"
<< "pathName.stem = >" << pathName.stem() << "<\n";
<< "pathName.nameLessExt= >" << pathName.nameLessExt() << "<\n";
Info<< "pathName.components() = " << pathName.components() << nl
<< "pathName.component(2) = " << pathName.component(2) << nl
<< endl;
pathName.replace_name("newName.ext");
Info<< "new name = " << pathName << nl;
Info<< "has ext = " << Switch::name(pathName.has_ext()) << nl;
Info<< "has ext('') = " << Switch::name(pathName.has_ext("")) << nl;
Info<< "has ext(foo) = " << Switch::name(pathName.has_ext("foo")) << nl;
Info<< "has ext(ext) = " << Switch::name(pathName.has_ext("ext")) << nl;
pathName.replace_ext("png");
Info<< "new ext = " << pathName << nl;
pathName.replace_ext(""); // Same as remove_ext
Info<< "new ext = " << pathName << nl;
Info<< "has path = " << Switch::name(pathName.has_path()) << nl;
pathName.remove_path();
pathName.removePath(); // second type should be a no-op
Info<< "hasPath = " << Switch(pathName.hasPath()) << nl;
pathName.removePath();
Info<< "removed path = " << pathName << nl;
Info<< nl << nl;

View File

@ -64,8 +64,13 @@ int main(int argc, char *argv[])
// Slightly extended bb. Slightly off-centred just so on symmetric
// geometry there are less face/edge aligned items.
treeBoundBox bb(efem.points());
bb.grow(ROOTVSMALL);
treeBoundBox bb
(
efem.points()
);
bb.min() -= point::uniform(ROOTVSMALL);
bb.max() += point::uniform(ROOTVSMALL);
labelList allEdges(identity(efem.edges().size()));

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
// No. of Nodes = nCells
// No. of Edges connecting Nodes = nInternalFaces
OFstream os(args.caseName() + ".graph", IOstreamOption::ASCII);
OFstream os(args.caseName() + ".graph", IOstream::ASCII);
os << "%% metis graph file, of an OpenFOAM mesh %%" << nl
<< "%% nCells=" << mesh.nCells()

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -61,10 +61,10 @@ int main(int argc, char *argv[])
InfoErr<< "output: " << outputName;
IOstreamOption::compressionType comp(IOstreamOption::UNCOMPRESSED);
if (outputName.has_ext("gz"))
if (outputName.hasExt("gz"))
{
comp = IOstreamOption::COMPRESSED;
outputName.remove_ext();
outputName.removeExt();
InfoErr<< " [compress]";
}

View File

@ -39,7 +39,7 @@ namespace Foam
{
typedef GeometricField<vector2D, fvPatchField, volMesh> volVector2DField;
defineTemplateTypeNameAndDebug(volVector2DField::Internal, 0);
defineTemplate2TypeNameAndDebug(volVector2DField::Internal, 0);
defineTemplateTypeNameAndDebug(volVector2DField, 0);
typedef fvPatchField<vector2D> fvPatchVector2DField;

View File

@ -204,7 +204,7 @@ int main(int argc, char *argv[])
labelPair inOut;
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
inOut[0] = allCcs.size();
Pstream::broadcast(allCcs);
Pstream::scatter(allCcs);
inOut[1] = allCcs.size();
Pout<< " " << inOut << endl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,31 +30,11 @@ Description
#include "argList.H"
#include "instant.H"
#include "Pair.H"
#include "fileNameInstant.H"
#include "DynamicList.H"
using namespace Foam;
template<class T>
Ostream& printInstant(const UList<T>& times, const label i)
{
if (i >= 0 && i < times.size())
{
Info<< " (" << times[i] << ")";
}
return Info;
}
template<class T>
Ostream& printInstant(const UList<T>& times, const Pair<label>& range)
{
printInstant(times, range.first());
printInstant(times, range.second());
return Info;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
@ -68,7 +48,6 @@ int main(int argc, char *argv[])
times.append({300.456, "def"});
times.append({454.456, "xyz"});
times.append({10, "ten"});
times.append({15, "fifteen"});
{
word timeName("twenty");
@ -82,19 +61,6 @@ int main(int argc, char *argv[])
sort(times);
Info<< "Sorted:" << times << nl;
for (const scalar val : { -0.5, 5.0, 18.0, 25.0, 450.0, 480.0 })
{
label start = instant::findStart(times, val);
Pair<label> range = instant::findRange(times, val);
Info<< nl
<< "time:" << val << nl;
Info<< " start:" << start;
printInstant(times, start) << nl;
Info<< " range:" << range;
printInstant(times, range) << nl;
}
DynamicList<fileNameInstant> files;
files.append(fileNameInstant{});

View File

@ -41,8 +41,8 @@ void printInfo(const labelRange& range)
<< "last " << range.last() << nl
<< "min " << range.min() << nl
<< "max " << range.max() << nl
<< "end " << range.end_value() << nl
<< "begin/end " << *range.cbegin() << ' ' << *range.cend() << nl;
<< "after " << range.after() << nl
<< "begin end " << *range.cbegin() << ' ' << *range.cend() << nl;
// Info<< "rbegin rend " << *range.rbegin() << ' ' << *range.rend() << nl;
}
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
argList::noParallel();
argList::noFunctionObjects();
argList::addArgument("start size .. startN sizeN");
argList::addVerboseOption("enable labelRange::debug");
argList::addVerbose("enable labelRange::debug");
argList::addNote
(
"The default is to add ranges, use 'add' and 'del' to toggle\n\n"

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -24,11 +24,10 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Print some numerical limits.
Print max limits.
\*---------------------------------------------------------------------------*/
#include <cmath>
#include <limits>
#include "int.H"
#include "uint.H"
@ -38,63 +37,21 @@ Description
using namespace Foam;
std::ostream& print(const char* tag, float val)
{
std::cout
<< tag << val
<< " 0x" << std::hex << *reinterpret_cast<const uint32_t*>(&val);
return std::cout;
}
std::ostream& print(const char* tag, double val)
{
std::cout
<< tag << val
<< " 0x" << std::hex << *reinterpret_cast<const uint64_t*>(&val);
return std::cout;
}
// Have (float|double)Scalar(GREAT|SMALL|..)
#define PrintFloatLimits(FloatType, NanFunction) \
{ \
print("max:", std::numeric_limits<FloatType>::max()); \
print(" VGREAT:", FloatType##ScalarVGREAT); \
print(" ROOTVGREAT:", FloatType##ScalarROOTVGREAT) << nl; \
\
print("min:", std::numeric_limits<FloatType>::min()); \
print(" VSMALL:", FloatType##ScalarVSMALL); \
print(" ROOTVSMALL:", FloatType##ScalarROOTVSMALL) << nl; \
\
print("epsilon:", std::numeric_limits<FloatType>::epsilon()); \
print(" SMALL:", FloatType##ScalarSMALL); \
print(" ROOTSMALL:", FloatType##ScalarROOTSMALL) << nl; \
\
print("1/epsilon:", 1/std::numeric_limits<FloatType>::epsilon()); \
print(" GREAT:", FloatType##ScalarGREAT); \
print(" ROOTGREAT:", FloatType##ScalarROOTGREAT) << nl; \
\
print("nan:", std::NanFunction("nan")) << nl; \
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
//NONE cout<<"int16:" << pTraits<int16_t>::max << nl;
cout<< "=max=" << nl;
cout<< "uint8:" << pTraits<uint8_t>::max << nl;
cout<< "int16:" << std::numeric_limits<int16_t>::max() << nl;
cout<< "int32:" << pTraits<int32_t>::max << nl;
cout<< "uint32:" << pTraits<uint32_t>::max << nl;
cout<< "int64:" << pTraits<int64_t>::max << nl;
cout<< "uint64:" << pTraits<uint64_t>::max << nl;
//NONE Info<<"int16:" << pTraits<int16_t>::max << nl;
Info<< "=max=" << nl;
Info<< "uint8:" << pTraits<uint8_t>::max << nl;
Info<< "int16:" << std::numeric_limits<int16_t>::max() << nl;
Info<< "int32:" << pTraits<int32_t>::max << nl;
Info<< "uint32:" << pTraits<uint32_t>::max << nl;
Info<< "int64:" << pTraits<int64_t>::max << nl;
Info<< "uint64:" << pTraits<uint64_t>::max << nl;
cout<< nl;
Info<< nl;
cout<< "int16:" << std::numeric_limits<int16_t>::max() << nl;
cout<< "int32:" << pTraits<int32_t>::max << nl;
@ -102,7 +59,7 @@ int main(int argc, char *argv[])
cout<< "int64:" << pTraits<int64_t>::max << nl;
cout<< "uint64:" << pTraits<uint64_t>::max << nl;
cout<< nl << "=digits=" << nl;
Info<< nl << "=digits=" << nl;
cout<< "int16:" << std::numeric_limits<int16_t>::digits << nl;
cout<< "int32:" << std::numeric_limits<int32_t>::digits << nl;
@ -113,15 +70,29 @@ int main(int argc, char *argv[])
cout<< "double:" << std::numeric_limits<double>::digits << nl;
cout<< "long double:" << std::numeric_limits<long double>::digits << nl;
// std::nanl (long double)
cout<< nl;
cout<< nl << "=float=" << nl;
PrintFloatLimits(float, nanf);
Info<< nl << "=float=" << nl;
cout<< nl << "=double=" << nl;
PrintFloatLimits(double, nan);
cout<< "max:" << std::numeric_limits<float>::max()
<< " VGREAT:" << floatScalarVGREAT << nl;
cout<< "min:" << std::numeric_limits<float>::min()
<< " VSMALL:" << floatScalarVSMALL << nl;
cout<< "epsilon:" << std::numeric_limits<float>::epsilon()
<< " SMALL:" << floatScalarSMALL << nl;
cout<< "1/epsilon:" << 1.0f/std::numeric_limits<float>::epsilon()
<< " GREAT:" << floatScalarGREAT << nl;
cout<< "---\nEnd\n" << std::endl;
Info<< nl << "=double=" << nl;
cout<< "max:" << std::numeric_limits<double>::max()
<< " VGREAT:" << doubleScalarVGREAT << nl;
cout<< "min:" << std::numeric_limits<double>::min()
<< " VSMALL:" << doubleScalarVSMALL << nl;
cout<< "epsilon:" << std::numeric_limits<double>::epsilon()
<< " SMALL:" << doubleScalarSMALL << nl;
cout<< "1/epsilon:" << 1.0f/std::numeric_limits<double>::epsilon()
<< " GREAT:" << doubleScalarGREAT << nl;
Info << "---\nEnd\n" << endl;
return 0;
}

View File

@ -38,7 +38,8 @@ Description
#include "DiagonalMatrix.H"
#include "RectangularMatrix.H"
#include "scalar.H"
#include "floatScalar.H"
#include "doubleScalar.H"
#include "complex.H"
#include "TestTools.H"

View File

@ -44,7 +44,8 @@ Note
#include "RectangularMatrix.H"
#include "SquareMatrix.H"
#include "scalar.H"
#include "floatScalar.H"
#include "doubleScalar.H"
#include "complex.H"
#include "IOmanip.H"
#include "TestTools.H"

View File

@ -45,7 +45,8 @@ Note
#include "scalarMatrices.H"
#include "RectangularMatrix.H"
#include "SquareMatrix.H"
#include "scalar.H"
#include "floatScalar.H"
#include "doubleScalar.H"
#include "complex.H"
#include "IOmanip.H"
#include "TestTools.H"

View File

@ -46,7 +46,8 @@ Note
#include "RectangularMatrix.H"
#include "SquareMatrix.H"
#include "SymmetricSquareMatrix.H"
#include "scalar.H"
#include "floatScalar.H"
#include "doubleScalar.H"
#include "complex.H"
#include "IOmanip.H"
#include "Random.H"

View File

@ -44,7 +44,7 @@ using namespace Foam;
template<class T>
Ostream& printInfo(const MinMax<T>& range)
{
Info<< range << " good=" << range.good() << " span=" << range.span();
Info<< range << " valid=" << range.valid() << " span=" << range.span();
return Info;
}
@ -234,7 +234,11 @@ int main(int argc, char *argv[])
Pout<< "hashed: " << hashed << nl;
Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>());
Pstream::mapCombineGather
(
hashed,
plusEqOp<scalarMinMax>()
);
Info<< "reduced: " << hashed << nl;

View File

@ -44,7 +44,7 @@ using namespace Foam;
template<class T>
Ostream& printInfo(const MinMax<T>& range)
{
Info<< range << " good=" << range.good();
Info<< range << " valid=" << range.valid();
return Info;
}

View File

@ -38,7 +38,7 @@ Description
#include "polyMesh.H"
#include "ListOps.H"
#include "face.H"
#include "tetrahedron.H"
#include "tetPointRef.H"
#include "triFaceList.H"
#include "OFstream.H"
#include "meshTools.H"

View File

@ -1,4 +1,4 @@
EXE_INC = $(COMP_OPENMP)
EXE_INC = ${COMP_OPENMP} /* -UUSE_OMP */
/* Mostly do not need to explicitly link openmp libraries */
/* EXE_LIBS = $(LINK_OPENMP) */
/* EXE_LIBS = ${LINK_OPENMP} */

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,6 +41,12 @@ Description
int main(int argc, char *argv[])
{
#if USE_OMP
std::cout << "USE_OMP defined (" << USE_OMP << ")\n";
#else
std::cout << "USE_OMP undefined\n";
#endif
#if _OPENMP
std::cout << "_OPENMP = " << _OPENMP << "\n\n";

View File

@ -55,7 +55,7 @@ void do_exchangeBuf
const bool wait
)
{
const label startOfRequests = UPstream::nRequests();
const label startOfRequests = Pstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~
@ -132,7 +132,7 @@ void do_exchangeContainer
const bool wait
)
{
const label startOfRequests = UPstream::nRequests();
const label startOfRequests = Pstream::nRequests();
// Set up receives
// ~~~~~~~~~~~~~~~

View File

@ -167,7 +167,7 @@ int main(int argc, char *argv[])
(
localValue,
sumOp<scalar>(),
UPstream::msgType(),
Pstream::msgType(),
comm
);
Pout<< "sum :" << sum << endl;

View File

@ -125,13 +125,13 @@ int main(int argc, char *argv[])
scalar data1 = 1.0;
label request1 = -1;
{
Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1);
}
scalar data2 = 0.1;
label request2 = -1;
{
Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2);
Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2);
}

View File

@ -232,7 +232,6 @@ int main(int argc, char *argv[])
const labelListList& edgeFaces = pp.edgeFaces();
const labelListList& faceEdges = pp.faceEdges();
Pout<< "box: " << pp.box() << endl;
checkFaceEdges(localFaces, edges, faceEdges);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2022 OpenCFD Ltd.
Copyright (C) 2017-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
DynamicList<char> buf;
OListStream os(std::move(buf), IOstreamOption::BINARY);
OListStream os(std::move(buf), IOstream::BINARY);
os << srcList;
os.swap(buf); // Recover buffer
@ -342,7 +342,7 @@ int main(int argc, char *argv[])
// Read back
List<scalar> dstList;
UIListStream is(buf, IOstreamOption::BINARY);
UIListStream is(buf, IOstream::BINARY);
is.setScalarByteSize(sizeof(otherType));
Info<< "Stream scalar-size ("

View File

@ -1,3 +0,0 @@
Test-rawIOField.C
EXE = $(FOAM_USER_APPBIN)/Test-rawIOField

View File

@ -1,9 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfileFormats \
-lsurfMesh \
-lmeshTools

View File

@ -1,168 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2022 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-rawIOField
Description
Reading rawIOField from disk
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "Switch.H"
#include "primitiveFields.H"
#include "pointField.H"
#include "rawIOField.H"
#include "exprTraits.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
using namespace Foam;
#undef USE_ROOT_CASE
//#define USE_ROOT_CASE
template<class Type>
tmp<Field<Type>> readRawField
(
const IOobject& io,
IOobjectOption::readOption withAverage
)
{
rawIOField<Type> raw(io, withAverage);
Info<< "File: " << io.objectPath() << nl
<< "Read: " << raw.size()
<< ' ' << pTraits<Type>::typeName << " entries" << nl
<< "Average: " << Switch::name(raw.hasAverage())
<< " = " << raw.average() << endl;
return tmp<Field<Type>>::New(std::move(static_cast<Field<Type>&>(raw)));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Test behaviour of rawIOField reading (writing?)"
);
argList::noCheckProcessorDirectories();
argList::addBoolOption("scalar", "Read scalar field");
argList::addBoolOption("vector", "Read vector field");
argList::addBoolOption("point", "Read point field");
argList::addBoolOption("average", "Require averaged value entry");
argList::addBoolOption("try-average", "Optional averaged value entry");
argList::addArgument("fileName");
#ifdef USE_ROOT_CASE
#include "setRootCase.H"
#include "createTime.H"
#else
// Without root case, or time
argList args(argc, argv);
#endif
fileName inputName = args.get<fileName>(1);
IOobjectOption::readOption withAverage = IOobjectOption::NO_READ;
if (args.found("average"))
{
withAverage = IOobjectOption::MUST_READ;
}
else if (args.found("try-average"))
{
withAverage = IOobjectOption::READ_IF_PRESENT;
}
Info<< "Using case: " << argList::envGlobalPath() << nl
<< "Read file: " << inputName << nl
<< "with average: " << int(withAverage) << nl
<< endl;
refPtr<Time> timePtr;
#ifdef USE_ROOT_CASE
timePtr.cref(runTime);
#endif
// Fallback (eg, no runTime)
if (!timePtr.good())
{
timePtr.reset(Time::New(argList::envGlobalPath()));
}
const auto& tm = timePtr();
fileName resolvedName(inputName);
resolvedName.toAbsolute();
IOobject io
(
resolvedName, // absolute path
tm,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER,
true // is global object (currently not used)
);
if (args.found("scalar"))
{
auto tfield = readRawField<scalar>(io, withAverage);
}
else if (args.found("point"))
{
auto tfield = readRawField<point>(io, withAverage);
}
else if (args.found("vector"))
{
auto tfield = readRawField<vector>(io, withAverage);
}
else
{
Info<< "no data type specified!\n";
}
Info<< nl << "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2022 OpenCFD Ltd.
Copyright (C) 2020-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -19,9 +19,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "primitiveFields.H"
#include "autoPtr.H"
#include "refPtr.H"
#include "tmp.H"
#include "Switch.H"
using namespace Foam;
@ -32,36 +29,6 @@ struct myScalarField : public scalarField
};
template<class T>
void constructInfo()
{
Info<< " move-constructible:"
<< std::is_move_constructible<T>::value
<< " move-assignable:"
<< std::is_move_assignable<T>::value
<< " nothrow:"
<< std::is_nothrow_move_assignable<T>::value
<< " trivially:"
<< std::is_trivially_move_assignable<T>::value
<< nl;
}
template<class T>
void printInfo(const autoPtr<T>& item, const bool verbose = false)
{
Info<< "autoPtr good:" << Switch::name(item.good())
<< " addr: " << Foam::name(item.get());
constructInfo<autoPtr<T>>();
if (verbose && item)
{
Info<< "content: " << item() << nl;
}
}
template<class T>
void printInfo(const refPtr<T>& item, const bool verbose = false)
{
@ -70,24 +37,15 @@ void printInfo(const refPtr<T>& item, const bool verbose = false)
<< " addr: " << Foam::name(item.get())
<< " movable:" << Switch(item.movable());
constructInfo<refPtr<T>>();
if (verbose && item)
{
Info<< "content: " << item() << nl;
}
}
template<class T>
void printInfo(const tmp<T>& item, const bool verbose = false)
{
Info<< "tmp good:" << Switch::name(item.good())
<< " pointer:" << Switch::name(item.is_pointer())
<< " addr: " << Foam::name(item.get())
<< " movable:" << Switch(item.movable());
constructInfo<tmp<T>>();
Info<< " move-constructible:"
<< std::is_move_constructible<refPtr<T>>::value
<< " move-assignable:"
<< std::is_move_assignable<refPtr<T>>::value
<< " nothrow:"
<< std::is_nothrow_move_assignable<refPtr<T>>::value
<< " trivially:"
<< std::is_trivially_move_assignable<refPtr<T>>::value
<< nl;
if (verbose && item)
{
@ -143,62 +101,6 @@ int main()
printInfo(tfld3, true);
}
{
refPtr<scalarField> tfld1;
auto aptr = autoPtr<scalarField>::New(2, scalar(2));
tmp<scalarField> tfld2;
printInfo(tfld2, true);
tfld2 = new scalarField(10, Zero);
/*
tfld2 = aptr.get();
// tfld1.reset(aptr);
// tfld1 = std::move(aptr);
// tfld1 = aptr;
Info<< nl << "From autoPtr" << nl;
printInfo(aptr, true);
//& Info<< nl << "Construct from autoPtr" << nl;
//& // refPtr<scalarField> tfld2(autoPtr<scalarField>::New(10, scalar(2)));
//& printInfo(tfld2, true);
*/
}
{
auto aptr1 = autoPtr<labelField>::New(2, Zero);
//auto aptr1 = autoPtr<scalarField>::New(2, scalar(2));
auto aptr2 = autoPtr<scalarField>::New(2, scalar(2));
refPtr<scalarField> tfld2(std::move(aptr2));
// aptr2 = std::move(aptr1);
}
{
auto tptr1 = tmp<labelField>::New(2, Zero);
auto aptr1 = autoPtr<labelField>::New(2, Zero);
auto tfld2 = refPtr<labelField>::New(2, Zero);
// Deleted: refPtr<labelField> tfld1(aptr1);
refPtr<labelField> tfld1;
// refPtr<labelField> tfld1(std::move(tptr1));
// refPtr<labelField> tfld1(tptr1);
tfld1 = std::move(aptr1);
// tfld1.reset(aptr1);
// tfld1.reset(tfld2);
// tfld1 = std::move(tptr1);
// Does not compile: tfld1.ref(tptr1);
// Deleted: tfld1.cref(tptr1);
// Deleted: tfld1.ref(aptr1);
}
Info<< "\nEnd" << endl;
return 0;

View File

@ -126,9 +126,6 @@ int main(int argc, char *argv[])
testDivide<vector>(vectors);
//(void) compareOp<vector>()(vector::zero, vector::one);
Info<< "\nEnd\n" << endl;
return 0;

View File

@ -135,7 +135,6 @@ int main(int argc, char *argv[])
cout<<"string:" << sizeof(Foam::string) << nl;
}
cout<<"IOobjectOption:" << sizeof(Foam::IOobjectOption) << nl;
cout<<"IOobject:" << sizeof(Foam::IOobject) << nl;
cout<<"IOstream:" << sizeof(Foam::IOstream) << nl;
cout<<"PstreamBuffers:" << sizeof(Foam::PstreamBuffers) << nl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2022 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -91,15 +91,15 @@ int main(int argc, char *argv[])
const auto importName = args.get<fileName>(1);
word ext =
(
importName.has_ext("gz")
? importName.stem().ext()
: importName.ext()
);
// Allow override of extension
args.readIfPresent("ext", ext);
word ext;
if (!args.readIfPresent("ext", ext))
{
ext = importName.ext();
if (ext == "gz")
{
ext = importName.lessExt().ext();
}
}
args.readIfPresent("stl-parser", fileFormats::STLReader::parserType);

View File

@ -0,0 +1,3 @@
Test-tensorFieldFields1.C
EXE = $(FOAM_USER_APPBIN)/Test-tensorFieldFields1

View File

@ -24,7 +24,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
Test-FieldFields2
Test-tensorFieldFields1
\*---------------------------------------------------------------------------*/
@ -73,29 +73,21 @@ void allocComponents
}
template<class Type>
tmp<Field<Type>> randomField(Random& rnd, label dim)
vectorField randomVectorField(label size)
{
auto tfld = tmp<Field<Type>>::New(dim);
auto& fld = tfld.ref();
Random rnd;
for (Type& val : fld)
vectorField vf(size);
forAll(vf, i)
{
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
for (direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
{
setComponent(val, cmpt) = rnd.position<label>(0, 100);
vf[i][cmpt] = rnd.position<label>(0, 100);
}
}
return tfld;
}
template<class Type>
tmp<Field<Type>> randomField(label dim)
{
Random rnd;
return randomField<Type>(rnd, dim);
return vf;
}
@ -199,7 +191,7 @@ int main(int argc, char *argv[])
printFieldField(sf1);
Info<< nl;
for (direction cmpt = 0; cmpt < pTraits<vector>::nComponents; ++cmpt)
for (direction cmpt = 0; cmpt < vector::nComponents; ++cmpt)
{
unzipRow(sf1, cmpt, slice[0]);
@ -261,9 +253,8 @@ int main(int argc, char *argv[])
{
Info<< nl << "vectorField" << nl;
Random rnd;
FieldField<Field, vector> vf1(1);
vf1.set(0, randomField<vector>(rnd, 4));
vf1.set(0, new vectorField(randomVectorField(4)));
FixedList<FieldField<Field, scalar>, 3> cmpts;
allocComponents(cmpts, 4);

View File

@ -34,29 +34,21 @@ Application
using namespace Foam;
template<class Type>
tmp<Field<Type>> randomField(Random& rnd, label dim)
vectorField randomVectorField(label size)
{
auto tfld = tmp<Field<Type>>::New(dim);
auto& fld = tfld.ref();
Random rnd;
for (Type& val : fld)
vectorField vf(size);
forAll(vf, i)
{
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
for (direction cmpt=0; cmpt < vector::nComponents; ++cmpt)
{
setComponent(val, cmpt) = rnd.position<label>(0, 100);
vf[i][cmpt] = rnd.position<label>(0, 100);
}
}
return tfld;
}
template<class Type>
tmp<Field<Type>> randomField(label dim)
{
Random rnd;
return randomField<Type>(rnd, dim);
return vf;
}
@ -259,7 +251,7 @@ int main(int argc, char *argv[])
{
Info<< nl << "vectorField" << nl;
vectorField vf1(randomField<vector>(4));
vectorField vf1(randomVectorField(4));
FixedList<scalarField, 3> cmpts(scalarField(vf1.size()));
Info<< nl

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,7 +31,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "tetrahedron.H"
#include "tetPointRef.H"
#include "OFstream.H"
#include "meshTools.H"
#include "cut.H"
@ -45,12 +44,12 @@ void writeOBJ
(
Ostream& os,
label& vertI,
const tetPoints& tet
const FixedList<point, 4>& tet
)
{
for (const point& p : tet)
forAll(tet, fp)
{
meshTools::writeOBJ(os, p);
meshTools::writeOBJ(os, tet[fp]);
}
os << "l " << vertI+1 << ' ' << vertI+2 << nl
<< "l " << vertI+1 << ' ' << vertI+3 << nl
@ -62,27 +61,33 @@ void writeOBJ
}
tetPointRef makeTetPointRef(const FixedList<point, 4>& p)
{
return tetPointRef(p[0], p[1], p[2], p[3]);
}
int main(int argc, char *argv[])
{
// Tets to test
tetPoints tetA
(
FixedList<point, 4> tetA
({
point(0, 0, 0),
point(1, 0, 0),
point(1, 1, 0),
point(1, 1, 1)
);
tetPoints tetB
(
});
FixedList<point, 4> tetB
({
point(0.1, 0.1, 0.1),
point(1.1, 0.1, 0.1),
point(1.1, 1.1, 0.1),
point(1.1, 1.1, 1.1)
);
});
// Do intersection
typedef DynamicList<tetPoints> tetList;
typedef DynamicList<FixedList<point, 4>> tetList;
tetList tetsIn1, tetsIn2, tetsOut;
cut::appendOp<tetList> tetOpIn1(tetsIn1);
cut::appendOp<tetList> tetOpIn2(tetsIn2);
@ -150,25 +155,25 @@ int main(int argc, char *argv[])
// Check the volumes
Info<< "Vol A: " << tetA.tet().mag() << endl;
Info<< "Vol A: " << makeTetPointRef(tetA).mag() << endl;
scalar volIn = 0;
for (const auto& t : tetsIn)
forAll(tetsIn, i)
{
volIn += t.tet().mag();
volIn += makeTetPointRef(tetsIn[i]).mag();
}
Info<< "Vol A inside B: " << volIn << endl;
scalar volOut = 0;
for (const auto& t : tetsOut)
forAll(tetsOut, i)
{
volOut += t.tet().mag();
volOut += makeTetPointRef(tetsOut[i]).mag();
}
Info<< "Vol A outside B: " << volOut << endl;
Info<< "Sum inside and outside: " << volIn + volOut << endl;
if (mag(volIn + volOut - tetA.tet().mag()) > SMALL)
if (mag(volIn + volOut - makeTetPointRef(tetA).mag()) > SMALL)
{
FatalErrorInFunction
<< "Tet volumes do not sum up to input tet."

View File

@ -63,6 +63,7 @@ int main(int argc, char *argv[])
argList::addNote("Test timeSelector and TimePaths");
timeSelector::addOptions(true, true);
argList::noLibs();
argList::noFunctionObjects();
argList::addOption("relative", "PATH", "Test relativePath");

View File

@ -19,9 +19,6 @@ Description
\*---------------------------------------------------------------------------*/
#include "primitiveFields.H"
#include "autoPtr.H"
#include "refPtr.H"
#include "tmp.H"
#include "Switch.H"
using namespace Foam;
@ -129,28 +126,6 @@ int main()
printInfo(tfld2);
}
{
auto tptr1 = refPtr<labelField>::New(2, Zero);
auto aptr1 = autoPtr<labelField>::New(2, Zero);
// Deleted: tmp<labelField> tfld1(aptr1);
// tmp<labelField> tfld1(std::move(aptr1));
// tmp<labelField> tfld1(std::move(tptr1));
tmp<labelField> tfld1;
//tfld1.cref(tptr1);
//tfld1.cref(aptr1);
// refPtr<labelField> tfld1(std::move(tptr1));
// refPtr<labelField> tfld1(tptr1);
// tfld1 = std::move(aptr1);
// tfld1 = std::move(tptr1);
// Does not compile: tfld1.ref(tptr1);
// Deleted: tfld1.cref(tptr1);
// Deleted: tfld1.ref(aptr1);
}
Info<< "\nEnd" << endl;
return 0;

View File

@ -33,7 +33,6 @@ Description
#include "vectorField.H"
#include "IOstreams.H"
#include "Random.H"
#include <algorithm>
#include <random>
@ -75,12 +74,8 @@ void doTest(vector& vec1, vector& vec2)
printInfo(vec1);
printInfo(vec2);
Info<< "vector: " << vec1 << nl
<< "vector: " << vec2 << nl
<< " min: " << min(vec1, vec2) << nl
<< " dist: " << vec1.dist(vec2) << ' ' << mag(vec1 - vec2) << nl
<< "dist^2: " << vec1.distSqr(vec2) << ' ' << magSqr(vec1 - vec2) << nl
<< nl;
Info<< "min of " << vec1 << " and " << vec2 << " = "
<< min(vec1, vec2) << nl << nl;
}
@ -151,46 +146,6 @@ int main(int argc, char *argv[])
std::shuffle(vec2.begin(), vec2.end(), std::default_random_engine());
Info<< "shuffled: " << vec2 << nl;
// Vectors with some identical components
List<vector> vectors
({
{1.1, 2.2, 3.3 },
{2.2, 3.3, 4.4 },
{-1.1, 2.2, 3.3 },
{-2.2, 3.3, 4.4 },
{-1.1, -2.2, 3.3 },
{-2.2, -3.3, 4.4 },
{-1.1, -2.2, -3.3 },
{-2.2, -3.3, -4.4 },
{-3.3, 2.1, 12 },
{3.145, 1.6, 2 },
{0, 0, 0}
});
shuffle(vectors);
Info<< "initial vectors: ";
vectors.writeList(Info, 1) << nl;
Foam::sort(vectors);
Info<< "regular sort:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_xyz);
Info<< "sorted xyz:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_yzx);
Info<< "sorted yzx:";
vectors.writeList(Info, 1) << nl;
std::sort(vectors.begin(), vectors.end(), vector::less_zxy);
Info<< "sorted zxy:";
vectors.writeList(Info, 1) << nl;
}
// Basic tests for fields

Some files were not shown because too many files have changed in this diff Show More