MRG: Integrated Foundation code to commit 19e602b

This commit is contained in:
Andrew Heather
2017-03-28 11:30:10 +01:00
227 changed files with 2746 additions and 2715 deletions

View File

@ -4,4 +4,5 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lfvOptions \
-lmeshTools -lmeshTools

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -184,7 +184,8 @@ public:
//- Evaluate the patch field //- Evaluate the patch field
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType=
Pstream::commsTypes::blocking
); );
//- Return face-gradient transform diagonal //- Return face-gradient transform diagonal

View File

@ -2,11 +2,11 @@
Info<< "Reading thermophysical properties\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiThermo> pThermo autoPtr<fluidThermo> pThermo
( (
psiThermo::New(mesh) fluidThermo::New(mesh)
); );
psiThermo& thermo = pThermo(); fluidThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
@ -40,27 +40,7 @@ volVectorField U
#include "compressibleCreatePhi.H" #include "compressibleCreatePhi.H"
dimensionedScalar rhoMax pressureControl pressureControl(p, rho, pimple.dict(), false);
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
pimple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
pimple.dict(),
dimDensity,
0
)
);
Info<< "Creating turbulence model\n" << endl; Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence autoPtr<compressible::turbulenceModel> turbulence

View File

@ -1,8 +1,3 @@
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
@ -12,55 +7,54 @@ if (pimple.nCorrPISO() <= 1)
tUEqn.clear(); tUEqn.clear();
} }
surfaceScalarField phiHbyA
(
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF);
if (pimple.transonic()) if (pimple.transonic())
{ {
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
fvc::interpolate(psi) (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA
*(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)/fvc::interpolate(rho)
)
); );
phiHbyA -= fvc::interpolate(p)*phid;
MRF.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rhorAUf, p) - fvm::laplacian(rhorAUf, p)
== ==
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
// Relax the pressure equation to ensure diagonal-dominance
pEqn.relax();
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
phi == pEqn.flux(); phi = phiHbyA + pEqn.flux();
} }
} }
} }
else else
{ {
surfaceScalarField phiHbyA
(
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
)
);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
@ -87,19 +81,20 @@ else
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
// Recalculate density from the relaxed pressure
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl;
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
pressureControl.limit(p);
p.correctBoundaryConditions();
rho = thermo.rho();
if (!pimple.transonic())
{
rho.relax();
}
if (thermo.dpdt()) if (thermo.dpdt())
{ {
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);

View File

@ -1,8 +1,3 @@
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
@ -12,72 +7,64 @@ if (pimple.nCorrPISO() <= 1)
tUEqn.clear(); tUEqn.clear();
} }
surfaceScalarField phiHbyA
(
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
)
);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF);
if (pimple.transonic()) if (pimple.transonic())
{ {
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
fvc::interpolate(psi) (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA
*(
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
/fvc::interpolate(rho)
)
); );
MRF.makeRelative(fvc::interpolate(psi), phid); phiHbyA +=
surfaceScalarField phic
(
"phic",
fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf() fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf()
); - fvc::interpolate(p)*phid;
HbyA -= (rAU - rAtU)*fvc::grad(p); HbyA -= (rAU - rAtU)*fvc::grad(p);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
+ fvm::div(phid, p) + fvm::div(phid, p)
+ fvc::div(phic)
- fvm::laplacian(rhorAtU, p) - fvm::laplacian(rhorAtU, p)
== ==
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
// Relax the pressure equation to ensure diagonal-dominance
pEqn.relax();
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
phi == phic + pEqn.flux(); phi = phiHbyA + pEqn.flux();
} }
} }
} }
else else
{ {
surfaceScalarField phiHbyA
(
"phiHbyA",
(
fvc::flux(rho*HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
)
);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf(); phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf();
HbyA -= (rAU - rAtU)*fvc::grad(p); HbyA -= (rAU - rAtU)*fvc::grad(p);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
@ -109,19 +96,16 @@ U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
if (thermo.dpdt()) pressureControl.limit(p);
{ p.correctBoundaryConditions();
dpdt = fvc::ddt(p);
}
// Recalculate density from the relaxed pressure
rho = thermo.rho(); rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
if (!pimple.transonic()) if (!pimple.transonic())
{ {
rho.relax(); rho.relax();
} }
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl; if (thermo.dpdt())
{
dpdt = fvc::ddt(p);
}

View File

@ -1,8 +1,3 @@
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
@ -12,55 +7,53 @@ if (pimple.nCorrPISO() <= 1)
tUEqn.clear(); tUEqn.clear();
} }
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
);
fvc::makeRelative(phiHbyA, rho, U);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF);
if (pimple.transonic()) if (pimple.transonic())
{ {
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
fvc::interpolate(psi) (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA
*(
fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)/fvc::interpolate(rho)
)
); );
phiHbyA -= fvc::interpolate(p)*phid;
fvc::makeRelative(phid, psi, U);
MRF.makeRelative(fvc::interpolate(psi), phid);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phiHbyA)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rhorAUf, p) - fvm::laplacian(rhorAUf, p)
== ==
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
); );
// Relax the pressure equation to ensure diagonal-dominance
pEqn.relax();
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter()))); pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
{ {
phi == pEqn.flux(); phi = phiHbyA + pEqn.flux();
} }
} }
} }
else else
{ {
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(rho*HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, rhoUf)
);
fvc::makeRelative(phiHbyA, rho, U);
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
// Pressure corrector // Pressure corrector
@ -88,19 +81,20 @@ else
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
p.relax(); p.relax();
// Recalculate density from the relaxed pressure
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl;
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
pressureControl.limit(p);
p.correctBoundaryConditions();
rho = thermo.rho();
if (!pimple.transonic())
{
rho.relax();
}
{ {
rhoUf = fvc::interpolate(rho*U); rhoUf = fvc::interpolate(rho*U);
surfaceVectorField n(mesh.Sf()/mesh.magSf()); surfaceVectorField n(mesh.Sf()/mesh.magSf());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application Application
rhoPimpleFoam rhoPimpleDyMFoam
Group Group
grpCompressibleSolvers grpMovingMeshSolvers grpCompressibleSolvers grpMovingMeshSolvers
@ -38,10 +38,11 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "psiThermo.H" #include "fluidThermo.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "bound.H" #include "bound.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureControl.H"
#include "CorrectPhi.H" #include "CorrectPhi.H"
#include "fvOptions.H" #include "fvOptions.H"
#include "localEulerDdtScheme.H" #include "localEulerDdtScheme.H"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,10 +37,11 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "psiThermo.H" #include "fluidThermo.H"
#include "turbulentFluidThermoModel.H" #include "turbulentFluidThermoModel.H"
#include "bound.H" #include "bound.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "pressureControl.H"
#include "fvOptions.H" #include "fvOptions.H"
#include "localEulerDdtScheme.H" #include "localEulerDdtScheme.H"
#include "fvcSmooth.H" #include "fvcSmooth.H"

View File

@ -1,5 +1,5 @@
Info<< "Reading thermophysical properties\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoThermo> pThermo
autoPtr<fluidThermo> pThermo autoPtr<fluidThermo> pThermo
( (
fluidThermo::New(mesh) fluidThermo::New(mesh)
@ -7,6 +7,8 @@ autoPtr<fluidThermo> pThermo
fluidThermo& thermo = pThermo(); fluidThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
volScalarField& p = thermo.p();
volScalarField rho volScalarField rho
( (
IOobject IOobject
@ -20,8 +22,6 @@ volScalarField rho
thermo.rho() thermo.rho()
); );
volScalarField& p = thermo.p();
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U volVectorField U
( (
@ -40,34 +40,8 @@ volVectorField U
pressureControl pressureControl(p, rho, simple.dict()); pressureControl pressureControl(p, rho, simple.dict());
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, simple.dict(), pRefCell, pRefValue);
mesh.setFluxRequired(p.name()); mesh.setFluxRequired(p.name());
dimensionedScalar rhoMax
(
dimensionedScalar::lookupOrDefault
(
"rhoMax",
simple.dict(),
dimDensity,
GREAT
)
);
dimensionedScalar rhoMin
(
dimensionedScalar::lookupOrDefault
(
"rhoMin",
simple.dict(),
dimDensity,
0
)
);
Info<< "Creating turbulence model\n" << endl; Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence autoPtr<compressible::turbulenceModel> turbulence
( (

View File

@ -8,16 +8,18 @@
bool closedVolume = false; bool closedVolume = false;
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF);
if (simple.transonic()) if (simple.transonic())
{ {
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
surfaceScalarField rhof(fvc::interpolate(rho));
MRF.makeRelative(rhof, phiHbyA);
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
(fvc::interpolate(psi)/rhof)*phiHbyA (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA
); );
phiHbyA -= fvc::interpolate(p)*phid; phiHbyA -= fvc::interpolate(p)*phid;
@ -51,14 +53,8 @@
} }
else else
{ {
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
closedVolume = adjustPhi(phiHbyA, U, p); closedVolume = adjustPhi(phiHbyA, U, p);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAUf, MRF);
while (simple.correctNonOrthogonal()) while (simple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn

View File

@ -5,16 +5,20 @@ tUEqn.clear();
bool closedVolume = false; bool closedVolume = false;
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF);
if (simple.transonic()) if (simple.transonic())
{ {
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
surfaceScalarField rhof(fvc::interpolate(rho));
MRF.makeRelative(rhof, phiHbyA);
surfaceScalarField phid surfaceScalarField phid
( (
"phid", "phid",
(fvc::interpolate(psi)/rhof)*phiHbyA (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA
); );
phiHbyA += phiHbyA +=
@ -23,14 +27,12 @@ if (simple.transonic())
HbyA -= (rAU - rAtU)*fvc::grad(p); HbyA -= (rAU - rAtU)*fvc::grad(p);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
while (simple.correctNonOrthogonal()) while (simple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::div(phid, p) fvc::div(phiHbyA)
+ fvc::div(phiHbyA) + fvm::div(phid, p)
- fvm::laplacian(rhorAtU, p) - fvm::laplacian(rhorAtU, p)
== ==
fvOptions(psi, p, rho.name()) fvOptions(psi, p, rho.name())
@ -55,19 +57,11 @@ if (simple.transonic())
} }
else else
{ {
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA));
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
closedVolume = adjustPhi(phiHbyA, U, p); closedVolume = adjustPhi(phiHbyA, U, p);
phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf(); phiHbyA += fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf();
HbyA -= (rAU - rAtU)*fvc::grad(p); HbyA -= (rAU - rAtU)*fvc::grad(p);
volScalarField rhorAtU("rhorAtU", rho*rAtU);
// Update the pressure BCs to ensure flux consistency
constrainPressure(p, rho, U, phiHbyA, rhorAtU, MRF);
while (simple.correctNonOrthogonal()) while (simple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn

View File

@ -2,46 +2,57 @@
word alphaScheme("div(phi,alpha)"); word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)"); word alpharScheme("div(phirb,alpha)");
tmp<fv::ddtScheme<scalar>> ddtAlpha
(
fv::ddtScheme<scalar>::New
(
mesh,
mesh.ddtScheme("ddt(alpha)")
)
);
// Set the off-centering coefficient according to ddt scheme // Set the off-centering coefficient according to ddt scheme
scalar ocCoeff = 0; scalar ocCoeff = 0;
if
(
isType<fv::EulerDdtScheme<scalar>>(ddtAlpha())
|| isType<fv::localEulerDdtScheme<scalar>>(ddtAlpha())
)
{ {
ocCoeff = 0; tmp<fv::ddtScheme<scalar>> tddtAlpha
} (
else if (isType<fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha())) fv::ddtScheme<scalar>::New
{ (
if (nAlphaSubCycles > 1) mesh,
mesh.ddtScheme("ddt(alpha)")
)
);
const fv::ddtScheme<scalar>& ddtAlpha = tddtAlpha();
if
(
isType<fv::EulerDdtScheme<scalar>>(ddtAlpha)
|| isType<fv::localEulerDdtScheme<scalar>>(ddtAlpha)
)
{
ocCoeff = 0;
}
else if (isType<fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha))
{
if (nAlphaSubCycles > 1)
{
FatalErrorInFunction
<< "Sub-cycling is not supported "
"with the CrankNicolson ddt scheme"
<< exit(FatalError);
}
if
(
alphaRestart
|| mesh.time().timeIndex() > mesh.time().startTimeIndex() + 1
)
{
ocCoeff =
refCast<const fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha)
.ocCoeff();
}
}
else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Sub-cycling is not supported " << "Only Euler and CrankNicolson ddt schemes are supported"
"with the CrankNicolson ddt scheme"
<< exit(FatalError); << exit(FatalError);
} }
ocCoeff =
refCast<const fv::CrankNicolsonDdtScheme<scalar>>(ddtAlpha())
.ocCoeff();
}
else
{
FatalErrorInFunction
<< "Only Euler and CrankNicolson ddt schemes are supported"
<< exit(FatalError);
} }
// Set the time blending factor, 1 for Euler
scalar cnCoeff = 1.0/(1.0 + ocCoeff); scalar cnCoeff = 1.0/(1.0 + ocCoeff);
// Standard face-flux compression coefficient // Standard face-flux compression coefficient
@ -136,8 +147,8 @@
( (
fvc::flux fvc::flux
( (
phi, phiCN(),
alpha1, cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime(),
alphaScheme alphaScheme
) )
+ fvc::flux + fvc::flux
@ -148,13 +159,6 @@
) )
); );
// Calculate the Crank-Nicolson off-centred alpha flux
if (ocCoeff > 0)
{
talphaPhiUn =
cnCoeff*talphaPhiUn + (1.0 - cnCoeff)*alphaPhi.oldTime();
}
if (MULESCorr) if (MULESCorr)
{ {
tmp<surfaceScalarField> talphaPhiCorr(talphaPhiUn() - alphaPhi); tmp<surfaceScalarField> talphaPhiCorr(talphaPhiUn() - alphaPhi);

View File

@ -0,0 +1,20 @@
IOobject alphaPhiHeader
(
"alphaPhi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
);
const bool alphaRestart = alphaPhiHeader.headerOk();
// MULES flux from previous time-step
surfaceScalarField alphaPhi
(
alphaPhiHeader,
phi*fvc::interpolate(alpha1)
);
// MULES Correction
tmp<surfaceScalarField> talphaPhiCorr0;

View File

@ -5,7 +5,7 @@
+ fvm::div(rhoPhi, T) + fvm::div(rhoPhi, T)
- fvm::laplacian(mixture.alphaEff(turbulence->mut()), T) - fvm::laplacian(mixture.alphaEff(turbulence->mut()), T)
+ ( + (
divU*p fvc::div(fvc::absolute(phi, U), p)
+ fvc::ddt(rho, K) + fvc::div(rhoPhi, K) + fvc::ddt(rho, K) + fvc::div(rhoPhi, K)
) )
*( *(

View File

@ -64,6 +64,7 @@ int main(int argc, char *argv[])
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createControl.H" #include "createControl.H"
#include "createFields.H" #include "createFields.H"
#include "createAlphaFluxes.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "createUf.H" #include "createUf.H"
#include "createControls.H" #include "createControls.H"

View File

@ -64,6 +64,7 @@ int main(int argc, char *argv[])
#include "createControl.H" #include "createControl.H"
#include "createTimeControls.H" #include "createTimeControls.H"
#include "createFields.H" #include "createFields.H"
#include "createAlphaFluxes.H"
#include "createFvOptions.H" #include "createFvOptions.H"
volScalarField& p = mixture.p(); volScalarField& p = mixture.p();
@ -112,7 +113,6 @@ int main(int argc, char *argv[])
solve(fvm::ddt(rho) + fvc::div(rhoPhi)); solve(fvm::ddt(rho) + fvc::div(rhoPhi));
#include "UEqn.H" #include "UEqn.H"
volScalarField divU(fvc::div(fvc::absolute(phi, U)));
#include "TEqn.H" #include "TEqn.H"
// --- Pressure corrector loop // --- Pressure corrector loop

View File

@ -101,21 +101,4 @@ autoPtr<compressible::turbulenceModel> turbulence
Info<< "Creating field kinetic energy K\n" << endl; Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U)); volScalarField K("K", 0.5*magSqr(U));
// MULES flux from previous time-step
surfaceScalarField alphaPhi
(
IOobject
(
"alphaPhi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
phi*fvc::interpolate(alpha1)
);
// MULES Correction
tmp<surfaceScalarField> talphaPhiCorr0;
#include "createMRF.H" #include "createMRF.H"

View File

@ -121,20 +121,6 @@ if (p_rgh.needReference())
mesh.setFluxRequired(p_rgh.name()); mesh.setFluxRequired(p_rgh.name());
mesh.setFluxRequired(alpha1.name()); mesh.setFluxRequired(alpha1.name());
// MULES flux from previous time-step
surfaceScalarField alphaPhi
(
IOobject
(
"alphaPhi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
phi*fvc::interpolate(alpha1)
);
// MULES compressed flux is registered in case scalarTransport FO needs it. // MULES compressed flux is registered in case scalarTransport FO needs it.
surfaceScalarField alphaPhiUn surfaceScalarField alphaPhiUn
( (
@ -150,7 +136,4 @@ surfaceScalarField alphaPhiUn
dimensionedScalar("zero", phi.dimensions(), 0.0) dimensionedScalar("zero", phi.dimensions(), 0.0)
); );
// MULES Correction
tmp<surfaceScalarField> talphaPhiCorr0;
#include "createMRF.H" #include "createMRF.H"

View File

@ -63,6 +63,7 @@ int main(int argc, char *argv[])
#include "createTimeControls.H" #include "createTimeControls.H"
#include "createDyMControls.H" #include "createDyMControls.H"
#include "createFields.H" #include "createFields.H"
#include "createAlphaFluxes.H"
#include "createFvOptions.H" #include "createFvOptions.H"
volScalarField rAU volScalarField rAU

View File

@ -66,6 +66,7 @@ int main(int argc, char *argv[])
#include "createTimeControls.H" #include "createTimeControls.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "createFields.H" #include "createFields.H"
#include "createAlphaFluxes.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "correctPhi.H" #include "correctPhi.H"

View File

@ -294,12 +294,11 @@ while (pimple.correct())
forAll(phases, phasei) forAll(phases, phasei)
{ {
phaseModel& phase = phases[phasei]; phaseModel& phase = phases[phasei];
const volScalarField& alpha = phase;
volScalarField& rho = phase.thermo().rho();
if (phase.compressible()) if (phase.compressible())
{ {
const volScalarField& alpha = phase;
const volScalarField& rho = phase.rho();
if (pimple.transonic()) if (pimple.transonic())
{ {
surfaceScalarField phid surfaceScalarField phid
@ -357,21 +356,29 @@ while (pimple.correct())
).ptr() ).ptr()
); );
} }
}
else
{
pEqnComps.set
(
phasei,
fvm::Su(-(fvOptions(alpha, rho)&rho)/rho, p_rgh).ptr()
);
}
if (fluid.transfersMass(phase)) if (fluid.transfersMass(phase))
{
if (pEqnComps.set(phasei))
{ {
if (pEqnComps.set(phasei)) pEqnComps[phasei] -= fluid.dmdt(phase)/rho;
{ }
pEqnComps[phasei] -= fluid.dmdt(phase)/rho; else
} {
else pEqnComps.set
{ (
pEqnComps.set phasei,
( fvm::Su(-fluid.dmdt(phase)/rho, p_rgh)
phasei, );
fvm::Su(-fluid.dmdt(phase)/rho, p_rgh)
);
}
} }
} }
} }
@ -421,7 +428,7 @@ while (pimple.correct())
phase.phi() = phiHbyAs[phasei] + alpharAUfs[phasei]*mSfGradp; phase.phi() = phiHbyAs[phasei] + alpharAUfs[phasei]*mSfGradp;
// Set the phase dilatation rates // Set the phase dilatation rates
if (phase.compressible()) if (pEqnComps.set(phasei))
{ {
phase.divU(-pEqnComps[phasei] & p_rgh); phase.divU(-pEqnComps[phasei] & p_rgh);
} }

View File

@ -230,9 +230,10 @@ while (pimple.correct())
tmp<fvScalarMatrix> pEqnComp2; tmp<fvScalarMatrix> pEqnComp2;
// Construct the compressibility parts of the pressure equation // Construct the compressibility parts of the pressure equation
if (pimple.transonic())
if (phase1.compressible())
{ {
if (phase1.compressible()) if (pimple.transonic())
{ {
surfaceScalarField phid1 surfaceScalarField phid1
( (
@ -257,8 +258,24 @@ while (pimple.correct())
deleteDemandDrivenData(pEqnComp1.ref().faceFluxCorrectionPtr()); deleteDemandDrivenData(pEqnComp1.ref().faceFluxCorrectionPtr());
pEqnComp1.ref().relax(); pEqnComp1.ref().relax();
} }
else
{
pEqnComp1 =
(
phase1.continuityError()
- fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1)
)/rho1
+ (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh));
}
}
else
{
pEqnComp1 = fvm::Su(-(fvOptions(alpha1, rho1)&rho1)/rho1, p_rgh);
}
if (phase2.compressible()) if (phase2.compressible())
{
if (pimple.transonic())
{ {
surfaceScalarField phid2 surfaceScalarField phid2
( (
@ -279,23 +296,11 @@ while (pimple.correct())
+ fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
) )
); );
deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr()); deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr());
pEqnComp2.ref().relax(); pEqnComp2.ref().relax();
} }
} else
else
{
if (phase1.compressible())
{
pEqnComp1 =
(
phase1.continuityError()
- fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1)
)/rho1
+ (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh));
}
if (phase2.compressible())
{ {
pEqnComp2 = pEqnComp2 =
( (
@ -305,6 +310,10 @@ while (pimple.correct())
+ (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)); + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh));
} }
} }
else
{
pEqnComp2 = fvm::Su(-(fvOptions(alpha2, rho2)&rho2)/rho2, p_rgh);
}
if (fluid.transfersMass()) if (fluid.transfersMass())
{ {
@ -390,11 +399,11 @@ while (pimple.correct())
} }
// Set the phase dilatation rates // Set the phase dilatation rates
if (phase1.compressible()) if (pEqnComp1.valid())
{ {
phase1.divU(-pEqnComp1 & p_rgh); phase1.divU(-pEqnComp1 & p_rgh);
} }
if (phase2.compressible()) if (pEqnComp2.valid())
{ {
phase2.divU(-pEqnComp2 & p_rgh); phase2.divU(-pEqnComp2 & p_rgh);
} }

