Compare commits
32 Commits
OpenFOAM-v
...
postreleas
| Author | SHA1 | Date | |
|---|---|---|---|
| 11964a4731 | |||
| c82facdc8e | |||
| da560be4df | |||
| cf6e3a1acf | |||
| 0a51a4848c | |||
| d310f82402 | |||
| 152eceeb56 | |||
| 7cfd053079 | |||
| 81f0620b7b | |||
| 7b7dde0a6d | |||
| f485093d37 | |||
| a4cbb33373 | |||
| f625a9a0dd | |||
| 5d5f541dd6 | |||
| 646b0aab36 | |||
| d048befbc0 | |||
| 26904bf6df | |||
| e3f0521b19 | |||
| bb16c493b7 | |||
| 89cd584440 | |||
| 2190684914 | |||
| 987dbe4589 | |||
| 39e054b0b8 | |||
| f6ec5c676e | |||
| ad85b684bb | |||
| dde4b12687 | |||
| 1a1322a2b0 | |||
| 8394e45c13 | |||
| 793231b4aa | |||
| f8bee97897 | |||
| 9f0f9f2dd6 | |||
| 58787bb166 |
@ -69,7 +69,8 @@ Foam::XiEqModels::Gulder::~Gulder()
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::Gulder::XiEq() const
|
||||
{
|
||||
volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));
|
||||
const volScalarField& epsilon = turbulence_.epsilon();
|
||||
const tmp<volScalarField> tepsilon(turbulence_.epsilon());
|
||||
const volScalarField& epsilon = tepsilon();
|
||||
|
||||
if (subGridSchelkin_)
|
||||
{
|
||||
|
||||
@ -75,8 +75,10 @@ Foam::XiEqModels::SCOPEXiEq::~SCOPEXiEq()
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const
|
||||
{
|
||||
const volScalarField& k = turbulence_.k();
|
||||
const volScalarField& epsilon = turbulence_.epsilon();
|
||||
const tmp<volScalarField> tk(turbulence_.k());
|
||||
const volScalarField& k = tk();
|
||||
const tmp<volScalarField> tepsilon(turbulence_.epsilon());
|
||||
const volScalarField& epsilon = tepsilon();
|
||||
|
||||
volScalarField up(sqrt((2.0/3.0)*k));
|
||||
if (subGridSchelkin_)
|
||||
|
||||
@ -66,7 +66,8 @@ Foam::XiGModels::KTS::~KTS()
|
||||
Foam::tmp<Foam::volScalarField> Foam::XiGModels::KTS::G() const
|
||||
{
|
||||
volScalarField up(sqrt((2.0/3.0)*turbulence_.k()));
|
||||
const volScalarField& epsilon = turbulence_.epsilon();
|
||||
const tmp<volScalarField> tepsilon(turbulence_.epsilon());
|
||||
const volScalarField& epsilon = tepsilon();
|
||||
|
||||
volScalarField tauEta(sqrt(mag(thermo_.muu()/(thermo_.rhou()*epsilon))));
|
||||
|
||||
|
||||
@ -110,15 +110,6 @@ public:
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new smoluchowskiJumpTFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
smoluchowskiJumpTFvPatchScalarField
|
||||
(
|
||||
@ -126,18 +117,22 @@ public:
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<scalar>> clone() const
|
||||
{
|
||||
return fvPatchField<scalar>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<scalar>> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new smoluchowskiJumpTFvPatchScalarField(*this, iF)
|
||||
);
|
||||
return fvPatchField<scalar>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
|
||||
@ -118,15 +118,6 @@ public:
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new maxwellSlipUFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
maxwellSlipUFvPatchVectorField
|
||||
(
|
||||
@ -134,16 +125,19 @@ public:
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<vector>> clone() const
|
||||
{
|
||||
return fvPatchField<vector>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<vector>> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new maxwellSlipUFvPatchVectorField(*this, iF)
|
||||
);
|
||||
return fvPatchField<vector>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -135,15 +135,6 @@ public:
|
||||
const fixedRhoFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new fixedRhoFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
fixedRhoFvPatchScalarField
|
||||
(
|
||||
@ -151,16 +142,19 @@ public:
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<scalar>> clone() const
|
||||
{
|
||||
return fvPatchField<scalar>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<scalar>> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new fixedRhoFvPatchScalarField(*this, iF)
|
||||
);
|
||||
return fvPatchField<scalar>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
volScalarField& p = thermo.p();
|
||||
const volScalarField& T = thermo.T();
|
||||
const volScalarField& psi = thermo.psi();
|
||||
const volScalarField& mu = thermo.mu();
|
||||
|
||||
bool inviscid(true);
|
||||
if (max(mu.primitiveField()) > 0.0)
|
||||
if (max(thermo.mu().cref().primitiveField()) > 0.0)
|
||||
{
|
||||
inviscid = false;
|
||||
}
|
||||
|
||||
@ -196,18 +196,6 @@ public:
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
|
||||
(
|
||||
@ -215,20 +203,19 @@ public:
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<scalar>> clone() const
|
||||
{
|
||||
return fvPatchField<scalar>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<scalar>> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return fvPatchField<scalar>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,15 +85,6 @@ public:
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new adjointOutletPressureFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
adjointOutletPressureFvPatchScalarField
|
||||
(
|
||||
@ -101,16 +92,19 @@ public:
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<scalar>> clone() const
|
||||
{
|
||||
return fvPatchField<scalar>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<scalar>> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new adjointOutletPressureFvPatchScalarField(*this, iF)
|
||||
);
|
||||
return fvPatchField<scalar>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,15 +85,6 @@ public:
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new adjointOutletVelocityFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
adjointOutletVelocityFvPatchVectorField
|
||||
(
|
||||
@ -101,16 +92,19 @@ public:
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<vector>> clone() const
|
||||
{
|
||||
return fvPatchField<vector>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<vector>> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new adjointOutletVelocityFvPatchVectorField(*this, iF)
|
||||
);
|
||||
return fvPatchField<vector>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -160,7 +160,8 @@ void VoFPatchTransfer::correct
|
||||
const volScalarField& heVoF = thermo.thermo1().he();
|
||||
const volScalarField& TVoF = thermo.thermo1().T();
|
||||
const volScalarField CpVoF(thermo.thermo1().Cp());
|
||||
const volScalarField& rhoVoF = thermo.thermo1().rho()();
|
||||
const tmp<volScalarField> trhoVoF(thermo.thermo1().rho());
|
||||
const volScalarField& rhoVoF = trhoVoF();
|
||||
const volScalarField& alphaVoF = thermo.alpha1();
|
||||
|
||||
forAll(patchIDs_, pidi)
|
||||
|
||||
@ -164,15 +164,6 @@ public:
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new alphaContactAngleFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
alphaContactAngleFvPatchScalarField
|
||||
(
|
||||
@ -180,16 +171,19 @@ public:
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<scalar>> clone() const
|
||||
{
|
||||
return fvPatchField<scalar>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<scalar>> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new alphaContactAngleFvPatchScalarField(*this, iF)
|
||||
);
|
||||
return fvPatchField<scalar>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@
|
||||
forAllConstIters(mixture.phases(), phase)
|
||||
{
|
||||
const rhoThermo& thermo = phase().thermo();
|
||||
const volScalarField& rho = thermo.rho()();
|
||||
const tmp<volScalarField> trho(thermo.rho());
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
p_rghEqnComps.set
|
||||
(
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2019 OpenCFD Ltd
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -206,9 +206,13 @@ public:
|
||||
//- Construct as copy
|
||||
DTRMParticle(const DTRMParticle& p);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<particle> clone() const
|
||||
{
|
||||
return particle::Clone(*this);
|
||||
}
|
||||
|
||||
//- Factory class to read-construct particles used for
|
||||
// parallel transfer
|
||||
//- Factory class to read-construct particles (for parallel transfer)
|
||||
class iNew
|
||||
{
|
||||
const polyMesh& mesh_;
|
||||
|
||||
@ -164,15 +164,6 @@ public:
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new alphaContactAngleFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
alphaContactAngleFvPatchScalarField
|
||||
(
|
||||
@ -180,16 +171,19 @@ public:
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<scalar>> clone() const
|
||||
{
|
||||
return fvPatchField<scalar>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<scalar>> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new alphaContactAngleFvPatchScalarField(*this, iF)
|
||||
);
|
||||
return fvPatchField<scalar>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -100,15 +100,6 @@ public:
|
||||
const tractionDisplacementFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new tractionDisplacementFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
tractionDisplacementFvPatchVectorField
|
||||
(
|
||||
@ -116,16 +107,19 @@ public:
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<vector>> clone() const
|
||||
{
|
||||
return fvPatchField<vector>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<vector>> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new tractionDisplacementFvPatchVectorField(*this, iF)
|
||||
);
|
||||
return fvPatchField<vector>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -98,15 +98,6 @@ public:
|
||||
const tractionDisplacementCorrectionFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new tractionDisplacementCorrectionFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
tractionDisplacementCorrectionFvPatchVectorField
|
||||
(
|
||||
@ -114,16 +105,19 @@ public:
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<vector>> clone() const
|
||||
{
|
||||
return fvPatchField<vector>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<vector>> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new tractionDisplacementCorrectionFvPatchVectorField(*this, iF)
|
||||
);
|
||||
return fvPatchField<vector>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
3
applications/test/checkIOspeed/Make/files
Normal file
3
applications/test/checkIOspeed/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-checkIOspeed.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-checkIOspeed
|
||||
7
applications/test/checkIOspeed/Make/options
Normal file
7
applications/test/checkIOspeed/Make/options
Normal file
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/blockMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lblockMesh
|
||||
400
applications/test/checkIOspeed/Test-checkIOspeed.cxx
Normal file
400
applications/test/checkIOspeed/Test-checkIOspeed.cxx
Normal file
@ -0,0 +1,400 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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-checkIOspeed
|
||||
|
||||
Description
|
||||
Simple test of file writing, including timings
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "profiling.H"
|
||||
#include "clockTime.H"
|
||||
|
||||
#include "fileName.H"
|
||||
#include "fileOperation.H"
|
||||
#include "IOstreams.H"
|
||||
#include "OSspecific.H"
|
||||
#include "globalIndex.H"
|
||||
#include "volFields.H"
|
||||
#include "IOField.H"
|
||||
#include "PDRblock.H"
|
||||
|
||||
// Not really great since CoherentMesh only works with reading!
|
||||
#ifdef USE_COHERENT
|
||||
#include "OFCstream.H"
|
||||
#include "SliceStreamRepo.H"
|
||||
#endif
|
||||
|
||||
#include <numeric>
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote("Rewrites fields multiple times");
|
||||
|
||||
argList::noFunctionObjects(); // Disallow function objects
|
||||
argList::noCheckProcessorDirectories();
|
||||
|
||||
argList::addVerboseOption("additional verbosity");
|
||||
argList::addOption
|
||||
(
|
||||
"output",
|
||||
"N",
|
||||
"Begin output iteration (default: 10000)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"count",
|
||||
"N",
|
||||
"Number of writes (default: 1)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"fields",
|
||||
"N",
|
||||
"Number of fields to write (default: 1)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"global",
|
||||
"N",
|
||||
"Global field size"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"local",
|
||||
"N",
|
||||
"Local fields size (default: 1000)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"mesh",
|
||||
"(nx ny nz)",
|
||||
"Create with a mesh"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"exclude",
|
||||
"(int ... )",
|
||||
"zero-sized on ranks with specified modulo"
|
||||
);
|
||||
|
||||
argList::addBoolOption("coherent", "Force coherent output");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
const label firstOutput = args.getOrDefault("output", 10000);
|
||||
const label nOutput = args.getOrDefault("count", 1);
|
||||
const label nFields = args.getOrDefault("fields", 1);
|
||||
labelVector meshCells(0, 0, 0);
|
||||
|
||||
const int verbose = args.verbose();
|
||||
|
||||
const bool useCoherent = args.found("coherent");
|
||||
|
||||
labelList excludes;
|
||||
args.readListIfPresent("exclude", excludes);
|
||||
|
||||
bool writeOnProc = true;
|
||||
|
||||
const label myProci = UPstream::myProcNo();
|
||||
|
||||
for (const label excl : excludes)
|
||||
{
|
||||
if (excl > 1 && myProci > 0 && (myProci % excl) == 0)
|
||||
{
|
||||
writeOnProc = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const label nProcsEff =
|
||||
returnReduce((writeOnProc ? 1 : 0), sumOp<label>());
|
||||
|
||||
Info<< "Output " << nProcsEff
|
||||
<< "/" << UPstream::nProcs()
|
||||
<< " ranks" << nl;
|
||||
|
||||
|
||||
if (args.readIfPresent("mesh", meshCells))
|
||||
{
|
||||
if (!writeOnProc)
|
||||
{
|
||||
meshCells = Zero;
|
||||
}
|
||||
|
||||
PDRblock block(boundBox(point::zero, point::one), meshCells);
|
||||
|
||||
// Advance time
|
||||
// - coherent currently still needs to read the mesh itself!
|
||||
runTime.setTime(firstOutput, firstOutput);
|
||||
|
||||
IOobject meshIO
|
||||
(
|
||||
polyMesh::defaultRegion,
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
autoPtr<polyMesh> pmeshPtr(block.innerMesh(meshIO));
|
||||
|
||||
fvMesh mesh
|
||||
(
|
||||
meshIO,
|
||||
pointField(pmeshPtr->points()),
|
||||
faceList(pmeshPtr->faces()),
|
||||
labelList(pmeshPtr->faceOwner()),
|
||||
labelList(pmeshPtr->faceNeighbour())
|
||||
);
|
||||
|
||||
pmeshPtr.reset(nullptr);
|
||||
|
||||
const label fieldSize = mesh.nCells();
|
||||
|
||||
const globalIndex giCells(fieldSize);
|
||||
|
||||
// Create fields
|
||||
Info<< nl << "Create " << nFields << " fields" << nl
|
||||
<< "field-size:" << fieldSize
|
||||
<< " total-size:" << giCells.totalSize() << nl;
|
||||
|
||||
// Dimensioned field (no proc boundaries)
|
||||
|
||||
PtrList<volScalarField::Internal> fields(nFields);
|
||||
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"field",
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
forAll(fields, fieldi)
|
||||
{
|
||||
io.resetHeader("field" + Foam::name(fieldi));
|
||||
|
||||
fields.set
|
||||
(
|
||||
fieldi,
|
||||
new volScalarField::Internal(io, mesh, dimless)
|
||||
);
|
||||
|
||||
auto& fld = fields[fieldi];
|
||||
std::iota(fld.begin(), fld.end(), scalar(0));
|
||||
}
|
||||
}
|
||||
|
||||
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
||||
|
||||
if (useCoherent)
|
||||
{
|
||||
#ifdef USE_COHERENT
|
||||
streamOpt.format(IOstreamOption::COHERENT);
|
||||
runTime.writeFormat(IOstreamOption::COHERENT);
|
||||
|
||||
mesh.writeObject(streamOpt, true);
|
||||
|
||||
Info<< nl
|
||||
<< "Specified -coherent (instance: "
|
||||
<< mesh.pointsInstance() << ")" << endl;
|
||||
|
||||
const auto& coherent = CoherentMesh::New(mesh);
|
||||
|
||||
Info<< " points = "
|
||||
<< coherent.globalPointOffsets().totalSize() << nl
|
||||
<< " cells = "
|
||||
<< coherent.globalCellOffsets().totalSize() << nl
|
||||
<< " patches = "
|
||||
<< coherent.nNonProcessorPatches() << nl;
|
||||
|
||||
#else
|
||||
Info<< "Warning: -coherent ignored" << nl;
|
||||
#endif
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Writing " << nOutput << " times starting at "
|
||||
<< firstOutput << nl;
|
||||
|
||||
clockTime timing;
|
||||
|
||||
if (verbose) Info<< "Time:";
|
||||
|
||||
for
|
||||
(
|
||||
label timeIndex = firstOutput, count = 0;
|
||||
count < nOutput;
|
||||
++timeIndex, ++count
|
||||
)
|
||||
{
|
||||
runTime.setTime(timeIndex, timeIndex);
|
||||
if (verbose) Info<< ' ' << runTime.timeName() << flush;
|
||||
runTime.writeNow();
|
||||
|
||||
for (const auto& fld : fields)
|
||||
{
|
||||
fld.regIOobject::writeObject(streamOpt, writeOnProc);
|
||||
}
|
||||
}
|
||||
|
||||
if (useCoherent)
|
||||
{
|
||||
#ifdef USE_COHERENT
|
||||
SliceStreamRepo::closeInstance();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (verbose) Info<< nl;
|
||||
Info<< nl << "Writing took "
|
||||
<< timing.timeIncrement() << "s" << endl;
|
||||
|
||||
Info<< nl
|
||||
<< "Cleanup newly generated files with" << nl << nl
|
||||
<< " foamListTimes -rm -time "
|
||||
<< firstOutput << ":" << nl
|
||||
<< " foamListTimes -processor -rm -time "
|
||||
<< firstOutput << ":" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
label fieldSize = 1000;
|
||||
|
||||
if (args.readIfPresent("global", fieldSize))
|
||||
{
|
||||
fieldSize /= nProcsEff;
|
||||
}
|
||||
else
|
||||
{
|
||||
args.readIfPresent("local", fieldSize);
|
||||
}
|
||||
|
||||
if (!writeOnProc)
|
||||
{
|
||||
fieldSize = 0;
|
||||
}
|
||||
|
||||
const globalIndex giCells(fieldSize);
|
||||
|
||||
// Create fields
|
||||
Info<< nl << "Create " << nFields << " fields" << nl
|
||||
<< "field-size:" << fieldSize
|
||||
<< " total-size:" << giCells.totalSize() << nl;
|
||||
|
||||
|
||||
PtrList<IOField<scalar>> fields(nFields);
|
||||
|
||||
{
|
||||
IOobject io
|
||||
(
|
||||
"field",
|
||||
runTime.timeName(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
forAll(fields, fieldi)
|
||||
{
|
||||
io.resetHeader("field" + Foam::name(fieldi));
|
||||
|
||||
fields.set
|
||||
(
|
||||
fieldi,
|
||||
new IOField<scalar>(io, fieldSize)
|
||||
);
|
||||
|
||||
auto& fld = fields[fieldi];
|
||||
std::iota(fld.begin(), fld.end(), scalar(0));
|
||||
}
|
||||
}
|
||||
|
||||
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
||||
|
||||
if (useCoherent)
|
||||
{
|
||||
Info<< "Warning: -coherent ignored" << nl;
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Writing " << nOutput << " times starting at "
|
||||
<< firstOutput << nl;
|
||||
|
||||
clockTime timing;
|
||||
|
||||
if (verbose) Info<< "Time:";
|
||||
|
||||
for
|
||||
(
|
||||
label timeIndex = firstOutput, count = 0;
|
||||
count < nOutput;
|
||||
++timeIndex, ++count
|
||||
)
|
||||
{
|
||||
runTime.setTime(timeIndex, timeIndex);
|
||||
if (verbose) Info<< ' ' << runTime.timeName() << flush;
|
||||
runTime.writeNow();
|
||||
|
||||
for (const auto& fld : fields)
|
||||
{
|
||||
fld.regIOobject::writeObject(streamOpt, writeOnProc);
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose) Info<< nl;
|
||||
Info<< nl << "Writing took "
|
||||
<< timing.timeIncrement() << "s" << endl;
|
||||
|
||||
Info<< nl
|
||||
<< "Cleanup newly generated files with" << nl << nl
|
||||
<< " foamListTimes -rm -time "
|
||||
<< firstOutput << ":" << nl
|
||||
<< " foamListTimes -processor -rm -time "
|
||||
<< firstOutput << ":" << nl;
|
||||
}
|
||||
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,3 +1,3 @@
|
||||
Test-fileHandler-writing.C
|
||||
Test-fileHandler-writing.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-fileHandler-writing
|
||||
|
||||
@ -56,8 +56,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList::noFunctionObjects(); // Disallow function objects
|
||||
argList::addVerboseOption("additional verbosity");
|
||||
argList::addOption("output", "Begin output iteration (default: 10000)");
|
||||
argList::addOption("count", "Number of writes (default: 1)");
|
||||
argList::addOption
|
||||
(
|
||||
"output",
|
||||
"N",
|
||||
"Begin output iteration (default: 10000)"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"count",
|
||||
"N",
|
||||
"Number of writes (default: 1)"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"procAddressing",
|
||||
instance,
|
||||
fvMesh::meshSubDir,
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
|
||||
@ -118,7 +118,8 @@ PtrList<GeoField> create
|
||||
(
|
||||
word("cmpt." + name(i)),
|
||||
mesh,
|
||||
dimensioned<typename GeoField::value_type>(Zero)
|
||||
Foam::zero{}, // value
|
||||
dimless
|
||||
).ptr()
|
||||
);
|
||||
}
|
||||
|
||||
@ -482,8 +482,8 @@ void Foam::searchableSurfaceControl::cellSizeFunctionVertices
|
||||
DynamicList<scalar>& sizes
|
||||
) const
|
||||
{
|
||||
const tmp<pointField> tmpPoints = searchableSurface_.points();
|
||||
const pointField& points = tmpPoints();
|
||||
const tmp<pointField> tpoints(searchableSurface_.points());
|
||||
const pointField& points = tpoints();
|
||||
|
||||
const scalar nearFeatDistSqrCoeff = 1e-8;
|
||||
|
||||
|
||||
@ -110,7 +110,8 @@ Foam::scalar Foam::nonUniformField::interpolate
|
||||
{
|
||||
const face& faceHitByPt = surfaceTriMesh_.triSurface::operator[](index);
|
||||
|
||||
const pointField& pts = surfaceTriMesh_.points();
|
||||
const tmp<pointField> tpoints(surfaceTriMesh_.points());
|
||||
const pointField& pts = tpoints();
|
||||
// const Map<label>& pMap = surfaceTriMesh_.meshPointMap();
|
||||
|
||||
triPointRef tri
|
||||
|
||||
@ -982,7 +982,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findOffsetPatchFaces
|
||||
offsetBoundaryCells.write();
|
||||
}
|
||||
|
||||
return std::move(offsetBoundaryCells);
|
||||
return offsetBoundaryCells;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1371,7 +1371,7 @@ Foam::labelHashSet Foam::conformalVoronoiMesh::findRemainingProtrusionSet
|
||||
protrudingCells.write();
|
||||
}
|
||||
|
||||
return std::move(protrudingCells);
|
||||
return protrudingCells;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,26 +53,33 @@ using namespace Foam;
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Name of region to create
|
||||
const string singleCellName = "singleCell";
|
||||
const word singleCellName = "singleCell";
|
||||
|
||||
|
||||
template<class GeoField>
|
||||
void interpolateFields
|
||||
wordList interpolateFields
|
||||
(
|
||||
const singleCellFvMesh& scMesh,
|
||||
const singleCellFvMesh& subsetter,
|
||||
const PtrList<GeoField>& flds
|
||||
)
|
||||
{
|
||||
wordList names(flds.size());
|
||||
|
||||
forAll(flds, i)
|
||||
{
|
||||
tmp<GeoField> scFld = scMesh.interpolate(flds[i]);
|
||||
GeoField* scFldPtr = scFld.ptr();
|
||||
scFldPtr->writeOpt(IOobject::AUTO_WRITE);
|
||||
scFldPtr->store();
|
||||
GeoField* subFld = subsetter.interpolate(flds[i]).ptr();
|
||||
|
||||
subFld->writeOpt(IOobject::AUTO_WRITE);
|
||||
subFld->store();
|
||||
|
||||
names[i] = subFld->name();
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -94,7 +101,7 @@ int main(int argc, char *argv[])
|
||||
if (regionName == singleCellName)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot convert region " << singleCellName
|
||||
<< "Cannot convert region " << regionName
|
||||
<< " since result would overwrite it. Please rename your region."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
@ -111,7 +118,8 @@ int main(int argc, char *argv[])
|
||||
mesh.pointsInstance(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::AUTO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh
|
||||
)
|
||||
@ -131,18 +139,27 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
forAll(timeDirs, timeI)
|
||||
// List of stored objects to clear prior to reading
|
||||
DynamicList<word> storedObjects;
|
||||
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timeI], timeI);
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
|
||||
Info<< nl << "Time = " << runTime.timeName() << endl;
|
||||
|
||||
// Purge any previously interpolated fields
|
||||
if (!storedObjects.empty())
|
||||
{
|
||||
static_cast<objectRegistry&>(scMesh()).erase(storedObjects);
|
||||
storedObjects.clear();
|
||||
}
|
||||
|
||||
// Check for new mesh
|
||||
if (mesh.readUpdate() != polyMesh::UNCHANGED)
|
||||
{
|
||||
Info<< "Detected changed mesh. Recreating singleCell mesh." << endl;
|
||||
scMesh.clear(); // remove any registered objects
|
||||
scMesh.reset(nullptr); // first free any stored objects
|
||||
scMesh.reset
|
||||
(
|
||||
new singleCellFvMesh
|
||||
@ -153,43 +170,37 @@ int main(int argc, char *argv[])
|
||||
mesh.pointsInstance(),
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::AUTO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Read objects in time directory
|
||||
IOobjectList objects(mesh, runTime.timeName());
|
||||
storedObjects.reserve(objects.size());
|
||||
|
||||
// Read vol fields.
|
||||
PtrList<volScalarField> vsFlds;
|
||||
ReadFields(mesh, objects, vsFlds);
|
||||
// Read fvMesh fields, map and store the interpolated fields
|
||||
#define doLocalCode(GeoField) \
|
||||
{ \
|
||||
PtrList<GeoField> flds; \
|
||||
ReadFields(mesh, objects, flds); \
|
||||
storedObjects.push_back(interpolateFields(scMesh(), flds)); \
|
||||
}
|
||||
|
||||
PtrList<volVectorField> vvFlds;
|
||||
ReadFields(mesh, objects, vvFlds);
|
||||
|
||||
PtrList<volSphericalTensorField> vstFlds;
|
||||
ReadFields(mesh, objects, vstFlds);
|
||||
|
||||
PtrList<volSymmTensorField> vsymtFlds;
|
||||
ReadFields(mesh, objects, vsymtFlds);
|
||||
|
||||
PtrList<volTensorField> vtFlds;
|
||||
ReadFields(mesh, objects, vtFlds);
|
||||
|
||||
// Map and store the fields on the scMesh.
|
||||
interpolateFields(scMesh(), vsFlds);
|
||||
interpolateFields(scMesh(), vvFlds);
|
||||
interpolateFields(scMesh(), vstFlds);
|
||||
interpolateFields(scMesh(), vsymtFlds);
|
||||
interpolateFields(scMesh(), vtFlds);
|
||||
doLocalCode(volScalarField);
|
||||
doLocalCode(volVectorField);
|
||||
doLocalCode(volSphericalTensorField);
|
||||
doLocalCode(volSymmTensorField);
|
||||
doLocalCode(volTensorField);
|
||||
|
||||
#undef doLocalCode
|
||||
|
||||
// Write
|
||||
Info<< "Writing mesh to time " << runTime.timeName() << endl;
|
||||
Info<< "Writing " << singleCellName
|
||||
<< " mesh/fields to time " << runTime.timeName() << endl;
|
||||
scMesh().write();
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,9 +30,8 @@ License
|
||||
#include "Time.H"
|
||||
#include "PtrList.H"
|
||||
#include "fvPatchFields.H"
|
||||
#include "fvsPatchFields.H"
|
||||
#include "emptyFvPatch.H"
|
||||
#include "emptyFvPatchField.H"
|
||||
#include "emptyFvsPatchField.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
#include "processorFvPatch.H"
|
||||
@ -123,15 +122,19 @@ Foam::parFvFieldDistributor::distributeField
|
||||
{
|
||||
if (patchFaceMaps_.set(patchi))
|
||||
{
|
||||
// Clone local patch field
|
||||
oldPatchFields.set(patchi, bfld[patchi].clone());
|
||||
|
||||
distributedFvPatchFieldMapper mapper
|
||||
(
|
||||
labelUList::null(),
|
||||
patchFaceMaps_[patchi]
|
||||
);
|
||||
|
||||
// Clone local patch field
|
||||
oldPatchFields.set
|
||||
(
|
||||
patchi,
|
||||
bfld[patchi].clone(fld.internalField())
|
||||
);
|
||||
|
||||
// Map into local copy
|
||||
oldPatchFields[patchi].autoMap(mapper);
|
||||
}
|
||||
@ -159,7 +162,7 @@ Foam::parFvFieldDistributor::distributeField
|
||||
(
|
||||
pfld,
|
||||
tgtMesh_.boundary()[patchi],
|
||||
DimensionedField<Type, volMesh>::null(),
|
||||
fvPatchField<Type>::Internal::null(),
|
||||
dummyMapper
|
||||
)
|
||||
);
|
||||
@ -178,9 +181,9 @@ Foam::parFvFieldDistributor::distributeField
|
||||
patchi,
|
||||
fvPatchField<Type>::New
|
||||
(
|
||||
emptyFvPatchField<Type>::typeName,
|
||||
fvPatchFieldBase::emptyType(),
|
||||
tgtMesh_.boundary()[patchi],
|
||||
DimensionedField<Type, volMesh>::null()
|
||||
fvPatchField<Type>::Internal::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -268,15 +271,19 @@ Foam::parFvFieldDistributor::distributeField
|
||||
{
|
||||
if (patchFaceMaps_.set(patchi))
|
||||
{
|
||||
// Clone local patch field
|
||||
oldPatchFields.set(patchi, bfld[patchi].clone());
|
||||
|
||||
distributedFvPatchFieldMapper mapper
|
||||
(
|
||||
labelUList::null(),
|
||||
patchFaceMaps_[patchi]
|
||||
);
|
||||
|
||||
// Clone local patch field
|
||||
oldPatchFields.set
|
||||
(
|
||||
patchi,
|
||||
bfld[patchi].clone(fld.internalField())
|
||||
);
|
||||
|
||||
// Map into local copy
|
||||
oldPatchFields[patchi].autoMap(mapper);
|
||||
}
|
||||
@ -303,7 +310,7 @@ Foam::parFvFieldDistributor::distributeField
|
||||
(
|
||||
pfld,
|
||||
tgtMesh_.boundary()[patchi],
|
||||
DimensionedField<Type, surfaceMesh>::null(),
|
||||
fvsPatchField<Type>::Internal::null(),
|
||||
dummyMapper
|
||||
)
|
||||
);
|
||||
@ -321,9 +328,9 @@ Foam::parFvFieldDistributor::distributeField
|
||||
patchi,
|
||||
fvsPatchField<Type>::New
|
||||
(
|
||||
emptyFvsPatchField<Type>::typeName,
|
||||
fvsPatchFieldBase::emptyType(),
|
||||
tgtMesh_.boundary()[patchi],
|
||||
DimensionedField<Type, surfaceMesh>::null()
|
||||
fvsPatchField<Type>::Internal::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -26,11 +26,11 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Time.H"
|
||||
#include "emptyPointPatchField.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
#include "distributedFieldMapper.H"
|
||||
#include "distributedPointPatchFieldMapper.H"
|
||||
#include "emptyPointPatch.H"
|
||||
#include "pointFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -108,7 +108,7 @@ Foam::parPointFieldDistributor::distributeField
|
||||
(
|
||||
bfld[patchi],
|
||||
tgtMesh.boundary()[patchi], // pointPatch
|
||||
DimensionedField<Type, pointMesh>::null(),
|
||||
pointPatchField<Type>::Internal::null(),
|
||||
mapper
|
||||
)
|
||||
);
|
||||
@ -122,7 +122,7 @@ Foam::parPointFieldDistributor::distributeField
|
||||
// bfld[patchi].clone
|
||||
// (
|
||||
// tgtMesh.boundary()[patchi],
|
||||
// DimensionedField<Type, pointMesh>::null(),
|
||||
// pointPatchField<Type>::Internal::null(),
|
||||
// mapper
|
||||
// )
|
||||
//);
|
||||
@ -140,9 +140,9 @@ Foam::parPointFieldDistributor::distributeField
|
||||
patchi,
|
||||
pointPatchField<Type>::New
|
||||
(
|
||||
emptyPointPatchField<Type>::typeName,
|
||||
pointPatchFieldBase::emptyType(),
|
||||
tgtMesh.boundary()[patchi],
|
||||
DimensionedField<Type, pointMesh>::null()
|
||||
pointPatchField<Type>::Internal::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -100,10 +100,10 @@ public:
|
||||
cachedPosition_(p.cachedPosition_)
|
||||
{}
|
||||
|
||||
//- Construct and return a clone
|
||||
//- Return a clone
|
||||
virtual autoPtr<particle> clone() const
|
||||
{
|
||||
return autoPtr<particle>(new passivePositionParticle(*this));
|
||||
return particle::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -148,7 +148,8 @@ bool setField
|
||||
(
|
||||
fieldName,
|
||||
mesh,
|
||||
dimensioned<typename GeoField::value_type>(dims)
|
||||
Foam::zero{}, // value
|
||||
dims
|
||||
);
|
||||
}
|
||||
else
|
||||
|
||||
@ -221,9 +221,10 @@ void detectSelfIntersections
|
||||
const edgeList& edges = s.edges();
|
||||
const indexedOctree<treeDataTriSurface>& tree = s.tree();
|
||||
const labelList& meshPoints = s.meshPoints();
|
||||
const pointField& points = s.points();
|
||||
const tmp<pointField> tpoints(s.points());
|
||||
const pointField& points = tpoints();
|
||||
|
||||
isEdgeIntersecting.setSize(edges.size());
|
||||
isEdgeIntersecting.resize_nocopy(edges.size());
|
||||
isEdgeIntersecting = false;
|
||||
|
||||
forAll(edges, edgeI)
|
||||
@ -311,7 +312,8 @@ label detectIntersectionPoints
|
||||
detectSelfIntersections(s, isEdgeIntersecting);
|
||||
|
||||
const edgeList& edges = s.edges();
|
||||
const pointField& points = s.points();
|
||||
const tmp<pointField> tpoints(s.points());
|
||||
const pointField& points = tpoints();
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
@ -836,9 +838,10 @@ int main(int argc, char *argv[])
|
||||
// Do some smoothing (Lloyds algorithm)
|
||||
lloydsSmoothing(nSmooth, s, isFeaturePoint, edgeStat, isAffectedPoint);
|
||||
|
||||
|
||||
// Update pointDisplacement
|
||||
const pointField& pts = s.points();
|
||||
const tmp<pointField> tpoints(s.points());
|
||||
const pointField& pts = tpoints();
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
label meshPointI = meshPoints[i];
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -86,13 +86,10 @@ public:
|
||||
const ${typeName}Function1_${TemplateType}& rhs
|
||||
) = default;
|
||||
|
||||
//- Construct and return a clone
|
||||
//- Return a clone
|
||||
virtual tmp<Function1<${TemplateType}>> clone() const
|
||||
{
|
||||
return tmp<Function1<${TemplateType}>>
|
||||
(
|
||||
new ${typeName}Function1_${TemplateType}(*this)
|
||||
);
|
||||
return Function1<${TemplateType}>::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -85,12 +85,6 @@ public:
|
||||
const bool faceValues = true
|
||||
);
|
||||
|
||||
//- Copy construct
|
||||
${typeName}PatchFunction1${FieldType}
|
||||
(
|
||||
const ${typeName}PatchFunction1${FieldType}& rhs
|
||||
) = default;
|
||||
|
||||
//- Copy construct, resetting patch
|
||||
${typeName}PatchFunction1${FieldType}
|
||||
(
|
||||
@ -98,25 +92,25 @@ public:
|
||||
const polyPatch& pp
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
//- Copy construct
|
||||
${typeName}PatchFunction1${FieldType}
|
||||
(
|
||||
const ${typeName}PatchFunction1${FieldType}& rhs
|
||||
) = default;
|
||||
|
||||
//- Return a clone
|
||||
virtual tmp<PatchFunction1<${TemplateType}>> clone() const
|
||||
{
|
||||
return tmp<PatchFunction1<${TemplateType}>>
|
||||
(
|
||||
new ${typeName}PatchFunction1${FieldType}(*this)
|
||||
);
|
||||
return PatchFunction1<${TemplateType}>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting patch
|
||||
//- Return a clone, setting the patch
|
||||
virtual tmp<PatchFunction1<${TemplateType}>> clone
|
||||
(
|
||||
const polyPatch& pp
|
||||
) const
|
||||
{
|
||||
return tmp<PatchFunction1<${TemplateType}>>
|
||||
(
|
||||
new ${typeName}PatchFunction1${FieldType}(*this, pp)
|
||||
);
|
||||
return PatchFunction1<${TemplateType}>::Clone(*this, pp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,15 +107,6 @@ public:
|
||||
const ${typeName}FixedValueFvPatch${FieldType}&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatch${FieldType}> clone() const
|
||||
{
|
||||
return tmp<fvPatch${FieldType}>
|
||||
(
|
||||
new ${typeName}FixedValueFvPatch${FieldType}(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
${typeName}FixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -123,16 +114,19 @@ public:
|
||||
const DimensionedField<${TemplateType}, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatch${FieldType}> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<${TemplateType}>> clone() const
|
||||
{
|
||||
return fvPatchField<${TemplateType}>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<${TemplateType}>> clone
|
||||
(
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatch${FieldType}>
|
||||
(
|
||||
new ${typeName}FixedValueFvPatch${FieldType}(*this, iF)
|
||||
);
|
||||
return fvPatchField<${TemplateType}>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -108,15 +108,6 @@ public:
|
||||
const ${typeName}FixedValuePointPatch${FieldType}&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<${TemplateType}>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<${TemplateType}>>
|
||||
(
|
||||
new ${typeName}FixedValuePointPatch${FieldType}(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
${typeName}FixedValuePointPatch${FieldType}
|
||||
(
|
||||
@ -124,16 +115,19 @@ public:
|
||||
const DimensionedField<${TemplateType}, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<${TemplateType}>> clone() const
|
||||
{
|
||||
return pointPatchField<${TemplateType}>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<${TemplateType}>> clone
|
||||
(
|
||||
const DimensionedField<${TemplateType}, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<${TemplateType}>>
|
||||
(
|
||||
new ${typeName}FixedValuePointPatch${FieldType}(*this, iF)
|
||||
);
|
||||
return pointPatchField<${TemplateType}>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,15 +107,6 @@ public:
|
||||
const ${typeName}MixedValueFvPatch${FieldType}&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatch${FieldType}> clone() const
|
||||
{
|
||||
return tmp<fvPatch${FieldType}>
|
||||
(
|
||||
new ${typeName}MixedValueFvPatch${FieldType}(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
${typeName}MixedValueFvPatch${FieldType}
|
||||
(
|
||||
@ -123,16 +114,19 @@ public:
|
||||
const DimensionedField<${TemplateType}, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatch${FieldType}> clone
|
||||
//- Return a clone
|
||||
virtual tmp<fvPatchField<${TemplateType}>> clone() const
|
||||
{
|
||||
return fvPatchField<${TemplateType}>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Clone with an internal field reference
|
||||
virtual tmp<fvPatchField<${TemplateType}>> clone
|
||||
(
|
||||
const DimensionedField<${TemplateType}, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatch${FieldType}>
|
||||
(
|
||||
new ${typeName}MixedValueFvPatch${FieldType}(*this, iF)
|
||||
);
|
||||
return fvPatchField<${TemplateType}>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ OptimisationSwitches
|
||||
// (sized with magnitude of value) is large enough to hold all
|
||||
// outstanding writes so will not try to initialise the Pstream with
|
||||
// threading support.
|
||||
// Default: 1e9
|
||||
// Default: 0
|
||||
maxThreadFileBufferSize 0;
|
||||
|
||||
//- masterUncollated: non-blocking buffer size.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -135,23 +135,15 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Helper: determine number of processors whose recvSizes fits
|
||||
//- into maxBufferSize
|
||||
static label calcNumProcs
|
||||
(
|
||||
const label comm,
|
||||
const off_t maxBufferSize,
|
||||
const labelUList& recvSizes,
|
||||
const label startProci
|
||||
);
|
||||
|
||||
//- Read data into *this. ISstream is only valid on master.
|
||||
//- Read data (on master) and transmit.
|
||||
static bool readBlocks
|
||||
(
|
||||
const label comm,
|
||||
// [in] The input stream (only valid on master)
|
||||
autoPtr<ISstream>& isPtr,
|
||||
List<char>& contentChars,
|
||||
const UPstream::commsTypes commsType
|
||||
// [out] The processor local data
|
||||
List<char>& localData,
|
||||
const UPstream::commsTypes commsType /* unused */
|
||||
);
|
||||
|
||||
//- Helper: skip a block of (binary) character data
|
||||
@ -277,6 +269,19 @@ public:
|
||||
}
|
||||
|
||||
//- Helper: write block of (binary) character content
|
||||
// Housekeeping
|
||||
static std::streamoff writeBlockEntry
|
||||
(
|
||||
OSstream& os,
|
||||
const label blocki,
|
||||
const stdFoam::span<char>& s
|
||||
)
|
||||
{
|
||||
return writeBlockEntry(os, blocki, s.data(), s.size());
|
||||
}
|
||||
|
||||
//- Helper: write block of (binary) character content
|
||||
// Housekeeping
|
||||
static std::streamoff writeBlockEntry
|
||||
(
|
||||
OSstream& os,
|
||||
@ -307,41 +312,37 @@ public:
|
||||
);
|
||||
|
||||
//- Read master header information (into headerIO) and return
|
||||
//- data in stream. Note: isPtr is only valid on master.
|
||||
//- data in stream.
|
||||
static autoPtr<ISstream> readBlocks
|
||||
(
|
||||
const label comm,
|
||||
const fileName& fName,
|
||||
//! [in] The input stream (only valid on master)
|
||||
autoPtr<ISstream>& isPtr,
|
||||
//! [out] header information
|
||||
IOobject& headerIO,
|
||||
const UPstream::commsTypes commsType
|
||||
const UPstream::commsTypes commsType /* unused */
|
||||
);
|
||||
|
||||
//- Helper: gather single label. Note: using native Pstream.
|
||||
// datas sized with num procs but undefined contents on
|
||||
// slaves
|
||||
static void gather
|
||||
(
|
||||
const label comm,
|
||||
const label data,
|
||||
labelList& datas
|
||||
);
|
||||
|
||||
//- Helper: gather data from (subset of) slaves.
|
||||
//- Helper: gather data from (subset of) sub-ranks.
|
||||
// In non-blocking mode it sets up send/recv for non-empty content.
|
||||
// In blocking/scheduled mode it uses MPI_Gatherv to collect data.
|
||||
//
|
||||
// Returns:
|
||||
// - recvData : received data
|
||||
// - recvData : the received data
|
||||
// - recvOffsets : offset in data. recvOffsets is nProcs+1
|
||||
static void gatherSlaveData
|
||||
static void gatherProcData
|
||||
(
|
||||
const label comm,
|
||||
const UList<char>& data,
|
||||
const labelUList& recvSizes,
|
||||
const UList<char>& localData, //!< [in] required on all procs
|
||||
const labelUList& recvSizes, //!< [in] only required on master
|
||||
|
||||
const labelRange& fromProcs,
|
||||
const labelRange& whichProcs, //!< [in] required on all procs
|
||||
|
||||
List<int>& recvOffsets,
|
||||
DynamicList<char>& recvData
|
||||
List<int>& recvOffsets, //!< [out] only relevant on master
|
||||
DynamicList<char>& recvData, //!< [out] only relevant on master
|
||||
|
||||
const UPstream::commsTypes commsType
|
||||
);
|
||||
|
||||
//- Write *this. Ostream only valid on master.
|
||||
@ -349,19 +350,98 @@ public:
|
||||
static bool writeBlocks
|
||||
(
|
||||
const label comm,
|
||||
|
||||
//! [in] output stream (relevant on master)
|
||||
autoPtr<OSstream>& osPtr,
|
||||
//! [out] start offsets to each block (relevant on master),
|
||||
//! ignored if List::null() type
|
||||
List<std::streamoff>& blockOffset,
|
||||
|
||||
const UList<char>& masterData,
|
||||
const UList<char>& localData, //!< [in] required on all procs
|
||||
const labelUList& recvSizes, //!< [in] only required on master
|
||||
|
||||
const labelUList& recvSizes,
|
||||
|
||||
// Optional slave data (on master)
|
||||
const UPtrList<SubList<char>>& slaveData,
|
||||
//! Optional proc data (only written on master)
|
||||
//! but \b must also be symmetrically defined (empty/non-empty)
|
||||
//! on all ranks
|
||||
const UList<stdFoam::span<char>>& procData,
|
||||
|
||||
const UPstream::commsTypes commsType,
|
||||
const bool syncReturnState = true
|
||||
);
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- Write *this. Ostream only valid on master.
|
||||
// Returns offsets of processor blocks in blockOffset
|
||||
FOAM_DEPRECATED_FOR(2023-09, "write with char span instead")
|
||||
static bool writeBlocks
|
||||
(
|
||||
const label comm,
|
||||
autoPtr<OSstream>& osPtr,
|
||||
List<std::streamoff>& blockOffset,
|
||||
|
||||
const UList<char>& localData, // [in] required on all procs
|
||||
const labelUList& recvSizes, // [in] only required on master
|
||||
|
||||
// Optional proc data (only written on master)
|
||||
// but \b must also be symmetrically defined (empty/non-empty)
|
||||
// on all ranks
|
||||
const UPtrList<SubList<char>>& procData,
|
||||
|
||||
const UPstream::commsTypes commsType,
|
||||
const bool syncReturnState = true
|
||||
)
|
||||
{
|
||||
// Transcribe to span<char>
|
||||
List<stdFoam::span<char>> spans(procData.size());
|
||||
forAll(procData, proci)
|
||||
{
|
||||
if (procData.test(proci))
|
||||
{
|
||||
spans[proci] = stdFoam::span<char>
|
||||
(
|
||||
const_cast<char*>(procData[proci].cdata()),
|
||||
procData[proci].size()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return decomposedBlockData::writeBlocks
|
||||
(
|
||||
comm,
|
||||
osPtr,
|
||||
blockOffset,
|
||||
localData,
|
||||
recvSizes,
|
||||
spans,
|
||||
commsType,
|
||||
syncReturnState
|
||||
);
|
||||
}
|
||||
|
||||
//- Deprecated(2023-09) - consider UPstream::listGatherValue
|
||||
// The only difference is that this gather also resizes the output
|
||||
// on the non-master procs
|
||||
// \deprecated(2023-09) - consider UPstream::listGatherValue
|
||||
FOAM_DEPRECATED_FOR(2023-09, "consider UPstream::listGatherValue()")
|
||||
static void gather
|
||||
(
|
||||
const label comm,
|
||||
const label localValue,
|
||||
labelList& allValues
|
||||
)
|
||||
{
|
||||
allValues.resize_nocopy(UPstream::nProcs(comm));
|
||||
|
||||
UPstream::mpiGather
|
||||
(
|
||||
reinterpret_cast<const char*>(&localValue),
|
||||
allValues.data_bytes(),
|
||||
sizeof(label), // The send/recv size per rank
|
||||
comm
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ License
|
||||
#include "masterOFstream.H"
|
||||
#include "OFstream.H"
|
||||
#include "OSspecific.H"
|
||||
#include "PstreamBuffers.H"
|
||||
#include "Pstream.H"
|
||||
#include "masterUncollatedFileOperation.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
@ -38,10 +38,10 @@ void Foam::masterOFstream::checkWrite
|
||||
(
|
||||
const fileName& fName,
|
||||
const char* str,
|
||||
std::streamsize len
|
||||
const std::streamsize len
|
||||
)
|
||||
{
|
||||
if (!len)
|
||||
if (!str || !len)
|
||||
{
|
||||
// Can probably skip all of this if there is nothing to write
|
||||
return;
|
||||
@ -63,9 +63,7 @@ void Foam::masterOFstream::checkWrite
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
// Use writeRaw() instead of writeQuoted(string,false) to output
|
||||
// characters directly.
|
||||
|
||||
// Write characters directly to std::ostream
|
||||
os.writeRaw(str, len);
|
||||
|
||||
if (!os.good())
|
||||
@ -77,97 +75,159 @@ void Foam::masterOFstream::checkWrite
|
||||
}
|
||||
|
||||
|
||||
void Foam::masterOFstream::checkWrite
|
||||
(
|
||||
const fileName& fName,
|
||||
const std::string& s
|
||||
)
|
||||
{
|
||||
checkWrite(fName, s.data(), s.length());
|
||||
}
|
||||
|
||||
|
||||
void Foam::masterOFstream::commit()
|
||||
{
|
||||
// Take ownership of serialized content, without copying or reallocation
|
||||
DynamicList<char> charData(OCharStream::release());
|
||||
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
// Ignore content if not writing (reduces communication)
|
||||
if (!writeOnProc_)
|
||||
{
|
||||
charData.clear();
|
||||
}
|
||||
|
||||
List<fileName> filePaths(UPstream::nProcs(comm_));
|
||||
filePaths[UPstream::myProcNo(comm_)] = pathName_;
|
||||
Pstream::gatherList(filePaths, UPstream::msgType(), comm_);
|
||||
|
||||
// Test for identical output paths
|
||||
bool uniform =
|
||||
(
|
||||
UPstream::master(comm_)
|
||||
&& fileOperation::uniformFile(filePaths)
|
||||
? fileOperation::uniformFile(filePaths)
|
||||
: true
|
||||
);
|
||||
|
||||
Pstream::broadcast(uniform, comm_);
|
||||
|
||||
if (uniform)
|
||||
{
|
||||
// Identical file paths - write on master
|
||||
if (UPstream::master(comm_) && writeOnProc_)
|
||||
{
|
||||
checkWrite(pathName_, this->str());
|
||||
checkWrite(pathName_, charData);
|
||||
}
|
||||
|
||||
this->reset();
|
||||
return;
|
||||
}
|
||||
|
||||
// Different files
|
||||
PstreamBuffers pBufs(comm_, UPstream::commsTypes::nonBlocking);
|
||||
// ---------------
|
||||
// Current strategy is to setup all non-blocking send/recv
|
||||
// using the probed message size to establish the recv size
|
||||
// (to avoid an additional communication of the sizes).
|
||||
//
|
||||
// For ranks with writeOnProc=false, the message size is 0.
|
||||
|
||||
if (!UPstream::master(comm_))
|
||||
// An alternative approach would be to gather recv sizes
|
||||
// to avoid zero-sized messages and/or use double buffering
|
||||
// to recv into a buffer and write.
|
||||
//
|
||||
// const labelList recvSizes
|
||||
// (
|
||||
// UPstream::listGatherValues<label>
|
||||
// (
|
||||
// (UPstream::is_subrank(comm_) ? charData.size() : label(0)),
|
||||
// comm_
|
||||
// )
|
||||
// );
|
||||
|
||||
const label startOfRequests = UPstream::nRequests();
|
||||
|
||||
// Some unique tag for this read/write/probe grouping
|
||||
const int messageTag = UPstream::msgType() + 256;
|
||||
|
||||
if (UPstream::is_subrank(comm_))
|
||||
{
|
||||
if (writeOnProc_)
|
||||
{
|
||||
// Send buffer to master
|
||||
string s(this->str());
|
||||
|
||||
UOPstream os(UPstream::masterNo(), pBufs);
|
||||
os.write(s.data(), s.length());
|
||||
}
|
||||
this->reset(); // Done with contents
|
||||
// Send to master. When (!writeOnProc_) it is zero-sized.
|
||||
UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
UPstream::masterNo(),
|
||||
charData.cdata_bytes(),
|
||||
charData.size_bytes(),
|
||||
messageTag,
|
||||
comm_
|
||||
);
|
||||
}
|
||||
|
||||
pBufs.finishedGathers();
|
||||
|
||||
|
||||
if (UPstream::master(comm_))
|
||||
else if (UPstream::master(comm_))
|
||||
{
|
||||
// The receive slots
|
||||
List<List<char>> procBuffers(UPstream::nProcs(comm_));
|
||||
|
||||
const auto recvProcs = UPstream::subProcs(comm_);
|
||||
|
||||
for (const int proci : recvProcs)
|
||||
{
|
||||
auto& procSlice = procBuffers[proci];
|
||||
|
||||
// Probe the message size
|
||||
std::pair<int, int> probed =
|
||||
UPstream::probeMessage
|
||||
(
|
||||
UPstream::commsTypes::blocking,
|
||||
proci,
|
||||
messageTag,
|
||||
comm_
|
||||
);
|
||||
|
||||
procSlice.resize_nocopy(probed.second);
|
||||
|
||||
// Receive content (can also be zero-sized)
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
proci,
|
||||
procSlice.data_bytes(),
|
||||
procSlice.size_bytes(),
|
||||
messageTag,
|
||||
comm_
|
||||
);
|
||||
}
|
||||
|
||||
if (writeOnProc_)
|
||||
{
|
||||
// Write master data
|
||||
checkWrite(filePaths[UPstream::masterNo()], this->str());
|
||||
// Write non-empty master data
|
||||
checkWrite(pathName_, charData);
|
||||
}
|
||||
this->reset(); // Done with contents
|
||||
|
||||
|
||||
// Allocate large enough to read without resizing
|
||||
List<char> buf(pBufs.maxRecvCount());
|
||||
|
||||
for (const int proci : UPstream::subProcs(comm_))
|
||||
// Poll for completed receive requests and dispatch
|
||||
DynamicList<int> indices(recvProcs.size());
|
||||
while
|
||||
(
|
||||
UPstream::waitSomeRequests
|
||||
(
|
||||
startOfRequests,
|
||||
recvProcs.size(),
|
||||
&indices
|
||||
)
|
||||
)
|
||||
{
|
||||
const std::streamsize count(pBufs.recvDataCount(proci));
|
||||
|
||||
if (count)
|
||||
for (const int idx : indices)
|
||||
{
|
||||
UIPstream is(proci, pBufs);
|
||||
const int proci = recvProcs[idx];
|
||||
auto& procSlice = procBuffers[proci];
|
||||
|
||||
is.read(buf.data(), count);
|
||||
checkWrite(filePaths[proci], buf.cdata(), count);
|
||||
if (!procSlice.empty())
|
||||
{
|
||||
// Write non-empty sub-proc data
|
||||
checkWrite(filePaths[proci], procSlice);
|
||||
}
|
||||
|
||||
// Eager cleanup?
|
||||
// TBD: procSlice.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UPstream::waitRequests(startOfRequests);
|
||||
}
|
||||
else
|
||||
{
|
||||
checkWrite(pathName_, this->str());
|
||||
this->reset();
|
||||
// Write (non-empty) data
|
||||
checkWrite(pathName_, charData);
|
||||
}
|
||||
|
||||
// This method is only called once (internally)
|
||||
// so no need to clear/flush old buffered data
|
||||
}
|
||||
|
||||
|
||||
@ -183,7 +243,7 @@ Foam::masterOFstream::masterOFstream
|
||||
const bool writeOnProc
|
||||
)
|
||||
:
|
||||
OStringStream(streamOpt),
|
||||
OCharStream(streamOpt),
|
||||
pathName_(pathName),
|
||||
atomic_(atomic),
|
||||
compression_(streamOpt.compression()),
|
||||
|
||||
@ -41,7 +41,7 @@ SourceFiles
|
||||
#ifndef Foam_masterOFstream_H
|
||||
#define Foam_masterOFstream_H
|
||||
|
||||
#include "StringStream.H"
|
||||
#include "SpanStream.H"
|
||||
#include "UPstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -55,7 +55,7 @@ namespace Foam
|
||||
|
||||
class masterOFstream
|
||||
:
|
||||
public OStringStream
|
||||
public OCharStream
|
||||
{
|
||||
// Private Data
|
||||
|
||||
@ -85,13 +85,20 @@ class masterOFstream
|
||||
(
|
||||
const fileName& fName,
|
||||
const char* str,
|
||||
std::streamsize len
|
||||
const std::streamsize len
|
||||
);
|
||||
|
||||
//- Open file with checking and write append contents
|
||||
void checkWrite(const fileName& fName, const std::string& s);
|
||||
void checkWrite
|
||||
(
|
||||
const fileName& fName,
|
||||
const UList<char>& charData
|
||||
)
|
||||
{
|
||||
checkWrite(fName, charData.cdata(), charData.size_bytes());
|
||||
}
|
||||
|
||||
//- Commit buffered information, including parallel gather as required
|
||||
//- Commit buffered information, including communication as required
|
||||
void commit();
|
||||
|
||||
|
||||
|
||||
@ -59,8 +59,10 @@ class ISstream
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The input stream path
|
||||
fileName name_;
|
||||
|
||||
//- The input stream
|
||||
std::istream& is_;
|
||||
|
||||
|
||||
@ -129,6 +131,8 @@ public:
|
||||
virtual const fileName& name() const override { return name_; }
|
||||
|
||||
//- The name of the input serial stream, for modification.
|
||||
// Use with caution since some classes (eg, Fstream)
|
||||
// also use this for filesystem information!
|
||||
virtual fileName& name() { return name_; }
|
||||
|
||||
|
||||
|
||||
@ -58,8 +58,10 @@ class OSstream
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The output stream path
|
||||
fileName name_;
|
||||
|
||||
//- The output stream
|
||||
std::ostream& os_;
|
||||
|
||||
|
||||
@ -119,6 +121,11 @@ public:
|
||||
//- (eg, the name of the Fstream file name)
|
||||
virtual const fileName& name() const override { return name_; }
|
||||
|
||||
//- The name of the output serial stream, for modification.
|
||||
// Use with caution since some classes (eg, Fstream)
|
||||
// also use this for filesystem information!
|
||||
virtual fileName& name() { return name_; }
|
||||
|
||||
|
||||
// STL stream
|
||||
|
||||
|
||||
@ -519,7 +519,8 @@ public:
|
||||
if (newCapacity < len)
|
||||
{
|
||||
// Increase capacity (doubling)
|
||||
newCapacity = max(len, label(2*storage_.size()));
|
||||
newCapacity =
|
||||
Foam::max(label(len), label(2*storage_.size()));
|
||||
}
|
||||
|
||||
// Info<<"request:" << len
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -151,6 +151,44 @@ Foam::HashTable<Foam::wordHashSet> Foam::objectRegistry::classes() const
|
||||
}
|
||||
|
||||
|
||||
Foam::IOobject Foam::objectRegistry::newIOobject
|
||||
(
|
||||
const word& name,
|
||||
IOobjectOption::readOption rOpt,
|
||||
IOobjectOption::writeOption wOpt,
|
||||
IOobjectOption::registerOption regOpt
|
||||
) const
|
||||
{
|
||||
return IOobject
|
||||
(
|
||||
name,
|
||||
time().timeName(), // instance
|
||||
*this,
|
||||
IOobjectOption(rOpt, wOpt, regOpt)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// FUTURE?
|
||||
//
|
||||
// Foam::IOobject Foam::objectRegistry::newIOobject_constant
|
||||
// (
|
||||
// const word& name,
|
||||
// IOobjectOption::readOption rOpt,
|
||||
// IOobjectOption::writeOption wOpt,
|
||||
// IOobjectOption::registerOption regOpt
|
||||
// ) const
|
||||
// {
|
||||
// return IOobject
|
||||
// (
|
||||
// name,
|
||||
// time().constant(), // instance
|
||||
// *this,
|
||||
// IOobjectOption(rOpt, wOpt, regOpt)
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
Foam::label Foam::objectRegistry::count(const char* clsName) const
|
||||
{
|
||||
// No nullptr check - only called with string literals
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -239,6 +239,23 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Helper Functions
|
||||
|
||||
//- Create an IOobject at the current time instance (timeName).
|
||||
// By default the object is NO_READ/NO_WRITE/NO_REGISTER
|
||||
IOobject newIOobject
|
||||
(
|
||||
//! The object name
|
||||
const word& name,
|
||||
//! The read option (default: NO_READ)
|
||||
IOobjectOption::readOption rOpt = IOobjectOption::NO_READ,
|
||||
//! The write option (default: NO_WRITE)
|
||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||
//! The register option (default: NO_REGISTER)
|
||||
IOobjectOption::registerOption regOpt = IOobjectOption::NO_REGISTER
|
||||
) const;
|
||||
|
||||
|
||||
// Summary of classes
|
||||
|
||||
//- A summary hash of classes used and their associated object names.
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,8 +65,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Function1Types_expression_H
|
||||
#define Function1Types_expression_H
|
||||
#ifndef Foam_Function1Types_expression_H
|
||||
#define Foam_Function1Types_expression_H
|
||||
|
||||
#include "Function1.H"
|
||||
#include "fieldExprDriver.H"
|
||||
@ -124,10 +124,10 @@ public:
|
||||
//- Copy construct
|
||||
explicit Function1Expression(const Function1Expression<Type>& rhs);
|
||||
|
||||
//- Construct and return a clone
|
||||
//- Return a clone
|
||||
virtual tmp<Function1<Type>> clone() const
|
||||
{
|
||||
return tmp<Function1<Type>>(new Function1Expression<Type>(*this));
|
||||
return Function1<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -440,8 +440,19 @@ public:
|
||||
const dimensioned<Type>& dt
|
||||
);
|
||||
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE).
|
||||
//- [Takes current timeName from the mesh registry].
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||
//- retaining its instance/local.
|
||||
// For LEGACY_REGISTER, registration is determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||
(
|
||||
const word& newName,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const tmp<DimensionedField<Type, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||
//- retaining its instance/local.
|
||||
// Registration/persistence determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<DimensionedField<Type, GeoMesh>> New
|
||||
|
||||
@ -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.
|
||||
@ -40,6 +40,7 @@ Foam::DimensionedField<Type, GeoMesh>::New_impl
|
||||
{
|
||||
auto ptr = tmp<DimensionedField<Type, GeoMesh>>::New
|
||||
(
|
||||
// == mesh.thisDb().newIOobject(name)
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
@ -53,19 +54,22 @@ Foam::DimensionedField<Type, GeoMesh>::New_impl
|
||||
std::forward<Args>(args)...
|
||||
);
|
||||
|
||||
if (IOobjectOption::REGISTER == regOpt)
|
||||
// Registration
|
||||
{
|
||||
ptr->checkIn();
|
||||
}
|
||||
else if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if (IOobjectOption::REGISTER == regOpt)
|
||||
{
|
||||
ptr->checkIn();
|
||||
}
|
||||
else if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
@ -290,6 +294,7 @@ Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||
Foam::DimensionedField<Type, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const tmp<DimensionedField<Type, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
@ -308,18 +313,44 @@ Foam::DimensionedField<Type, GeoMesh>::New
|
||||
tfld
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
// Registration
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if (IOobjectOption::REGISTER == regOpt)
|
||||
{
|
||||
ptr->checkIn();
|
||||
}
|
||||
else if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class GeoMesh>
|
||||
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||
Foam::DimensionedField<Type, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
const tmp<DimensionedField<Type, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
return DimensionedField<Type, GeoMesh>::New
|
||||
(
|
||||
name,
|
||||
IOobjectOption::LEGACY_REGISTER,
|
||||
tfld
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, class GeoMesh>
|
||||
template<class AnyType>
|
||||
Foam::tmp<Foam::DimensionedField<Type, GeoMesh>>
|
||||
@ -345,13 +376,16 @@ Foam::DimensionedField<Type, GeoMesh>::New
|
||||
dims
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
// Registration
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
@ -383,13 +417,16 @@ Foam::DimensionedField<Type, GeoMesh>::New
|
||||
dt.dimensions()
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
// Registration
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017,2022 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -189,7 +189,7 @@ bool Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::checkConsistency
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::readField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
@ -210,7 +210,9 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::readField
|
||||
|
||||
for (const entry& dEntry : dict)
|
||||
{
|
||||
if (dEntry.isDict() && dEntry.keyword().isLiteral())
|
||||
const auto* subdict = dEntry.dictPtr();
|
||||
|
||||
if (subdict && dEntry.keyword().isLiteral())
|
||||
{
|
||||
const label patchi = bmesh_.findPatchID(dEntry.keyword());
|
||||
|
||||
@ -222,11 +224,11 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::readField
|
||||
PatchField<Type>::New
|
||||
(
|
||||
bmesh_[patchi],
|
||||
field,
|
||||
dEntry.dict()
|
||||
iField,
|
||||
*subdict
|
||||
)
|
||||
);
|
||||
nUnset--;
|
||||
--nUnset;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -245,8 +247,9 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::readField
|
||||
for (auto iter = dict.crbegin(); iter != dict.crend(); ++iter)
|
||||
{
|
||||
const entry& dEntry = *iter;
|
||||
const auto* subdict = dEntry.dictPtr();
|
||||
|
||||
if (dEntry.isDict() && dEntry.keyword().isLiteral())
|
||||
if (subdict && dEntry.keyword().isLiteral())
|
||||
{
|
||||
const labelList patchIds =
|
||||
bmesh_.indices(dEntry.keyword(), true); // use patchGroups
|
||||
@ -261,8 +264,8 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::readField
|
||||
PatchField<Type>::New
|
||||
(
|
||||
bmesh_[patchi],
|
||||
field,
|
||||
dEntry.dict()
|
||||
iField,
|
||||
*subdict
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -285,15 +288,15 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::readField
|
||||
(
|
||||
emptyPolyPatch::typeName,
|
||||
bmesh_[patchi],
|
||||
field
|
||||
iField
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool found = dict.found(bmesh_[patchi].name());
|
||||
const auto* subdict = dict.findDict(bmesh_[patchi].name());
|
||||
|
||||
if (found)
|
||||
if (subdict)
|
||||
{
|
||||
this->set
|
||||
(
|
||||
@ -301,8 +304,8 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::readField
|
||||
PatchField<Type>::New
|
||||
(
|
||||
bmesh_[patchi],
|
||||
field,
|
||||
dict.subDict(bmesh_[patchi].name())
|
||||
iField,
|
||||
*subdict
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -353,7 +356,7 @@ template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const word& patchFieldType
|
||||
)
|
||||
:
|
||||
@ -374,7 +377,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
patchFieldType,
|
||||
bmesh_[patchi],
|
||||
field
|
||||
iField
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -385,7 +388,7 @@ template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& constraintTypes
|
||||
)
|
||||
@ -424,7 +427,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
patchFieldTypes[patchi],
|
||||
constraintTypes[patchi],
|
||||
bmesh_[patchi],
|
||||
field
|
||||
iField
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -440,7 +443,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
patchFieldTypes[patchi],
|
||||
bmesh_[patchi],
|
||||
field
|
||||
iField
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -452,7 +455,7 @@ template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const PtrList<PatchField<Type>>& ptfl
|
||||
)
|
||||
:
|
||||
@ -466,7 +469,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set(patchi, ptfl[patchi].clone(field));
|
||||
this->set(patchi, ptfl[patchi].clone(iField));
|
||||
}
|
||||
}
|
||||
|
||||
@ -474,7 +477,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const GeometricBoundaryField<Type, PatchField, GeoMesh>& btf
|
||||
)
|
||||
:
|
||||
@ -488,7 +491,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
|
||||
forAll(bmesh_, patchi)
|
||||
{
|
||||
this->set(patchi, btf[patchi].clone(field));
|
||||
this->set(patchi, btf[patchi].clone(iField));
|
||||
}
|
||||
}
|
||||
|
||||
@ -496,7 +499,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const GeometricBoundaryField<Type, PatchField, GeoMesh>& btf,
|
||||
const labelList& patchIDs,
|
||||
const word& patchFieldType
|
||||
@ -519,7 +522,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
patchFieldType,
|
||||
bmesh_[patchi],
|
||||
field
|
||||
iField
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -528,7 +531,7 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
{
|
||||
if (!this->set(patchi))
|
||||
{
|
||||
this->set(patchi, btf[patchi].clone(field));
|
||||
this->set(patchi, btf[patchi].clone(iField));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -554,14 +557,14 @@ template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
FieldField<PatchField, Type>(bmesh.size()),
|
||||
bmesh_(bmesh)
|
||||
{
|
||||
readField(field, dict);
|
||||
readField(iField, dict);
|
||||
}
|
||||
|
||||
|
||||
@ -835,18 +838,24 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::types() const
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>
|
||||
Foam::tmp<Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::
|
||||
boundaryInternalField() const
|
||||
{
|
||||
GeometricBoundaryField<Type, PatchField, GeoMesh> result(*this);
|
||||
auto tresult = tmp<GeometricBoundaryField<Type, PatchField, GeoMesh>>::New
|
||||
(
|
||||
DimensionedField<Type, GeoMesh>::null(),
|
||||
*this
|
||||
);
|
||||
|
||||
auto& result = tresult;
|
||||
|
||||
forAll(result, patchi)
|
||||
{
|
||||
result[patchi] == this->operator[](patchi).patchInternalField();
|
||||
}
|
||||
|
||||
return result;
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
@ -858,13 +867,11 @@ Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::interfaces() const
|
||||
|
||||
forAll(list, patchi)
|
||||
{
|
||||
const auto* lduPtr =
|
||||
isA<LduInterfaceField<Type>>(this->operator[](patchi));
|
||||
|
||||
if (lduPtr)
|
||||
{
|
||||
list.set(patchi, lduPtr);
|
||||
}
|
||||
list.set
|
||||
(
|
||||
patchi,
|
||||
isA<LduInterfaceField<Type>>(this->operator[](patchi))
|
||||
);
|
||||
}
|
||||
|
||||
return list;
|
||||
@ -880,13 +887,11 @@ scalarInterfaces() const
|
||||
|
||||
forAll(list, patchi)
|
||||
{
|
||||
const auto* lduPtr =
|
||||
isA<lduInterfaceField>(this->operator[](patchi));
|
||||
|
||||
if (lduPtr)
|
||||
{
|
||||
list.set(patchi, lduPtr);
|
||||
}
|
||||
list.set
|
||||
(
|
||||
patchi,
|
||||
isA<lduInterfaceField>(this->operator[](patchi))
|
||||
);
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
@ -117,7 +117,7 @@ public:
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||
);
|
||||
|
||||
@ -127,7 +127,7 @@ public:
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const wordList& wantedPatchTypes,
|
||||
const wordList& actualPatchTypes = wordList()
|
||||
);
|
||||
@ -137,14 +137,14 @@ public:
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const PtrList<PatchField<Type>>& ptfl
|
||||
);
|
||||
|
||||
//- Construct as copy, setting the reference to the internal field
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const GeometricBoundaryField<Type, PatchField, GeoMesh>& btf
|
||||
);
|
||||
|
||||
@ -152,7 +152,7 @@ public:
|
||||
//- and resetting type of field for given patch IDs
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const GeometricBoundaryField<Type, PatchField, GeoMesh>& btf,
|
||||
const labelList& patchIDs,
|
||||
const word& patchFieldName
|
||||
@ -169,7 +169,7 @@ public:
|
||||
GeometricBoundaryField
|
||||
(
|
||||
const BoundaryMesh& bmesh,
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const Internal& iField,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
@ -177,11 +177,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Read the boundary field
|
||||
void readField
|
||||
(
|
||||
const DimensionedField<Type, GeoMesh>& field,
|
||||
const dictionary& dict
|
||||
);
|
||||
void readField(const Internal& iField, const dictionary& dict);
|
||||
|
||||
//- Update the boundary condition coefficients
|
||||
void updateCoeffs();
|
||||
@ -203,7 +199,7 @@ public:
|
||||
wordList types() const;
|
||||
|
||||
//- Return boundary field of values neighbouring the boundary
|
||||
GeometricBoundaryField boundaryInternalField() const;
|
||||
tmp<GeometricBoundaryField> boundaryInternalField() const;
|
||||
|
||||
//- Return a list of pointers for each patch field with only those
|
||||
//- pointing to interfaces being set
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -504,6 +504,68 @@ public:
|
||||
const word& patchFieldType = PatchField<Type>::calculatedType()
|
||||
);
|
||||
|
||||
//- Return tmp field (NO_READ, NO_WRITE)
|
||||
//- from name, mesh, dimensions, copy of internal field contents
|
||||
//- and patch list to clone.
|
||||
//- [Takes current timeName from the mesh registry].
|
||||
// For LEGACY_REGISTER, registration is determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& name,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const Mesh& mesh,
|
||||
const dimensionSet& dims,
|
||||
const Field<Type>& iField,
|
||||
const PtrList<PatchField<Type>>& pflds
|
||||
);
|
||||
|
||||
//- Return tmp field (NO_READ, NO_WRITE)
|
||||
//- from name, mesh, dimensions, copy of internal field contents
|
||||
//- and patch list to clone.
|
||||
//- [Takes current timeName from the mesh registry].
|
||||
// Registration/persistence determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& name,
|
||||
const Mesh& mesh,
|
||||
const dimensionSet& dims,
|
||||
const Field<Type>& iField,
|
||||
const PtrList<PatchField<Type>>& pflds
|
||||
);
|
||||
|
||||
//- Return tmp field (NO_READ, NO_WRITE)
|
||||
//- from name, mesh, dimensions, moved internal field contents
|
||||
//- and patch list to clone.
|
||||
//- [Takes current timeName from the mesh registry].
|
||||
// For LEGACY_REGISTER, registration is determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& name,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const Mesh& mesh,
|
||||
const dimensionSet& dims,
|
||||
Field<Type>&& iField,
|
||||
const PtrList<PatchField<Type>>& pflds
|
||||
);
|
||||
|
||||
//- Return tmp field (NO_READ, NO_WRITE)
|
||||
//- from name, mesh, dimensions, moved internal field contents
|
||||
//- and patch list to clone.
|
||||
//- [Takes current timeName from the mesh registry].
|
||||
// Registration/persistence determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& name,
|
||||
const Mesh& mesh,
|
||||
const dimensionSet& dims,
|
||||
Field<Type>&& iField,
|
||||
const PtrList<PatchField<Type>>& pflds
|
||||
);
|
||||
|
||||
//- Return tmp field (NO_READ, NO_WRITE)
|
||||
//- from name, mesh, field value, dimensions and patch type.
|
||||
//- [Takes current timeName from the mesh registry].
|
||||
@ -621,36 +683,70 @@ public:
|
||||
);
|
||||
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||
//- [Takes current timeName from the mesh registry].
|
||||
// Registration/persistence determined by
|
||||
//- retaining its instance/local.
|
||||
// For LEGACY_REGISTER, registration is determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& newName,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||
//- with reset patch field type.
|
||||
//- [Takes current timeName from the mesh registry].
|
||||
//- retaining its instance/local.
|
||||
// Registration/persistence determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& newName,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||
//- with reset patch field type, retaining its instance/local.
|
||||
// For LEGACY_REGISTER, registration is determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& newName,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld,
|
||||
const word& patchFieldType
|
||||
);
|
||||
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||
//- with reset patch field types.
|
||||
//- [Takes instance from the field].
|
||||
//- with reset patch field type, retaining its instance/local.
|
||||
// Registration/persistence determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& newName,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld,
|
||||
const word& patchFieldType
|
||||
);
|
||||
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||
//- with reset patch field types, retaining its instance/local.
|
||||
// For LEGACY_REGISTER, registration is determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& newName,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& actualPatchTypes = wordList()
|
||||
);
|
||||
|
||||
//- Return renamed tmp field (NO_READ, NO_WRITE)
|
||||
//- with reset patch field types, retaining its instance/local.
|
||||
// Registration/persistence determined by
|
||||
// objectRegistry::is_cacheTemporaryObject().
|
||||
static tmp<GeometricField<Type, PatchField, GeoMesh>> New
|
||||
(
|
||||
const word& newName,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& actualPatchTypes = wordList()
|
||||
);
|
||||
@ -866,7 +962,6 @@ public:
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Return a const-reference to the dimensioned internal field.
|
||||
//- Same as internalField().
|
||||
// Useful in the formulation of source-terms for FV equations
|
||||
const Internal& operator()() const { return *this; }
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,6 +41,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||
{
|
||||
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
||||
(
|
||||
// == mesh.thisDb().newIOobject(name)
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
@ -54,19 +55,22 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||
std::forward<Args>(args)...
|
||||
);
|
||||
|
||||
if (IOobjectOption::REGISTER == regOpt)
|
||||
// Registration
|
||||
{
|
||||
ptr->checkIn();
|
||||
}
|
||||
else if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if (IOobjectOption::REGISTER == regOpt)
|
||||
{
|
||||
ptr->checkIn();
|
||||
}
|
||||
else if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
@ -211,6 +215,100 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const Mesh& mesh,
|
||||
const dimensionSet& dims,
|
||||
const Field<Type>& iField,
|
||||
const PtrList<PatchField<Type>>& pflds
|
||||
)
|
||||
{
|
||||
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||
(
|
||||
regOpt,
|
||||
name,
|
||||
mesh,
|
||||
dims,
|
||||
iField,
|
||||
pflds
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
const Mesh& mesh,
|
||||
const dimensionSet& dims,
|
||||
const Field<Type>& iField,
|
||||
const PtrList<PatchField<Type>>& pflds
|
||||
)
|
||||
{
|
||||
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||
(
|
||||
IOobjectOption::LEGACY_REGISTER,
|
||||
name,
|
||||
mesh,
|
||||
dims,
|
||||
iField,
|
||||
pflds
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const Mesh& mesh,
|
||||
const dimensionSet& dims,
|
||||
Field<Type>&& iField,
|
||||
const PtrList<PatchField<Type>>& pflds
|
||||
)
|
||||
{
|
||||
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||
(
|
||||
regOpt,
|
||||
name,
|
||||
mesh,
|
||||
dims,
|
||||
std::move(iField),
|
||||
pflds
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
const Mesh& mesh,
|
||||
const dimensionSet& dims,
|
||||
Field<Type>&& iField,
|
||||
const PtrList<PatchField<Type>>& pflds
|
||||
)
|
||||
{
|
||||
return GeometricField<Type, PatchField, GeoMesh>::New_impl
|
||||
(
|
||||
IOobjectOption::LEGACY_REGISTER,
|
||||
name,
|
||||
mesh,
|
||||
dims,
|
||||
std::move(iField),
|
||||
pflds
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
@ -406,7 +504,70 @@ Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
tfld().instance(),
|
||||
tfld().local(),
|
||||
tfld().db(),
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
tfld
|
||||
);
|
||||
|
||||
// Registration
|
||||
{
|
||||
if (IOobjectOption::REGISTER == regOpt)
|
||||
{
|
||||
ptr->checkIn();
|
||||
}
|
||||
else if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
return GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
name,
|
||||
IOobjectOption::LEGACY_REGISTER,
|
||||
tfld
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld,
|
||||
const word& patchFieldType
|
||||
)
|
||||
{
|
||||
@ -415,24 +576,33 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
tgf().instance(),
|
||||
tgf().local(),
|
||||
tgf().db(),
|
||||
tfld().instance(),
|
||||
tfld().local(),
|
||||
tfld().db(),
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
tgf,
|
||||
tfld,
|
||||
patchFieldType
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
// Registration
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if (IOobjectOption::REGISTER == regOpt)
|
||||
{
|
||||
ptr->checkIn();
|
||||
}
|
||||
else if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
@ -443,33 +613,17 @@ Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld,
|
||||
const word& patchFieldType
|
||||
)
|
||||
{
|
||||
auto ptr = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
||||
return GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
tgf().instance(),
|
||||
tgf().local(),
|
||||
tgf().db(),
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
tgf
|
||||
name,
|
||||
IOobjectOption::LEGACY_REGISTER,
|
||||
tfld,
|
||||
patchFieldType
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
@ -478,7 +632,8 @@ Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tgf,
|
||||
IOobjectOption::registerOption regOpt,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& actualPatchTypes
|
||||
)
|
||||
@ -488,30 +643,60 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
tgf().instance(),
|
||||
tgf().local(),
|
||||
tgf().db(),
|
||||
tfld().instance(),
|
||||
tfld().local(),
|
||||
tfld().db(),
|
||||
IOobjectOption::NO_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
),
|
||||
tgf,
|
||||
tfld,
|
||||
patchFieldTypes,
|
||||
actualPatchTypes
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
// Registration
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if (IOobjectOption::REGISTER == regOpt)
|
||||
{
|
||||
ptr->checkIn();
|
||||
}
|
||||
else if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
(IOobjectOption::LEGACY_REGISTER == regOpt)
|
||||
&& ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
const word& name,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld,
|
||||
const wordList& patchFieldTypes,
|
||||
const wordList& actualPatchTypes
|
||||
)
|
||||
{
|
||||
return GeometricField<Type, PatchField, GeoMesh>::New
|
||||
(
|
||||
name,
|
||||
IOobjectOption::LEGACY_REGISTER,
|
||||
tfld,
|
||||
patchFieldTypes,
|
||||
actualPatchTypes
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
template<class AnyType>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
@ -539,13 +724,17 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
patchFieldType
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
// Registration
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
@ -579,13 +768,17 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::New
|
||||
patchFieldType
|
||||
);
|
||||
|
||||
if
|
||||
(
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
// Registration
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
if
|
||||
(
|
||||
// LEGACY_REGISTER: detect if caching is desired
|
||||
ptr->db().is_cacheTemporaryObject(ptr.get())
|
||||
)
|
||||
{
|
||||
ptr.protect(true);
|
||||
ptr->checkIn();
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -172,6 +172,21 @@ public:
|
||||
{
|
||||
return obr.lookupObject<IOField<Type>>(fieldName);
|
||||
}
|
||||
|
||||
//- Lookup an IOField within object registry
|
||||
// Fatal if not found or wrong type
|
||||
//
|
||||
// Note: const char signature to avoid spurious
|
||||
// -Wdangling-reference with gcc-13
|
||||
template<class Type>
|
||||
static const IOField<Type>& lookupIOField
|
||||
(
|
||||
const char* fieldName,
|
||||
const objectRegistry& obr
|
||||
)
|
||||
{
|
||||
return obr.lookupObject<IOField<Type>>(word(fieldName));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -83,18 +83,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new basicSymmetryPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
basicSymmetryPointPatchField
|
||||
(
|
||||
@ -102,33 +90,35 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new basicSymmetryPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
// Member Functions
|
||||
|
||||
// Evaluation functions
|
||||
//- Update the patch field
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType = Pstream::commsTypes::blocking
|
||||
);
|
||||
|
||||
//- Update the patch field
|
||||
virtual void evaluate
|
||||
(
|
||||
const Pstream::commsTypes commsType =
|
||||
Pstream::commsTypes::blocking
|
||||
);
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Inherit assignment operators
|
||||
using pointPatchField<Type>::operator=;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -78,14 +78,13 @@ Foam::calculatedPointPatchField<Type>::calculatedPointPatchField
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Type2>
|
||||
Foam::autoPtr<Foam::pointPatchField<Type>>
|
||||
Foam::pointPatchField<Type>::NewCalculatedType
|
||||
(
|
||||
const pointPatchField<Type2>& pf
|
||||
const pointPatch& p
|
||||
)
|
||||
{
|
||||
auto* patchTypeCtor = patchConstructorTable(pf.patch().type());
|
||||
auto* patchTypeCtor = patchConstructorTable(p.type());
|
||||
|
||||
if (patchTypeCtor)
|
||||
{
|
||||
@ -93,8 +92,8 @@ Foam::pointPatchField<Type>::NewCalculatedType
|
||||
(
|
||||
patchTypeCtor
|
||||
(
|
||||
pf.patch(),
|
||||
Field<Type>::null()
|
||||
p,
|
||||
DimensionedField<Type, pointMesh>::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -104,12 +103,24 @@ Foam::pointPatchField<Type>::NewCalculatedType
|
||||
(
|
||||
new calculatedPointPatchField<Type>
|
||||
(
|
||||
pf.patch(),
|
||||
Field<Type>::null()
|
||||
p,
|
||||
DimensionedField<Type, pointMesh>::null()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class AnyType>
|
||||
Foam::autoPtr<Foam::pointPatchField<Type>>
|
||||
Foam::pointPatchField<Type>::NewCalculatedType
|
||||
(
|
||||
const pointPatchField<AnyType>& pf
|
||||
)
|
||||
{
|
||||
return NewCalculatedType(pf.patch());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -85,18 +85,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new calculatedPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
calculatedPointPatchField
|
||||
(
|
||||
@ -104,18 +92,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>>
|
||||
clone(const DimensionedField<Type, pointMesh>& iF) const
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new calculatedPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -87,9 +87,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const = 0;
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
coupledPointPatchField
|
||||
(
|
||||
@ -97,6 +94,9 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const = 0;
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
|
||||
@ -111,18 +111,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new fixedValuePointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
fixedValuePointPatchField
|
||||
(
|
||||
@ -130,20 +118,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new fixedValuePointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -237,7 +237,8 @@ void Foam::valuePointPatchField<Type>::operator=
|
||||
const pointPatchField<Type>& ptf
|
||||
)
|
||||
{
|
||||
Field<Type>::operator=(this->patchInternalField());
|
||||
// pointPatchField has no values to copy, assign internal values
|
||||
this->extrapolateInternal();
|
||||
}
|
||||
|
||||
|
||||
@ -277,7 +278,8 @@ void Foam::valuePointPatchField<Type>::operator==
|
||||
const pointPatchField<Type>& ptf
|
||||
)
|
||||
{
|
||||
Field<Type>::operator=(this->patchInternalField());
|
||||
// pointPatchField has no values to copy, assign internal values
|
||||
this->extrapolateInternal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -142,18 +142,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new valuePointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
valuePointPatchField
|
||||
(
|
||||
@ -161,20 +149,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new valuePointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -85,18 +85,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new zeroGradientPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
zeroGradientPointPatchField
|
||||
(
|
||||
@ -104,20 +92,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new zeroGradientPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -92,18 +92,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new cyclicPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
cyclicPointPatchField
|
||||
(
|
||||
@ -111,19 +99,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new cyclicPointPatchField<Type>
|
||||
(
|
||||
*this, iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -87,18 +87,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new cyclicSlipPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
cyclicSlipPointPatchField
|
||||
(
|
||||
@ -106,19 +94,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new cyclicSlipPointPatchField<Type>
|
||||
(
|
||||
*this, iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -86,18 +86,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new emptyPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
emptyPointPatchField
|
||||
(
|
||||
@ -105,22 +93,22 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new emptyPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Constraint handling
|
||||
|
||||
@ -87,18 +87,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new nonuniformTransformCyclicPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
nonuniformTransformCyclicPointPatchField
|
||||
(
|
||||
@ -106,19 +94,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new nonuniformTransformCyclicPointPatchField<Type>
|
||||
(
|
||||
*this, iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -91,18 +91,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new processorPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
processorPointPatchField
|
||||
(
|
||||
@ -110,20 +98,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new processorPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -93,15 +93,16 @@ void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated
|
||||
Field<Type>& pField
|
||||
) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
// Get internal field into correct order for opposite side. Note use
|
||||
// of member data buffer since using non-blocking. Could be optimised
|
||||
// out if not using non-blocking...
|
||||
sendBuf_ = this->patchInternalField
|
||||
this->patchInternalField
|
||||
(
|
||||
pField,
|
||||
procPatch_.reverseMeshPoints()
|
||||
procPatch_.reverseMeshPoints(),
|
||||
sendBuf_
|
||||
);
|
||||
|
||||
if (commsType == Pstream::commsTypes::nonBlocking)
|
||||
@ -138,7 +139,7 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
|
||||
Field<Type>& pField
|
||||
) const
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
// If nonblocking, data is already in receive buffer
|
||||
|
||||
|
||||
@ -99,18 +99,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new processorCyclicPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
processorCyclicPointPatchField
|
||||
(
|
||||
@ -118,20 +106,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new processorCyclicPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -87,18 +87,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new symmetryPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
symmetryPointPatchField
|
||||
(
|
||||
@ -106,20 +94,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new symmetryPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -92,18 +92,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new symmetryPlanePointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
symmetryPlanePointPatchField
|
||||
(
|
||||
@ -111,20 +99,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new symmetryPlanePointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -87,18 +87,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new wedgePointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
wedgePointPatchField
|
||||
(
|
||||
@ -106,19 +94,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new wedgePointPatchField<Type>
|
||||
(
|
||||
*this, iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -209,15 +209,6 @@ public:
|
||||
const codedFixedValuePointPatchField<Type>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new codedFixedValuePointPatchField<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
codedFixedValuePointPatchField
|
||||
(
|
||||
@ -225,20 +216,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new codedFixedValuePointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -104,18 +104,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new fixedNormalSlipPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
fixedNormalSlipPointPatchField
|
||||
(
|
||||
@ -123,22 +111,22 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new fixedNormalSlipPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Update the patch field
|
||||
|
||||
@ -86,18 +86,6 @@ public:
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new slipPointPatchField<Type>
|
||||
(
|
||||
*this
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
slipPointPatchField
|
||||
(
|
||||
@ -105,20 +93,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new slipPointPatchField<Type>
|
||||
(
|
||||
*this,
|
||||
iF
|
||||
)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -101,15 +101,6 @@ public:
|
||||
const timeVaryingUniformFixedValuePointPatchField<Type>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new timeVaryingUniformFixedValuePointPatchField<Type>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
timeVaryingUniformFixedValuePointPatchField
|
||||
(
|
||||
@ -117,16 +108,19 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const
|
||||
{
|
||||
return pointPatchField<Type>::Clone(*this);
|
||||
}
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new timeVaryingUniformFixedValuePointPatchField<Type>(*this, iF)
|
||||
);
|
||||
return pointPatchField<Type>::Clone(*this, iF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -108,6 +108,64 @@ void Foam::pointPatchField<Type>::write(Ostream& os) const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Type1>
|
||||
void Foam::pointPatchField<Type>::patchInternalField
|
||||
(
|
||||
const UList<Type1>& internalData,
|
||||
const labelUList& addressing,
|
||||
Field<Type1>& pfld
|
||||
) const
|
||||
{
|
||||
// Check size
|
||||
if (internalData.size() != primitiveField().size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Internal field size: " << internalData.size()
|
||||
<< " != mesh size: " << primitiveField().size() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const label len = this->size();
|
||||
|
||||
pfld.resize_nocopy(len);
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
pfld[i] = internalData[addressing[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Type1>
|
||||
Foam::tmp<Foam::Field<Type1>>
|
||||
Foam::pointPatchField<Type>::patchInternalField
|
||||
(
|
||||
const UList<Type1>& internalData,
|
||||
const labelUList& addressing
|
||||
) const
|
||||
{
|
||||
auto tpfld = tmp<Field<Type1>>::New();
|
||||
this->patchInternalField(internalData, addressing, tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Type1>
|
||||
Foam::tmp<Foam::Field<Type1>>
|
||||
Foam::pointPatchField<Type>::patchInternalField
|
||||
(
|
||||
const UList<Type1>& internalData
|
||||
) const
|
||||
{
|
||||
auto tpfld = tmp<Field<Type1>>::New();
|
||||
this->patchInternalField(internalData, patch().meshPoints(), tpfld.ref());
|
||||
return tpfld;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::pointPatchField<Type>::patchInternalField() const
|
||||
@ -116,41 +174,6 @@ Foam::pointPatchField<Type>::patchInternalField() const
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Type1>
|
||||
Foam::tmp<Foam::Field<Type1>>
|
||||
Foam::pointPatchField<Type>::patchInternalField
|
||||
(
|
||||
const Field<Type1>& iF,
|
||||
const labelUList& meshPoints
|
||||
) const
|
||||
{
|
||||
// Check size
|
||||
if (iF.size() != primitiveField().size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "given internal field does not correspond to the mesh. "
|
||||
<< "Field size: " << iF.size()
|
||||
<< " mesh size: " << primitiveField().size()
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
return tmp<Field<Type1>>::New(iF, meshPoints);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Type1>
|
||||
Foam::tmp<Foam::Field<Type1>>
|
||||
Foam::pointPatchField<Type>::patchInternalField
|
||||
(
|
||||
const Field<Type1>& iF
|
||||
) const
|
||||
{
|
||||
return patchInternalField(iF, patch().meshPoints());
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class Type1>
|
||||
void Foam::pointPatchField<Type>::addToInternalField
|
||||
@ -163,18 +186,16 @@ void Foam::pointPatchField<Type>::addToInternalField
|
||||
if (iF.size() != primitiveField().size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "given internal field does not correspond to the mesh. "
|
||||
<< "Field size: " << iF.size()
|
||||
<< " mesh size: " << primitiveField().size()
|
||||
<< "Internal field size: " << iF.size()
|
||||
<< " != mesh size: " << primitiveField().size() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (pF.size() != size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "given patch field does not correspond to the mesh. "
|
||||
<< "Field size: " << pF.size()
|
||||
<< " mesh size: " << size()
|
||||
<< "Patch field size: " << pF.size()
|
||||
<< " != patch size: " << size() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -201,18 +222,16 @@ void Foam::pointPatchField<Type>::addToInternalField
|
||||
if (iF.size() != primitiveField().size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "given internal field does not correspond to the mesh. "
|
||||
<< "Field size: " << iF.size()
|
||||
<< " mesh size: " << primitiveField().size()
|
||||
<< "Internal field size: " << iF.size()
|
||||
<< " != mesh size: " << primitiveField().size() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (pF.size() != size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "given patch field does not correspond to the mesh. "
|
||||
<< "Field size: " << pF.size()
|
||||
<< " mesh size: " << size()
|
||||
<< "Patch field size: " << pF.size()
|
||||
<< " != patch size: " << size() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -240,18 +259,16 @@ void Foam::pointPatchField<Type>::setInInternalField
|
||||
if (iF.size() != primitiveField().size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "given internal field does not correspond to the mesh. "
|
||||
<< "Field size: " << iF.size()
|
||||
<< " mesh size: " << primitiveField().size()
|
||||
<< "Internal field size: " << iF.size()
|
||||
<< " != mesh size: " << primitiveField().size() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
if (pF.size() != meshPoints.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "given patch field does not correspond to the meshPoints. "
|
||||
<< "Field size: " << pF.size()
|
||||
<< " meshPoints size: " << size()
|
||||
<< "Patch field size: " << pF.size()
|
||||
<< " != meshPoints size: " << meshPoints.size() << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -240,6 +240,25 @@ class pointPatchField
|
||||
:
|
||||
public pointPatchFieldBase
|
||||
{
|
||||
public:
|
||||
|
||||
// Public Data Types
|
||||
|
||||
//- The patch type for the patch field
|
||||
typedef pointPatch Patch;
|
||||
|
||||
//- The value_type for the patch field
|
||||
typedef Type value_type;
|
||||
|
||||
//- The internal field type associated with the patch field
|
||||
typedef DimensionedField<Type, pointMesh> Internal;
|
||||
|
||||
//- Type for a \em calculated patch
|
||||
typedef calculatedPointPatchField<Type> Calculated;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Reference to internal field
|
||||
@ -248,19 +267,6 @@ class pointPatchField
|
||||
|
||||
public:
|
||||
|
||||
//- The Field value_type
|
||||
typedef Type value_type;
|
||||
|
||||
//- The internal field type associated with the patch field
|
||||
typedef DimensionedField<Type, pointMesh> Internal;
|
||||
|
||||
//- The patch type for the patch field
|
||||
typedef pointPatch Patch;
|
||||
|
||||
//- Type for a \em calculated patch
|
||||
typedef calculatedPointPatchField<Type> Calculated;
|
||||
|
||||
|
||||
// Declare run-time constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
@ -339,17 +345,31 @@ public:
|
||||
const DimensionedField<Type, pointMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
//- Clone patch field with its own internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone() const = 0;
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
//- Clone patch field with an internal field reference
|
||||
virtual autoPtr<pointPatchField<Type>> clone
|
||||
(
|
||||
const DimensionedField<Type, pointMesh>& iF
|
||||
) const = 0;
|
||||
|
||||
|
||||
// Selectors
|
||||
// Factory Methods
|
||||
|
||||
//- Clone a patch field, optionally with internal field reference etc.
|
||||
template<class DerivedPatchField, class... Args>
|
||||
static autoPtr<pointPatchField<Type>> Clone
|
||||
(
|
||||
const DerivedPatchField& pf,
|
||||
Args&&... args
|
||||
)
|
||||
{
|
||||
return autoPtr<pointPatchField<Type>>
|
||||
(
|
||||
new DerivedPatchField(pf, std::forward<Args>(args)...)
|
||||
);
|
||||
}
|
||||
|
||||
//- Return a pointer to a new patchField created on freestore given
|
||||
// patch and internal field
|
||||
@ -394,11 +414,19 @@ public:
|
||||
|
||||
//- Return a pointer to a new calculatedPointPatchField created on
|
||||
// freestore without setting patchField values
|
||||
template<class Type2>
|
||||
static autoPtr<pointPatchField<Type>>
|
||||
NewCalculatedType
|
||||
(
|
||||
const pointPatchField<Type2>&
|
||||
const pointPatch& p
|
||||
);
|
||||
|
||||
//- Return a pointer to a new calculatedPointPatchField created on
|
||||
// freestore without setting patchField values
|
||||
template<class AnyType>
|
||||
static autoPtr<pointPatchField<Type>>
|
||||
NewCalculatedType
|
||||
(
|
||||
const pointPatchField<AnyType>& pf
|
||||
);
|
||||
|
||||
|
||||
@ -431,26 +459,43 @@ public:
|
||||
|
||||
// Evaluation Functions
|
||||
|
||||
//- Return field created from appropriate internal field values
|
||||
tmp<Field<Type>> patchInternalField() const;
|
||||
|
||||
//- Return field created from appropriate internal field values
|
||||
//- given internal field reference
|
||||
//- Extract field using specified addressing
|
||||
// \param internalData The internal field to extract from
|
||||
// \param addressing Addressing (mesh-points) into internal field
|
||||
// \param [out] pfld The extracted patch field.
|
||||
// It is always resized according to the patch size(),
|
||||
// which can be smaller than the addressing size
|
||||
template<class Type1>
|
||||
tmp<Field<Type1>> patchInternalField
|
||||
void patchInternalField
|
||||
(
|
||||
const Field<Type1>& iF
|
||||
const UList<Type1>& internalData,
|
||||
const labelUList& addressing,
|
||||
Field<Type1>& pfld
|
||||
) const;
|
||||
|
||||
//- Return field created from selected internal field values
|
||||
//- given internal field reference
|
||||
// \param internalData The internal field to extract from
|
||||
// \param addressing Addressing (mesh-points) into internal field
|
||||
template<class Type1>
|
||||
tmp<Field<Type1>> patchInternalField
|
||||
(
|
||||
const Field<Type1>& iF,
|
||||
const labelUList& meshPoints
|
||||
const UList<Type1>& internalData,
|
||||
const labelUList& addressing
|
||||
) const;
|
||||
|
||||
//- Return field created from appropriate internal field values
|
||||
//- given internal field reference
|
||||
template<class Type1>
|
||||
tmp<Field<Type1>> patchInternalField
|
||||
(
|
||||
const UList<Type1>& internalData
|
||||
) const;
|
||||
|
||||
//- Return field created from appropriate internal field values
|
||||
tmp<Field<Type>> patchInternalField() const;
|
||||
|
||||
|
||||
//- Given the internal field and a patch field,
|
||||
//- add the patch field to the internal field
|
||||
template<class Type1>
|
||||
|
||||
@ -47,9 +47,9 @@ bool Foam::OFstreamCollator::writeFile
|
||||
const label comm,
|
||||
const word& objectType,
|
||||
const fileName& fName,
|
||||
const string& masterData,
|
||||
const UList<char>& localData,
|
||||
const labelUList& recvSizes,
|
||||
const UPtrList<SubList<char>>& slaveData, // optional slave data
|
||||
const UList<stdFoam::span<char>>& procData, // optional proc data
|
||||
IOstreamOption streamOpt,
|
||||
IOstreamOption::atomicType atomic,
|
||||
IOstreamOption::appendType append,
|
||||
@ -58,18 +58,14 @@ bool Foam::OFstreamCollator::writeFile
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "OFstreamCollator : Writing master " << label(masterData.size())
|
||||
Pout<< "OFstreamCollator : Writing local " << localData.size()
|
||||
<< " bytes to " << fName << " using comm " << comm
|
||||
<< " and " << slaveData.size() << " sub-ranks" << endl;
|
||||
<< " and " << procData.size() << " sub-ranks" << endl;
|
||||
|
||||
forAll(slaveData, proci)
|
||||
forAll(procData, proci)
|
||||
{
|
||||
if (slaveData.set(proci))
|
||||
{
|
||||
Pout<< " " << proci
|
||||
<< " size:" << slaveData[proci].size()
|
||||
<< endl;
|
||||
}
|
||||
Pout<< " " << proci << " size:"
|
||||
<< label(procData[proci].size()) << nl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,32 +100,27 @@ bool Foam::OFstreamCollator::writeFile
|
||||
// for some mpi so default is non-blocking.
|
||||
const UPstream::commsTypes myCommsType
|
||||
(
|
||||
mag
|
||||
(
|
||||
fileOperations::masterUncollatedFileOperation::
|
||||
maxMasterFileBufferSize == 0
|
||||
)
|
||||
maxMasterFileBufferSize
|
||||
) < 1
|
||||
? UPstream::commsTypes::scheduled
|
||||
: UPstream::commsTypes::nonBlocking
|
||||
);
|
||||
|
||||
|
||||
UList<char> slice
|
||||
(
|
||||
const_cast<char*>(masterData.data()),
|
||||
label(masterData.size())
|
||||
);
|
||||
|
||||
List<std::streamoff> blockOffset;
|
||||
List<std::streamoff> blockOffsets; // Optional
|
||||
decomposedBlockData::writeBlocks
|
||||
(
|
||||
comm,
|
||||
osPtr,
|
||||
blockOffset,
|
||||
slice,
|
||||
blockOffsets, // or List<std::streamoff>::null()
|
||||
localData,
|
||||
recvSizes,
|
||||
slaveData,
|
||||
procData,
|
||||
myCommsType,
|
||||
false // do not reduce return state
|
||||
false // do not sync return state
|
||||
);
|
||||
|
||||
if (osPtr && !osPtr->good())
|
||||
@ -140,17 +131,18 @@ bool Foam::OFstreamCollator::writeFile
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "OFstreamCollator : Finished writing " << masterData.size()
|
||||
<< " bytes";
|
||||
Pout<< "OFstreamCollator : Finished writing "
|
||||
<< localData.size() << " bytes";
|
||||
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
off_t sum = 0;
|
||||
off_t total = 0;
|
||||
for (const label recv : recvSizes)
|
||||
{
|
||||
sum += recv;
|
||||
total += recv;
|
||||
}
|
||||
// Use std::to_string to display long int
|
||||
Pout<< " (overall " << std::to_string(sum) << ')';
|
||||
Pout<< " (overall " << std::to_string(total) << ')';
|
||||
}
|
||||
Pout<< " to " << fName
|
||||
<< " using comm " << comm << endl;
|
||||
@ -167,13 +159,16 @@ void* Foam::OFstreamCollator::writeAll(void *threadarg)
|
||||
// Consume stack
|
||||
while (true)
|
||||
{
|
||||
writeData* ptr = nullptr;
|
||||
std::unique_ptr<writeData> ptr;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(handler.mutex_);
|
||||
|
||||
if (handler.objects_.size())
|
||||
{
|
||||
ptr = handler.objects_.pop();
|
||||
// FIFO
|
||||
ptr.reset(handler.objects_.front());
|
||||
handler.objects_.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,51 +176,39 @@ void* Foam::OFstreamCollator::writeAll(void *threadarg)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
writeData& obj = *ptr;
|
||||
|
||||
// Obtain spans from storage
|
||||
List<stdFoam::span<char>> procData(obj.procData_.size());
|
||||
forAll(procData, proci)
|
||||
{
|
||||
// Convert storage to pointers
|
||||
PtrList<SubList<char>> slaveData;
|
||||
if (ptr->slaveData_.size())
|
||||
{
|
||||
slaveData.resize(ptr->slaveData_.size());
|
||||
forAll(slaveData, proci)
|
||||
{
|
||||
if (ptr->slaveData_.set(proci))
|
||||
{
|
||||
slaveData.set
|
||||
(
|
||||
proci,
|
||||
new SubList<char>
|
||||
(
|
||||
ptr->slaveData_[proci],
|
||||
ptr->sizes_[proci]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ok = writeFile
|
||||
procData[proci] = stdFoam::span<char>
|
||||
(
|
||||
ptr->comm_,
|
||||
ptr->objectType_,
|
||||
ptr->pathName_,
|
||||
ptr->data_,
|
||||
ptr->sizes_,
|
||||
slaveData,
|
||||
ptr->streamOpt_,
|
||||
ptr->atomic_,
|
||||
ptr->append_,
|
||||
ptr->headerEntries_
|
||||
const_cast<char*>(obj.procData_[proci].cdata()),
|
||||
obj.procData_[proci].size()
|
||||
);
|
||||
if (!ok)
|
||||
{
|
||||
FatalIOErrorInFunction(ptr->pathName_)
|
||||
<< "Failed writing " << ptr->pathName_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
delete ptr;
|
||||
bool ok = writeFile
|
||||
(
|
||||
obj.comm_,
|
||||
obj.objectType_,
|
||||
obj.pathName_,
|
||||
obj.localData_,
|
||||
obj.sizes_,
|
||||
procData,
|
||||
obj.streamOpt_,
|
||||
obj.atomic_,
|
||||
obj.append_,
|
||||
obj.headerEntries_
|
||||
);
|
||||
|
||||
if (!ok)
|
||||
{
|
||||
FatalIOErrorInFunction(obj.pathName_)
|
||||
<< "Failed writing " << obj.pathName_
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
//sleep(1);
|
||||
}
|
||||
@ -248,14 +231,14 @@ void Foam::OFstreamCollator::waitForBufferSpace(const off_t wantedSize) const
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
// Count files to be written
|
||||
// The pending output size(s)
|
||||
off_t totalSize = 0;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
forAllConstIters(objects_, iter)
|
||||
for (const writeData* ptr : objects_)
|
||||
{
|
||||
totalSize += iter()->size();
|
||||
if (ptr) totalSize += ptr->size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -287,17 +270,7 @@ void Foam::OFstreamCollator::waitForBufferSpace(const off_t wantedSize) const
|
||||
|
||||
Foam::OFstreamCollator::OFstreamCollator(const off_t maxBufferSize)
|
||||
:
|
||||
maxBufferSize_(maxBufferSize),
|
||||
threadRunning_(false),
|
||||
localComm_(UPstream::worldComm),
|
||||
threadComm_
|
||||
(
|
||||
UPstream::allocateCommunicator
|
||||
(
|
||||
localComm_,
|
||||
labelRange(UPstream::nProcs(localComm_))
|
||||
)
|
||||
)
|
||||
OFstreamCollator(maxBufferSize, UPstream::worldComm)
|
||||
{}
|
||||
|
||||
|
||||
@ -312,6 +285,7 @@ Foam::OFstreamCollator::OFstreamCollator
|
||||
localComm_(comm),
|
||||
threadComm_
|
||||
(
|
||||
// dupComm
|
||||
UPstream::allocateCommunicator
|
||||
(
|
||||
localComm_,
|
||||
@ -345,7 +319,7 @@ bool Foam::OFstreamCollator::write
|
||||
(
|
||||
const word& objectType,
|
||||
const fileName& fName,
|
||||
const string& data,
|
||||
DynamicList<char>&& localData,
|
||||
IOstreamOption streamOpt,
|
||||
IOstreamOption::atomicType atomic,
|
||||
IOstreamOption::appendType append,
|
||||
@ -355,78 +329,109 @@ bool Foam::OFstreamCollator::write
|
||||
{
|
||||
// Determine (on master) sizes to receive. Note: do NOT use thread
|
||||
// communicator
|
||||
labelList recvSizes;
|
||||
decomposedBlockData::gather(localComm_, label(data.size()), recvSizes);
|
||||
const labelList recvSizes
|
||||
(
|
||||
UPstream::listGatherValues<label>(localData.size(), localComm_)
|
||||
);
|
||||
|
||||
off_t totalSize = 0;
|
||||
label maxLocalSize = 0;
|
||||
|
||||
if (UPstream::master(localComm_))
|
||||
{
|
||||
if (UPstream::master(localComm_))
|
||||
for (const label recvSize : recvSizes)
|
||||
{
|
||||
for (const label recvSize : recvSizes)
|
||||
{
|
||||
totalSize += recvSize;
|
||||
maxLocalSize = max(maxLocalSize, recvSize);
|
||||
}
|
||||
totalSize += recvSize;
|
||||
maxLocalSize = max(maxLocalSize, recvSize);
|
||||
}
|
||||
Pstream::broadcasts(localComm_, totalSize, maxLocalSize);
|
||||
}
|
||||
Pstream::broadcasts(localComm_, totalSize, maxLocalSize);
|
||||
|
||||
|
||||
// Determine how things will be gathered and written...
|
||||
|
||||
enum class dispatchModes { GATHER_WRITE, PREFETCH_THREADED, FULL_THREADED };
|
||||
|
||||
dispatchModes dispatch(dispatchModes::GATHER_WRITE);
|
||||
|
||||
if (!useThread || maxBufferSize_ == 0 || maxLocalSize > maxBufferSize_)
|
||||
{
|
||||
dispatch = dispatchModes::GATHER_WRITE;
|
||||
}
|
||||
else if (totalSize <= maxBufferSize_)
|
||||
{
|
||||
// Total size can be stored locally
|
||||
// - gather all data now and only do the writing in the thread
|
||||
|
||||
dispatch = dispatchModes::PREFETCH_THREADED;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Gather data and write in the thread
|
||||
|
||||
dispatch = dispatchModes::FULL_THREADED;
|
||||
|
||||
if (!UPstream::haveThreads())
|
||||
{
|
||||
WarningInFunction
|
||||
<< "MPI not initialized with thread support." << nl
|
||||
<< " maxThreadFileBufferSize = 0 to disable threading" << nl
|
||||
<< " or maxThreadFileBufferSize > " << totalSize
|
||||
<< " to collate before threaded writing." << nl << nl;
|
||||
|
||||
dispatch = dispatchModes::GATHER_WRITE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -----------
|
||||
// Dispatching
|
||||
// -----------
|
||||
|
||||
if (dispatch == dispatchModes::GATHER_WRITE)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "OFstreamCollator : non-thread gather and write of " << fName
|
||||
<< " using local comm " << localComm_ << endl;
|
||||
Pout<< "OFstreamCollator : non-thread gather/write "
|
||||
<< "(local comm: " << localComm_ << ") of "
|
||||
<< fName << endl;
|
||||
}
|
||||
|
||||
// Direct collating and writing (so master blocks until all written!)
|
||||
const PtrList<SubList<char>> dummySlaveData;
|
||||
return writeFile
|
||||
(
|
||||
localComm_,
|
||||
objectType,
|
||||
fName,
|
||||
data,
|
||||
localData,
|
||||
recvSizes,
|
||||
dummySlaveData,
|
||||
UList<stdFoam::span<char>>(), // dummy proc data
|
||||
streamOpt,
|
||||
atomic,
|
||||
append,
|
||||
headerEntries
|
||||
);
|
||||
}
|
||||
else if (totalSize <= maxBufferSize_)
|
||||
else if (dispatch == dispatchModes::PREFETCH_THREADED)
|
||||
{
|
||||
// Total size can be stored locally so receive all data now and only
|
||||
// do the writing in the thread
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "OFstreamCollator : non-thread gather; thread write of "
|
||||
<< fName << endl;
|
||||
}
|
||||
|
||||
if (Pstream::master(localComm_))
|
||||
if (UPstream::master(localComm_))
|
||||
{
|
||||
waitForBufferSpace(totalSize);
|
||||
}
|
||||
|
||||
|
||||
// Receive in chunks of labelMax (2^31-1) since this is the maximum
|
||||
// size that a List can be
|
||||
|
||||
autoPtr<writeData> fileAndDataPtr
|
||||
std::unique_ptr<writeData> fileAndDataPtr
|
||||
(
|
||||
new writeData
|
||||
(
|
||||
threadComm_, // Note: comm not actually used anymore
|
||||
objectType,
|
||||
fName,
|
||||
(
|
||||
Pstream::master(localComm_)
|
||||
? data // Only used on master
|
||||
: string::null
|
||||
),
|
||||
recvSizes,
|
||||
streamOpt,
|
||||
atomic,
|
||||
@ -434,63 +439,81 @@ bool Foam::OFstreamCollator::write
|
||||
headerEntries
|
||||
)
|
||||
);
|
||||
writeData& fileAndData = fileAndDataPtr();
|
||||
auto& fileAndData = *fileAndDataPtr;
|
||||
|
||||
PtrList<List<char>>& slaveData = fileAndData.slaveData_;
|
||||
List<List<char>>& procData = fileAndData.procData_;
|
||||
if (UPstream::master(localComm_))
|
||||
{
|
||||
// Move in local data (master only!)
|
||||
fileAndData.transfer(localData);
|
||||
|
||||
UList<char> slice(const_cast<char*>(data.data()), label(data.size()));
|
||||
// Storage for receive data
|
||||
procData.resize(UPstream::nProcs(localComm_));
|
||||
|
||||
for (const int proci : UPstream::subProcs(localComm_))
|
||||
{
|
||||
procData[proci].resize(recvSizes[proci]);
|
||||
}
|
||||
}
|
||||
else if (UPstream::is_subrank(localComm_))
|
||||
{
|
||||
// Requires a size for decomposedBlockData::writeBlocks() logic
|
||||
procData.resize(UPstream::nProcs(localComm_));
|
||||
}
|
||||
|
||||
slaveData.setSize(recvSizes.size());
|
||||
|
||||
// Gather all data onto master. Is done in local communicator since
|
||||
// not in write thread. Note that we do not store in contiguous
|
||||
// buffer since that would limit to 2G chars.
|
||||
// not in write thread.
|
||||
const label startOfRequests = UPstream::nRequests();
|
||||
if (Pstream::master(localComm_))
|
||||
if (UPstream::master(localComm_))
|
||||
{
|
||||
for (label proci = 1; proci < slaveData.size(); proci++)
|
||||
for (const int proci : UPstream::subProcs(localComm_))
|
||||
{
|
||||
slaveData.set(proci, new List<char>(recvSizes[proci]));
|
||||
List<char>& procSlice = procData[proci];
|
||||
if (procSlice.empty()) continue;
|
||||
|
||||
UIPstream::read
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
proci,
|
||||
slaveData[proci].data(),
|
||||
slaveData[proci].size_bytes(),
|
||||
Pstream::msgType(),
|
||||
procSlice.data_bytes(),
|
||||
procSlice.size_bytes(),
|
||||
UPstream::msgType(),
|
||||
localComm_
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (UPstream::is_subrank(localComm_) && !localData.empty())
|
||||
{
|
||||
if
|
||||
(
|
||||
!UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::nonBlocking,
|
||||
0,
|
||||
slice.cdata(),
|
||||
slice.size_bytes(),
|
||||
Pstream::msgType(),
|
||||
UPstream::masterNo(),
|
||||
localData.cdata_bytes(),
|
||||
localData.size_bytes(),
|
||||
UPstream::msgType(),
|
||||
localComm_
|
||||
)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot send outgoing message. "
|
||||
<< "to:" << 0 << " nBytes:"
|
||||
<< label(slice.size_bytes())
|
||||
<< "Cannot send outgoing message (size: "
|
||||
<< localData.size() << ") to master" << nl
|
||||
<< Foam::abort(FatalError);
|
||||
}
|
||||
}
|
||||
UPstream::waitRequests(startOfRequests);
|
||||
|
||||
// The localData has been moved (master) or communicated
|
||||
localData.clearStorage();
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
|
||||
// Append to thread buffer
|
||||
objects_.push(fileAndDataPtr.ptr());
|
||||
// Append to thread buffer (as FIFO), take ownership
|
||||
objects_.push_back(fileAndDataPtr.release());
|
||||
|
||||
// Start thread if not running
|
||||
if (!threadRunning_)
|
||||
@ -517,49 +540,46 @@ bool Foam::OFstreamCollator::write
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
else if (dispatch == dispatchModes::FULL_THREADED)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "OFstreamCollator : thread gather and write of " << fName
|
||||
<< " using communicator " << threadComm_ << endl;
|
||||
Pout<< "OFstreamCollator : thread gather and write "
|
||||
<< "(thread comm: " << threadComm_
|
||||
<< ") of " << fName << endl;
|
||||
}
|
||||
|
||||
if (!UPstream::haveThreads())
|
||||
if (UPstream::master(localComm_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "mpi does not seem to have thread support."
|
||||
<< " Make sure to set buffer size 'maxThreadFileBufferSize'"
|
||||
<< " to at least " << totalSize
|
||||
<< " to be able to do the collating before threading."
|
||||
<< exit(FatalError);
|
||||
waitForBufferSpace(localData.size());
|
||||
}
|
||||
|
||||
if (Pstream::master(localComm_))
|
||||
{
|
||||
waitForBufferSpace(data.size());
|
||||
}
|
||||
std::unique_ptr<writeData> fileAndDataPtr
|
||||
(
|
||||
new writeData
|
||||
(
|
||||
threadComm_,
|
||||
objectType,
|
||||
fName,
|
||||
recvSizes,
|
||||
streamOpt,
|
||||
atomic,
|
||||
append,
|
||||
headerEntries
|
||||
)
|
||||
);
|
||||
|
||||
// Move in local data (all procs)
|
||||
fileAndDataPtr->transfer(localData);
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(mutex_);
|
||||
|
||||
// Push all file info on buffer. Note that no slave data provided
|
||||
// Append to thread buffer (as FIFO), take ownership
|
||||
objects_.push_back(fileAndDataPtr.release());
|
||||
|
||||
// Note: no proc data provided
|
||||
// so it will trigger communication inside the thread
|
||||
objects_.push
|
||||
(
|
||||
new writeData
|
||||
(
|
||||
threadComm_,
|
||||
objectType,
|
||||
fName,
|
||||
data,
|
||||
recvSizes,
|
||||
streamOpt,
|
||||
atomic,
|
||||
append,
|
||||
headerEntries
|
||||
)
|
||||
);
|
||||
|
||||
if (!threadRunning_)
|
||||
{
|
||||
@ -584,6 +604,12 @@ bool Foam::OFstreamCollator::write
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Unknown dispatch mode: " << int(dispatch)
|
||||
<< " - programming error?" << abort(FatalError);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -591,7 +617,7 @@ void Foam::OFstreamCollator::waitAll()
|
||||
{
|
||||
// Wait for all buffer space to be available i.e. wait for all jobs
|
||||
// to finish
|
||||
if (Pstream::master(localComm_))
|
||||
if (UPstream::master(localComm_))
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -51,14 +51,14 @@ SourceFiles
|
||||
#ifndef Foam_OFstreamCollator_H
|
||||
#define Foam_OFstreamCollator_H
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include "IOstream.H"
|
||||
#include "labelList.H"
|
||||
#include "FIFOStack.H"
|
||||
#include "SubList.H"
|
||||
#include "List.H"
|
||||
#include "CircularBuffer.H" // As FIFO
|
||||
#include "dictionary.H"
|
||||
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -72,26 +72,33 @@ class OFstreamCollator
|
||||
{
|
||||
// Private Class
|
||||
|
||||
//- Holds data to be written
|
||||
struct writeData
|
||||
{
|
||||
const label comm_;
|
||||
const word objectType_;
|
||||
const fileName pathName_;
|
||||
const string data_;
|
||||
DynamicList<char> localData_;
|
||||
const labelList sizes_;
|
||||
PtrList<List<char>> slaveData_;
|
||||
List<List<char>> procData_;
|
||||
const IOstreamOption streamOpt_;
|
||||
IOstreamOption::atomicType atomic_;
|
||||
IOstreamOption::appendType append_;
|
||||
const dictionary headerEntries_;
|
||||
|
||||
writeData() = delete; // No default construct
|
||||
writeData(const writeData&) = delete; // No copy construct
|
||||
writeData(writeData&&) = delete; // No move construct
|
||||
void operator=(const writeData&) = delete; // No copy assign
|
||||
void operator=(writeData&&) = delete; // No move assign
|
||||
|
||||
//- Construct without local data
|
||||
writeData
|
||||
(
|
||||
const label comm,
|
||||
const word& objectType,
|
||||
const fileName& pathName,
|
||||
const string& data,
|
||||
const labelList& sizes,
|
||||
const labelUList& sizes,
|
||||
IOstreamOption streamOpt,
|
||||
IOstreamOption::atomicType atomic,
|
||||
IOstreamOption::appendType append,
|
||||
@ -101,27 +108,30 @@ class OFstreamCollator
|
||||
comm_(comm),
|
||||
objectType_(objectType),
|
||||
pathName_(pathName),
|
||||
data_(data),
|
||||
localData_(),
|
||||
sizes_(sizes),
|
||||
slaveData_(),
|
||||
procData_(),
|
||||
streamOpt_(streamOpt),
|
||||
atomic_(atomic),
|
||||
append_(append),
|
||||
headerEntries_(headerEntries)
|
||||
{}
|
||||
|
||||
//- The (approximate) size of master + any optional slave data
|
||||
//- Move reset local data
|
||||
void transfer(DynamicList<char>& localData)
|
||||
{
|
||||
localData_.transfer(localData);
|
||||
}
|
||||
|
||||
//- The (approximate) size of local + any optional proc data
|
||||
off_t size() const
|
||||
{
|
||||
off_t totalSize = data_.size();
|
||||
forAll(slaveData_, i)
|
||||
off_t total = localData_.size();
|
||||
for (const auto& data : procData_)
|
||||
{
|
||||
if (slaveData_.set(i))
|
||||
{
|
||||
totalSize += slaveData_[i].size();
|
||||
}
|
||||
total += data.size();
|
||||
}
|
||||
return totalSize;
|
||||
return total;
|
||||
}
|
||||
};
|
||||
|
||||
@ -135,8 +145,8 @@ class OFstreamCollator
|
||||
|
||||
std::unique_ptr<std::thread> thread_;
|
||||
|
||||
//- Stack of files to write + contents
|
||||
FIFOStack<writeData*> objects_;
|
||||
//- FIFO of files to write and their contents
|
||||
CircularBuffer<writeData*> objects_;
|
||||
|
||||
//- Whether thread is running (and not exited)
|
||||
bool threadRunning_;
|
||||
@ -156,9 +166,9 @@ class OFstreamCollator
|
||||
const label comm,
|
||||
const word& objectType,
|
||||
const fileName& fName,
|
||||
const string& masterData,
|
||||
const UList<char>& localData,
|
||||
const labelUList& recvSizes,
|
||||
const UPtrList<SubList<char>>& slaveData,
|
||||
const UList<stdFoam::span<char>>& procData,
|
||||
IOstreamOption streamOpt,
|
||||
IOstreamOption::atomicType atomic,
|
||||
IOstreamOption::appendType append,
|
||||
@ -181,7 +191,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from buffer size. 0 = do not use thread
|
||||
//- Construct from buffer size (0 = do not use thread)
|
||||
//- and with worldComm
|
||||
explicit OFstreamCollator(const off_t maxBufferSize);
|
||||
|
||||
//- Construct from buffer size (0 = do not use thread)
|
||||
@ -195,14 +206,15 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Write file with contents.
|
||||
// Blocks until writethread has space available
|
||||
//- Write file with contents, possibly taking ownership of the
|
||||
//- content.
|
||||
// Blocks until write-thread has space available
|
||||
// (total file sizes < maxBufferSize)
|
||||
bool write
|
||||
(
|
||||
const word& objectType,
|
||||
const fileName&,
|
||||
const string& data,
|
||||
const fileName& fName,
|
||||
DynamicList<char>&& localData,
|
||||
IOstreamOption streamOpt,
|
||||
IOstreamOption::atomicType atomic,
|
||||
IOstreamOption::appendType append,
|
||||
@ -210,6 +222,37 @@ public:
|
||||
const dictionary& headerEntries = dictionary::null
|
||||
);
|
||||
|
||||
//- Write file with contents.
|
||||
FOAM_DEPRECATED_FOR(2023-09, "use write with movable content")
|
||||
bool write
|
||||
(
|
||||
const word& objectType,
|
||||
const fileName& fName,
|
||||
const std::string& s,
|
||||
IOstreamOption streamOpt,
|
||||
IOstreamOption::atomicType atomic,
|
||||
IOstreamOption::appendType append,
|
||||
const bool useThread = true,
|
||||
const dictionary& headerEntries = dictionary::null
|
||||
)
|
||||
{
|
||||
DynamicList<char> charData;
|
||||
charData.setCapacity(s.size());
|
||||
std::copy(s.begin(), s.end(), charData.begin());
|
||||
|
||||
return write
|
||||
(
|
||||
objectType,
|
||||
fName,
|
||||
std::move(charData),
|
||||
streamOpt,
|
||||
atomic,
|
||||
append,
|
||||
useThread,
|
||||
headerEntries
|
||||
);
|
||||
}
|
||||
|
||||
//- Wait for all thread actions to have finished
|
||||
void waitAll();
|
||||
};
|
||||
|
||||
@ -59,7 +59,7 @@ namespace fileOperations
|
||||
|
||||
float collatedFileOperation::maxThreadFileBufferSize
|
||||
(
|
||||
debug::floatOptimisationSwitch("maxThreadFileBufferSize", 1e9)
|
||||
debug::floatOptimisationSwitch("maxThreadFileBufferSize", 0)
|
||||
);
|
||||
registerOptSwitch
|
||||
(
|
||||
@ -90,26 +90,41 @@ void Foam::fileOperations::collatedFileOperation::printBanner
|
||||
DetailInfo
|
||||
<< "I/O : " << this->type();
|
||||
|
||||
if (maxThreadFileBufferSize == 0)
|
||||
{
|
||||
DetailInfo
|
||||
<< " [unthreaded] (maxThreadFileBufferSize = 0)." << nl
|
||||
<< " Writing may be slow for large file sizes."
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
if (mag(maxThreadFileBufferSize) > 1)
|
||||
{
|
||||
// FUTURE: deprecate or remove threading?
|
||||
DetailInfo
|
||||
<< " [threaded] (maxThreadFileBufferSize = "
|
||||
<< maxThreadFileBufferSize << ")." << nl
|
||||
<< " Requires buffer large enough to collect all data"
|
||||
" or thread support" << nl
|
||||
<< " enabled in MPI. If MPI thread support cannot be"
|
||||
" enabled, deactivate" << nl
|
||||
<< " threading by setting maxThreadFileBufferSize"
|
||||
" to 0 in" << nl
|
||||
" or MPI thread support." << nl
|
||||
<< " To avoid MPI threading [slow], set"
|
||||
" (maxThreadFileBufferSize = 0) in" << nl
|
||||
<< " OpenFOAM etc/controlDict" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
DetailInfo
|
||||
<< " [unthreaded] (maxThreadFileBufferSize = 0)." << nl;
|
||||
|
||||
if (mag(maxMasterFileBufferSize) < 1)
|
||||
{
|
||||
DetailInfo
|
||||
<< " With scheduled transfer" << nl;
|
||||
}
|
||||
else if (maxMasterFileBufferSize >= 1)
|
||||
{
|
||||
DetailInfo
|
||||
<< " With non-blocking transfer,"
|
||||
" buffer-size = " << maxMasterFileBufferSize << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
DetailInfo
|
||||
<< " With non-blocking transfer,"
|
||||
" minimal buffer size" << nl;
|
||||
}
|
||||
}
|
||||
|
||||
if (withRanks)
|
||||
{
|
||||
@ -455,7 +470,7 @@ bool Foam::fileOperations::collatedFileOperation::writeObject
|
||||
{
|
||||
// Re-check static maxThreadFileBufferSize variable to see
|
||||
// if needs to use threading
|
||||
const bool useThread = (maxThreadFileBufferSize != 0);
|
||||
const bool useThread = (mag(maxThreadFileBufferSize) > 1);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,7 +41,7 @@ Foam::threadedCollatedOFstream::threadedCollatedOFstream
|
||||
const bool useThread
|
||||
)
|
||||
:
|
||||
OStringStream(streamOpt),
|
||||
OCharStream(streamOpt),
|
||||
writer_(writer),
|
||||
pathName_(pathName),
|
||||
atomic_(atomic),
|
||||
@ -74,11 +74,22 @@ Foam::threadedCollatedOFstream::threadedCollatedOFstream
|
||||
|
||||
Foam::threadedCollatedOFstream::~threadedCollatedOFstream()
|
||||
{
|
||||
commit();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::threadedCollatedOFstream::commit()
|
||||
{
|
||||
// Take ownership of serialized content, without copying or reallocation
|
||||
DynamicList<char> charData(OCharStream::release());
|
||||
|
||||
writer_.write
|
||||
(
|
||||
decomposedBlockData::typeName,
|
||||
pathName_,
|
||||
str(),
|
||||
std::move(charData),
|
||||
IOstreamOption(IOstreamOption::BINARY, version(), compression_),
|
||||
atomic_,
|
||||
IOstreamOption::NON_APPEND,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,7 +39,7 @@ SourceFiles
|
||||
#define Foam_threadedCollatedOFstream_H
|
||||
|
||||
#include "dictionary.H"
|
||||
#include "StringStream.H"
|
||||
#include "SpanStream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,7 +55,7 @@ class OFstreamCollator;
|
||||
|
||||
class threadedCollatedOFstream
|
||||
:
|
||||
public OStringStream
|
||||
public OCharStream
|
||||
{
|
||||
// Private Data
|
||||
|
||||
@ -78,6 +78,11 @@ class threadedCollatedOFstream
|
||||
dictionary headerEntries_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Commit buffered information
|
||||
void commit();
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
@ -102,12 +107,14 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
//- Destructor - commits buffered information to file
|
||||
~threadedCollatedOFstream();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// -> using OCharStream::rewind
|
||||
|
||||
//- Define the header entries for the data block(s)
|
||||
void setHeaderEntries(const dictionary& dict);
|
||||
};
|
||||
|
||||
@ -127,7 +127,7 @@ Foam::labelListList Foam::GAMGProcAgglomeration::globalCellCells
|
||||
const lduAddressing& addr = mesh.lduAddr();
|
||||
lduInterfacePtrsList interfaces = mesh.interfaces();
|
||||
|
||||
const label myProcID = UPstream::myProcNo(mesh.comm());
|
||||
const label myProci = UPstream::myProcNo(mesh.comm());
|
||||
|
||||
const globalIndex globalNumbering
|
||||
(
|
||||
@ -138,11 +138,7 @@ Foam::labelListList Foam::GAMGProcAgglomeration::globalCellCells
|
||||
|
||||
const labelList globalIndices
|
||||
(
|
||||
identity
|
||||
(
|
||||
globalNumbering.localSize(myProcID),
|
||||
globalNumbering.localStart(myProcID)
|
||||
)
|
||||
Foam::identity(globalNumbering.range(myProci))
|
||||
);
|
||||
|
||||
// Get the interface cells
|
||||
|
||||
@ -105,12 +105,14 @@ Foam::labelListList Foam::lduPrimitiveMesh::globalCellCells
|
||||
const lduAddressing& addr = mesh.lduAddr();
|
||||
lduInterfacePtrsList interfaces = mesh.interfaces();
|
||||
|
||||
const label myProci = UPstream::myProcNo(mesh.comm());
|
||||
|
||||
const labelList globalIndices
|
||||
(
|
||||
identity
|
||||
Foam::identity
|
||||
(
|
||||
addr.size(),
|
||||
globalNumbering.localStart(UPstream::myProcNo(mesh.comm()))
|
||||
globalNumbering.localStart(myProci)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -289,10 +289,12 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
|
||||
label vertI = 0;
|
||||
|
||||
forAll(faceCentres(), facej)
|
||||
const vectorField::subField ownFaceCentres = faceCentres();
|
||||
|
||||
forAll(ownFaceCentres, facej)
|
||||
{
|
||||
const point& c0 = neighbFaceCentres_[facej];
|
||||
const point& c1 = faceCentres()[facej];
|
||||
const point& c1 = ownFaceCentres[facej];
|
||||
|
||||
writeOBJ(ccStr, c0, c1, vertI);
|
||||
}
|
||||
|
||||
@ -538,6 +538,10 @@ inline Foam::Tensor<Cmpt> Foam::Tensor<Cmpt>::inv2D
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Foam::Tensor<Cmpt>
|
||||
Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
|
||||
{
|
||||
@ -561,6 +565,10 @@ Foam::Tensor<Cmpt>::inner(const Tensor<Cmpt>& t2) const
|
||||
|
||||
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Foam::Tensor<Cmpt>
|
||||
Foam::Tensor<Cmpt>::schur(const Tensor<Cmpt>& t2) const
|
||||
{
|
||||
@ -1103,6 +1111,10 @@ operator&(const Tensor<Cmpt>& t1, const Tensor<Cmpt>& t2)
|
||||
|
||||
//- Inner-product of a SphericalTensor and a Tensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
{
|
||||
@ -1117,6 +1129,10 @@ operator&(const SphericalTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
|
||||
//- Inner-product of a Tensor and a SphericalTensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
|
||||
{
|
||||
@ -1131,6 +1147,10 @@ operator&(const Tensor<Cmpt>& t1, const SphericalTensor<Cmpt>& st2)
|
||||
|
||||
//- Inner-product of a SymmTensor and a Tensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
{
|
||||
@ -1153,6 +1173,10 @@ operator&(const SymmTensor<Cmpt>& st1, const Tensor<Cmpt>& t2)
|
||||
|
||||
//- Inner-product of a Tensor and a SymmTensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Tensor<Cmpt>
|
||||
operator&(const Tensor<Cmpt>& t1, const SymmTensor<Cmpt>& st2)
|
||||
{
|
||||
@ -1193,6 +1217,10 @@ operator&(const Tensor<Cmpt>& t, const Vector<Cmpt>& v)
|
||||
|
||||
//- Inner-product of a Vector and a Tensor
|
||||
template<class Cmpt>
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
// Workaround for gcc (11+) that fails to handle tensor dot vector
|
||||
__attribute__((optimize("no-tree-vectorize")))
|
||||
#endif
|
||||
inline Vector<Cmpt>
|
||||
operator&(const Vector<Cmpt>& v, const Tensor<Cmpt>& t)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -133,9 +133,7 @@ public:
|
||||
//- Return clone
|
||||
autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return
|
||||
autoPtr<coordinateRotation>::NewFrom
|
||||
<coordinateRotations::euler>(*this);
|
||||
return coordinateRotation::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -115,9 +115,7 @@ public:
|
||||
//- Return clone
|
||||
autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return
|
||||
autoPtr<coordinateRotation>::NewFrom
|
||||
<coordinateRotations::starcd>(*this);
|
||||
return coordinateRotation::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -144,9 +144,7 @@ public:
|
||||
//- Return clone
|
||||
autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return
|
||||
autoPtr<coordinateRotation>::NewFrom
|
||||
<coordinateRotations::axes>(*this);
|
||||
return coordinateRotation::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -120,9 +120,7 @@ public:
|
||||
//- Return clone
|
||||
autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return
|
||||
autoPtr<coordinateRotation>::NewFrom
|
||||
<coordinateRotations::axisAngle>(*this);
|
||||
return coordinateRotation::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -109,11 +109,18 @@ public:
|
||||
|
||||
// Uses all default constructors
|
||||
|
||||
//- Construct and return a clone
|
||||
//- Return a clone
|
||||
virtual autoPtr<coordinateRotation> clone() const = 0;
|
||||
|
||||
|
||||
// Selectors
|
||||
// Factory Methods
|
||||
|
||||
//- Clone a coordinate rotation
|
||||
template<class Derived>
|
||||
static autoPtr<coordinateRotation> Clone(const Derived& crot)
|
||||
{
|
||||
return autoPtr<coordinateRotation>(new Derived(crot));
|
||||
}
|
||||
|
||||
//- Select construct the specified coordinate rotation type
|
||||
//
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -89,9 +89,7 @@ public:
|
||||
//- Return clone
|
||||
autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return
|
||||
autoPtr<coordinateRotation>::NewFrom
|
||||
<coordinateRotations::cylindrical>(*this);
|
||||
return coordinateRotation::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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.
|
||||
@ -93,9 +93,7 @@ public:
|
||||
//- Return clone
|
||||
autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return
|
||||
autoPtr<coordinateRotation>::NewFrom
|
||||
<coordinateRotations::identity>(*this);
|
||||
return coordinateRotation::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -89,9 +89,7 @@ public:
|
||||
//- Return clone
|
||||
autoPtr<coordinateRotation> clone() const
|
||||
{
|
||||
return
|
||||
autoPtr<coordinateRotation>::NewFrom
|
||||
<coordinateRotations::specified>(*this);
|
||||
return coordinateRotation::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -149,7 +149,7 @@ public:
|
||||
//- Return clone
|
||||
virtual autoPtr<coordinateSystem> clone() const
|
||||
{
|
||||
return autoPtr<coordinateSystem>::NewFrom<cartesian>(*this);
|
||||
return coordinateSystem::Clone(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -453,7 +453,26 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
// Factory Methods
|
||||
|
||||
//- Clone a coordinate system
|
||||
template<class Derived>
|
||||
static autoPtr<coordinateSystem> Clone(const Derived& csys)
|
||||
{
|
||||
return autoPtr<coordinateSystem>(new Derived(csys));
|
||||
}
|
||||
|
||||
//- Select construct the specified coordinate system type
|
||||
//- with reference to objectRegistry for indirect entries.
|
||||
//
|
||||
// An empty modelType will be treated as "cartesian"
|
||||
static autoPtr<coordinateSystem> Clone
|
||||
(
|
||||
const word& modelType,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
IOobjectOption::readOption readOrigin = IOobjectOption::MUST_READ
|
||||
);
|
||||
|
||||
//- Select construct the specified coordinate system type
|
||||
//- with reference to objectRegistry for indirect entries.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user