Compare commits
71 Commits
issue-3065
...
feature-po
| Author | SHA1 | Date | |
|---|---|---|---|
| a4aa16b509 | |||
| 343126df7b | |||
| c5e6c70cfa | |||
| 89e1de29a1 | |||
| 268851c5e2 | |||
| e0cf4209a8 | |||
| 1426191fa2 | |||
| ec3bca90fc | |||
| 8b85e5c932 | |||
| 506802bbea | |||
| 0c20009587 | |||
| 5a0fba84b4 | |||
| 732c8b3330 | |||
| ff567dbe71 | |||
| e3b7c2e6ee | |||
| 84a1fc9b4f | |||
| 47c44a5783 | |||
| 91a1eaa01b | |||
| fcf090410a | |||
| 19a6241e08 | |||
| 52f5a6d039 | |||
| fe1d7e01d6 | |||
| cb416fb3ec | |||
| 4ae4f0928d | |||
| 6dadd3d33e | |||
| 3a43aae7c0 | |||
| 9ad3754ed7 | |||
| d6781b91fe | |||
| d9c5a5d1a9 | |||
| fc9820b08a | |||
| f9bbd06e57 | |||
| 182afc27ba | |||
| 0bf39691ff | |||
| 312c7a1c32 | |||
| 0ae3da8560 | |||
| 44c594dbff | |||
| a889e5eba6 | |||
| 3d0cb79be3 | |||
| d310f82402 | |||
| 152eceeb56 | |||
| ebe49d4cbd | |||
| 7cfd053079 | |||
| 81f0620b7b | |||
| 7b7dde0a6d | |||
| f485093d37 | |||
| a4cbb33373 | |||
| f625a9a0dd | |||
| 5d5f541dd6 | |||
| 646b0aab36 | |||
| d048befbc0 | |||
| 26904bf6df | |||
| 62524b140c | |||
| e3f0521b19 | |||
| bb16c493b7 | |||
| 89cd584440 | |||
| 2190684914 | |||
| 987dbe4589 | |||
| 39e054b0b8 | |||
| f6ec5c676e | |||
| ad85b684bb | |||
| dde4b12687 | |||
| 1a1322a2b0 | |||
| 8394e45c13 | |||
| a46b310fa4 | |||
| 793231b4aa | |||
| 1dc216eb1f | |||
| c4328296b0 | |||
| 52ab1fc06f | |||
| f8bee97897 | |||
| 9f0f9f2dd6 | |||
| 58787bb166 |
@ -9,6 +9,7 @@ It is likely incomplete...
|
||||
- Yu Ankun
|
||||
- Tetsuo Aoyagi
|
||||
- Akira Azami
|
||||
- Pete Bachant
|
||||
- William Bainbridge
|
||||
- Gabriel Barajas
|
||||
- Kutalmis Bercin
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -135,14 +135,14 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return thermo1_->he();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy [J/kg]
|
||||
virtual const volScalarField& he() const
|
||||
{
|
||||
NotImplemented;
|
||||
return thermo1_->he();
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy
|
||||
@ -213,7 +213,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Heat capacity at constant volume [J/kg/K]
|
||||
@ -236,7 +236,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -243,14 +243,14 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return phases_[0].thermo().he();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy [J/kg]
|
||||
virtual const volScalarField& he() const
|
||||
{
|
||||
NotImplemented;
|
||||
return phases_[0].thermo().he();
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy
|
||||
@ -327,7 +327,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Heat capacity at constant volume [J/kg/K]
|
||||
@ -350,7 +350,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
|
||||
@ -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_;
|
||||
|
||||
@ -86,14 +86,14 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return p();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Return access to the internal energy field [J/Kg]
|
||||
virtual const volScalarField& he() const
|
||||
{
|
||||
NotImplemented;
|
||||
return p();
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy
|
||||
@ -182,7 +182,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Return Cv of the mixture
|
||||
@ -205,7 +205,7 @@ public:
|
||||
) const
|
||||
{
|
||||
NotImplemented;
|
||||
return tmp<scalarField>::New(p);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//- Gamma = Cp/Cv []
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -412,7 +412,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
{
|
||||
Info<< "range-for of list (" << list1.count() << '/'
|
||||
Info<< "range-for of list (" << list1.count_nonnull() << '/'
|
||||
<< list1.size() << ") non-null entries" << nl
|
||||
<< "(" << nl;
|
||||
for (const auto& item : list1)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -64,6 +64,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Add some more entries
|
||||
{
|
||||
label idx = 0;
|
||||
dictionary subdict;
|
||||
|
||||
subdict.add("key", 100);
|
||||
@ -72,23 +73,30 @@ int main(int argc, char *argv[])
|
||||
|
||||
subdict.add
|
||||
(
|
||||
new formattingEntry(10, "// comment - without newline.")
|
||||
new formattingEntry(++idx, "// comment - without newline.")
|
||||
);
|
||||
|
||||
subdict.add
|
||||
(
|
||||
// NB newline must be part of the content!
|
||||
new formattingEntry(11, "// some comment - with newline?\n")
|
||||
new formattingEntry(++idx, "// some comment - with newline?\n")
|
||||
);
|
||||
|
||||
subdict.add
|
||||
(
|
||||
// NB newline must be part of the content!
|
||||
new formattingEntry(12, "/* other comment */\n")
|
||||
new formattingEntry(++idx, "/* other comment */\n")
|
||||
);
|
||||
|
||||
// Other - invisible
|
||||
subdict.add(new formattingEntry(++idx, token(123), false));
|
||||
|
||||
// Other - visible (probably not what anyone wants!)
|
||||
subdict.add(new formattingEntry(++idx, token(456)));
|
||||
|
||||
subdict.add("val", 42);
|
||||
|
||||
Info<< "subdict keys:" << flatOutput(subdict.toc()) << nl;
|
||||
dict.add("subdict", std::move(subdict));
|
||||
}
|
||||
|
||||
|
||||
@ -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"
|
||||
@ -1,3 +1,3 @@
|
||||
Test-gatherValues1.C
|
||||
Test-gatherValues1.cxx
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-gatherValues1
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
const labelList localValues
|
||||
(
|
||||
identity(2 *(Pstream::myProcNo()+1), -5*Pstream::myProcNo())
|
||||
identity(2 *(UPstream::myProcNo()+1), -5*UPstream::myProcNo())
|
||||
);
|
||||
|
||||
// Test resize
|
||||
@ -76,8 +76,8 @@ int main(int argc, char *argv[])
|
||||
// One-sided sizing! master only
|
||||
const globalIndex allProcAddr
|
||||
(
|
||||
sendData.size(),
|
||||
globalIndex::gatherOnly{}
|
||||
globalIndex::gatherOnly{},
|
||||
sendData.size()
|
||||
);
|
||||
|
||||
Pout<< "listGather sizes: " << flatOutput(allProcAddr.sizes()) << nl;
|
||||
@ -98,8 +98,8 @@ int main(int argc, char *argv[])
|
||||
// One-sided sizing! master only
|
||||
const globalIndex allProcAddr
|
||||
(
|
||||
sendData.size(),
|
||||
globalIndex::gatherOnly{}
|
||||
globalIndex::gatherOnly{},
|
||||
sendData.size()
|
||||
);
|
||||
|
||||
Pout<< "listGather sizes: " << flatOutput(allProcAddr.sizes()) << nl;
|
||||
@ -116,7 +116,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
const labelList::subList& sendData =
|
||||
(
|
||||
Pstream::master()
|
||||
UPstream::master()
|
||||
? SubList<label>(localValues, 0) // exclude
|
||||
: SubList<label>(localValues)
|
||||
);
|
||||
@ -147,11 +147,11 @@ int main(int argc, char *argv[])
|
||||
<< UPstream::listScatterValues(subProcAddr.offsets()) << nl;
|
||||
|
||||
|
||||
Pout<< endl << "local list [" << Pstream::myProcNo() << "] "
|
||||
Pout<< endl << "local list [" << UPstream::myProcNo() << "] "
|
||||
<< flatOutput(localValues) << nl;
|
||||
|
||||
|
||||
Pout<< endl << "local send [" << Pstream::myProcNo() << "] "
|
||||
Pout<< endl << "local send [" << UPstream::myProcNo() << "] "
|
||||
<< sendSize << nl;
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Pout<< "off-proc: " << allValues << endl;
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
Info<< "master: " << flatOutput(localValues) << nl;
|
||||
|
||||
@ -196,7 +196,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
globalIndex glob
|
||||
(
|
||||
globalIndex:gatherNone{},
|
||||
globalIndex::gatherNone{},
|
||||
labelList(Foam::one{}, 0)
|
||||
);
|
||||
Info<< "single:" << nl;
|
||||
@ -208,35 +208,37 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// This will likely fail - not declared as is_contiguous
|
||||
// Cannot even catch since it triggers an abort()
|
||||
|
||||
#if 0
|
||||
// Non-contiguous gather - use Pstream, not UPstream!
|
||||
{
|
||||
std::pair<label,vector> sendData(Pstream::myProcNo(), vector::one);
|
||||
typedef std::pair<label,vector> valueType;
|
||||
|
||||
const bool oldThrowingError = FatalError.throwing(true);
|
||||
valueType sendData(UPstream::myProcNo(), vector::one);
|
||||
|
||||
try
|
||||
{
|
||||
List<std::pair<label,vector>> countValues
|
||||
(
|
||||
UPstream::listGatherValues<std::pair<label, vector>>
|
||||
(
|
||||
sendData
|
||||
)
|
||||
);
|
||||
List<valueType> countValues
|
||||
(
|
||||
Pstream::listGatherValues(sendData)
|
||||
);
|
||||
|
||||
Pout<< "listGather: " << flatOutput(countValues) << nl;
|
||||
}
|
||||
catch (const Foam::error& err)
|
||||
{
|
||||
Info<< err.message().c_str() << nl;
|
||||
}
|
||||
|
||||
FatalError.throwing(oldThrowingError);
|
||||
Pout<< "listGather: " << flatOutput(countValues) << nl;
|
||||
}
|
||||
|
||||
// Non-contiguous scatter - use Pstream, not UPstream!
|
||||
{
|
||||
List<fileName> allValues;
|
||||
|
||||
if (UPstream::master())
|
||||
{
|
||||
allValues.resize(UPstream::nProcs());
|
||||
forAll(allValues, proci)
|
||||
{
|
||||
allValues[proci] = "processor" + Foam::name(proci);
|
||||
}
|
||||
}
|
||||
|
||||
fileName procName = Pstream::listScatterValues(allValues);
|
||||
|
||||
Pout<< "listScatter: " << procName << nl;
|
||||
}
|
||||
#endif
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"procAddressing",
|
||||
instance,
|
||||
fvMesh::meshSubDir,
|
||||
polyMesh::meshSubDir,
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2014 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -48,7 +48,7 @@ class SimpleClass
|
||||
public:
|
||||
|
||||
//- Default construct
|
||||
SimpleClass() {}
|
||||
SimpleClass() = default;
|
||||
};
|
||||
|
||||
|
||||
@ -73,9 +73,8 @@ void printInfo(const UList<T>& list)
|
||||
int main()
|
||||
{
|
||||
// Test pointer and reference to a class
|
||||
|
||||
SimpleClass* ptrToClass = new SimpleClass;
|
||||
SimpleClass& refToClass(*ptrToClass);
|
||||
auto ptrToClass = autoPtr<SimpleClass>::New();
|
||||
auto& refToClass = ptrToClass.ref();
|
||||
|
||||
std::cout
|
||||
<< "nullObject addr=" << name(&(nullObjectPtr)) << nl
|
||||
@ -89,13 +88,13 @@ int main()
|
||||
<< " pointer:" << name(nullObjectPtr->pointer()) << nl
|
||||
<< " value:" << nullObjectPtr->value() << nl << nl;
|
||||
|
||||
if (notNull(ptrToClass))
|
||||
if (notNull(ptrToClass.get()))
|
||||
{
|
||||
Info<< "Pass: ptrToClass is not null" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "FAIL: refToClass is null" << nl;
|
||||
Info<< "FAIL: ptrToClass is null" << nl;
|
||||
}
|
||||
|
||||
if (notNull(refToClass))
|
||||
@ -110,8 +109,8 @@ int main()
|
||||
|
||||
// Test pointer and reference to the nullObject
|
||||
|
||||
const SimpleClass* ptrToNull(NullObjectPtr<SimpleClass>());
|
||||
const SimpleClass& refToNull(*ptrToNull);
|
||||
const SimpleClass* ptrToNull = NullObjectPtr<SimpleClass>();
|
||||
const SimpleClass& refToNull = (*ptrToNull);
|
||||
|
||||
if (isNull(ptrToNull))
|
||||
{
|
||||
@ -131,9 +130,6 @@ int main()
|
||||
Info<< "FAIL: refToNull is not null" << nl;
|
||||
}
|
||||
|
||||
// Clean-up
|
||||
delete ptrToClass;
|
||||
|
||||
|
||||
// Test List casting
|
||||
{
|
||||
@ -152,7 +148,7 @@ int main()
|
||||
// Looks pretty ugly though!
|
||||
|
||||
NullObject::nullObject = "hello world";
|
||||
NullObject::nullObject = labelList({1, 2, 3});
|
||||
NullObject::nullObject = Foam::identity(5);
|
||||
|
||||
Info<< nl;
|
||||
|
||||
|
||||
@ -50,37 +50,37 @@ scalar sumReduce
|
||||
)
|
||||
{
|
||||
scalar sum = 0;
|
||||
if (Pstream::parRun())
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
if (UPstream::master(comm))
|
||||
{
|
||||
// Add master value and all slaves
|
||||
// Add master value and all sub-procs
|
||||
sum = localValue;
|
||||
|
||||
for (const int slave : UPstream::subProcs(comm))
|
||||
for (const int proci : UPstream::subProcs(comm))
|
||||
{
|
||||
scalar slaveValue;
|
||||
scalar procValue;
|
||||
UIPstream::read
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
slave,
|
||||
reinterpret_cast<char*>(&slaveValue),
|
||||
UPstream::commsTypes::blocking,
|
||||
proci,
|
||||
reinterpret_cast<char*>(&procValue),
|
||||
sizeof(scalar),
|
||||
UPstream::msgType(), // tag
|
||||
comm // communicator
|
||||
);
|
||||
|
||||
sum += slaveValue;
|
||||
sum += procValue;
|
||||
}
|
||||
|
||||
// Send back to slaves
|
||||
// Send back
|
||||
|
||||
for (const int slave : UPstream::subProcs(comm))
|
||||
for (const int proci : UPstream::subProcs(comm))
|
||||
{
|
||||
UOPstream::write
|
||||
(
|
||||
UPstream::commsTypes::blocking,
|
||||
slave,
|
||||
proci,
|
||||
reinterpret_cast<const char*>(&sum),
|
||||
sizeof(scalar),
|
||||
UPstream::msgType(), // tag
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,27 +52,27 @@ void testMapDistribute()
|
||||
|
||||
// Generate random data.
|
||||
List<Tuple2<label, List<scalar>>> complexData(100);
|
||||
forAll(complexData, i)
|
||||
for (auto& data : complexData)
|
||||
{
|
||||
complexData[i].first() = rndGen.position(0, Pstream::nProcs()-1);
|
||||
complexData[i].second().setSize(3);
|
||||
complexData[i].second()[0] = 1;
|
||||
complexData[i].second()[1] = 2;
|
||||
complexData[i].second()[2] = 3;
|
||||
data.first() = rndGen.position(0, UPstream::nProcs()-1);
|
||||
data.second().resize(3);
|
||||
data.second()[0] = 1;
|
||||
data.second()[1] = 2;
|
||||
data.second()[2] = 3;
|
||||
}
|
||||
|
||||
// Send all ones to processor indicated by .first()
|
||||
|
||||
// Count how many to send
|
||||
labelList nSend(Pstream::nProcs(), Zero);
|
||||
forAll(complexData, i)
|
||||
labelList nSend(UPstream::nProcs(), Foam::zero{});
|
||||
for (const auto& data : complexData)
|
||||
{
|
||||
const label proci = complexData[i].first();
|
||||
const label proci = data.first();
|
||||
nSend[proci]++;
|
||||
}
|
||||
|
||||
// Collect items to be sent
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
labelListList sendMap(UPstream::nProcs());
|
||||
forAll(sendMap, proci)
|
||||
{
|
||||
sendMap[proci].resize_nocopy(nSend[proci]);
|
||||
@ -116,40 +116,31 @@ void testTransfer(const T& input)
|
||||
{
|
||||
T data = input;
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
Perr<<"test transfer (" << (typeid(T).name()) << "): ";
|
||||
perrInfo(data) << nl << endl;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
for (const int slave : Pstream::subProcs())
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
Perr<< "master receiving from slave " << slave << endl;
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
fromSlave >> data;
|
||||
Perr<< "master receiving from proc:" << proci << endl;
|
||||
IPstream::recv(data, proci);
|
||||
perrInfo(data) << endl;
|
||||
}
|
||||
|
||||
for (const int slave : Pstream::subProcs())
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
Perr<< "master sending to slave " << slave << endl;
|
||||
OPstream toSlave(Pstream::commsTypes::blocking, slave);
|
||||
toSlave << data;
|
||||
Perr<< "master sending to proc:" << proci << endl;
|
||||
OPstream::bsend(data, proci);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
Perr<< "slave sending to master " << Pstream::masterNo() << endl;
|
||||
OPstream toMaster(Pstream::commsTypes::blocking, Pstream::masterNo());
|
||||
toMaster << data;
|
||||
}
|
||||
Perr<< "proc sending to master" << endl;
|
||||
OPstream::bsend(data, UPstream::masterNo());
|
||||
|
||||
Perr<< "slave receiving from master " << Pstream::masterNo() << endl;
|
||||
IPstream fromMaster(Pstream::commsTypes::blocking, Pstream::masterNo());
|
||||
fromMaster >> data;
|
||||
Perr<< "proc receiving from master" << endl;
|
||||
IPstream::recv(data, UPstream::masterNo());
|
||||
perrInfo(data) << endl;
|
||||
}
|
||||
}
|
||||
@ -160,49 +151,31 @@ void testTokenized(const T& data)
|
||||
{
|
||||
token tok;
|
||||
|
||||
if (Pstream::master())
|
||||
if (UPstream::master())
|
||||
{
|
||||
Perr<<"test tokenized \"" << data << "\"" << nl << endl;
|
||||
}
|
||||
Perr<< "test tokenized \"" << data << "\"" << nl << endl;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
for (const int slave : Pstream::subProcs())
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
Perr<< "master receiving from slave " << slave << endl;
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, slave);
|
||||
fromSlave >> tok;
|
||||
Perr<< "master receiving from proc:" << proci << endl;
|
||||
IPstream::recv(tok, proci);
|
||||
Perr<< tok.info() << endl;
|
||||
}
|
||||
|
||||
for (const int slave : Pstream::subProcs())
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
Perr<< "master sending to slave " << slave << endl;
|
||||
OPstream toSlave(Pstream::commsTypes::blocking, slave);
|
||||
toSlave << data;
|
||||
Perr<< "master sending to proc:" << proci << endl;
|
||||
OPstream::bsend(tok, proci);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
Perr<< "slave sending to master " << Pstream::masterNo() << endl;
|
||||
OPstream toMaster
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
Perr<< "proc sending to master" << endl;
|
||||
OPstream::bsend(tok, UPstream::masterNo());
|
||||
|
||||
toMaster << data;
|
||||
}
|
||||
Perr<< "proc receiving from master" << endl;
|
||||
IPstream::recv(tok, UPstream::masterNo());
|
||||
|
||||
Perr<< "slave receiving from master " << Pstream::masterNo() << endl;
|
||||
IPstream fromMaster
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
|
||||
fromMaster >> tok;
|
||||
Perr<< tok.info() << endl;
|
||||
}
|
||||
}
|
||||
@ -212,12 +185,14 @@ void testTokenized(const T& data)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noCheckProcessorDirectories();
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
testMapDistribute();
|
||||
|
||||
if (!Pstream::parRun())
|
||||
if (!UPstream::parRun())
|
||||
{
|
||||
Info<< "\nWarning: not parallel - skipping further tests\n" << endl;
|
||||
return 0;
|
||||
|
||||
11
applications/test/syncTools/missing_cell/Allclean
Executable file
11
applications/test/syncTools/missing_cell/Allclean
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
cleanCase
|
||||
|
||||
# Remove surface and features
|
||||
rm -rf constant/triSurface
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
27
applications/test/syncTools/missing_cell/Allrun
Executable file
27
applications/test/syncTools/missing_cell/Allrun
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
#- Generate 2x2x1 cells
|
||||
runApplication blockMesh
|
||||
|
||||
#- Remove cell0
|
||||
runApplication topoSet
|
||||
runApplication subsetMesh c0 -patch exposed0 -overwrite
|
||||
|
||||
#- Put exposed faces (2) into separate patches
|
||||
runApplication -s face topoSet
|
||||
runApplication createPatch -overwrite
|
||||
|
||||
#- Decompose - creates one processor without any faces in patches
|
||||
runApplication decomposePar
|
||||
|
||||
#- Extract inter-patch points. Should include processor that does not
|
||||
#- have faces on patch ...
|
||||
mkdir -p constant/triSurface
|
||||
runParallel surfaceMeshExtract \
|
||||
-patches '(exposed0 exposed1)' -featureAngle 180 \
|
||||
constant/triSurface/blockMesh.obj
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
7
applications/test/syncTools/missing_cell/README.txt
Normal file
7
applications/test/syncTools/missing_cell/README.txt
Normal file
@ -0,0 +1,7 @@
|
||||
- 2x2x1 mesh
|
||||
- remove one cell, exposing two faces
|
||||
- move exposed faces into two patches
|
||||
- decompose onto 3
|
||||
- run surfaceMeshExtract -featureAngle 180
|
||||
- should also mark points on the processor that has no
|
||||
faces but is coupled
|
||||
@ -0,0 +1,21 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object transportProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
nu 0.01;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,88 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object blockMeshDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
scale 1;
|
||||
|
||||
vertices
|
||||
(
|
||||
//- Single block
|
||||
(0 0 0)
|
||||
(2 0 0)
|
||||
(2 2 0)
|
||||
(0 2 0)
|
||||
(0 0 2)
|
||||
(2 0 2)
|
||||
(2 2 2)
|
||||
(0 2 2)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (2 2 1) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
topWall
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(3 7 6 2)
|
||||
);
|
||||
}
|
||||
bottomWall
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(1 5 4 0)
|
||||
);
|
||||
}
|
||||
fixedWalls
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(0 4 7 3)
|
||||
(2 6 5 1)
|
||||
);
|
||||
}
|
||||
frontAndBack
|
||||
{
|
||||
type patch;
|
||||
faces
|
||||
(
|
||||
(0 3 2 1)
|
||||
(4 5 6 7)
|
||||
);
|
||||
}
|
||||
exposed0
|
||||
{
|
||||
type patch;
|
||||
faces ();
|
||||
}
|
||||
);
|
||||
|
||||
mergePatchPairs
|
||||
(
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
48
applications/test/syncTools/missing_cell/system/controlDict
Normal file
48
applications/test/syncTools/missing_cell/system/controlDict
Normal file
@ -0,0 +1,48 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application icoFoam;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 0.5;
|
||||
|
||||
deltaT 0.005;
|
||||
|
||||
writeControl timeStep;
|
||||
|
||||
writeInterval 20;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 16;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object createPatchDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
pointSync false;
|
||||
|
||||
// Patches to create.
|
||||
patches
|
||||
(
|
||||
// Example of creating mapped patches using geometric matching
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
{
|
||||
// Name of new patch
|
||||
name exposed1;
|
||||
|
||||
// Dictionary to construct new patch from
|
||||
patchInfo
|
||||
{
|
||||
type patch;
|
||||
}
|
||||
|
||||
// How to select the faces:
|
||||
// - set : specify faceSet in 'set'
|
||||
// - patches : specify names in 'patches'
|
||||
// - autoPatch : attempts automatic patching of the specified
|
||||
// candidates in 'patches'.
|
||||
constructFrom set;
|
||||
set exposed0;
|
||||
}
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,24 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
note "mesh decomposition control dictionary";
|
||||
object decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- The total number of domains (mandatory)
|
||||
numberOfSubdomains 3;
|
||||
|
||||
//- The decomposition method (mandatory)
|
||||
method scotch;
|
||||
|
||||
// ************************************************************************* //
|
||||
51
applications/test/syncTools/missing_cell/system/fvSchemes
Normal file
51
applications/test/syncTools/missing_cell/system/fvSchemes
Normal file
@ -0,0 +1,51 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
default Euler;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
grad(p) Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default Gauss linear orthogonal;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default orthogonal;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
52
applications/test/syncTools/missing_cell/system/fvSolution
Normal file
52
applications/test/syncTools/missing_cell/system/fvSolution
Normal file
@ -0,0 +1,52 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2312 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "system";
|
||||
object fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
p
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-06;
|
||||
relTol 0.05;
|
||||
}
|
||||
|
||||
pFinal
|
||||
{
|
||||
$p;
|
||||
relTol 0;
|
||||
}
|
||||
|
||||
U
|
||||
{
|
||||
solver smoothSolver;
|
||||
smoother symGaussSeidel;
|
||||
tolerance 1e-05;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PISO
|
||||
{
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
pRefCell 0;
|
||||
pRefValue 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -8,53 +8,41 @@
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format binary;
|
||||
class volScalarField;
|
||||
object mut;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object topoSetDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [1 -1 -1 0 0 0 0];
|
||||
|
||||
internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
inlet
|
||||
actions
|
||||
(
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
name c0;
|
||||
type cellSet;
|
||||
action new;
|
||||
source labelToCell;
|
||||
value (0);
|
||||
}
|
||||
{
|
||||
name c0;
|
||||
type cellSet;
|
||||
action invert;
|
||||
}
|
||||
|
||||
outlet
|
||||
{
|
||||
type calculated;
|
||||
value uniform 0;
|
||||
name exposed0;
|
||||
type faceSet;
|
||||
action new;
|
||||
source patchToFace;
|
||||
patch exposed0;
|
||||
}
|
||||
|
||||
symmetry
|
||||
{
|
||||
type symmetryPlane;
|
||||
name exposed0;
|
||||
type faceSet;
|
||||
action subset;
|
||||
source boxToFace;
|
||||
box (-100 1 -100)(100 100 100);
|
||||
}
|
||||
|
||||
walls
|
||||
{
|
||||
type mutkWallFunction;
|
||||
Cmu 0.09;
|
||||
kappa 0.41;
|
||||
E 9.8;
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
cabin_to_ice
|
||||
{
|
||||
type mutkWallFunction;
|
||||
Cmu 0.09;
|
||||
kappa 0.41;
|
||||
E 9.8;
|
||||
value uniform 0;
|
||||
}
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -51,7 +51,7 @@ void printConnection(Ostream& os, const label proci, const labelUList& below)
|
||||
// The number of receives - as per gatherList (v2112)
|
||||
void printRecvCount_gatherList
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
const UList<UPstream::commsStruct>& comms,
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
@ -91,7 +91,7 @@ void printRecvCount_gatherList
|
||||
// The number of sends - as per scatterList (v2112)
|
||||
void printSendCount_scatterList
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
const UList<UPstream::commsStruct>& comms,
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
@ -131,7 +131,7 @@ void printSendCount_scatterList
|
||||
// Transmission widths (contiguous data)
|
||||
void printWidths
|
||||
(
|
||||
const List<UPstream::commsStruct>& comms,
|
||||
const UList<UPstream::commsStruct>& comms,
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -579,8 +579,8 @@ inline bool CGAL::indexedCell<Gt, Cb>::potentialCoplanarCell() const
|
||||
|
||||
if (nMasters == 2 && nSlaves == 2)
|
||||
{
|
||||
Foam::vector vp0(Foam::Zero);
|
||||
Foam::vector vp1(Foam::Zero);
|
||||
Foam::vector vp0(Foam::zero{});
|
||||
Foam::vector vp1(Foam::zero{});
|
||||
|
||||
if
|
||||
(
|
||||
|
||||
@ -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) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -220,7 +220,7 @@ PtrList<FieldType> subsetFields
|
||||
const pointMesh& pMesh
|
||||
)
|
||||
{
|
||||
const fvMesh& baseMesh = subsetter.baseMesh();
|
||||
//const fvMesh& baseMesh = subsetter.baseMesh();
|
||||
|
||||
const UPtrList<const IOobject> fieldObjects
|
||||
(
|
||||
@ -247,8 +247,8 @@ PtrList<FieldType> subsetFields
|
||||
IOobject
|
||||
(
|
||||
io.name(),
|
||||
baseMesh.time().timeName(),
|
||||
baseMesh,
|
||||
pMesh.thisDb().time().timeName(),
|
||||
pMesh.thisDb(),
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
IOobjectOption::NO_REGISTER
|
||||
@ -382,6 +382,8 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
|
||||
#include "createNamedMesh.H"
|
||||
// Make sure pointMesh gets constructed/read as well
|
||||
(void)pointMesh::New(mesh, IOobject::READ_IF_PRESENT);
|
||||
|
||||
// arg[1] = word (cellSet) or wordRes (cellZone)
|
||||
// const word selectionName = args[1];
|
||||
@ -583,7 +585,7 @@ int main(int argc, char *argv[])
|
||||
// Read point fields and subset
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||
const pointMesh& pMesh = pointMesh::New(mesh, IOobject::READ_IF_PRESENT);
|
||||
|
||||
#undef createSubsetFields
|
||||
#define createSubsetFields(FieldType, Variable) \
|
||||
@ -663,6 +665,18 @@ int main(int argc, char *argv[])
|
||||
subsetter.subMesh().write();
|
||||
processorMeshes::removeFiles(subsetter.subMesh());
|
||||
|
||||
auto* subPointMeshPtr =
|
||||
subsetter.subMesh().thisDb().findObject<pointMesh>
|
||||
(
|
||||
pointMesh::typeName
|
||||
);
|
||||
if (subPointMeshPtr)
|
||||
{
|
||||
pointMesh& subPointMesh = const_cast<pointMesh&>(*subPointMeshPtr);
|
||||
subPointMesh.setInstance(subsetter.subMesh().facesInstance());
|
||||
subPointMesh.write();
|
||||
}
|
||||
|
||||
|
||||
// Volume fields
|
||||
for (const auto& fld : vScalarFlds) { fld.write(); }
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022,2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -661,6 +661,9 @@ int main(int argc, char *argv[])
|
||||
),
|
||||
decompDictFile
|
||||
);
|
||||
// Make sure pointMesh gets read as well
|
||||
(void)pointMesh::New(mesh, IOobject::READ_IF_PRESENT);
|
||||
|
||||
|
||||
// Decompose the mesh
|
||||
if (!decomposeFieldsOnly)
|
||||
@ -780,6 +783,7 @@ int main(int argc, char *argv[])
|
||||
PtrList<labelIOList> cellProcAddressingList(mesh.nProcs());
|
||||
PtrList<labelIOList> boundaryProcAddressingList(mesh.nProcs());
|
||||
PtrList<labelIOList> pointProcAddressingList(mesh.nProcs());
|
||||
PtrList<labelIOList> pointBoundaryProcAddressingList(mesh.nProcs());
|
||||
|
||||
PtrList<fvFieldDecomposer> fieldDecomposerList(mesh.nProcs());
|
||||
PtrList<pointFieldDecomposer> pointFieldDecomposerList
|
||||
@ -850,7 +854,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Point fields
|
||||
// ~~~~~~~~~~~~
|
||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||
|
||||
// Read decomposed pointMesh
|
||||
const pointMesh& pMesh =
|
||||
pointMesh::New(mesh, IOobject::READ_IF_PRESENT);
|
||||
|
||||
pointFieldDecomposer::fieldsCache pointFieldCache;
|
||||
|
||||
@ -1119,7 +1126,34 @@ int main(int argc, char *argv[])
|
||||
pointProcAddressingList
|
||||
);
|
||||
|
||||
const pointMesh& procPMesh = pointMesh::New(procMesh);
|
||||
const pointMesh& procPMesh =
|
||||
pointMesh::New(procMesh, IOobject::READ_IF_PRESENT);
|
||||
|
||||
if (!pointBoundaryProcAddressingList.set(proci))
|
||||
{
|
||||
pointBoundaryProcAddressingList.set
|
||||
(
|
||||
proci,
|
||||
autoPtr<labelIOList>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"boundaryProcAddressing",
|
||||
procMesh.facesInstance(),
|
||||
polyMesh::meshSubDir
|
||||
/pointMesh::meshSubDir,
|
||||
procPMesh.thisDb(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
boundaryProcAddressing
|
||||
)
|
||||
);
|
||||
}
|
||||
const auto& pointBoundaryProcAddressing =
|
||||
pointBoundaryProcAddressingList[proci];
|
||||
|
||||
|
||||
if (!pointFieldDecomposerList.set(proci))
|
||||
{
|
||||
@ -1131,7 +1165,7 @@ int main(int argc, char *argv[])
|
||||
pMesh,
|
||||
procPMesh,
|
||||
pointProcAddressing,
|
||||
boundaryProcAddressing
|
||||
pointBoundaryProcAddressing
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -1143,6 +1177,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (times.size() == 1)
|
||||
{
|
||||
// Early deletion
|
||||
pointBoundaryProcAddressingList.set
|
||||
(
|
||||
proci,
|
||||
nullptr
|
||||
);
|
||||
pointProcAddressingList.set(proci, nullptr);
|
||||
pointFieldDecomposerList.set(proci, nullptr);
|
||||
}
|
||||
|
||||
@ -44,6 +44,12 @@ License
|
||||
#include "decompositionModel.H"
|
||||
#include "hexRef8Data.H"
|
||||
|
||||
// For handling pointMeshes with additional patches
|
||||
#include "pointMesh.H"
|
||||
#include "meshPointPatch.H"
|
||||
#include "processorPointPatch.H"
|
||||
#include "DynamicField.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::domainDecomposition::mark
|
||||
@ -740,6 +746,101 @@ bool Foam::domainDecomposition::writeDecomposition(const bool decomposeSets)
|
||||
|
||||
procMesh.write();
|
||||
|
||||
// Add pointMesh if it was available
|
||||
const auto* pMeshPtr =
|
||||
thisDb().cfindObject<pointMesh>(pointMesh::typeName);
|
||||
if (pMeshPtr)
|
||||
{
|
||||
const auto& pMesh = *pMeshPtr;
|
||||
const auto& pMeshBoundary = pMesh.boundary();
|
||||
|
||||
|
||||
// 1. Generate pointBoundaryMesh from polyBoundaryMesh (so ignoring
|
||||
// any additional patches
|
||||
const auto& procPointMesh = pointMesh::New(procMesh);
|
||||
|
||||
pointBoundaryMesh& procBoundary =
|
||||
const_cast<pointBoundaryMesh&>(procPointMesh.boundary());
|
||||
|
||||
|
||||
// 2. Explicitly add subsetted meshPointPatches
|
||||
forAll(pMeshBoundary, patchi)
|
||||
{
|
||||
const auto* mppPtr = isA<meshPointPatch>(pMeshBoundary[patchi]);
|
||||
if (mppPtr && (procBoundary.findPatchID(mppPtr->name()) == -1))
|
||||
{
|
||||
const auto& mpp = *mppPtr;
|
||||
|
||||
DynamicList<label> procMeshPoints(mpp.size());
|
||||
DynamicField<vector> procNormals(mpp.size());
|
||||
forAll(mpp.meshPoints(), i)
|
||||
{
|
||||
const label pointi = mpp.meshPoints()[i];
|
||||
const label procPointi = pointLookup[pointi];
|
||||
if (procPointi != -1)
|
||||
{
|
||||
procMeshPoints.append(procPointi);
|
||||
procNormals.append(mpp.pointNormals()[i]);
|
||||
}
|
||||
}
|
||||
|
||||
procBoundary.push_back
|
||||
(
|
||||
new meshPointPatch
|
||||
(
|
||||
mpp.name(),
|
||||
procMeshPoints,
|
||||
procNormals,
|
||||
procBoundary.size(),
|
||||
procBoundary,
|
||||
meshPointPatch::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Shuffle new patches before any processor patches
|
||||
labelList oldToNew(procBoundary.size());
|
||||
label newPatchi = 0;
|
||||
forAll(procBoundary, patchi)
|
||||
{
|
||||
if (!isA<processorPointPatch>(procBoundary[patchi]))
|
||||
{
|
||||
oldToNew[patchi] = newPatchi;
|
||||
newPatchi++;
|
||||
}
|
||||
}
|
||||
|
||||
// decomposed-to-undecomposed patch numbering
|
||||
labelList boundaryProcAddressing(identity(newPatchi));
|
||||
boundaryProcAddressing.setSize(procBoundary.size(), -1);
|
||||
|
||||
forAll(procBoundary, patchi)
|
||||
{
|
||||
if (isA<processorPointPatch>(procBoundary[patchi]))
|
||||
{
|
||||
oldToNew[patchi] = newPatchi++;
|
||||
}
|
||||
}
|
||||
procBoundary.reorder(oldToNew, true);
|
||||
|
||||
// Write pointMesh/boundary
|
||||
procBoundary.write();
|
||||
|
||||
// Write pointMesh/boundaryProcAddressing
|
||||
IOobject ioAddr
|
||||
(
|
||||
"boundaryProcAddressing",
|
||||
procMesh.facesInstance(),
|
||||
polyMesh::meshSubDir/pointMesh::meshSubDir,
|
||||
procPointMesh.thisDb(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
IOListRef<label>(ioAddr, boundaryProcAddressing).write();
|
||||
}
|
||||
|
||||
// Write points if pointsInstance differing from facesInstance
|
||||
if (facesInstancePointsPtr_)
|
||||
{
|
||||
|
||||
@ -411,24 +411,18 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< "Reconstructing point fields" << nl << endl;
|
||||
|
||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
||||
PtrList<pointMesh> pMeshes(procMeshes.meshes().size());
|
||||
|
||||
forAll(pMeshes, proci)
|
||||
{
|
||||
pMeshes.set
|
||||
(
|
||||
proci,
|
||||
new pointMesh(procMeshes.meshes()[proci])
|
||||
);
|
||||
}
|
||||
const pointMesh& pMesh = pointMesh::New
|
||||
(
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
);
|
||||
|
||||
pointFieldReconstructor reconstructor
|
||||
(
|
||||
pMesh,
|
||||
pMeshes,
|
||||
procMeshes.pointMeshes(),
|
||||
procMeshes.pointProcAddressing(),
|
||||
procMeshes.boundaryProcAddressing()
|
||||
procMeshes.pointMeshBoundaryProcAddressing()
|
||||
);
|
||||
|
||||
reconstructor.reconstructAllFields(objects, selectedFields);
|
||||
|
||||
@ -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];
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -34,10 +34,13 @@ Description
|
||||
Extract patch or faceZone surfaces from a polyMesh.
|
||||
Depending on output surface format triangulates faces.
|
||||
|
||||
Region numbers on faces no guaranteed to be the same as the patch indices.
|
||||
Region numbers on faces not guaranteed to be the same as the patch indices.
|
||||
|
||||
Optionally only extracts named patches.
|
||||
|
||||
Optionally filters out points on feature-edges and generates pointPatches
|
||||
for these - written to pointMesh/boundary.
|
||||
|
||||
If run in parallel, processor patches get filtered out by default and
|
||||
the mesh is merged (based on topology).
|
||||
|
||||
@ -48,6 +51,7 @@ Description
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "pointMesh.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "ListListOps.H"
|
||||
@ -55,6 +59,11 @@ Description
|
||||
#include "globalMeshData.H"
|
||||
#include "globalIndex.H"
|
||||
#include "timeSelector.H"
|
||||
#include "meshPointPatch.H"
|
||||
#include "unitConversion.H"
|
||||
#include "dummyTransform.H"
|
||||
#include "syncTools.H"
|
||||
#include "processorPointPatch.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -106,6 +115,551 @@ labelList getSelectedPatches
|
||||
}
|
||||
|
||||
|
||||
label addMeshPointPatches
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const pointMesh& pMesh,
|
||||
|
||||
const uindirectPrimitivePatch& allBoundary,
|
||||
const labelUList& faceToZone,
|
||||
const surfZoneIdentifierList& surfZones,
|
||||
|
||||
const scalar edgeFeatureAngle,
|
||||
const scalar pointFeatureAngle,
|
||||
const bool verbose = true
|
||||
)
|
||||
{
|
||||
const pointBoundaryMesh& pointBm = pMesh.boundary();
|
||||
const label nPointPatches = pointBm.size();
|
||||
|
||||
const globalMeshData& globalData = mesh.globalData();
|
||||
const indirectPrimitivePatch& cpp = globalData.coupledPatch();
|
||||
const mapDistribute& map = globalData.globalEdgeSlavesMap();
|
||||
const auto& mp = allBoundary.meshPoints();
|
||||
|
||||
|
||||
const vector nullVector(vector::uniform(0));
|
||||
const auto assignNonNull = [&](vector& x, const vector& y)
|
||||
{
|
||||
if (x == nullVector && y != nullVector)
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
};
|
||||
|
||||
// Calculate parallel-consistent point normals (as unweighted average
|
||||
// of faceNormals). Note: only valid on patch points, not on mesh points
|
||||
// that are coupled to these.
|
||||
const pointField pointNormals
|
||||
(
|
||||
PatchTools::pointNormals
|
||||
(
|
||||
mesh,
|
||||
allBoundary
|
||||
)
|
||||
);
|
||||
// Expand to all coupled points
|
||||
pointField meshPointNormals(mesh.nPoints(), nullVector);
|
||||
UIndirectList<vector>(meshPointNormals, mp) = pointNormals;
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh,
|
||||
meshPointNormals,
|
||||
assignNonNull,
|
||||
nullVector
|
||||
);
|
||||
|
||||
|
||||
// Find correspondence between allBoundary and coupled edges
|
||||
labelList allEdges;
|
||||
labelList coupledEdges;
|
||||
bitSet sameEdgeOrientation;
|
||||
PatchTools::matchEdges
|
||||
(
|
||||
allBoundary,
|
||||
cpp,
|
||||
allEdges,
|
||||
coupledEdges,
|
||||
sameEdgeOrientation
|
||||
);
|
||||
|
||||
|
||||
|
||||
// To construct the patches we need to know per edge
|
||||
// - patch on either side (if topological feature edge)
|
||||
// - faceNormal on either side (if feature angle)
|
||||
// We need to know per point
|
||||
// - patches on all connected faces
|
||||
// - faceNormals on all connected faces? And compare to average?
|
||||
// or edge normals on all connected edges
|
||||
|
||||
|
||||
typedef Tuple2<label, vector> PN;
|
||||
const PN nullPN(-1, nullVector);
|
||||
|
||||
|
||||
|
||||
// Point-based analysis
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
// Collect per (mesh)point the zones (1, 2 or >2). Note: per mesh to
|
||||
// make it easier to sync. See edge-based code below where we explicitly
|
||||
// have to transfer from patch-edge to mesh-point etc. Note sure which one
|
||||
// fits better....
|
||||
labelPairList pointToZones(mesh.nPoints(), labelPair(-1, -1));
|
||||
{
|
||||
// Combine zones.
|
||||
const auto combineZones = [&](labelPair& x, const labelPair& y)
|
||||
{
|
||||
if (x == labelPair(-2, -2))
|
||||
{
|
||||
// Already marked
|
||||
}
|
||||
else if (y == labelPair(-2, -2))
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find first free slot
|
||||
if (x[0] == -1)
|
||||
{
|
||||
if (y[0] != -1)
|
||||
{
|
||||
x[0] = y[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
x[0] = y[1];
|
||||
}
|
||||
}
|
||||
else if (x[1] == -1)
|
||||
{
|
||||
if (y[0] != -1 && y[0] != x[0])
|
||||
{
|
||||
x[1] = y[0];
|
||||
}
|
||||
else if (y[1] != -1 && y[1] != x[1])
|
||||
{
|
||||
x[1] = y[1];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Both x slots filled. See if y adds a 3rd element
|
||||
if (y[0] != -1 && y[0] != x[0] && y[0] != x[1])
|
||||
{
|
||||
x = labelPair(-2, -2);
|
||||
}
|
||||
else if (y[1] != -1 && y[1] != x[0] && y[1] != x[1])
|
||||
{
|
||||
x = labelPair(-2, -2);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
forAll(allBoundary, facei)
|
||||
{
|
||||
const auto& f = allBoundary[facei];
|
||||
const label zonei = faceToZone[facei];
|
||||
for (const label pointi : f)
|
||||
{
|
||||
auto& pZones = pointToZones[pointi];
|
||||
|
||||
if (pZones != labelPair(-2, -2) && !pZones.contains(zonei))
|
||||
{
|
||||
if (pZones.first() == -1)
|
||||
{
|
||||
pZones.first() = zonei;
|
||||
}
|
||||
else if (pZones.second() == -1)
|
||||
{
|
||||
pZones.second() = zonei;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mark as >2 zones
|
||||
pZones = labelPair(-2, -2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh,
|
||||
pointToZones,
|
||||
combineZones,
|
||||
labelPair(-1, -1),
|
||||
dummyTransform()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Edge-based analysis
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// 1. Local analysis
|
||||
|
||||
List<Pair<PN>> allEdgeToFaces
|
||||
(
|
||||
allBoundary.nEdges(),
|
||||
Pair<PN>(nullPN, nullPN)
|
||||
);
|
||||
{
|
||||
const auto& edgeFaces = allBoundary.edgeFaces();
|
||||
const auto& faceNormals = allBoundary.faceNormals();
|
||||
|
||||
forAll(edgeFaces, edgei)
|
||||
{
|
||||
const auto& eFaces = edgeFaces[edgei];
|
||||
const vector& n0 = faceNormals[eFaces[0]];
|
||||
const label zone0 = faceToZone[eFaces[0]];
|
||||
if (eFaces.size() == 1)
|
||||
{
|
||||
allEdgeToFaces[edgei] = Pair<PN>(PN(zone0, n0), nullPN);
|
||||
}
|
||||
else
|
||||
{
|
||||
const vector& n1 = faceNormals[eFaces[1]];
|
||||
const label zone1 = faceToZone[eFaces[1]];
|
||||
allEdgeToFaces[edgei] = Pair<PN>
|
||||
(
|
||||
PN(zone0, n0),
|
||||
PN(zone1, n1)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 2. Sync across coupled patches
|
||||
|
||||
{
|
||||
// Combine pair of normals
|
||||
const auto vectorPairMax = [&](Pair<PN>& x, const Pair<PN>& y)
|
||||
{
|
||||
if (x[0] == nullPN)
|
||||
{
|
||||
if (y[0] != nullPN)
|
||||
{
|
||||
x[0] = y[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
x[0] = y[1];
|
||||
}
|
||||
}
|
||||
else if (x[1] == nullPN)
|
||||
{
|
||||
if (y[0] != nullPN && y[0] != x[0])
|
||||
{
|
||||
x[1] = y[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
x[1] = y[1];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
List<Pair<PN>> cppEdgeData
|
||||
(
|
||||
map.constructSize(),
|
||||
Pair<PN>(nullPN, nullPN)
|
||||
);
|
||||
UIndirectList<Pair<PN>>(cppEdgeData, coupledEdges) =
|
||||
UIndirectList<Pair<PN>>(allEdgeToFaces, allEdges);
|
||||
|
||||
globalData.syncData
|
||||
(
|
||||
cppEdgeData,
|
||||
globalData.globalEdgeSlaves(),
|
||||
globalData.globalEdgeTransformedSlaves(),
|
||||
map,
|
||||
globalData.globalTransforms(),
|
||||
vectorPairMax,
|
||||
dummyTransform()
|
||||
);
|
||||
|
||||
UIndirectList<Pair<PN>>(allEdgeToFaces, allEdges) =
|
||||
UIndirectList<Pair<PN>>(cppEdgeData, coupledEdges);
|
||||
}
|
||||
|
||||
|
||||
// Now we have all the per-patch edge information
|
||||
// - do inter-patch edges
|
||||
// - do feature-angle edges
|
||||
// Store on mesh points
|
||||
|
||||
const auto assignNonNullPN = [&](PN& x, const PN& y)
|
||||
{
|
||||
if (x.second() == nullVector && y.second() != nullVector)
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Storing the normal for points that are on inter-patch edges
|
||||
vectorField patchEdgeNormal(mesh.nPoints(), nullVector);
|
||||
// Storing the normal for points that are on patch-internal feat edges
|
||||
List<PN> featEdgeNormal(mesh.nPoints(), nullPN);
|
||||
forAll(allEdgeToFaces, edgei)
|
||||
{
|
||||
const edge& e = allBoundary.edges()[edgei];
|
||||
const label mp0 = mp[e[0]];
|
||||
const label mp1 = mp[e[1]];
|
||||
|
||||
const Pair<PN>& facesInfo = allEdgeToFaces[edgei];
|
||||
|
||||
if (facesInfo[1] == nullPN)
|
||||
{
|
||||
// Boundary edge
|
||||
patchEdgeNormal[mp0] = pointNormals[e[0]];
|
||||
patchEdgeNormal[mp1] = pointNormals[e[1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (facesInfo[0].first() != facesInfo[1].first())
|
||||
{
|
||||
// Inter-patch
|
||||
patchEdgeNormal[mp0] = pointNormals[e[0]];
|
||||
patchEdgeNormal[mp1] = pointNormals[e[1]];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Same patch - check for feature angle
|
||||
|
||||
const vector& n0 = facesInfo[0].second();
|
||||
const vector& n1 = facesInfo[1].second();
|
||||
|
||||
if ((n0 & n1) < Foam::cos(degToRad(edgeFeatureAngle)))
|
||||
{
|
||||
if (patchEdgeNormal[mp0] == nullVector)
|
||||
{
|
||||
featEdgeNormal[mp0] = PN
|
||||
(
|
||||
facesInfo[0].first(), // zone
|
||||
pointNormals[e[0]]
|
||||
);
|
||||
}
|
||||
if (patchEdgeNormal[mp1] == nullVector)
|
||||
{
|
||||
featEdgeNormal[mp1] = PN
|
||||
(
|
||||
facesInfo[0].first(), // zone
|
||||
pointNormals[e[1]]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh,
|
||||
patchEdgeNormal,
|
||||
assignNonNull,
|
||||
nullVector
|
||||
);
|
||||
syncTools::syncPointList
|
||||
(
|
||||
mesh,
|
||||
featEdgeNormal,
|
||||
assignNonNullPN,
|
||||
nullPN,
|
||||
dummyTransform()
|
||||
);
|
||||
|
||||
// Make sure that inter-patch points are not also in feature-edge
|
||||
// points. Note: not absolutely nessecary since all inter-patch points
|
||||
// will also be in the 'normal' facePointPatches.
|
||||
|
||||
DynamicList<label> multiZoneMeshPoints(allBoundary.nPoints());
|
||||
forAll(pointToZones, pointi)
|
||||
{
|
||||
if (pointToZones[pointi] == labelPair(-2, -2))
|
||||
{
|
||||
multiZoneMeshPoints.append(pointi);
|
||||
// Unmark as feature angle point
|
||||
patchEdgeNormal[pointi] = nullVector;
|
||||
featEdgeNormal[pointi] = nullPN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DynamicList<label> twoZoneMeshPoints(allBoundary.nPoints());
|
||||
forAll(patchEdgeNormal, pointi)
|
||||
{
|
||||
if (patchEdgeNormal[pointi] != nullVector)
|
||||
{
|
||||
twoZoneMeshPoints.append(pointi);
|
||||
// Unmark as feature angle point
|
||||
featEdgeNormal[pointi] = nullPN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sort featEdgeNormal according to zone
|
||||
List<List<label>> zoneToMeshPoints(surfZones.size());
|
||||
List<vectorField> zoneToNormal(surfZones.size());
|
||||
{
|
||||
labelList sizes(surfZones.size(), 0);
|
||||
forAll(featEdgeNormal, pointi)
|
||||
{
|
||||
const auto& pInfo = featEdgeNormal[pointi];
|
||||
if (pInfo != nullPN)
|
||||
{
|
||||
const label zonei = pInfo.first();
|
||||
sizes[zonei]++;
|
||||
}
|
||||
}
|
||||
forAll(zoneToMeshPoints, zonei)
|
||||
{
|
||||
zoneToMeshPoints[zonei].setSize(sizes[zonei]);
|
||||
zoneToNormal[zonei].setSize(sizes[zonei]);
|
||||
}
|
||||
sizes = 0;
|
||||
forAll(featEdgeNormal, pointi)
|
||||
{
|
||||
const auto& pInfo = featEdgeNormal[pointi];
|
||||
if (pInfo != nullPN)
|
||||
{
|
||||
const label zonei = pInfo.first();
|
||||
const label index = sizes[zonei]++;
|
||||
zoneToMeshPoints[zonei][index] = pointi;
|
||||
zoneToNormal[zonei][index] = pInfo.second();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add patches
|
||||
forAll(zoneToMeshPoints, zonei)
|
||||
{
|
||||
const label nPoints =
|
||||
returnReduce(zoneToMeshPoints[zonei].size(), sumOp<label>());
|
||||
|
||||
const word patchName(surfZones[zonei].name() + "Edges");
|
||||
|
||||
if (nPoints && (pointBm.findPatchID(patchName) == -1))
|
||||
{
|
||||
const_cast<pointBoundaryMesh&>(pointBm).push_back
|
||||
(
|
||||
new meshPointPatch
|
||||
(
|
||||
patchName,
|
||||
zoneToMeshPoints[zonei],
|
||||
zoneToNormal[zonei],
|
||||
pointBm.size(),
|
||||
pointBm,
|
||||
meshPointPatch::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
const auto& ppp = pointBm.last();
|
||||
Info<< "Added feature-edges pointPatch " << ppp.name()
|
||||
<< " with " << nPoints << " points" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add inter-patch points
|
||||
|
||||
const word allEdgePatchName("boundaryEdges");
|
||||
const label nPatchEdgePoints =
|
||||
returnReduce(twoZoneMeshPoints.size(), sumOp<label>());
|
||||
if (nPatchEdgePoints && (pointBm.findPatchID(allEdgePatchName) == -1))
|
||||
{
|
||||
const_cast<pointBoundaryMesh&>(pointBm).push_back
|
||||
(
|
||||
new meshPointPatch
|
||||
(
|
||||
allEdgePatchName,
|
||||
twoZoneMeshPoints,
|
||||
vectorField
|
||||
(
|
||||
patchEdgeNormal, // is pointNormal expanded to all mesh
|
||||
twoZoneMeshPoints
|
||||
),
|
||||
pointBm.size(),
|
||||
pointBm,
|
||||
meshPointPatch::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
const auto& ppp = pointBm.last();
|
||||
Info<< "Added inter-patch pointPatch " << ppp.name()
|
||||
<< " with " << nPatchEdgePoints << " points" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const word allPointPatchName("boundaryPoints");
|
||||
const label nMultiPoints =
|
||||
returnReduce(multiZoneMeshPoints.size(), sumOp<label>());
|
||||
if (nMultiPoints && (pointBm.findPatchID(allPointPatchName) == -1))
|
||||
{
|
||||
const_cast<pointBoundaryMesh&>(pointBm).push_back
|
||||
(
|
||||
new meshPointPatch
|
||||
(
|
||||
allPointPatchName,
|
||||
multiZoneMeshPoints,
|
||||
vectorField
|
||||
(
|
||||
meshPointNormals, // is pointNormal expanded to all mesh
|
||||
multiZoneMeshPoints
|
||||
),
|
||||
pointBm.size(),
|
||||
pointBm,
|
||||
meshPointPatch::typeName
|
||||
)
|
||||
);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
const auto& ppp = pointBm.last();
|
||||
Info<< "Added multi-patch pointPatch " << ppp.name()
|
||||
<< " with " << nMultiPoints << " points" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Shuffle into order
|
||||
labelList oldToNew(pointBm.size());
|
||||
label newPatchi = 0;
|
||||
forAll(pointBm, patchi)
|
||||
{
|
||||
if (!isA<processorPointPatch>(pointBm[patchi]))
|
||||
{
|
||||
oldToNew[patchi] = newPatchi++;
|
||||
}
|
||||
}
|
||||
forAll(pointBm, patchi)
|
||||
{
|
||||
if (isA<processorPointPatch>(pointBm[patchi]))
|
||||
{
|
||||
oldToNew[patchi] = newPatchi++;
|
||||
}
|
||||
}
|
||||
const_cast<pointBoundaryMesh&>(pointBm).reorder(oldToNew, true);
|
||||
|
||||
return pointBm.size() - nPointPatches;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -152,6 +706,12 @@ int main(int argc, char *argv[])
|
||||
true // mark as an advanced option
|
||||
);
|
||||
argList::addOptionCompat("exclude-patches", {"excludePatches", 2306});
|
||||
argList::addOption
|
||||
(
|
||||
"featureAngle",
|
||||
"angle",
|
||||
"Auto-extract feature edges/points and put into separate point-patches"
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
@ -199,9 +759,28 @@ int main(int argc, char *argv[])
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
scalar featureAngle = 180.0;
|
||||
const bool specifiedFeature = args.readIfPresent
|
||||
(
|
||||
"featureAngle",
|
||||
featureAngle
|
||||
);
|
||||
|
||||
Info<< "Reading mesh from time " << runTime.value() << endl;
|
||||
|
||||
#include "createNamedPolyMesh.H"
|
||||
if (specifiedFeature)
|
||||
{
|
||||
Info<< "Detecting all sharp (>" << featureAngle
|
||||
<< " degrees) patch edges." << nl << endl;
|
||||
|
||||
//#include "createNamedPointMesh.H"
|
||||
// Do not read constant/pointMesh - construct from polyMesh only
|
||||
Info<< "Create pointMesh for time = "
|
||||
<< runTime.timeName() << Foam::nl << Foam::endl;
|
||||
(void)pointMesh::New(mesh);
|
||||
}
|
||||
|
||||
|
||||
// User specified times
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
@ -275,6 +854,8 @@ int main(int argc, char *argv[])
|
||||
// Mesh face and compact zone indx
|
||||
DynamicList<label> faceLabels;
|
||||
DynamicList<label> compactZones;
|
||||
// Per compact 'zone' index the name and location
|
||||
surfZoneIdentifierList surfZones;
|
||||
|
||||
{
|
||||
// Collect sizes. Hash on names to handle local-only patches (e.g.
|
||||
@ -316,6 +897,17 @@ int main(int argc, char *argv[])
|
||||
Pstream::broadcast(compactZoneID);
|
||||
|
||||
|
||||
// Zones
|
||||
surfZones.resize_nocopy(compactZoneID.size());
|
||||
forAllConstIters(compactZoneID, iter)
|
||||
{
|
||||
surfZones[*iter] = surfZoneIdentifier(iter.key(), *iter);
|
||||
Info<< "surfZone " << *iter
|
||||
<< " : " << surfZones[*iter].name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
// Rework HashTable into labelList just for speed of conversion
|
||||
labelList patchToCompactZone(bMesh.size(), -1);
|
||||
labelList faceZoneToCompactZone(bMesh.size(), -1);
|
||||
@ -361,7 +953,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Addressing engine for all faces
|
||||
uindirectPrimitivePatch allBoundary
|
||||
const uindirectPrimitivePatch allBoundary
|
||||
(
|
||||
UIndirectList<face>(mesh.faces(), faceLabels),
|
||||
mesh.points()
|
||||
@ -399,7 +991,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Gather all ZoneIDs
|
||||
List<labelList> gatheredZones(Pstream::nProcs());
|
||||
gatheredZones[Pstream::myProcNo()].transfer(compactZones);
|
||||
gatheredZones[Pstream::myProcNo()] = compactZones;
|
||||
Pstream::gatherList(gatheredZones);
|
||||
|
||||
// On master combine all points, faces, zones
|
||||
@ -427,16 +1019,6 @@ int main(int argc, char *argv[])
|
||||
gatheredZones.clear();
|
||||
|
||||
|
||||
// Zones
|
||||
surfZoneIdentifierList surfZones(compactZoneID.size());
|
||||
forAllConstIters(compactZoneID, iter)
|
||||
{
|
||||
surfZones[*iter] = surfZoneIdentifier(iter.key(), *iter);
|
||||
Info<< "surfZone " << *iter
|
||||
<< " : " << surfZones[*iter].name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
UnsortedMeshedSurface<face> unsortedFace
|
||||
(
|
||||
std::move(allPoints),
|
||||
@ -463,6 +1045,31 @@ int main(int argc, char *argv[])
|
||||
|
||||
sortedFace.write(globalCasePath);
|
||||
}
|
||||
|
||||
|
||||
if (specifiedFeature)
|
||||
{
|
||||
// Add edge patches
|
||||
const auto& pMesh = pointMesh::New(mesh);
|
||||
|
||||
const label nAdded = addMeshPointPatches
|
||||
(
|
||||
mesh,
|
||||
pMesh,
|
||||
|
||||
allBoundary, // all patches together
|
||||
compactZones, // originating compactZone
|
||||
surfZones, // per compactZone the index
|
||||
|
||||
featureAngle,
|
||||
featureAngle
|
||||
);
|
||||
|
||||
if (nAdded)
|
||||
{
|
||||
pMesh.boundary().write();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
@ -440,6 +440,15 @@ pointSet_doc
|
||||
}
|
||||
|
||||
|
||||
//- All points of pointpatch
|
||||
{
|
||||
source patchToPoint;
|
||||
patches ("patch.*");
|
||||
// or
|
||||
patch somePatch;
|
||||
}
|
||||
|
||||
|
||||
//- Copy elements from pointSet
|
||||
{
|
||||
source pointToPoint;
|
||||
|
||||
@ -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.
|
||||
|
||||
@ -38,8 +38,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ODESolver_H
|
||||
#define ODESolver_H
|
||||
#ifndef Foam_ODESolver_H
|
||||
#define Foam_ODESolver_H
|
||||
|
||||
#include "ODESystem.H"
|
||||
#include "typeInfo.H"
|
||||
@ -56,10 +56,9 @@ namespace Foam
|
||||
|
||||
class ODESolver
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
// Protected Data
|
||||
|
||||
//- Reference to ODESystem
|
||||
const ODESystem& odes_;
|
||||
@ -106,7 +105,7 @@ public:
|
||||
|
||||
class stepState
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
const bool forward;
|
||||
scalar dxTry;
|
||||
@ -171,14 +170,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the number of equations to solve
|
||||
inline label nEqns() const;
|
||||
//- The number of equations to solve
|
||||
label nEqns() const noexcept { return n_; }
|
||||
|
||||
//- Return access to the absolute tolerance field
|
||||
inline scalarField& absTol();
|
||||
//- Access to the absolute tolerance field
|
||||
scalarField& absTol() noexcept { return absTol_; }
|
||||
|
||||
//- Return access to the relative tolerance field
|
||||
inline scalarField& relTol();
|
||||
//- Access to the relative tolerance field
|
||||
scalarField& relTol() noexcept { return relTol_; }
|
||||
|
||||
//- Resize the ODE solver
|
||||
virtual bool resize() = 0;
|
||||
|
||||
@ -27,36 +27,19 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
inline Foam::label Foam::ODESolver::nEqns() const
|
||||
{
|
||||
return n_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalarField& Foam::ODESolver::absTol()
|
||||
{
|
||||
return absTol_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::scalarField& Foam::ODESolver::relTol()
|
||||
{
|
||||
return relTol_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline void Foam::ODESolver::resizeField(UList<Type>& f, const label n)
|
||||
{
|
||||
f.shallowCopy(UList<Type>(f.begin(), n));
|
||||
// shallowResize
|
||||
f.shallowCopy(f.data(), n);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline void Foam::ODESolver::resizeField(UList<Type>& f) const
|
||||
{
|
||||
resizeField(f, n_);
|
||||
// shallowResize
|
||||
f.shallowCopy(f.data(), n_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -716,8 +716,10 @@ $(pointMeshMapper)/pointPatchMapper.C
|
||||
|
||||
pointPatches = $(pointMesh)/pointPatches
|
||||
$(pointPatches)/pointPatch/pointPatch.C
|
||||
$(pointPatches)/pointPatch/pointPatchNew.C
|
||||
$(pointPatches)/facePointPatch/facePointPatch.C
|
||||
$(pointPatches)/facePointPatch/facePointPatchNew.C
|
||||
$(pointPatches)/meshPointPatch/meshPointPatch.C
|
||||
|
||||
basicPointPatches = $(pointPatches)/basic
|
||||
$(basicPointPatches)/coupled/coupledPointPatch.C
|
||||
|
||||
@ -120,8 +120,11 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null bitSet reference
|
||||
inline static const bitSet& null();
|
||||
//- Return a null bitSet (reference to a nullObject).
|
||||
static const bitSet& null() noexcept
|
||||
{
|
||||
return NullObjectRef<bitSet>();
|
||||
}
|
||||
|
||||
|
||||
//- Declare type-name (with debug switch)
|
||||
|
||||
@ -405,12 +405,6 @@ inline Foam::label Foam::bitSet::find_next(label pos) const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::bitSet& Foam::bitSet::null()
|
||||
{
|
||||
return NullObjectRef<bitSet>();
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::bitSet::all() const
|
||||
{
|
||||
if (empty()) return true; // SIC. boost convention
|
||||
|
||||
@ -81,7 +81,7 @@ Foam::CompactListList<T> Foam::CompactListList<T>::pack_impl
|
||||
|
||||
if (len)
|
||||
{
|
||||
newOffsets.resize(len+1, Zero);
|
||||
newOffsets.resize(len+1, Foam::zero{});
|
||||
|
||||
for (label i = 0; i < len; ++i)
|
||||
{
|
||||
|
||||
@ -138,8 +138,11 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a CompactListList reference to a nullObject
|
||||
inline static const CompactListList<T>& null();
|
||||
//- Return a null CompactListList (reference to a nullObject).
|
||||
static const CompactListList<T>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<CompactListList<T>>();
|
||||
}
|
||||
|
||||
//- Construct by packing together the list of lists
|
||||
template<class SubListType = List<T>>
|
||||
|
||||
@ -29,15 +29,6 @@ License
|
||||
#include "ListOps.H"
|
||||
#include "SubList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::CompactListList<T>& Foam::CompactListList<T>::null()
|
||||
{
|
||||
return NullObjectRef<CompactListList<T>>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
@ -98,7 +89,7 @@ inline Foam::CompactListList<T>::CompactListList
|
||||
const label nVals
|
||||
)
|
||||
:
|
||||
offsets_(mRows+1, Zero),
|
||||
offsets_(mRows+1, Foam::zero{}),
|
||||
values_(nVals)
|
||||
{
|
||||
// Optionally: enforceSizeSanity();
|
||||
@ -113,8 +104,8 @@ inline Foam::CompactListList<T>::CompactListList
|
||||
const Foam::zero
|
||||
)
|
||||
:
|
||||
offsets_(mRows+1, Zero),
|
||||
values_(nVals, Zero)
|
||||
offsets_(mRows+1, Foam::zero{}),
|
||||
values_(nVals, Foam::zero{})
|
||||
{
|
||||
// Optionally: enforceSizeSanity();
|
||||
}
|
||||
@ -128,7 +119,7 @@ inline Foam::CompactListList<T>::CompactListList
|
||||
const T& val
|
||||
)
|
||||
:
|
||||
offsets_(mRows+1, Zero),
|
||||
offsets_(mRows+1, Foam::zero{}),
|
||||
values_(nVals, val)
|
||||
{
|
||||
// Optionally: enforceSizeSanity();
|
||||
@ -387,7 +378,7 @@ inline void Foam::CompactListList<T>::resize
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets_.resize(mRows+1, Zero);
|
||||
offsets_.resize(mRows+1, Foam::zero{});
|
||||
values_.resize(nVals);
|
||||
}
|
||||
}
|
||||
@ -408,7 +399,7 @@ inline void Foam::CompactListList<T>::resize_nocopy
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets_.resize(mRows+1, Zero);
|
||||
offsets_.resize(mRows+1, Foam::zero{});
|
||||
values_.resize_nocopy(nVals);
|
||||
}
|
||||
}
|
||||
@ -430,7 +421,7 @@ inline void Foam::CompactListList<T>::resize
|
||||
}
|
||||
else
|
||||
{
|
||||
offsets_.resize(mRows+1, Zero);
|
||||
offsets_.resize(mRows+1, Foam::zero{});
|
||||
values_.resize(nVals, val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,9 +46,10 @@ SourceFiles
|
||||
#include "zero.H"
|
||||
#include "contiguous.H"
|
||||
#include "stdFoam.H"
|
||||
#include "autoPtr.H"
|
||||
#include "nullObject.H"
|
||||
#include "Hash.H"
|
||||
#include "ListPolicy.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// <algorithm> already included by stdFoam.H
|
||||
#include <iterator>
|
||||
@ -139,8 +140,12 @@ public:
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Return a null FixedList
|
||||
inline static const FixedList<T, N>& null();
|
||||
//- Return a null FixedList (reference to a nullObject).
|
||||
//- Read/write access is questionable
|
||||
static const FixedList<T, N>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<FixedList<T, N>>();
|
||||
}
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -28,15 +28,6 @@ License
|
||||
|
||||
#include "UList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T, unsigned N>
|
||||
inline const Foam::FixedList<T, N>& Foam::FixedList<T, N>::null()
|
||||
{
|
||||
return NullObjectRef<FixedList<T, N>>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, unsigned N>
|
||||
|
||||
@ -129,8 +129,12 @@ public:
|
||||
|
||||
// Static Member Functions
|
||||
|
||||
//- Return a null List
|
||||
inline static const List<T>& null();
|
||||
//- Return a null List (reference to a nullObject).
|
||||
//- Behaves like an empty List.
|
||||
static const List<T>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<List<T>>();
|
||||
}
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -133,13 +133,6 @@ inline Foam::autoPtr<Foam::List<T>> Foam::List<T>::clone() const
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::List<T>& Foam::List<T>::null()
|
||||
{
|
||||
return NullObjectRef<List<T>>();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::List<T>::clear()
|
||||
{
|
||||
|
||||
@ -73,8 +73,12 @@ public:
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Return a null SubList
|
||||
inline static const SubList<T>& null();
|
||||
//- Return a null SubList (reference to a nullObject).
|
||||
//- Behaves like an empty SubList.
|
||||
static const SubList<T>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<SubList<T>>();
|
||||
}
|
||||
|
||||
|
||||
// Generated Methods
|
||||
|
||||
@ -28,15 +28,6 @@ License
|
||||
|
||||
#include "FixedList.H"
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::SubList<T>& Foam::SubList<T>::null()
|
||||
{
|
||||
return NullObjectRef<SubList<T>>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
@ -124,7 +115,7 @@ inline Foam::SubList<T>::SubList
|
||||
template<class T>
|
||||
inline Foam::UList<T>& Foam::SubList<T>::reset(std::nullptr_t) noexcept
|
||||
{
|
||||
UList<T>::shallowCopy(nullptr, 0);
|
||||
UList<T>::shallowCopy(nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -183,8 +183,12 @@ public:
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Return a UList reference to a nullObject
|
||||
inline static const UList<T>& null();
|
||||
//- Return a null UList (reference to a nullObject).
|
||||
//- Behaves like an empty UList.
|
||||
static const UList<T>& null() noexcept
|
||||
{
|
||||
return NullObjectRef<UList<T>>();
|
||||
}
|
||||
|
||||
|
||||
// Public Classes
|
||||
@ -367,6 +371,9 @@ public:
|
||||
//- Copy the pointer and size
|
||||
inline void shallowCopy(T* __restrict__ ptr, const label len) noexcept;
|
||||
|
||||
//- Copy nullptr and zero size
|
||||
inline void shallowCopy(std::nullptr_t) noexcept;
|
||||
|
||||
//- Copy the pointer and size held by the given UList
|
||||
inline void shallowCopy(const UList<T>& list) noexcept;
|
||||
|
||||
|
||||
@ -93,13 +93,6 @@ inline void Foam::UList<T>::fill_uniform(const Foam::zero)
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
inline const Foam::UList<T>& Foam::UList<T>::null()
|
||||
{
|
||||
return NullObjectRef<UList<T>>();
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::label Foam::UList<T>::fcIndex(const label i) const noexcept
|
||||
{
|
||||
@ -330,6 +323,14 @@ inline void Foam::UList<T>::shallowCopy
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::UList<T>::shallowCopy(std::nullptr_t) noexcept
|
||||
{
|
||||
size_ = 0;
|
||||
v_ = nullptr;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline void Foam::UList<T>::shallowCopy(const UList<T>& list) noexcept
|
||||
{
|
||||
|
||||
@ -116,7 +116,7 @@ Foam::labelListList Foam::invertOneToMany
|
||||
const labelUList& map
|
||||
)
|
||||
{
|
||||
labelList sizes(len, Zero);
|
||||
labelList sizes(len, Foam::zero{});
|
||||
|
||||
for (const label newIdx : map)
|
||||
{
|
||||
|
||||
@ -707,7 +707,7 @@ void Foam::invertManyToMany
|
||||
)
|
||||
{
|
||||
// The output list sizes
|
||||
labelList sizes(len, Zero);
|
||||
labelList sizes(len, Foam::zero{});
|
||||
|
||||
for (const InputIntListType& sublist : input)
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,7 +30,7 @@ License
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
Foam::label Foam::Detail::PtrListDetail<T>::count() const noexcept
|
||||
Foam::label Foam::Detail::PtrListDetail<T>::count_nonnull() const noexcept
|
||||
{
|
||||
label n = 0;
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -95,8 +95,8 @@ public:
|
||||
//- Return pointer to element or nullptr for out-of-range access.
|
||||
inline T* get(const label i);
|
||||
|
||||
//- Return the number of non-null entries
|
||||
label count() const noexcept;
|
||||
//- The number of non-nullptr entries in the list
|
||||
label count_nonnull() const noexcept;
|
||||
|
||||
//- FatalError if any null exists in the list
|
||||
inline void checkNonNull() const;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,8 +40,8 @@ Foam::Ostream& Foam::Detail::PtrListDetail<T>::write
|
||||
{
|
||||
const label len = this->size();
|
||||
|
||||
// The net length (after trimming any nullptr)
|
||||
const label netLen = (trimNull ? this->count() : len);
|
||||
// The net length, optionally after trimming any nullptr
|
||||
const label netLen = (trimNull ? this->count_nonnull() : len);
|
||||
|
||||
if (!netLen)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -257,8 +257,8 @@ public:
|
||||
//- Size of the underlying storage.
|
||||
inline label capacity() const noexcept;
|
||||
|
||||
//- The number of non-null entries in the list
|
||||
inline label count() const noexcept;
|
||||
//- The number of non-nullptr entries in the list
|
||||
inline label count_nonnull() const noexcept;
|
||||
|
||||
//- Reference to the first element of the list
|
||||
inline T& front();
|
||||
@ -648,6 +648,10 @@ public:
|
||||
//- Move append another list to the end of this list.
|
||||
//FOAM_DEPRECATED_FOR(2022-10, "push_back()")
|
||||
void append(UPtrList<T>&& other) { this->push_back(std::move(other)); }
|
||||
|
||||
//- The number of non-nullptr entries in the list
|
||||
FOAM_DEPRECATED_FOR(2024-01, "count_nonnull()")
|
||||
label count() const noexcept { return count_nonnull(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -124,9 +124,9 @@ inline Foam::label Foam::UPtrList<T>::capacity() const noexcept
|
||||
|
||||
|
||||
template<class T>
|
||||
inline Foam::label Foam::UPtrList<T>::count() const noexcept
|
||||
inline Foam::label Foam::UPtrList<T>::count_nonnull() const noexcept
|
||||
{
|
||||
return ptrs_.count();
|
||||
return ptrs_.count_nonnull();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -132,7 +132,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- True if compiled with libz support
|
||||
static bool supports_gz();
|
||||
static bool supports_gz() noexcept;
|
||||
|
||||
|
||||
// Access
|
||||
@ -276,7 +276,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- True if compiled with libz support
|
||||
static bool supports_gz();
|
||||
static bool supports_gz() noexcept;
|
||||
|
||||
|
||||
// Access
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,7 +40,7 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::ifstreamPointer::supports_gz()
|
||||
bool Foam::ifstreamPointer::supports_gz() noexcept
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
return true;
|
||||
@ -50,7 +50,7 @@ bool Foam::ifstreamPointer::supports_gz()
|
||||
}
|
||||
|
||||
|
||||
bool Foam::ofstreamPointer::supports_gz()
|
||||
bool Foam::ofstreamPointer::supports_gz() noexcept
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
return true;
|
||||
@ -71,7 +71,7 @@ Foam::ifstreamPointer::ifstreamPointer
|
||||
IOstreamOption streamOpt // Currently unused
|
||||
)
|
||||
:
|
||||
ptr_(nullptr)
|
||||
ptr_()
|
||||
{
|
||||
open(pathname, streamOpt);
|
||||
}
|
||||
@ -82,7 +82,7 @@ Foam::ifstreamPointer::ifstreamPointer
|
||||
const fileName& pathname
|
||||
)
|
||||
:
|
||||
ptr_(nullptr)
|
||||
ptr_()
|
||||
{
|
||||
open(pathname);
|
||||
}
|
||||
@ -110,7 +110,7 @@ Foam::ofstreamPointer::ofstreamPointer
|
||||
const bool atomic
|
||||
)
|
||||
:
|
||||
ptr_(nullptr),
|
||||
ptr_(),
|
||||
atomic_(atomic)
|
||||
{
|
||||
std::ios_base::openmode mode
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -468,6 +468,41 @@ inline IOstream& scientific(IOstream& io)
|
||||
namespace Detail
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Detail::StreamAllocator Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
//- A wrapper to hold a std::stream type for OpenFOAM wrapped streams.
|
||||
//- This is necessary since the OpenFOAM streams hold a reference to
|
||||
//- the normal std::stream
|
||||
template<class StreamType>
|
||||
class StreamAllocator
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- The std::stream
|
||||
StreamType stream_;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct (empty)
|
||||
StreamAllocator() = default;
|
||||
};
|
||||
|
||||
|
||||
} // End namespace Detail
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Functions/Algorithms
|
||||
|
||||
namespace Detail
|
||||
{
|
||||
|
||||
//- Termination for input looping (no-op)
|
||||
template<class IS> inline void inputLoop(IS&) {}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,6 +71,33 @@ public:
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Receive and deserialize a value.
|
||||
//- Uses \c operator>> for de-serialization
|
||||
template<class Type>
|
||||
static void recv
|
||||
(
|
||||
Type& value,
|
||||
const int fromProcNo,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
)
|
||||
{
|
||||
IPstream is
|
||||
(
|
||||
UPstream::commsTypes::scheduled,
|
||||
fromProcNo,
|
||||
0, // bufSize
|
||||
tag,
|
||||
comm,
|
||||
fmt
|
||||
);
|
||||
is >> value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
Copyright (C) 2021-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,6 +71,73 @@ public:
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
);
|
||||
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- Serialize a value and send (buffered/blocking or standard mode).
|
||||
//- Uses \c operator<< for serialization
|
||||
template<class Type>
|
||||
static void send
|
||||
(
|
||||
const Type& value,
|
||||
//! blocking or scheduled only!
|
||||
const UPstream::commsTypes commsType,
|
||||
const int toProcNo,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
)
|
||||
{
|
||||
OPstream os(commsType, toProcNo, 0, tag, comm, fmt);
|
||||
os << value;
|
||||
}
|
||||
|
||||
//- Serialize a value and send (buffered/blocking mode).
|
||||
//- Uses \c operator<< for serialization
|
||||
template<class Type>
|
||||
static void bsend
|
||||
(
|
||||
const Type& value,
|
||||
const int toProcNo,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
)
|
||||
{
|
||||
OPstream::send
|
||||
(
|
||||
value,
|
||||
UPstream::commsTypes::blocking,
|
||||
toProcNo,
|
||||
tag,
|
||||
comm,
|
||||
fmt
|
||||
);
|
||||
}
|
||||
|
||||
//- Serialize a value and send (standard mode).
|
||||
//- Uses \c operator<< for serialization
|
||||
template<class Type>
|
||||
static void send
|
||||
(
|
||||
const Type& value,
|
||||
const int toProcNo,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm,
|
||||
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
|
||||
)
|
||||
{
|
||||
OPstream::send
|
||||
(
|
||||
value,
|
||||
UPstream::commsTypes::scheduled,
|
||||
toProcNo,
|
||||
tag,
|
||||
comm,
|
||||
fmt
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,9 +47,6 @@ SourceFiles
|
||||
#include "UPstream.H"
|
||||
#include "DynamicList.H"
|
||||
|
||||
// Legacy
|
||||
// #define Foam_Pstream_scatter_nobroadcast
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -130,22 +127,9 @@ public:
|
||||
|
||||
// Gather
|
||||
|
||||
//- Gather (reduce) data, appyling \c bop to combine \c value
|
||||
//- from different processors. The basis for Foam::reduce().
|
||||
// Uses the specified communication schedule.
|
||||
template<class T, class BinaryOp>
|
||||
static void gather
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
T& value,
|
||||
const BinaryOp& bop,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Gather (reduce) data, applying \c bop to combine \c value
|
||||
//- from different processors. The basis for Foam::reduce().
|
||||
// Uses linear/tree communication.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class T, class BinaryOp>
|
||||
static void gather
|
||||
(
|
||||
@ -155,46 +139,46 @@ public:
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Gather individual values into list locations.
|
||||
// On master list length == nProcs, otherwise zero length.
|
||||
// \n
|
||||
// For \b non-parallel :
|
||||
// the returned list length is 1 with localValue.
|
||||
template<class T>
|
||||
static List<T> listGatherValues
|
||||
(
|
||||
const T& localValue,
|
||||
const label comm = UPstream::worldComm,
|
||||
//! Only used for non-contiguous types
|
||||
const int tag = UPstream::msgType()
|
||||
);
|
||||
|
||||
//- Scatter individual values from list locations.
|
||||
// On master input list length == nProcs, ignored on other procs.
|
||||
// \n
|
||||
// For \b non-parallel :
|
||||
// returns the first list element (or default initialized).
|
||||
template<class T>
|
||||
static T listScatterValues
|
||||
(
|
||||
const UList<T>& allValues,
|
||||
const label comm = UPstream::worldComm,
|
||||
//! Only used for non-contiguous types
|
||||
const int tag = UPstream::msgType()
|
||||
);
|
||||
|
||||
|
||||
// Gather/combine data
|
||||
// Inplace combine values from processors.
|
||||
// (Uses construct from Istream instead of <<)
|
||||
// (Uses construct from Istream instead of \c << operator)
|
||||
|
||||
//- Gather data, applying \c cop to inplace combine \c value
|
||||
//- from different processors.
|
||||
// Uses the specified communication schedule.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class T, class CombineOp>
|
||||
static void combineGather
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Gather data, applying \c cop to inplace combine \c value
|
||||
//- from different processors.
|
||||
// Uses linear/tree communication.
|
||||
template<class T, class CombineOp>
|
||||
static void combineGather
|
||||
(
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Reduce inplace (cf. MPI Allreduce)
|
||||
//- applying \c cop to inplace combine \c value
|
||||
//- from different processors.
|
||||
//- After completion all processors have the same data.
|
||||
// Uses the specified communication schedule.
|
||||
// Wraps combineGather/broadcast (may change in the future).
|
||||
template<class T, class CombineOp>
|
||||
static void combineReduce
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
//! [in,out]
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
@ -210,6 +194,7 @@ public:
|
||||
template<class T, class CombineOp>
|
||||
static void combineReduce
|
||||
(
|
||||
//! [in,out]
|
||||
T& value,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
@ -232,30 +217,25 @@ public:
|
||||
|
||||
// Combine variants working on whole List at a time.
|
||||
|
||||
//- Combines List elements.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class T, class CombineOp>
|
||||
static void listCombineGather
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Like above but switches between linear/tree communication
|
||||
template<class T, class CombineOp>
|
||||
static void listCombineGather
|
||||
(
|
||||
List<T>& values,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Combines List elements.
|
||||
//- After completion all processors have the same data.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class T, class CombineOp>
|
||||
static void listCombineReduce
|
||||
(
|
||||
//! [in,out] - List (not UList) due to broadcast()
|
||||
List<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
@ -266,6 +246,7 @@ public:
|
||||
template<class T, class CombineOp>
|
||||
static void listCombineAllGather
|
||||
(
|
||||
//! [in,out] - List (not UList) due to broadcast()
|
||||
List<T>& values,
|
||||
const CombineOp& cop,
|
||||
const int tag = UPstream::msgType(),
|
||||
@ -279,17 +260,8 @@ public:
|
||||
// Combine variants working on whole map at a time.
|
||||
// Container needs iterators, find() and insert methods defined.
|
||||
|
||||
template<class Container, class CombineOp>
|
||||
static void mapCombineGather
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
Container& values,
|
||||
const CombineOp& cop,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Like above but switches between linear/tree communication
|
||||
//- Combine Map elements.
|
||||
// Uses linear/tree communication (with parallel guard).
|
||||
template<class Container, class CombineOp>
|
||||
static void mapCombineGather
|
||||
(
|
||||
@ -338,8 +310,9 @@ public:
|
||||
template<class T>
|
||||
static void gatherList
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const UList<commsStruct>& comms,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
@ -349,133 +322,48 @@ public:
|
||||
template<class T>
|
||||
static void gatherList
|
||||
(
|
||||
List<T>& values,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Gather data, but keep individual values separate.
|
||||
//- Uses linear/tree communication.
|
||||
//- Uses MPI_Allgather or manual linear/tree communication.
|
||||
// After completion all processors have the same data.
|
||||
// Wraps gatherList/scatterList (may change in the future).
|
||||
template<class T>
|
||||
static void allGatherList
|
||||
(
|
||||
List<T>& values,
|
||||
//! [in,out]
|
||||
UList<T>& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
|
||||
// Scatter
|
||||
// Scatter
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note comms and tag parameters only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void scatter
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
T& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
//- Inverse of gatherList.
|
||||
//- Uses the specified communication schedule.
|
||||
template<class T>
|
||||
static void scatterList
|
||||
(
|
||||
const UList<commsStruct>& comms,
|
||||
UList<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note tag parameter only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void scatter
|
||||
(
|
||||
T& value,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note tag parameter only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void combineScatter
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
T& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note tag parameter only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void combineScatter
|
||||
(
|
||||
T& value,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note comms and tag parameters only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void listCombineScatter
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
List<T>& value,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
// \note comms and tag parameters only used when
|
||||
// Foam_Pstream_scatter_nobroadcast is defined
|
||||
template<class T>
|
||||
static void listCombineScatter
|
||||
(
|
||||
List<T>& value,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
//- Broadcast data: Distribute without modification.
|
||||
template<class Container>
|
||||
static void mapCombineScatter
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
Container& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Like above but switches between linear/tree communication
|
||||
template<class Container>
|
||||
static void mapCombineScatter
|
||||
(
|
||||
Container& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
|
||||
//- Scatter data. Reverse of gatherList
|
||||
template<class T>
|
||||
static void scatterList
|
||||
(
|
||||
const List<commsStruct>& comms,
|
||||
List<T>& values,
|
||||
const int tag,
|
||||
const label comm
|
||||
);
|
||||
|
||||
//- Like above but switches between linear/tree communication
|
||||
template<class T>
|
||||
static void scatterList
|
||||
(
|
||||
List<T>& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
//- Inverse of gatherList.
|
||||
//- Uses linear/tree communication.
|
||||
template<class T>
|
||||
static void scatterList
|
||||
(
|
||||
UList<T>& values,
|
||||
const int tag = UPstream::msgType(),
|
||||
const label comm = UPstream::worldComm
|
||||
);
|
||||
|
||||
|
||||
// Exchange
|
||||
@ -654,6 +542,61 @@ public:
|
||||
const label comm,
|
||||
const bool wait = true //!< (ignored)
|
||||
);
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- \deprecated(2024-01) Broadcast data
|
||||
template<class T>
|
||||
FOAM_DEPRECATED_FOR(2024-01, "Pstream::broadcast()")
|
||||
static void scatter
|
||||
(
|
||||
T& value,
|
||||
const int tag = UPstream::msgType(), //!< ignored
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
|
||||
//- \deprecated(2024-01) Broadcast data
|
||||
template<class T>
|
||||
FOAM_DEPRECATED_FOR(2024-01, "Pstream::broadcast()")
|
||||
static void combineScatter
|
||||
(
|
||||
T& value,
|
||||
const int tag = UPstream::msgType(), //!< ignored
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
|
||||
//- \deprecated(2024-01) Broadcast data
|
||||
template<class T>
|
||||
FOAM_DEPRECATED_FOR(2024-01, "Pstream::broadcast()")
|
||||
static void listCombineScatter
|
||||
(
|
||||
List<T>& value,
|
||||
const int tag = UPstream::msgType(), //!< ignored
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Pstream::broadcast(value, comm);
|
||||
}
|
||||
|
||||
//- \deprecated(2024-01) Broadcast data
|
||||
template<class Container>
|
||||
FOAM_DEPRECATED_FOR(2024-01, "Pstream::broadcast()")
|
||||
static void mapCombineScatter
|
||||
(
|
||||
Container& values,
|
||||
const int tag = UPstream::msgType(), //!< ignored
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Pstream::broadcast(values, comm);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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.
|
||||
@ -137,4 +137,32 @@ void Foam::Pstream::broadcastList(ListType& list, const label comm)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Convenience wrappers - defined after all specialisations are known
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//- Return a broadcasted value (uses a copy internally)
|
||||
template<class Type>
|
||||
Type returnBroadcast
|
||||
(
|
||||
const Type& value,
|
||||
const label comm = UPstream::worldComm
|
||||
)
|
||||
{
|
||||
Type work(value);
|
||||
Pstream::broadcast(work, comm);
|
||||
return work;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user