View File

@ -215,79 +215,91 @@ while (pimple.correct())
tmp<fvScalarMatrix> pEqnComp1; tmp<fvScalarMatrix> pEqnComp1;
tmp<fvScalarMatrix> pEqnComp2; tmp<fvScalarMatrix> pEqnComp2;
if (pimple.transonic()) // Construct the compressibility parts of the pressure equation
{
surfaceScalarField phid1
(
IOobject::groupName("phid", phase1.name()),
fvc::interpolate(psi1)*phi1
);
surfaceScalarField phid2
(
IOobject::groupName("phid", phase2.name()),
fvc::interpolate(psi2)*phi2
);
if (phase1.compressible()) if (phase1.compressible())
{
if (pimple.transonic())
{ {
pEqnComp1 = surfaceScalarField phid1
( (
phase1.continuityError() IOobject::groupName("phid", phase1.name()),
- fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1) fvc::interpolate(psi1)*phi1
)/rho1
+ correction
(
(alpha1/rho1)*
(
psi1*fvm::ddt(p_rgh)
+ fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
)
); );
pEqnComp1 =
(
phase1.continuityError()
- fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1)
)/rho1
+ correction
(
(alpha1/rho1)*
(
psi1*fvm::ddt(p_rgh)
+ fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
)
);
deleteDemandDrivenData(pEqnComp1.ref().faceFluxCorrectionPtr()); deleteDemandDrivenData(pEqnComp1.ref().faceFluxCorrectionPtr());
pEqnComp1.ref().relax(); pEqnComp1.ref().relax();
} }
else
if (phase2.compressible())
{ {
pEqnComp2 = pEqnComp1 =
(
phase2.continuityError()
- fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2)
)/rho2
+ correction
(
(alpha2/rho2)*
( (
psi2*fvm::ddt(p_rgh) phase1.continuityError()
+ fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) - fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1)
) )/rho1
); + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh));
deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr());
pEqnComp2.ref().relax();
} }
} }
else else
{ {
if (phase1.compressible()) pEqnComp1 = fvm::Su(-(fvOptions(alpha1, rho1)&rho1)/rho1, p_rgh);
{ }
pEqnComp1 =
(
phase1.continuityError()
- fvc::Sp(fvc::ddt(alpha1) + fvc::div(alphaPhi1), rho1)
)/rho1
+ (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh));
}
if (phase2.compressible()) if (phase2.compressible())
{
if (pimple.transonic())
{
surfaceScalarField phid2
(
IOobject::groupName("phid", phase2.name()),
fvc::interpolate(psi2)*phi2
);
pEqnComp2 =
(
phase2.continuityError()
- fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2)
)/rho2
+ correction
(
(alpha2/rho2)*
(
psi2*fvm::ddt(p_rgh)
+ fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
)
);
deleteDemandDrivenData(pEqnComp2.ref().faceFluxCorrectionPtr());
pEqnComp2.ref().relax();
}
else
{ {
pEqnComp2 = pEqnComp2 =
( (
phase2.continuityError() phase2.continuityError()
- fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2) - fvc::Sp(fvc::ddt(alpha2) + fvc::div(alphaPhi2), rho2)
)/rho2 )/rho2
+ (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)); + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh));
} }
} }
else
{
pEqnComp2 = fvm::Su(-(fvOptions(alpha2, rho2)&rho2)/rho2, p_rgh);
}
if (fluid.transfersMass()) if (fluid.transfersMass())
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -73,13 +73,13 @@ Lavieville::fLiquid
) const ) const
{ {
return return
pos(alphaLiquid-alphaCrit_) pos(alphaLiquid - alphaCrit_)
*( *(
1 - 0.5*exp(-20*(alphaLiquid - alphaCrit_)) 1 - 0.5*exp(-20*(alphaLiquid - alphaCrit_))
) )
+ neg(alphaLiquid - alphaCrit_) + neg(alphaLiquid - alphaCrit_)
*( *(
pow(0.5*(alphaLiquid/alphaCrit_), 20*alphaCrit_) 0.5*pow(alphaLiquid/alphaCrit_, 20*alphaCrit_)
); );
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -92,7 +92,11 @@ int main(int argc, char *argv[])
Serr<< "slave sending to master " Serr<< "slave sending to master "
<< Pstream::masterNo() << endl; << Pstream::masterNo() << endl;
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
FixedList<label, 2> list3; FixedList<label, 2> list3;
list3[0] = 0; list3[0] = 0;
@ -109,7 +113,7 @@ int main(int argc, char *argv[])
) )
{ {
Serr << "master receiving from slave " << slave << endl; Serr << "master receiving from slave " << slave << endl;
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::commsTypes::blocking, slave);
FixedList<label, 2> list3(fromSlave); FixedList<label, 2> list3(fromSlave);
Serr<< list3 << endl; Serr<< list3 << endl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,7 +65,7 @@ scalar sumReduce
scalar slaveValue; scalar slaveValue;
UIPstream::read UIPstream::read
( (
Pstream::blocking, Pstream::commsTypes::blocking,
slave, slave,
reinterpret_cast<char*>(&slaveValue), reinterpret_cast<char*>(&slaveValue),
sizeof(scalar), sizeof(scalar),
@ -87,7 +87,7 @@ scalar sumReduce
{ {
UOPstream::write UOPstream::write
( (
UPstream::blocking, UPstream::commsTypes::blocking,
slave, slave,
reinterpret_cast<const char*>(&sum), reinterpret_cast<const char*>(&sum),
sizeof(scalar), sizeof(scalar),
@ -101,7 +101,7 @@ scalar sumReduce
{ {
UOPstream::write UOPstream::write
( (
UPstream::blocking, UPstream::commsTypes::blocking,
UPstream::masterNo(), UPstream::masterNo(),
reinterpret_cast<const char*>(&localValue), reinterpret_cast<const char*>(&localValue),
sizeof(scalar), sizeof(scalar),
@ -113,7 +113,7 @@ scalar sumReduce
{ {
UIPstream::read UIPstream::read
( (
UPstream::blocking, UPstream::commsTypes::blocking,
UPstream::masterNo(), UPstream::masterNo(),
reinterpret_cast<char*>(&sum), reinterpret_cast<char*>(&sum),
sizeof(scalar), sizeof(scalar),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
Pstream::myProcNo() Pstream::myProcNo()
); );
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
if (Pstream::myProcNo() != Pstream::masterNo()) if (Pstream::myProcNo() != Pstream::masterNo())
{ {
@ -100,7 +100,7 @@ int main(int argc, char *argv[])
// Send allData back // Send allData back
PstreamBuffers pBufs2(Pstream::nonBlocking); PstreamBuffers pBufs2(Pstream::commsTypes::nonBlocking);
if (Pstream::myProcNo() == Pstream::masterNo()) if (Pstream::myProcNo() == Pstream::masterNo())
{ {
for for
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
// Do a non-blocking send inbetween // Do a non-blocking send inbetween
{ {
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
for (label proci = 0; proci < Pstream::nProcs(); proci++) for (label proci = 0; proci < Pstream::nProcs(); proci++)
{ {

View File

@ -134,12 +134,12 @@ void testTransfer(const T& input)
{ {
{ {
Perr<< "slave sending to master " << Pstream::masterNo() << endl; Perr<< "slave sending to master " << Pstream::masterNo() << endl;
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster(Pstream::commsTypes::blocking, Pstream::masterNo());
toMaster << data; toMaster << data;
} }
Perr<< "slave receiving from master " << Pstream::masterNo() << endl; Perr<< "slave receiving from master " << Pstream::masterNo() << endl;
IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); IPstream fromMaster(Pstream::commsTypes::blocking, Pstream::masterNo());
fromMaster >> data; fromMaster >> data;
Perr<< data << endl; Perr<< data << endl;
} }
@ -153,7 +153,7 @@ void testTransfer(const T& input)
) )
{ {
Perr<< "master receiving from slave " << slave << endl; Perr<< "master receiving from slave " << slave << endl;
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::commsTypes::blocking, slave);
fromSlave >> data; fromSlave >> data;
Perr<< data << endl; Perr<< data << endl;
} }
@ -166,7 +166,7 @@ void testTransfer(const T& input)
) )
{ {
Perr<< "master sending to slave " << slave << endl; Perr<< "master sending to slave " << slave << endl;
OPstream toSlave(Pstream::blocking, slave); OPstream toSlave(Pstream::commsTypes::blocking, slave);
toSlave << data; toSlave << data;
} }
} }
@ -187,12 +187,21 @@ void testTokenized(const T& data)
{ {
{ {
Perr<< "slave sending to master " << Pstream::masterNo() << endl; Perr<< "slave sending to master " << Pstream::masterNo() << endl;
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
toMaster << data; toMaster << data;
} }
Perr<< "slave receiving from master " << Pstream::masterNo() << endl; Perr<< "slave receiving from master " << Pstream::masterNo() << endl;
IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); IPstream fromMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
fromMaster >> tok; fromMaster >> tok;
Perr<< tok.info() << endl; Perr<< tok.info() << endl;
@ -207,7 +216,7 @@ void testTokenized(const T& data)
) )
{ {
Perr<< "master receiving from slave " << slave << endl; Perr<< "master receiving from slave " << slave << endl;
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::commsTypes::blocking, slave);
fromSlave >> tok; fromSlave >> tok;
Perr<< tok.info() << endl; Perr<< tok.info() << endl;
} }
@ -220,7 +229,7 @@ void testTokenized(const T& data)
) )
{ {
Perr<< "master sending to slave " << slave << endl; Perr<< "master sending to slave " << slave << endl;
OPstream toSlave(Pstream::blocking, slave); OPstream toSlave(Pstream::commsTypes::blocking, slave);
toSlave << data; toSlave << data;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,7 +63,7 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
slave++, procIndex++ slave++, procIndex++
) )
{ {
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
fromSlave >> this->operator[](procIndex); fromSlave >> this->operator[](procIndex);
} }
@ -75,7 +75,7 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
slave++, procIndex++ slave++, procIndex++
) )
{ {
OPstream toSlave(Pstream::scheduled, slave); OPstream toSlave(Pstream::commsTypes::scheduled, slave);
if (redistribute) if (redistribute)
{ {
@ -92,13 +92,21 @@ Gather<T0>::Gather(const T0& localData, const bool redistribute)
{ {
// Slave: send my local data to master // Slave: send my local data to master
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster << localData; toMaster << localData;
} }
// Receive data from master // Receive data from master
{ {
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); IPstream fromMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
if (redistribute) if (redistribute)
{ {
fromMaster >> *this; fromMaster >> *this;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -641,7 +641,7 @@ void Foam::conformalVoronoiMesh::reorderProcessorPatches
labelList rotation(faces.size(), label(0)); labelList rotation(faces.size(), label(0));
labelList faceMap(faces.size(), label(-1)); labelList faceMap(faces.size(), label(-1));
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Send ordering // Send ordering
forAll(sortMesh.boundaryMesh(), patchi) forAll(sortMesh.boundaryMesh(), patchi)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -430,7 +430,7 @@ void Foam::mergeAndWrite
// Receive slave ones // Receive slave ones
for (int slave=1; slave<Pstream::nProcs(); slave++) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
pointField slavePts(fromSlave); pointField slavePts(fromSlave);
labelList slaveIDs(fromSlave); labelList slaveIDs(fromSlave);
@ -446,7 +446,7 @@ void Foam::mergeAndWrite
// be improved. // be improved.
OPstream toMaster OPstream toMaster
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
Pstream::masterNo(), Pstream::masterNo(),
myPoints.byteSize() + myIDs.byteSize() myPoints.byteSize() + myIDs.byteSize()
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -352,7 +352,11 @@ void syncPoints
} }
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); OPstream toNbr
(
Pstream::commsTypes::blocking,
procPatch.neighbProcNo()
);
toNbr << patchInfo; toNbr << patchInfo;
} }
} }
@ -380,7 +384,7 @@ void syncPoints
// so cannot use Pstream::read. // so cannot use Pstream::read.
IPstream fromNbr IPstream fromNbr
( (
Pstream::blocking, Pstream::commsTypes::blocking,
procPatch.neighbProcNo() procPatch.neighbProcNo()
); );
fromNbr >> nbrPatchInfo; fromNbr >> nbrPatchInfo;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -394,7 +394,7 @@ void getInterfaceSizes
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::commsTypes::blocking, slave);
EdgeMap<Map<label>> slaveSizes(fromSlave); EdgeMap<Map<label>> slaveSizes(fromSlave);
@ -439,7 +439,11 @@ void getInterfaceSizes
{ {
// Send to master // Send to master
{ {
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
toMaster << regionsToSize; toMaster << regionsToSize;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -124,14 +124,18 @@ Foam::autoPtr<Foam::fvMesh> Foam::loadOrCreateMesh
slave++ slave++
) )
{ {
OPstream toSlave(Pstream::scheduled, slave); OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << patchEntries; toSlave << patchEntries;
} }
} }
else else
{ {
// Receive patches // Receive patches
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); IPstream fromMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
fromMaster >> patchEntries; fromMaster >> patchEntries;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -467,7 +467,7 @@ void writeProcAddressing
// Apply face flips // Apply face flips
mapDistributeBase::distribute mapDistributeBase::distribute
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
List<labelPair>(), List<labelPair>(),
faceDistMap.constructSize(), faceDistMap.constructSize(),
faceDistMap.subMap(), faceDistMap.subMap(),
@ -489,7 +489,7 @@ void writeProcAddressing
// provide one ... // provide one ...
mapDistributeBase::distribute mapDistributeBase::distribute
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
List<labelPair>(), List<labelPair>(),
patchDistMap.constructSize(), patchDistMap.constructSize(),
patchDistMap.subMap(), patchDistMap.subMap(),
@ -520,7 +520,7 @@ void writeProcAddressing
mapDistributeBase::distribute mapDistributeBase::distribute
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
List<labelPair>(), List<labelPair>(),
map.nOldFaces(), map.nOldFaces(),
faceDistMap.constructMap(), faceDistMap.constructMap(),
@ -649,7 +649,7 @@ void readFields
{ {
if (!haveMesh[procI]) if (!haveMesh[procI])
{ {
OPstream toProc(Pstream::blocking, procI); OPstream toProc(Pstream::commsTypes::blocking, procI);
toProc<< tsubfld(); toProc<< tsubfld();
} }
} }
@ -665,7 +665,11 @@ void readFields
const word& name = masterNames[i]; const word& name = masterNames[i];
// Receive field // Receive field
IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); IPstream fromMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
dictionary fieldDict(fromMaster); dictionary fieldDict(fromMaster);
fields.set fields.set
@ -723,8 +727,8 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
typename GeoField::Boundary& bfld = fld.boundaryFieldRef(); typename GeoField::Boundary& bfld = fld.boundaryFieldRef();
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
label nReq = Pstream::nRequests(); label nReq = Pstream::nRequests();
@ -745,7 +749,7 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
if if
( (
Pstream::parRun() Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking && Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
Pstream::waitRequests(nReq); Pstream::waitRequests(nReq);
@ -763,7 +767,7 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = const lduSchedule& patchSchedule =
fld.mesh().globalData().patchSchedule(); fld.mesh().globalData().patchSchedule();
@ -779,11 +783,11 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
{ {
if (patchSchedule[patchEvali].init) if (patchSchedule[patchEvali].init)
{ {
pfld.initEvaluate(Pstream::scheduled); pfld.initEvaluate(Pstream::commsTypes::scheduled);
} }
else else
{ {
pfld.evaluate(Pstream::scheduled); pfld.evaluate(Pstream::commsTypes::scheduled);
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,8 +43,8 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
label nReq = Pstream::nRequests(); label nReq = Pstream::nRequests();
@ -67,7 +67,7 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
if if
( (
Pstream::parRun() Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking && Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
Pstream::waitRequests(nReq); Pstream::waitRequests(nReq);
@ -87,7 +87,7 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = const lduSchedule& patchSchedule =
fld.mesh().globalData().patchSchedule(); fld.mesh().globalData().patchSchedule();
@ -105,11 +105,11 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
{ {
if (patchSchedule[patchEvali].init) if (patchSchedule[patchEvali].init)
{ {
tgtField.initEvaluate(Pstream::scheduled); tgtField.initEvaluate(Pstream::commsTypes::scheduled);
} }
else else
{ {
tgtField.evaluate(Pstream::scheduled); tgtField.evaluate(Pstream::commsTypes::scheduled);
} }
} }
} }

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Web: www.OpenFOAM.org
\\/ M anipulation |
-------------------------------------------------------------------------------
Description
Calculate intensive fields:
- UMean
- translationalT
- internalT
- overallT
from averaged extensive fields from a DSMC calculation.
\*---------------------------------------------------------------------------*/
type dsmcFields;
libs ("liblagrangianFunctionObjects.so");
fields (rhoNMean rhoMMean momentumMean linearKEMean internalEMean
iDofMean fDMean);
executeControl writeTime;
writeControl writeTime;
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -112,7 +112,7 @@ void Foam::ParSortableList<Type>::checkAndSend
} }
{ {
OPstream toSlave(Pstream::blocking, destProci); OPstream toSlave(Pstream::commsTypes::blocking, destProci);
toSlave << values << indices; toSlave << values << indices;
} }
} }
@ -306,7 +306,7 @@ void Foam::ParSortableList<Type>::sort()
Pout<< "Receiving from " << proci << endl; Pout<< "Receiving from " << proci << endl;
} }
IPstream fromSlave(Pstream::blocking, proci); IPstream fromSlave(Pstream::commsTypes::blocking, proci);
fromSlave >> recValues >> recIndices; fromSlave >> recValues >> recIndices;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -83,7 +83,7 @@ void Foam::PstreamBuffers::finishedSends(const bool block)
{ {
finishedSendsCalled_ = true; finishedSendsCalled_ = true;
if (commsType_ == UPstream::nonBlocking) if (commsType_ == UPstream::commsTypes::nonBlocking)
{ {
Pstream::exchange<DynamicList<char>, char> Pstream::exchange<DynamicList<char>, char>
( (
@ -101,7 +101,7 @@ void Foam::PstreamBuffers::finishedSends(labelList& recvSizes, const bool block)
{ {
finishedSendsCalled_ = true; finishedSendsCalled_ = true;
if (commsType_ == UPstream::nonBlocking) if (commsType_ == UPstream::commsTypes::nonBlocking)
{ {
Pstream::exchangeSizes(sendBuf_, recvSizes, comm_); Pstream::exchangeSizes(sendBuf_, recvSizes, comm_);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,7 +35,7 @@ Description
Example usage: Example usage:
PstreamBuffers pBuffers(Pstream::nonBlocking); PstreamBuffers pBuffers(Pstream::commsTypes::nonBlocking);
for (label proci = 0; proci < Pstream::nProcs(); proci++) for (label proci = 0; proci < Pstream::nProcs(); proci++)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -113,7 +113,7 @@ Foam::UOPstream::UOPstream(const int toProcNo, PstreamBuffers& buffers)
sendBuf_(buffers.sendBuf_[toProcNo]), sendBuf_(buffers.sendBuf_[toProcNo]),
tag_(buffers.tag_), tag_(buffers.tag_),
comm_(buffers.comm_), comm_(buffers.comm_),
sendAtDestruct_(buffers.commsType_ != UPstream::nonBlocking) sendAtDestruct_(buffers.commsType_ != UPstream::commsTypes::nonBlocking)
{ {
setOpened(); setOpened();
setGood(); setGood();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,7 +62,7 @@ class UPstream
public: public:
//- Types of communications //- Types of communications
enum commsTypes enum class commsTypes
{ {
blocking, blocking,
scheduled, scheduled,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,7 +65,7 @@ void Foam::Pstream::combineGather
T value; T value;
UIPstream::read UIPstream::read
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
reinterpret_cast<char*>(&value), reinterpret_cast<char*>(&value),
sizeof(T), sizeof(T),
@ -83,7 +83,14 @@ void Foam::Pstream::combineGather
} }
else else
{ {
IPstream fromBelow(UPstream::scheduled, belowID, 0, tag, comm); IPstream fromBelow
(
UPstream::commsTypes::scheduled,
belowID,
0,
tag,
comm
);
T value(fromBelow); T value(fromBelow);
if (debug & 2) if (debug & 2)
@ -109,7 +116,7 @@ void Foam::Pstream::combineGather
{ {
UOPstream::write UOPstream::write
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
reinterpret_cast<const char*>(&Value), reinterpret_cast<const char*>(&Value),
sizeof(T), sizeof(T),
@ -121,7 +128,7 @@ void Foam::Pstream::combineGather
{ {
OPstream toAbove OPstream toAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -189,7 +196,7 @@ void Foam::Pstream::combineScatter
{ {
UIPstream::read UIPstream::read
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
reinterpret_cast<char*>(&Value), reinterpret_cast<char*>(&Value),
sizeof(T), sizeof(T),
@ -201,7 +208,7 @@ void Foam::Pstream::combineScatter
{ {
IPstream fromAbove IPstream fromAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -231,7 +238,7 @@ void Foam::Pstream::combineScatter
{ {
UOPstream::write UOPstream::write
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
reinterpret_cast<const char*>(&Value), reinterpret_cast<const char*>(&Value),
sizeof(T), sizeof(T),
@ -241,7 +248,14 @@ void Foam::Pstream::combineScatter
} }
else else
{ {
OPstream toBelow(UPstream::scheduled, belowID, 0, tag, comm); OPstream toBelow
(
UPstream::commsTypes::scheduled,
belowID,
0,
tag,
comm
);
toBelow << Value; toBelow << Value;
} }
} }
@ -294,7 +308,7 @@ void Foam::Pstream::listCombineGather
UIPstream::read UIPstream::read
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
reinterpret_cast<char*>(receivedValues.begin()), reinterpret_cast<char*>(receivedValues.begin()),
receivedValues.byteSize(), receivedValues.byteSize(),
@ -315,7 +329,14 @@ void Foam::Pstream::listCombineGather
} }
else else
{ {
IPstream fromBelow(UPstream::scheduled, belowID, 0, tag, comm); IPstream fromBelow
(
UPstream::commsTypes::scheduled,
belowID,
0,
tag,
comm
);
List<T> receivedValues(fromBelow); List<T> receivedValues(fromBelow);
if (debug & 2) if (debug & 2)
@ -344,7 +365,7 @@ void Foam::Pstream::listCombineGather
{ {
UOPstream::write UOPstream::write
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
reinterpret_cast<const char*>(Values.begin()), reinterpret_cast<const char*>(Values.begin()),
Values.byteSize(), Values.byteSize(),
@ -356,7 +377,7 @@ void Foam::Pstream::listCombineGather
{ {
OPstream toAbove OPstream toAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -424,7 +445,7 @@ void Foam::Pstream::listCombineScatter
{ {
UIPstream::read UIPstream::read
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
reinterpret_cast<char*>(Values.begin()), reinterpret_cast<char*>(Values.begin()),
Values.byteSize(), Values.byteSize(),
@ -436,7 +457,7 @@ void Foam::Pstream::listCombineScatter
{ {
IPstream fromAbove IPstream fromAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -466,7 +487,7 @@ void Foam::Pstream::listCombineScatter
{ {
UOPstream::write UOPstream::write
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
reinterpret_cast<const char*>(Values.begin()), reinterpret_cast<const char*>(Values.begin()),
Values.byteSize(), Values.byteSize(),
@ -476,7 +497,14 @@ void Foam::Pstream::listCombineScatter
} }
else else
{ {
OPstream toBelow(UPstream::scheduled, belowID, 0, tag, comm); OPstream toBelow
(
UPstream::commsTypes::scheduled,
belowID,
0,
tag,
comm
);
toBelow << Values; toBelow << Values;
} }
} }
@ -535,7 +563,14 @@ void Foam::Pstream::mapCombineGather
{ {
label belowID = myComm.below()[belowI]; label belowID = myComm.below()[belowI];
IPstream fromBelow(UPstream::scheduled, belowID, 0, tag, comm); IPstream fromBelow
(
UPstream::commsTypes::scheduled,
belowID,
0,
tag,
comm
);
Container receivedValues(fromBelow); Container receivedValues(fromBelow);
if (debug & 2) if (debug & 2)
@ -575,7 +610,14 @@ void Foam::Pstream::mapCombineGather
<< " data:" << Values << endl; << " data:" << Values << endl;
} }
OPstream toAbove(UPstream::scheduled, myComm.above(), 0, tag, comm); OPstream toAbove
(
UPstream::commsTypes::scheduled,
myComm.above(),
0,
tag,
comm
);
toAbove << Values; toAbove << Values;
} }
} }
@ -635,7 +677,7 @@ void Foam::Pstream::mapCombineScatter
{ {
IPstream fromAbove IPstream fromAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -660,7 +702,14 @@ void Foam::Pstream::mapCombineScatter
Pout<< " sending to " << belowID << " data:" << Values << endl; Pout<< " sending to " << belowID << " data:" << Values << endl;
} }
OPstream toBelow(UPstream::scheduled, belowID, 0, tag, comm); OPstream toBelow
(
UPstream::commsTypes::scheduled,
belowID,
0,
tag,
comm
);
toBelow << Values; toBelow << Values;
} }
} }

View File

@ -54,7 +54,7 @@ void Foam::Pstream::exchangeContainer
{ {
UIPstream::read UIPstream::read
( (
UPstream::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
reinterpret_cast<char*>(recvBufs[proci].begin()), reinterpret_cast<char*>(recvBufs[proci].begin()),
recvSizes[proci]*sizeof(T), recvSizes[proci]*sizeof(T),
@ -76,7 +76,7 @@ void Foam::Pstream::exchangeContainer
( (
!UOPstream::write !UOPstream::write
( (
UPstream::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
reinterpret_cast<const char*>(sendBufs[proci].begin()), reinterpret_cast<const char*>(sendBufs[proci].begin()),
sendBufs[proci].size()*sizeof(T), sendBufs[proci].size()*sizeof(T),
@ -128,7 +128,7 @@ void Foam::Pstream::exchangeBuf
{ {
UIPstream::read UIPstream::read
( (
UPstream::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
recvBufs[proci], recvBufs[proci],
recvSizes[proci]*sizeof(T), recvSizes[proci]*sizeof(T),
@ -150,7 +150,7 @@ void Foam::Pstream::exchangeBuf
( (
!UOPstream::write !UOPstream::write
( (
UPstream::nonBlocking, UPstream::commsTypes::nonBlocking,
proci, proci,
sendBufs[proci], sendBufs[proci],
sendSizes[proci]*sizeof(T), sendSizes[proci]*sizeof(T),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -66,7 +66,7 @@ void Pstream::gather
{ {
UIPstream::read UIPstream::read
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.below()[belowI], myComm.below()[belowI],
reinterpret_cast<char*>(&value), reinterpret_cast<char*>(&value),
sizeof(T), sizeof(T),
@ -78,7 +78,7 @@ void Pstream::gather
{ {
IPstream fromBelow IPstream fromBelow
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.below()[belowI], myComm.below()[belowI],
0, 0,
tag, tag,
@ -97,7 +97,7 @@ void Pstream::gather
{ {
UOPstream::write UOPstream::write
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
reinterpret_cast<const char*>(&Value), reinterpret_cast<const char*>(&Value),
sizeof(T), sizeof(T),
@ -109,7 +109,7 @@ void Pstream::gather
{ {
OPstream toAbove OPstream toAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -163,7 +163,7 @@ void Pstream::scatter
{ {
UIPstream::read UIPstream::read
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
reinterpret_cast<char*>(&Value), reinterpret_cast<char*>(&Value),
sizeof(T), sizeof(T),
@ -175,7 +175,7 @@ void Pstream::scatter
{ {
IPstream fromAbove IPstream fromAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -194,7 +194,7 @@ void Pstream::scatter
{ {
UOPstream::write UOPstream::write
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.below()[belowI], myComm.below()[belowI],
reinterpret_cast<const char*>(&Value), reinterpret_cast<const char*>(&Value),
sizeof(T), sizeof(T),
@ -206,7 +206,7 @@ void Pstream::scatter
{ {
OPstream toBelow OPstream toBelow
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.below()[belowI], myComm.below()[belowI],
0, 0,
tag, tag,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -79,7 +79,7 @@ void Pstream::gatherList
UIPstream::read UIPstream::read
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
reinterpret_cast<char*>(receivedValues.begin()), reinterpret_cast<char*>(receivedValues.begin()),
receivedValues.byteSize(), receivedValues.byteSize(),
@ -96,7 +96,14 @@ void Pstream::gatherList
} }
else else
{ {
IPstream fromBelow(UPstream::scheduled, belowID, 0, tag, comm); IPstream fromBelow
(
UPstream::commsTypes::scheduled,
belowID,
0,
tag,
comm
);
fromBelow >> Values[belowID]; fromBelow >> Values[belowID];
if (debug & 2) if (debug & 2)
@ -148,7 +155,7 @@ void Pstream::gatherList
OPstream::write OPstream::write
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
reinterpret_cast<const char*>(sendingValues.begin()), reinterpret_cast<const char*>(sendingValues.begin()),
sendingValues.byteSize(), sendingValues.byteSize(),
@ -160,7 +167,7 @@ void Pstream::gatherList
{ {
OPstream toAbove OPstream toAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -234,7 +241,7 @@ void Pstream::scatterList
UIPstream::read UIPstream::read
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
reinterpret_cast<char*>(receivedValues.begin()), reinterpret_cast<char*>(receivedValues.begin()),
receivedValues.byteSize(), receivedValues.byteSize(),
@ -251,7 +258,7 @@ void Pstream::scatterList
{ {
IPstream fromAbove IPstream fromAbove
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
tag, tag,
@ -290,7 +297,7 @@ void Pstream::scatterList
OPstream::write OPstream::write
( (
UPstream::scheduled, UPstream::commsTypes::scheduled,
belowID, belowID,
reinterpret_cast<const char*>(sendingValues.begin()), reinterpret_cast<const char*>(sendingValues.begin()),
sendingValues.byteSize(), sendingValues.byteSize(),
@ -300,7 +307,14 @@ void Pstream::scatterList
} }
else else
{ {
OPstream toBelow(UPstream::scheduled, belowID, 0, tag, comm); OPstream toBelow
(
UPstream::commsTypes::scheduled,
belowID,
0,
tag,
comm
);
// Send data destined for all other processors below belowID // Send data destined for all other processors below belowID
forAll(notBelowLeaves, leafI) forAll(notBelowLeaves, leafI)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -135,8 +135,12 @@ void Foam::timeSelector::addOptions
argList::addBoolOption argList::addBoolOption
( (
"noZero", "noZero",
"exclude the '0/' dir from the times list, " string("exclude the '0/' dir from the times list")
"has precedence over the -withZero option" + (
withZero
? ", has precedence over the -withZero option"
: ""
)
); );
argList::addBoolOption argList::addBoolOption
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -334,7 +334,19 @@ public:
) const; ) const;
//- Find and return a T, //- Find and return a T,
// if not found return the given default value // if not found throw a fatal error.
// If recursive, search parent dictionaries.
// If patternMatch, use regular expressions.
template<class T>
T lookupType
(
const word&,
bool recursive=false,
bool patternMatch=true
) const;
//- Find and return a T,
// if not found return the given default value.
// If recursive, search parent dictionaries. // If recursive, search parent dictionaries.
// If patternMatch, use regular expressions. // If patternMatch, use regular expressions.
template<class T> template<class T>

View File

@ -28,6 +28,30 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T>
T Foam::dictionary::lookupType
(
const word& keyword,
bool recursive,
bool patternMatch
) const
{
const entry* entryPtr = lookupEntryPtr(keyword, recursive, patternMatch);
if (entryPtr == nullptr)
{
FatalIOErrorInFunction
(
*this
) << "keyword " << keyword << " is undefined in dictionary "
<< name()
<< exit(FatalIOError);
}
return pTraits<T>(entryPtr->stream());
}
template<class T> template<class T>
T Foam::dictionary::lookupOrDefault T Foam::dictionary::lookupOrDefault
( (

View File

@ -104,7 +104,7 @@ bool Foam::regIOobject::read
IPstream fromAbove IPstream fromAbove
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
myComm.above(), myComm.above(),
0, 0,
Pstream::msgType(), Pstream::msgType(),
@ -119,7 +119,7 @@ bool Foam::regIOobject::read
{ {
OPstream toBelow OPstream toBelow
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
myComm.below()[belowI], myComm.below()[belowI],
0, 0,
Pstream::msgType(), Pstream::msgType(),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -422,8 +422,8 @@ evaluate()
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
label nReq = Pstream::nRequests(); label nReq = Pstream::nRequests();
@ -437,7 +437,7 @@ evaluate()
if if
( (
Pstream::parRun() Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking && Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
Pstream::waitRequests(nReq); Pstream::waitRequests(nReq);
@ -448,7 +448,7 @@ evaluate()
this->operator[](patchi).evaluate(Pstream::defaultCommsType); this->operator[](patchi).evaluate(Pstream::defaultCommsType);
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = const lduSchedule& patchSchedule =
bmesh_.mesh().globalData().patchSchedule(); bmesh_.mesh().globalData().patchSchedule();
@ -458,12 +458,12 @@ evaluate()
if (patchSchedule[patchEvali].init) if (patchSchedule[patchEvali].init)
{ {
this->operator[](patchSchedule[patchEvali].patch) this->operator[](patchSchedule[patchEvali].patch)
.initEvaluate(Pstream::scheduled); .initEvaluate(Pstream::commsTypes::scheduled);
} }
else else
{ {
this->operator[](patchSchedule[patchEvali].patch) this->operator[](patchSchedule[patchEvali].patch)
.evaluate(Pstream::scheduled); .evaluate(Pstream::commsTypes::scheduled);
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -124,7 +124,8 @@ public:
//- Update the patch field //- Update the patch field
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
); );
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -116,7 +116,8 @@ public:
//- Evaluate the patch field //- Evaluate the patch field
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
) = 0; ) = 0;
//- Initialise swap of patch point values //- Initialise swap of patch point values

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -162,7 +162,8 @@ public:
//- Evaluate the patch field //- Evaluate the patch field
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -161,7 +161,8 @@ public:
//- Evaluate the patch field //- Evaluate the patch field
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
) )
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -122,14 +122,11 @@ public:
// Member functions // Member functions
// Evaluation functions //- Evaluate the patch field
virtual void evaluate
//- Evaluate the patch field (
virtual void evaluate const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
( );
const Pstream::commsTypes commsType=Pstream::blocking
);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -122,14 +122,11 @@ public:
// Member functions // Member functions
// Evaluation functions //- Evaluate the patch field
virtual void evaluate
//- Evaluate the patch field (
virtual void evaluate const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
( );
const Pstream::commsTypes commsType=Pstream::blocking
);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -157,7 +157,7 @@ public:
} }
//- Constraint handling // Constraint handling
//- Return the constraint type this pointPatchField implements //- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const virtual const word& constraintType() const
@ -171,7 +171,8 @@ public:
//- Evaluate the patch field //- Evaluate the patch field
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
) )
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -113,7 +113,7 @@ void Foam::processorCyclicPointPatchField<Type>::initSwapAddSeparated
) )
); );
if (commsType == Pstream::nonBlocking) if (commsType == Pstream::commsTypes::nonBlocking)
{ {
receiveBuf_.setSize(pf.size()); receiveBuf_.setSize(pf.size());
IPstream::read IPstream::read
@ -149,7 +149,7 @@ void Foam::processorCyclicPointPatchField<Type>::swapAddSeparated
if (Pstream::parRun()) if (Pstream::parRun())
{ {
// If nonblocking data has already been received into receiveBuf_ // If nonblocking data has already been received into receiveBuf_
if (commsType != Pstream::nonBlocking) if (commsType != Pstream::commsTypes::nonBlocking)
{ {
receiveBuf_.setSize(this->size()); receiveBuf_.setSize(this->size());
IPstream::read IPstream::read

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -166,7 +166,8 @@ public:
//- Evaluate the patch field //- Evaluate the patch field
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
) )
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -134,13 +134,11 @@ public:
return symmetryPlanePointPatch::typeName; return symmetryPlanePointPatch::typeName;
} }
// Evaluation functions //- Update the patch field
virtual void evaluate
//- Update the patch field (
virtual void evaluate const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
( );
const Pstream::commsTypes commsType=Pstream::blocking
);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -122,21 +122,17 @@ public:
// Member functions // Member functions
//- Constraint handling //- Return the constraint type this pointPatchField implements
virtual const word& constraintType() const
{
return type();
}
//- Return the constraint type this pointPatchField implements //- Update the patch field
virtual const word& constraintType() const virtual void evaluate
{ (
return type(); const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
} );
// Evaluation functions
//- Update the patch field
virtual void evaluate
(
const Pstream::commsTypes commsType=Pstream::blocking
);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -231,7 +231,7 @@ public:
//- Evaluate the patch field, sets Updated to false //- Evaluate the patch field, sets Updated to false
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
); );
//- Write //- Write

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -139,14 +139,11 @@ public:
// Member functions // Member functions
// Evaluation functions //- Update the patch field
virtual void evaluate
//- Update the patch field (
virtual void evaluate const Pstream::commsTypes commsType=Pstream::commsTypes::blocking
( );
const Pstream::commsTypes commsType=Pstream::blocking
);
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream&) const;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -418,14 +418,16 @@ public:
//- Initialise evaluation of the patch field (do nothing) //- Initialise evaluation of the patch field (do nothing)
virtual void initEvaluate virtual void initEvaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
) )
{} {}
//- Evaluate the patch field //- Evaluate the patch field
virtual void evaluate virtual void evaluate
( (
const Pstream::commsTypes commsType=Pstream::blocking const Pstream::commsTypes commsType =
Pstream::commsTypes::blocking
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -764,7 +764,7 @@ void Foam::argList::parse
{ {
options_.set("case", roots[slave-1]/globalCase_); options_.set("case", roots[slave-1]/globalCase_);
OPstream toSlave(Pstream::scheduled, slave); OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << args_ << options_; toSlave << args_ << options_;
} }
options_.erase("case"); options_.erase("case");
@ -811,7 +811,7 @@ void Foam::argList::parse
slave++ slave++
) )
{ {
OPstream toSlave(Pstream::scheduled, slave); OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << args_ << options_; toSlave << args_ << options_;
} }
} }
@ -819,7 +819,11 @@ void Foam::argList::parse
else else
{ {
// Collect the master's argument list // Collect the master's argument list
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); IPstream fromMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
fromMaster >> args_ >> options_; fromMaster >> args_ >> options_;
// Establish rootPath_/globalCase_/case_ for slave // Establish rootPath_/globalCase_/case_ for slave
@ -853,7 +857,7 @@ void Foam::argList::parse
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
string slaveBuild; string slaveBuild;
string slaveMachine; string slaveMachine;
@ -876,7 +880,11 @@ void Foam::argList::parse
} }
else else
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster << string(Foam::FOAMbuild) << hostName() << pid(); toMaster << string(Foam::FOAMbuild) << hostName() << pid();
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -97,7 +97,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
( (
IPstream IPstream
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
slave, slave,
0, // bufSize 0, // bufSize
Pstream::msgType(), Pstream::msgType(),
@ -111,7 +111,7 @@ Foam::LUscalarMatrix::LUscalarMatrix
{ {
OPstream toMaster OPstream toMaster
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
Pstream::masterNo(), Pstream::masterNo(),
0, // bufSize 0, // bufSize
Pstream::msgType(), Pstream::msgType(),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -62,7 +62,7 @@ void Foam::LUscalarMatrix::solve
{ {
IPstream::read IPstream::read
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
slave, slave,
reinterpret_cast<char*> reinterpret_cast<char*>
( (
@ -78,7 +78,7 @@ void Foam::LUscalarMatrix::solve
{ {
OPstream::write OPstream::write
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
Pstream::masterNo(), Pstream::masterNo(),
reinterpret_cast<const char*>(x.begin()), reinterpret_cast<const char*>(x.begin()),
x.byteSize(), x.byteSize(),
@ -106,7 +106,7 @@ void Foam::LUscalarMatrix::solve
{ {
OPstream::write OPstream::write
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
slave, slave,
reinterpret_cast<const char*> reinterpret_cast<const char*>
( (
@ -122,7 +122,7 @@ void Foam::LUscalarMatrix::solve
{ {
IPstream::read IPstream::read
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
Pstream::masterNo(), Pstream::masterNo(),
reinterpret_cast<char*>(x.begin()), reinterpret_cast<char*>(x.begin()),
x.byteSize(), x.byteSize(),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,8 +38,8 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces
{ {
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
forAll(interfaces_, interfacei) forAll(interfaces_, interfacei)
@ -57,7 +57,7 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = this->patchSchedule(); const lduSchedule& patchSchedule = this->patchSchedule();
@ -78,7 +78,7 @@ void Foam::LduMatrix<Type, DType, LUType>::initMatrixInterfaces
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
Pstream::blocking Pstream::commsTypes::blocking
); );
} }
} }
@ -103,12 +103,12 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
{ {
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
// Block until all sends/receives have been finished // Block until all sends/receives have been finished
if (Pstream::defaultCommsType == Pstream::nonBlocking) if (Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking)
{ {
IPstream::waitRequests(); IPstream::waitRequests();
OPstream::waitRequests(); OPstream::waitRequests();
@ -129,7 +129,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = this->patchSchedule(); const lduSchedule& patchSchedule = this->patchSchedule();
@ -148,7 +148,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
Pstream::scheduled Pstream::commsTypes::scheduled
); );
} }
else else
@ -159,7 +159,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
Pstream::scheduled Pstream::commsTypes::scheduled
); );
} }
} }
@ -182,7 +182,7 @@ void Foam::LduMatrix<Type, DType, LUType>::updateMatrixInterfaces
psiif, psiif,
interfaceCoeffs[interfacei], interfaceCoeffs[interfacei],
//Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]), //Amultiplier<Type, LUType>(interfaceCoeffs[interfacei]),
Pstream::blocking Pstream::commsTypes::blocking
); );
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,7 +38,11 @@ void Foam::processorLduInterface::send
{ {
label nBytes = f.byteSize(); label nBytes = f.byteSize();
if (commsType == Pstream::blocking || commsType == Pstream::scheduled) if
(
commsType == Pstream::commsTypes::blocking
|| commsType == Pstream::commsTypes::scheduled
)
{ {
OPstream::write OPstream::write
( (
@ -50,7 +54,7 @@ void Foam::processorLduInterface::send
comm() comm()
); );
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::commsTypes::nonBlocking)
{ {
resizeBuf(receiveBuf_, nBytes); resizeBuf(receiveBuf_, nBytes);
@ -80,7 +84,7 @@ void Foam::processorLduInterface::send
else else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unsupported communications type " << commsType << "Unsupported communications type " << int(commsType)
<< exit(FatalError); << exit(FatalError);
} }
} }
@ -93,7 +97,11 @@ void Foam::processorLduInterface::receive
UList<Type>& f UList<Type>& f
) const ) const
{ {
if (commsType == Pstream::blocking || commsType == Pstream::scheduled) if
(
commsType == Pstream::commsTypes::blocking
|| commsType == Pstream::commsTypes::scheduled
)
{ {
IPstream::read IPstream::read
( (
@ -105,14 +113,14 @@ void Foam::processorLduInterface::receive
comm() comm()
); );
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::commsTypes::nonBlocking)
{ {
memcpy(f.begin(), receiveBuf_.begin(), f.byteSize()); memcpy(f.begin(), receiveBuf_.begin(), f.byteSize());
} }
else else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unsupported communications type " << commsType << "Unsupported communications type " << int(commsType)
<< exit(FatalError); << exit(FatalError);
} }
} }
@ -158,7 +166,11 @@ void Foam::processorLduInterface::compressedSend
reinterpret_cast<Type&>(fArray[nm1]) = f.last(); reinterpret_cast<Type&>(fArray[nm1]) = f.last();
if (commsType == Pstream::blocking || commsType == Pstream::scheduled) if
(
commsType == Pstream::commsTypes::blocking
|| commsType == Pstream::commsTypes::scheduled
)
{ {
OPstream::write OPstream::write
( (
@ -170,7 +182,7 @@ void Foam::processorLduInterface::compressedSend
comm() comm()
); );
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::commsTypes::nonBlocking)
{ {
resizeBuf(receiveBuf_, nBytes); resizeBuf(receiveBuf_, nBytes);
@ -197,7 +209,7 @@ void Foam::processorLduInterface::compressedSend
else else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unsupported communications type " << commsType << "Unsupported communications type " << int(commsType)
<< exit(FatalError); << exit(FatalError);
} }
} }
@ -222,7 +234,11 @@ void Foam::processorLduInterface::compressedReceive
label nFloats = nm1 + nlast; label nFloats = nm1 + nlast;
label nBytes = nFloats*sizeof(float); label nBytes = nFloats*sizeof(float);
if (commsType == Pstream::blocking || commsType == Pstream::scheduled) if
(
commsType == Pstream::commsTypes::blocking
|| commsType == Pstream::commsTypes::scheduled
)
{ {
resizeBuf(receiveBuf_, nBytes); resizeBuf(receiveBuf_, nBytes);
@ -236,10 +252,10 @@ void Foam::processorLduInterface::compressedReceive
comm() comm()
); );
} }
else if (commsType != Pstream::nonBlocking) else if (commsType != Pstream::commsTypes::nonBlocking)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unsupported communications type " << commsType << "Unsupported communications type " << int(commsType)
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,8 +38,8 @@ void Foam::lduMatrix::initMatrixInterfaces
{ {
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
forAll(interfaces, interfacei) forAll(interfaces, interfacei)
@ -57,7 +57,7 @@ void Foam::lduMatrix::initMatrixInterfaces
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = this->patchSchedule(); const lduSchedule& patchSchedule = this->patchSchedule();
@ -78,7 +78,7 @@ void Foam::lduMatrix::initMatrixInterfaces
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
Pstream::blocking Pstream::commsTypes::blocking
); );
} }
} }
@ -102,7 +102,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
const direction cmpt const direction cmpt
) const ) const
{ {
if (Pstream::defaultCommsType == Pstream::blocking) if (Pstream::defaultCommsType == Pstream::commsTypes::blocking)
{ {
forAll(interfaces, interfacei) forAll(interfaces, interfacei)
{ {
@ -119,7 +119,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::nonBlocking) else if (Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking)
{ {
// Try and consume interfaces as they become available // Try and consume interfaces as they become available
bool allUpdated = false; bool allUpdated = false;
@ -198,7 +198,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = this->patchSchedule(); const lduSchedule& patchSchedule = this->patchSchedule();
@ -217,7 +217,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
Pstream::scheduled Pstream::commsTypes::scheduled
); );
} }
else else
@ -228,7 +228,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
Pstream::scheduled Pstream::commsTypes::scheduled
); );
} }
} }
@ -251,7 +251,7 @@ void Foam::lduMatrix::updateMatrixInterfaces
psiif, psiif,
coupleCoeffs[interfacei], coupleCoeffs[interfacei],
cmpt, cmpt,
Pstream::blocking Pstream::commsTypes::blocking
); );
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -279,7 +279,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
{ {
fineInterfaces[inti].initInternalFieldTransfer fineInterfaces[inti].initInternalFieldTransfer
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
restrictMap restrictMap
); );
} }
@ -322,7 +322,7 @@ void Foam::GAMGAgglomeration::agglomerateLduAddressing
fineInterfaces[inti].interfaceInternalField(restrictMap), fineInterfaces[inti].interfaceInternalField(restrictMap),
fineInterfaces[inti].internalFieldTransfer fineInterfaces[inti].internalFieldTransfer
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
restrictMap restrictMap
), ),
fineLevelIndex, fineLevelIndex,
@ -488,7 +488,7 @@ void Foam::GAMGAgglomeration::procAgglomerateRestrictAddressing
procRestrictAddressing, procRestrictAddressing,
UPstream::msgType(), UPstream::msgType(),
Pstream::nonBlocking //Pstream::scheduled Pstream::commsTypes::nonBlocking //Pstream::commsTypes::scheduled
); );
@ -645,7 +645,7 @@ void Foam::GAMGAgglomeration::combineLevels(const label curLevel)
// label& slaveVal = vals[i]; // label& slaveVal = vals[i];
// IPstream::read // IPstream::read
// ( // (
// Pstream::scheduled, // Pstream::commsTypes::scheduled,
// procIDs[i], // procIDs[i],
// reinterpret_cast<char*>(&slaveVal), // reinterpret_cast<char*>(&slaveVal),
// sizeof(slaveVal), // sizeof(slaveVal),
@ -658,7 +658,7 @@ void Foam::GAMGAgglomeration::combineLevels(const label curLevel)
// { // {
// OPstream::write // OPstream::write
// ( // (
// Pstream::scheduled, // Pstream::commsTypes::scheduled,
// procIDs[0], // procIDs[0],
// reinterpret_cast<const char*>(&myVal), // reinterpret_cast<const char*>(&myVal),
// sizeof(myVal), // sizeof(myVal),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,7 +48,7 @@ void Foam::GAMGAgglomeration::gatherList
{ {
IPstream fromSlave IPstream fromSlave
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
procIDs[i], procIDs[i],
0, 0,
tag, tag,
@ -62,7 +62,7 @@ void Foam::GAMGAgglomeration::gatherList
{ {
OPstream toMaster OPstream toMaster
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
procIDs[0], procIDs[0],
0, 0,
tag, tag,
@ -128,7 +128,7 @@ void Foam::GAMGAgglomeration::restrictField
procIDs, procIDs,
cf, cf,
UPstream::msgType(), UPstream::msgType(),
Pstream::nonBlocking //Pstream::scheduled Pstream::commsTypes::nonBlocking //Pstream::commsTypes::scheduled
); );
} }
} }
@ -201,7 +201,7 @@ void Foam::GAMGAgglomeration::prolongField
cf, cf,
allCf, allCf,
UPstream::msgType(), UPstream::msgType(),
Pstream::nonBlocking //Pstream::scheduled Pstream::commsTypes::nonBlocking //Pstream::commsTypes::scheduled
); );
forAll(fineToCoarse, i) forAll(fineToCoarse, i)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -150,7 +150,7 @@ Foam::labelListList Foam::GAMGProcAgglomeration::globalCellCells
{ {
interfaces[inti].initInternalFieldTransfer interfaces[inti].initInternalFieldTransfer
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
globalIndices globalIndices
); );
} }
@ -172,7 +172,7 @@ Foam::labelListList Foam::GAMGProcAgglomeration::globalCellCells
( (
interfaces[inti].internalFieldTransfer interfaces[inti].internalFieldTransfer
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
globalIndices globalIndices
) )
) )

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -318,7 +318,7 @@ void Foam::GAMGSolver::gatherMatrices
IPstream fromSlave IPstream fromSlave
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
procIDs[proci], procIDs[proci],
0, // bufSize 0, // bufSize
Pstream::msgType(), Pstream::msgType(),
@ -387,7 +387,7 @@ void Foam::GAMGSolver::gatherMatrices
OPstream toMaster OPstream toMaster
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
procIDs[0], procIDs[0],
0, 0,
Pstream::msgType(), Pstream::msgType(),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,7 +67,7 @@ void Foam::GAMGSolver::scale
vector2D scalingVector(scalingFactorNum, scalingFactorDenom); vector2D scalingVector(scalingFactorNum, scalingFactorDenom);
A.mesh().reduce(scalingVector, sumOp<vector2D>()); A.mesh().reduce(scalingVector, sumOp<vector2D>());
scalar sf = scalingVector.x()/stabilise(scalingVector.y(), VSMALL); const scalar sf = scalingVector.x()/stabilise(scalingVector.y(), VSMALL);
if (debug >= 2) if (debug >= 2)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -104,14 +104,18 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
procInterface_.interfaceInternalField(psiInternal, scalarSendBuf_); procInterface_.interfaceInternalField(psiInternal, scalarSendBuf_);
if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer) if
(
commsType == Pstream::commsTypes::nonBlocking
&& !Pstream::floatTransfer
)
{ {
// Fast path. // Fast path.
scalarReceiveBuf_.setSize(scalarSendBuf_.size()); scalarReceiveBuf_.setSize(scalarSendBuf_.size());
outstandingRecvRequest_ = UPstream::nRequests(); outstandingRecvRequest_ = UPstream::nRequests();
IPstream::read IPstream::read
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
reinterpret_cast<char*>(scalarReceiveBuf_.begin()), reinterpret_cast<char*>(scalarReceiveBuf_.begin()),
scalarReceiveBuf_.byteSize(), scalarReceiveBuf_.byteSize(),
@ -122,7 +126,7 @@ void Foam::processorGAMGInterfaceField::initInterfaceMatrixUpdate
outstandingSendRequest_ = UPstream::nRequests(); outstandingSendRequest_ = UPstream::nRequests();
OPstream::write OPstream::write
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
procInterface_.neighbProcNo(), procInterface_.neighbProcNo(),
reinterpret_cast<const char*>(scalarSendBuf_.begin()), reinterpret_cast<const char*>(scalarSendBuf_.begin()),
scalarSendBuf_.byteSize(), scalarSendBuf_.byteSize(),
@ -160,7 +164,11 @@ void Foam::processorGAMGInterfaceField::updateInterfaceMatrix
const labelUList& faceCells = procInterface_.faceCells(); const labelUList& faceCells = procInterface_.faceCells();
if (commsType == Pstream::nonBlocking && !Pstream::floatTransfer) if
(
commsType == Pstream::commsTypes::nonBlocking
&& !Pstream::floatTransfer
)
{ {
// Fast path. // Fast path.
if if

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,6 +31,9 @@ namespace Foam
{ {
defineTypeNameAndDebug(PBiCGStab, 0); defineTypeNameAndDebug(PBiCGStab, 0);
lduMatrix::solver::addsymMatrixConstructorToTable<PBiCGStab>
addPBiCGStabSymMatrixConstructorToTable_;
lduMatrix::solver::addasymMatrixConstructorToTable<PBiCGStab> lduMatrix::solver::addasymMatrixConstructorToTable<PBiCGStab>
addPBiCGStabAsymMatrixConstructorToTable_; addPBiCGStabAsymMatrixConstructorToTable_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -142,6 +142,9 @@ public:
//- Return const object pointer //- Return const object pointer
inline const T* operator->() const; inline const T* operator->() const;
//- Take over the object pointer from parameter
inline void operator=(T*);
//- Take over the object pointer from parameter //- Take over the object pointer from parameter
inline void operator=(const autoPtr<T>&); inline void operator=(const autoPtr<T>&);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -218,6 +218,13 @@ inline const T* Foam::autoPtr<T>::operator->() const
} }
template<class T>
inline void Foam::autoPtr<T>::operator=(T* p)
{
reset(p);
}
template<class T> template<class T>
inline void Foam::autoPtr<T>::operator=(const autoPtr<T>& ap) inline void Foam::autoPtr<T>::operator=(const autoPtr<T>& ap)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -124,7 +124,11 @@ Foam::ProcessorTopology<Container, ProcPatch>::ProcessorTopology
Pstream::scatterList(*this, Pstream::msgType(), comm); Pstream::scatterList(*this, Pstream::msgType(), comm);
} }
if (Pstream::parRun() && Pstream::defaultCommsType == Pstream::scheduled) if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::commsTypes::scheduled
)
{ {
label patchEvali = 0; label patchEvali = 0;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -993,7 +993,7 @@ void Foam::lduPrimitiveMesh::gather
IPstream fromSlave IPstream fromSlave
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
procIDs[i], procIDs[i],
0, // bufSize 0, // bufSize
Pstream::msgType(), Pstream::msgType(),
@ -1066,7 +1066,7 @@ void Foam::lduPrimitiveMesh::gather
OPstream toMaster OPstream toMaster
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
procIDs[0], procIDs[0],
0, 0,
Pstream::msgType(), Pstream::msgType(),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -80,8 +80,8 @@ void Foam::pointBoundaryMesh::calcGeometry()
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
forAll(*this, patchi) forAll(*this, patchi)
@ -96,7 +96,7 @@ void Foam::pointBoundaryMesh::calcGeometry()
operator[](patchi).calcGeometry(pBufs); operator[](patchi).calcGeometry(pBufs);
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
@ -126,8 +126,8 @@ void Foam::pointBoundaryMesh::movePoints(const pointField& p)
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
forAll(*this, patchi) forAll(*this, patchi)
@ -142,7 +142,7 @@ void Foam::pointBoundaryMesh::movePoints(const pointField& p)
operator[](patchi).movePoints(pBufs, p); operator[](patchi).movePoints(pBufs, p);
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
@ -172,8 +172,8 @@ void Foam::pointBoundaryMesh::updateMesh()
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
forAll(*this, patchi) forAll(*this, patchi)
@ -188,7 +188,7 @@ void Foam::pointBoundaryMesh::updateMesh()
operator[](patchi).updateMesh(pBufs); operator[](patchi).updateMesh(pBufs);
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -161,7 +161,8 @@ public:
const UList<Type>& fld, const UList<Type>& fld,
List<Type>& allFld, List<Type>& allFld,
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),
const Pstream::commsTypes commsType=Pstream::nonBlocking const Pstream::commsTypes commsType =
Pstream::commsTypes::nonBlocking
); );
//- Collect data in processor order on master (== procIDs[0]). //- Collect data in processor order on master (== procIDs[0]).
@ -174,7 +175,8 @@ public:
const UList<Type>& fld, const UList<Type>& fld,
List<Type>& allFld, List<Type>& allFld,
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),
const Pstream::commsTypes commsType=Pstream::nonBlocking const Pstream::commsTypes commsType =
Pstream::commsTypes::nonBlocking
) const ) const
{ {
gather(offsets_, comm, procIDs, fld, allFld, tag, commsType); gather(offsets_, comm, procIDs, fld, allFld, tag, commsType);
@ -190,7 +192,8 @@ public:
const labelList& procIDs, const labelList& procIDs,
List<Type>& fld, List<Type>& fld,
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),
const Pstream::commsTypes commsType=Pstream::nonBlocking const Pstream::commsTypes commsType =
Pstream::commsTypes::nonBlocking
); );
//- Inplace collect data in processor order on master //- Inplace collect data in processor order on master
@ -202,7 +205,8 @@ public:
const labelList& procIDs, const labelList& procIDs,
List<Type>& fld, List<Type>& fld,
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),
const Pstream::commsTypes commsType=Pstream::nonBlocking const Pstream::commsTypes commsType =
Pstream::commsTypes::nonBlocking
) const ) const
{ {
gather(offsets_, comm, procIDs, fld, tag, commsType); gather(offsets_, comm, procIDs, fld, tag, commsType);
@ -218,7 +222,8 @@ public:
const UList<Type>& allFld, const UList<Type>& allFld,
UList<Type>& fld, UList<Type>& fld,
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),
const Pstream::commsTypes commsType=Pstream::nonBlocking const Pstream::commsTypes commsType =
Pstream::commsTypes::nonBlocking
); );
//- Distribute data in processor order. Requires fld to be sized! //- Distribute data in processor order. Requires fld to be sized!
@ -230,7 +235,8 @@ public:
const UList<Type>& allFld, const UList<Type>& allFld,
UList<Type>& fld, UList<Type>& fld,
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),
const Pstream::commsTypes commsType=Pstream::nonBlocking const Pstream::commsTypes commsType =
Pstream::commsTypes::nonBlocking
) const ) const
{ {
scatter(offsets_, comm, procIDs, allFld, fld, tag, commsType); scatter(offsets_, comm, procIDs, allFld, fld, tag, commsType);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -46,7 +46,11 @@ void Foam::globalIndex::gather
// Assign my local data // Assign my local data
SubList<Type>(allFld, fld.size(), 0) = fld; SubList<Type>(allFld, fld.size(), 0) = fld;
if (commsType == Pstream::scheduled || commsType == Pstream::blocking) if
(
commsType == Pstream::commsTypes::scheduled
|| commsType == Pstream::commsTypes::blocking
)
{ {
for (label i = 1; i < procIDs.size(); i++) for (label i = 1; i < procIDs.size(); i++)
{ {
@ -113,7 +117,11 @@ void Foam::globalIndex::gather
} }
else else
{ {
if (commsType == Pstream::scheduled || commsType == Pstream::blocking) if
(
commsType == Pstream::commsTypes::scheduled
|| commsType == Pstream::commsTypes::blocking
)
{ {
if (contiguous<Type>()) if (contiguous<Type>())
{ {
@ -209,7 +217,11 @@ void Foam::globalIndex::scatter
{ {
fld.deepCopy(SubList<Type>(allFld, off[1]-off[0])); fld.deepCopy(SubList<Type>(allFld, off[1]-off[0]));
if (commsType == Pstream::scheduled || commsType == Pstream::blocking) if
(
commsType == Pstream::commsTypes::scheduled
|| commsType == Pstream::commsTypes::blocking
)
{ {
for (label i = 1; i < procIDs.size(); i++) for (label i = 1; i < procIDs.size(); i++)
{ {
@ -286,7 +298,11 @@ void Foam::globalIndex::scatter
} }
else else
{ {
if (commsType == Pstream::scheduled || commsType == Pstream::blocking) if
(
commsType == Pstream::commsTypes::scheduled
|| commsType == Pstream::commsTypes::blocking
)
{ {
if (contiguous<Type>()) if (contiguous<Type>())
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,7 @@ void Foam::globalMeshData::initProcAddr()
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Send indices of my processor patches to my neighbours // Send indices of my processor patches to my neighbours
forAll(processorPatches_, i) forAll(processorPatches_, i)
@ -401,7 +401,7 @@ void Foam::globalMeshData::calcSharedEdges() const
) )
{ {
// Receive the edges using shared points from the slave. // Receive the edges using shared points from the slave.
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::commsTypes::blocking, slave);
EdgeMap<labelList> procSharedEdges(fromSlave); EdgeMap<labelList> procSharedEdges(fromSlave);
if (debug) if (debug)
@ -450,7 +450,7 @@ void Foam::globalMeshData::calcSharedEdges() const
) )
{ {
// Receive the edges using shared points from the slave. // Receive the edges using shared points from the slave.
OPstream toSlave(Pstream::blocking, slave); OPstream toSlave(Pstream::commsTypes::blocking, slave);
toSlave << globalShared; toSlave << globalShared;
} }
} }
@ -459,14 +459,20 @@ void Foam::globalMeshData::calcSharedEdges() const
{ {
// Send local edges to master // Send local edges to master
{ {
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
toMaster << localShared; toMaster << localShared;
} }
// Receive merged edges from master. // Receive merged edges from master.
{ {
IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); IPstream fromMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
fromMaster >> globalShared; fromMaster >> globalShared;
} }
} }
@ -1920,7 +1926,7 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::commsTypes::blocking, slave);
labelList nbrSharedPointAddr; labelList nbrSharedPointAddr;
pointField nbrSharedPoints; pointField nbrSharedPoints;
@ -1944,7 +1950,7 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const
{ {
OPstream toSlave OPstream toSlave
( (
Pstream::blocking, Pstream::commsTypes::blocking,
slave, slave,
sharedPoints.size()*sizeof(Zero) sharedPoints.size()*sizeof(Zero)
); );
@ -1956,8 +1962,11 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const
// Slave: // Slave:
// send points // send points
{ {
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
toMaster toMaster
<< pointAddr << pointAddr
<< UIndirectList<point>(mesh_.points(), pointLabels)(); << UIndirectList<point>(mesh_.points(), pointLabels)();
@ -1965,7 +1974,11 @@ Foam::pointField Foam::globalMeshData::sharedPoints() const
// Receive sharedPoints // Receive sharedPoints
{ {
IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); IPstream fromMaster
(
Pstream::commsTypes::blocking,
Pstream::masterNo()
);
fromMaster >> sharedPoints; fromMaster >> sharedPoints;
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -901,8 +901,8 @@ void Foam::globalPoints::calculateSharedPoints
PstreamBuffers pBufs PstreamBuffers pBufs
( (
( (
Pstream::defaultCommsType == Pstream::scheduled Pstream::defaultCommsType == Pstream::commsTypes::scheduled
? Pstream::nonBlocking ? Pstream::commsTypes::nonBlocking
: Pstream::defaultCommsType : Pstream::defaultCommsType
) )
); );
@ -939,8 +939,8 @@ void Foam::globalPoints::calculateSharedPoints
PstreamBuffers pBufs PstreamBuffers pBufs
( (
( (
Pstream::defaultCommsType == Pstream::scheduled Pstream::defaultCommsType == Pstream::commsTypes::scheduled
? Pstream::nonBlocking ? Pstream::commsTypes::nonBlocking
: Pstream::defaultCommsType : Pstream::defaultCommsType
) )
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -84,7 +84,7 @@ Foam::List<Foam::labelPair> Foam::mapDistributeBase::schedule
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::scheduled, slave, 0, tag); IPstream fromSlave(Pstream::commsTypes::scheduled, slave, 0, tag);
List<labelPair> nbrData(fromSlave); List<labelPair> nbrData(fromSlave);
forAll(nbrData, i) forAll(nbrData, i)
@ -105,20 +105,26 @@ Foam::List<Foam::labelPair> Foam::mapDistributeBase::schedule
slave++ slave++
) )
{ {
OPstream toSlave(Pstream::scheduled, slave, 0, tag); OPstream toSlave(Pstream::commsTypes::scheduled, slave, 0, tag);
toSlave << allComms; toSlave << allComms;
} }
} }
else else
{ {
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo(), 0, tag); OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo(),
0,
tag
);
toMaster << allComms; toMaster << allComms;
} }
{ {
IPstream fromMaster IPstream fromMaster
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
Pstream::masterNo(), Pstream::masterNo(),
0, 0,
tag tag
@ -861,7 +867,7 @@ void Foam::mapDistributeBase::compact(const boolList& elemIsUsed, const int tag)
recvFields[domain].setSize(map.size()); recvFields[domain].setSize(map.size());
IPstream::read IPstream::read
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
domain, domain,
reinterpret_cast<char*>(recvFields[domain].begin()), reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].size()*sizeof(bool), recvFields[domain].size()*sizeof(bool),
@ -894,7 +900,7 @@ void Foam::mapDistributeBase::compact(const boolList& elemIsUsed, const int tag)
OPstream::write OPstream::write
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
domain, domain,
reinterpret_cast<const char*>(subField.begin()), reinterpret_cast<const char*>(subField.begin()),
subField.size()*sizeof(bool), subField.size()*sizeof(bool),
@ -1028,7 +1034,7 @@ void Foam::mapDistributeBase::compact
recvFields[domain].setSize(map.size()); recvFields[domain].setSize(map.size());
IPstream::read IPstream::read
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
domain, domain,
reinterpret_cast<char*>(recvFields[domain].begin()), reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].size()*sizeof(bool), recvFields[domain].size()*sizeof(bool),
@ -1060,7 +1066,7 @@ void Foam::mapDistributeBase::compact
OPstream::write OPstream::write
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
domain, domain,
reinterpret_cast<const char*>(subField.begin()), reinterpret_cast<const char*>(subField.begin()),
subField.size()*sizeof(bool), subField.size()*sizeof(bool),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -364,8 +364,9 @@ public:
const int tag = UPstream::msgType() const int tag = UPstream::msgType()
); );
//- Distribute data. Note:schedule only used for Pstream::scheduled //- Distribute data. Note:schedule only used for
// for now, all others just use send-to-all, receive-from-all. // Pstream::commsTypes::scheduled for now, all others just use
// send-to-all, receive-from-all.
template<class T, class negateOp> template<class T, class negateOp>
static void distribute static void distribute
( (

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -159,7 +159,7 @@ void Foam::mapDistributeBase::distribute
return; return;
} }
if (commsType == Pstream::blocking) if (commsType == Pstream::commsTypes::blocking)
{ {
// Since buffered sending can reuse the field to collect the // Since buffered sending can reuse the field to collect the
// received data. // received data.
@ -171,7 +171,7 @@ void Foam::mapDistributeBase::distribute
if (domain != Pstream::myProcNo() && map.size()) if (domain != Pstream::myProcNo() && map.size())
{ {
OPstream toNbr(Pstream::blocking, domain, 0, tag); OPstream toNbr(Pstream::commsTypes::blocking, domain, 0, tag);
List<T> subField(map.size()); List<T> subField(map.size());
forAll(subField, i) forAll(subField, i)
@ -219,7 +219,7 @@ void Foam::mapDistributeBase::distribute
if (domain != Pstream::myProcNo() && map.size()) if (domain != Pstream::myProcNo() && map.size())
{ {
IPstream fromNbr(Pstream::blocking, domain, 0, tag); IPstream fromNbr(Pstream::commsTypes::blocking, domain, 0, tag);
List<T> subField(fromNbr); List<T> subField(fromNbr);
checkReceivedSize(domain, map.size(), subField.size()); checkReceivedSize(domain, map.size(), subField.size());
@ -236,7 +236,7 @@ void Foam::mapDistributeBase::distribute
} }
} }
} }
else if (commsType == Pstream::scheduled) else if (commsType == Pstream::commsTypes::scheduled)
{ {
// Need to make sure I don't overwrite field with received data // Need to make sure I don't overwrite field with received data
// since the data might need to be sent to another processor. So // since the data might need to be sent to another processor. So
@ -285,7 +285,13 @@ void Foam::mapDistributeBase::distribute
{ {
// I am send first, receive next // I am send first, receive next
{ {
OPstream toNbr(Pstream::scheduled, recvProc, 0, tag); OPstream toNbr
(
Pstream::commsTypes::scheduled,
recvProc,
0,
tag
);
const labelList& map = subMap[recvProc]; const labelList& map = subMap[recvProc];
List<T> subField(map.size()); List<T> subField(map.size());
@ -302,7 +308,13 @@ void Foam::mapDistributeBase::distribute
toNbr << subField; toNbr << subField;
} }
{ {
IPstream fromNbr(Pstream::scheduled, recvProc, 0, tag); IPstream fromNbr
(
Pstream::commsTypes::scheduled,
recvProc,
0,
tag
);
List<T> subField(fromNbr); List<T> subField(fromNbr);
const labelList& map = constructMap[recvProc]; const labelList& map = constructMap[recvProc];
@ -324,7 +336,13 @@ void Foam::mapDistributeBase::distribute
{ {
// I am receive first, send next // I am receive first, send next
{ {
IPstream fromNbr(Pstream::scheduled, sendProc, 0, tag); IPstream fromNbr
(
Pstream::commsTypes::scheduled,
sendProc,
0,
tag
);
List<T> subField(fromNbr); List<T> subField(fromNbr);
const labelList& map = constructMap[sendProc]; const labelList& map = constructMap[sendProc];
@ -342,7 +360,13 @@ void Foam::mapDistributeBase::distribute
); );
} }
{ {
OPstream toNbr(Pstream::scheduled, sendProc, 0, tag); OPstream toNbr
(
Pstream::commsTypes::scheduled,
sendProc,
0,
tag
);
const labelList& map = subMap[sendProc]; const labelList& map = subMap[sendProc];
List<T> subField(map.size()); List<T> subField(map.size());
@ -362,13 +386,13 @@ void Foam::mapDistributeBase::distribute
} }
field.transfer(newField); field.transfer(newField);
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::commsTypes::nonBlocking)
{ {
label nOutstanding = Pstream::nRequests(); label nOutstanding = Pstream::nRequests();
if (!contiguous<T>()) if (!contiguous<T>())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking, tag); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking, tag);
// Stream data into buffer // Stream data into buffer
for (label domain = 0; domain < Pstream::nProcs(); domain++) for (label domain = 0; domain < Pstream::nProcs(); domain++)
@ -484,7 +508,7 @@ void Foam::mapDistributeBase::distribute
OPstream::write OPstream::write
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
domain, domain,
reinterpret_cast<const char*>(subField.begin()), reinterpret_cast<const char*>(subField.begin()),
subField.byteSize(), subField.byteSize(),
@ -506,7 +530,7 @@ void Foam::mapDistributeBase::distribute
recvFields[domain].setSize(map.size()); recvFields[domain].setSize(map.size());
IPstream::read IPstream::read
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
domain, domain,
reinterpret_cast<char*>(recvFields[domain].begin()), reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].byteSize(), recvFields[domain].byteSize(),
@ -591,7 +615,7 @@ void Foam::mapDistributeBase::distribute
else else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unknown communication schedule " << commsType << "Unknown communication schedule " << int(commsType)
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -638,7 +662,7 @@ void Foam::mapDistributeBase::distribute
return; return;
} }
if (commsType == Pstream::blocking) if (commsType == Pstream::commsTypes::blocking)
{ {
// Since buffered sending can reuse the field to collect the // Since buffered sending can reuse the field to collect the
// received data. // received data.
@ -650,7 +674,7 @@ void Foam::mapDistributeBase::distribute
if (domain != Pstream::myProcNo() && map.size()) if (domain != Pstream::myProcNo() && map.size())
{ {
OPstream toNbr(Pstream::blocking, domain, 0, tag); OPstream toNbr(Pstream::commsTypes::blocking, domain, 0, tag);
List<T> subField(map.size()); List<T> subField(map.size());
forAll(subField, i) forAll(subField, i)
{ {
@ -690,7 +714,7 @@ void Foam::mapDistributeBase::distribute
if (domain != Pstream::myProcNo() && map.size()) if (domain != Pstream::myProcNo() && map.size())
{ {
IPstream fromNbr(Pstream::blocking, domain, 0, tag); IPstream fromNbr(Pstream::commsTypes::blocking, domain, 0, tag);
List<T> subField(fromNbr); List<T> subField(fromNbr);
checkReceivedSize(domain, map.size(), subField.size()); checkReceivedSize(domain, map.size(), subField.size());
@ -707,7 +731,7 @@ void Foam::mapDistributeBase::distribute
} }
} }
} }
else if (commsType == Pstream::scheduled) else if (commsType == Pstream::commsTypes::scheduled)
{ {
// Need to make sure I don't overwrite field with received data // Need to make sure I don't overwrite field with received data
// since the data might need to be sent to another processor. So // since the data might need to be sent to another processor. So
@ -759,7 +783,13 @@ void Foam::mapDistributeBase::distribute
{ {
// I am send first, receive next // I am send first, receive next
{ {
OPstream toNbr(Pstream::scheduled, recvProc, 0, tag); OPstream toNbr
(
Pstream::commsTypes::scheduled,
recvProc,
0,
tag
);
const labelList& map = subMap[recvProc]; const labelList& map = subMap[recvProc];
@ -777,7 +807,13 @@ void Foam::mapDistributeBase::distribute
toNbr << subField; toNbr << subField;
} }
{ {
IPstream fromNbr(Pstream::scheduled, recvProc, 0, tag); IPstream fromNbr
(
Pstream::commsTypes::scheduled,
recvProc,
0,
tag
);
List<T> subField(fromNbr); List<T> subField(fromNbr);
const labelList& map = constructMap[recvProc]; const labelList& map = constructMap[recvProc];
@ -798,7 +834,13 @@ void Foam::mapDistributeBase::distribute
{ {
// I am receive first, send next // I am receive first, send next
{ {
IPstream fromNbr(Pstream::scheduled, sendProc, 0, tag); IPstream fromNbr
(
Pstream::commsTypes::scheduled,
sendProc,
0,
tag
);
List<T> subField(fromNbr); List<T> subField(fromNbr);
const labelList& map = constructMap[sendProc]; const labelList& map = constructMap[sendProc];
@ -815,7 +857,13 @@ void Foam::mapDistributeBase::distribute
); );
} }
{ {
OPstream toNbr(Pstream::scheduled, sendProc, 0, tag); OPstream toNbr
(
Pstream::commsTypes::scheduled,
sendProc,
0,
tag
);
const labelList& map = subMap[sendProc]; const labelList& map = subMap[sendProc];
@ -836,13 +884,13 @@ void Foam::mapDistributeBase::distribute
} }
field.transfer(newField); field.transfer(newField);
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::commsTypes::nonBlocking)
{ {
label nOutstanding = Pstream::nRequests(); label nOutstanding = Pstream::nRequests();
if (!contiguous<T>()) if (!contiguous<T>())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking, tag); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking, tag);
// Stream data into buffer // Stream data into buffer
for (label domain = 0; domain < Pstream::nProcs(); domain++) for (label domain = 0; domain < Pstream::nProcs(); domain++)
@ -961,7 +1009,7 @@ void Foam::mapDistributeBase::distribute
OPstream::write OPstream::write
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
domain, domain,
reinterpret_cast<const char*>(subField.begin()), reinterpret_cast<const char*>(subField.begin()),
subField.size()*sizeof(T), subField.size()*sizeof(T),
@ -983,7 +1031,7 @@ void Foam::mapDistributeBase::distribute
recvFields[domain].setSize(map.size()); recvFields[domain].setSize(map.size());
UIPstream::read UIPstream::read
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
domain, domain,
reinterpret_cast<char*>(recvFields[domain].begin()), reinterpret_cast<char*>(recvFields[domain].begin()),
recvFields[domain].size()*sizeof(T), recvFields[domain].size()*sizeof(T),
@ -1067,7 +1115,7 @@ void Foam::mapDistributeBase::distribute
else else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unknown communication schedule " << commsType << "Unknown communication schedule " << int(commsType)
<< abort(FatalError); << abort(FatalError);
} }
} }
@ -1155,11 +1203,11 @@ void Foam::mapDistributeBase::distribute
const int tag const int tag
) const ) const
{ {
if (Pstream::defaultCommsType == Pstream::nonBlocking) if (Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking)
{ {
distribute distribute
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
List<labelPair>(), List<labelPair>(),
constructSize_, constructSize_,
subMap_, subMap_,
@ -1171,11 +1219,11 @@ void Foam::mapDistributeBase::distribute
tag tag
); );
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
distribute distribute
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
schedule(), schedule(),
constructSize_, constructSize_,
subMap_, subMap_,
@ -1191,7 +1239,7 @@ void Foam::mapDistributeBase::distribute
{ {
distribute distribute
( (
Pstream::blocking, Pstream::commsTypes::blocking,
List<labelPair>(), List<labelPair>(),
constructSize_, constructSize_,
subMap_, subMap_,
@ -1245,11 +1293,11 @@ void Foam::mapDistributeBase::reverseDistribute
const int tag const int tag
) const ) const
{ {
if (Pstream::defaultCommsType == Pstream::nonBlocking) if (Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking)
{ {
distribute distribute
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
List<labelPair>(), List<labelPair>(),
constructSize, constructSize,
constructMap_, constructMap_,
@ -1261,11 +1309,11 @@ void Foam::mapDistributeBase::reverseDistribute
tag tag
); );
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
distribute distribute
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
schedule(), schedule(),
constructSize, constructSize,
constructMap_, constructMap_,
@ -1281,7 +1329,7 @@ void Foam::mapDistributeBase::reverseDistribute
{ {
distribute distribute
( (
Pstream::blocking, Pstream::commsTypes::blocking,
List<labelPair>(), List<labelPair>(),
constructSize, constructSize,
constructMap_, constructMap_,
@ -1308,11 +1356,11 @@ void Foam::mapDistributeBase::reverseDistribute
const int tag const int tag
) const ) const
{ {
if (Pstream::defaultCommsType == Pstream::nonBlocking) if (Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking)
{ {
distribute distribute
( (
Pstream::nonBlocking, Pstream::commsTypes::nonBlocking,
List<labelPair>(), List<labelPair>(),
constructSize, constructSize,
constructMap_, constructMap_,
@ -1326,11 +1374,11 @@ void Foam::mapDistributeBase::reverseDistribute
tag tag
); );
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
distribute distribute
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
schedule(), schedule(),
constructSize, constructSize,
constructMap_, constructMap_,
@ -1348,7 +1396,7 @@ void Foam::mapDistributeBase::reverseDistribute
{ {
distribute distribute
( (
Pstream::blocking, Pstream::commsTypes::blocking,
List<labelPair>(), List<labelPair>(),
constructSize, constructSize,
constructMap_, constructMap_,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -211,8 +211,8 @@ void Foam::polyBoundaryMesh::calcGeometry()
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
forAll(*this, patchi) forAll(*this, patchi)
@ -227,7 +227,7 @@ void Foam::polyBoundaryMesh::calcGeometry()
operator[](patchi).calcGeometry(pBufs); operator[](patchi).calcGeometry(pBufs);
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
@ -998,8 +998,8 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
forAll(*this, patchi) forAll(*this, patchi)
@ -1014,7 +1014,7 @@ void Foam::polyBoundaryMesh::movePoints(const pointField& p)
operator[](patchi).movePoints(pBufs, p); operator[](patchi).movePoints(pBufs, p);
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();
@ -1048,8 +1048,8 @@ void Foam::polyBoundaryMesh::updateMesh()
if if
( (
Pstream::defaultCommsType == Pstream::blocking Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::nonBlocking || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
) )
{ {
forAll(*this, patchi) forAll(*this, patchi)
@ -1064,7 +1064,7 @@ void Foam::polyBoundaryMesh::updateMesh()
operator[](patchi).updateMesh(pBufs); operator[](patchi).updateMesh(pBufs);
} }
} }
else if (Pstream::defaultCommsType == Pstream::scheduled) else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = mesh().globalData().patchSchedule(); const lduSchedule& patchSchedule = mesh().globalData().patchSchedule();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -129,7 +129,7 @@ void Foam::syncTools::syncPointMap
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Send // Send
@ -311,7 +311,7 @@ void Foam::syncTools::syncPointMap
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
Map<T> nbrValues(fromSlave); Map<T> nbrValues(fromSlave);
// Merge neighbouring values with my values // Merge neighbouring values with my values
@ -335,7 +335,7 @@ void Foam::syncTools::syncPointMap
slave++ slave++
) )
{ {
OPstream toSlave(Pstream::scheduled, slave); OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << sharedPointValues; toSlave << sharedPointValues;
} }
} }
@ -343,14 +343,18 @@ void Foam::syncTools::syncPointMap
{ {
// Slave: send to master // Slave: send to master
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster << sharedPointValues; toMaster << sharedPointValues;
} }
// Receive merged values // Receive merged values
{ {
IPstream fromMaster IPstream fromMaster
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
Pstream::masterNo() Pstream::masterNo()
); );
fromMaster >> sharedPointValues; fromMaster >> sharedPointValues;
@ -405,7 +409,7 @@ void Foam::syncTools::syncEdgeMap
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Send // Send
@ -687,7 +691,7 @@ void Foam::syncTools::syncEdgeMap
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
EdgeMap<T> nbrValues(fromSlave); EdgeMap<T> nbrValues(fromSlave);
// Merge neighbouring values with my values // Merge neighbouring values with my values
@ -712,7 +716,7 @@ void Foam::syncTools::syncEdgeMap
) )
{ {
OPstream toSlave(Pstream::scheduled, slave); OPstream toSlave(Pstream::commsTypes::scheduled, slave);
toSlave << sharedEdgeValues; toSlave << sharedEdgeValues;
} }
} }
@ -720,12 +724,20 @@ void Foam::syncTools::syncEdgeMap
{ {
// Send to master // Send to master
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
toMaster << sharedEdgeValues; toMaster << sharedEdgeValues;
} }
// Receive merged values // Receive merged values
{ {
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo()); IPstream fromMaster
(
Pstream::commsTypes::scheduled,
Pstream::masterNo()
);
fromMaster >> sharedEdgeValues; fromMaster >> sharedEdgeValues;
} }
} }
@ -799,7 +811,7 @@ void Foam::syncTools::syncEdgeMap
// //
// if (Pstream::parRun()) // if (Pstream::parRun())
// { // {
// PstreamBuffers pBufs(Pstream::nonBlocking); // PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// //
// // Send // // Send
// //
@ -1302,7 +1314,7 @@ void Foam::syncTools::syncBoundaryFaceList
if (parRun) if (parRun)
{ {
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Send // Send
@ -1422,7 +1434,7 @@ void Foam::syncTools::syncFaceList
if (parRun) if (parRun)
{ {
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::commsTypes::nonBlocking);
// Send // Send

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -182,7 +182,7 @@ void Foam::PatchTools::gatherAndMerge
// Receive slave ones // Receive slave ones
for (int slave=1; slave<Pstream::nProcs(); slave++) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::commsTypes::scheduled, slave);
pointField slavePoints(fromSlave); pointField slavePoints(fromSlave);
List<FaceType> slaveFaces(fromSlave); List<FaceType> slaveFaces(fromSlave);
@ -210,7 +210,7 @@ void Foam::PatchTools::gatherAndMerge
// be improved. // be improved.
OPstream toMaster OPstream toMaster
( (
Pstream::scheduled, Pstream::commsTypes::scheduled,
Pstream::masterNo(), Pstream::masterNo(),
myPoints.byteSize() + 4*sizeof(label)*myFaces.size() myPoints.byteSize() + 4*sizeof(label)*myFaces.size()
); );

View File

@ -0,0 +1,84 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "OneConstant.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Function1Types::OneConstant<Type>::OneConstant(const word& entryName)
:
Function1<Type>(entryName)
{}
template<class Type>
Foam::Function1Types::OneConstant<Type>::OneConstant
(
const word& entryName,
const dictionary& dict
)
:
Function1<Type>(entryName)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Function1Types::OneConstant<Type>::~OneConstant()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::Function1Types::OneConstant<Type>::value(const scalar x) const
{
return pTraits<Type>::one;
}
template<class Type>
Type Foam::Function1Types::OneConstant<Type>::integrate
(
const scalar x1,
const scalar x2
) const
{
return (x2 - x1)*pTraits<Type>::one;
}
template<class Type>
void Foam::Function1Types::OneConstant<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Class
Foam::Function1Types::OneConstant
Description
Templated function that returns the corresponding 1 (one).
Usage:
\verbatim
<entryName> one;
\endverbatim
SourceFiles
OneConstant.C
\*---------------------------------------------------------------------------*/
#ifndef OneConstant_H
#define OneConstant_H
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace Function1Types
{
/*---------------------------------------------------------------------------*\
Class OneConstant Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class OneConstant
:
public Function1<Type>
{
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const OneConstant<Type>&);
public:
// Runtime type information
TypeName("one");
// Constructors
//- Construct from entry name
OneConstant(const word& entryName);
//- Construct from entry name and dictionary
OneConstant(const word& entryName, const dictionary& dict);
//- Construct and return a clone
virtual tmp<Function1<Type>> clone() const
{
return tmp<Function1<Type>>(new OneConstant<Type>(*this));
}
//- Destructor
virtual ~OneConstant();
// Member Functions
//- Return constant value
Type value(const scalar) const;
//- Integrate between two values
Type integrate(const scalar x1, const scalar x2) const;
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Function1Types
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "OneConstant.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "ZeroConstant.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::Function1Types::ZeroConstant<Type>::ZeroConstant
(
const word& entryName,
const dictionary& dict
)
:
Function1<Type>(entryName)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type>
Foam::Function1Types::ZeroConstant<Type>::~ZeroConstant()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Type Foam::Function1Types::ZeroConstant<Type>::value(const scalar x) const
{
return pTraits<Type>::zero;
}
template<class Type>
Type Foam::Function1Types::ZeroConstant<Type>::integrate
(
const scalar x1,
const scalar x2
) const
{
return pTraits<Type>::zero;
}
template<class Type>
void Foam::Function1Types::ZeroConstant<Type>::writeData(Ostream& os) const
{
Function1<Type>::writeData(os);
os << token::END_STATEMENT << nl;
}
// ************************************************************************* //

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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/>.
Class
Foam::Function1Types::ZeroConstant
Description
Templated function that returns the corresponding 0 (zero).
Usage:
\verbatim
<entryName> zero;
\endverbatim
SourceFiles
ZeroConstant.C
\*---------------------------------------------------------------------------*/
#ifndef ZeroConstant_H
#define ZeroConstant_H
#include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace Function1Types
{
/*---------------------------------------------------------------------------*\
Class ZeroConstant Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class ZeroConstant
:
public Function1<Type>
{
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const ZeroConstant<Type>&);
public:
// Runtime type information
TypeName("zero");
// Constructors
//- Construct from entry name and dictionary
ZeroConstant(const word& entryName, const dictionary& dict);
//- Construct and return a clzero
virtual tmp<Function1<Type>> clzero() const
{
return tmp<Function1<Type>>(new ZeroConstant<Type>(*this));
}
//- Destructor
virtual ~ZeroConstant();
// Member Functions
//- Return constant value
Type value(const scalar) const;
//- Integrate between two values
Type integrate(const scalar x1, const scalar x2) const;
//- Write in dictionary format
virtual void writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Function1Types
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "ZeroConstant.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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